./inc/mysql-manager.php:44:// @TODO Can we cache this?
./inc/reset/reset_beg.php:49:// @TODO This should be converted in a daily beg rallye
./inc/reset/reset_birthday.php:89: // @TODO 4 is hard-coded here, should we move it out in config?
-./inc/revision-functions.php:151:// @TODO Please describe this function
+./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array'
./inc/template-functions.php:1139: // @TODO This can be easily moved out after the merge from EL branch to this is complete
./inc/template-functions.php:1172: // @TODO Add a little more infos here
./inc/template-functions.php:1460:// @TODO Lame description for this function
} // END - if
// Generate replacer
- $replacer = sprintf("&ext=%s&ver=%s&rev={?CURR_SVN_REVISION?}", $data['matches'][4][$data['key']], $replacer);
+ $replacer = sprintf("&ext=%s&ver=%s&rev={?CURRENT_REPOSITORY_REVISION?}", $data['matches'][4][$data['key']], $replacer);
// Replace it and insert parameter for GET request
$code = replaceExpressionCode($data, $replacer);
registerFilter('init', 'INIT_EXTENSIONS');
registerFilter('init', 'SET_CURRENT_DATE');
registerFilter('init', 'INIT_RANDOM_NUMBER');
- registerFilter('init', 'CHECK_SVN_REVISION');
+ registerFilter('init', 'CHECK_REPOSITORY_REVISION');
registerFilter('init', 'RUN_DAILY_RESET');
registerFilter('init', 'TRIGGER_SENDING_POOL');
registerFilter('init', 'DETERMINE_USERNAME');
}
// Filter for checking and updating SVN revision
-function FILTER_CHECK_SVN_REVISION () {
+function FILTER_CHECK_REPOSITORY_REVISION () {
// Only execute this filter if installed and all config entries are there
if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return;
// Check for patch level differences between databases and current hard-coded
- if ((getCurrSvnRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
+ if ((getCurrentRepositoryRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURRENT_REPOSITORY_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
// Update database and CONFIG array
- updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrSvnRevision(), 'UNIX_TIMESTAMP()'));
- setConfigEntry('patch_level', getCurrSvnRevision());
+ updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()'));
+ setConfigEntry('patch_level', getCurrentRepositoryRevision());
setConfigEntry('patch_ctime', time());
} // END - if
}
'ADMIN_THEMES_UPDATED' => "Themes wurden aktualisiert.",
'ADMIN_THEMES_DELETED' => "Themes wurden gelöscht.",
'ADMIN_THEME_IMPORTED' => "Theme <span class=\"data\">%s</span> wurde importiert.",
- 'CURR_THEME_IS' => "Aktuelles Design:",
+ 'CURRENT_THEME_IS' => "Aktuelles Design:",
'ADMIN_NO_THEME_INSTALLED_WARNING' => "Kein Design installiert.",
'CHANGE_THEME' => "Design ändern",
'ADMIN_SET_AS_NEW_THEME' => "Dieses Theme als Standart-Theme setzen",
'ADMIN_ENTER_SUB_REASON' => "Grund des Abzuges",
'ADMIN_SUB_POINTS_FROM_ALL' => "Allen Mitgliedern {?POINTS?} abziehen",
'ADMIN_DOWNLOAD_SVN' => "SVN-Version herunterladen",
- 'ADMIN_SVN_REPOSITORY' => "SVN-Repository",
+ 'ADMIN_REPOSITORY' => "SVN-Repository",
'ADMIN_DOWNLOAD_NOW' => "Jetzt downloaden.",
'ADMIN_MEMBER_STATS_TITLE' => "Einstellungen an der Mitglieder-Statistik",
'ADMIN_MEMBER_STATS_LIMIT' => "Anzahl Mailbuchungen pro Seite (<strong>Nicht verwendet!</strong>)",
// Installation/setup
addMessages(array(
'ADMIN_NEW_VERSION_AVAILABLE' => "Neue Version verfügbar.",
- 'ADMIN_NO_UPDATES_AVAILABLE' => "Derzeit ist keine neuere Version als <span class=\"data\">{?FULL_VERSION?} r{?CURR_SVN_REVISION?}</span> verfügbar.",
+ 'ADMIN_NO_UPDATES_AVAILABLE' => "Derzeit ist keine neuere Version als <span class=\"data\">{?FULL_VERSION?} r{?CURRENT_REPOSITORY_REVISION?}</span> verfügbar.",
'ADMIN_YOUR_VERSION_IS' => "Installierte Version",
'ADMIN_ONLINE_VERSION_IS' => "Verfügbare Version",
'ADMIN_UPDATE_CREATE_TIME' => "Update wurde erstellt",
'ADMIN_DOWNLOAD_NEW_VERSION' => "Jetzt neue Version herunterladen.",
'ADMIN_CANNOT_CHECK_VERSION' => "Konnte Versionsnummer nicht abgleichen! (Fehlende Internet-Verbindung? Server ist down?)",
- 'ADMIN_LOCAL_REVISION_IS_NEWER_THAN_UPDATE' => "Die auf Ihrem installierte Revision <span class=\"data\">{?CURR_SVN_REVISION?}</span> ist neuer als die auf dem Server. Dies sollte nicht vorkommen, bitte melden Sie dies im Forum oder Bug-Tracker.",
+ 'ADMIN_LOCAL_REVISION_IS_NEWER_THAN_UPDATE' => "Die auf Ihrem installierte Revision <span class=\"data\">{?CURRENT_REPOSITORY_REVISION?}</span> ist neuer als die auf dem Server. Dies sollte nicht vorkommen, bitte melden Sie dies im Forum oder Bug-Tracker.",
));
// [EOF]
$GLOBALS['cache_instance']->init();
// add the new RevInfos in and saves it to the cache
- $GLOBALS['cache_instance']->addRow(getArrayFromActualVersion());
+ $GLOBALS['cache_instance']->addRow(getArrayFromRepositoryData());
// Close the cache
$GLOBALS['cache_instance']->finalize();
if (empty($ONLINE['version'])) {
// Disconnected?
loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CANNOT_CHECK_VERSION--} (' . $ONLINE['code'] . ')');
-} elseif (($ONLINE['version'] != getFullVersion()) || ($ONLINE['revision'] > getCurrSvnRevision())) {
+} elseif (($ONLINE['version'] != getFullVersion()) || ($ONLINE['revision'] > getCurrentRepositoryRevision())) {
// New full-version available (all previous released patches are included in this version!)
$ONLINE['changed'] = generateDateTime($ONLINE['changed'], 2);
// Load template
loadTemplate('admin_update_download', false, $ONLINE);
-} elseif ($ONLINE['revision'] < getCurrSvnRevision()) {
+} elseif ($ONLINE['revision'] < getCurrentRepositoryRevision()) {
// Installed revision is newer than on server
loadTemplate('admin_settings_saved', false, '{--ADMIN_LOCAL_REVISION_IS_NEWER_THAN_UPDATE--}');
} else {
die();
} // END - if
+// Initializes repository data
+function initRepositoryData () {
+ // Default data values or array indexes if numerical
+ $GLOBALS['default_repository_data'] = array(
+ // Main author of this script
+ 'Author' => 'quix0r',
+ // No default value for current file name
+ 'File' => 11,
+ // No default value for revision number
+ 'Revision' => 10,
+ // No default value for date
+ 'Date' => 9,
+ // Default branch
+ 'Tag' => 8
+ );
+}
+
// "Getter" for revision/version data
-function getActualVersion ($type = 'Revision') {
+function getRepositoryData ($type = 'Revision') {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . '] - ENTRY!');
// Default is an invalid value to find bugs... :-)
$ret = 'INVALID';
} // END - foreach
// Return found value
- $ret = getActualVersion($type);
+ $ret = getRepositoryData($type);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
}
}
// Has it been updated?
if ($new === true) {
// Write it
- writeToFile($FQFN, implode("\n", getArrayFromActualVersion()));
+ writeToFile($FQFN, implode("\n", getArrayFromRepositoryData()));
// ... and call recursive
- $ret = getActualVersion($type);
+ $ret = getRepositoryData($type);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
} // END - if
}
}
// Repares an array we are looking for
-// The returned Array is needed twice (in getArrayFromActualVersion() and in getActualVersion() in the old .revision-fallback) so I puted it in an extra function to not polute the global namespace
+// The returned Array is needed twice (in getArrayFromRepositoryData() and in getRepositoryData() in the old .revision-fallback) so I puted it in an extra function to not polute the global namespace
function getSearchFor () {
// Add Revision, Date, Tag and Author
$searchFor = array('File', 'Revision', 'Date', 'Tag', 'Author');
return extractRevisionInfoFromData($fileData, $search);
}
-// @TODO Please describe this function
-function getArrayFromActualVersion () {
+// Gets an array back for current repository data.
+// @TODO This function does also set and get in 'cache_array'
+function getArrayFromRepositoryData () {
// Init array
$GLOBALS['cache_array']['revision'] = array();
// at least 3 keyword-Tags are needed for propper values
if ($GLOBALS['revision_res'] && $GLOBALS['revision_res'] >= 3
- && isset($GLOBALS['cache_array']['revision']['Revision'][0]) && $GLOBALS['cache_array']['revision']['Revision'][0] != ''
- && isset($GLOBALS['cache_array']['revision']['Date'][0]) && $GLOBALS['cache_array']['revision']['Date'][0] != ''
- && isset($GLOBALS['cache_array']['revision']['Tag'][0]) && $GLOBALS['cache_array']['revision']['Tag'][0] != '') {
+ && isset($GLOBALS['cache_array']['revision']['Revision'][0]) && !empty($GLOBALS['cache_array']['revision']['Revision'][0])
+ && isset($GLOBALS['cache_array']['revision']['Date'][0]) && !empty($GLOBALS['cache_array']['revision']['Date'][0])
+ && isset($GLOBALS['cache_array']['revision']['Tag'][0]) && !empty($GLOBALS['cache_array']['revision']['Tag'][0])) {
// Prepare content witch need special treadment
// Prepare timestamp for date
// Invalid request reply?
if (!isset($version[11])) {
// Cannot continue here
- debug_report_bug(__FUNCTION__, __LINE__, 'Invalid response from check-updates3.php, count should be 10+, is ' . count($version));
+ debug_report_bug(__FUNCTION__, __LINE__, 'Invalid response from check-updates3.php, count should be at least 11, is ' . count($version));
} // END - if
// Prepare content
// Only sets not setted or not proper values to the Online-Server-Fallback-Solution
- if (!isset($GLOBALS['cache_array']['revision']['File'][0]) || $GLOBALS['cache_array']['revision']['File'][0] == '') $GLOBALS['cache_array']['revision']['File'][0] = trim($version[11]);
- if (!isset($GLOBALS['cache_array']['revision']['Revision'][0]) || $GLOBALS['cache_array']['revision']['Revision'][0] == '') $GLOBALS['cache_array']['revision']['Revision'][0] = trim($version[10]);
- if (!isset($GLOBALS['cache_array']['revision']['Date'][0]) || $GLOBALS['cache_array']['revision']['Date'][0] == '') $GLOBALS['cache_array']['revision']['Date'][0] = trim($version[9]);
- if (!isset($GLOBALS['cache_array']['revision']['Tag'][0]) || $GLOBALS['cache_array']['revision']['Tag'][0] == '') $GLOBALS['cache_array']['revision']['Tag'][0] = trim($version[8]);
- if (!isset($GLOBALS['cache_array']['revision']['Author'][0]) || $GLOBALS['cache_array']['revision']['Author'][0] == '') $GLOBALS['cache_array']['revision']['Author'][0] = 'quix0r';
+ foreach (getSearchFor() as $entry) {
+ // Is it not set or empty?
+ if ((!isset($GLOBALS['cache_array']['revision'][$entry][0])) || (empty($GLOBALS['cache_array']['revision']['File'][0]))) {
+ // Is default data entry nummerical?
+ if (is_numeric($GLOBALS['default_repository_data'][$entry])) {
+ // Use entry from $version
+ $GLOBALS['cache_array']['revision'][$entry][0] = trim($version[$GLOBALS['default_repository_data'][$entry]]);
+ } else {
+ // Non-numeric -> use it directly
+ $GLOBALS['cache_array']['revision'][$entry][0] = $GLOBALS['default_repository_data'][$entry];
+ }
+ } // END - if
+ } // END - if
}
// Temporary remove [0] from array
$OUT .= '?theme=' . $newTheme . '&installing=1';
} else {
// Add SVN revision to bypass caching problems
- $OUT .= '?rev=' . getCurrSvnRevision();
+ $OUT .= '?rev=' . getCurrentRepositoryRevision();
}
// Close tag
} // END - if
// If you understand regular expressions ^^^ you may know how I versionize... ;-)
-setConfigEntry('FULL_VERSION', getActualVersion('Tag'));
+setConfigEntry('FULL_VERSION', getRepositoryData('Tag'));
// Current SVN revision and date
-setConfigEntry('CURR_SVN_REVISION', getActualVersion('Revision'));
-setConfigEntry('CURR_SVN_DATE' , getActualVersion('Date'));
+setConfigEntry('CURRENT_REPOSITORY_REVISION', getRepositoryData('Revision'));
+setConfigEntry('CURRENT_REPOSITORY_DATE' , getRepositoryData('Date'));
// [EOF]
?>
}
// "Getter" for curr_svn_revision
-function getCurrSvnRevision () {
+function getCurrentRepositoryRevision () {
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__])) {
// Determine it
- $GLOBALS[__FUNCTION__] = getConfig('CURR_SVN_REVISION');
+ $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION');
} // END - if
// Return cache
<div style="clear:both">
<div style="float:left;padding:5px">{--ADMIN_YOUR_VERSION_IS--}:</div>
- <div style="float:right;padding:5px"><strong>v{?FULL_VERSION?} R{?CURR_SVN_REVISION?}</strong></div>
+ <div style="float:right;padding:5px"><strong>v{?FULL_VERSION?} R{?CURRENT_REPOSITORY_REVISION?}</strong></div>
</div>
<div style="clear:both">
<div style="padding:5px">
<div style="float:left">{--ADMIN_DOWNLOAD_SVN--}:</div>
<div style="float:right">
- <strong><a href="{?SERVER_URL?}/cms/index/wht/svn" title="{--ADMIN_SVN_REPOSITORY--}" target="_blank">{--ADMIN_DOWNLOAD_NOW--}</a></strong>
+ <strong><a href="{?SERVER_URL?}/cms/index/wht/svn" title="{--ADMIN_REPOSITORY--}" target="_blank">{--ADMIN_DOWNLOAD_NOW--}</a></strong>
</div>
</div>
</div>
<ul class="copyright_box">
<li class="copyright_lines"><span class="copyright_lines">
{?TITLE?}
- v{?FULL_VERSION?} R{?CURR_SVN_REVISION?}<br />
+ v{?FULL_VERSION?} R{?CURRENT_REPOSITORY_REVISION?}<br />
{?COPY?}
</span></li>
<ul class="copyright_box">
<li class="copyright_lines"><span class="copyright_lines">
[<a href="{?SERVER_URL?}/" title="{?TITLE?}" target="_blank" rel="external">{?TITLE?}</a>]
- v{?FULL_VERSION?} R{?CURR_SVN_REVISION?}<br />
+ v{?FULL_VERSION?} R{?CURRENT_REPOSITORY_REVISION?}<br />
{?COPY?}
</span></li>
-{--CURR_THEME_IS--}
+{--CURRENT_THEME_IS--}
<div class="theme_note">
$content
</div>