]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Queries fixed
[mailer.git] / inc / modules / admin / admin-inc.php
index f8017ebbef57b183ebe1e64e96abb1e0e2f7df73..b7537c8b604212d74f8b9bc9236c88aa6f78b9d0 100644 (file)
@@ -97,7 +97,7 @@ function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) {
                                // All fine
                                $ret = 'done';
                        } else {
-                               // Set status
+                               // Did not match!
                                $ret = 'password';
                        }
                } // END - if
@@ -626,9 +626,9 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') {
        if (($title == '') && (isValidUserId($userid))) {
                // Set userid as title
                $title = $userid;
-       } elseif ($userid == 0) {
+       } elseif (!isValidUserId($userid)) {
                // User id zero is invalid
-               return '<strong>' . $userid . '</strong>';
+               return '<strong>' . makeNullToZero($userid) . '</strong>';
        }
 
        if (($title == '0') && ($what == 'list_refs')) {
@@ -1338,12 +1338,17 @@ function doResetAdminPassword ($login, $password) {
        // Generate hash (we already check for sql_patches in generateHash())
        $passHash = generateHash($password);
 
+       // Prepare fake POST data
+       $postData = array(
+               'login'    => array(getAdminId($login) => $login),
+               'password' => array(getAdminId($login) => $passHash),
+       );
+
        // Update database
-       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `password`='%s' WHERE `login`='%s' LIMIT 1",
-               array($passHash, $login), __FUNCTION__, __LINE__);
+       $message = adminsChangeAdminAccount($postData, '', false);
 
        // Run filters
-       runFilterChain('post_form_reset_pass', array('login' => $login, 'hash' => $passHash));
+       runFilterChain('post_form_reset_pass', array('login' => $login, 'hash' => $passHash, 'message' => $message));
 
        // Return output
        return '{--ADMIN_PASSWORD_RESET_DONE--}';