X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItem.php;h=923d72c11bcd37cf7955897553759bc9c93d2d45;hb=23b10cf2ae5fe10ba21a4b43e1aae17818647661;hp=fbbd2eb673731b7bfe75e0c98caf35bd397bd79b;hpb=19c3e55ca88e43d4dee6ba49f4b435034b660ecd;p=friendica.git diff --git a/src/Model/Item.php b/src/Model/Item.php index fbbd2eb673..923d72c11b 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -88,7 +88,7 @@ class Item 'writable', 'self', 'cid', 'alias', 'event-created', 'event-edited', 'event-start', 'event-finish', 'event-summary', 'event-desc', 'event-location', 'event-type', - 'event-nofinish', 'event-adjust', 'event-ignore', 'event-id', + 'event-nofinish', 'event-ignore', 'event-id', 'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed' ]; @@ -103,7 +103,7 @@ class Item 'thr-parent-id', 'parent-uri-id', 'postopts', 'pubmail', 'event-created', 'event-edited', 'event-start', 'event-finish', 'event-summary', 'event-desc', 'event-location', 'event-type', - 'event-nofinish', 'event-adjust', 'event-ignore', 'event-id']; + 'event-nofinish', 'event-ignore', 'event-id']; // All fields in the item table const ITEM_FIELDLIST = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', @@ -366,7 +366,7 @@ class Item public static function guid($item, $notify) { if (!empty($item['guid'])) { - return Strings::escapeTags(trim($item['guid'])); + return trim($item['guid']); } if ($notify) { @@ -448,7 +448,7 @@ class Item // We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates $file = 'item-' . round(microtime(true) * 10000) . '-' . mt_rand() . '.msg'; - $spoolpath = get_spoolpath(); + $spoolpath = System::getSpoolPath(); if ($spoolpath != "") { $spool = $spoolpath . '/' . $file; @@ -971,7 +971,7 @@ class Item } if (!empty($item['cancel'])) { - Logger::log('post cancelled by addon.'); + Logger::notice('post cancelled by addon.'); return 0; } @@ -980,13 +980,14 @@ class Item } // Creates or assigns the permission set - $item['psid'] = PermissionSet::getIdFromACL( - $item['uid'], - $item['allow_cid'], - $item['allow_gid'], - $item['deny_cid'], - $item['deny_gid'] - ); + $item['psid'] = DI::permissionSet()->selectOrCreate( + DI::permissionSetFactory()->createFromString( + $item['uid'], + $item['allow_cid'], + $item['allow_gid'], + $item['deny_cid'], + $item['deny_gid'] + ))->id; if (!empty($item['extid'])) { $item['external-id'] = ItemURI::getIdByURI($item['extid']); @@ -1884,7 +1885,7 @@ class Item foreach ($matches as $mtch) { if (Strings::compareLink($link, $mtch[1]) || Strings::compareLink($dlink, $mtch[1])) { $mention = true; - Logger::log('mention found: ' . $mtch[2]); + Logger::notice('mention found', ['mention' => $mtch[2]]); } } } @@ -1952,18 +1953,19 @@ class Item $private = self::PUBLIC; } - $psid = PermissionSet::getIdFromACL( - $user['uid'], - $user['allow_cid'], - $user['allow_gid'], - $user['deny_cid'], - $user['deny_gid'] - ); + $permissionSet = DI::permissionSet()->selectOrCreate( + DI::permissionSetFactory()->createFromString( + $user['uid'], + $user['allow_cid'], + $user['allow_gid'], + $user['deny_cid'], + $user['deny_gid'] + )); $forum_mode = ($prvgroup ? 2 : 1); $fields = ['wall' => true, 'origin' => true, 'forum_mode' => $forum_mode, 'contact-id' => $self['id'], - 'owner-id' => $owner_id, 'private' => $private, 'psid' => $psid]; + 'owner-id' => $owner_id, 'private' => $private, 'psid' => $permissionSet->id]; self::update($fields, ['id' => $item['id']]); Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', Delivery::POST, (int)$item['uri-id'], (int)$item['uid']); @@ -2303,7 +2305,7 @@ class Item ++$expired; } DBA::close($items); - Logger::log('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos"); + Logger::notice('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos"); } public static function firstPostDate($uid, $wall = false) @@ -2352,7 +2354,7 @@ class Item $item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]); if (!DBA::isResult($item)) { - Logger::log('like: unknown item ' . $item_id); + Logger::notice('like: unknown item', ['id' => $item_id]); return false; } @@ -2549,12 +2551,12 @@ class Item $condition = []; } elseif ($remote_user) { // Authenticated visitor - fetch the matching permissionsets - $set = PermissionSet::get($owner_id, $remote_user); + $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id); if (!empty($set)) { $condition = ["(`private` != ? OR (`private` = ? AND `wall` AND `psid` IN (" . implode(', ', array_fill(0, count($set), '?')) . ")))", self::PRIVATE, self::PRIVATE]; - $condition = array_merge($condition, $set); + $condition = array_merge($condition, $permissionSets->column('id')); } } @@ -2595,10 +2597,10 @@ class Item * If pre-verified, the caller is expected to have already * done this and passed the groups into this function. */ - $set = PermissionSet::get($owner_id, $remote_user); + $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id); if (!empty($set)) { - $sql_set = sprintf(" OR (" . $table . "`private` = %d AND " . $table . "`wall` AND " . $table . "`psid` IN (", self::PRIVATE) . implode(',', $set) . "))"; + $sql_set = sprintf(" OR (" . $table . "`private` = %d AND " . $table . "`wall` AND " . $table . "`psid` IN (", self::PRIVATE) . implode(',', $permissionSets->column('id')) . "))"; } else { $sql_set = ''; }