Merge pull request #6483 from MrPetovan/bug/fixes-after-2019-03-develop-rebase
Fixes after 2019 03 develop rebase
This commit is contained in:
commit
85ff976f83
|
@ -528,7 +528,7 @@ function api_unique_id_to_nurl($id)
|
||||||
*
|
*
|
||||||
* @param App $a App
|
* @param App $a App
|
||||||
* @param int|string $contact_id Contact ID or URL
|
* @param int|string $contact_id Contact ID or URL
|
||||||
* @return array
|
* @return array|bool
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws ImagickException
|
* @throws ImagickException
|
||||||
* @throws InternalServerErrorException
|
* @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);
|
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)) {
|
if (!empty($item_id)) {
|
||||||
// Get the item with the given id
|
// Get the item with the given id
|
||||||
$condition = ['id' => $item_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(),
|
$condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
|
||||||
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type == "raw") {
|
||||||
|
$condition['private'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
|
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
|
||||||
|
|
||||||
if (DBA::isResult($lastwall)) {
|
if (DBA::isResult($lastwall)) {
|
||||||
|
@ -2834,7 +2833,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
|
|
||||||
$entities["media"][] = [
|
$entities["media"][] = [
|
||||||
"id" => $start+1,
|
"id" => $start+1,
|
||||||
"id_str" => (string)$start+1,
|
"id_str" => (string) ($start + 1),
|
||||||
"indices" => [$start, $start+strlen($url)],
|
"indices" => [$start, $start+strlen($url)],
|
||||||
"media_url" => Strings::normaliseLink($media_url),
|
"media_url" => Strings::normaliseLink($media_url),
|
||||||
"media_url_https" => $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()];
|
$condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()];
|
||||||
Photo::update(['profile' => false], $condition);
|
Photo::update(['profile' => false], $condition);
|
||||||
} else {
|
} else {
|
||||||
$fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype,
|
$fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext,
|
||||||
'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype];
|
'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext];
|
||||||
DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
|
DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,8 +210,8 @@ function localize_item(&$item)
|
||||||
foreach ($links->link as $l) {
|
foreach ($links->link as $l) {
|
||||||
$atts = $l->attributes();
|
$atts = $l->attributes();
|
||||||
switch ($atts['rel']) {
|
switch ($atts['rel']) {
|
||||||
case "alternate": $Blink = $atts['href'];
|
case "alternate": $Blink = $atts['href']; break;
|
||||||
case "photo": $Bphoto = $atts['href'];
|
case "photo": $Bphoto = $atts['href']; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1044,6 @@ function format_like($cnt, array $arr, $type, $id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$phrase = '';
|
|
||||||
if ($cnt > 1) {
|
if ($cnt > 1) {
|
||||||
$total = count($arr);
|
$total = count($arr);
|
||||||
if ($total < MAX_LIKERS) {
|
if ($total < MAX_LIKERS) {
|
||||||
|
@ -1447,7 +1446,7 @@ function sort_thr_created_rev(array $a, array $b)
|
||||||
*
|
*
|
||||||
* @param array $a
|
* @param array $a
|
||||||
* @param array $b
|
* @param array $b
|
||||||
* @return int|lt
|
* @return int
|
||||||
*/
|
*/
|
||||||
function sort_thr_commented(array $a, array $b)
|
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 = [];
|
$ret = [];
|
||||||
foreach ($response_verbs as $v) {
|
foreach ($response_verbs as $v) {
|
||||||
$ret[$v] = [];
|
$ret[$v] = [];
|
||||||
|
|
|
@ -11,8 +11,8 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Emailer;
|
use Friendica\Util\Emailer;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
@ -25,7 +25,7 @@ use Friendica\Util\Strings;
|
||||||
* link, subject, body, to_name, to_email, source_name,
|
* link, subject, body, to_name, to_email, source_name,
|
||||||
* source_link, activity, preamble, notify_flags,
|
* source_link, activity, preamble, notify_flags,
|
||||||
* language, show_in_notification_page
|
* language, show_in_notification_page
|
||||||
* @return bool|object
|
* @return bool
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
function notification($params)
|
function notification($params)
|
||||||
|
@ -43,7 +43,7 @@ function notification($params)
|
||||||
|
|
||||||
if (!DBA::isResult($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
Logger::log('Unknown user ' . $params['uid']);
|
Logger::log('Unknown user ' . $params['uid']);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
|
$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
|
// 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])) {
|
if (!DBA::isResult($user) || in_array($user["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
$nickname = $user["nickname"];
|
$nickname = $user["nickname"];
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,7 +146,7 @@ function notification($params)
|
||||||
if (DBA::isResult($thread) && $thread['ignored']) {
|
if (DBA::isResult($thread) && $thread['ignored']) {
|
||||||
Logger::log('Thread ' . $parent_id . ' will be ignored', Logger::DEBUG);
|
Logger::log('Thread ' . $parent_id . ' will be ignored', Logger::DEBUG);
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if there was already a tag notify or comment notify for this post.
|
// 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']];
|
'link' => $params['link'], 'uid' => $params['uid']];
|
||||||
if (DBA::exists('notify', $condition)) {
|
if (DBA::exists('notify', $condition)) {
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's a post figure out who's post it is.
|
// if it's a post figure out who's post it is.
|
||||||
|
@ -522,7 +522,7 @@ function notification($params)
|
||||||
|
|
||||||
if ($datarray['abort']) {
|
if ($datarray['abort']) {
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
return False;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create notification entry in DB
|
// create notification entry in DB
|
||||||
|
@ -671,8 +671,7 @@ function notification($params)
|
||||||
|
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
// use the Emailer class to send the message
|
// use the Emailer class to send the message
|
||||||
return Emailer::send(
|
return Emailer::send([
|
||||||
[
|
|
||||||
'uid' => $params['uid'],
|
'uid' => $params['uid'],
|
||||||
'fromName' => $sender_name,
|
'fromName' => $sender_name,
|
||||||
'fromEmail' => $sender_email,
|
'fromEmail' => $sender_email,
|
||||||
|
@ -681,8 +680,8 @@ function notification($params)
|
||||||
'messageSubject' => $datarray['subject'],
|
'messageSubject' => $datarray['subject'],
|
||||||
'htmlVersion' => $email_html_body,
|
'htmlVersion' => $email_html_body,
|
||||||
'textVersion' => $email_text_body,
|
'textVersion' => $email_text_body,
|
||||||
'additionalMailHeader' => $datarray['headers']]
|
'additionalMailHeader' => $datarray['headers']
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
|
@ -778,7 +777,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||||
$item = Item::selectFirst($fields, $condition);
|
$item = Item::selectFirst($fields, $condition);
|
||||||
if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
|
if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the notification array
|
// Generate the notification array
|
||||||
|
|
|
@ -247,30 +247,21 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false)
|
||||||
* @param array $importer
|
* @param array $importer
|
||||||
* @param array $contact
|
* @param array $contact
|
||||||
* @param $hub
|
* @param $hub
|
||||||
* @param int $datedir
|
|
||||||
* @param int $pass
|
|
||||||
* @throws ImagickException
|
* @throws ImagickException
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @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 ($contact['network'] === Protocol::OSTATUS) {
|
||||||
if ($pass < 2) {
|
Logger::log("Consume OStatus messages ", Logger::DEBUG);
|
||||||
// Test - remove before flight
|
OStatus::import($xml, $importer, $contact, $hub);
|
||||||
//$tempfile = tempnam(get_temppath(), "ostatus2");
|
|
||||||
//file_put_contents($tempfile, $xml);
|
|
||||||
Logger::log("Consume OStatus messages ", Logger::DEBUG);
|
|
||||||
OStatus::import($xml, $importer, $contact, $hub);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['network'] === Protocol::FEED) {
|
if ($contact['network'] === Protocol::FEED) {
|
||||||
if ($pass < 2) {
|
Logger::log("Consume feeds", Logger::DEBUG);
|
||||||
Logger::log("Consume feeds", Logger::DEBUG);
|
Feed::import($xml, $importer, $contact, $hub);
|
||||||
Feed::import($xml, $importer, $contact, $hub);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ function qp($s) {
|
||||||
*/
|
*/
|
||||||
function redir_private_images($a, &$item)
|
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);
|
$cnt = preg_match_all('|\[img\](http[^\[]*?/photo/[a-fA-F0-9]+?(-[0-9]\.[\w]+?)?)\[\/img\]|', $item['body'], $matches, PREG_SET_ORDER);
|
||||||
if ($cnt) {
|
if ($cnt) {
|
||||||
foreach ($matches as $mtch) {
|
foreach ($matches as $mtch) {
|
||||||
|
@ -187,7 +187,7 @@ function get_cats_and_terms($item)
|
||||||
$categories = [];
|
$categories = [];
|
||||||
$folders = [];
|
$folders = [];
|
||||||
|
|
||||||
$matches = false;
|
$matches = [];
|
||||||
$first = true;
|
$first = true;
|
||||||
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
|
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
|
||||||
if ($cnt) {
|
if ($cnt) {
|
||||||
|
@ -208,7 +208,7 @@ function get_cats_and_terms($item)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user() == $item['uid']) {
|
if (local_user() == $item['uid']) {
|
||||||
$matches = false;
|
$matches = [];
|
||||||
$first = true;
|
$first = true;
|
||||||
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
|
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
|
||||||
if ($cnt) {
|
if ($cnt) {
|
||||||
|
@ -235,7 +235,7 @@ function get_cats_and_terms($item)
|
||||||
/**
|
/**
|
||||||
* return number of bytes in size (K, M, G)
|
* return number of bytes in size (K, M, G)
|
||||||
* @param string $size_str
|
* @param string $size_str
|
||||||
* @return number
|
* @return int
|
||||||
*/
|
*/
|
||||||
function return_bytes($size_str) {
|
function return_bytes($size_str) {
|
||||||
switch (substr ($size_str, -1)) {
|
switch (substr ($size_str, -1)) {
|
||||||
|
|
|
@ -1564,7 +1564,7 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
$response_verbs = ['like'];
|
$response_verbs = ['like'];
|
||||||
$response_verbs[] = 'dislike';
|
$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);
|
$paginate = $pager->renderFull($total);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
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']) : '';
|
$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']) : '';
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Thread extends BaseObject
|
||||||
*
|
*
|
||||||
* We should find a way to avoid using those arguments (at least most of them)
|
* 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
|
* @return mixed The data requested on success
|
||||||
* false on failure
|
* false on failure
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Emailer
|
||||||
* additionalMailHeader additions to the SMTP mail header
|
* additionalMailHeader additions to the SMTP mail header
|
||||||
* optional uid user id of the destination user
|
* optional uid user id of the destination user
|
||||||
*
|
*
|
||||||
* @return object
|
* @return bool
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function send($params)
|
public static function send($params)
|
||||||
|
|
Loading…
Reference in a new issue