X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilters.php;h=073bf4a83778a994b26dee6fda32a9468d2f2d2d;hb=4418d7cfabd34a285cc5ff3638e3ba05d8afd16b;hp=987d89326a400dc245781cbb4c87b923cc81953e;hpb=6401e072bebcbf06f028ebd090979e83826d494a;p=mailer.git diff --git a/inc/filters.php b/inc/filters.php index 987d89326a..073bf4a837 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -583,67 +583,97 @@ 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 - reportBug(__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'); + reportBug(__FUNCTION__, __LINE__, 'Cannot run hourly reset! enabled='.intval(isHourlyResetEnabled()).',ext='.intval(isExtensionInstalledAndNewer('sql_patches', '0.9.8')).' Please report this bug. Thanks'); } // END - if - // Get more hourly reset scripts - setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_')); + // Is the config entry set? + if (isExtensionInstalledAndNewer('sql_patches', '0.7.5')) { + // Get more hourly reset scripts + setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_')); - // Update database - if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) { - updateConfiguration('last_hour', getHour()); - } // END - if + // Update database + if ((!isConfigEntrySet('DEBUG_HOURLY')) || (!isDebugHourlyEnabled())) { + updateConfiguration('last_hourly', getHour()); + } // END - if - // Run the filter - runFilterChain('load_includes', 'hourly'); + // Run the filter + runFilterChain('load_includes', 'hourly'); + } // END - if } -// Load more reset scripts -function FILTER_RUN_RESET_INCLUDES () { +// Load more daily scripts +function FILTER_RUN_DAILY_INCLUDES () { // Is the reset set or old sql_patches? - if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (isHtmlOutputMode())) { + if (((!isDailyResetEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) && (isHtmlOutputMode())) { // Then abort here - reportBug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks'); + reportBug(__FUNCTION__, __LINE__, 'Cannot run daily reset! enabled='.intval(isDailyResetEnabled()).',ext='.intval(isExtensionInstalledAndNewer('sql_patches', '0.9.8')).' Please report this bug. Thanks'); } // END - if // Get more daily reset scripts - setIncludePool('reset', getArrayFromDirectory('inc/daily/', 'daily_')); + setIncludePool('daily', getArrayFromDirectory('inc/daily/', 'daily_')); // Update configuration if this reset is not being debugged - if (!isDebugResetEnabled()) { - updateConfiguration('last_update', 'UNIX_TIMESTAMP()'); + if (!isDebugDailyEnabled()) { + updateConfiguration('last_daily', getDay()); + } // END - if + + // Run the filter + runFilterChain('load_includes', 'daily'); +} + +// Load more weeklt scripts +function FILTER_RUN_WEEKLY_INCLUDES () { + // Is the reset set or old sql_patches? + if (((!isWeeklyResetDebugEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) && (isHtmlOutputMode())) { + // Then abort here + reportBug(__FUNCTION__, __LINE__, 'Cannot run weekly reset! enabled='.intval(isWeeklyResetDebugEnabled()).',ext='.intval(isExtensionInstalledAndNewer('sql_patches', '0.9.8')).' Please report this bug. Thanks'); } // END - if // Is the config entry set? if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) { // Has it changed? - if (((isConfigEntrySet('last_week')) && (getConfig('last_week') != getWeek())) || (isWeeklyResetDebugEnabled())) { + if (((isConfigEntrySet('last_weekly')) && (getLastWeekly() != getWeek())) || (isWeeklyResetDebugEnabled())) { // Include weekly reset scripts - mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_')); + setIncludePool('weekly', getArrayFromDirectory('inc/weekly/', 'weekly_')); // Update configuration if this reset is not being debugged if (!isWeeklyResetDebugEnabled()) { - updateConfiguration('last_week', getWeek()); + updateConfiguration('last_weekly', getWeek()); } // END - if } // END - if + // Run the filter + runFilterChain('load_includes', 'weekly'); + } // END - if +} + +// Load more monthly scripts +function FILTER_RUN_MONTHLY_INCLUDES () { + // Is the reset set or old sql_patches? + if (((!isMonthlyResetDebugEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) && (isHtmlOutputMode())) { + // Then abort here + reportBug(__FUNCTION__, __LINE__, 'Cannot run monthly reset! enabled='.intval(isMonthlyResetDebugEnabled()).',ext='.intval(isExtensionInstalledAndNewer('sql_patches', '0.9.8')).' Please report this bug. Thanks'); + } // END - if + + // Is the config entry set? + if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) { // Create current month mark $currMonth = getMonth(); // Has it changed? - if ((getLastMonth() != $currMonth) || (isMonthlyResetDebugEnabled())) { + if ((getLastMonthly() != $currMonth) || (isMonthlyResetDebugEnabled())) { // Include monthly reset scripts - mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_')); + setIncludePool('monthly', getArrayFromDirectory('inc/monthly/', 'monthly_')); // Update configuration if this reset is not being debugged if (!isMonthlyResetDebugEnabled()) { - updateConfiguration('last_month', $currMonth); + updateConfiguration('last_monthly', $currMonth); } // END - if } // END - if } // END - if // Run the filter - runFilterChain('load_includes', 'reset'); + runFilterChain('load_includes', 'monthly'); } // Filter for removing the given extension @@ -792,7 +822,9 @@ function FILTER_TRIGGER_SENDING_POOL () { // Filter for checking and updating 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; + if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) { + return; + } // END - if // 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')) { @@ -803,31 +835,59 @@ function FILTER_CHECK_REPOSITORY_REVISION () { } // 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.9.8'))) { + return; + } // END - if + + // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D + if (((getLastHourly() != getHour()) || (isDebugHourlyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) { + // Tell every module we are in reset-mode! + doHourly(); + } // END - if +} + // Filter for running daily reset function FILTER_RUN_DAILY_RESET () { // Only execute this filter if installed - if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) { + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) { 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()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) { + if (((getLastDaily() != getDay()) || (isDebugDailyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! - doReset(); + doDaily(); } // END - if } -// Filter for running hourly reset -function FILTER_RUN_HOURLY_RESET () { +// Filter for running weekly reset +function FILTER_RUN_WEEKLY_RESET () { // Only execute this filter if installed - if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) { + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) { return; } // END - if // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D - if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) { + if (((getLastWeekly() != getWeek()) || (isDebugWeeklyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! - doHourly(); + doWeekly(); + } // END - if +} + +// Filter for running monthly reset +function FILTER_RUN_MONTHLY_RESET () { + // Only execute this filter if installed + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.8'))) { + return; + } // END - if + + // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D + if (((getLastMonthly() != getMonth()) || (isDebugMonthlyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) { + // Tell every module we are in reset-mode! + doMonthly(); } // END - if } @@ -885,14 +945,14 @@ function FILTER_INIT_RANDOM_NUMBER () { // Update module counter function FILTER_COUNT_MODULE () { - // Is installation phase? - if (isInstallationPhase()) { + // Is installation phase or no admin registered? + if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered())) { // Then don't count any modules return; } // END - if //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ' - ENTERED!'); - // Do count all other modules but not accesses on CSS file css.php! + // Count module click SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1", array(getModule()), __FUNCTION__, __LINE__); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS() . ' - EXIT!'); @@ -1150,8 +1210,8 @@ function FILTER_EXTENSION_MARK_INSTALLED ($filterData) { // Filter for generating mails links for 'pool' mails function FILTER_GENERATE_POOL_MAIL_LINKS ($filterData) { - // Is type 'mid'? - if ($filterData['type'] == 'mid') { + // Is type 'normal'? + if ($filterData['type'] == 'normal') { // Load template $filterData['__output'] .= loadTemplate('admin_links_' . strtolower($filterData['mail_status']) . '_pool_mail', TRUE, $filterData); } // END - if @@ -1162,8 +1222,8 @@ function FILTER_GENERATE_POOL_MAIL_LINKS ($filterData) { // Filter to activate exchange function FILTER_ACTIVATE_EXCHANGE () { - // Is the extension 'user' there? - if ((!isExtensionActive('user')) || (getActivateXchange() == '0')) { + // Are the extension ext-user/other there? + if ((!isExtensionActive('user')) || (!isExtensionActive('other')) || (getActivateXchange() == '0')) { // Silently abort here return FALSE; } // END - if @@ -1208,7 +1268,7 @@ function FILTER_ADD_HISTORY_ENTRY ($filterData) { __FUNCTION__, __LINE__); // Remember insert id for other filters - $filterData['history_id'] = SQL_INSERTID(); + $filterData['history_id'] = SQL_INSERT_ID(); // Return data return $filterData; @@ -1393,5 +1453,17 @@ function FILTER_DETERMINE_MENU_MODE_GENERIC ($filterData) { return $filterData; } +// Filter to exclude default referral id +function FILTER_EXCLUDE_DEFAULT_REFID ($filterData = array()) { + // Is it valid? + if (isValidId(getDefRefid())) { + // Exclude it + array_push($filterData, '{?def_refid?}'); + } // END - if + + // Return it + return $filterData; +} + // [EOF] ?>