From 7e061e0cae880fa22bfc6c782d5e2cb7519e0297 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 7 Apr 2019 21:18:04 +0200 Subject: [PATCH] replacing direct query with User model call --- src/Model/Photo.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 66b30baef3..52fc8bff1d 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -369,17 +369,11 @@ class Photo extends BaseObject $logger = $a->getLogger(); $profiler = $a->getProfiler(); - $userStmt = DBA::p( - "SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid` - WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1", - intval($uid) - ); + $user = User::getOwnerDataById($uid); - if (!DBA::isResult($userStmt)) { + if (!DBA::isResult($user) || !empty($user['blocked'])) { $logger->info("Can't detect user data.", ['uid' => $uid]); return []; - } else { - $user = DBA::toArray($userStmt); } $page_owner_nick = $user[0]['nickname']; -- 2.39.5