]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-adminedit.php
Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-adminedit.php
index c446faeccf6bf9ba15a6ef516d05554c006fa552..715c31c67ca1be0091c45d1336514c2c1a05c11c 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 *
@@ -60,11 +60,11 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        foreach (postRequestElement('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $count++;
-                       $result = SQL_QUERY_ESC("SELECT `title`, `action`, `what`, `descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                       $result = sqlQueryEscaped("SELECT `title`, `action`, `what`, `descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
                                array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1) {
+                       if (sqlNumRows($result) == 1) {
                                // Entry found so we load the stuff...
-                               $content = SQL_FETCHARRAY($result);
+                               $content = sqlFetchArray($result);
 
                                // Prepare data for the row template
                                $content = array(
@@ -89,7 +89,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                        }
 
                        // Free result and switch color
-                       SQL_FREERESULT($result);
+                       sqlFreeResult($result);
                } // END - if
        } // END - foreach
 
@@ -110,11 +110,11 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        foreach (postRequestElement('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $count++;
-                       $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                       $result = sqlQueryEscaped("SELECT `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
                                array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1) {
+                       if (sqlNumRows($result) == 1) {
                                // Entry found so we load the stuff...
-                               $content = SQL_FETCHARRAY($result);
+                               $content = sqlFetchArray($result);
 
                                // Prepare data for the row template
                                $content = array(
@@ -130,7 +130,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                                );
                                $OUT .= loadTemplate('admin_menu_404_row', TRUE, $content);
                        }
-                       SQL_FREERESULT($result);
+                       sqlFreeResult($result);
                } // END - if
        } // END - switch
 
@@ -150,7 +150,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                                $sel = bigintval($sel);
 
                                // Update entry
-                               SQL_QUERY_ESC("UPDATE
+                               sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_admin_menu`
 SET
        `title`='%s',
@@ -176,7 +176,7 @@ LIMIT 1",
 
                case 'delete': // Delete menu
                        foreach (postRequestElement('sel') as $sel => $menu) {
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
                                        array(bigintval($sel)), __FILE__, __LINE__);
                        } // END - foreach
 
@@ -185,7 +185,7 @@ LIMIT 1",
                        break;
 
                default: // Unexpected action
-                       logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestElement('ok')));
+                       logDebugMessage(__FILE__, __LINE__, sprintf('Unsupported action %s detected.', postRequestElement('ok')));
                        displayMessage('{%message,ADMIN_UNKNOWN_OKAY=' . postRequestElement('ok') . '%}');
                        break;
        } // END - switch
@@ -194,16 +194,16 @@ LIMIT 1",
        doAdminProcessMenuWeightning('admin', $AND);
 
        // Run SQL
-       $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);
+       $result = sqlQuery("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);
 
        // Are there entries?
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNumRows($result)) {
                // Init variables
                $OUT = '';
                $count = '0';
 
                // Process all entries
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Remember sub value
                        $content['sub'] = $subMenu;
 
@@ -215,7 +215,7 @@ LIMIT 1",
                        if (($content['sort'] == '0') || (($content['sort'] == 1) && (!empty($subMenu)))) {
                                // Is highest position
                                $content['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $content['action'] . '&amp;w=' . $content['what'] . '&amp;tid=' . ($content['sort']+1) . '&amp;fid=' . $content['sort'] . '%}">{--LOWER--}</a>';
-                       } elseif (SQL_NUMROWS($result) == $count) {
+                       } elseif (sqlNumRows($result) == $count) {
                                // Is lowest position
                                $content['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $content['action'] . '&amp;w=' . $content['what'] . '&amp;tid=' . ($content['sort']-1) . '&amp;fid=' . $content['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($content['sort'] > 0) {
@@ -235,7 +235,7 @@ LIMIT 1",
                $content['sub']  = $subMenu;
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
 
                // Load template
                loadTemplate('admin_edit_admin_menu', FALSE, $content);