$data) {
// Reverse the array
$data['builds'] = array_reverse($data['builds'], true);
foreach($data['builds'] as $build) {
$changelog[$build]['name'] = $name;
$changelog[$build]['colour'] = $data['colour'];
$changelog[$build]['changes'] = array();
}
}
// Sort changes properly
foreach($changelogFile['changelog'] as $ver => $data) {
// Reverse the array
$data = array_reverse($data, true);
// Add the log to the array
foreach($data as $id => $change)
$changelog[$ver]['changes'][$id] = $change;
}
// Add a thing to only get the json
if(isset($_REQUEST['getjson'])) {
// Print encoded json and exit
print json_encode($changelog);
exit;
}
// Create variable to store HTML in
$changelogHTML = null;
// Format HTML
foreach($changelog as $build => $buildData) {
$changelogHTML .= '
';
$changelogHTML .= '
Build '. $build .' ('. $buildData['name'] .')';
foreach($buildData['changes'] as $id => $changeData) {
$changelogHTML .= '
';
switch($changeData['type']) {
case 'ADD':
$changelogHTML .= 'Added';
break;
case 'REM':
$changelogHTML .= 'Removed';
break;
case 'FIX':
$changelogHTML .= 'Fixed';
break;
case 'UPD':
$changelogHTML .= 'Updated';
break;
default:
$changelogHTML .= 'Unknown';
}
$changelogHTML .= '';
$changelogHTML .= $changeData['change'];
$changelogHTML .= '';
$changelogHTML .= '
';
}
$changelogHTML .= '
';
}
// Get special template file
$tpl = file_get_contents(ROOT .'_sakura/templates/versionInfo.tpl');
// Parse tags
$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl);
$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl);
$tpl = str_replace('{{ version_type }}', SAKURA_VTYPE, $tpl);
$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl);
$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl);
// Print template
print $tpl;