X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_rallyes.php;h=44b4be1d7ad8f867f54c6196198a5446999b91ad;hp=ffe00d085a345f2ee60a23ccb3516df5318def8f;hb=c47144dd555bbab4acdf9085e4623900dedb0e7c;hpb=75ad748a68473ace540251427a74fb781b1145e9 diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index ffe00d085a..44b4be1d7a 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -32,14 +32,13 @@ ************************************************************************/ // Some security stuff... -if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) -{ +if ((!defined('__SECURITY')) || (!IS_ADMIN())) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } // Add description as navigation point -ADD_DESCR("admin", basename(__FILE__)); +ADD_DESCR("admin", __FILE__); if (empty($_GET['sub'])) $_GET['sub'] = ""; $MSG = ""; @@ -54,11 +53,11 @@ if (isset($_GET['rallye'])) switch ($_GET['activate']) { case "1": // Activate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET is_active='Y' WHERE id=%d AND is_active='N' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE id=%s AND is_active='N' LIMIT 1"; break; case "0": // Deactivate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET is_active='N' WHERE id=%d AND is_active='Y' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE id=%s AND is_active='Y' LIMIT 1"; break; } } @@ -69,11 +68,11 @@ if (isset($_GET['rallye'])) switch ($_GET['notify']) { case "1": // Activate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET send_notify='Y' WHERE id=%d AND send_notify='N' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE id=%s AND send_notify='N' LIMIT 1"; break; case "0": // Deactivate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET send_notify='N' WHERE id=%d AND send_notify='Y' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE id=%s AND send_notify='Y' LIMIT 1"; break; } } @@ -84,11 +83,11 @@ if (isset($_GET['rallye'])) switch ($_GET['auto']) { case "1": // Activate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET auto_add_new_user='Y' WHERE id=%d AND auto_add_new_user='N' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE id=%s AND auto_add_new_user='N' LIMIT 1"; break; case "0": // Deactivate - $SQL = "UPDATE "._MYSQL_PREFIX."_rallye_data SET auto_add_new_user='N' WHERE id=%d AND auto_add_new_user='Y' LIMIT 1"; + $SQL = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE id=%s AND auto_add_new_user='Y' LIMIT 1"; break; } } @@ -106,15 +105,15 @@ if (isset($_GET['rallye'])) if ($SEL > 0) { // Delete selected rallyes and all it's data - foreach ($_POST['sel'] as $id=>$sel) + foreach ($_POST['sel'] as $id => $sel) { // Remove selected rallye entirely... - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_data WHERE id=%d LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%d", - array(bigintval($id)), __FILE__, __LINE__); - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%d", - array(bigintval($id)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1", + array(bigintval($id)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s", + array(bigintval($id)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s", + array(bigintval($id)), __FILE__, __LINE__); } // Output message @@ -133,7 +132,7 @@ if (isset($_GET['rallye'])) if ($SEL > 0) { // Change selected rallyes and all it's data - foreach ($_POST['title'] as $id=>$title) + foreach ($_POST['title'] as $id => $title) { // Secure ID number $id = bigintval($id); @@ -143,7 +142,7 @@ if (isset($_GET['rallye'])) $END = mktime($_POST['end_hour'][$id] , $_POST['end_min'][$id] , $_POST['end_sec'][$id] , $_POST['end_month'][$id] , $_POST['end_day'][$id] , $_POST['end_year'][$id] ); // Update entry - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_rallye_data SET + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET title='%s', descr='%s', template='%s', @@ -169,10 +168,10 @@ if (isset($_POST['edit'])) { // Make all selected and deactivated rallyes editable $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id=>$sel) + foreach ($_POST['sel'] as $id => $sel) { // Load rallye basic data - $result = SQL_QUERY_ESC("SELECT title, descr, template, start_time, end_time, min_users, min_prices FROM "._MYSQL_PREFIX."_rallye_data WHERE id=%d LIMIT 1", + $result = SQL_QUERY_ESC("SELECT title, descr, template, start_time, end_time, min_users, min_prices FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); list($title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -183,7 +182,7 @@ if (isset($_POST['edit'])) $content['s_hour'] = ADD_SELECTION("hour" , date("G", $start), "start", $id); $content['s_day'] = ADD_SELECTION("day" , date("d", $start), "start", $id); $content['s_month'] = ADD_SELECTION("month", date("m", $start), "start", $id); - $content['s_year'] = ADD_SELECTION("year" , date("Y", $start), "start", $id); + $content['s_year'] = ADD_SELECTION("year" , date('Y', $start), "start", $id); // Ending day $content['e_sec'] = ADD_SELECTION("sec" , date("s", $end) , "end" , $id); @@ -191,7 +190,7 @@ if (isset($_POST['edit'])) $content['e_hour'] = ADD_SELECTION("hour" , date("G", $end) , "end" , $id); $content['e_day'] = ADD_SELECTION("day" , date("d", $end) , "end" , $id); $content['e_month'] = ADD_SELECTION("month", date("m", $end) , "end" , $id); - $content['e_year'] = ADD_SELECTION("year" , date("Y", $end) , "end" , $id); + $content['e_year'] = ADD_SELECTION("year" , date('Y', $end) , "end" , $id); // Remember over values $content['templ'] = RALLYE_TEMPLATE_SELECTION("templ[".$id."]", $templ); @@ -219,11 +218,9 @@ if (isset($_POST['edit'])) // Nothing selected to edit LOAD_TEMPLATE("admin_settings_saved", false, LOAD_TEMPLATE("admin_list_rallye_noselect", true)); } -} - elseif (($_GET['sub'] == "users") && ($_GET['rallye'] > 0)) -{ +} elseif (($_GET['sub'] == "users") && ($_GET['rallye'] > 0)) { // List users and their refs before start and current - $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%d ORDER BY userid", + $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid", array(bigintval($_GET['rallye'])), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { @@ -231,19 +228,23 @@ if (isset($_POST['edit'])) define('__RALLYE_VALUE', $_GET['rallye']); while (list($uid, $old, $opoints) = SQL_FETCHROW($result)) { - // Check for referral count + // Check for referal count $cnt = RALLYE_GET_REFCOUNT($uid, $old); // Output row $Bl = ""; $Br = ""; - if (($opoints > 0) && ($cnt > 0)) { $Bl = ""; $Br = ""; } + if (($opoints > 0) && ($cnt > 0)) { $Bl = ""; $Br = ""; } if (($old > 0) || ($cnt > 0)) { - // Insert link to referral list - //* DEBUG: */ echo "-".$uid."/".$cnt."/".$old."-
"; + // Insert link to referal list + //* DEBUG: */ echo "-".$uid."/".$cnt."/".$old."-
"; $cnt = ADMIN_USER_PROFILE_LINK($uid, $cnt, "list_refs"); $old = ADMIN_USER_PROFILE_LINK($uid, $old, "list_refs"); } + + // Get user points + $points = GET_TOTAL_DATA($uid, "user_points", "points", "userid", false, " AND ref_depth=1 LIMIT 1"); + //* DEBUG: */ echo basename(__FILE__).":uid={$uid},points={$points},opoints={$opoints}
\n"; $content = array( 'sw' => $SW , 'uid' => $uid, @@ -251,7 +252,7 @@ if (isset($_POST['edit'])) 'bold_r' => $Br , 'old' => $old, 'cnt' => $cnt, - 'opoints' => TRANSLATE_COMMA($opoints), + 'opoints' => TRANSLATE_COMMA($points - $opoints), ); $OUT .= LOAD_TEMPLATE("admin_list_rallye_usr_row", true, $content); $SW = 3 - $SW; @@ -274,7 +275,7 @@ if (isset($_POST['edit'])) { // Start listing rallyes $result = SQL_QUERY("SELECT id, admin_id, title, descr, template, start_time, end_time, auto_add_new_user, is_active, send_notify, notified, min_users, min_prices -FROM "._MYSQL_PREFIX."_rallye_data +FROM `{!_MYSQL_PREFIX!}_rallye_data` ORDER BY start_time DESC", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) @@ -287,11 +288,11 @@ ORDER BY start_time DESC", $alogin = GET_ADMIN_LOGIN($aid); // Count assigned prices - $result_prices = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%d", + $result_prices = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s", array(bigintval($id)), __FILE__, __LINE__); // Count joined userids - $result_user = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%d", + $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s", array($id), __FILE__, __LINE__); $joined = SQL_NUMROWS($result_user); @@ -299,7 +300,7 @@ ORDER BY start_time DESC", if ($joined > 0) { // List joined users - $joined = "".$joined.""; + $joined = "".$joined.""; } // Alter some variables @@ -309,7 +310,7 @@ ORDER BY start_time DESC", // Transfer data into array for the template $content = array( - 'select' => "", + 'select' => "", 'aid' => $aid, 'email_link' => CREATE_EMAIL_LINK($aid), 'alogin' => $alogin, @@ -339,9 +340,9 @@ ORDER BY start_time DESC", { case "Y": // Rallye is active so do not edit it! - $content['select'] = "".$id.""; + $content['select'] = "
".$id.""; $content['active_title'] = RALLYE_DEACTIVATE_NOW; - $content['active'] = "0"; + $content['active'] = 0; break; case "N": @@ -355,7 +356,7 @@ ORDER BY start_time DESC", { case "Y": $content['notify_title'] = RALLYE_STOP_NOTIFY_NOW; - $content['notify'] = "0"; + $content['notify'] = 0; break; case "N": @@ -369,7 +370,7 @@ ORDER BY start_time DESC", { case "Y": $content['auto_title'] = RALLYE_STOP_AUTO_ADD_NOW; - $content['auto'] = "0"; + $content['auto'] = 0; break; case "N":