From: Roland Häder <roland@mxchange.org>
Date: Sun, 12 Sep 2010 12:42:57 +0000 (+0000)
Subject: Functions renamed
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=07af932574589f4906be5ebf6733fdb95f30e9a2;p=mailer.git

Functions renamed
---

diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt
index 4c7bffd8cd..75ebe55aff 100644
--- a/DOCS/TODOs.txt
+++ b/DOCS/TODOs.txt
@@ -185,7 +185,7 @@
 ./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
diff --git a/inc/expression-functions.php b/inc/expression-functions.php
index 0c76f8f37f..b3ee099725 100644
--- a/inc/expression-functions.php
+++ b/inc/expression-functions.php
@@ -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);
diff --git a/inc/filter-functions.php b/inc/filter-functions.php
index f944978b24..d91d5d6ea6 100644
--- a/inc/filter-functions.php
+++ b/inc/filter-functions.php
@@ -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');
diff --git a/inc/filters.php b/inc/filters.php
index 164acb9225..de7de41c6d 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -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
 }
diff --git a/inc/language/de.php b/inc/language/de.php
index e2ee800036..ee533f45cb 100644
--- a/inc/language/de.php
+++ b/inc/language/de.php
@@ -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>)",
diff --git a/inc/language/update_de.php b/inc/language/update_de.php
index ab8ffae1d0..0100437c01 100644
--- a/inc/language/update_de.php
+++ b/inc/language/update_de.php
@@ -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]
diff --git a/inc/loader/load_cache-revision.php b/inc/loader/load_cache-revision.php
index 29d8950b3e..d15d410c30 100644
--- a/inc/loader/load_cache-revision.php
+++ b/inc/loader/load_cache-revision.php
@@ -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();
diff --git a/inc/modules/admin/what-updates.php b/inc/modules/admin/what-updates.php
index 5d702805a0..9ea426a407 100644
--- a/inc/modules/admin/what-updates.php
+++ b/inc/modules/admin/what-updates.php
@@ -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 {
diff --git a/inc/revision-functions.php b/inc/revision-functions.php
index 37ed37f415..ff8fd97206 100644
--- a/inc/revision-functions.php
+++ b/inc/revision-functions.php
@@ -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
diff --git a/inc/stylesheet.php b/inc/stylesheet.php
index cd60159cc5..9658652f39 100644
--- a/inc/stylesheet.php
+++ b/inc/stylesheet.php
@@ -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
diff --git a/inc/versions.php b/inc/versions.php
index 404e6fe79b..abc4cc7b8c 100644
--- a/inc/versions.php
+++ b/inc/versions.php
@@ -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]
 ?>
diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php
index 23faa7a6a4..b42874ee8a 100644
--- a/inc/wrapper-functions.php
+++ b/inc/wrapper-functions.php
@@ -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
diff --git a/templates/de/html/admin/admin_update_download.tpl b/templates/de/html/admin/admin_update_download.tpl
index 1533c887c3..d9baa6f477 100644
--- a/templates/de/html/admin/admin_update_download.tpl
+++ b/templates/de/html/admin/admin_update_download.tpl
@@ -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>
diff --git a/templates/de/html/copyright.tpl b/templates/de/html/copyright.tpl
index 6727b6747a..89c86e42d0 100644
--- a/templates/de/html/copyright.tpl
+++ b/templates/de/html/copyright.tpl
@@ -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>
 
diff --git a/templates/de/html/copyright_backlink.tpl b/templates/de/html/copyright_backlink.tpl
index 326103e17a..d2deb35301 100644
--- a/templates/de/html/copyright_backlink.tpl
+++ b/templates/de/html/copyright_backlink.tpl
@@ -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>
 
diff --git a/templates/de/html/theme/theme_one.tpl b/templates/de/html/theme/theme_one.tpl
index 9a89cf8ddf..5852314e01 100644
--- a/templates/de/html/theme/theme_one.tpl
+++ b/templates/de/html/theme/theme_one.tpl
@@ -1,4 +1,4 @@
-{--CURR_THEME_IS--}
+{--CURRENT_THEME_IS--}
 <div class="theme_note">
 	$content
 </div>