]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6483 from MrPetovan/bug/fixes-after-2019-03-develop-rebase
authorMichael Vogel <icarus@dabo.de>
Mon, 21 Jan 2019 20:52:22 +0000 (21:52 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Jan 2019 20:52:22 +0000 (21:52 +0100)
Fixes after 2019 03 develop rebase

include/api.php
include/conversation.php
include/enotify.php
include/items.php
include/text.php
mod/photos.php
src/Object/Post.php
src/Object/Thread.php
src/Util/Emailer.php

index d1d54f144c7f23cc864e7c1212b6b0b1f12940da..4452ebfb92eddfacc58e28a738d300785bc7668a 100644 (file)
@@ -528,7 +528,7 @@ function api_unique_id_to_nurl($id)
  *
  * @param App        $a          App
  * @param int|string $contact_id Contact ID or URL
- * @return array
+ * @return array|bool
  * @throws BadRequestException
  * @throws ImagickException
  * @throws InternalServerErrorException
@@ -1320,12 +1320,6 @@ function api_status_show($type, $item_id = 0)
 
        Logger::log('api_status_show: user_info: '.print_r($user_info, true), Logger::DEBUG);
 
-       if ($type == "raw") {
-               $privacy_sql = "AND NOT `private`";
-       } else {
-               $privacy_sql = "";
-       }
-
        if (!empty($item_id)) {
                // Get the item with the given id
                $condition = ['id' => $item_id];
@@ -1334,6 +1328,11 @@ function api_status_show($type, $item_id = 0)
                $condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
                        'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
        }
+
+       if ($type == "raw") {
+               $condition['private'] = false;
+       }
+
        $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
 
        if (DBA::isResult($lastwall)) {
@@ -2834,7 +2833,7 @@ function api_get_entitities(&$text, $bbcode)
 
                                $entities["media"][] = [
                                                        "id" => $start+1,
-                                                       "id_str" => (string)$start+1,
+                                                       "id_str" => (string) ($start + 1),
                                                        "indices" => [$start, $start+strlen($url)],
                                                        "media_url" => Strings::normaliseLink($media_url),
                                                        "media_url_https" => $media_url,
@@ -4597,8 +4596,8 @@ function api_account_update_profile_image($type)
                $condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()];
                Photo::update(['profile' => false], $condition);
        } else {
-               $fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype,
-                       'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype];
+               $fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext,
+                       'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext];
                DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
        }
 
index 6ee7309ad17bd4aeb1e7cd9a5fd11712ce66f137..d7e3d54808ed77640c15662a9bc28ae4de40b2b6 100644 (file)
@@ -210,8 +210,8 @@ function localize_item(&$item)
                foreach ($links->link as $l) {
                        $atts = $l->attributes();
                        switch ($atts['rel']) {
-                               case "alternate": $Blink = $atts['href'];
-                               case "photo": $Bphoto = $atts['href'];
+                               case "alternate": $Blink = $atts['href']; break;
+                               case "photo": $Bphoto = $atts['href']; break;
                        }
                }
 
@@ -1044,7 +1044,6 @@ function format_like($cnt, array $arr, $type, $id) {
                }
        }
 
-       $phrase = '';
        if ($cnt > 1) {
                $total = count($arr);
                if ($total < MAX_LIKERS) {
@@ -1447,7 +1446,7 @@ function sort_thr_created_rev(array $a, array $b)
  *
  * @param array $a
  * @param array $b
- * @return int|lt
+ * @return int
  */
 function sort_thr_commented(array $a, array $b)
 {
@@ -1464,7 +1463,7 @@ function render_location_dummy(array $item) {
        }
 }
 
-function get_responses(array $conv_responses, array $response_verbs, $ob, array $item) {
+function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) {
        $ret = [];
        foreach ($response_verbs as $v) {
                $ret[$v] = [];
index 800158d9ae98df54b6687791e2c53ec0469b0b69..58e1a75f00a830c64de414c5ca5c13f8c9d0f7b2 100644 (file)
@@ -11,8 +11,8 @@ use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
 use Friendica\Model\Item;
+use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Emailer;
 use Friendica\Util\Strings;
@@ -25,7 +25,7 @@ use Friendica\Util\Strings;
  *                      link, subject, body, to_name, to_email, source_name,
  *                      source_link, activity, preamble, notify_flags,
  *                      language, show_in_notification_page
- * @return bool|object
+ * @return bool
  * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
 function notification($params)
@@ -43,7 +43,7 @@ function notification($params)
 
        if (!DBA::isResult($user)) {
                Logger::log('Unknown user ' . $params['uid']);
-               return;
+               return false;
        }
 
        $params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
@@ -79,7 +79,7 @@ function notification($params)
 
                // There is no need to create notifications for forum accounts
                if (!DBA::isResult($user) || in_array($user["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
-                       return;
+                       return false;
                }
                $nickname = $user["nickname"];
        } else {
@@ -146,7 +146,7 @@ function notification($params)
                if (DBA::isResult($thread) && $thread['ignored']) {
                        Logger::log('Thread ' . $parent_id . ' will be ignored', Logger::DEBUG);
                        L10n::popLang();
-                       return;
+                       return false;
                }
 
                // Check to see if there was already a tag notify or comment notify for this post.
@@ -155,7 +155,7 @@ function notification($params)
                        'link' => $params['link'], 'uid' => $params['uid']];
                if (DBA::exists('notify', $condition)) {
                        L10n::popLang();
-                       return;
+                       return false;
                }
 
                // if it's a post figure out who's post it is.
@@ -522,7 +522,7 @@ function notification($params)
 
                if ($datarray['abort']) {
                        L10n::popLang();
-                       return False;
+                       return false;
                }
 
                // create notification entry in DB
@@ -671,8 +671,7 @@ function notification($params)
 
                L10n::popLang();
                // use the Emailer class to send the message
-               return Emailer::send(
-                       [
+               return Emailer::send([
                        'uid' => $params['uid'],
                        'fromName' => $sender_name,
                        'fromEmail' => $sender_email,
@@ -681,8 +680,8 @@ function notification($params)
                        'messageSubject' => $datarray['subject'],
                        'htmlVersion' => $email_html_body,
                        'textVersion' => $email_text_body,
-                       'additionalMailHeader' => $datarray['headers']]
-               );
+                       'additionalMailHeader' => $datarray['headers']
+               ]);
        }
 
        L10n::popLang();
@@ -778,7 +777,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
        $condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
        $item = Item::selectFirst($fields, $condition);
        if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
-               return;
+               return false;
        }
 
        // Generate the notification array
index 52d37d621c37835afcb3d6381aff91102aadabfc..88eec1dc48794de8faa89f91ac80aeaaedf91ac0 100644 (file)
@@ -247,30 +247,21 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false)
  * @param array $importer
  * @param array $contact
  * @param       $hub
- * @param int   $datedir
- * @param int   $pass
  * @throws ImagickException
  * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
-function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0, $pass = 0)
+function consume_feed($xml, array $importer, array $contact, &$hub)
 {
        if ($contact['network'] === Protocol::OSTATUS) {
-               if ($pass < 2) {
-                       // Test - remove before flight
-                       //$tempfile = tempnam(get_temppath(), "ostatus2");
-                       //file_put_contents($tempfile, $xml);
-                       Logger::log("Consume OStatus messages ", Logger::DEBUG);
-                       OStatus::import($xml, $importer, $contact, $hub);
-               }
+               Logger::log("Consume OStatus messages ", Logger::DEBUG);
+               OStatus::import($xml, $importer, $contact, $hub);
 
                return;
        }
 
        if ($contact['network'] === Protocol::FEED) {
-               if ($pass < 2) {
-                       Logger::log("Consume feeds", Logger::DEBUG);
-                       Feed::import($xml, $importer, $contact, $hub);
-               }
+               Logger::log("Consume feeds", Logger::DEBUG);
+               Feed::import($xml, $importer, $contact, $hub);
 
                return;
        }
index 0b8bcacba59f4f63f2cac9c435553a819300c92e..c4249f86c49acc47d245163f3eed9bd3787ff866 100644 (file)
@@ -122,7 +122,7 @@ function qp($s) {
  */
 function redir_private_images($a, &$item)
 {
-       $matches = false;
+       $matches = [];
        $cnt = preg_match_all('|\[img\](http[^\[]*?/photo/[a-fA-F0-9]+?(-[0-9]\.[\w]+?)?)\[\/img\]|', $item['body'], $matches, PREG_SET_ORDER);
        if ($cnt) {
                foreach ($matches as $mtch) {
@@ -187,7 +187,7 @@ function get_cats_and_terms($item)
        $categories = [];
        $folders = [];
 
-       $matches = false;
+       $matches = [];
        $first = true;
        $cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
        if ($cnt) {
@@ -208,7 +208,7 @@ function get_cats_and_terms($item)
        }
 
        if (local_user() == $item['uid']) {
-               $matches = false;
+               $matches = [];
                $first = true;
                $cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
                if ($cnt) {
@@ -235,7 +235,7 @@ function get_cats_and_terms($item)
 /**
  * return number of bytes in size (K, M, G)
  * @param string $size_str
- * @return number
+ * @return int
  */
 function return_bytes($size_str) {
        switch (substr ($size_str, -1)) {
index 710a3873ee30812afb4a404988b96f530e3af586..137e0adb563218b312b51fc3b0dc021899df677f 100644 (file)
@@ -1564,7 +1564,7 @@ function photos_content(App $a)
                        }
                        $response_verbs = ['like'];
                        $response_verbs[] = 'dislike';
-                       $responses = get_responses($conv_responses, $response_verbs, '', $link_item);
+                       $responses = get_responses($conv_responses, $response_verbs, $link_item);
 
                        $paginate = $pager->renderFull($total);
                }
index 2d52f4244a6c5fbe19b10af406c5b78b8907fa13..c9e5cddb699f6ebb950cf13870a95a2f4e114ede 100644 (file)
@@ -250,7 +250,7 @@ class Post extends BaseObject
                        }
                }
 
-               $responses = get_responses($conv_responses, $response_verbs, $this, $item);
+               $responses = get_responses($conv_responses, $response_verbs, $item, $this);
 
                foreach ($response_verbs as $value => $verbs) {
                        $responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : '';
index c5795819a42e0d5a0f020d8bab3dc7a6714ea348..89ed5a9408bd506e7f340db4ec3b82ce33410e01 100644 (file)
@@ -170,7 +170,7 @@ class Thread extends BaseObject
         *
         * We should find a way to avoid using those arguments (at least most of them)
         *
-        * @param object $conv_responses data
+        * @param array $conv_responses data
         *
         * @return mixed The data requested on success
         *               false on failure
index cccf8c2fab349c5573afc555e188a31e7f8239ea..6a19e8e4587c929b80c0cf1895f187ad5383f033 100644 (file)
@@ -29,7 +29,7 @@ class Emailer
         *                      additionalMailHeader additions to the SMTP mail header
         *                      optional             uid user id of the destination user
         *
-        * @return object
+        * @return bool
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public static function send($params)