Merge pull request #6483 from MrPetovan/bug/fixes-after-2019-03-develop-rebase

Fixes after 2019 03 develop rebase
This commit is contained in:
Michael Vogel 2019-01-21 21:52:22 +01:00 committed by GitHub
commit 85ff976f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 49 deletions

View 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()]);
}

View 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] = [];

View 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

View 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;
}

View 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)) {

View 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);
}

View 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']) : '';

View 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

View 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)