]> git.mxchange.org Git - friendica.git/commitdiff
Some more notices (#5424)
authorMichael Vogel <icarus@dabo.de>
Fri, 20 Jul 2018 18:07:54 +0000 (20:07 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Fri, 20 Jul 2018 18:07:54 +0000 (14:07 -0400)
src/Core/ACL.php
src/Model/Item.php
src/Network/Probe.php
src/Protocol/DFRN.php
src/Protocol/PortableContact.php
src/Worker/OnePoll.php

index f05cf1f7915880c0a1bf9b5305bf2fcc651625a6..21c0b41bde5f401c801fb536b83f6ad742e4b1dc 100644 (file)
@@ -258,6 +258,11 @@ class ACL extends BaseObject
         */
        public static function getFullSelectorHTML(array $user = null, $show_jotnets = false)
        {
+
+               if (empty($user['uid'])) {
+                       return '';
+               }
+
                $perms = self::getDefaultUserPermissions($user);
 
                $jotnets = '';
index 059fee93bdbb87d3a4774ba0353bb8714afe4ab3..5db1b0bb45d7c2f7c96d69422c40cdfc9e426b25 100644 (file)
@@ -1204,6 +1204,17 @@ class Item extends BaseObject
                return $contact_id;
        }
 
+       // This function will finally cover most of the preparation functionality in mod/item.php
+       public static function prepare(&$item)
+       {
+               $data = BBCode::getAttachmentData($item['body']);
+               if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
+                       && ($posttype != Item::PT_PERSONAL_NOTE)) {
+                       $posttype = Item::PT_PAGE;
+                       $objecttype = ACTIVITY_OBJ_BOOKMARK;
+               }
+       }
+
        public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
        {
                $a = get_app();
index 48530ffeae1377f8f233eb1bfe44ff99d0fbe2f6..c01e3edd415ee0685603d9e5bfdecb1d322892c0 100644 (file)
@@ -119,7 +119,7 @@ class Probe
 
                if (!is_object($xrd)) {
                        $ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
-                       if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+                       if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                logger("Probing timeout for ".$url, LOGGER_DEBUG);
                                return false;
                        }
@@ -731,7 +731,7 @@ class Probe
                $redirects = 0;
 
                $ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
-               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        return false;
                }
                $data = $ret['body'];
@@ -798,7 +798,7 @@ class Probe
        private static function pollNoscrape($noscrape_url, $data)
        {
                $ret = Network::curl($noscrape_url);
-               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        return false;
                }
                $content = $ret['body'];
@@ -1036,7 +1036,7 @@ class Probe
        private static function pollHcard($hcard_url, $data, $dfrn = false)
        {
                $ret = Network::curl($hcard_url);
-               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        return false;
                }
                $content = $ret['body'];
@@ -1283,7 +1283,7 @@ class Probe
                                                }
                                        } elseif (normalise_link($pubkey) == 'http://') {
                                                $ret = Network::curl($pubkey);
-                                               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+                                               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                                        return false;
                                                }
                                                $pubkey = $ret['body'];
@@ -1315,7 +1315,7 @@ class Probe
 
                // Fetch all additional data from the feed
                $ret = Network::curl($data["poll"]);
-               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        return false;
                }
                $feed = $ret['body'];
@@ -1525,7 +1525,7 @@ class Probe
        private static function feed($url, $probe = true)
        {
                $ret = Network::curl($url);
-               if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        return false;
                }
                $feed = $ret['body'];
index b5e1b6c573b29c4be031cecfc86db93ba0d251c0..3e8d99e7cb0f8fd928ba691f88378dbf02a918b5 100644 (file)
@@ -1189,7 +1189,7 @@ class DFRN
 
                $ret = Network::curl($url);
 
-               if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+               if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                        Contact::markForArchival($contact);
                        return -2; // timed out
                }
index f45b65e611f00b768f921d94645985a34b2eef68..85b23f569932c12bf829436a37266c4956ba3583 100644 (file)
@@ -1003,7 +1003,7 @@ class PortableContact
                // Quit if there is a timeout.
                // But we want to make sure to only quit if we are mostly sure that this server url fits.
                if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
-                       (!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
+                       (!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
                        logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
                        DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
                        return false;
@@ -1018,7 +1018,7 @@ class PortableContact
                        $serverret = Network::curl($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
 
                        // Quit if there is a timeout
-                       if (!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+                       if (!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
                                DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
                                return false;
index e586ca005a90dd23fa37a376af48d6cb75f4c7dd..89703a82b28dc711847cedaa6f4b089de081157b 100644 (file)
@@ -185,7 +185,7 @@ class OnePoll
 
                        $ret = Network::curl($url);
 
-                       if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+                       if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                // set the last-update so we don't keep polling
                                DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
@@ -321,7 +321,7 @@ class OnePoll
                        $ret = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
                        unlink($cookiejar);
 
-                       if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+                       if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
                                // set the last-update so we don't keep polling
                                DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);