]> git.mxchange.org Git - friendica.git/commitdiff
Some more notices (#5526)
authorMichael Vogel <icarus@dabo.de>
Mon, 30 Jul 2018 04:41:20 +0000 (06:41 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Mon, 30 Jul 2018 04:41:20 +0000 (06:41 +0200)
* Some more notices

* Fixed nasty to find notice in DFRN and OStatus

* And more notices ...

* Yeah, some removed notices ... again ...

mod/contacts.php
mod/dfrn_notify.php
mod/dirfind.php
mod/photos.php
src/App.php
src/Content/Text/BBCode.php
src/Content/Text/Markdown.php
src/Core/Addon.php
src/Model/Event.php
src/Protocol/OStatus.php

index ae23974e039dc41fabc8699b0107fe39129aa08e..f4cbbf44de0c8bab76864b9ebb1806d96b209d49 100644 (file)
@@ -188,7 +188,7 @@ function contacts_post(App $a)
 
        Addon::callHooks('contact_edit_post', $_POST);
 
-       $profile_id = intval($_POST['profile-assign']);
+       $profile_id = intval(defaults($_POST, 'profile-assign', 0));
        if ($profile_id) {
                if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
                        notice(L10n::t('Could not locate selected profile.') . EOL);
@@ -200,11 +200,11 @@ function contacts_post(App $a)
 
        $notify = intval($_POST['notify']);
 
-       $fetch_further_information = intval($_POST['fetch_further_information']);
+       $fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
 
-       $ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
+       $ffi_keyword_blacklist = escape_tags(trim(defaults($_POST, 'ffi_keyword_blacklist', '')));
 
-       $priority = intval($_POST['poll']);
+       $priority = intval(defaults($_POST, 'poll', 0));
        if ($priority > 5 || $priority < 0) {
                $priority = 0;
        }
index ee6290d663534d42319ec230034c1af057257de3..26985527bec260fa326abd840d31ffee2e5a4863 100644 (file)
@@ -213,6 +213,14 @@ function dfrn_dispatch_public($postdata)
 
        // We now have some contact, so we fetch it
        $importer = DBA::fetchFirst("SELECT *, `name` as `senderName`
+                                       '' AS `uprvkey`,
+                                       'UTC' AS `timezone`,
+                                       '' AS `nickname`,
+                                       '' AS `sprvkey`,
+                                       '' AS `spubkey`,
+                                       0 AS `page-flags`,
+                                       0 AS `account-type`,
+                                       0 AS `prvnets`
                                        FROM `contact`
                                        WHERE NOT `blocked` AND `id` = ? LIMIT 1",
                                        $contact['id']);
index 40275523fd1829d73c40ed49c63b53713e19239b..0171da1b04b41def85eef30f886a3e6ae592524f 100644 (file)
@@ -211,7 +211,7 @@ function dirfind_content(App $a, $prefix = "") {
                                                $photo_menu = [];
                                        }
                                } else {
-                                       $connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
+                                       $connlnk = System::baseUrl().'/follow/?url='.(!empty($jj->connect) ? $jj->connect : $jj->url);
                                        $conntxt = L10n::t('Connect');
                                        $photo_menu = [
                                                'profile' => [L10n::t("View Profile"), Contact::magicLink($jj->url)],
index b7e678487a8ac2978552d169ad111f247ef6bcbc..04d4138fc6cd865429be6a9978f23b0e64e63549 100644 (file)
@@ -123,7 +123,10 @@ function photos_init(App $a) {
                }
 
                $a->page['aside'] .= $vcard_widget;
-               $a->page['aside'] .= $photo_albums_widget;
+
+               if (!empty($photo_albums_widget)) {
+                       $a->page['aside'] .= $photo_albums_widget;
+               }
 
                $tpl = get_markup_template("photos_head.tpl");
 
index 02215d2e69fcc10cf224301acbac836ff3326762..f583f151a6d307259f5be6d88bbd3d8d703c0a26 100644 (file)
@@ -1307,11 +1307,11 @@ class App
                // Only arrays are serialized in database, so we have to unserialize sparingly
                $value = is_string($v) && preg_match("|^a:[0-9]+:{.*}$|s", $v) ? unserialize($v) : $v;
 
-               if (!isset($this->config[$uid])) {
+               if (!isset($this->config[$uid]) || !is_array($this->config[$uid])) {
                        $this->config[$uid] = [];
                }
 
-               if (!isset($this->config[$uid][$cat])) {
+               if (!isset($this->config[$uid][$cat]) || !is_array($this->config[$uid][$cat])) {
                        $this->config[$uid][$cat] = [];
                }
 
index 6c21a37cba290aa40b366b6444dac9c6b7d14680..da9279900ededf855e7fbf3621b788de9747a774 100644 (file)
@@ -585,7 +585,7 @@ class BBCode extends BaseObject
                                        $return .= sprintf('<h4><a href="%s">%s</a></h4>', $data['url'], $data['title']);
                                }
 
-                               if ($data["description"] != "" && $data["description"] != $data["title"]) {
+                               if (!empty($data["description"]) && $data["description"] != $data["title"]) {
                                        // Sanitize the HTML by converting it to BBCode
                                        $bbcode = HTML::toBBCode($data["description"]);
                                        $return .= sprintf('<blockquote>%s</blockquote>', trim(self::convert($bbcode)));
@@ -627,15 +627,15 @@ class BBCode extends BaseObject
                }
 
                // If the link already is included in the post, don't add it again
-               if (($data["url"] != "") && strpos($data["text"], $data["url"])) {
+               if (!empty($data["url"]) && strpos($data["text"], $data["url"])) {
                        return $data["text"] . $data["after"];
                }
 
                $text = $data["text"];
 
-               if (($data["url"] != "") && ($data["title"] != "")) {
+               if (!empty($data["url"]) && ($data["title"] != "")) {
                        $text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
-               } elseif (($data["url"] != "")) {
+               } elseif (!empty($data["url"])) {
                        $text .= "\n[url]" . $data["url"] . "[/url]";
                }
 
index ac598d0fc4826dbcfcd575cb9a90fb2e2ad210d3..71d1a7b849c92dd7aab25bf8e7de105ea42ba1e2 100644 (file)
@@ -53,6 +53,10 @@ class Markdown extends BaseObject
 
                $data = Contact::getDetailsByAddr($match[2]);
 
+               if (empty($data)) {
+                       return;
+               }
+
                $name = $match[1];
 
                if ($name == '') {
index bfb2a1e8fddbdd01f11e93125b65004bd2ba4ea8..e4acd6e9d36c5d873f9785cf2a72875deb6065b4 100644 (file)
@@ -311,7 +311,12 @@ class Addon
                        foreach ($ll as $l) {
                                $l = trim($l, "\t\n\r */");
                                if ($l != "") {
-                                       list($type, $v) = array_map("trim", explode(":", $l, 2));
+                                       $addon_info = array_map("trim", explode(":", $l, 2));
+                                       if (count($addon_info) < 2) {
+                                               continue;
+                                       }
+
+                                       list($type, $v) = $addon_info;
                                        $type = strtolower($type);
                                        if ($type == "author" || $type == "maintainer") {
                                                $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
index 16d1ada27a07cab999a5ef7ef46a4b84f80cf766..8e67da6352daf5f7b269b750056b9e132c5f3f8b 100644 (file)
@@ -76,12 +76,14 @@ class Event extends BaseObject
 
                if (!$event['nofinish']) {
                        $o .= '<div class="event-end" ><span class="event-label">' . L10n::t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
-                               . DateTimeFormat::utc($event['finish'], (($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
+                               . DateTimeFormat::utc($event['finish'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
                                . '" >' . $event_end
                                . '</span></div>' . "\r\n";
                }
 
-               $o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
+               if (!empty($event['desc'])) {
+                       $o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
+               }
 
                if (strlen($event['location'])) {
                        $o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span>&nbsp;<span class="location">'
index dca47e31b9f9d6b9a0b3bad0a70efbcdf3055177..bf0abc643d271396116f80a49c4e23dcf2044938 100644 (file)
@@ -1610,6 +1610,8 @@ class OStatus
                        $contact["alias"] = $contact["url"];
                }
 
+               $contact['account-type'] = $owner['account-type'];
+
                return $contact;
        }
 
@@ -1640,7 +1642,6 @@ class OStatus
                }
 
                $contact = self::contactEntry($repeated_item['author-link'], $owner);
-               $contact['account-type'] = $contact['contact-type'];
 
                $title = $owner["nick"]." repeated a notice by ".$contact["nick"];