]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / settings.php
index 3e851c9be8fa7e4d8199cf6a36ab038be3237e0a..28690f15b46eac93a29e17fc80d00fc0ba2ad0c1 100644 (file)
@@ -225,7 +225,7 @@ function settings_post(&$a) {
                                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                        intval(local_user())
                                );
-                               if(! count($r)) {
+                               if(! dbm::is_result($r)) {
                                        q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
                                                intval(local_user())
                                        );
@@ -255,7 +255,7 @@ function settings_post(&$a) {
                                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                        intval(local_user())
                                );
-                               if(count($r)) {
+                               if(dbm::is_result($r)) {
                                        $eacct = $r[0];
                                        require_once('include/email.php');
                                        $mb = construct_mailbox_name($eacct);
@@ -301,6 +301,7 @@ function settings_post(&$a) {
                $infinite_scroll   = x($_POST, 'infinite_scroll')   ? intval($_POST['infinite_scroll'])    : 0;
                $no_auto_update    = x($_POST, 'no_auto_update')    ? intval($_POST['no_auto_update'])     : 0;
                $bandwidth_saver   = x($_POST, 'bandwidth_saver')   ? intval($_POST['bandwidth_saver'])    : 0;
+               $nowarn_insecure   = x($_POST, 'nowarn_insecure')   ? intval($_POST['nowarn_insecure'])    : 0;
                $browser_update    = x($_POST, 'browser_update')    ? intval($_POST['browser_update'])     : 0;
                if ($browser_update != -1) {
                        $browser_update = $browser_update * 1000;
@@ -321,6 +322,7 @@ function settings_post(&$a) {
                        set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
                }
 
+               set_pconfig(local_user(), 'system', 'nowarn_insecure'         , $nowarn_insecure);
                set_pconfig(local_user(), 'system', 'update_interval'         , $browser_update);
                set_pconfig(local_user(), 'system', 'itemspage_network'       , $itemspage_network);
                set_pconfig(local_user(), 'system', 'itemspage_mobile_network', $itemspage_mobile_network);
@@ -689,7 +691,7 @@ function settings_content(&$a) {
                                        dbesc($a->argv[3]),
                                        local_user());
 
-                       if (!count($r)){
+                       if (!dbm::is_result($r)){
                                notice(t("You can't edit this application."));
                                return;
                        }
@@ -750,7 +752,7 @@ function settings_content(&$a) {
                $settings_addons = "";
 
                $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
-               if(! count($r))
+               if(! dbm::is_result($r))
                        $settings_addons = t('No Plugin settings configured');
 
                call_hooks('plugin_settings', $settings_addons);
@@ -857,15 +859,15 @@ function settings_content(&$a) {
                        $r = null;
                }
 
-               $mail_server       = ((count($r)) ? $r[0]['server'] : '');
-               $mail_port         = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
-               $mail_ssl          = ((count($r)) ? $r[0]['ssltype'] : '');
-               $mail_user         = ((count($r)) ? $r[0]['user'] : '');
-               $mail_replyto      = ((count($r)) ? $r[0]['reply_to'] : '');
-               $mail_pubmail      = ((count($r)) ? $r[0]['pubmail'] : 0);
-               $mail_action       = ((count($r)) ? $r[0]['action'] : 0);
-               $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
-               $mail_chk          = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
+               $mail_server       = ((dbm::is_result($r)) ? $r[0]['server'] : '');
+               $mail_port         = ((dbm::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
+               $mail_ssl          = ((dbm::is_result($r)) ? $r[0]['ssltype'] : '');
+               $mail_user         = ((dbm::is_result($r)) ? $r[0]['user'] : '');
+               $mail_replyto      = ((dbm::is_result($r)) ? $r[0]['reply_to'] : '');
+               $mail_pubmail      = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
+               $mail_action       = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
+               $mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
+               $mail_chk          = ((dbm::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
 
 
                $tpl = get_markup_template("settings_connectors.tpl");
@@ -951,6 +953,8 @@ function settings_content(&$a) {
                $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
                $mobile_theme_selected = (!x($_SESSION,'mobile-theme')? $default_mobile_theme : $_SESSION['mobile-theme']);
 
+               $nowarn_insecure = intval(get_pconfig(local_user(), 'system', 'nowarn_insecure'));
+
                $browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
                if (intval($browser_update) != -1)
                        $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
@@ -995,6 +999,7 @@ function settings_content(&$a) {
 
                        '$theme'        => array('theme', t('Display Theme:'), $theme_selected, '', $themes, true),
                        '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false),
+                       '$nowarn_insecure' => array('nowarn_insecure',  t('Suppress warning of insecure networks'), $nowarn_insecure, t("Should the system suppress the warning that the current group contains members of networks that can't receive non public postings.")),
                        '$ajaxint'   => array('browser_update',  t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds. Enter -1 to disable it.')),
                        '$itemspage_network'   => array('itemspage_network',  t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')),
                        '$itemspage_mobile_network'   => array('itemspage_mobile_network',  t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')),
@@ -1004,7 +1009,7 @@ function settings_content(&$a) {
                        '$noinfo'       => array('noinfo', t("Don't show notices"), $noinfo, ''),
                        '$infinite_scroll'      => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
                        '$no_auto_update'       => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, 'When disabled, the network page is updated all the time, which could be confusing while reading.'),
-                       '$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, 'When enabled, embedded content is not displayed on automatic updates, they only show on page reload.'),
+                       '$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')),
 
                        '$d_tset' => t('General Theme Settings'),
                        '$d_ctset' => t('Custom Theme Settings'),