Functions renamed
authorRoland Häder <roland@mxchange.org>
Sun, 12 Sep 2010 12:42:57 +0000 (12:42 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 12 Sep 2010 12:42:57 +0000 (12:42 +0000)
16 files changed:
DOCS/TODOs.txt
inc/expression-functions.php
inc/filter-functions.php
inc/filters.php
inc/language/de.php
inc/language/update_de.php
inc/loader/load_cache-revision.php
inc/modules/admin/what-updates.php
inc/revision-functions.php
inc/stylesheet.php
inc/versions.php
inc/wrapper-functions.php
templates/de/html/admin/admin_update_download.tpl
templates/de/html/copyright.tpl
templates/de/html/copyright_backlink.tpl
templates/de/html/theme/theme_one.tpl

index 4c7bffd8cd19de75922126479c9c9bf162334881..75ebe55affc7e97fe6e56c4e0a673d8ef17d8a30 100644 (file)
 ./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
index 0c76f8f37f4677de61897de73af51e0ed4867195..b3ee099725fead995c04ca8e44694ea05f6721ab 100644 (file)
@@ -151,7 +151,7 @@ function doExpressionExt ($data) {
        } // END - if
 
        // Generate replacer
-       $replacer = sprintf("&amp;ext=%s&amp;ver=%s&amp;rev={?CURR_SVN_REVISION?}", $data['matches'][4][$data['key']], $replacer);
+       $replacer = sprintf("&amp;ext=%s&amp;ver=%s&amp;rev={?CURRENT_REPOSITORY_REVISION?}", $data['matches'][4][$data['key']], $replacer);
 
        // Replace it and insert parameter for GET request
        $code = replaceExpressionCode($data, $replacer);
index f944978b242a1955e18164cc9c3bad4976347093..d91d5d6ea6e12a9ff1c7f03637205c249d16d65b 100644 (file)
@@ -104,7 +104,7 @@ ORDER BY
        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');
index 164acb9225af28f2b27de87acf576a9504d9e7a8..de7de41c6d83ca5f142fde7bc31e3ef7316bf84e 100644 (file)
@@ -710,15 +710,15 @@ function FILTER_TRIGGER_SENDING_POOL () {
 }
 
 // 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
 }
index e2ee800036e3746e6bd67464a819e4e360e54d81..ee533f45cbe6633fb939887a90c16228eb0c34a1 100644 (file)
@@ -834,7 +834,7 @@ addMessages(array(
        'ADMIN_THEMES_UPDATED' => "Themes wurden aktualisiert.",
        'ADMIN_THEMES_DELETED' => "Themes wurden gel&ouml;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 &auml;ndern",
        'ADMIN_SET_AS_NEW_THEME' => "Dieses Theme als Standart-Theme setzen",
@@ -878,7 +878,7 @@ addMessages(array(
        '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>)",
index ab8ffae1d0f76570591a6dbe46b570c915a9defb..0100437c010788c27faa5e29268ba2848f354f98 100644 (file)
@@ -43,13 +43,13 @@ if (!defined('__SECURITY')) {
 // Installation/setup
 addMessages(array(
        'ADMIN_NEW_VERSION_AVAILABLE' => "Neue Version verf&uuml;gbar.",
-       'ADMIN_NO_UPDATES_AVAILABLE' => "Derzeit ist keine neuere Version als <span class=\"data\">{?FULL_VERSION?} r{?CURR_SVN_REVISION?}</span> verf&uuml;gbar.",
+       'ADMIN_NO_UPDATES_AVAILABLE' => "Derzeit ist keine neuere Version als <span class=\"data\">{?FULL_VERSION?} r{?CURRENT_REPOSITORY_REVISION?}</span> verf&uuml;gbar.",
        'ADMIN_YOUR_VERSION_IS' => "Installierte Version",
        'ADMIN_ONLINE_VERSION_IS' => "Verf&uuml;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]
index 29d8950b3e37c420494a546e3d4e6ba5a8e4efbc..d15d410c30a41aae86a776ab6d0582f1c6dbbcfa 100644 (file)
@@ -49,7 +49,7 @@ if ($GLOBALS['cache_instance']->loadCacheFile('revision')) {
        $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();
index 5d702805a0132fdf11f3230ff0c36732dc1ce26e..9ea426a407e6c29bbd8c3e20a85f5b27872c6e0c 100644 (file)
@@ -89,13 +89,13 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($
 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 {
index 37ed37f41594a78b7dd3a579fa8e1c9fea7f3cbd..ff8fd972064f8e510b10292de30fd48066d8769a 100644 (file)
@@ -40,8 +40,25 @@ if (!defined('__SECURITY')) {
        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';
@@ -89,7 +106,7 @@ function getActualVersion ($type = 'Revision') {
                                        } // END - foreach
 
                                        // Return found value
-                                       $ret = getActualVersion($type);
+                                       $ret = getRepositoryData($type);
                                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
                                }
                        }
@@ -98,10 +115,10 @@ function getActualVersion ($type = 'Revision') {
                // 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
        }
@@ -112,7 +129,7 @@ function getActualVersion ($type = 'Revision') {
 }
 
 // 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');
@@ -148,8 +165,9 @@ function extractRevisionInfoFromFile ($FQFN, $search) {
        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();
 
@@ -189,9 +207,9 @@ function getArrayFromActualVersion () {
 
        // 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
@@ -210,16 +228,24 @@ function getArrayFromActualVersion () {
                // 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
index cd60159cc5cd1560deb328b3735bb17d3a89b2de..9658652f397752d594c79d5d35b56040394e9648 100644 (file)
@@ -114,7 +114,7 @@ if ((isCssOutputMode()) || (getConfig('css_php') == 'DIRECT')) {
                $OUT .= '?theme=' . $newTheme . '&amp;installing=1';
        } else {
                // Add SVN revision to bypass caching problems
-               $OUT .= '?rev=' . getCurrSvnRevision();
+               $OUT .= '?rev=' . getCurrentRepositoryRevision();
        }
 
        // Close tag
index 404e6fe79ba250ce444d2b8ea84bd540e9737c6b..abc4cc7b8cb521f66e38a1e23221678b6ee7775c 100644 (file)
@@ -41,11 +41,11 @@ if (!defined('__SECURITY')) {
 } // 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]
 ?>
index 23faa7a6a468b4e6c9bc05e1d3d8dc4cdeddc20a..b42874ee8a035d540729ff09ce03c050585be84d 100644 (file)
@@ -1493,11 +1493,11 @@ function getTitle () {
 }
 
 // "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
index 1533c887c331d9a3c5c71f8586577f3c9295c2fc..d9baa6f477988ad1dce7ce8c62f22efafdf3655d 100644 (file)
@@ -7,7 +7,7 @@
 
 <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">
@@ -27,7 +27,7 @@
        <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>
index 6727b6747ae130b9b291b9054904d5344c57afe6..89c86e42d00a3de4d521c5e0e311c21934dfc76b 100644 (file)
@@ -2,7 +2,7 @@
 <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>
 
index 326103e17ae03e151b43e6f4b2826e04301d9fe9..d2deb35301c94adf27324424d88d50b23768f358 100644 (file)
@@ -2,7 +2,7 @@
 <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>
 
index 9a89cf8ddfe85255a6e3fed5d6df050865cd158c..5852314e018ed86ee28502df25bbaec2811fbce5 100644 (file)
@@ -1,4 +1,4 @@
-{--CURR_THEME_IS--}
+{--CURRENT_THEME_IS--}
 <div class="theme_note">
        $content
 </div>