]> git.mxchange.org Git - friendica.git/commitdiff
Remove references to deprecated profile.is-default and profile.profile-name fields
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 23 Jan 2020 00:34:15 +0000 (19:34 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 23 Jan 2020 00:42:37 +0000 (19:42 -0500)
16 files changed:
boot.php
mod/display.php
mod/msearch.php
mod/poco.php
mod/regmod.php
mod/settings.php
src/Model/Contact.php
src/Model/Profile.php
src/Model/User.php
src/Module/Settings/Profile/Index.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php
src/Worker/Directory.php
view/theme/vier/theme.php

index 4e1249e197ce14bfb2d2f6bc58c3a43ea9ecafdc..2bcbb4ebdd8eb745e8b3c3f622787a8750247831 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -355,7 +355,7 @@ function feed_birthday($uid, $tz)
                $tz = 'UTC';
        }
 
-       $profile = DBA::selectFirst('profile', ['dob'], ['is-default' => true, 'uid' => $uid]);
+       $profile = DBA::selectFirst('profile', ['dob'], ['uid' => $uid]);
        if (DBA::isResult($profile)) {
                $tmp_dob = substr($profile['dob'], 5);
                if (intval($tmp_dob)) {
index b5edafc5f93f84db4a20fa61125df4853ab229b3..8be5520138199719fd682c996808608c8dd9f041 100644 (file)
@@ -102,7 +102,7 @@ function display_init(App $a)
                if ($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 `profile`.`is-default` AND `contact`.`self` LIMIT 1",
+                               WHERE `user`.`nickname` = ? AND `contact`.`self` LIMIT 1",
                                $nickname
                        );
                        if (DBA::isResult($profile)) {
index 67b8ea6fd59e63760fad9ae02238abc0e0aa82c5..95847760023d29f989f03f3afab0b246d445a2c5 100644 (file)
@@ -26,8 +26,7 @@ function msearch_post(App $a)
                "SELECT COUNT(*) AS `total`
                        FROM `profile`
                        JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                       WHERE `is-default` = 1
-                       AND `user`.`hidewall` = 0
+                       WHERE `user`.`hidewall` = 0
                        AND MATCH(`pub_keywords`) AGAINST (?)",
                $search
        );
@@ -42,8 +41,7 @@ function msearch_post(App $a)
                "SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid`
                        FROM `user`
                        JOIN `profile` ON `user`.`uid` = `profile`.`uid`
-                       WHERE `is-default` = 1
-                       AND `user`.`hidewall` = 0
+                       WHERE `user`.`hidewall` = 0
                        AND MATCH(`pub_keywords`) AGAINST (?)
                        LIMIT ?, ?",
                $search,
index 8e7d63418afba2271c32b294fa15a2cef2240277..d8941e51ade5c6de1caa52d71197d6693bc06c8e 100644 (file)
@@ -67,7 +67,7 @@ function poco_init(App $a) {
 
        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' and `profile`.`is-default` = 1 limit 1",
+                       where `user`.`nickname` = '%s' limit 1",
                        DBA::escape($nickname)
                );
                if (! DBA::isResult($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
@@ -140,7 +140,7 @@ function poco_init(App $a) {
                                `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
                        FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
                                INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
-                       WHERE `self` = 1 AND `profile`.`is-default`
+                       WHERE `self` = 1
                        AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
                        intval($startIndex),
                        intval($itemsPerPage)
index a3039b79845d88e2d4561f9a3e4a7be2c2673977..ed030723d3114eb8fc5016daed6085cb4e17a169 100644 (file)
@@ -27,7 +27,7 @@ function user_allow($hash)
 
        DBA::update('user', ['blocked' => false, 'verified' => true], ['uid' => $register['uid']]);
 
-       $profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
+       $profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid']]);
 
        if (DBA::isResult($profile) && $profile['net-publish'] && DI::config()->get('system', 'directory')) {
                $url = DI::baseUrl() . '/profile/' . $user['nickname'];
index a07ad24ccd1eb67d3abbbbb27ca2a8f4609af912..3ba5dc2b370ab09cbf6d4110035f80f11319ce75 100644 (file)
@@ -611,7 +611,7 @@ function settings_post(App $a)
                `name` = '%s',
                `net-publish` = %d,
                `hide-friends` = %d
-               WHERE `is-default` = 1 AND `uid` = %d",
+               WHERE `uid` = %d",
                intval($publish),
                DBA::escape($username),
                intval($net_publish),
@@ -978,7 +978,7 @@ function settings_content(App $a)
         * ACCOUNT SETTINGS
         */
 
-       $profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
+       $profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
        if (!DBA::isResult($profile)) {
                notice(DI::l10n()->t('Unable to find your profile. Please contact your admin.') . EOL);
                return;
index 08c67f8efadd0f327011839583134cf673d0ea9a..d20872ed64376c8df855c6917430ba0890920057 100644 (file)
@@ -723,7 +723,7 @@ class Contact
 
                $fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region',
                        'country-name', 'gender', 'pub_keywords', 'xmpp', 'net-publish'];
-               $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
+               $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid]);
                if (!DBA::isResult($profile)) {
                        return;
                }
@@ -800,7 +800,7 @@ class Contact
                        // Update the profile
                        $fields = ['photo' => DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix,
                                'thumb' => DI::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix];
-                       DBA::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
+                       DBA::update('profile', $fields, ['uid' => $uid]);
                }
        }
 
index 774f419ee78104c703b97256e26e205f7ae5e63c..86fb1a94cbb22aeb48ecef35492eb423bd4a12fe 100644 (file)
@@ -35,8 +35,7 @@ class Profile
         */
        public static function getByUID($uid)
        {
-               $profile = DBA::selectFirst('profile', [], ['uid' => $uid, 'is-default' => true]);
-               return $profile;
+               return DBA::selectFirst('profile', [], ['uid' => $uid]);
        }
 
        /**
@@ -151,7 +150,7 @@ class Profile
                        }
                }
 
-               $profile = self::getByNickname($nickname, $user['uid'], $profile_id);
+               $profile = self::getByNickname($nickname, $user['uid']);
 
                if (empty($profile) && empty($profiledata)) {
                        Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
@@ -159,17 +158,7 @@ class Profile
                }
 
                if (empty($profile)) {
-                       $profile = ['uid' => 0, 'is-default' => false,'name' => $nickname];
-               }
-
-               // fetch user tags if this isn't the default profile
-
-               if (!$profile['is-default']) {
-                       $condition = ['uid' => $profile['uid'], 'is-default' => true];
-                       $profile_id = DBA::selectFirst('profile', ['pub_keywords'], $condition);
-                       if (DBA::isResult($profile_id)) {
-                               $profile['pub_keywords'] = $profile_id['pub_keywords'];
-                       }
+                       $profile = ['uid' => 0, 'name' => $nickname];
                }
 
                $a->profile = $profile;
@@ -1031,7 +1020,7 @@ class Profile
         */
        public static function searchProfiles($start = 0, $count = 100, $search = null)
        {
-               $publish = (DI::config()->get('system', 'publish_all') ? '' : " AND `publish` = 1 ");
+               $publish = (DI::config()->get('system', 'publish_all') ? '' : "`publish` = 1");
                $total = 0;
 
                if (!empty($search)) {
@@ -1039,7 +1028,7 @@ class Profile
                        $cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total`
                                FROM `profile`
                                LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                               WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
+                               WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
                                AND ((`profile`.`name` LIKE ?) OR
                                (`user`.`nickname` LIKE ?) OR
                                (`profile`.`pdesc` LIKE ?) OR
@@ -1061,7 +1050,7 @@ class Profile
                        $cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total`
                                FROM `profile`
                                LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                               WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed`");
+                               WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed`");
                }
 
                if (DBA::isResult($cnt)) {
@@ -1081,7 +1070,7 @@ class Profile
                        FROM `profile`
                        LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
                        LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
-                       WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self`
+                       WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self`
                        AND ((`profile`.`name` LIKE ?) OR
                                (`user`.`nickname` LIKE ?) OR
                                (`profile`.`pdesc` LIKE ?) OR
@@ -1108,7 +1097,7 @@ class Profile
                        FROM `profile`
                        LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
                        LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
-                       WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self`
+                       WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self`
                        $order LIMIT ?,?",
                                        $start, $count
                                );
index 0e8d11f7339e461d8f52c3222be36a220325eb3e..fd7238819d23ad293d1df1e7114ca90c0287889d 100644 (file)
@@ -782,9 +782,7 @@ class User
                        'photo' => DI::baseUrl() . "/photo/profile/{$uid}.jpg",
                        'thumb' => DI::baseUrl() . "/photo/avatar/{$uid}.jpg",
                        'publish' => $publish,
-                       'is-default' => 1,
                        'net-publish' => $netpublish,
-                       'profile-name' => DI::l10n()->t('default')
                ]);
                if (!$insert_result) {
                        DBA::delete('user', ['uid' => $uid]);
@@ -1113,7 +1111,7 @@ class User
 
                $userStmt = DBA::p("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
                        FROM `user`
-                       INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` AND `profile`.`is-default`
+                       INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`
                        INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
                        WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified`
                                AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
index ea3df3ca2272b4d6e0db44ce3f38f935bcb38082..b0eb194edd8d99e9932f1c4ec0551bd470ef8a6d 100644 (file)
@@ -115,10 +115,7 @@ class Index extends BaseSettingsModule
                                'prv_keywords' => $prv_keywords,
                                'hide-friends' => $hide_friends,
                        ],
-                       [
-                               'uid' => local_user(),
-                               'is-default' => true,
-                       ]
+                       ['uid' => local_user()]
                );
 
                if ($result) {
index c9d39dede7952cf7c02d08cbbadbbf382385c805..23301456a98b178291927b1174f5a066b88822fc 100644 (file)
@@ -224,7 +224,7 @@ class Transmitter
                }
 
                $fields = ['locality', 'region', 'country-name'];
-               $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
+               $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid]);
                if (!DBA::isResult($profile)) {
                        return [];
                }
index f649df558f2690149ddb39a67c5499291d3250ce..424b519063da5385fb0ac06ab6314cbab5ddd134 100644 (file)
@@ -687,7 +687,7 @@ class DFRN
                                `profile`.`pub_keywords`, `profile`.`xmpp`, `profile`.`dob`
                        FROM `profile`
                                INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                               WHERE `profile`.`is-default` AND NOT `user`.`hidewall` AND `user`.`uid` = %d",
+                               WHERE NOT `user`.`hidewall` AND `user`.`uid` = %d",
                        intval($owner['uid'])
                );
                if (DBA::isResult($r)) {
index beb0485c46f2cf9f52ba11fc82fa4cee394164d9..bff56d5af39bbe9864bde864364758432709bdde 100644 (file)
@@ -4092,7 +4092,7 @@ class Diaspora
                        FROM `profile`
                        INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
                        INNER JOIN `contact` ON `profile`.`uid` = `contact`.`uid`
-                       WHERE `user`.`uid` = %d AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
+                       WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
                        intval($uid)
                );
 
index 225c2ec2b447c5341af3237909c7076bd61c46be..dc30b596fcc2b54098e3dc7e3db1a4dacff18ced 100644 (file)
@@ -1428,7 +1428,7 @@ class OStatus
         */
        private static function addAuthor(DOMDocument $doc, array $owner, $show_profile = true)
        {
-               $profile = DBA::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
+               $profile = DBA::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid']]);
                $author = $doc->createElement("author");
                XML::addElement($doc, $author, "id", $owner["url"]);
                if ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY) {
index 4d5393dd84dcd27717c2f77b25491804b444c443..ac9aeae5b974630e5671706bbd19b6eaa95a9d22 100644 (file)
@@ -46,7 +46,7 @@ class Directory
                $r = q("SELECT `url` FROM `contact`
                        INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
                        INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
-                               WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
+                               WHERE `contact`.`self` AND `profile`.`net-publish` AND
                                        NOT `user`.`account_expired` AND `user`.`verified`");
 
                if (DBA::isResult($r)) {
index 9188bcbc99dbfb41b9b21a27a0f314fb96c48e80..e5d5e1ce971a48a2239298f876c9bb183b3b8e04 100644 (file)
@@ -140,14 +140,14 @@ function vier_community_info()
 
        // last 9 users
        if ($show_lastusers) {
-               $publish = (DI::config()->get('system', 'publish_all') ? '' : " AND `publish` = 1 ");
+               $publish = (DI::config()->get('system', 'publish_all') ? '' : "`publish` = 1");
                $order = " ORDER BY `register_date` DESC ";
 
                $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
 
                $r = q("SELECT `profile`.*, `user`.`nickname`
                                FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
-                               WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
+                               WHERE $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
                        0,
                        9
                );