X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilter-functions.php;h=19d95e504bb874553eab155b279d322afcea64d7;hb=77f1fa8cd38db6a89be86c51b9aef70915457ed8;hp=946d0a5ef5c143af77bce454f8b042f18a569a97;hpb=74a607e3879faefdc2ca152605cb533806b98e83;p=mailer.git diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 946d0a5ef5..19d95e504b 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -114,11 +114,16 @@ ORDER BY registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_HOURLY_RESET'); registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_DAILY_RESET'); registerFilter(__FUNCTION__, __LINE__, 'init', 'TRIGGER_SENDING_POOL'); - registerFilter(__FUNCTION__, __LINE__, 'init', 'DETERMINE_USERNAME'); + // @TODO Remove this forced removal after a year or so + unregisterFilter(__FUNCTION__, __LINE__, 'init', 'DETERMINE_USERNAME', TRUE); registerFilter(__FUNCTION__, __LINE__, 'init', 'DETERMINE_WHAT_ACTION'); registerFilter(__FUNCTION__, __LINE__, 'init', 'COUNT_MODULE'); registerFilter(__FUNCTION__, __LINE__, 'init', 'UPDATE_LOGIN_DATA'); registerFilter(__FUNCTION__, __LINE__, 'init', 'ACTIVATE_EXCHANGE'); + registerFilter(__FUNCTION__, __LINE__, 'init', 'REDIRECT_WRONG_SERVER_NAME'); + + // Post-initialization + registerFilter(__FUNCTION__, __LINE__, 'post_init', 'DETERMINE_USERNAME'); // Page headers - pre-filter (normally, you want to register here) registerFilter(__FUNCTION__, __LINE__, 'pre_page_header', 'LOAD_PAGE_HEADER'); @@ -198,6 +203,13 @@ ORDER BY // Build mails registerFilter(__FUNCTION__, __LINE__, 'send_build_mail', 'SEND_BUILD_MAIL'); + + // Handle referral banner click/view + registerFilter(__FUNCTION__, __LINE__, 'handle_click_php', 'HANDLE_REFERRER_BANNER_CLICK'); + registerFilter(__FUNCTION__, __LINE__, 'handle_view_php', 'HANDLE_REFERRER_BANNER_VIEW'); + + // Generic filter to add hidden fields to formulars + registerFilter(__FUNCTION__, __LINE__, 'open_form_fields', 'ADD_INPUT_HIDDEN_SESSION_ID'); } // "Registers" a new filter function @@ -206,7 +218,7 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR $filterFunction = 'FILTER_' . strtoupper($filterFunction); // Debug message with FILTER_ prefix - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!'); // Is that filter already there? if ((isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) { @@ -225,7 +237,7 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR // Is the function there? if (!function_exists($filterFunction)) { // Then abort here - addFatalMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force))); + logDebugMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force))); return FALSE; } // END - if @@ -235,7 +247,10 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = '0'; } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!'); + + // Worked + return TRUE; } // "Unregisters" a filter from the given chain @@ -250,18 +265,21 @@ function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = FALSE, // Is that filter there? if ((!isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) { // Not found, so abort here - addFatalMessage(__FUNCTION__, __LINE__, sprintf(getMessage('FILTER_FAILED_NOT_REMOVED'), $filterFunction, $filterName)); + logDebugMessage(__FUNCTION__, __LINE__, sprintf('Filter function %s cannot be unregistered from filter %s.', $filterFunction, $filterName)); return FALSE; } // END - if // Shall we remove? (default, not while just showing an extension removal) - if ($isDryRun === FALSE) { + if (($isDryRun === FALSE) && (isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction]))) { // Mark for filter removal //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ' - REMOVE!'); $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R'; } // END - if //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - EXIT!'); + + // Worked + return TRUE; } // "Runs" the given filters, filterData is optional and can be any type of data @@ -298,7 +316,7 @@ function runFilterChain ($filterName, $filterData = NULL) { } // END - if // Call the filter chain - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue) . ' - CALLING!'); $returnValue = call_user_func_array($filterFunction, array($returnValue)); // Update usage counter