]> git.mxchange.org Git - friendica.git/commitdiff
applied coding convention:
authorRoland Häder <roland@mxchange.org>
Mon, 23 Jan 2017 08:44:53 +0000 (09:44 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 18 Mar 2017 23:40:21 +0000 (00:40 +0100)
- replaced space -> tab (code indenting)
- added curly braces
- used dbm::is_result() if $r is no result (may happen)

Signed-off-by: Roland Häder <roland@mxchange.org>
mod/settings.php

index 32ccaf541af0aa738469642a3274049b6d6f1d06..94b93f9b9564ce6d6483375709afbc3aa33db444 100644 (file)
@@ -381,13 +381,15 @@ function settings_post(App $a) {
                        $err = true;
         }
 
-        //  check if the old password was supplied correctly before
-        //  changing it to the new value
-        $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
-        if( $oldpass != $r[0]['password'] ) {
-            notice( t('Wrong password.') . EOL);
-            $err = true;
-        }
+               //  check if the old password was supplied correctly before
+               //  changing it to the new value
+               $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
+               if (!dbm::is_result($r)) {
+                       killme();
+               } elseif ( $oldpass != $r[0]['password'] ) {
+                       notice( t('Wrong password.') . EOL);
+                       $err = true;
+               }
 
                if(! $err) {
                        $password = hash('whirlpool',$newpass);
@@ -395,10 +397,11 @@ function settings_post(App $a) {
                                dbesc($password),
                                intval(local_user())
                        );
-                       if($r)
+                       if($r) {
                                info( t('Password changed.') . EOL);
-                       else
+                       } else {
                                notice( t('Password update failed. Please try again.') . EOL);
+                       }
                }
        }