mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 18:04:26 +02:00
Some more replaced item SQL queries
This commit is contained in:
parent
9f74e96c93
commit
8e24de90ba
3 changed files with 26 additions and 39 deletions
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\ModelItem;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
function viewsrc_install() {
|
||||
Addon::registerHook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
|
||||
|
@ -40,14 +42,12 @@ function viewsrc_item_photo_menu(&$a, &$b)
|
|||
}
|
||||
|
||||
if (local_user() != $b['item']['uid']) {
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `guid` = '%s'",
|
||||
intval(local_user()), dbesc($b['item']['guid']));
|
||||
|
||||
if (!$r) {
|
||||
$item = Item::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
|
||||
if (!DBM::is_result($item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$item_id = $r[0]['id'];
|
||||
$item_id = $item['id'];
|
||||
} else {
|
||||
$item_id = $b['item']['id'];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue