From 5a295e2c5ceaf111dc6a6d7cea5c4a7ebaab6480 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 30 Sep 2012 21:21:32 +0000 Subject: [PATCH] Introduced FILTER_INIT_SESSION() which calls determineReferralId() after all extensions has been initialized to make ext-order (it has a hook for user exclusions) working again at script initialization phase --- inc/extensions-functions.php | 4 ++-- inc/extensions/ext-beg.php | 4 ++-- inc/extensions/ext-sql_patches.php | 2 +- inc/filter-functions.php | 16 ++++++++++++++-- inc/filters.php | 9 +++++++++ inc/language/de.php | 2 +- inc/referral-functions.php | 6 +++--- inc/session.php | 3 --- 8 files changed, 32 insertions(+), 14 deletions(-) diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index b3e95cdcfa..fb71395536 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -1646,9 +1646,9 @@ function FILTER_INIT_EXTENSIONS () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE - START!'); foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key => $ext_name) { // Load it - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - START'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - START'); loadExtension($ext_name, 'init', getExtensionVersion($ext_name)); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - END'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - END'); } // END - foreach //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE - END!'); } // END - if diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 4a9dc5730c..0286d9e366 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -75,7 +75,7 @@ INDEX (`userid`)", case 'remove': // Do stuff when removing extension // SQL commands to run addDropTableSql('beg_ips'); - addDropTableSql('beg_referals'); + addDropTableSql('beg_referrals'); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_beg','list_beg','list_beg_referral_urls')"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='beg'"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('beg','beg2')"); @@ -363,8 +363,8 @@ INDEX (`userid`)", registerExtensionPointsData('monthly_beg_ref', 'points', 'LOCKED', 'DIRECT'); // SQL queries (renaming) - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_beg_referals` CHANGE `referal_url` `referral_url` TINYTEXT NOT NULL"); addExtensionSql("RENAME TABLE `{?_MYSQL_PREFIX?}_beg_referals` TO `{?_MYSQL_PREFIX?}_beg_referrals`"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_beg_referrals` CHANGE `referal_url` `referral_url` TINYTEXT NOT NULL"); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='list_beg_referral_urls' WHERE `what`='list_beg_referal_urls' LIMIT 1"); // Update notes diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 574302f55f..c0a268cc53 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -894,7 +894,7 @@ INDEX (`history_last_used` DESC)", addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_points_data` SET `payment_method`='REFERRAL' WHERE `payment_method` != 'DIRECT'"); // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Referral, REFERRAL soll es überall heissen (ist ein Typo nur mit einem R zu schreiben)."); + setExtensionUpdateNotes("Referral/REFERRAL soll es überall heissen (ist ein Typo nur mit einem R zu schreiben)."); break; case '0.8.7': // SQL queries for v0.8.7 diff --git a/inc/filter-functions.php b/inc/filter-functions.php index f10ce83848..bdfcbea4ab 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -107,6 +107,7 @@ ORDER BY registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_RANDOMIZER'); registerFilter(__FUNCTION__, __LINE__, 'init', 'LOAD_RUNTIME_INCLUDES'); registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_EXTENSIONS'); + registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_SESSION'); registerFilter(__FUNCTION__, __LINE__, 'init', 'SET_CURRENT_DATE'); registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_RANDOM_NUMBER'); registerFilter(__FUNCTION__, __LINE__, 'init', 'CHECK_REPOSITORY_REVISION'); @@ -352,9 +353,17 @@ function prepareFilterArray () { $GLOBALS['cache_array']['filter'] = $filterArray; } -// Loads filter for given extension if present. This function will silently -// ignore absent filter files. +/** + * Loads filter for given extension if present. This function will silently + * ignore absent filter files. + * + * @param $ext_name Name of extension + * @return void + */ function loadExtensionFilters ($ext_name) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - ENTERED!'); + // Do we have cache entry? if (!isset($GLOBALS[__FUNCTION__][$ext_name])) { // Default is not found @@ -375,6 +384,9 @@ function loadExtensionFilters ($ext_name) { logDebugMessage(__FUNCTION__, __LINE__, 'Filter include file ' . $incFileName . ' for extension ' . $ext_name . ' is missing.'); } } // END - if + + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',result=' . intval($GLOBALS[__FUNCTION__][$ext_name]) . ' - EXIT!'); } // [EOF] diff --git a/inc/filters.php b/inc/filters.php index 54e697ad99..2bfb349587 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -1228,5 +1228,14 @@ function FILTER_GENERATE_FILE_SECRET_HASH ($filterData) { return $filterData; } +// Filter to initialize session +function FILTER_INIT_SESSION ($filterData) { + // Determine and set referral id + determineReferralId(); + + // Return data + return $filterData; +} + // [EOF] ?> diff --git a/inc/language/de.php b/inc/language/de.php index 6e53fbece3..76517e878a 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -479,7 +479,7 @@ addMessages(array( 'GUEST_CONFIRM_SUBJECT' => "Bitte Ihre Email-Adresse bestätigen.", 'MEMBER_ORDER_ACCEPTED' => "Ihre Mailbuchung wurde freigeschaltet", 'MEMBER_ORDER_REJECTED' => "Ihre Mailbuchung wurde abgelehnt", - 'THANX_REFERRAL_ONE_SUBJECT' => "Vielen Dank für die Referral-Werbung.", + 'THANKS_REFERRAL_ONE_SUBJECT' => "Vielen Dank für die Referral-Werbung.", 'ADMIN_SEND_MAIL' => "Bonusmail versenden", 'ADMIN_BONUS_SEND' => "Bonusmail wurde in den Sende-Pool eingefügt.", 'ENTER_POINTS' => "Vergütung", diff --git a/inc/referral-functions.php b/inc/referral-functions.php index 6078e378fa..a0261d9293 100644 --- a/inc/referral-functions.php +++ b/inc/referral-functions.php @@ -83,7 +83,7 @@ function getReferralLevelPercents ($level) { } /** - * Dynamic referral and points system, can also send mails! + * Dynamic Referral and points system, can also send mails! * * subject = Subject line, write in lower-case letters and underscore is allowed * userid = Referral id wich should receive... @@ -222,7 +222,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU $message = loadEmailTemplate('guest_user_confirmed_referral', $content, bigintval($userid)); // Send email - sendEmail($userid, '{--THANX_REFERRAL_ONE_SUBJECT--}', $message); + sendEmail($userid, '{--THANKS_REFERRAL_ONE_SUBJECT--}', $message); } // END - if // Points updated, maybe I shall send him an email? @@ -262,7 +262,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU ); } // END - if - // Increase referral level, if payment method is REFERRAL + // Increase referral level, if payment method is 'REFERRAL' if ($paymentMethod == 'REFERRAL') { // Increase it $GLOBALS['ref_level']++; diff --git a/inc/session.php b/inc/session.php index 49c0ab1219..e8b9e23317 100644 --- a/inc/session.php +++ b/inc/session.php @@ -58,8 +58,5 @@ if (session_id() == '') { // Load language file(s) loadLanguageFile(); -// Determine and set referral id -determineReferralId(); - // [EOF] ?> -- 2.39.2