X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffilters.php;h=5de86582f375e749a9e7b5e147ca8cc684e4d6ea;hp=1bbede3a98313c2113f8d7b2b5dbc942d429b8cf;hb=1c2d077de1940e35b00ad895e75039949c979cae;hpb=5d89789720c77e954b2eba28c00ec710dd28900d diff --git a/inc/filters.php b/inc/filters.php index 1bbede3a98..5de86582f3 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? @@ -557,10 +587,12 @@ function FILTER_RUN_RESET_INCLUDES () { } // END - if // Get more daily reset scripts - setIncludePool('reset', getArrayFromDirectory('inc/reset/', 'reset_')); + 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')) { @@ -714,7 +746,7 @@ function FILTER_CHECK_REPOSITORY_REVISION () { // Only execute this filter if installed and all config entries are there if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return; - // Check for patch level differences between databases and current hard-coded + // Check for patch level differences between database and current hard-coded if ((getCurrentRepositoryRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURRENT_REPOSITORY_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) { // Update database and CONFIG array updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()')); @@ -726,21 +758,37 @@ 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 - foreach (array('inc/databases.php','inc/session.php','inc/versions.php') as $inc) { + foreach (array('databases', 'session', 'versions') as $inc) { // Load the include - loadIncludeOnce($inc); + loadIncludeOnce('inc/' . $inc . '.php'); } // END - foreach } @@ -959,11 +1007,11 @@ LIMIT 1", function FILTER_DO_LOGIN_ADMIN ($data) { // Now set all session variables and store the result for later processing $GLOBALS['admin_login_success'] = (( - setSession('admin_md5', encodeHashForCookie($data['pass_hash'])) + setAdminMd5(encodeHashForCookie($data['pass_hash'])) ) && ( - setSession('admin_id', $data['id']) + setAdminId($data['id']) ) && ( - setSession('admin_last', time()) + setAdminLast(time()) )); // Return the data for further processing