]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Fix formatting in mod/settings
[friendica.git] / mod / settings.php
index 8ad82b023d67501f973e4b28a4fc554ac6651e8c..6ac3af285caf95889c7fe739f4f83b68627ee58a 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Model\GlobalContact;
 use Friendica\Model\User;
+use Friendica\Protocol\Email;
 
 require_once 'include/group.php';
 
@@ -259,12 +260,12 @@ function settings_post(App $a) {
                                );
                                if (DBM::is_result($r)) {
                                        $eacct = $r[0];
-                                       require_once('include/email.php');
-                                       $mb = construct_mailbox_name($eacct);
+                                       $mb = Email::constructMailboxName($eacct);
+
                                        if (strlen($eacct['server'])) {
                                                $dcrpass = '';
                                                openssl_private_decrypt(hex2bin($eacct['pass']), $dcrpass, $a->user['prvkey']);
-                                               $mbox = email_connect($mb, $mail_user, $dcrpass);
+                                               $mbox = Email::connect($mb, $mail_user, $dcrpass);
                                                unset($dcrpass);
                                                if (!$mbox) {
                                                        $failed = true;
@@ -347,7 +348,6 @@ function settings_post(App $a) {
                        }
                }
 
-
                $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
                                dbesc($theme),
                                intval(local_user())
@@ -369,7 +369,6 @@ function settings_post(App $a) {
        call_hooks('settings_post', $_POST);
 
        if (x($_POST, 'password') || x($_POST, 'confirm')) {
-
                $newpass = $_POST['password'];
                $confirm = $_POST['confirm'];
 
@@ -384,9 +383,8 @@ function settings_post(App $a) {
                        $err = true;
         }
 
-        //  check if the old password was supplied correctly before
-        //  changing it to the new value
         if (User::authenticate(intval(local_user()), $_POST['opassword'])) {
+        //  check if the old password was supplied correctly before changing it to the new value
             notice(t('Wrong password.') . EOL);
             $err = true;
         }
@@ -397,14 +395,14 @@ 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);
+                       }
                }
        }
 
-
        $username         = ((x($_POST, 'username'))   ? notags(trim($_POST['username']))     : '');
        $email            = ((x($_POST, 'email'))      ? notags(trim($_POST['email']))        : '');
        $timezone         = ((x($_POST, 'timezone'))   ? notags(trim($_POST['timezone']))     : '');