Moved global PAGE_* to Profile class (#5500)

* Rewrites:
- moved PAGE_* to Friendica\Model\Profile class

* Fixed more rewrites from plain (global namespace) PAGE_* to Friendica\Models\Profile class

* CR request:
- moved all PAGE_* constants to Friendica\Model\Contact class
- fixed all references of both classes

* CR request:
- moved ACCOUNT_TYPE_* constants from boot.php to Contact::ACCOUNT_TYPE_*

* Just copy-pasted this code from boot.php, needs to be changed to `const ACCOUNT_TYPE_FOO = x;`

* Ops, melting brain cells here ... :-/
This commit is contained in:
Roland Häder 2018-07-28 01:25:57 +02:00 committed by Hypolite Petovan
parent 5f77e98d76
commit 4a22710b3b
27 changed files with 185 additions and 172 deletions

View file

@ -1299,7 +1299,7 @@ class OStatus
"rel" => "self", "type" => "application/atom+xml"];
XML::addElement($doc, $root, "link", "", $attributes);
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) {
$condition = ['uid' => $owner['uid'], 'self' => false, 'pending' => false,
'archive' => false, 'hidden' => false, 'blocked' => false];
$members = DBA::count('contact', $condition);
@ -1407,7 +1407,7 @@ class OStatus
$profile = DBA::selectFirst('profile', ['homepage', 'publish'], ['uid' => $owner['uid'], 'is-default' => true]);
$author = $doc->createElement("author");
XML::addElement($doc, $author, "id", $owner["url"]);
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) {
XML::addElement($doc, $author, "activity:object-type", ACTIVITY_OBJ_GROUP);
} else {
XML::addElement($doc, $author, "activity:object-type", ACTIVITY_OBJ_PERSON);
@ -1872,7 +1872,7 @@ class OStatus
$entry = $doc->createElement("entry");
$title = sprintf("New note by %s", $owner["nick"]);
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) {
$contact = self::contactEntry($item['author-link'], $owner);
$author = self::addAuthor($doc, $contact, false);
$entry->appendChild($author);
@ -2030,8 +2030,8 @@ class OStatus
foreach ($mentioned as $mention) {
$condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($mention)];
$contact = DBA::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == ACCOUNT_TYPE_COMMUNITY) ||
($contact['self'] && ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY))) {
if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) ||
($contact['self'] && ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY))) {
XML::addElement($doc, $entry, "link", "",
[
"rel" => "mentioned",
@ -2048,7 +2048,7 @@ class OStatus
}
}
if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) {
if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) {
XML::addElement($doc, $entry, "link", "", [
"rel" => "mentioned",
"ostatus:object-type" => "http://activitystrea.ms/schema/1.0/group",
@ -2155,7 +2155,7 @@ class OStatus
$condition[] = ACTIVITY_OBJ_COMMENT;
}
if ($owner['account-type'] != ACCOUNT_TYPE_COMMUNITY) {
if ($owner['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY) {
$condition[0] .= " AND `contact-id` = ? AND `author-id` = ?";
$condition[] = $owner["id"];
$condition[] = $authorid;