]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge branch 'develop' into rewrites/dbm_is_result
[friendica.git] / mod / settings.php
index 41783815e7fd3b4364166bf7f87291cc042efb61..9aa7c57624381219bf2e12b46ff7b5ee0a86374d 100644 (file)
@@ -16,9 +16,9 @@ function get_theme_config_file($theme){
        return null;
 }
 
-function settings_init(&$a) {
+function settings_init(App &$a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                notice( t('Permission denied.') . EOL );
                return;
        }
@@ -116,22 +116,24 @@ function settings_init(&$a) {
 }
 
 
-function settings_post(&$a) {
+function settings_post(App &$a) {
 
-       if(! local_user())
+       if (! local_user()) {
                return;
+       }
 
-       if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+       if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
                return;
+       }
 
-       if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
+       if (count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
 
        $old_page_flags = $a->user['page-flags'];
 
-       if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){
+       if (($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')) {
                check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
 
                $key = $_POST['remove'];
@@ -142,7 +144,7 @@ function settings_post(&$a) {
                return;
        }
 
-       if(($a->argc > 2) && ($a->argv[1] === 'oauth')  && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) {
+       if (($a->argc > 2) && ($a->argv[1] === 'oauth')  && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) {
 
                check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
 
@@ -225,7 +227,7 @@ function settings_post(&$a) {
                                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                        intval(local_user())
                                );
-                               if(! dbm::is_result($r)) {
+                               if (! dbm::is_result($r)) {
                                        q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
                                                intval(local_user())
                                        );
@@ -628,8 +630,9 @@ function settings_post(&$a) {
        if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
                // Update global directory in background
                $url = $_SESSION['my_url'];
-               if($url && strlen(get_config('system','directory')))
+               if ($url && strlen(get_config('system','directory'))) {
                        proc_run(PRIORITY_LOW, "include/directory.php", $url);
+               }
        }
 
        require_once('include/profile_update.php');
@@ -651,17 +654,17 @@ function settings_post(&$a) {
 }
 
 
-function settings_content(&$a) {
+function settings_content(App &$a) {
 
        $o = '';
        nav_set_selected('settings');
 
-       if(! local_user()) {
+       if (! local_user()) {
                #notice( t('Permission denied.') . EOL );
                return;
        }
 
-       if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
+       if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
                notice( t('Permission denied.') . EOL );
                return;
        }
@@ -752,8 +755,9 @@ function settings_content(&$a) {
                $settings_addons = "";
 
                $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
-               if(! dbm::is_result($r))
+               if (! dbm::is_result($r)) {
                        $settings_addons = t('No Plugin settings configured');
+               }
 
                call_hooks('plugin_settings', $settings_addons);
 
@@ -821,8 +825,10 @@ function settings_content(&$a) {
 
                $settings_connectors .= mini_group_select(local_user(), $default_group, t("Default group for OStatus contacts"));
 
-               if ($legacy_contact != "")
+               /// @TODO Found to much different usage to test empty/non-empty strings (e.g. empty(), trim() == '' ) which is wanted?
+               if ($legacy_contact != "") {
                        $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.App::get_baseurl().'/ostatus_subscribe?url='.urlencode($legacy_contact).'">';
+               }
 
                $settings_connectors .= '<div id="legacy-contact-wrapper" class="field input">';
                $settings_connectors .= '<label id="legacy-contact-label" for="snautofollow-checkbox">'. t('Your legacy GNU Social account'). '</label>';