Stopped using deprecated constants NETWORK_* (#5537)

* Rewrite:
- stopped using deprecated NETWORK_* constants, now Protocol::* should be used
- still left them intact for slow/lazy developers ...

* Removed deprecated NETWORK_* constants as per code reviewer's request.
This commit is contained in:
Roland Häder 2018-08-11 22:40:44 +02:00 committed by Hypolite Petovan
parent c623465df2
commit e06fc2aa69
59 changed files with 527 additions and 492 deletions

View file

@ -8,6 +8,7 @@ namespace Friendica\Core;
use Friendica\BaseObject;
use Friendica\Content\Feature;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -46,18 +47,21 @@ class ACL extends BaseObject
switch (defaults($options, 'networks', Protocol::PHANTOM)) {
case 'DFRN_ONLY':
$networks = [NETWORK_DFRN];
$networks = [Protocol::DFRN];
break;
case 'PRIVATE':
$networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA];
$networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA];
break;
case 'TWO_WAY':
if (!empty($a->user['prvnets'])) {
$networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA];
$networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA];
} else {
$networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS];
$networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA, Protocol::OSTATUS];
}
break;
default: /// @TODO Maybe log this call?
break;
}
@ -148,7 +152,7 @@ class ACL extends BaseObject
// When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector
// to one recipient. By default our selector allows multiple selects amongst all contacts.
$sql_extra = sprintf(" AND `rel` = %d ", intval(Contact::FRIEND));
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ", NETWORK_DFRN, NETWORK_DIASPORA);
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ", Protocol::DFRN, Protocol::DIASPORA);
$tabindex_attr = !empty($tabindex) ? ' tabindex="' . intval($tabindex) . '"' : '';

View file

@ -9,6 +9,7 @@ namespace Friendica\Core;
use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
@ -235,7 +236,7 @@ class NotificationsManager extends BaseObject
}
// For feed items we use the user's contact, since the avatar is mostly self choosen.
if (!empty($it['network']) && $it['network'] == NETWORK_FEED) {
if (!empty($it['network']) && $it['network'] == Protocol::FEED) {
$it['author-avatar'] = $it['contact-avatar'];
}
@ -639,14 +640,14 @@ class NotificationsManager extends BaseObject
$it = $this->getMissingIntroData($it);
// Don't show these data until you are connected. Diaspora is doing the same.
if ($it['gnetwork'] === NETWORK_DIASPORA) {
if ($it['gnetwork'] === Protocol::DIASPORA) {
$it['glocation'] = "";
$it['gabout'] = "";
$it['ggender'] = "";
}
$intro = [
'label' => (($it['network'] !== NETWORK_OSTATUS) ? 'friend_request' : 'follower'),
'notify_type' => (($it['network'] !== NETWORK_OSTATUS) ? L10n::t('Friend/Connect Request') : L10n::t('New Follower')),
'label' => (($it['network'] !== Protocol::OSTATUS) ? 'friend_request' : 'follower'),
'notify_type' => (($it['network'] !== Protocol::OSTATUS) ? L10n::t('Friend/Connect Request') : L10n::t('New Follower')),
'dfrn_id' => $it['issued-id'],
'uid' => $_SESSION['uid'],
'intro_id' => $it['intro_id'],

View file

@ -5,6 +5,7 @@
namespace Friendica\Core;
use Friendica\App;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Photo;
use Friendica\Object\Image;
@ -182,12 +183,12 @@ class UserImport
$contact["avatar-date"] = NULL_DATE;
switch ($contact['network']) {
case NETWORK_DFRN:
case NETWORK_DIASPORA:
case Protocol::DFRN:
case Protocol::DIASPORA:
// send relocate message (below)
break;
case NETWORK_FEED:
case NETWORK_MAIL:
case Protocol::FEED:
case Protocol::MAIL:
// Nothing to do
break;
default: