mailer project continued:
[mailer.git] / inc / filter / bonus_filter.php
index 09ed63f552d20c77b8de1423ea3b71d6efde5273..7c6815affdba4b78d365a3424df973ff6a2c9851 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -46,7 +46,7 @@ function FILTER_ADD_LOGIN_BONUS ($filterData) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
        if (!isMember()) {
                // Do only run for logged in members
-               debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.');
+               reportBug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.');
        } // END - if
 
        // Bonus is not given by default ;-)
@@ -86,8 +86,9 @@ LIMIT 1',
 
 // 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!');
+
+       // Is the type 'bid'?
        if ($filterData['type'] == 'bid') {
                // Load template
                $filterData['__output'] .= loadTemplate('admin_links_bonus_mail', true, $filterData);
@@ -100,6 +101,8 @@ function FILTER_GENERATE_BONUS_MAIL_LINKS ($filterData) {
 
 // Filter for adding bonus columns with a plus (+) sign
 function FILTER_ADD_BONUS_POINTS_USER_COLUMNS ($add = '') {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
        // Skip out-dated extension, because this causes an error
        if (isExtensionInstalledAndOlder('bonus', '0.9.7')) {
                // Skip this silently
@@ -114,8 +117,40 @@ function FILTER_ADD_BONUS_POINTS_USER_COLUMNS ($add = '') {
        if (getConfig('include_bonus_ref')   == 'Y') $add .= ' + `bonus_ref`';
 
        // Return $add
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
        return $add;
 }
 
+// Filter for adding SQL columns on user registration for bonus/"active" rallye notification
+function FILTER_BONUS_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Next: active rallye
+       if (!isBonusNewMemberNotifyEnabled()) {
+               $GLOBALS['register_sql_columns'] .= ', `bonus_rallye_enable_notify`, `bonus_rallye_disable_notify`';
+               $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
+       } // END - if
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
+       return $filterData;
+}
+
+// Filter for sending out bonus rallye notifications
+function FILTER_SEND_BONUS_NOTIFICATIONS ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       // Check for bonus rallye is active and send mails out
+       if ((isBonusRallyeActive()) && (isBonusNewMemberNotifyEnabled())) {
+               // Include file for sending out mails
+               addIncludeToPool('notify', 'inc/mails/bonus_mails.php');
+       } // END - if
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
+       return $filterData;
+}
+
 // [EOF]
 ?>