]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge pull request #10967 from annando/api
[friendica.git] / mod / settings.php
index 9ea99789d18c7b3a520fe68e0557a51d7b55e844..080bcdeb93848a7cc086c60798583752a3b17be3 100644 (file)
@@ -37,7 +37,6 @@ use Friendica\Model\User;
 use Friendica\Module\BaseSettings;
 use Friendica\Module\Security\Login;
 use Friendica\Protocol\Email;
-use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 use Friendica\Worker\Delivery;
 
@@ -216,14 +215,14 @@ function settings_post(App $a)
                }
        }
 
-       $username         = (!empty($_POST['username'])   ? Strings::escapeTags(trim($_POST['username']))     : '');
-       $email            = (!empty($_POST['email'])      ? Strings::escapeTags(trim($_POST['email']))        : '');
-       $timezone         = (!empty($_POST['timezone'])   ? Strings::escapeTags(trim($_POST['timezone']))     : '');
-       $language         = (!empty($_POST['language'])   ? Strings::escapeTags(trim($_POST['language']))     : '');
+       $username         = (!empty($_POST['username'])        ? trim($_POST['username'])          : '');
+       $email            = (!empty($_POST['email'])           ? trim($_POST['email'])             : '');
+       $timezone         = (!empty($_POST['timezone'])        ? trim($_POST['timezone'])          : '');
+       $language         = (!empty($_POST['language'])        ? trim($_POST['language'])          : '');
 
-       $defloc           = (!empty($_POST['defloc'])     ? Strings::escapeTags(trim($_POST['defloc']))       : '');
-       $maxreq           = (!empty($_POST['maxreq'])     ? intval($_POST['maxreq'])             : 0);
-       $expire           = (!empty($_POST['expire'])     ? intval($_POST['expire'])             : 0);
+       $defloc           = (!empty($_POST['defloc'])          ? trim($_POST['defloc'])            : '');
+       $maxreq           = (!empty($_POST['maxreq'])          ? intval($_POST['maxreq'])          : 0);
+       $expire           = (!empty($_POST['expire'])          ? intval($_POST['expire'])          : 0);
        $def_gid          = (!empty($_POST['group-selection']) ? intval($_POST['group-selection']) : 0);
 
 
@@ -309,7 +308,9 @@ function settings_post(App $a)
 
        if ($email != $user['email']) {
                //  check for the correct password
-               if (!User::authenticate(intval(local_user()), $_POST['mpassword'])) {
+               try {
+                       User::getIdFromPasswordAuthentication(local_user(), $_POST['mpassword']);
+               } catch (Exception $ex) {
                        $err .= DI::l10n()->t('Wrong Password.');
                        $email = $user['email'];
                }
@@ -333,7 +334,7 @@ function settings_post(App $a)
        }
 
        if (($timezone != $user['timezone']) && strlen($timezone)) {
-               date_default_timezone_set($timezone);
+               $a->setTimeZone($timezone);
        }
 
        $aclFormatter = DI::aclFormatter();
@@ -492,7 +493,7 @@ function settings_content(App $a)
                $settings_connectors = '';
                Hook::callAll('connector_settings', $settings_connectors);
 
-               if (is_site_admin()) {
+               if ($a->isSiteAdmin()) {
                        $diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora (Socialhome, Hubzilla)'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
                        $ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('OStatus (GNU Social)'), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
                } else {
@@ -601,7 +602,7 @@ function settings_content(App $a)
        $expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false);
 
        if (!strlen($user['timezone'])) {
-               $timezone = date_default_timezone_get();
+               $timezone = $a->getTimeZone();
        }
 
        // Set the account type to "Community" when the page is a community page but the account type doesn't fit