// This function will finally cover most of the preparation functionality in mod/item.php
public static function prepare(&$item)
{
+ /*
+ * @TODO: Unused code triggering inspection errors
+ *
$data = BBCode::getAttachmentData($item['body']);
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
$posttype = Item::PT_PAGE;
$objecttype = ACTIVITY_OBJ_BOOKMARK;
}
+ */
}
public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
{
$orig_item = $item;
+ $priority = PRIORITY_HIGH;
+
// If it is a posting where users should get notifications, then define it as wall posting
if ($notify) {
$item['wall'] = 1;
if (is_int($notify)) {
$priority = $notify;
- } else {
- $priority = PRIORITY_HIGH;
}
} else {
$item['network'] = trim(defaults($item, 'network', Protocol::PHANTOM));
DBA::insert('diaspora-interaction', ['uri-id' => $item['uri-id'], 'interaction' => $diaspora_signed_text], true);
}
- $deleted = self::tagDeliver($item['uid'], $current_post);
+ self::tagDeliver($item['uid'], $current_post);
/*
* current post can be deleted if is for a community page and no mention are
* in it.
*/
- if (!$deleted && !$dontcache) {
+ if (!$dontcache) {
$posted_item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $current_post]);
if (DBA::isResult($posted_item)) {
if ($notify) {
$cmd = 'wall-new';
}
- Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', $cmd, $current_post);
+ Worker::add(['priority' => $priority, 'dont_fork' => true], 'Notifier', $cmd, $current_post);
}
return $current_post;
$condition = ['id' => $itemid, 'uid' => 0,
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""],
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
- $item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
+ $item = self::selectFirst(self::ITEM_FIELDLIST, $condition);
if (!DBA::isResult($item)) {
return;
}
$id = 0;
if ($uid == 0) {
- $uid == local_user();
+ $uid = local_user();
}
// Does the given user have this item?
return;
}
- $community_page = (($user['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
- $prvgroup = (($user['page-flags'] == Contact::PAGE_PRVGROUP) ? true : false);
+ $community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
+ $prvgroup = (($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP) ? true : false);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
if (!DBA::isResult($item)) {
// Contact-id is the uid-dependant author contact
if (local_user() == $uid) {
$item_contact_id = $owner_self_contact['id'];
- $item_contact = $owner_self_contact;
} else {
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
$item["mention"] = 1;
}
- $sql = "";
-
$fields = [];
foreach ($item as $field => $data) {