]> git.mxchange.org Git - mailer.git/commitdiff
Rewrites/fixes for CURRENT_DATE, better encapsulation of redirect, coding convention:
authorquix0r <quix0r@mxchange.org>
Mon, 23 Aug 2010 12:32:54 +0000 (12:32 +0000)
committerquix0r <quix0r@mxchange.org>
Mon, 23 Aug 2010 12:32:54 +0000 (12:32 +0000)
- loadExtension()'s parameter $ext_ver is now '0.0' by default, this saves a
  manual fix. Still all these errors needs to be fixed
- Setting CURRENT_DATE in inc/databases.php causes an error on some servers,
  thanks to km4l (www.funcoins.de) for helping me
- Redirect re-introduced, it should now no longer endless redirect and is
  required to redirect from any script to the base script
- Move setting of HTTP status '302 MOVED' into sendRawRedirect()
- if() braces added (coding convention applied)
- TODOs.txt updated

DOCS/TODOs.txt
inc/databases.php
inc/extensions-functions.php
inc/filter-functions.php
inc/filters.php
inc/functions.php
inc/mysql-connect.php
inc/wrapper-functions.php

index 21a0837eb8eaa661e862955221888e5182537ea5..50b59eec88dc6a36ef6edd9d647da806e05398b8 100644 (file)
@@ -4,7 +4,6 @@
 ./beg.php:165:                 // @TODO Opps, what is missing here???
 ./birthday_confirm.php:95:             // @TODO Try to rewrite the following unset()
 ./inc/autopurge/purge-inact.php:57:    // @TODO Rewrite these if() blocks to a filter
-./inc/cache/config-local.php:126:// @TODO Rewrite the following three constants, somehow...
 ./inc/classes/cachesystem.class.php:474:       // @TODO Add support for more types which break in last else-block
 ./inc/config-functions.php:141:        // @TODO Make this all better... :-/
 ./inc/expression-functions.php:166:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
 ./inc/extensions-functions.php:434:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
 ./inc/extensions-functions.php:564:            // @TODO Extension is loaded, what next?
 ./inc/functions.php:112:               // @TODO Extension 'msg' does not exist
-./inc/functions.php:1499:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1522:                      // @TODO Rewrite this old lost code to a template
-./inc/functions.php:1590:                      // @TODO Are these convertions still required?
-./inc/functions.php:1608:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1496:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1519:                      // @TODO Rewrite this old lost code to a template
+./inc/functions.php:1587:                      // @TODO Are these convertions still required?
+./inc/functions.php:1605:// @TODO Rewrite this function to use readFromFile() and writeToFile()
 ./inc/functions.php:181:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2264:      // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2263:      // @TODO This is still very static, rewrite it somehow
 ./inc/gen_sql_patches.php:96:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:59:        // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/language/de.php:1116:// @TODO Rewrite these two constants
index 8dd31b8864620767d7bdf4147d499a3c08761bae..7b61176b96dec52b82d68ff080a0da4d2ab28a48 100644 (file)
@@ -96,9 +96,6 @@ $GLOBALS['replacer'] = array(
 // One day
 setConfigEntry('ONE_DAY', (60*60*24));
 
-// Current date
-setConfigEntry('CURRENT_DATE', generateDateTime(time(), 3));
-
 // Timestamp for yesterday, today ... all at 00:00 am
 setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('ONE_DAY')));
 setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
index 56b13139233641a43fc96f909203116343b8d5e6..5ceb349621c21cb4cf47e413fcf80bc05385b428 100644 (file)
@@ -43,9 +43,11 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Load the extension and maybe found language and function files.
-function loadExtension ($ext_name, $ext_mode, $ext_ver = '', $dry_run = false) {
-       // If this happens twice, we need the bug report from you, except for updates/tests
+function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0', $dry_run = false) {
+       // Loading an extension in same mode, but not test/update, twice is not
+       // good, so is the extension $ext_name already loaded in mode $ext_mode?
        if ((isset($GLOBALS['loaded_extension'][$ext_name][$ext_mode])) && (!in_array($ext_mode, array('update', 'test')))) {
+               // If this happens twice, we need the bug report from you, except for updates/tests
                debug_report_bug(__FUNCTION__, __LINE__, '() is called twice: ext_name=' . $ext_name . ', ext_mode='. $ext_mode . ',ext_sqls=' . print_r(getExtensionSqls(), true) . ', ext_register_running=' . print_r($GLOBALS['ext_register_running'], true) . ', ext_running_updates=' . print_r($GLOBALS['ext_running_updates'], true));
        } // END - if
 
@@ -76,8 +78,8 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '', $dry_run = false) {
 
                // In all but test-mode we need these messages to debug! Please report all (together, e.g.)
                if (($ext_mode != 'test') && (getCurrentExtensionVersion() == '0.0')) {
-                       // Log empty versions not in test-mode, but maybe it is fine...
-                       logDebugMessage(__FUNCTION__, __LINE__, 'Extension version is empty, setting to 0.0. ext_name=' . $ext_name . ', ext_mode=' . $ext_mode . ', dry_run=' . intval($dry_run));
+                       // Abort here, this must now always be set!
+                       debug_report_bug(__FUNCTION__, __LINE__, 'Extension version is empty, setting to 0.0. ext_name=' . $ext_name . ', ext_mode=' . $ext_mode . ', dry_run=' . intval($dry_run));
                } // END - if
        }
 
index dac79b3107b5ce52f27a08b3de2c510a955667ed..e5421fd4ba4954d2aadb2dd2861b6850cb17090c 100644 (file)
@@ -104,6 +104,7 @@ ORDER BY
        registerFilter('init', 'INIT_RANDOMIZER');
        registerFilter('init', 'LOAD_RUNTIME_INCLUDES');
        registerFilter('init', 'INIT_EXTENSIONS');
+       registerFilter('init', 'SET_CURRENT_DATE');
        registerFilter('init', 'INIT_RANDOM_NUMBER');
        registerFilter('init', 'CHECK_SVN_REVISION');
        registerFilter('init', 'RUN_DAILY_RESET');
index fe1a36c00990c04e4831d5c539ca6c0d81e8110b..b68274ccb237e7a60d702e28552f2ea4917f5f17 100644 (file)
@@ -1016,5 +1016,11 @@ function FILTER_CLEANUP_DNS_CACHE () {
        } // END - if
 }
 
+// Filter for setting CURRENT_DATE, this is required after initialization of extensions
+function FILTER_SET_CURRENT_DATE () {
+       // Set current date
+       setConfigEntry('CURRENT_DATE', generateDateTime(time(), '3'));
+}
+
 // [EOF]
 ?>
index ff31b7dcbb27bc72d42c52ee5e51907c49c9178d..ff063d75f75c854f946c209e55acaaada197f321 100644 (file)
@@ -585,9 +585,6 @@ function redirectToUrl ($URL, $allowSpider = true) {
                // Clear own output buffer
                $GLOBALS['output'] = '';
 
-               // Set header
-               setHttpStatus('302 Found');
-
                // Load URL when headers are not sent
                sendRawRedirect(doFinalCompilation(str_replace('&amp;', '&', $URL), false));
        } else {
@@ -2016,7 +2013,9 @@ function initMemberId () {
 // Setter for member id
 function setMemberId ($memberid) {
        // We should not set member id to zero
-       if ($memberid == '0') debug_report_bug(__FUNCTION__, __LINE__, 'Userid should not be set zero.');
+       if ($memberid == '0') {
+               debug_report_bug(__FUNCTION__, __LINE__, 'Userid should not be set zero.');
+       } // END - if
 
        // Set it secured
        $GLOBALS['member_id'] = bigintval($memberid);
index 70a3ef45b937a4b67ba104c3266a85d63b94f39b..40a86ef8f9ec909cde97e4f04ff6db6abec42b39 100644 (file)
@@ -149,6 +149,12 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
                // Load the include
                loadIncludeOnce('inc/' . $inc . '.php');
        } // END - foreach
+
+       // Check wether we are in installation routine
+       if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) {
+               // Redirect to the URL
+               redirectToUrl('install.php');
+       } // END - if
 }
 
 // Handle fatal errors
index de57eb8b26d35ce49b57dc8c70d6d1f4af520d47..918ad0a93a039bb7686851c30d9cfb01d4951b89 100644 (file)
@@ -965,6 +965,9 @@ function getHttpStatus () {
  * @access  private
  */
 function sendRawRedirect ($url) {
+       // Send helping header
+       setHttpStatus('302 Found');
+
        // always close the session
        session_write_close();