]> git.mxchange.org Git - friendica.git/commitdiff
Some more
authorMichael <heluecht@pirati.ca>
Tue, 7 Nov 2017 21:53:11 +0000 (21:53 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 7 Nov 2017 21:53:11 +0000 (21:53 +0000)
include/auth_ejabberd.php
mod/admin.php
mod/cal.php
mod/settings.php
src/ParseUrl.php

index 1307d578321a91b2efd85f897cda653194f689ed..998c6fe3d9745ba7fc7a0835e3cfc07bd81bdfd0 100755 (executable)
@@ -79,7 +79,7 @@ class exAuth {
                $this->writeLog(LOG_NOTICE, "start");
 
                // We are connected to the SQL server.
-               do {
+               while (!feof(STDIN)) {
                        // Quit if the database connection went down
                        if (!dba::connected()) {
                                $this->writeLog(LOG_ERR, "the database connection went down");
@@ -125,7 +125,7 @@ class exAuth {
                                $this->writeLog(LOG_NOTICE, "invalid command string ".$sData);
                                fwrite(STDOUT, pack("nn", 2, 0));
                        }
-               } while (true);
+               }
        }
 
        /**
index 4f156a0c3bbd7e208be1638c0a4e798589144cac..08c732c6edbf56add54c85e5cbaee37ee97b801c 100644 (file)
@@ -2273,10 +2273,7 @@ function admin_page_features(App $a) {
                        $arr[$fname][0] = $fdata[0];
                        foreach (array_slice($fdata,1) as $f) {
 
-                               $set = Config::get('feature',$f[0]);
-                               if ($set === false) {
-                                       $set = $f[3];
-                               }
+                               $set = Config::get('feature',$f[0], $f[3]);
                                $arr[$fname][1][] = array(
                                        array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'), t('On'))),
                                        array('featurelock_' .$f[0],sprintf(t('Lock feature %s'),$f[1]),(($f[4] !== false) ? "1" : ''),'',array(t('Off'), t('On')))
index db5b00879e679f78b2f821c3c85f4bd2ad7bd1c5..4f5bde5d58a5f5447957e0e4dff012a04da86e04 100644 (file)
@@ -73,8 +73,7 @@ function cal_content(App $a) {
        nav_set_selected('events');
 
        // First day of the week (0 = Sunday)
-       $firstDay = PConfig::get(local_user(),'system','first_day_of_week');
-       if ($firstDay === false) $firstDay=0;
+       $firstDay = PConfig::get(local_user(),'system','first_day_of_week', 0);
 
        // get the translation strings for the callendar
        $i18n = get_event_strings();
index 6c160a21f08fd3656dbd5c9c7f09772795519bb9..37daa359c1b1df1e4017ad95ac8c9c118f953e34 100644 (file)
@@ -953,7 +953,7 @@ function settings_content(App $a) {
                                $is_experimental = file_exists('view/theme/' . $th . '/experimental');
                                $unsupported = file_exists('view/theme/' . $th . '/unsupported');
                                $is_mobile = file_exists('view/theme/' . $th . '/mobile');
-                               if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || Config::get('experimentals', 'exp_themes')===false))) {
+                               if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) {
                                        $theme_name = (($is_experimental) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
                                        if ($is_mobile) {
                                                $mobile_themes[$f]=$theme_name;
@@ -978,24 +978,14 @@ function settings_content(App $a) {
                $itemspage_mobile_network = intval(PConfig::get(local_user(), 'system', 'itemspage_mobile_network'));
                $itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
 
-               $nosmile = PConfig::get(local_user(), 'system', 'no_smilies');
-               $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
-
-               $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week');
-               $first_day_of_week = (($first_day_of_week===false)? '0': $first_day_of_week); // default if not set: 0
+               $nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0);
+               $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
                $weekdays = array(0 => t("Sunday"), 1 => t("Monday"));
 
-               $noinfo = PConfig::get(local_user(), 'system', 'ignore_info');
-               $noinfo = (($noinfo===false)? '0': $noinfo); // default if not set: 0
-
-               $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll');
-               $infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0
-
-               $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update');
-               $no_auto_update = (($no_auto_update===false)? '0': $no_auto_update); // default if not set: 0
-
-               $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver');
-               $bandwidth_saver = (($bandwidth_saver === false) ? '0' : $bandwidth_saver); // default if not set: 0
+               $noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0);
+               $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
+               $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0);
+               $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0);
 
                $theme_config = "";
                if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
index 81c5671c90c5cac48bdb8c54187604c996b561aa..d6b6b60272ddd43603ee2beed183160c65094859 100644 (file)
@@ -161,13 +161,13 @@ class ParseUrl {
 
                        $oembed_data = oembed_fetch_url($url);
 
-                       if (!in_array($oembed_data->type, array("error", "rich"))) {
+                       if (!in_array($oembed_data->type, array("error", "rich", ""))) {
                                $siteinfo["type"] = $oembed_data->type;
                        }
 
                        if (($oembed_data->type == "link") && ($siteinfo["type"] != "photo")) {
                                if (isset($oembed_data->title)) {
-                                       $siteinfo["title"] = $oembed_data->title;
+                                       $siteinfo["title"] = trim($oembed_data->title);
                                }
                                if (isset($oembed_data->description)) {
                                        $siteinfo["text"] = trim($oembed_data->description);
@@ -240,7 +240,7 @@ class ParseUrl {
 
                $list = $xpath->query("//title");
                if ($list->length > 0) {
-                       $siteinfo["title"] = $list->item(0)->nodeValue;
+                       $siteinfo["title"] = trim($list->item(0)->nodeValue);
                }
 
                //$list = $xpath->query("head/meta[@name]");
@@ -258,10 +258,10 @@ class ParseUrl {
                        if ($attr["content"] != "") {
                                switch (strtolower($attr["name"])) {
                                        case "fulltitle":
-                                               $siteinfo["title"] = $attr["content"];
+                                               $siteinfo["title"] = trim($attr["content"]);
                                                break;
                                        case "description":
-                                               $siteinfo["text"] = $attr["content"];
+                                               $siteinfo["text"] = trim($attr["content"]);
                                                break;
                                        case "thumbnail":
                                                $siteinfo["image"] = $attr["content"];
@@ -278,16 +278,16 @@ class ParseUrl {
                                                }
                                                break;
                                        case "twitter:description":
-                                               $siteinfo["text"] = $attr["content"];
+                                               $siteinfo["text"] = trim($attr["content"]);
                                                break;
                                        case "twitter:title":
-                                               $siteinfo["title"] = $attr["content"];
+                                               $siteinfo["title"] = trim($attr["content"]);
                                                break;
                                        case "dc.title":
-                                               $siteinfo["title"] = $attr["content"];
+                                               $siteinfo["title"] = trim($attr["content"]);
                                                break;
                                        case "dc.description":
-                                               $siteinfo["text"] = $attr["content"];
+                                               $siteinfo["text"] = trim($attr["content"]);
                                                break;
                                        case "keywords":
                                                $keywords = explode(",", $attr["content"]);
@@ -329,10 +329,10 @@ class ParseUrl {
                                                $siteinfo["image"] = $attr["content"];
                                                break;
                                        case "og:title":
-                                               $siteinfo["title"] = $attr["content"];
+                                               $siteinfo["title"] = trim($attr["content"]);
                                                break;
                                        case "og:description":
-                                               $siteinfo["text"] = $attr["content"];
+                                               $siteinfo["text"] = trim($attr["content"]);
                                                break;
                                }
                        }