]> git.mxchange.org Git - friendica.git/commitdiff
And some more view calls added
authorMichael <heluecht@pirati.ca>
Fri, 24 Apr 2020 12:59:19 +0000 (12:59 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 24 Apr 2020 12:59:19 +0000 (12:59 +0000)
mod/display.php
src/Model/Profile.php
static/dbview.config.php

index 107e666d48c06786b713cb112753d187cf080bc3..a06d8a72394fa3cd588e7f9f6346688faffc98ae 100644 (file)
@@ -116,11 +116,7 @@ function display_init(App $a)
                $nickname = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/profile/', '', Strings::normaliseLink($profiledata['url']));
 
                if (!empty($a->user['nickname']) && $nickname != $a->user['nickname']) {
-                       $profile = DBA::fetchFirst("SELECT `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
-                               INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
-                               WHERE `user`.`nickname` = ? AND `contact`.`self` LIMIT 1",
-                               $nickname
-                       );
+                       $profile = DBA::selectFirst('owner-view', [], ['nickname' => $nickname]);
                        if (DBA::isResult($profile)) {
                                $profiledata = $profile;
                        }
index 867a6db4fb6fad2f31ea1a41d65c6a7b9cb8f07d..ec862947ba10116228fb8dc96998e615680d45f7 100644 (file)
@@ -234,19 +234,7 @@ class Profile
         */
        public static function getByNickname($nickname, $uid = 0)
        {
-               $profile = DBA::fetchFirst(
-                       "SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
-                               `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
-                               `profile`.*,
-                               `contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.*
-                       FROM `profile`
-                       INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
-                       INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
-                       WHERE `user`.`nickname` = ? AND `profile`.`uid` = ? LIMIT 1",
-                       $nickname,
-                       intval($uid)
-               );
-
+               $profile = DBA::selectFirst('owner-view', [], ['nickname' => $nickname, 'uid' => $uid]);
                return $profile;
        }
 
@@ -399,9 +387,9 @@ class Profile
                                'fullname' => $profile['name'],
                                'firstname' => $firstname,
                                'lastname' => $lastname,
-                               'photo300' => $profile['contact_photo'] ?? '',
-                               'photo100' => $profile['contact_thumb'] ?? '',
-                               'photo50' => $profile['contact_micro'] ?? '',
+                               'photo300' => $profile['photo'] ?? '',
+                               'photo100' => $profile['thumb'] ?? '',
+                               'photo50' => $profile['micro'] ?? '',
                        ];
                } else {
                        $diaspora = false;
index 0fd4048ca729af95212495454179a178f8f63e4b..06f7d3aa95da4d9fa329aa685e5c763efeef8dc1 100755 (executable)
@@ -103,6 +103,8 @@ return [
                        "name-date" => ["contact", "name-date"],
                        "uri-date" => ["contact", "uri-date"],
                        "avatar-date" => ["contact", "avatar-date"],
+                       "contact_id" => ["contact", "id"], /// @todo Replaces all uses of "contact_id" with "id"
+                       "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
                        "term-date" => ["contact", "term-date"],
                        "last-item" => ["contact", "last-item"],                        
                        "lastitem_date" => ["contact", "last-item"], /// @todo Replaces all uses of "lastitem_date" with "last-item"