]> git.mxchange.org Git - mailer.git/blobdiff - inc/mails/beg_mails.php
Fix for surfbar if no account has depleted points
[mailer.git] / inc / mails / beg_mails.php
index ce4573232abf5b6f973049bc107377e9c11ed087..37272d712ec54187bb41c2cb1918b127e3b4f3fd 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
- elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN()))
-{
-       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "beg");
+} elseif (!EXT_IS_ACTIVE("beg")) {
        return;
 }
 
 // Do not execute when script is in CSS mode
+global $CSS;
 if ($CSS == 1) return;
 
 // Create timemark from saved month
-$mark = mktime(0, 0, 0, $_CONFIG['beg_month'], date("d", time()), date('Y', time()));
+$mark = mktime(0, 0, 0, $_CONFIG['last_month'], date("d", time()), date('Y', time()));
 $SQL = ""; $MODE = "";
 
 // Shall I sent activation or deactivation mail?
@@ -111,8 +108,7 @@ if (!empty($SQL))
                $MAIL_MODE = (($_CONFIG['beg_notify_bonus'] > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
 
                // Generate subject line
-               $eval = "\$SUBJECT = BEG_RALLYE_".strtoupper($MODE)."_NOTIFY;";
-               eval($eval);
+               $SUBJECT = constant('BEG_RALLYE_'.strtoupper($MODE).'_NOTIFY');
 
                // Load message body for bonus mails
                $MSG = LOAD_EMAIL_TEMPLATE("beg_en_notify_body", "", "{PER}uid{PER}");
@@ -123,7 +119,7 @@ if (!empty($SQL))
                {
                        // Update account
                        $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data
-SET beg_ral_notify='%s', beg_ral_%s_notify='%s' WHERE userid=%d LIMIT 1",
+SET beg_ral_notify='%s', beg_ral_%s_notify='%s' WHERE userid=%s LIMIT 1",
  array(time(), $MODE, time(), $uid), __FILE__, __LINE__);
 
                        // Load email template and send it to the user!
@@ -135,8 +131,8 @@ SET beg_ral_notify='%s', beg_ral_%s_notify='%s' WHERE userid=%d LIMIT 1",
                         else
                        {
                                // Send normal notification mail to the members
-                               $MSG = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", "", $uid);
-                               SEND_EMAIL($email, $SUBJECT, $MSG);
+                               $MSG = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", array(), $uid);
+                               SEND_EMAIL($uid, $SUBJECT, $MSG);
                        }
                }
 
@@ -147,7 +143,7 @@ SET beg_ral_notify='%s', beg_ral_%s_notify='%s' WHERE userid=%d LIMIT 1",
                        $RECEIVER = implode(";", $UIDs);
                        $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
 (subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, is_notify)
-VALUES ('%s', '%s', '%s', '%s', '%s', 'NEW', UNIX_TIMESTAMP(), '%s', '%s', '%s', '%s', 'Y')",
+VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(), '%s','%s','%s','%s','Y')",
  array(
        $SUBJECT,
        $MSG,