Move Contact::Page_* constants to User::PAGE_FLAGS_*
This commit is contained in:
parent
11a4a57bfe
commit
ad9c67663d
23 changed files with 126 additions and 86 deletions
|
@ -1988,11 +1988,11 @@ function admin_page_users(App $a)
|
|||
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||
$_setup_users = function ($e) use ($adminlist) {
|
||||
$page_types = [
|
||||
Contact::PAGE_NORMAL => L10n::t('Normal Account Page'),
|
||||
Contact::PAGE_SOAPBOX => L10n::t('Soapbox Page'),
|
||||
Contact::PAGE_COMMUNITY => L10n::t('Public Forum'),
|
||||
Contact::PAGE_FREELOVE => L10n::t('Automatic Friend Page'),
|
||||
Contact::PAGE_PRVGROUP => L10n::t('Private Forum')
|
||||
User::PAGE_FLAGS_NORMAL => L10n::t('Normal Account Page'),
|
||||
User::PAGE_FLAGS_SOAPBOX => L10n::t('Soapbox Page'),
|
||||
User::PAGE_FLAGS_COMMUNITY => L10n::t('Public Forum'),
|
||||
User::PAGE_FLAGS_FREELOVE => L10n::t('Automatic Friend Page'),
|
||||
User::PAGE_FLAGS_PRVGROUP => L10n::t('Private Forum')
|
||||
];
|
||||
$account_types = [
|
||||
Contact::ACCOUNT_TYPE_PERSON => L10n::t('Personal Page'),
|
||||
|
|
|
@ -202,11 +202,11 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$params['duplex'] = 1;
|
||||
}
|
||||
|
||||
if ($user['page-flags'] == Contact::PAGE_COMMUNITY) {
|
||||
if ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
$params['page'] = 1;
|
||||
}
|
||||
|
||||
if ($user['page-flags'] == Contact::PAGE_PRVGROUP) {
|
||||
if ($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
|
||||
$params['page'] = 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ function dfrn_notify_content(App $a) {
|
|||
$rino = $rino_remote;
|
||||
}
|
||||
|
||||
if (($importer['rel'] && ($importer['rel'] != Contact::SHARING)) || ($importer['page-flags'] == Contact::PAGE_COMMUNITY)) {
|
||||
if (($importer['rel'] && ($importer['rel'] != Contact::SHARING)) || ($importer['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {
|
||||
$perm = 'rw';
|
||||
} else {
|
||||
$perm = 'r';
|
||||
|
|
|
@ -544,7 +544,7 @@ function dfrn_request_content(App $a)
|
|||
$auto_confirm = false;
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
if ($r[0]['page-flags'] != Contact::PAGE_NORMAL && $r[0]['page-flags'] != Contact::PAGE_PRVGROUP) {
|
||||
if ($r[0]['page-flags'] != User::PAGE_FLAGS_NORMAL && $r[0]['page-flags'] != User::PAGE_FLAGS_PRVGROUP) {
|
||||
$auto_confirm = true;
|
||||
}
|
||||
|
||||
|
@ -572,7 +572,7 @@ function dfrn_request_content(App $a)
|
|||
'node' => $r[0]['nickname'],
|
||||
'dfrn_id' => $r[0]['issued-id'],
|
||||
'intro_id' => $intro[0]['id'],
|
||||
'duplex' => (($r[0]['page-flags'] == Contact::PAGE_FREELOVE) ? 1 : 0),
|
||||
'duplex' => (($r[0]['page-flags'] == User::PAGE_FLAGS_FREELOVE) ? 1 : 0),
|
||||
];
|
||||
dfrn_confirm_post($a, $handsfree);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ function dfrn_request_content(App $a)
|
|||
* because nobody is going to read the comments and
|
||||
* it doesn't matter if they know you or not.
|
||||
*/
|
||||
if ($a->profile['page-flags'] == Contact::PAGE_NORMAL) {
|
||||
if ($a->profile['page-flags'] == User::PAGE_FLAGS_NORMAL) {
|
||||
$tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
|
||||
} else {
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
|
|
@ -29,7 +29,7 @@ function hcard_init(App $a)
|
|||
|
||||
Profile::load($a, $which, $profile);
|
||||
|
||||
if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == Contact::PAGE_COMMUNITY)) {
|
||||
if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {
|
||||
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
|
||||
}
|
||||
if (!empty($a->profile['openidserver'])) {
|
||||
|
|
|
@ -153,7 +153,7 @@ function photos_post(App $a)
|
|||
$visitor = 0;
|
||||
|
||||
$page_owner_uid = $a->data['user']['uid'];
|
||||
$community_page = $a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY;
|
||||
$community_page = $a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
|
||||
if (local_user() && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
|
@ -938,7 +938,7 @@ function photos_content(App $a)
|
|||
|
||||
$owner_uid = $a->data['user']['uid'];
|
||||
|
||||
$community_page = (($a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
|
||||
$community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if (local_user() && (local_user() == $owner_uid)) {
|
||||
$can_post = true;
|
||||
|
|
|
@ -62,7 +62,7 @@ function profile_init(App $a)
|
|||
$blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
|
||||
$userblock = !local_user() && !remote_user() && $a->profile['hidewall'];
|
||||
|
||||
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == Contact::PAGE_COMMUNITY) {
|
||||
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ function profile_content(App $a, $update = 0)
|
|||
|
||||
$o .= Widget::commonFriendsVisitor($a->profile['profile_uid']);
|
||||
|
||||
$commpage = $a->profile['page-flags'] == Contact::PAGE_COMMUNITY;
|
||||
$commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
$commvisitor = $commpage && $remote_contact;
|
||||
|
||||
$a->page['aside'] .= posted_date_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'], true);
|
||||
|
@ -256,7 +256,7 @@ function profile_content(App $a, $update = 0)
|
|||
|
||||
// Does the profile page belong to a forum?
|
||||
// If not then we can improve the performance with an additional condition
|
||||
$condition = ['uid' => $a->profile['profile_uid'], 'page-flags' => [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP]];
|
||||
$condition = ['uid' => $a->profile['profile_uid'], 'page-flags' => [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]];
|
||||
if (!DBA::exists('user', $condition)) {
|
||||
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
|
||||
} else {
|
||||
|
|
|
@ -532,7 +532,7 @@ function profiles_content(App $a) {
|
|||
]);
|
||||
|
||||
$personal_account = !(in_array($a->user["page-flags"],
|
||||
[Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP]));
|
||||
[User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]));
|
||||
|
||||
$detailled_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account);
|
||||
|
||||
|
|
|
@ -474,14 +474,14 @@ function settings_post(App $a)
|
|||
}
|
||||
|
||||
// Adjust the page flag if the account type doesn't fit to the page flag.
|
||||
if (($account_type == Contact::ACCOUNT_TYPE_PERSON) && !in_array($page_flags, [Contact::PAGE_NORMAL, Contact::PAGE_SOAPBOX, Contact::PAGE_FREELOVE])) {
|
||||
$page_flags = Contact::PAGE_NORMAL;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, [Contact::PAGE_SOAPBOX])) {
|
||||
$page_flags = Contact::PAGE_SOAPBOX;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_NEWS) && !in_array($page_flags, [Contact::PAGE_SOAPBOX])) {
|
||||
$page_flags = Contact::PAGE_SOAPBOX;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP])) {
|
||||
$page_flags = Contact::PAGE_COMMUNITY;
|
||||
if (($account_type == Contact::ACCOUNT_TYPE_PERSON) && !in_array($page_flags, [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_FREELOVE])) {
|
||||
$page_flags = User::PAGE_FLAGS_NORMAL;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, [User::PAGE_FLAGS_SOAPBOX])) {
|
||||
$page_flags = User::PAGE_FLAGS_SOAPBOX;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_NEWS) && !in_array($page_flags, [User::PAGE_FLAGS_SOAPBOX])) {
|
||||
$page_flags = User::PAGE_FLAGS_SOAPBOX;
|
||||
} elseif (($account_type == Contact::ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
|
||||
$page_flags = User::PAGE_FLAGS_COMMUNITY;
|
||||
}
|
||||
|
||||
$err = '';
|
||||
|
@ -555,7 +555,7 @@ function settings_post(App $a)
|
|||
PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly);
|
||||
PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif);
|
||||
|
||||
if ($page_flags == Contact::PAGE_PRVGROUP) {
|
||||
if ($page_flags == User::PAGE_FLAGS_PRVGROUP) {
|
||||
$hidewall = 1;
|
||||
if (!$str_contact_allow && !$str_group_allow && !$str_contact_deny && !$str_group_deny) {
|
||||
if ($def_gid) {
|
||||
|
@ -1014,7 +1014,7 @@ function settings_content(App $a)
|
|||
|
||||
// Set the account type to "Community" when the page is a community page but the account type doesn't fit
|
||||
// This is only happening on the first visit after the update
|
||||
if (in_array($a->user['page-flags'], [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP]) &&
|
||||
if (in_array($a->user['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]) &&
|
||||
($a->user['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY))
|
||||
$a->user['account-type'] = Contact::ACCOUNT_TYPE_COMMUNITY;
|
||||
|
||||
|
@ -1046,25 +1046,25 @@ function settings_content(App $a)
|
|||
L10n::t('Account for community discussions.'),
|
||||
($a->user['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY)],
|
||||
|
||||
'$page_normal' => ['page-flags', L10n::t('Normal Account Page'), Contact::PAGE_NORMAL,
|
||||
'$page_normal' => ['page-flags', L10n::t('Normal Account Page'), User::PAGE_FLAGS_NORMAL,
|
||||
L10n::t('Account for a regular personal profile that requires manual approval of "Friends" and "Followers".'),
|
||||
($a->user['page-flags'] == Contact::PAGE_NORMAL)],
|
||||
($a->user['page-flags'] == User::PAGE_FLAGS_NORMAL)],
|
||||
|
||||
'$page_soapbox' => ['page-flags', L10n::t('Soapbox Page'), Contact::PAGE_SOAPBOX,
|
||||
'$page_soapbox' => ['page-flags', L10n::t('Soapbox Page'), User::PAGE_FLAGS_SOAPBOX,
|
||||
L10n::t('Account for a public profile that automatically approves contact requests as "Followers".'),
|
||||
($a->user['page-flags'] == Contact::PAGE_SOAPBOX)],
|
||||
($a->user['page-flags'] == User::PAGE_FLAGS_SOAPBOX)],
|
||||
|
||||
'$page_community' => ['page-flags', L10n::t('Public Forum'), Contact::PAGE_COMMUNITY,
|
||||
'$page_community' => ['page-flags', L10n::t('Public Forum'), User::PAGE_FLAGS_COMMUNITY,
|
||||
L10n::t('Automatically approves all contact requests.'),
|
||||
($a->user['page-flags'] == Contact::PAGE_COMMUNITY)],
|
||||
($a->user['page-flags'] == User::PAGE_FLAGS_COMMUNITY)],
|
||||
|
||||
'$page_freelove' => ['page-flags', L10n::t('Automatic Friend Page'), Contact::PAGE_FREELOVE,
|
||||
'$page_freelove' => ['page-flags', L10n::t('Automatic Friend Page'), User::PAGE_FLAGS_FREELOVE,
|
||||
L10n::t('Account for a popular profile that automatically approves contact requests as "Friends".'),
|
||||
($a->user['page-flags'] == Contact::PAGE_FREELOVE)],
|
||||
($a->user['page-flags'] == User::PAGE_FLAGS_FREELOVE)],
|
||||
|
||||
'$page_prvgroup' => ['page-flags', L10n::t('Private Forum [Experimental]'), Contact::PAGE_PRVGROUP,
|
||||
'$page_prvgroup' => ['page-flags', L10n::t('Private Forum [Experimental]'), User::PAGE_FLAGS_PRVGROUP,
|
||||
L10n::t('Requires manual approval of contact requests.'),
|
||||
($a->user['page-flags'] == Contact::PAGE_PRVGROUP)],
|
||||
($a->user['page-flags'] == User::PAGE_FLAGS_PRVGROUP)],
|
||||
|
||||
|
||||
]);
|
||||
|
|
|
@ -178,7 +178,7 @@ function videos_content(App $a)
|
|||
|
||||
$owner_uid = $a->data['user']['uid'];
|
||||
|
||||
$community_page = (($a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
|
||||
$community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if ((local_user()) && (local_user() == $owner_uid)) {
|
||||
$can_post = true;
|
||||
|
|
|
@ -41,7 +41,7 @@ function wall_attach_post(App $a) {
|
|||
|
||||
$page_owner_uid = $r[0]['uid'];
|
||||
$page_owner_cid = $r[0]['id'];
|
||||
$community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
|
||||
$community_page = (($r[0]['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if ((local_user()) && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
|
|
|
@ -69,7 +69,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
$page_owner_uid = $r[0]['uid'];
|
||||
$default_cid = $r[0]['id'];
|
||||
$page_owner_nick = $r[0]['nickname'];
|
||||
$community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
|
||||
$community_page = (($r[0]['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if ((local_user()) && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue