Remove references to deprecated profile.is-default and profile.profile-name fields
This commit is contained in:
parent
d9f7556b4a
commit
18cfd8dfaa
16 changed files with 28 additions and 46 deletions
2
boot.php
2
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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 [];
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue