X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffilters.php;h=9dad8b42b286d5ba148f1cb0fe15d81ec17d7de8;hp=9985adf03d5852c2f38047a633125a2484a8a48c;hb=9a60a71dde1189e5c922a6dd377b862d08ea8f51;hpb=ef8bdde1d3b805a341e64cb29c89e562e1ca963f diff --git a/inc/filters.php b/inc/filters.php index 9985adf03d..9dad8b42b2 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -258,7 +258,9 @@ function FILTER_RUN_SQLS ($data) { $sql = trim($sql); // Is 'enable_codes' not set? Then set it to true - if (!isset($data['enable_codes'])) $data['enable_codes'] = true; + if (!isset($data['enable_codes'])) { + $data['enable_codes'] = true; + } // END - if // Is there still a query left? if (!empty($sql)) { @@ -284,10 +286,14 @@ function FILTER_RUN_SQLS ($data) { // Filter for updating/validating login data function FILTER_UPDATE_LOGIN_DATA () { // Add missing array - if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) $GLOBALS['last_online'] = array(); + if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) { + $GLOBALS['last_online'] = array(); + } // END - if // Recheck if logged in - if (!isMember()) return false; + if (!isMember()) { + return false; + } // END - if // Secure user id setMemberId(getSession('userid')); @@ -324,7 +330,9 @@ function FILTER_UPDATE_LOGIN_DATA () { // Filter for initializing randomizer function FILTER_INIT_RANDOMIZER () { // Only execute this filter if installed - if ((!isInstalled()) || (!isExtensionInstalledAndNewer('other', '0.2.5'))) return; + if ((!isInstalled()) || (!isExtensionInstalledAndNewer('other', '0.2.5'))) { + return; + } // END - if // Take a prime number which is long (if you know a longer one please try it out!) setConfigEntry('_PRIME', 591623); @@ -550,6 +558,26 @@ function FILTER_UPDATE_EXTENSION_DATA ($ext_name) { unset($GLOBALS['update_ver'][$ext_name]); } +// Load more hourly reset scripts +function FILTER_RUN_HOURLY_INCLUDES () { + // Is the reset set or old sql_patches? + if (((!isHourlyResetEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) && (isHtmlOutputMode())) { + // Then abort here + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isHourlyResetEnabled()).',ext_newer[sql_patches:0.7.5]='.intval(isExtensionInstalledAndNewer('sql_patches', '0.7.5')).' Please report this bug. Thanks'); + } // END - if + + // Get more hourly reset scripts + setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_')); + + // Update database + if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) { + updateConfiguration('last_hour', getHour()); + } // END - if + + // Run the filter + runFilterChain('load_includes', 'hourly'); +} + // Load more reset scripts function FILTER_RUN_RESET_INCLUDES () { // Is the reset set or old sql_patches? @@ -562,7 +590,9 @@ function FILTER_RUN_RESET_INCLUDES () { setIncludePool('reset', getArrayFromDirectory('inc/daily/', 'daily_')); // Update database - if ((!isConfigEntrySet('DEBUG_RESET')) || (getConfig('DEBUG_RESET') != 'Y')) updateConfiguration('last_update', 'UNIX_TIMESTAMP()'); + if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) { + updateConfiguration('last_update', 'UNIX_TIMESTAMP()'); + } // END - if // Is the config entry set? if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) { @@ -587,7 +617,9 @@ function FILTER_RUN_RESET_INCLUDES () { mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_')); // Update config - if (!isMonthlyResetDebugEnabled()) updateConfiguration('last_month', $currMonth); + if (!isMonthlyResetDebugEnabled()) { + updateConfiguration('last_month', $currMonth); + } // END - if } // END - if } // END - if @@ -728,15 +760,31 @@ function FILTER_CHECK_REPOSITORY_REVISION () { // Filter for running daily reset function FILTER_RUN_DAILY_RESET () { // Only execute this filter if installed - if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return; + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) { + return; + } // END - if // 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')) && (!isCssOutputMode())) { + if (((getDay(getConfig('last_update')) != getDay()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! doReset(); } // END - if } +// Filter for running hourly reset +function FILTER_RUN_HOURLY_RESET () { + // Only execute this filter if installed + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) { + return; + } // END - if + + // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D + if (((getConfig('last_hour') != getHour()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) { + // Tell every module we are in reset-mode! + doHourly(); + } // END - if +} + // Filter for loading more runtime includes (not for installation) function FILTER_LOAD_RUNTIME_INCLUDES () { // Load more includes