]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_rallyes.php
More improved SQL queries
[mailer.git] / inc / modules / admin / what-list_rallyes.php
index 554efeaefe9ec6c743440bbce6bbbc2ce2ec5be8..44b4be1d7ad8f867f54c6196198a5446999b91ad 100644 (file)
@@ -53,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=%s 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=%s 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;
                }
        }
@@ -68,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=%s 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=%s 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;
                }
        }
@@ -83,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=%s 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=%s 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;
                }
        }
@@ -108,11 +108,11 @@ if (isset($_GET['rallye']))
                foreach ($_POST['sel'] as $id => $sel)
                {
                        // Remove selected rallye entirely...
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_data WHERE id=%s LIMIT 1",
+                       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",
+                       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",
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
                                array(bigintval($id)), __FILE__, __LINE__);
                }
 
@@ -142,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
-                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_rallye_data SET
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET
 title='%s',
 descr='%s',
 template='%s',
@@ -171,7 +171,7 @@ if (isset($_POST['edit']))
                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=%s 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);
@@ -220,7 +220,7 @@ if (isset($_POST['edit']))
        }
 } 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=%s 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)
        {
@@ -275,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)
@@ -288,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=%s",
+                       $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=%s",
+                       $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);
 
@@ -300,7 +300,7 @@ ORDER BY start_time DESC",
                        if ($joined > 0)
                        {
                                // List joined users
-                               $joined = "<a href=\"".URL."/modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=".$id."\" title=\"".RALLYE_LIST_USERS."\">".$joined."</a>";
+                               $joined = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=".$id."\" title=\"".RALLYE_LIST_USERS."\">".$joined."</a>";
                        }
 
                        // Alter some variables
@@ -310,7 +310,7 @@ ORDER BY start_time DESC",
 
                        // Transfer data into array for the template
                        $content = array(
-                               'select'     => "<INPUT type=\"checkbox\" name=\"sel[".$id."]\" class=\"admin_normal\" value=\"1\">",
+                               'select'     => "<input type=\"checkbox\" name=\"sel[".$id."]\" class=\"admin_normal\" value=\"1\" />",
                                'aid'        => $aid,
                                'email_link' => CREATE_EMAIL_LINK($aid),
                                'alogin'     => $alogin,