X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=1353ad3d10da2d8b9c733016b2c1dc9fdac96d65;hp=bdb9dedaf6c4ed86e8a64b269737850f92662f81;hb=98077af43126dd7c274fe57f6ea0494e906e8943;hpb=03f62d0b89aa9276ac37f4d616d940fae184d850 diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index bdb9dedaf6..1353ad3d10 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -45,11 +45,11 @@ if (!defined('__SECURITY')) { // Register an administrator account function REGISTER_ADMIN ($user, $md5, $email) { // Login does already exist - $ret = "already"; + $ret = 'already'; // Lookup the admin $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1", - array($user), __FUNCTION__, __LINE__); + array($user), __FUNCTION__, __LINE__); // Is the entry there? if (SQL_NUMROWS($result) == 0) { @@ -95,8 +95,8 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) { $add = runFilterChain('sql_admin_extra_data'); // Get password from DB - $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1", - array($aid), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `password`" . $add . " FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1", + array($aid), __FUNCTION__, __LINE__); // Entry found? if (SQL_NUMROWS($result) == 1) { @@ -195,30 +195,29 @@ function LOGIN_ADMIN ($adminLogin, $passHash) { if ((GET_EXT_VERSION('admins') >= '0.7.0') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ''))) { // Reset counter on out-dated sql_patches version SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=0,last_failure='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1", - array($adminLogin), __FUNCTION__, __LINE__); + array($adminLogin), __FUNCTION__, __LINE__); // Rebuild cache rebuildCacheFiles('admins', 'admin'); } // END - if // Now set all session variables and return the result - return ( - ( - setSession('admin_md5', generatePassString($passHash)) + return (( + setSession('admin_md5', generatePassString($passHash)) ) && ( - setSession('admin_login', $adminLogin) + setSession('admin_login', $adminLogin) ) && ( - setSession('admin_last', time()) + setSession('admin_last', time()) ) && ( - setSession('admin_to', bigintval(REQUEST_POST('timeout'))) - ) - ); + setSession('admin_to', bigintval(REQUEST_POST('timeout'))) + )); } // Only be executed on cookie checking function CHECK_ADMIN_COOKIES ($admin_login, $password) { // By default no admin cookies are found - $ret = '404'; $pass = ''; + $ret = '404'; + $pass = ''; // Get hash $pass = GET_ADMIN_HASH(GET_ADMIN_ID($admin_login)); @@ -230,7 +229,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) { if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) { // Passwords matches! $ret = 'done'; - } + } // END - if // Return result return $ret; @@ -356,7 +355,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) { $GLOBALS['menu']['description'][$menu] = $descr; } $OUT .= "
  • -
    · "; +
    · "; if (($menu == $act) && (empty($wht))) { $OUT .= ""; @@ -886,13 +885,11 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct // "Walk" through all entries foreach ($IDs as $id => $sel) { // Construct SQL query - $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET", - SQL_ESCAPE($table) - ); + $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET", SQL_ESCAPE($table)); // Load data of entry $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1", - array($table, $idColumn, $id), __FUNCTION__, __LINE__); + array($table, $idColumn, $id), __FUNCTION__, __LINE__); // Fetch the data $content = SQL_FETCHARRAY($result); @@ -901,9 +898,9 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct SQL_FREERESULT($result); // Add all status entries (e.g. status column last_updated or so) - $newStatus = "UNKNOWN"; - $oldStatus = "UNKNOWN"; - $statusColumn = "unknown"; + $newStatus = 'UNKNOWN'; + $oldStatus = 'UNKNOWN'; + $statusColumn = 'unknown'; foreach ($statusArray as $column => $statusInfo) { // Does the entry exist? if ((isset($content[$column])) && (isset($statusInfo[$content[$column]]))) { @@ -911,7 +908,7 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct $sql .= sprintf(" %s='%s',", SQL_ESCAPE($column), SQL_ESCAPE($statusInfo[$content[$column]])); // Remember status - if ($statusColumn == "unknown") { + if ($statusColumn == 'unknown') { // Always (!!!) change status column first! $oldStatus = $content[$column]; $newStatus = $statusInfo[$oldStatus];