]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / filters.php
index 4551d1d80c1e95b7c7c32e6178ead81e26f58785..5dd7d6999025ddec270572adfccaf23db5ca54d3 100644 (file)
@@ -107,7 +107,7 @@ function FILTER_FLUSH_FILTERS () {
        } // END - if
 
        // Shall we update usage counters (ONLY FOR DEBUGGING!)
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')) {
+       if (isFilterUsageUpdateEnabled()) {
                // Update all counters
                foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) {
                        // Walk through all filters
@@ -324,7 +324,7 @@ function FILTER_INIT_RANDOMIZER () {
        setConfigEntry('_PRIME', 591623);
 
        // Calculate "entropy" with the prime number (for code generation)
-       setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1)));
+       setConfigEntry('_ADD', (getPrime() * getPrime() / (pi() * getConfig('code_length') + 1)));
 
        // Simply init the randomizer with seed and _ADD value
        mt_srand(generateSeed() + getConfig('_ADD'));
@@ -452,7 +452,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
        //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:<pre>'.print_r($matches, true).'</pre>');
 
        // Default is from outputHtml()
-       $outputMode = getOutputMode();
+       $outputMode = getScriptOutputMode();
 
        // Some entries found?
        if ((count($matches) > 0) && (count($matches[3]) > 0)) {
@@ -510,7 +510,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
        } // END - if
 
        // Do we have non-HTML mode?
-       if ((getOutputMode() != '0') || ($outputMode != '0')) $code = decodeEntities($code);
+       if ((getScriptOutputMode() != '0') || ($outputMode != '0')) $code = decodeEntities($code);
 
        // Return compiled code
        //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:<pre>'.($code).'</pre>');
@@ -534,7 +534,7 @@ function FILTER_UPDATE_EXTENSION_DATA ($ext_name) {
 // Load more reset scripts
 function FILTER_RUN_RESET_INCLUDES () {
        // Is the reset set or old sql_patches?
-       if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (getOutputMode() == '0')) {
+       if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (getScriptOutputMode() == '0')) {
                // Then abort here
                debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks');
        } // END - if
@@ -551,24 +551,24 @@ function FILTER_RUN_RESET_INCLUDES () {
                $currWeek = getWeek();
 
                // Has it changed?
-               if ((getConfig('last_week') != $currWeek) || ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'))) {
+               if ((getConfig('last_week') != $currWeek) || (isWeeklyResetDebugEnabled())) {
                        // Include weekly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_'));
 
-                       // Update config
-                       if ((!isConfigEntrySet('DEBUG_WEEKLY')) || (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek);
+                       // Update config if not in debug mode
+                       if (!isWeeklyResetDebugEnabled()) updateConfiguration('last_week', $currWeek);
                } // END - if
 
                // Create current month mark
                $currMonth = getMonth();
 
                // Has it changed?
-               if ((getConfig('last_month') != $currMonth) || ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'))) {
+               if ((getConfig('last_month') != $currMonth) || (isMonthlyResetDebugEnabled())) {
                        // Include monthly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_'));
 
                        // Update config
-                       if ((!isConfigEntrySet('DEBUG_MONTHLY')) || (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth);
+                       if (!isMonthlyResetDebugEnabled()) updateConfiguration('last_month', $currMonth);
                } // END - if
        } // END - if
 
@@ -624,14 +624,14 @@ function FILTER_DETERMINE_WHAT_ACTION () {
        } // END - if
 
        // Get all values
-       if ((getOutputMode() != 1) && (getOutputMode() != -1)) {
+       if ((getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) {
                // Fix module
                if (!isModuleSet()) {
                        // Is the request element set?
                        if (isGetRequestParameterSet('module')) {
                                // Set module from request
                                setModule(getRequestParameter('module'));
-                       } elseif (getOutputMode() == '0') {
+                       } elseif (getScriptOutputMode() == '0') {
                                // Set default module 'index'
                                setModule('index');
                        } else {
@@ -653,7 +653,7 @@ function FILTER_DETERMINE_WHAT_ACTION () {
 
        // Set default 'what' value
        //* DEBUG: */ debugOutput('-' . getModule() . '/' . getWhat() . '-');
-       if ((!isWhatSet()) && (!isActionSet()) && (getOutputMode() != 1) && (getOutputMode() != -1)) {
+       if ((!isWhatSet()) && (!isActionSet()) && (getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) {
                if (getModule() == 'admin') {
                        // Set 'action' value to 'login' in admin menu
                        setAction(getActionFromModuleWhat(getModule(), getWhat()));
@@ -670,7 +670,7 @@ function FILTER_DETERMINE_WHAT_ACTION () {
 // Sends out pooled mails
 function FILTER_TRIGGER_SENDING_POOL () {
        // Are we in normal output mode?
-       if (getOutputMode() != 0) {
+       if (getScriptOutputMode() != 0) {
                // Only in normal output mode to prevent race-conditons!
        } // END - if
 
@@ -694,10 +694,10 @@ function FILTER_CHECK_SVN_REVISION () {
        if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return;
 
        // Check for patch level differences between databases and current hard-coded
-       if ((getConfig('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
+       if ((getCurrSvnRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
                // Update database and CONFIG array
-               updateConfiguration(array('patch_level', 'patch_ctime'), array(getConfig('CURR_SVN_REVISION'), 'UNIX_TIMESTAMP()'));
-               setConfigEntry('patch_level', getConfig('CURR_SVN_REVISION'));
+               updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrSvnRevision(), 'UNIX_TIMESTAMP()'));
+               setConfigEntry('patch_level', getCurrSvnRevision());
                setConfigEntry('patch_ctime', time());
        } // END - if
 }
@@ -708,7 +708,7 @@ function FILTER_RUN_DAILY_RESET () {
        if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return;
 
        // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
-       if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (getOutputMode() != 1)) {
+       if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (getScriptOutputMode() != 1)) {
                // Tell every module we are in reset-mode!
                doReset();
        } // END - if
@@ -770,7 +770,7 @@ function FILTER_COUNT_MODULE () {
 // Handles fatal errors
 function FILTER_HANDLE_FATAL_ERRORS () {
        // Do we have errors to handle and right output mode?
-       if ((!ifFatalErrorsDetected()) || (getOutputMode() != '0')) {
+       if ((!ifFatalErrorsDetected()) || (getScriptOutputMode() != '0')) {
                // Abort executing here
                return false;
        } // END - if
@@ -871,7 +871,7 @@ function FILTER_DISPLAY_COPYRIGHT () {
 function FILTER_DISPLAY_PARSING_TIME () {
        // Shall we display the parsing time and number of queries?
        // 1234                            5                      54    4         5              5       4    4                       5       543    3                   4432    2             33     2    2                              21
-       if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestParameterSet('frame'))) || (isInstallationPhase())) && (getOutputMode() == '0') && ($GLOBALS['header_sent'] == 2)) {
+       if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestParameterSet('frame'))) || (isInstallationPhase())) && (getScriptOutputMode() == '0') && ($GLOBALS['header_sent'] == 2)) {
                // Then display it here
                displayParsingTime();
        } // END - if