X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=mailid_top.php;h=344bed250c87cda81517f7b8dfea14e021c29cae;hp=a61ce990cc9d81376faf058e81f654164c4720fb;hb=381133ea5f3925617f114d4dd3ef735be1903ef8;hpb=a9a5edafa0c323a7f33d14e0cef9629c940896ff diff --git a/mailid_top.php b/mailid_top.php index a61ce990cc..344bed250c 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -42,15 +42,14 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "mailid"; $CSS = 0; // Load the required file(s) -require ("inc/config.php"); +require("inc/config.php"); -if (isBooleanConstantAndTrue('mxchange_installed')) -{ +if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the extension active if (!EXT_IS_ACTIVE("mailid", true)) { // Is not activated/installed yet! - ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register")); - } + ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid")); + } // END - if // Secure all data $url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = ""; @@ -61,25 +60,22 @@ if (isBooleanConstantAndTrue('mxchange_installed')) if (!empty($_GET['mode'])) $mode = $_GET['mode']; // 01 1 12 2 2 21 1 2 2 10 - if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) - { + if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) { + // No image? Then output header if ($mode != "img") require_once(PATH."inc/header.php"); // Maybe he wants to confirm an email? - if ($url_mid > 0) - { + if ($url_mid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s AND userid=%s LIMIT 1", array($url_mid, $url_uid), __FILE__, __LINE__); $type = "mailid"; $DATA = $url_mid; - } - elseif ($url_bid > 0) - { + } elseif ($url_bid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s AND userid=%s LIMIT 1", array($url_bid, $url_uid), __FILE__, __LINE__); $type = "bonusid"; $DATA = $url_bid; } - if (SQL_NUMROWS($result) == 1) - { + + if (SQL_NUMROWS($result) == 1) { // Is the stats ID valid? list($lid, $ltype) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -87,16 +83,18 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); break; case "BONUS": $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); break; } - if (SQL_NUMROWS($result_mailid) == 1) - { + + // Entry found? + if (SQL_NUMROWS($result_mailid) == 1) { + // Load data list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); // Correct notification switch in non-bonus mails @@ -109,33 +107,34 @@ if (isBooleanConstantAndTrue('mxchange_installed')) if ($ltype == "BONUS") $sender = 0; // Is the user's ID unlocked? - $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { // Load data list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result); + + // Free some memory SQL_FREERESULT($result); - if ($status == "CONFIRMED") - { + if ($status == "CONFIRMED") { // Update last activity - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); // User has confirmed his account so we can procede... switch ($ltype) { case "NORMAL": $result = SQL_QUERY_ESC("SELECT payment_id FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($pay) = SQL_FETCHROW($result); $time = GET_PAY_POINTS($pay, "time"); $payment = GET_PAY_POINTS($pay, "payment"); $VALID = true; - } + } // END - if // Free memory... SQL_FREERESULT($result); @@ -143,9 +142,10 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("SELECT time, points FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($time, $payment) = SQL_FETCHROW($result); $VALID = true; } @@ -154,19 +154,17 @@ if (isBooleanConstantAndTrue('mxchange_installed')) SQL_FREERESULT($result); break; } - if ($VALID) - { + + // Is this entry valid? + if ($VALID) { if (($time == "0") && ($payment > 0)) $time = "1"; - if (($time > 0) && ($payment > 0)) - { - if (!empty($code)) - { + if (($time > 0) && ($payment > 0)) { + if (!empty($code)) { // Generate code - $img_code = GEN_RANDOM_CODE($_CONFIG['code_length'], $code, $url_uid, $DATA); - } + $img_code = GEN_RANDOM_CODE(getConfig('code_length'), $code, $url_uid, $DATA); + } // END - if - switch ($mode) - { + switch ($mode) { case "add": // Init stats data $stats_data = 0; @@ -176,7 +174,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -188,7 +186,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -206,13 +204,13 @@ if (isBooleanConstantAndTrue('mxchange_installed')) // Only when user extension = v0.1.2: Update mails-confirmed counter if (GET_EXT_VERSION("user") >= "0.1.2") { // Update counter - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1", array($url_uid), __FILE__, __LINE__); // Update random confirmed as well? if (GET_EXT_VERSION("user") >= "0.3.4") { // Update second counter - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1", array($url_uid), __FILE__, __LINE__); } // END - if } // END - if @@ -227,26 +225,26 @@ if (isBooleanConstantAndTrue('mxchange_installed')) $template = "mailid_points_done"; // Right code entered add points and remove entry - if (($ref_pay > 0) && ($_CONFIG['allow_direct_pay'] == "N")) { + if (($ref_pay > 0) && (getConfig('allow_direct_pay') == "N")) { // Don't add points over the referal system $locked = true; $template = "mailid_points_locked"; } // END - if // Count down ref_payout value - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1", array($url_uid), __FILE__, __LINE__); // Add points unset($DEPTH); - ADD_POINTS_REFSYSTEM($url_uid, $payment, false, "0", $locked); + ADD_POINTS_REFSYSTEM("mailid_okay", $url_uid, $payment, false, "0", $locked); // Shall I add bonus points for "turbo clickers" ? if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (function_exists('BONUS_ADD_TURBO_POINTS'))) { // Is an active-rallye running and this is not a notification mail? - if (($_CONFIG['bonus_active'] == "Y") && ($notify == "N")) { + if ((getConfig('bonus_active') == "Y") && ($notify == "N")) { // Shall I exclude the webmaster's own userid from the active-rallye? - if (((($_CONFIG['bonus_uid'] == $url_uid) && ($_CONFIG['bonus_include_own'] == "Y")) || ($_CONFIG['bonus_uid'] != $url_uid)) && ($_CONFIG['def_refid'] != $url_uid)) { + if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == "Y")) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) { // Add points and remember ranking are done in this function.... BONUS_ADD_TURBO_POINTS($DATA, $url_uid, $type); @@ -271,7 +269,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) } else { // Wrong image code! So add points to sender's account unset($DEPTH); - ADD_POINTS_REFSYSTEM($sender, $payment, false, 0, false, "direct"); + ADD_POINTS_REFSYSTEM("mailid_payback", $sender, $payment, false, 0, false, "direct"); // Load template LOAD_TEMPLATE("mailid_points_failed"); @@ -295,7 +293,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) define('_TYPE_VALUE', $type); define('_DATA_VALUE', $DATA); define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true)); - if ($_CONFIG['code_length'] > 0) + if (getConfig('code_length') > 0) { // Generate Code define('_IMAGE_CODE', IMG_CODE($code, $type, $DATA, $url_uid)); @@ -334,33 +332,26 @@ if (isBooleanConstantAndTrue('mxchange_installed')) else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (5)"); } else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (4)"); - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (3)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (2)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (1)"); } - if ($mode != "img") - { + + // Insert footer if no image + if ($mode != "img") { // Write footer require_once(PATH."inc/footer.php"); - } + } // END - if } -} - elseif ($mode != "img") -{ +} elseif ($mode != "img") { // You have to configure first! LOAD_URL("install.php"); }