A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / filter / bonus_filter.php
index 34ee4408088f4b53a315aaec6fb6d24aebb631fb..4520937f457d1eb3ad487c6a8c770b77014727f3 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Filter for adding login bonus to the user's account
-function FILTER_ADD_LOGIN_BONUS ($data) {
+function FILTER_ADD_LOGIN_BONUS ($filterData) {
        // Is the user data valid?
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
        if (!isMember()) {
@@ -51,7 +51,7 @@ function FILTER_ADD_LOGIN_BONUS ($data) {
 
        // Bonus is not given by default ;-)
        $bonus = false;
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (isBonusRallyeActive()) && (getConfig('bonus_login_yn') == 'Y')) {
+       if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (isBonusRallyeActive()) && (getConfig('include_bonus_login') == 'Y')) {
                // Update last login if far enougth away
                // @TODO This query isn't right, it will only update if the user was for a longer time away!
                SQL_QUERY_ESC('UPDATE
@@ -81,7 +81,40 @@ LIMIT 1',
 
        // Return data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
-       return $data;
+       return $filterData;
+}
+
+// Filter for generating admin mail links for bonus mails
+function FILTER_GENERATE_BONUS_MAIL_LINKS ($filterData) {
+       // Is the type 'bid'?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       if ($filterData['type'] == 'bid') {
+               // Load template
+               $filterData['__output'] .= loadTemplate('admin_links_bonus_mail', true, $filterData);
+       } // END - if
+
+       // Return data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for adding bonus columns with a plus (+) sign
+function FILTER_ADD_BONUS_POINTS_USER_COLUMNS ($add = '') {
+       // Skip out-dated extension, because this causes an error
+       if (isExtensionInstalledAndOlder('bonus', '0.9.7')) {
+               // Skip this silently
+               return $add;
+       } // END - if
+
+       // Add more columns only when the corresponding configuration is enabled, too
+       if (getConfig('include_bonus_click') == 'Y') $add .= ' + `turbo_bonus`';
+       if (getConfig('include_bonus_login') == 'Y') $add .= ' + `login_bonus`';
+       if (getConfig('include_bonus_order') == 'Y') $add .= ' + `bonus_order`';
+       if (getConfig('include_bonus_stats') == 'Y') $add .= ' + `bonus_stats`';
+       if (getConfig('include_bonus_ref')   == 'Y') $add .= ' + `bonus_ref`';
+
+       // Return $add
+       return $add;
 }
 
 // [EOF]