]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Added a for-loop (#5442)
[friendica.git] / mod / settings.php
index cd45cc50705e69507aae4727933edaf1691dfa32..d984819593e19f6e57376959ee8e57113a9a0d19 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
@@ -26,12 +27,12 @@ use Friendica\Util\Temporal;
 function get_theme_config_file($theme)
 {
        $a = get_app();
-       $base_theme = $a->theme_info['extends'];
+       $base_theme = defaults($a->theme_info, 'extends');
 
        if (file_exists("view/theme/$theme/config.php")) {
                return "view/theme/$theme/config.php";
        }
-       if (file_exists("view/theme/$base_theme/config.php")) {
+       if ($base_theme && file_exists("view/theme/$base_theme/config.php")) {
                return "view/theme/$base_theme/config.php";
        }
        return null;
@@ -149,7 +150,7 @@ function settings_post(App $a)
                check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
 
                $key = $_POST['remove'];
-               dba::delete('tokens', ['id' => $key, 'uid' => local_user()]);
+               DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
                goaway(System::baseUrl(true)."/settings/oauth/");
                return;
        }
@@ -240,12 +241,12 @@ function settings_post(App $a)
                                        intval(local_user())
                                );
                                if (!DBM::is_result($r)) {
-                                       dba::insert('mailacct', ['uid' => local_user()]);
+                                       DBA::insert('mailacct', ['uid' => local_user()]);
                                }
                                if (strlen($mail_pass)) {
                                        $pass = '';
                                        openssl_public_encrypt($mail_pass, $pass, $a->user['pubkey']);
-                                       dba::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
+                                       DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
                                }
                                $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
                                        `action` = %d, `movetofolder` = '%s',
@@ -509,9 +510,8 @@ function settings_post(App $a)
                        $err .= L10n::t('Invalid email.');
                }
                //  ensure new email is not the admin mail
-               //if ((x($a->config, 'admin_email')) && (strcasecmp($email, $a->config['admin_email']) == 0)) {
-               if (x($a->config, 'admin_email')) {
-                       $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
+               if (Config::get('config', 'admin_email')) {
+                       $adminlist = explode(",", str_replace(" ", "", strtolower(Config::get('config', 'admin_email'))));
                        if (in_array(strtolower($email), $adminlist)) {
                                $err .= L10n::t('Cannot change to that email.');
                                $email = $a->user['email'];
@@ -706,7 +706,7 @@ function settings_content(App $a)
                if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
                        check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
 
-                       dba::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
+                       DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
                        goaway(System::baseUrl(true)."/settings/oauth/");
                        return;
                }
@@ -989,7 +989,7 @@ function settings_content(App $a)
         * ACCOUNT SETTINGS
         */
 
-       $profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
+       $profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
        if (!DBM::is_result($profile)) {
                notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
                return;
@@ -1155,7 +1155,7 @@ function settings_content(App $a)
 
        // Private/public post links for the non-JS ACL form
        $private_post = 1;
-       if ($_REQUEST['public']) {
+       if (!empty($_REQUEST['public']) && !$_REQUEST['public']) {
                $private_post = 0;
        }