]> git.mxchange.org Git - friendica.git/commitdiff
Fix potential bugs without expected behavior change
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 7 Jan 2019 17:51:48 +0000 (12:51 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 16:04:19 +0000 (11:04 -0500)
- Fix uninitialized variables
- Fix potentially not set variables
- Fix wrong parameter default value
- Fix method scope
- Fix missing return value

35 files changed:
include/conversation.php
include/enotify.php
mod/admin.php
mod/dfrn_notify.php
mod/dfrn_request.php
mod/directory.php
mod/dirfind.php
mod/fbrowser.php
mod/feedtest.php
mod/help.php
mod/ignored.php
mod/invite.php
mod/item.php
mod/msearch.php
mod/notifications.php
mod/notify.php
mod/openid.php
mod/poco.php
mod/suggest.php
mod/worker.php
mod/xrd.php
src/App.php
src/Core/Console/DatabaseStructure.php
src/Core/NotificationsManager.php
src/Model/Attach.php
src/Model/Contact.php
src/Model/Conversation.php
src/Model/Event.php
src/Model/Item.php
src/Module/Proxy.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php
src/Protocol/OStatus.php
src/Util/Network.php
src/Util/Strings.php

index 5125b3d1e8d7851050bd003f2b515a72193070e6..6ee7309ad17bd4aeb1e7cd9a5fd11712ce66f137 100644 (file)
@@ -176,6 +176,7 @@ function localize_item(&$item)
 
                $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
 
+               $bodyverb = '';
                if (activity_match($item['verb'], ACTIVITY_LIKE)) {
                        $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
                } elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
@@ -1043,25 +1044,22 @@ function format_like($cnt, array $arr, $type, $id) {
                }
        }
 
+       $phrase = '';
        if ($cnt > 1) {
                $total = count($arr);
-               if ($total >= MAX_LIKERS) {
-                       $arr = array_slice($arr, 0, MAX_LIKERS - 1);
-               }
                if ($total < MAX_LIKERS) {
                        $last = L10n::t('and') . ' ' . $arr[count($arr)-1];
                        $arr2 = array_slice($arr, 0, -1);
-                       $str = implode(', ', $arr2) . ' ' . $last;
-               }
-               if ($total >= MAX_LIKERS) {
-                       $str = implode(', ', $arr);
-                       $str .= L10n::t('and %d other people', $total - MAX_LIKERS);
+                       $likers = implode(', ', $arr2) . ' ' . $last;
+               } else  {
+                       $arr = array_slice($arr, 0, MAX_LIKERS - 1);
+                       $likers = implode(', ', $arr);
+                       $likers .= L10n::t('and %d other people', $total - MAX_LIKERS);
                }
 
-               $likers = $str;
-
                $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
 
+               $explikers = '';
                switch ($type) {
                        case 'like':
                                $phrase = L10n::t('<span  %1$s>%2$d people</span> like this', $spanatts, $cnt);
@@ -1497,6 +1495,7 @@ function get_responses(array $conv_responses, array $response_verbs, $ob, array
 
 function get_response_button_text($v, $count)
 {
+       $return = '';
        switch ($v) {
                case 'like':
                        $return = L10n::tt('Like', 'Likes', $count);
index 80e6782c2dcc74303f22f5dc91b827aa8150aff9..800158d9ae98df54b6687791e2c53ec0469b0b69 100644 (file)
@@ -120,6 +120,12 @@ function notification($params)
        }
 
        $epreamble = '';
+       $preamble  = '';
+       $subject   = '';
+       $sitelink  = '';
+       $tsitelink = '';
+       $hsitelink = '';
+       $itemlink  = '';
 
        if ($params['type'] == NOTIFY_MAIL) {
                $itemlink = $siteurl.'/message/'.$params['item']['id'];
@@ -453,10 +459,6 @@ function notification($params)
 
                $body =  $params['body'];
 
-               $sitelink = "";
-               $tsitelink = "";
-               $hsitelink = "";
-               $itemlink =  "";
                $show_in_notification_page = false;
        }
 
@@ -487,6 +489,8 @@ function notification($params)
        $hsitelink = $h['hsitelink'];
        $itemlink  = $h['itemlink'];
 
+       $notify_id = 0;
+
        if ($show_in_notification_page) {
                Logger::log("adding notification entry", Logger::DEBUG);
                do {
index 8ff3089d9c540d1081120df8313aabe97ada5ce8..e5dbf12f2915bd6e24e63ad6b580d0acc544b68b 100644 (file)
@@ -1298,7 +1298,7 @@ function admin_page_site_post(App $a)
                Config::set('system', 'banner', $banner);
        }
 
-       if ($info == "") {
+       if (empty($info)) {
                Config::delete('config', 'info');
        } else {
                Config::set('config', 'info', $info);
index e42f18e76b6fcc656c7ecfc2e0c5ebd9e6f40911..745411a8ef89ec10f9f8263fda1db1a30f3355d0 100644 (file)
@@ -300,6 +300,7 @@ function dfrn_notify_content(App $a) {
                                break;
                        default:
                                $status = 1;
+                               $my_id = '';
                                break;
                }
 
index 6142257e77fd0083f9b80205450580452c67be56..780e0afeeb7feb146129ca660887d50a415a96b5 100644 (file)
@@ -34,9 +34,9 @@ function dfrn_request_init(App $a)
 {
        if ($a->argc > 1) {
                $which = $a->argv[1];
+               Profile::load($a, $which);
        }
 
-       Profile::load($a, $which);
        return;
 }
 
@@ -168,7 +168,7 @@ function dfrn_request_post(App $a)
                                $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
                                        intval(local_user()),
                                        DBA::escape($dfrn_url),
-                                       $parms['key'] // this was already escaped
+                                       defaults($parms, 'key', '') // Potentially missing
                                );
                                if (DBA::isResult($r)) {
                                        Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']);
@@ -187,7 +187,7 @@ function dfrn_request_post(App $a)
                                        $dfrn_request = $contact_record['request'];
                                }
 
-                               if (strlen($dfrn_request) && strlen($confirm_key)) {
+                               if (!empty($dfrn_request) && strlen($confirm_key)) {
                                        Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
                                }
 
index c32cf5dbb8f93e204f7db42f80551a166dd05c19..8ca8d8158e2d2640667703cf1a0384aa8021c123 100644 (file)
@@ -111,8 +111,11 @@ function directory_content(App $a)
                        $photo = 'photo';
                }
 
+               $entries = [];
+
                while ($rr = DBA::fetch($r)) {
 
+               while ($rr = DBA::fetch($r)) {
                        $itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
 
                        $profile_link = $rr['profile_url'];
index 909a723165b49c84b678535ba713ee38f1127930..a5b77312f35d03ba078a8700b67220a7acfea2ef 100644 (file)
@@ -179,21 +179,19 @@ function dirfind_content(App $a, $prefix = "") {
 
                        // Add found profiles from the global directory to the local directory
                        Worker::add(PRIORITY_LOW, 'DiscoverPoCo', "dirsearch", urlencode($search));
-               } else {
+               } elseif (strlen(Config::get('system','directory'))) {
                        $p = (($pager->getPage() != 1) ? '&p=' . $pager->getPage() : '');
 
-                       if (strlen(Config::get('system','directory'))) {
-                               $x = Network::fetchUrl(get_server() . '/lsearch?f=' . $p .  '&search=' . urlencode($search));
-                       }
+                       $x = Network::fetchUrl(get_server() . '/lsearch?f=' . $p .  '&search=' . urlencode($search));
 
                        $j = json_decode($x);
-
                        $pager->setItemsPerPage($j->items_page);
                }
 
                if (!empty($j->results)) {
                        $id = 0;
 
+                       $entries = [];
                        foreach ($j->results as $jj) {
 
                                $alt_text = "";
index d302383157a372fe2e4293a4c984837c326f981f..559896acb13932ea6c690b4dd93d6dca0a385ef2 100644 (file)
@@ -29,6 +29,8 @@ function fbrowser_content(App $a)
 
        $template_file = "filebrowser.tpl";
 
+       $o = '';
+
        switch ($a->argv[1]) {
                case "image":
                        $path = [["", L10n::t("Photos")]];
index 8508b93e47002089a400a9eb86d7b48d3d7bc227..cffc1f34510721c2d45e6a94969c003f26c948a5 100644 (file)
@@ -35,7 +35,7 @@ function feedtest_content(App $a)
                $import_result = Feed::import($xml, $importer, $contact, $dummy, true);
 
                $result = [
-                       'input' => text_highlight($xml, 'xml'),
+                       'input' => $xml,
                        'output' => var_export($import_result, true),
                ];
        }
index 3a21695b090f05ee4f4170620ae22be8078f70d0..3df280dbd64e0698ccdb1df8f183bea93de5b5a1 100644 (file)
@@ -33,6 +33,7 @@ function help_content(App $a)
        Nav::setSelected('help');
 
        $text = '';
+       $filename = '';
 
        if ($a->argc > 1) {
                $path = '';
index e50d183b2855eb866f004e6f62d1000d83c1bb31..64edf6e151c17d7a6dac97ee727259d016ef6883 100644 (file)
@@ -14,7 +14,7 @@ function ignored_init(App $a)
                $message_id = intval($a->argv[1]);
        }
 
-       if (!$message_id) {
+       if (empty($message_id)) {
                exit();
        }
 
index 02415239aecf1ae3d7b1531e1f796be891714379..3b1667a79aeb9e898dd80f9222ab136fdc7ac2ad 100644 (file)
@@ -41,6 +41,8 @@ function invite_post(App $a)
        $message     = !empty($_POST['message'])    ? Strings::escapeTags(trim($_POST['message']))     : '';
 
        $total = 0;
+       $invitation_only = false;
+       $invites_remaining = null;
 
        if (Config::get('system', 'invitation_only')) {
                $invitation_only = true;
index 6276ba4d1e44e2187004a9ca9d02c210b31b0e5c..7cb2849a89e137e54a85fbcecbb4434b2dcc47dd 100644 (file)
@@ -1049,7 +1049,7 @@ function handle_tag(&$body, &$inform, &$str_tags, $profile_uid, $tag, $network =
                         * Status.Net seems to require the numeric ID URL in a mention if the person isn't
                         * subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
                         */
-                       if (strlen($alias)) {
+                       if (!empty($alias)) {
                                $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
                                if (!stripos($str_tags, '[url=' . $alias . ']')) {
                                        if (strlen($str_tags)) {
index 64c6ce3cf8a0c2f5a2ad9dfebbb8463b321c2aac..fcb93a32f01b5ec495b38f4641d817eadf3a45ec 100644 (file)
@@ -20,6 +20,8 @@ function msearch_post(App $a)
                exit();
        }
 
+       $total = 0;
+
        $count_stmt = DBA::p(
                "SELECT COUNT(*) AS `total`
                        FROM `profile`
@@ -29,7 +31,6 @@ function msearch_post(App $a)
                        AND MATCH(`pub_keywords`) AGAINST (?)",
                $search
        );
-
        if (DBA::isResult($count_stmt)) {
                $row = DBA::fetch($count_stmt);
                $total = $row['total'];
index 00c234d157717639ee948ebdc687faad128174a9..909b297ebfbe992c92e01cc46cff10a03c435e72 100644 (file)
@@ -92,6 +92,8 @@ function notifications_content(App $a)
 
        $notif_header = L10n::t('Notifications');
 
+       $all = false;
+
        // Get introductions
        if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
                Nav::setSelected('introductions');
index 2606e796ff81daa74682a4b80671a4f387776f99..87035817841d637b957037051ca087b34a9551ba 100644 (file)
@@ -58,6 +58,8 @@ function notify_content(App $a)
                return Login::form();
        }
 
+       $notif_content = '';
+
        $nm = new NotificationsManager();
 
        $notif_tpl = Renderer::getMarkupTemplate('notifications.tpl');
index 2ae3f6c718550383ce9ccab8752bd545d8441840..d20258fa96986ff829bd20f6ea8e4b6ec05cb2fb 100644 (file)
@@ -93,17 +93,17 @@ function openid_content(App $a) {
                                        }
                                }
                        }
-                       if ($nick) {
+                       if (!empty($nick)) {
                                $args .= '&nickname=' . urlencode($nick);
                        }
-                       elseif ($first) {
+                       elseif (!empty($first)) {
                                $args .= '&nickname=' . urlencode($first);
                        }
 
-                       if ($photosq) {
+                       if (!empty($photosq)) {
                                $args .= '&photo=' . urlencode($photosq);
                        }
-                       elseif ($photo) {
+                       elseif (!empty($photo)) {
                                $args .= '&photo=' . urlencode($photo);
                        }
 
index 477b48b04472a29b42e0b24ca94bf38bdf478b36..064e0e9a85f919178aefcd6372a4092efd324a69 100644 (file)
@@ -26,9 +26,9 @@ function poco_init(App $a) {
        }
 
        if ($a->argc > 1) {
-               $user = Strings::escapeTags(trim($a->argv[1]));
+               $nickname = Strings::escapeTags(trim($a->argv[1]));
        }
-       if (empty($user)) {
+       if (empty($nickname)) {
                $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
                if (!DBA::isResult($c)) {
                        System::httpExit(401);
@@ -70,7 +70,7 @@ function poco_init(App $a) {
        if (! $system_mode && ! $global) {
                $users = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
                        where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
-                       DBA::escape($user)
+                       DBA::escape($nickname)
                );
                if (! DBA::isResult($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
                        System::httpExit(404);
index 7f1fe3386c139f297244f88f0ea45f2d23aba310..bca2694d37360ebb9e7055114d91df6995eeca61 100644 (file)
@@ -77,6 +77,7 @@ function suggest_content(App $a)
        }
 
        $id = 0;
+       $entries = [];
 
        foreach ($r as $rr) {
 
index 86fed28bbe37f73e80b95bade828f699c251a54b..2995775db1b18e05a12ad099994d838f96e3ae75 100644 (file)
@@ -38,7 +38,9 @@ function worker_init()
 
        Worker::callWorker();
 
-       if ($r = Worker::workerProcess()) {
+       $passing_slow = false;
+
+       if ($r = Worker::workerProcess($passing_slow)) {
                // On most configurations this parameter wouldn't have any effect.
                // But since it doesn't destroy anything, we just try to get more execution time in any way.
                set_time_limit(0);
index 1b3b4f3cc1c6b5e9f06a8e14c046fa0e4b9ff639..b4cb60afed68c7b1c80b27a61cc0e84ab8b90a07 100644 (file)
@@ -63,13 +63,13 @@ function xrd_init(App $a)
        }
 
        if ($mode == 'xml') {
-               xrd_xml($a, $addr, $alias, $profile_url, $user);
+               xrd_xml($addr, $alias, $profile_url, $user);
        } else {
-               xrd_json($a, $addr, $alias, $profile_url, $user);
+               xrd_json($addr, $alias, $profile_url, $user);
        }
 }
 
-function xrd_json($a, $uri, $alias, $profile_url, $r)
+function xrd_json($uri, $alias, $profile_url, $r)
 {
        $salmon_key = Salmon::salmonKey($r['spubkey']);
 
@@ -100,7 +100,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
        exit();
 }
 
-function xrd_xml($a, $uri, $alias, $profile_url, $r)
+function xrd_xml($uri, $alias, $profile_url, $r)
 {
        $salmon_key = Salmon::salmonKey($r['spubkey']);
 
index 6421a4c21299b5f244a20e52668aa84e6813b127..0015405c46bea5892cc634282f50c6c87d62d3f8 100644 (file)
@@ -1869,14 +1869,14 @@ class App
                                // And then append it to the target
                                $target->documentElement->appendChild($item);
                        }
-               }
 
-               if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) {
-                       header("Content-type: text/html; charset=utf-8");
+                       if ($_GET["mode"] == "raw") {
+                               header("Content-type: text/html; charset=utf-8");
 
-                       echo substr($target->saveHTML(), 6, -8);
+                               echo substr($target->saveHTML(), 6, -8);
 
-                       exit();
+                               exit();
+                       }
                }
 
                $page    = $this->page;
index 47e6af5eb1f508efa63a41d6ffca59e3c0c7cff0..724feea5e44f947e2178ef47915bc22ce257360c 100644 (file)
@@ -79,6 +79,8 @@ HELP;
                                DBStructure::convertToInnoDB();
                                $output = ob_get_clean();
                                break;
+                       default:
+                               $output = 'Unknown command: ' . $this->getArgument(0);
                }
 
                $this->out($output);
index 98de4fa178ecfdac71e40eda65fbc9ae0789899c..d582f21596688c16145ee28ee9cc3ec5c2a79de6 100644 (file)
@@ -637,6 +637,8 @@ class NotificationsManager extends BaseObject
        {
                $knowyou = '';
 
+               $arr = [];
+
                foreach ($intros as $it) {
                        // There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
                        // We have to distinguish between these two because they use different data.
index c74209d6a176bb7cb0c0e5e950bf0671654b27ca..9be77eca91bb161d01d026b9fa5999e44ba5f57e 100644 (file)
@@ -232,7 +232,7 @@ class Attach extends BaseObject
         * @return boolean True on success
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function storeFile($src, $uid, $filename = '', $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '')
+       public static function storeFile($src, $uid, $filename = '', $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '')
        {
                if ($filename === '') {
                        $filename = basename($src);
index 8937f198c772256fe2599b48e4c6e3b3f31f2b7f..2b7aada795b97488bb3e79f6b3e96e64f7c3c6b9 100644 (file)
@@ -35,12 +35,6 @@ class Contact extends BaseObject
         * @deprecated since version 2019.03
         * @see User::PAGE_FLAGS_NORMAL
         */
-       const PAGE_NORMAL    = 0;
-       const PAGE_SOAPBOX   = 1;
-       const PAGE_COMMUNITY = 2;
-       const PAGE_FREELOVE  = 3;
-       const PAGE_BLOG      = 4;
-       const PAGE_PRVGROUP  = 5;
        const PAGE_NORMAL    = User::PAGE_FLAGS_NORMAL;
        /**
         * @deprecated since version 2019.03
@@ -1205,9 +1199,10 @@ class Contact extends BaseObject
                                $contact = DBA::selectFirst('contact', $fields, ['addr' => $url]);
                        }
 
+                       // The link could be provided as http although we stored it as https
+                       $ssl_url = str_replace('http://', 'https://', $url);
+
                        if (!DBA::isResult($contact)) {
-                               // The link could be provided as http although we stored it as https
-                               $ssl_url = str_replace('http://', 'https://', $url);
                                $condition = ['alias' => [$url, Strings::normaliseLink($url), $ssl_url]];
                                $contact = DBA::selectFirst('contact', $fields, $condition);
                        }
@@ -1426,7 +1421,7 @@ class Contact extends BaseObject
        {
                $a = self::getApp();
 
-               $cid = Self::getIdForURL($contact_url);
+               $cid = self::getIdForURL($contact_url);
 
                $contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
                if (!DBA::isResult($contact)) {
index 90c70a9be535fc1aaa4e85bfec8334ecf4ffbb0d..06d3ba536d0567544af65558a85dc74d14eb47f3 100644 (file)
@@ -77,7 +77,7 @@ class Conversation
                                }
                                // Update structure data all the time but the source only when its from a better protocol.
                                if (empty($conversation['source']) || (!empty($old_conv['source']) &&
-                                       ($old_conv['protocol'] < defaults($conversation, 'protocol', PARCEL_UNKNOWN)))) {
+                                       ($old_conv['protocol'] < defaults($conversation, 'protocol', self::PARCEL_UNKNOWN)))) {
                                        unset($conversation['protocol']);
                                        unset($conversation['source']);
                                }
index 576f47ba832d6fa95b94beea42cf798fefe78af8..cd08c314afa5ffe521a3fab5305f4037499acf59 100644 (file)
@@ -48,8 +48,10 @@ class Event extends BaseObject
                }
 
                if ($simple) {
+                       $o = '';
+
                        if (!empty($event['summary'])) {
-                               $o = "<h3>" . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "</h3>";
+                               $o .= "<h3>" . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "</h3>";
                        }
 
                        if (!empty($event['desc'])) {
index cffa25397c850df81bd3a1e57d091cdec3edefe8..bc3d58c4a5f84b4ebe685c5963dfe2356f6725f8 100644 (file)
@@ -1252,6 +1252,8 @@ class Item extends BaseObject
        {
                $orig_item = $item;
 
+               $priority = PRIORITY_HIGH;
+
                // If it is a posting where users should get notifications, then define it as wall posting
                if ($notify) {
                        $item['wall'] = 1;
@@ -1261,8 +1263,6 @@ class Item extends BaseObject
 
                        if (is_int($notify)) {
                                $priority = $notify;
-                       } else {
-                               $priority = PRIORITY_HIGH;
                        }
                } else {
                        $item['network'] = trim(defaults($item, 'network', Protocol::PHANTOM));
@@ -1850,7 +1850,7 @@ class Item extends BaseObject
                                $cmd = 'wall-new';
                        }
 
-                       Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', $cmd, $current_post);
+                       Worker::add(['priority' => $priority, 'dont_fork' => true], 'Notifier', $cmd, $current_post);
                }
 
                return $current_post;
index 221ce8d08164c25f0def5c958068d17859324345..1c980fe11e7fcb6d6f33341d4ea86938d9c5e408 100644 (file)
@@ -293,7 +293,7 @@ class Proxy extends BaseModule
         *
         */
        private static function responseError() {
-               header('Content-type: ' . $img->getType());
+               header('Content-type: image/png');
                echo file_get_contents('images/blank.png');
                exit();
        }
index 44bb491813d7eb5a58b1a0d4515e2bcf2e16c2d6..a44f5c8b59b54233a57d799bc4496abf10f9354f 100644 (file)
@@ -1238,7 +1238,7 @@ class Transmitter
                Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
 
                $signed = LDSignature::sign($data, $owner);
-               HTTPSignature::transmit($signed, $profile['inbox'], $uid);
+               return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
        }
 
        /**
index 2dc5976b1dd5f71471754a88a3240bad305c9e58..cf6080c572d440fde1c26b2beb3de7d48ac28ed7 100644 (file)
@@ -1963,6 +1963,7 @@ class DFRN
                                DBA::escape($suggest["photo"]),
                                DBA::escape($suggest["request"])
                        );
+                       $fid = $r[0]["id"];
                }
 
                $condition = ['url' => $suggest["url"], 'name' => $suggest["name"], 'request' => $suggest["request"]];
@@ -1977,8 +1978,6 @@ class DFRN
                        exit();
                }
 
-               $fid = $r[0]["id"];
-
                $hash = Strings::getRandomHex();
 
                q(
@@ -2219,6 +2218,7 @@ class DFRN
 
                if (($xo->type == ACTIVITY_OBJ_PERSON) && ($xo->id)) {
                        // somebody was poked/prodded. Was it me?
+                       $Blink = '';
                        foreach ($xo->link as $l) {
                                $atts = $l->attributes();
                                switch ($atts["rel"]) {
index 2196fb7726492cdc273b0a1655b172896d4ee3e9..6860665fc200c43f58eb207c4580e568094ee8e0 100644 (file)
@@ -53,7 +53,7 @@ class OStatus
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact = null, $onlyfetch)
+       private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact, $onlyfetch)
        {
                $author = [];
                $author["author-link"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context);
@@ -303,7 +303,7 @@ class OStatus
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       public static function import($xml, array $importer, array &$contact = null, &$hub)
+       public static function import($xml, array $importer, array &$contact, &$hub)
        {
                self::process($xml, $importer, $contact, $hub);
        }
@@ -322,7 +322,7 @@ class OStatus
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true)
+       private static function process($xml, array $importer, array &$contact, &$hub, $stored = false, $initialize = true)
        {
                if ($initialize) {
                        self::$itemlist = [];
index c7e7c3c5ea68bf4af44b4acd27b66fc16762b981..de4b45da9a35bcf7c60572b140af0c8ac13b17c6 100644 (file)
@@ -101,6 +101,7 @@ class Network
                        return CurlResult::createErrorCurl(substr($url, 0, 200));
                }
 
+               $parts2 = [];
                $parts = parse_url($url);
                $path_parts = explode('/', defaults($parts, 'path', ''));
                foreach ($path_parts as $part) {
index 0a476a76beb338da29e2994efedaf38c66076763..0c63749c8593603b85c7f0a5b25fd3e5a80cbfbe 100644 (file)
@@ -295,7 +295,7 @@ class Strings
      * 
      * @return string   normalized OpenId Identity
      */
-    function normaliseOpenID($s)
+    public static function normaliseOpenID($s)
     {
         return trim(str_replace(['http://', 'https://'], ['', ''], $s), '/');
     }