Unknown module in non-HTML mode, debug comments removed :(
[mailer.git] / inc / mails / beg_mails.php
index 4f61d180fac8992287b497a416d376d20cf54385..0cd50f820f5980a5be2f71cc57d91b1f899d66fa 100644 (file)
@@ -51,13 +51,13 @@ $mark = mktime(0, 0, 0, getConfig('last_month'), date('d', time()), date('Y', ti
 $sql = ''; $mode = '';
 
 // Shall I sent activation or deactivation mail?
-$sql = "SELECT userid, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE (beg_ral_notify ";
+$sql = "SELECT `userid`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE (`beg_ral_notify` ";
 switch (getConfig('beg_rallye')) {
        case 'Y': // Begging rallye is activated
                if (getConfig('beg_ral_en_notify') == 'Y') {
                        // Okay, let's check for member accounts
-                       $sql .= "= 0 OR (beg_ral_notify > 0 AND beg_ral_en_notify < beg_ral_di_notify)";
-                       $mode = "en";
+                       $sql .= '= 0 OR (`beg_ral_notify` > 0 AND `beg_ral_en_notify` < `beg_ral_di_notify`)';
+                       $mode = 'en';
                } else {
                        // Do not notify!
                        $sql = '';
@@ -67,14 +67,14 @@ switch (getConfig('beg_rallye')) {
        case 'N': // Begging rallye is deactivated
                if (getConfig('beg_ral_di_notify') == 'Y') {
                        // Okay, let's check for member accounts
-                       $sql .= " > 0 AND beg_ral_di_notify < beg_ral_en_notify";
-                       $mode = "di";
+                       $sql .= ' > 0 AND `beg_ral_di_notify` < `beg_ral_en_notify`';
+                       $mode = 'di';
                } else {
-               // Do not notify!
-               $sql = '';
+                       // Do not notify!
+                       $sql = '';
                }
                break;
-}
+} // END - switch
 
 if (!empty($sql)) {
        // The SQL command needs to be finisched here (only confirmed accounts!)
@@ -109,9 +109,13 @@ if (!empty($sql)) {
                // Okay lets notify all users!
                while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
                        // Update account
-                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
-SET `beg_ral_notify`=UNIX_TIMESTAMP(),` beg_ral_%s_notify`=UNIX_TIMESTAMP()
-WHERE `userid`=%s
+                       SQL_QUERY_ESC("UPDATE
+       `{?_MYSQL_PREFIX?}_user_data`
+SET
+       `beg_ral_notify`=UNIX_TIMESTAMP(),
+       `beg_ral_%s_notify`=UNIX_TIMESTAMP()
+WHERE
+       `userid`=%s
 LIMIT 1",
                                array(
                                        $mode,