mirror of
https://github.com/friendica/friendica
synced 2025-04-29 14:24:22 +02:00
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
|
@ -232,7 +232,7 @@ class Transmitter
|
|||
'vcard:region' => $profile['region'], 'vcard:locality' => $profile['locality']];
|
||||
$data['summary'] = $contact['about'];
|
||||
$data['url'] = $contact['url'];
|
||||
$data['manuallyApprovesFollowers'] = in_array($user['page-flags'], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP]);
|
||||
$data['manuallyApprovesFollowers'] = in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['publicKey'] = ['id' => $contact['url'] . '#main-key',
|
||||
'owner' => $contact['url'],
|
||||
'publicKeyPem' => $user['pubkey']];
|
||||
|
|
|
@ -587,14 +587,14 @@ class DFRN
|
|||
}
|
||||
|
||||
// For backward compatibility we keep this element
|
||||
if ($owner['page-flags'] == Contact::PAGE_COMMUNITY) {
|
||||
if ($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
XML::addElement($doc, $root, "dfrn:community", 1);
|
||||
}
|
||||
|
||||
// The former element is replaced by this one
|
||||
XML::addElement($doc, $root, "dfrn:account_type", $owner["account-type"]);
|
||||
|
||||
/// @todo We need a way to transmit the different page flags like "Contact::PAGE_PRVGROUP"
|
||||
/// @todo We need a way to transmit the different page flags like "User::PAGE_FLAGS_PRVGROUP"
|
||||
|
||||
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
||||
|
||||
|
@ -1264,11 +1264,11 @@ class DFRN
|
|||
$perm = (($res->perm) ? $res->perm : null);
|
||||
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
|
||||
$rino_remote_version = intval($res->rino);
|
||||
$page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0);
|
||||
$page = (($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? 1 : 0);
|
||||
|
||||
Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], Logger::DEBUG);
|
||||
|
||||
if ($owner['page-flags'] == Contact::PAGE_PRVGROUP) {
|
||||
if ($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
|
||||
$page = 2;
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (($contact['duplex'] && strlen($contact['pubkey']))
|
||||
|| ($owner['page-flags'] == Contact::PAGE_COMMUNITY && strlen($contact['pubkey']))
|
||||
|| ($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY && strlen($contact['pubkey']))
|
||||
|| ($contact['rel'] == Contact::SHARING && strlen($contact['pubkey']))
|
||||
) {
|
||||
openssl_public_decrypt($sent_dfrn_id, $final_dfrn_id, $contact['pubkey']);
|
||||
|
@ -1314,7 +1314,7 @@ class DFRN
|
|||
$postvars['dissolve'] = '1';
|
||||
}
|
||||
|
||||
if ((($contact['rel']) && ($contact['rel'] != Contact::SHARING) && (! $contact['blocked'])) || ($owner['page-flags'] == Contact::PAGE_COMMUNITY)) {
|
||||
if ((($contact['rel']) && ($contact['rel'] != Contact::SHARING) && (! $contact['blocked'])) || ($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {
|
||||
$postvars['data'] = $atom;
|
||||
$postvars['perm'] = 'rw';
|
||||
} else {
|
||||
|
@ -1349,7 +1349,7 @@ class DFRN
|
|||
|
||||
if ($dfrn_version >= 2.1) {
|
||||
if (($contact['duplex'] && strlen($contact['pubkey']))
|
||||
|| ($owner['page-flags'] == Contact::PAGE_COMMUNITY && strlen($contact['pubkey']))
|
||||
|| ($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY && strlen($contact['pubkey']))
|
||||
|| ($contact['rel'] == Contact::SHARING && strlen($contact['pubkey']))
|
||||
) {
|
||||
openssl_public_encrypt($key, $postvars['key'], $contact['pubkey']);
|
||||
|
@ -1357,7 +1357,7 @@ class DFRN
|
|||
openssl_private_encrypt($key, $postvars['key'], $contact['prvkey']);
|
||||
}
|
||||
} else {
|
||||
if (($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == Contact::PAGE_COMMUNITY)) {
|
||||
if (($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {
|
||||
openssl_private_encrypt($key, $postvars['key'], $contact['prvkey']);
|
||||
} else {
|
||||
openssl_public_encrypt($key, $postvars['key'], $contact['pubkey']);
|
||||
|
@ -2146,7 +2146,7 @@ class DFRN
|
|||
if ($item["parent-uri"] != $item["uri"]) {
|
||||
$community = false;
|
||||
|
||||
if ($importer["page-flags"] == Contact::PAGE_COMMUNITY || $importer["page-flags"] == Contact::PAGE_PRVGROUP) {
|
||||
if ($importer["page-flags"] == User::PAGE_FLAGS_COMMUNITY || $importer["page-flags"] == User::PAGE_FLAGS_PRVGROUP) {
|
||||
$sql_extra = "";
|
||||
$community = true;
|
||||
Logger::log("possible community action");
|
||||
|
@ -3073,8 +3073,8 @@ class DFRN
|
|||
return false;
|
||||
}
|
||||
|
||||
$community_page = ($user['page-flags'] == Contact::PAGE_COMMUNITY);
|
||||
$prvgroup = ($user['page-flags'] == Contact::PAGE_PRVGROUP);
|
||||
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
|
||||
$prvgroup = ($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP);
|
||||
|
||||
$link = Strings::normaliseLink(System::baseUrl() . '/profile/' . $user['nickname']);
|
||||
|
||||
|
|
|
@ -639,7 +639,7 @@ class Diaspora
|
|||
return false;
|
||||
}
|
||||
|
||||
$importer = ["uid" => 0, "page-flags" => Contact::PAGE_FREELOVE];
|
||||
$importer = ["uid" => 0, "page-flags" => User::PAGE_FLAGS_FREELOVE];
|
||||
$success = self::dispatch($importer, $msg, $fields);
|
||||
|
||||
return $success;
|
||||
|
@ -1123,7 +1123,7 @@ class Diaspora
|
|||
*/
|
||||
// It is deactivated by now, due to side effects. See issue https://github.com/friendica/friendica/pull/4033
|
||||
// It is not removed by now. Possibly the code is needed?
|
||||
//if (!$is_comment && $contact["rel"] == Contact::FOLLOWER && in_array($importer["page-flags"], array(Contact::PAGE_FREELOVE))) {
|
||||
//if (!$is_comment && $contact["rel"] == Contact::FOLLOWER && in_array($importer["page-flags"], array(User::PAGE_FLAGS_FREELOVE))) {
|
||||
// DBA::update(
|
||||
// 'contact',
|
||||
// array('rel' => Contact::FRIEND, 'writable' => true),
|
||||
|
@ -1143,7 +1143,7 @@ class Diaspora
|
|||
// Yes, then it is fine.
|
||||
return true;
|
||||
// Is it a post to a community?
|
||||
} elseif (($contact["rel"] == Contact::FOLLOWER) && in_array($importer["page-flags"], [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP])) {
|
||||
} elseif (($contact["rel"] == Contact::FOLLOWER) && in_array($importer["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
|
||||
// That's good
|
||||
return true;
|
||||
// Is the message a global user or a comment?
|
||||
|
@ -2422,7 +2422,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) {
|
||||
if (!$following && $sharing && in_array($importer["page-flags"], [User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_NORMAL])) {
|
||||
Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", Logger::DEBUG);
|
||||
return false;
|
||||
} elseif (!$following && !$sharing) {
|
||||
|
@ -2480,7 +2480,7 @@ class Diaspora
|
|||
|
||||
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
|
||||
|
||||
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
|
||||
if (in_array($importer["page-flags"], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP])) {
|
||||
Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG);
|
||||
|
||||
$hash = Strings::getRandomHex().(string)time(); // Generate a confirm_key
|
||||
|
@ -2508,9 +2508,9 @@ class Diaspora
|
|||
* but if our page-type is Profile::PAGE_COMMUNITY or Profile::PAGE_SOAPBOX
|
||||
* we are going to change the relationship and make them a follower.
|
||||
*/
|
||||
if (($importer["page-flags"] == Contact::PAGE_FREELOVE) && $sharing && $following) {
|
||||
if (($importer["page-flags"] == User::PAGE_FLAGS_FREELOVE) && $sharing && $following) {
|
||||
$new_relation = Contact::FRIEND;
|
||||
} elseif (($importer["page-flags"] == Contact::PAGE_FREELOVE) && $sharing) {
|
||||
} elseif (($importer["page-flags"] == User::PAGE_FLAGS_FREELOVE) && $sharing) {
|
||||
$new_relation = Contact::SHARING;
|
||||
} else {
|
||||
$new_relation = Contact::FOLLOWER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue