X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=6eee1eddf6e93996b89532899bfbb5c77fb54678;hp=5d655b2f74b4fac3935630f250db0f6b54d4a08f;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=8da353fa4bb729bb3299d247803c23833a52a327 diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 5d655b2f74..6eee1eddf6 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -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 * @@ -42,19 +42,22 @@ if (!defined('__SECURITY')) { // Register an administrator account function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') { + // Only let valid data pass + assert(in_array($accessLevel, array('allow', 'deny'))); + // Login does already exist $ret = 'already'; // Lookup the admin - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", array($adminLogin), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNumRows($result)) { // Is ext-admins installed and version at least 0.3.0? if (isExtensionInstalledAndNewer('admins', '0.3.0')) { // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", array( $adminLogin, $passHash, @@ -63,7 +66,7 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'd ), __FUNCTION__, __LINE__); } else { // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", array( $adminLogin, $passHash, @@ -76,7 +79,7 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'd } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $ret; @@ -132,6 +135,8 @@ function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) { // Only be executed on cookie checking function ifAdminCookiesAreValid ($adminLogin, $passHash) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLogin=' . $adminLogin . ',passHash=' . $passHash . ' - CALLED!'); + // First of all, no admin login is found $ret = '404'; @@ -158,7 +163,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { } // END - if // Return status - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret='.$ret); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret . ' - EXIT!'); return $ret; } @@ -187,7 +192,7 @@ function doAdminAction () { loadTemplate('admin_main', FALSE, $content); // Check if action/what pair is valid - $result_action = SQL_QUERY_ESC("SELECT + $result_action = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` @@ -212,9 +217,9 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result_action) == 1) { + if (sqlNumRows($result_action) == 1) { // Is valid but does the inlcude file exists? - $inc = sprintf("inc/modules/admin/action-%s.php", $action); + $inc = sprintf('inc/modules/admin/action-%s.php', $action); if ((isIncludeReadable($inc)) && (isMenuActionValid('admin', $action, $what)) && ($GLOBALS['acl_allow'] === TRUE)) { // Ok, we finally load the admin action module loadInclude($inc); @@ -231,7 +236,7 @@ LIMIT 1", } // Free memory - SQL_FREERESULT($result_action); + sqlFreeResult($result_action); // Tableset footer loadTemplate('admin_main_footer', FALSE, $content); @@ -264,7 +269,7 @@ function addAdminMenu ($action, $what) { $GLOBALS['menu']['title'] = array(); // Build main menu - $result_main = SQL_QUERY("SELECT + $result_main = sqlQuery("SELECT `action` AS `main_action`, `title` AS `main_title`, `descr` AS `main_descr` @@ -277,13 +282,13 @@ ORDER BY `id` DESC", __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result_main)) { + if (!ifSqlHasZeroNumRows($result_main)) { $OUT .= ''; // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); } // END - if // Return content @@ -344,7 +349,7 @@ function addAdminSubMenu ($mainContent, $action, $what) { $OUT = ''; // Check for menu entries - $result_what = SQL_QUERY_ESC("SELECT + $result_what = sqlQueryEscaped("SELECT `what` AS `sub_what`, `title` AS `sub_title`, `descr` AS `sub_descr` @@ -360,7 +365,7 @@ ORDER BY array($mainContent['main_action']), __FUNCTION__, __LINE__); // Remember the count for later checks - setAdminMenuHasEntries($mainContent['main_action'], ((!SQL_HASZERONUMS($result_what)) && (($action == $mainContent['main_action']) || (isAdminMenuJavascriptEnabled())))); + setAdminMenuHasEntries($mainContent['main_action'], ((!ifSqlHasZeroNumRows($result_what)) && (($action == $mainContent['main_action']) || (isAdminMenuJavascriptEnabled())))); // Start li-tag for sub menu content $OUT .= '
  • '; @@ -371,14 +376,14 @@ ORDER BY $SUB = TRUE; // Are there entries? - if (!SQL_HASZERONUMS($result_what)) { + if (!ifSqlHasZeroNumRows($result_what)) { // Start HTML code $OUT .= '