Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-admin_add.php
index 0fb82ebbd68cc9bd258f2c880b1aba5e5ac55b79..d9a9a59155313607d3a6bb462d3e118e0d34c640 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,11 +55,11 @@ if (!isFormSent()) {
        $below = array();
 
        // Get all available main menus
-       $result = SQL_QUERY("SELECT `action`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
-       if (!SQL_HASZERONUMS($result)) {
+       $result = sqlQuery("SELECT `action`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
+       if (!ifSqlHasZeroNumRows($result)) {
                // Read menu structure
                // @TODO Cant this be rewritten?
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Menu actions
                        array_push($menus, $content['action']);
 
@@ -71,7 +71,7 @@ if (!isFormSent()) {
                } // END - while
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
 
                // Remove double eintries
                // @TODO This can be somehow rewritten to a function
@@ -93,16 +93,16 @@ if (!isFormSent()) {
 
                // Load sub menus :)
                foreach ($menus as $key_main => $value_main) {
-                       $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
+                       $result = sqlQueryEscaped("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
                                array($value_main), __FILE__, __LINE__);
-                       if (!SQL_HASZERONUMS($result)) {
+                       if (!ifSqlHasZeroNumRows($result)) {
                                // Init arrays
                                $menus[$value_main] = array();
                                $titles[$value_main] = array();
                                $below[$value_main] = array();
 
                                // Read menu structure
-                               while ($content = SQL_FETCHARRAY($result)) {
+                               while ($content = sqlFetchArray($result)) {
                                        // Menu actions
                                        array_push($menus[$value_main], $content['what']);
 
@@ -114,7 +114,7 @@ if (!isFormSent()) {
                                } // END - while
 
                                // Free memory
-                               SQL_FREERESULT($result);
+                               sqlFreeResult($result);
 
                                // Remove double eintries
                                // @TODO This can be somehow rewritten to a function
@@ -160,12 +160,12 @@ if (!isFormSent()) {
        $content['action_selection'] = adminAddMenuSelectionBox('admin', 'action', 'menu');
 
        // Display form
-       loadTemplate('admin_add_admin_menu', false, $content);
+       loadTemplate('admin_add_admin_menu', FALSE, $content);
 } elseif (!isDemoModeActive()) {
        // Insert new menu entry
        if (isPostRequestElementSet('menu')) {
                // Add sub menu
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`, `what`, `title`, `descr`, `sort`) VALUES ('%s','%s','%s','%s','%s')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`, `what`, `title`, `descr`, `sort`) VALUES ('%s','%s','%s','%s','%s')",
                        array(
                                postRequestElement('menu'),
                                postRequestElement('name'),
@@ -176,7 +176,7 @@ if (!isFormSent()) {
                );
        } else {
                // Add main menu
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (action, title, descr, sort) VALUES ('%s','%s','%s','%s')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (action, title, descr, sort) VALUES ('%s','%s','%s','%s')",
                        array(
                                postRequestElement('name'),
                                postRequestElement('title'),