*
* @param App $a App
* @param int|string $contact_id Contact ID or URL
- * @return array
+ * @return array|bool
* @throws BadRequestException
* @throws ImagickException
* @throws InternalServerErrorException
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];
$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)) {
$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,
$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()]);
}
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;
}
}
}
}
- $phrase = '';
if ($cnt > 1) {
$total = count($arr);
if ($total < MAX_LIKERS) {
*
* @param array $a
* @param array $b
- * @return int|lt
+ * @return int
*/
function sort_thr_commented(array $a, array $b)
{
}
}
-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] = [];
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;
* 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)
if (!DBA::isResult($user)) {
Logger::log('Unknown user ' . $params['uid']);
- return;
+ return false;
}
$params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
// 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 {
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.
'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.
if ($datarray['abort']) {
L10n::popLang();
- return False;
+ return false;
}
// create notification entry in DB
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,
'messageSubject' => $datarray['subject'],
'htmlVersion' => $email_html_body,
'textVersion' => $email_text_body,
- 'additionalMailHeader' => $datarray['headers']]
- );
+ 'additionalMailHeader' => $datarray['headers']
+ ]);
}
L10n::popLang();
$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
* @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;
}
*/
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) {
$categories = [];
$folders = [];
- $matches = false;
+ $matches = [];
$first = true;
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
if ($cnt) {
}
if (local_user() == $item['uid']) {
- $matches = false;
+ $matches = [];
$first = true;
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
if ($cnt) {
/**
* 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)) {
}
$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);
}
}
}
- $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']) : '';
*
* 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
* 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)