]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_rallyes.php
Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-list_rallyes.php
index 94e8f6f68a4cfcef3129aff74f195f148f2eaa69..788c49723494a258a43cbe84f31dfc01b1621968 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -55,13 +55,13 @@ if (isGetRequestElementSet('rallye_id')) {
                // Activate / deactivate
                switch (getRequestElement('activate')) {
                        case '1': // Activate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `is_active`='Y' WHERE `id`=%s AND `is_active`='N' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `is_active`='Y' WHERE `id`=%s AND `is_active`='N' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
 
                        case '0': // Deactivate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `is_active`='N' WHERE `id`=%s AND `is_active`='Y' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `is_active`='N' WHERE `id`=%s AND `is_active`='Y' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
@@ -70,13 +70,13 @@ if (isGetRequestElementSet('rallye_id')) {
                // Automatic notification
                switch (getRequestElement('notify')) {
                        case '1': // Activate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `send_notify`='Y' WHERE `id`=%s AND `send_notify`='N' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `send_notify`='Y' WHERE `id`=%s AND `send_notify`='N' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
 
                        case '0': // Deactivate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `send_notify`='N' WHERE `id`=%s AND `send_notify`='Y' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `send_notify`='N' WHERE `id`=%s AND `send_notify`='Y' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
@@ -85,13 +85,13 @@ if (isGetRequestElementSet('rallye_id')) {
                // Automatic adding of new members
                switch (getRequestElement('auto')) {
                        case '1': // Activate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `auto_add_new_user`='Y' WHERE `id`=%s AND `auto_add_new_user`='N' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `auto_add_new_user`='Y' WHERE `id`=%s AND `auto_add_new_user`='N' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
 
                        case '0': // Deactivate
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `auto_add_new_user`='N' WHERE `id`=%s AND `auto_add_new_user`='Y' LIMIT 1",
+                               addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `auto_add_new_user`='N' WHERE `id`=%s AND `auto_add_new_user`='Y' LIMIT 1",
                                        array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__, FALSE)
                                );
                                break;
@@ -109,11 +109,11 @@ if (isGetRequestElementSet('rallye_id')) {
                // Delete selected rallyes and all it's data
                foreach (postRequestElement('sel') as $id => $selected) {
                        // Remove selected rallye entirely...
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
+                       addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__, FALSE));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s",
+                       addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s",
                                array(bigintval($id)), __FILE__, __LINE__, FALSE));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s",
+                       addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s",
                                array(bigintval($id)), __FILE__, __LINE__, FALSE));
                } // END - foreach
 
@@ -138,11 +138,11 @@ if (isGetRequestElementSet('rallye_id')) {
                        $id = bigintval($id);
 
                        // Generate timestamps
-                       $START = mktime(postRequestElement('start_time_hour', $id), postRequestElement('start_time_min', $id), 0, postRequestElement('start_time_month', $id), postRequestElement('start_time_day', $id), postRequestElement('start_time_year', $id));
-                       $END   = mktime(postRequestElement('end_time_hour', $id)  , postRequestElement('end_time_min', $id)  , 0, postRequestElement('end_time_month', $id)  , postRequestElement('end_time_day', $id)  , postRequestElement('end_time_year', $id)  );
+                       $START = mktime(postRequestElement('start_time_ho', $id), postRequestElement('start_time_mi', $id), 0, postRequestElement('start_time_mo', $id), postRequestElement('start_time_da', $id), postRequestElement('start_time_ye', $id));
+                       $END   = mktime(postRequestElement('end_time_ho', $id)  , postRequestElement('end_time_mi', $id)  , 0, postRequestElement('end_time_mo', $id)  , postRequestElement('end_time_da', $id)  , postRequestElement('end_time_ye', $id)  );
 
                        // Update entry
-                       addSql(SQL_QUERY_ESC("UPDATE
+                       addSql(sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_rallye_data`
 SET
        `title`='%s',
@@ -185,14 +185,14 @@ if ((isFormSent('edit')) || (isFormSent('delete'))) {
                // Then set it
                $mode = 'delete';
        } // END - if
-       
+
        // Check for selections
        if (ifPostContainsSelections()) {
                // Make all selected and deactivated rallyes editable
                $OUT = '';
                foreach (postRequestElement('sel') as $id => $selected) {
                        // Load rallye basic data
-                       $result = SQL_QUERY_ESC("SELECT
+                       $result = sqlQueryEscaped("SELECT
        `title`,
        `descr`,
        `template`,
@@ -208,10 +208,10 @@ LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
 
                        // Fetch an array
-                       $content = SQL_FETCHARRAY($result);
+                       $content = sqlFetchArray($result);
 
                        // Free result
-                       SQL_FREERESULT($result);
+                       sqlFreeResult($result);
 
                        // Only for editing ...
                        if ($mode == 'edit') {
@@ -252,7 +252,7 @@ LIMIT 1",
        }
 } elseif ((getRequestElement('sub') == 'users') && (getRequestElement('rallye_id') > 0)) {
        // List users and their refs before start and current
-       $result = SQL_QUERY_ESC("SELECT
+       $result = sqlQueryEscaped("SELECT
        `userid`,
        `refs`,
        `curr_points`
@@ -263,10 +263,10 @@ WHERE
 ORDER BY
        `userid` ASC",
                array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__);
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNumRows($result)) {
                $OUT = '';
                $content['rallye_id'] = bigintval(getRequestElement('rallye_id'));
-               while ($row = SQL_FETCHARRAY($result)) {
+               while ($row = sqlFetchArray($result)) {
                        // Check for referral count
                        $count = getReferralRallyeRefsCount($row['userid'], $row['refs']);
 
@@ -303,7 +303,7 @@ ORDER BY
                $content['rallye_id'] = bigintval(getRequestElement('rallye_id'));
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
 
                // Load template
                loadTemplate('admin_list_rallye_usr', FALSE, $content);
@@ -313,7 +313,7 @@ ORDER BY
        }
 } else {
        // Start listing rallyes
-       $result = SQL_QUERY("SELECT
+       $result = sqlQuery("SELECT
        `id` AS `rallye_id`,
        `admin_id`,
        `title`,
@@ -333,10 +333,10 @@ ORDER BY
        `start_time` DESC", __FILE__, __LINE__);
 
        // Records found?
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNumRows($result)) {
                // List found rallyes
                $OUT = '';
-               while ($data = SQL_FETCHARRAY($result)) {
+               while ($data = sqlFetchArray($result)) {
                        // Count joined userids
                        $users = countSumTotalData($data['rallye_id'], 'rallye_users', 'rallye_id', 'rallye_id', TRUE);
 
@@ -412,7 +412,7 @@ ORDER BY
                } // END - while
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
 
                // Remember rows in array
                $content['rows'] = $OUT;