Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-guest_add.php
index fd1e10ed35788e96aec4427bb83c3f6e7f208545..b17b369e97621c8fbc569331156813620b479e66 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 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 *
@@ -54,7 +54,7 @@ if (!isFormSent()) {
        $menus = array(); $titles = array(); $below = array();
 
        // Get all available main menus
-       $result_menu = SQL_QUERY("SELECT
+       $result_menu = sqlQuery("SELECT
        `action`, `title`, `sort`
 FROM
        `{?_MYSQL_PREFIX?}_guest_menu`
@@ -62,10 +62,11 @@ WHERE
        (`what`='' OR `what` IS NULL)
 ORDER BY
        `sort` ASC", __FILE__, __LINE__);
-       if (!SQL_HASZERONUMS($result_menu)) {
+
+       if (!ifSqlHasZeroNumRows($result_menu)) {
                // Read menu structure
                // @TODO Cant this be rewritten?
-               while ($content = SQL_FETCHARRAY($result_menu)) {
+               while ($content = sqlFetchArray($result_menu)) {
                        // Menu actions
                        array_push($menus, $content['action']);
 
@@ -97,7 +98,7 @@ ORDER BY
                // Load sub menus :)
                foreach ($menus as $key_main => $value_main) {
                        // Query for sub menus
-                       $result = SQL_QUERY_ESC("SELECT
+                       $result = sqlQueryEscaped("SELECT
        `what`, `title`, `sort`
 FROM
        `{?_MYSQL_PREFIX?}_guest_menu`
@@ -107,14 +108,15 @@ WHERE
        `what` IS NOT NULL
 ORDER BY `sort` ASC",
                                array($value_main), __FILE__, __LINE__);
-                       if (!SQL_HASZERONUMS($result)) {
+
+                       if (!ifSqlHasZeroNumRows($result)) {
                                // Initialize 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']);
 
@@ -145,12 +147,12 @@ ORDER BY `sort` ASC",
                        } // END - if
 
                        // Free memory
-                       SQL_FREERESULT($result);
+                       sqlFreeResult($result);
                } // END - foreach
        } // END - if
 
        // Free memory
-       SQL_FREERESULT($result_menu);
+       sqlFreeResult($result_menu);
 
        $OUT = '<select class="form_select" name="sort" size="1">
       <option value="0">{--ADMIN_IS_FIRST_MENU--}</option>';
@@ -181,7 +183,7 @@ ORDER BY `sort` ASC",
 } elseif (!isDemoModeActive()) {
        // Insert new menu entry
        if (isPostRequestElementSet('menu')) {
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `what`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s','%s')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `what`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s','%s')",
                        array(
                                postRequestElement('menu'),
                                postRequestElement('name'),
@@ -191,7 +193,7 @@ ORDER BY `sort` ASC",
                                postRequestElement('active'),
                        ), __FILE__, __LINE__);
        } else {
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')",
                        array(
                                postRequestElement('name'),
                                postRequestElement('title'),