Rewrite:
- moved constants GRAVITY_* from boot.php to Friendica\Model\Item - also rewrote some array initialization: From: ```` <?php $arr = []; $arr['foo'] = "FOO"; ```` To: ```` <?php $arr['foo'] = "FOO"; ```` - added a few type-hints
This commit is contained in:
parent
e5ae5c7e67
commit
da66730e4f
77 changed files with 547 additions and 513 deletions
|
@ -106,7 +106,7 @@ function display_init(App $a)
|
|||
displayShowFeed($item['uri-id'], $item['uid'], false);
|
||||
}
|
||||
|
||||
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||
if ($item['gravity'] != Item::GRAVITY_PARENT) {
|
||||
$parent = Post::selectFirstForUser($item_user, $fields, ['uid' => [0, $item_user], 'uri-id' => $item['parent-uri-id']], ['order' => ['uid' => true]]);
|
||||
$item = $parent ?: $item;
|
||||
}
|
||||
|
|
23
mod/item.php
23
mod/item.php
|
@ -122,7 +122,7 @@ function item_post(App $a) {
|
|||
$thr_parent_uri = $parent_item['uri'];
|
||||
$toplevel_item = $parent_item;
|
||||
|
||||
if ($parent_item['gravity'] != GRAVITY_PARENT) {
|
||||
if ($parent_item['gravity'] != Item::GRAVITY_PARENT) {
|
||||
$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $toplevel_item['parent']]);
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ function item_post(App $a) {
|
|||
// Look for any tags and linkify them
|
||||
$item = [
|
||||
'uid' => local_user() ? local_user() : $profile_uid,
|
||||
'gravity' => $toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT,
|
||||
'gravity' => $toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT,
|
||||
'network' => $network,
|
||||
'body' => $body,
|
||||
'postopts' => $postopts,
|
||||
|
@ -513,7 +513,7 @@ function item_post(App $a) {
|
|||
$network = Protocol::DFRN;
|
||||
}
|
||||
|
||||
$gravity = ($toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT);
|
||||
$gravity = ($toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT);
|
||||
|
||||
// even if the post arrived via API we are considering that it
|
||||
// originated on this site by default for determining relayability.
|
||||
|
@ -705,7 +705,7 @@ function item_post(App $a) {
|
|||
|
||||
Tag::storeFromBody($datarray['uri-id'], $datarray['body']);
|
||||
|
||||
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == GRAVITY_COMMENT)) {
|
||||
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == Item::GRAVITY_COMMENT)) {
|
||||
Tag::createImplicitMentions($datarray['uri-id'], $datarray['thr-parent-id']);
|
||||
}
|
||||
|
||||
|
@ -833,15 +833,15 @@ function item_content(App $a)
|
|||
* @return string
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
function drop_item(int $id, string $return = '')
|
||||
function drop_item(int $id, string $return = ''): string
|
||||
{
|
||||
// locate item to be deleted
|
||||
$fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'];
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $id]);
|
||||
// Locate item to be deleted
|
||||
$item = Post::selectFirstForUser(local_user(), ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'], ['id' => $id]);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
notice(DI::l10n()->t('Item not found.'));
|
||||
DI::baseUrl()->redirect('network');
|
||||
//NOTREACHED
|
||||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
|
@ -860,6 +860,7 @@ function drop_item(int $id, string $return = '')
|
|||
Item::deleteForUser(['id' => $item['id']], local_user());
|
||||
|
||||
item_redirect_after_action($item, $return);
|
||||
//NOTREACHED
|
||||
} else {
|
||||
Logger::warning('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]);
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
|
@ -870,15 +871,15 @@ function drop_item(int $id, string $return = '')
|
|||
return '';
|
||||
}
|
||||
|
||||
function item_redirect_after_action($item, $returnUrlHex)
|
||||
function item_redirect_after_action(array $item, string $returnUrlHex)
|
||||
{
|
||||
$return_url = hex2bin($returnUrlHex);
|
||||
|
||||
// removes update_* from return_url to ignore Ajax refresh
|
||||
$return_url = str_replace("update_", "", $return_url);
|
||||
$return_url = str_replace('update_', '', $return_url);
|
||||
|
||||
// Check if delete a comment
|
||||
if ($item['gravity'] == GRAVITY_COMMENT) {
|
||||
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
|
||||
if (!empty($item['parent'])) {
|
||||
$parentitem = Post::selectFirstForUser(local_user(), ['guid'], ['id' => $item['parent']]);
|
||||
}
|
||||
|
|
172
mod/message.php
172
mod/message.php
|
@ -43,23 +43,23 @@ function message_init(App $a)
|
|||
}
|
||||
|
||||
$new = [
|
||||
'label' => DI::l10n()->t('New Message'),
|
||||
'url' => 'message/new',
|
||||
'sel' => DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new',
|
||||
'label' => DI::l10n()->t('New Message'),
|
||||
'url' => 'message/new',
|
||||
'sel' => DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new',
|
||||
'accesskey' => 'm',
|
||||
];
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('message_side.tpl');
|
||||
DI::page()['aside'] = Renderer::replaceMacros($tpl, [
|
||||
'$tabs' => $tabs,
|
||||
'$new' => $new,
|
||||
'$new' => $new,
|
||||
]);
|
||||
$base = DI::baseUrl();
|
||||
|
||||
$head_tpl = Renderer::getMarkupTemplate('message-head.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$base' => $base
|
||||
'$base' => $base
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,15 @@ function message_post(App $a)
|
|||
notice(DI::l10n()->t('No recipient selected.'));
|
||||
$norecip = true;
|
||||
break;
|
||||
|
||||
case -2:
|
||||
notice(DI::l10n()->t('Unable to locate contact information.'));
|
||||
break;
|
||||
|
||||
case -3:
|
||||
notice(DI::l10n()->t('Message could not be sent.'));
|
||||
break;
|
||||
|
||||
case -4:
|
||||
notice(DI::l10n()->t('Message collection failure.'));
|
||||
break;
|
||||
|
@ -118,20 +121,20 @@ function message_content(App $a)
|
|||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') {
|
||||
$button = [
|
||||
'label' => DI::l10n()->t('Discard'),
|
||||
'url' => '/message',
|
||||
'sel' => 'close',
|
||||
'url' => '/message',
|
||||
'sel' => 'close',
|
||||
];
|
||||
} else {
|
||||
$button = [
|
||||
'label' => DI::l10n()->t('New Message'),
|
||||
'url' => '/message/new',
|
||||
'sel' => 'new',
|
||||
'label' => DI::l10n()->t('New Message'),
|
||||
'url' => '/message/new',
|
||||
'sel' => 'new',
|
||||
'accesskey' => 'm',
|
||||
];
|
||||
}
|
||||
$header = Renderer::replaceMacros($tpl, [
|
||||
'$messages' => DI::l10n()->t('Messages'),
|
||||
'$button' => $button,
|
||||
'$button' => $button,
|
||||
]);
|
||||
|
||||
if ((DI::args()->getArgc() == 3) && (DI::args()->getArgv()[1] === 'drop' || DI::args()->getArgv()[1] === 'dropconv')) {
|
||||
|
@ -186,19 +189,19 @@ function message_content(App $a)
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('prv_message.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$header' => DI::l10n()->t('Send Private Message'),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
'$subject' => DI::l10n()->t('Subject:'),
|
||||
'$subjtxt' => $_REQUEST['subject'] ?? '',
|
||||
'$text' => $_REQUEST['body'] ?? '',
|
||||
'$readonly' => '',
|
||||
'$yourmessage'=> DI::l10n()->t('Your message:'),
|
||||
'$select' => $select,
|
||||
'$parent' => '',
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$insert' => DI::l10n()->t('Insert web link'),
|
||||
'$wait' => DI::l10n()->t('Please wait'),
|
||||
'$submit' => DI::l10n()->t('Submit')
|
||||
'$header' => DI::l10n()->t('Send Private Message'),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
'$subject' => DI::l10n()->t('Subject:'),
|
||||
'$subjtxt' => $_REQUEST['subject'] ?? '',
|
||||
'$text' => $_REQUEST['body'] ?? '',
|
||||
'$readonly' => '',
|
||||
'$yourmessage' => DI::l10n()->t('Your message:'),
|
||||
'$select' => $select,
|
||||
'$parent' => '',
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$insert' => DI::l10n()->t('Insert web link'),
|
||||
'$wait' => DI::l10n()->t('Please wait'),
|
||||
'$submit' => DI::l10n()->t('Submit')
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
|
@ -312,18 +315,18 @@ function message_content(App $a)
|
|||
$from_photo = Contact::getThumb($contact);
|
||||
|
||||
$mails[] = [
|
||||
'id' => $message['id'],
|
||||
'from_name' => $from_name_e,
|
||||
'from_url' => $from_url,
|
||||
'from_addr' => $contact['addr'] ?? $from_url,
|
||||
'sparkle' => $sparkle,
|
||||
'id' => $message['id'],
|
||||
'from_name' => $from_name_e,
|
||||
'from_url' => $from_url,
|
||||
'from_addr' => $contact['addr'] ?? $from_url,
|
||||
'sparkle' => $sparkle,
|
||||
'from_photo' => $from_photo,
|
||||
'subject' => $subject_e,
|
||||
'body' => $body_e,
|
||||
'delete' => DI::l10n()->t('Delete message'),
|
||||
'to_name' => $to_name_e,
|
||||
'date' => DateTimeFormat::local($message['created'], DI::l10n()->t('D, d M Y - g:i A')),
|
||||
'ago' => Temporal::getRelativeDate($message['created']),
|
||||
'subject' => $subject_e,
|
||||
'body' => $body_e,
|
||||
'delete' => DI::l10n()->t('Delete message'),
|
||||
'to_name' => $to_name_e,
|
||||
'date' => DateTimeFormat::local($message['created'], DI::l10n()->t('D, d M Y - g:i A')),
|
||||
'ago' => Temporal::getRelativeDate($message['created']),
|
||||
];
|
||||
|
||||
$seen = $message['seen'];
|
||||
|
@ -334,28 +337,27 @@ function message_content(App $a)
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('mail_display.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$thread_id' => DI::args()->getArgv()[1],
|
||||
'$thread_id' => DI::args()->getArgv()[1],
|
||||
'$thread_subject' => $message['title'],
|
||||
'$thread_seen' => $seen,
|
||||
'$delete' => DI::l10n()->t('Delete conversation'),
|
||||
'$canreply' => (($unknown) ? false : '1'),
|
||||
'$unknown_text' => DI::l10n()->t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
|
||||
'$mails' => $mails,
|
||||
|
||||
'$thread_seen' => $seen,
|
||||
'$delete' => DI::l10n()->t('Delete conversation'),
|
||||
'$canreply' => (($unknown) ? false : '1'),
|
||||
'$unknown_text' => DI::l10n()->t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
|
||||
'$mails' => $mails,
|
||||
// reply
|
||||
'$header' => DI::l10n()->t('Send Reply'),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
'$subject' => DI::l10n()->t('Subject:'),
|
||||
'$subjtxt' => $message['title'],
|
||||
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',
|
||||
'$yourmessage' => DI::l10n()->t('Your message:'),
|
||||
'$text' => '',
|
||||
'$select' => $select,
|
||||
'$parent' => $parent,
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$insert' => DI::l10n()->t('Insert web link'),
|
||||
'$submit' => DI::l10n()->t('Submit'),
|
||||
'$wait' => DI::l10n()->t('Please wait')
|
||||
'$header' => DI::l10n()->t('Send Reply'),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
'$subject' => DI::l10n()->t('Subject:'),
|
||||
'$subjtxt' => $message['title'],
|
||||
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',
|
||||
'$yourmessage' => DI::l10n()->t('Your message:'),
|
||||
'$text' => '',
|
||||
'$select' => $select,
|
||||
'$parent' => $parent,
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$insert' => DI::l10n()->t('Insert web link'),
|
||||
'$submit' => DI::l10n()->t('Submit'),
|
||||
'$wait' => DI::l10n()->t('Please wait')
|
||||
]);
|
||||
|
||||
return $o;
|
||||
|
@ -368,7 +370,7 @@ function message_content(App $a)
|
|||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
function get_messages(int $uid, int $start, int $limit)
|
||||
function get_messages(int $uid, int $start, int $limit): array
|
||||
{
|
||||
return DBA::toArray(DBA::p('SELECT
|
||||
m.`id`,
|
||||
|
@ -392,21 +394,21 @@ function get_messages(int $uid, int $start, int $limit)
|
|||
c.`url`,
|
||||
c.`thumb`,
|
||||
c.`network`,
|
||||
m2.`count`,
|
||||
m2.`mailcreated`,
|
||||
m2.`mailseen`
|
||||
FROM `mail` m
|
||||
JOIN (
|
||||
SELECT
|
||||
`parent-uri`,
|
||||
MIN(`id`) AS `id`,
|
||||
COUNT(*) AS `count`,
|
||||
MAX(`created`) AS `mailcreated`,
|
||||
MIN(`seen`) AS `mailseen`
|
||||
FROM `mail`
|
||||
WHERE `uid` = ?
|
||||
GROUP BY `parent-uri`
|
||||
) m2 ON m.`parent-uri` = m2.`parent-uri` AND m.`id` = m2.`id`
|
||||
m2.`count`,
|
||||
m2.`mailcreated`,
|
||||
m2.`mailseen`
|
||||
FROM `mail` m
|
||||
JOIN (
|
||||
SELECT
|
||||
`parent-uri`,
|
||||
MIN(`id`) AS `id`,
|
||||
COUNT(*) AS `count`,
|
||||
MAX(`created`) AS `mailcreated`,
|
||||
MIN(`seen`) AS `mailseen`
|
||||
FROM `mail`
|
||||
WHERE `uid` = ?
|
||||
GROUP BY `parent-uri`
|
||||
) m2 ON m.`parent-uri` = m2.`parent-uri` AND m.`id` = m2.`id`
|
||||
LEFT JOIN `contact` c ON m.`contact-id` = c.`id`
|
||||
WHERE m.`uid` = ?
|
||||
ORDER BY m2.`mailcreated` DESC
|
||||
|
@ -414,7 +416,7 @@ function get_messages(int $uid, int $start, int $limit)
|
|||
, $uid, $uid, $start, $limit));
|
||||
}
|
||||
|
||||
function render_messages(array $msg, $t)
|
||||
function render_messages(array $msg, string $t): string
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
|
@ -444,20 +446,20 @@ function render_messages(array $msg, $t)
|
|||
$from_photo = Contact::getThumb($contact);
|
||||
|
||||
$rslt .= Renderer::replaceMacros($tpl, [
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
'$from_addr' => $contact['addr'] ?? '',
|
||||
'$sparkle' => ' sparkle',
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
'$from_addr' => $contact['addr'] ?? '',
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => $from_photo,
|
||||
'$subject' => $rr['title'],
|
||||
'$delete' => DI::l10n()->t('Delete conversation'),
|
||||
'$body' => $body_e,
|
||||
'$to_name' => $to_name_e,
|
||||
'$date' => DateTimeFormat::local($rr['mailcreated'], DI::l10n()->t('D, d M Y - g:i A')),
|
||||
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
|
||||
'$seen' => $rr['mailseen'],
|
||||
'$count' => DI::l10n()->tt('%d message', '%d messages', $rr['count']),
|
||||
'$subject' => $rr['title'],
|
||||
'$delete' => DI::l10n()->t('Delete conversation'),
|
||||
'$body' => $body_e,
|
||||
'$to_name' => $to_name_e,
|
||||
'$date' => DateTimeFormat::local($rr['mailcreated'], DI::l10n()->t('D, d M Y - g:i A')),
|
||||
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
|
||||
'$seen' => $rr['mailseen'],
|
||||
'$count' => DI::l10n()->tt('%d message', '%d messages', $rr['count']),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ function notes_init(App $a)
|
|||
}
|
||||
|
||||
|
||||
function notes_content(App $a, $update = false)
|
||||
function notes_content(App $a, bool $update = false)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
|
@ -60,7 +60,7 @@ function notes_content(App $a, $update = false)
|
|||
$o .= DI::conversation()->statusEditor($x, $a->getContactId());
|
||||
}
|
||||
|
||||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
||||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => Item::GRAVITY_PARENT,
|
||||
'contact-id'=> $a->getContactId()];
|
||||
|
||||
if (DI::mode()->isMobile()) {
|
||||
|
|
|
@ -93,8 +93,8 @@ function oexchange_init(App $a)
|
|||
System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/xrd+xml');
|
||||
}
|
||||
|
||||
function oexchange_content(App $a) {
|
||||
|
||||
function oexchange_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
$o = Login::form();
|
||||
return $o;
|
||||
|
@ -109,7 +109,7 @@ function oexchange_content(App $a) {
|
|||
$description = !empty($_REQUEST['description']) ? trim($_REQUEST['description']) : '';
|
||||
$tags = !empty($_REQUEST['tags']) ? trim($_REQUEST['tags']) : '';
|
||||
|
||||
$s = \Friendica\Content\Text\BBCode::embedURL($url, true, $title, $description, $tags);
|
||||
$s = BBCode::embedURL($url, true, $title, $description, $tags);
|
||||
|
||||
if (!strlen($s)) {
|
||||
return;
|
||||
|
@ -119,9 +119,9 @@ function oexchange_content(App $a) {
|
|||
|
||||
$post['profile_uid'] = local_user();
|
||||
$post['return'] = '/oexchange/done';
|
||||
$post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
|
||||
$post['body'] = HTML::toBBCode($s);
|
||||
|
||||
$_REQUEST = $post;
|
||||
require_once('mod/item.php');
|
||||
require_once 'mod/item.php';
|
||||
item_post($a);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
function ostatus_subscribe_content(App $a)
|
||||
function ostatus_subscribe_content(App $a): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
|
@ -42,7 +42,6 @@ function ostatus_subscribe_content(App $a)
|
|||
$counter = intval($_REQUEST['counter'] ?? 0);
|
||||
|
||||
if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') {
|
||||
|
||||
if ($_REQUEST['url'] == '') {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('No contact provided.');
|
||||
|
|
|
@ -55,8 +55,8 @@ use Friendica\Util\Temporal;
|
|||
use Friendica\Util\XML;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
function photos_init(App $a) {
|
||||
|
||||
function photos_init(App $a)
|
||||
{
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -526,44 +526,40 @@ function photos_post(App $a)
|
|||
foreach ($taginfo as $tagged) {
|
||||
$uri = Item::newURI();
|
||||
|
||||
$arr = [];
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['wall'] = 1;
|
||||
$arr['contact-id'] = $owner_record['id'];
|
||||
$arr['owner-name'] = $owner_record['name'];
|
||||
$arr['owner-link'] = $owner_record['url'];
|
||||
$arr['owner-avatar'] = $owner_record['thumb'];
|
||||
$arr['author-name'] = $owner_record['name'];
|
||||
$arr['author-link'] = $owner_record['url'];
|
||||
$arr['author-avatar'] = $owner_record['thumb'];
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $photo['allow_cid'];
|
||||
$arr['allow_gid'] = $photo['allow_gid'];
|
||||
$arr['deny_cid'] = $photo['deny_cid'];
|
||||
$arr['deny_gid'] = $photo['deny_gid'];
|
||||
$arr['visible'] = 0;
|
||||
$arr['verb'] = Activity::TAG;
|
||||
$arr['gravity'] = GRAVITY_PARENT;
|
||||
$arr['object-type'] = Activity\ObjectType::PERSON;
|
||||
$arr['target-type'] = Activity\ObjectType::IMAGE;
|
||||
$arr['inform'] = $tagged[2];
|
||||
$arr['origin'] = 1;
|
||||
$arr['body'] = DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
|
||||
$arr['body'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
|
||||
$arr = [
|
||||
'guid' => System::createUUID(),
|
||||
'uid' => $page_owner_uid,
|
||||
'uri' => $uri,
|
||||
'wall' => 1,
|
||||
'contact-id' => $owner_record['id'],
|
||||
'owner-name' => $owner_record['name'],
|
||||
'owner-link' => $owner_record['url'],
|
||||
'owner-avatar' => $owner_record['thumb'],
|
||||
'author-name' => $owner_record['name'],
|
||||
'author-link' => $owner_record['url'],
|
||||
'author-avatar' => $owner_record['thumb'],
|
||||
'title' => '',
|
||||
'allow_cid' => $photo['allow_cid'],
|
||||
'allow_gid' => $photo['allow_gid'],
|
||||
'deny_cid' => $photo['deny_cid'],
|
||||
'deny_gid' => $photo['deny_gid'],
|
||||
'visible' => 0,
|
||||
'verb' => Activity::TAG,
|
||||
'gravity' => Item::GRAVITY_PARENT,
|
||||
'object-type' => Activity\ObjectType::PERSON,
|
||||
'target-type' => Activity\ObjectType::IMAGE,
|
||||
'inform' => $tagged[2],
|
||||
'origin' => 1,
|
||||
'body' => DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') . "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n",
|
||||
'object' => '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"),
|
||||
'target' => '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>',
|
||||
];
|
||||
|
||||
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
|
||||
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
|
||||
if ($tagged[3]) {
|
||||
$arr['object'] .= XML::escape('<link rel="photo" type="' . $photo['type'] . '" href="' . $tagged[3]['photo'] . '" />' . "\n");
|
||||
}
|
||||
$arr['object'] .= '</link></object>' . "\n";
|
||||
|
||||
$arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
|
||||
. DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
|
||||
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
|
||||
|
||||
Item::insert($arr);
|
||||
}
|
||||
}
|
||||
|
@ -1233,7 +1229,7 @@ function photos_content(App $a)
|
|||
$link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
|
||||
|
||||
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
||||
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], GRAVITY_COMMENT];
|
||||
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], Item::GRAVITY_COMMENT];
|
||||
$total = Post::count($condition);
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
@ -1404,7 +1400,7 @@ function photos_content(App $a)
|
|||
|
||||
if (($activity->match($item['verb'], Activity::LIKE) ||
|
||||
$activity->match($item['verb'], Activity::DISLIKE)) &&
|
||||
($item['gravity'] != GRAVITY_PARENT)) {
|
||||
($item['gravity'] != Item::GRAVITY_PARENT)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1421,25 +1417,25 @@ function photos_content(App $a)
|
|||
$drop = [
|
||||
'dropping' => $dropping,
|
||||
'pagedrop' => false,
|
||||
'select' => DI::l10n()->t('Select'),
|
||||
'delete' => DI::l10n()->t('Delete'),
|
||||
'select' => DI::l10n()->t('Select'),
|
||||
'delete' => DI::l10n()->t('Delete'),
|
||||
];
|
||||
|
||||
$title_e = $item['title'];
|
||||
$body_e = BBCode::convertForUriId($item['uri-id'], $item['body']);
|
||||
|
||||
$comments .= Renderer::replaceMacros($template,[
|
||||
'$id' => $item['id'],
|
||||
'$id' => $item['id'],
|
||||
'$profile_url' => $profile_url,
|
||||
'$name' => $item['author-name'],
|
||||
'$thumb' => $item['author-avatar'],
|
||||
'$sparkle' => $sparkle,
|
||||
'$title' => $title_e,
|
||||
'$body' => $body_e,
|
||||
'$ago' => Temporal::getRelativeDate($item['created']),
|
||||
'$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''),
|
||||
'$drop' => $drop,
|
||||
'$comment' => $comment
|
||||
'$name' => $item['author-name'],
|
||||
'$thumb' => $item['author-avatar'],
|
||||
'$sparkle' => $sparkle,
|
||||
'$title' => $title_e,
|
||||
'$body' => $body_e,
|
||||
'$ago' => Temporal::getRelativeDate($item['created']),
|
||||
'$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''),
|
||||
'$drop' => $drop,
|
||||
'$comment' => $comment
|
||||
]);
|
||||
|
||||
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
|
||||
|
|
|
@ -123,7 +123,7 @@ EOT;
|
|||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
$arr['wall'] = $item['wall'];
|
||||
$arr['gravity'] = GRAVITY_COMMENT;
|
||||
$arr['gravity'] = Item::GRAVITY_COMMENT;
|
||||
$arr['parent'] = $item['id'];
|
||||
$arr['thr-parent'] = $item['uri'];
|
||||
$arr['owner-name'] = $item['author-name'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue