]> git.mxchange.org Git - friendica.git/blobdiff - mod/poco.php
More joins replaced by view calls
[friendica.git] / mod / poco.php
index 96607552e0766885cae3255888e20e75f4619f6d..edbe73dceaffe825ceb1bc345f425764e71d8c8d 100644 (file)
@@ -80,16 +80,11 @@ function poco_init(App $a) {
                $cid = intval($a->argv[4]);
        }
 
-       if (! $system_mode && ! $global) {
-               $users = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
-                       where `user`.`nickname` = '%s' limit 1",
-                       DBA::escape($nickname)
-               );
-               if (! DBA::isResult($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
+       if (!$system_mode && !$global) {
+               $user = DBA::selectFirst('owner-view', ['uid', 'nickname'], ['nickname' => $nickname, 'hide-friends' => false]);
+               if (!DBA::isResult($user)) {
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
-
-               $user = $users[0];
        }
 
        if ($justme) {