$data) {
// Reverse the array
$data['revisions'] = array_reverse($data['revisions'], true);
foreach($data['revisions'] as $rev) {
$changelog[$rev]['name'] = $name;
$changelog[$rev]['colour'] = $data['colour'];
$changelog[$rev]['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 $revisionId => $revisionData) {
$changelogHTML .= '
';
$changelogHTML .= '
Revision '. $revisionId .' ('. $revisionData['name'] .')';
foreach($revisionData['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/changeLog.tpl');
// Parse tags
$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl);
$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl);
$tpl = str_replace('{{ version_type }}', SAKURA_STABLE ? 'Stable' : 'Development', $tpl);
$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl);
$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl);
// Print template
print $tpl;