]> git.mxchange.org Git - friendica.git/commitdiff
replacing direct query with User model call
authorPhilipp Holzer <admin@philipp.info>
Sun, 7 Apr 2019 19:18:04 +0000 (21:18 +0200)
committerPhilipp Holzer <admin@philipp.info>
Sun, 7 Apr 2019 19:18:04 +0000 (21:18 +0200)
src/Model/Photo.php

index 66b30baef3c54c17e2b09985b5dd1b85bbb0eab2..52fc8bff1de719f3c1b9b8f79237a19738fd4238 100644 (file)
@@ -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'];