X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffilters.php;h=0b07e67b7eec01c714a4e8d4944ab105e3c5f55b;hp=254630b39eb25aca5da88beeb32fc74b9b8a978f;hb=e8ca54fe91872ab95a6ffdc4f1268bf18889021d;hpb=71c07e991fc7f5393317f4d9adf4ecdbc26b9aa3 diff --git a/inc/filters.php b/inc/filters.php index 254630b39e..0b07e67b7e 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -14,8 +14,6 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009, 2010 by Mailer Developer Team * @@ -111,10 +109,10 @@ function FILTER_FLUSH_FILTERS () { // Update all counters foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) { // Walk through all filters - foreach ($filterArray as $filterFunction => $cnt) { + foreach ($filterArray as $filterFunction => $count) { // Construct and add the query addSql(sprintf("UPDATE `{?_MYSQL_PREFIX?}_filters` SET `filter_counter`=%s WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT 1", - bigintval($cnt), + bigintval($count), $filterName, $filterFunction )); @@ -165,10 +163,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 +242,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 +269,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 +278,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 @@ -327,7 +330,7 @@ function FILTER_INIT_RANDOMIZER () { setConfigEntry('_PRIME', 591623); // Calculate "entropy" with the prime number (for code generation) - setConfigEntry('_ADD', (getPrime() * getPrime() / (pi() * getConfig('code_length') + 1))); + setConfigEntry('_ADD', (getPrime() * getPrime() / (pi() * getCodeLength() + 1))); // Simply init the randomizer with seed and _ADD value mt_srand(generateSeed() + getConfig('_ADD')); @@ -351,7 +354,7 @@ function FILTER_REMOVE_UPDATES ($data) { // Shall we remove this update? if (in_array($ext_name, getExtensionRemovalList())) { // Then remove this extension! - removeExtensionUpdateDependency($ext_name); + removeExtensionDependency($ext_name); } // END - if } // END - foreach } // END - if @@ -466,7 +469,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { $callback = ''; $extraFunction = ''; $extraFunction2 = ''; - $value = ''; + $value = null; // Extract command and call-back $cmdArray = explode(',', $cmd); @@ -497,7 +500,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,7 +521,7 @@ 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=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.'); } } // END - foreach } // END - if @@ -577,7 +580,7 @@ function FILTER_RUN_RESET_INCLUDES () { $currMonth = getMonth(); // Has it changed? - if ((getConfig('last_month') != $currMonth) || (isMonthlyResetDebugEnabled())) { + if ((getLastMonth() != $currMonth) || (isMonthlyResetDebugEnabled())) { // Include monthly reset scripts mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_')); @@ -707,15 +710,15 @@ function FILTER_TRIGGER_SENDING_POOL () { } // Filter for checking and updating SVN revision -function FILTER_CHECK_SVN_REVISION () { +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 - if ((getCurrSvnRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) { + 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(getCurrSvnRevision(), 'UNIX_TIMESTAMP()')); - setConfigEntry('patch_level', getCurrSvnRevision()); + updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()')); + setConfigEntry('patch_level', getCurrentRepositoryRevision()); setConfigEntry('patch_ctime', time()); } // END - if } @@ -770,7 +773,7 @@ function FILTER_INIT_RANDOM_NUMBER () { // Generate random number setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getMemberId(), '')); } else { - // Generate weak (!!!) code + // Generate *WEAK* code setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999)); } @@ -969,11 +972,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') { @@ -1014,5 +1014,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() - getOneDay())); + setConfigEntry('START_TDAY', makeTime(0, 0, 0, time())); +} + // [EOF] ?>