A lot calls saved, expression language rewritten:
[mailer.git] / inc / filters.php
index 4551d1d80c1e95b7c7c32e6178ead81e26f58785..a470fa1275088c7894a2d0231068c9911e53a6e9 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'));
@@ -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
 
@@ -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
 }