X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilters.php;h=2a11b82da0c121311e25cf6a305aeaf741d82578;hb=d4cff9c73632a8d93428a80dcf54b3a8daa80a24;hp=77a02c56cab62268ca3545ee5b3eaf5722ed7e84;hpb=cae64f77825f882ff8e84a4b33e8914dff7caac1;p=mailer.git diff --git a/inc/filters.php b/inc/filters.php index 77a02c56ca..2a11b82da0 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -165,10 +165,12 @@ function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () { // Filter for auto-activation of a extension function FILTER_AUTO_ACTIVATE_EXTENSION ($data) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $data['ext_name'] . ',isExtensionAlwaysActive()=' . intval(isExtensionAlwaysActive())); + // Is this extension always activated? if (isExtensionAlwaysActive()) { // Then activate the extension - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name={$data['ext_name']}
"); doActivateExtension($data['ext_name']); } // END - if @@ -242,13 +244,16 @@ function FILTER_LOAD_INCLUDES ($pool) { // Filter for running SQL commands function FILTER_RUN_SQLS ($data) { // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Entered!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Entered!'); // Is the array there? if ((isSqlsValid()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) { // Run SQL commands - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Found ".countSqls()." queries to run."); - foreach (getSqls() as $sqls) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.'); + foreach (getSqls() as $mode=>$sqls) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mode=' . $mode . ',count()=' . count($sqls)); + // New cache format... foreach ($sqls as $sql) { // Trim spaces away @@ -266,7 +271,7 @@ function FILTER_RUN_SQLS ($data) { SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__, $data['enable_codes']); } else { // Run regular SQL command - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running regular query: ' . $sql . ',enable_codes=' . intval($data['enable_codes']); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running regular query: ' . $sql . ',enable_codes=' . intval($data['enable_codes'])); SQL_QUERY($sql, __FUNCTION__, __LINE__, $data['enable_codes']); } } // END - if @@ -275,7 +280,7 @@ function FILTER_RUN_SQLS ($data) { } // END - if // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Left!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!'); } // Filter for updating/validating login data @@ -497,7 +502,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { } // END - if // Construct call-back function name for the command - $commandFunction = 'doExpression' . ucfirst(strtolower($cmd)); + $commandFunction = 'doExpression' . capitalizeUnderscoreString($cmd); // Is this function there? if (function_exists($commandFunction)) { @@ -518,13 +523,13 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { $code = call_user_func($commandFunction, $data); } else { // Unsupported command detected - debug_report_bug(__FUNCTION__, __LINE__, 'Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.'); + logDebugMessage(__FUNCTION__, __LINE__, 'Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.'); } } // END - foreach } // END - if // Do we have non-HTML mode? - if ((getScriptOutputMode() != '0') || ($outputMode != '0')) $code = decodeEntities($code); + if ((!isHtmlOutputMode()) || ($outputMode != '0')) $code = decodeEntities($code); // Return compiled code //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.($code).'
'); @@ -548,7 +553,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'))) && (getScriptOutputMode() == '0')) { + if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (isHtmlOutputMode())) { // 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 @@ -638,14 +643,14 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // END - if // Get all values - if ((getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) { + if ((!isCssOutputMode()) && (!isRawOutputMode())) { // Fix module if (!isModuleSet()) { // Is the request element set? if (isGetRequestParameterSet('module')) { // Set module from request setModule(getRequestParameter('module')); - } elseif (getScriptOutputMode() == '0') { + } elseif (isHtmlOutputMode()) { // Set default module 'index' setModule('index'); } else { @@ -655,10 +660,14 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // END - if // Fix 'what' if not yet set - if (!isWhatSet()) setWhat(getWhatFromModule(getModule())); + if (!isWhatSet()) { + setWhat(getWhatFromModule(getModule())); + } // END - if // Fix 'action' if not yet set - if (!isActionSet()) setAction(getActionFromModuleWhat(getModule(), getWhat())); + if (!isActionSet()) { + setAction(getActionFromModuleWhat(getModule(), getWhat())); + } // END - if } else { // Set action/what to empty setAction(''); @@ -667,7 +676,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { // Set default 'what' value //* DEBUG: */ debugOutput('-' . getModule() . '/' . getWhat() . '-'); - if ((!isWhatSet()) && (!isActionSet()) && (getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) { + if ((!isWhatSet()) && (!isActionSet()) && (!isCssOutputMode()) && (!isRawOutputMode())) { if (getModule() == 'admin') { // Set 'action' value to 'login' in admin menu setAction(getActionFromModuleWhat(getModule(), getWhat())); @@ -684,7 +693,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { // Sends out pooled mails function FILTER_TRIGGER_SENDING_POOL () { // Are we in normal output mode? - if (getScriptOutputMode() != 0) { + if (!isHtmlOutputMode()) { // Only in normal output mode to prevent race-conditons! } // END - if @@ -722,7 +731,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')) && (getScriptOutputMode() != 1)) { + if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! doReset(); } // END - if @@ -784,7 +793,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()) || (getScriptOutputMode() != '0')) { + if ((!ifFatalErrorsDetected()) || (!isHtmlOutputMode())) { // Abort executing here return false; } // END - if @@ -885,7 +894,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())) && (getScriptOutputMode() == '0') && ($GLOBALS['header_sent'] == 2)) { + if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestParameterSet('frame'))) || (isInstallationPhase())) && (isHtmlOutputMode()) && ($GLOBALS['header_sent'] == 2)) { // Then display it here displayParsingTime(); } // END - if @@ -965,11 +974,8 @@ function FILTER_DO_LOGIN_ADMIN ($data) { // Filter for loading page header, this should be ran first! function FILTER_LOAD_PAGE_HEADER () { - // Determine the page title - $content['header_title'] = determinePageTitle(); - // Output page header code - $GLOBALS['page_header'] = loadTemplate('page_header', true, $content); + $GLOBALS['page_header'] = loadTemplate('page_header', true); // Include meta data in 'guest' module if (getModule() == 'index') { @@ -1010,5 +1016,15 @@ function FILTER_CLEANUP_DNS_CACHE () { } // END - if } +// Filter for setting CURRENT_DATE, this is required after initialization of extensions +function FILTER_SET_CURRENT_DATE () { + // Set current date + setConfigEntry('CURRENT_DATE', generateDateTime(time(), '3')); + + // Timestamp for yesterday, today ... all at 00:00 am + setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('ONE_DAY'))); + setConfigEntry('START_TDAY', makeTime(0, 0, 0, time())); +} + // [EOF] ?>