X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilters.php;h=9dad8b42b286d5ba148f1cb0fe15d81ec17d7de8;hb=0b3c15320cbefa1ae2ab0a0d6b6df525d08836d7;hp=5f69f44285c5e1725999099260676efc54d5f8f9;hpb=b4c80165024acf8963971a72e5c3ca970b3e646d;p=mailer.git diff --git a/inc/filters.php b/inc/filters.php index 5f69f44285..9dad8b42b2 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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); @@ -508,7 +516,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { $data = array( 'matches' => $matches, 'key' => $key, - 'mode' => $outputMode, + 'mode' => getScriptOutputMode(), 'code' => $code, 'callback' => $callback, 'extra_func' => $extraFunction, @@ -527,7 +535,9 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { } // END - if // Do we have non-HTML mode? - if ((!isHtmlOutputMode()) || ($outputMode != '0')) $code = decodeEntities($code); + if (!isHtmlOutputMode()) { + $code = decodeEntities($code); + } // END - if // Return compiled code //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.($code).'
'); @@ -548,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? @@ -560,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')) { @@ -585,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 @@ -726,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