- replace usage of deprecated NETWORK_* with Protocol::*
pull/701/head
Roland Häder 2018-08-11 22:40:48 +02:00 committed by Hypolite Petovan
parent 9a48452e09
commit c8371bc521
8 changed files with 55 additions and 47 deletions

View File

@ -13,6 +13,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\ItemContent; use Friendica\Model\ItemContent;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
@ -307,7 +308,7 @@ function buffer_send(App $a, array &$b)
switch ($profile->service) { switch ($profile->service) {
case 'facebook': case 'facebook':
$send = ($b["extid"] != NETWORK_FACEBOOK); $send = ($b["extid"] != Protocol::FACEBOOK);
$limit = 0; $limit = 0;
$markup = false; $markup = false;
$includedlinks = false; $includedlinks = false;
@ -315,7 +316,7 @@ function buffer_send(App $a, array &$b)
break; break;
case 'google': case 'google':
$send = ($b["extid"] != NETWORK_GPLUS); $send = ($b["extid"] != Protocol::GPLUS);
$limit = 0; $limit = 0;
$markup = true; $markup = true;
$includedlinks = false; $includedlinks = false;
@ -323,7 +324,7 @@ function buffer_send(App $a, array &$b)
break; break;
case 'twitter': case 'twitter':
$send = ($b["extid"] != NETWORK_TWITTER); $send = ($b["extid"] != Protocol::TWITTER);
$limit = 280; $limit = 280;
$markup = false; $markup = false;
$includedlinks = true; $includedlinks = true;
@ -331,7 +332,7 @@ function buffer_send(App $a, array &$b)
break; break;
case 'linkedin': case 'linkedin':
$send = ($b["extid"] != NETWORK_LINKEDIN); $send = ($b["extid"] != Protocol::LINKEDIN);
$limit = 700; $limit = 700;
$markup = false; $markup = false;
$includedlinks = true; $includedlinks = true;

View File

@ -14,6 +14,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Queue; use Friendica\Model\Queue;
@ -59,7 +60,7 @@ function diaspora_queue_hook(App $a, &$b) {
$hostname = $a->get_hostname(); $hostname = $a->get_hostname();
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
DBA::escape(NETWORK_DIASPORA2) DBA::escape(Protocol::DIASPORA2)
); );
if (!DBA::isResult($qi)) { if (!DBA::isResult($qi)) {
@ -67,7 +68,7 @@ function diaspora_queue_hook(App $a, &$b) {
} }
foreach ($qi as $x) { foreach ($qi as $x) {
if ($x['network'] !== NETWORK_DIASPORA2) { if ($x['network'] !== Protocol::DIASPORA2) {
continue; continue;
} }
@ -383,7 +384,7 @@ function diaspora_send(App $a, array &$b)
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
Queue::add($a->contact, NETWORK_DIASPORA2, $s); Queue::add($a->contact, Protocol::DIASPORA2, $s);
notice(L10n::t('Diaspora post failed. Queued for retry.').EOL); notice(L10n::t('Diaspora post failed. Queued for retry.').EOL);
} }
} }

View File

@ -13,6 +13,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Object\Image; use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -173,10 +174,10 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
$_REQUEST['profile_uid'] = $uid; $_REQUEST['profile_uid'] = $uid;
$_REQUEST['source'] = $source; $_REQUEST['source'] = $source;
$_REQUEST['extid'] = NETWORK_GPLUS; $_REQUEST['extid'] = Protocol::GPLUS;
if (isset($id)) { if (isset($id)) {
$_REQUEST['message_id'] = Item::newURI($uid, NETWORK_GPLUS.':'.$id); $_REQUEST['message_id'] = Item::newURI($uid, Protocol::GPLUS.':'.$id);
} }
// $_REQUEST['verb'] // $_REQUEST['verb']

View File

@ -14,6 +14,7 @@ use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -181,8 +182,8 @@ function ifttt_message($uid, $item)
if (strstr($item['url'], 'facebook.com')) { if (strstr($item['url'], 'facebook.com')) {
$hash = hash('ripemd128', item['url']); $hash = hash('ripemd128', item['url']);
$_REQUEST['extid'] = NETWORK_FACEBOOK; $_REQUEST['extid'] = Protocol::FACEBOOK;
$_REQUEST['message_id'] = Item::newURI($uid, NETWORK_FACEBOOK . ':' . $hash); $_REQUEST['message_id'] = Item::newURI($uid, Protocol::FACEBOOK . ':' . $hash);
} }
if ($item['type'] == 'link') { if ($item['type'] == 'link') {

View File

@ -67,6 +67,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -594,7 +595,7 @@ function jappixmini_cron(App $a, $d)
// for each user, go through list of contacts // for each user, go through list of contacts
$contacts = q("SELECT * FROM `contact` WHERE `uid`=%d AND ((LENGTH(`dfrn-id`) AND LENGTH(`pubkey`)) OR (LENGTH(`issued-id`) AND LENGTH(`prvkey`))) AND `network` = '%s'", $contacts = q("SELECT * FROM `contact` WHERE `uid`=%d AND ((LENGTH(`dfrn-id`) AND LENGTH(`pubkey`)) OR (LENGTH(`issued-id`) AND LENGTH(`prvkey`))) AND `network` = '%s'",
intval($uid), DBA::escape(NETWORK_DFRN)); intval($uid), DBA::escape(Protocol::DFRN));
foreach ($contacts as $contact_row) { foreach ($contacts as $contact_row) {
$request = $contact_row["request"]; $request = $contact_row["request"];
if (!$request) { if (!$request) {

View File

@ -13,6 +13,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -417,7 +418,7 @@ function pumpio_send(App $a, array &$b)
if ($b['parent'] != $b['id']) { if ($b['parent'] != $b['id']) {
// Looking if its a reply to a pumpio post // Looking if its a reply to a pumpio post
$condition = ['id' => $b['parent'], 'network' => NETWORK_PUMPIO]; $condition = ['id' => $b['parent'], 'network' => Protocol::PUMPIO];
$orig_post = Item::selectFirst([], $condition); $orig_post = Item::selectFirst([], $condition);
if (!DBA::isResult($orig_post)) { if (!DBA::isResult($orig_post)) {
@ -578,7 +579,7 @@ function pumpio_send(App $a, array &$b)
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
Queue::add($a->contact, NETWORK_PUMPIO, $s); Queue::add($a->contact, Protocol::PUMPIO, $s);
notice(L10n::t('Pump.io post failed. Queued for retry.').EOL); notice(L10n::t('Pump.io post failed. Queued for retry.').EOL);
} }
} }
@ -655,7 +656,7 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
$s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]); $s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
Queue::add($a->contact, NETWORK_PUMPIO, $s); Queue::add($a->contact, Protocol::PUMPIO, $s);
notice(L10n::t('Pump.io like failed. Queued for retry.').EOL); notice(L10n::t('Pump.io like failed. Queued for retry.').EOL);
} }
} }
@ -831,7 +832,7 @@ function pumpio_fetchtimeline(App $a, $uid)
$_REQUEST["source"] = "pump.io"; $_REQUEST["source"] = "pump.io";
if (isset($post->object->id)) { if (isset($post->object->id)) {
$_REQUEST['message_id'] = NETWORK_PUMPIO.":".$post->object->id; $_REQUEST['message_id'] = Protocol::PUMPIO.":".$post->object->id;
} }
if ($post->object->displayName != "") { if ($post->object->displayName != "") {
@ -964,7 +965,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
$likedata['gravity'] = GRAVITY_ACTIVITY; $likedata['gravity'] = GRAVITY_ACTIVITY;
$likedata['uid'] = $uid; $likedata['uid'] = $uid;
$likedata['wall'] = 0; $likedata['wall'] = 0;
$likedata['network'] = NETWORK_PUMPIO; $likedata['network'] = Protocol::PUMPIO;
$likedata['uri'] = Item::newURI($uid); $likedata['uri'] = Item::newURI($uid);
$likedata['parent-uri'] = $orig_post["uri"]; $likedata['parent-uri'] = $orig_post["uri"];
$likedata['contact-id'] = $contactid; $likedata['contact-id'] = $contactid;
@ -993,7 +994,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
function pumpio_get_contact($uid, $contact, $no_insert = false) function pumpio_get_contact($uid, $contact, $no_insert = false)
{ {
$gcontact = ["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2, $gcontact = ["url" => $contact->url, "network" => Protocol::PUMPIO, "generation" => 2,
"name" => $contact->displayName, "hide" => true, "name" => $contact->displayName, "hide" => true,
"nick" => $contact->preferredUsername, "nick" => $contact->preferredUsername,
"addr" => str_replace("acct:", "", $contact->id)]; "addr" => str_replace("acct:", "", $contact->id)];
@ -1037,7 +1038,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
DBA::escape($contact->displayName), DBA::escape($contact->displayName),
DBA::escape($contact->preferredUsername), DBA::escape($contact->preferredUsername),
DBA::escape($contact->image->url), DBA::escape($contact->image->url),
DBA::escape(NETWORK_PUMPIO), DBA::escape(Protocol::PUMPIO),
intval(Contact::FRIEND), intval(Contact::FRIEND),
intval(1), intval(1),
DBA::escape($contact->location->displayName), DBA::escape($contact->location->displayName),
@ -1144,7 +1145,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
} }
$postarray = []; $postarray = [];
$postarray['network'] = NETWORK_PUMPIO; $postarray['network'] = Protocol::PUMPIO;
$postarray['uid'] = $uid; $postarray['uid'] = $uid;
$postarray['wall'] = 0; $postarray['wall'] = 0;
$postarray['uri'] = $post->object->id; $postarray['uri'] = $post->object->id;
@ -1310,7 +1311,7 @@ function pumpio_fetchinbox(App $a, $uid)
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
WHERE `thread`.`network` = '%s' AND `thread`.`uid` = %d AND `item`.`extid` != '' WHERE `thread`.`network` = '%s' AND `thread`.`uid` = %d AND `item`.`extid` != ''
ORDER BY `thread`.`commented` DESC LIMIT 10", ORDER BY `thread`.`commented` DESC LIMIT 10",
DBA::escape(NETWORK_PUMPIO), DBA::escape(Protocol::PUMPIO),
intval($uid) intval($uid)
); );
@ -1411,7 +1412,7 @@ function pumpio_getallusers(App &$a, $uid)
function pumpio_queue_hook(App $a, array &$b) function pumpio_queue_hook(App $a, array &$b)
{ {
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
DBA::escape(NETWORK_PUMPIO) DBA::escape(Protocol::PUMPIO)
); );
if (!DBA::isResult($qi)) { if (!DBA::isResult($qi)) {
@ -1419,7 +1420,7 @@ function pumpio_queue_hook(App $a, array &$b)
} }
foreach ($qi as $x) { foreach ($qi as $x) {
if ($x['network'] !== NETWORK_PUMPIO) { if ($x['network'] !== Protocol::PUMPIO) {
continue; continue;
} }
@ -1518,7 +1519,7 @@ function pumpio_getreceiver(App $a, array $b)
$r = q("SELECT `name`, `nick`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `network` = '%s' AND `blocked` = 0 AND `readonly` = 0 LIMIT 1", $r = q("SELECT `name`, `nick`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `network` = '%s' AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
intval($cid), intval($cid),
intval($b["uid"]), intval($b["uid"]),
DBA::escape(NETWORK_PUMPIO) DBA::escape(Protocol::PUMPIO)
); );
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
@ -1536,7 +1537,7 @@ function pumpio_getreceiver(App $a, array $b)
"FROM `group_member`, `contact` WHERE `group_member`.`gid` = %d ". "FROM `group_member`, `contact` WHERE `group_member`.`gid` = %d ".
"AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = '%s'", "AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = '%s'",
intval($gid), intval($gid),
DBA::escape(NETWORK_PUMPIO) DBA::escape(Protocol::PUMPIO)
); );
foreach ($r AS $row) foreach ($r AS $row)
@ -1561,7 +1562,7 @@ function pumpio_getreceiver(App $a, array $b)
$r = q("SELECT `name`, `nick`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `network` = '%s' AND `blocked` = 0 AND `readonly` = 0 LIMIT 1", $r = q("SELECT `name`, `nick`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `network` = '%s' AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
intval($cid), intval($cid),
intval($b["uid"]), intval($b["uid"]),
DBA::escape(NETWORK_PUMPIO) DBA::escape(Protocol::PUMPIO)
); );
if (DBA::isResult($r)) { if (DBA::isResult($r)) {

View File

@ -47,6 +47,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -520,7 +521,7 @@ function statusnet_post_hook(App $a, &$b)
} }
// if posts comes from GNU Social don't send it back // if posts comes from GNU Social don't send it back
if ($b['extid'] == NETWORK_STATUSNET) { if ($b['extid'] == Protocol::STATUSNET) {
return; return;
} }
@ -675,7 +676,7 @@ function statusnet_addon_admin(App $a, &$o)
function statusnet_prepare_body(App $a, &$b) function statusnet_prepare_body(App $a, &$b)
{ {
if ($b["item"]["network"] != NETWORK_STATUSNET) { if ($b["item"]["network"] != Protocol::STATUSNET) {
return; return;
} }
@ -841,10 +842,10 @@ function statusnet_fetchtimeline(App $a, $uid)
$_REQUEST["profile_uid"] = $uid; $_REQUEST["profile_uid"] = $uid;
//$_REQUEST["source"] = "StatusNet"; //$_REQUEST["source"] = "StatusNet";
$_REQUEST["source"] = $post->source; $_REQUEST["source"] = $post->source;
$_REQUEST["extid"] = NETWORK_STATUSNET; $_REQUEST["extid"] = Protocol::STATUSNET;
if (isset($post->id)) { if (isset($post->id)) {
$_REQUEST['message_id'] = Item::newURI($uid, NETWORK_STATUSNET . ":" . $post->id); $_REQUEST['message_id'] = Item::newURI($uid, Protocol::STATUSNET . ":" . $post->id);
} }
//$_REQUEST["date"] = $post->created_at; //$_REQUEST["date"] = $post->created_at;
@ -899,12 +900,12 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
} }
GContact::update(["url" => $contact->statusnet_profile_url, GContact::update(["url" => $contact->statusnet_profile_url,
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url, "network" => Protocol::STATUSNET, "photo" => $contact->profile_image_url,
"name" => $contact->name, "nick" => $contact->screen_name, "name" => $contact->name, "nick" => $contact->screen_name,
"location" => $contact->location, "about" => $contact->description, "location" => $contact->location, "about" => $contact->description,
"addr" => statusnet_address($contact), "generation" => 3]); "addr" => statusnet_address($contact), "generation" => 3]);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), DBA::escape(normalise_link($contact->statusnet_profile_url)), DBA::escape(NETWORK_STATUSNET)); $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), DBA::escape(normalise_link($contact->statusnet_profile_url)), DBA::escape(Protocol::STATUSNET));
if (!DBA::isResult($r) && !$create_user) { if (!DBA::isResult($r) && !$create_user) {
return 0; return 0;
@ -932,7 +933,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
DBA::escape($contact->name), DBA::escape($contact->name),
DBA::escape($contact->screen_name), DBA::escape($contact->screen_name),
DBA::escape($contact->profile_image_url), DBA::escape($contact->profile_image_url),
DBA::escape(NETWORK_STATUSNET), DBA::escape(Protocol::STATUSNET),
intval(Contact::FRIEND), intval(Contact::FRIEND),
intval(1), intval(1),
DBA::escape($contact->location), DBA::escape($contact->location),
@ -943,7 +944,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
$r = q("SELECT * FROM `contact` WHERE `alias` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `alias` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1",
DBA::escape($contact->statusnet_profile_url), DBA::escape($contact->statusnet_profile_url),
intval($uid), intval($uid),
DBA::escape(NETWORK_STATUSNET)); DBA::escape(Protocol::STATUSNET));
if (!DBA::isResult($r)) { if (!DBA::isResult($r)) {
return false; return false;
@ -1065,7 +1066,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
$postarray = []; $postarray = [];
$postarray['network'] = NETWORK_STATUSNET; $postarray['network'] = Protocol::STATUSNET;
$postarray['uid'] = $uid; $postarray['uid'] = $uid;
$postarray['wall'] = 0; $postarray['wall'] = 0;

View File

@ -70,6 +70,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -521,7 +522,7 @@ function twitter_post_hook(App $a, array &$b)
} }
// if post comes from twitter don't send it back // if post comes from twitter don't send it back
if ($b['extid'] == NETWORK_TWITTER) { if ($b['extid'] == Protocol::TWITTER) {
return; return;
} }
@ -628,7 +629,7 @@ function twitter_post_hook(App $a, array &$b)
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
Queue::add($a->contact, NETWORK_TWITTER, $s); Queue::add($a->contact, Protocol::TWITTER, $s);
notice(L10n::t('Twitter post failed. Queued for retry.') . EOL); notice(L10n::t('Twitter post failed. Queued for retry.') . EOL);
} elseif ($iscomment) { } elseif ($iscomment) {
logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']); logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
@ -734,7 +735,7 @@ function twitter_expire(App $a)
return; return;
} }
$r = DBA::select('item', ['id', 'iaid', 'icid'], ['deleted' => true, 'network' => NETWORK_TWITTER]); $r = DBA::select('item', ['id', 'iaid', 'icid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
while ($row = DBA::fetch($r)) { while ($row = DBA::fetch($r)) {
DBA::delete('item', ['id' => $row['id']]); DBA::delete('item', ['id' => $row['id']]);
if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) { if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) {
@ -754,7 +755,7 @@ function twitter_expire(App $a)
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
logger('twitter_expire: user ' . $rr['uid']); logger('twitter_expire: user ' . $rr['uid']);
Item::expire($rr['uid'], $days, NETWORK_TWITTER, true); Item::expire($rr['uid'], $days, Protocol::TWITTER, true);
} }
} }
@ -763,7 +764,7 @@ function twitter_expire(App $a)
function twitter_prepare_body(App $a, array &$b) function twitter_prepare_body(App $a, array &$b)
{ {
if ($b["item"]["network"] != NETWORK_TWITTER) { if ($b["item"]["network"] != Protocol::TWITTER) {
return; return;
} }
@ -812,8 +813,8 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
{ {
$datarray['api_source'] = true; $datarray['api_source'] = true;
$datarray['profile_uid'] = $uid; $datarray['profile_uid'] = $uid;
$datarray['extid'] = NETWORK_TWITTER; $datarray['extid'] = Protocol::TWITTER;
$datarray['message_id'] = Item::newURI($uid, NETWORK_TWITTER . ':' . $post->id); $datarray['message_id'] = Item::newURI($uid, Protocol::TWITTER . ':' . $post->id);
$datarray['protocol'] = Conversation::PARCEL_TWITTER; $datarray['protocol'] = Conversation::PARCEL_TWITTER;
$datarray['source'] = json_encode($post); $datarray['source'] = json_encode($post);
$datarray['title'] = ''; $datarray['title'] = '';
@ -924,14 +925,14 @@ function twitter_fetchtimeline(App $a, $uid)
function twitter_queue_hook(App $a) function twitter_queue_hook(App $a)
{ {
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
DBA::escape(NETWORK_TWITTER) DBA::escape(Protocol::TWITTER)
); );
if (!DBA::isResult($qi)) { if (!DBA::isResult($qi)) {
return; return;
} }
foreach ($qi as $x) { foreach ($qi as $x) {
if ($x['network'] !== NETWORK_TWITTER) { if ($x['network'] !== Protocol::TWITTER) {
continue; continue;
} }
@ -1003,13 +1004,13 @@ function twitter_fetch_contact($uid, $data, $create_user)
$url = "https://twitter.com/" . $data->screen_name; $url = "https://twitter.com/" . $data->screen_name;
$addr = $data->screen_name . "@twitter.com"; $addr = $data->screen_name . "@twitter.com";
GContact::update(["url" => $url, "network" => NETWORK_TWITTER, GContact::update(["url" => $url, "network" => Protocol::TWITTER,
"photo" => $avatar, "hide" => true, "photo" => $avatar, "hide" => true,
"name" => $data->name, "nick" => $data->screen_name, "name" => $data->name, "nick" => $data->screen_name,
"location" => $data->location, "about" => $data->description, "location" => $data->location, "about" => $data->description,
"addr" => $addr, "generation" => 2]); "addr" => $addr, "generation" => 2]);
$fields = ['url' => $url, 'network' => NETWORK_TWITTER, $fields = ['url' => $url, 'network' => Protocol::TWITTER,
'name' => $data->name, 'nick' => $data->screen_name, 'addr' => $addr, 'name' => $data->name, 'nick' => $data->screen_name, 'addr' => $addr,
'location' => $data->location, 'about' => $data->description]; 'location' => $data->location, 'about' => $data->description];
@ -1343,7 +1344,7 @@ function twitter_media_entities($post, array &$postarray)
function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $only_existing_contact, $noquote) function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $only_existing_contact, $noquote)
{ {
$postarray = []; $postarray = [];
$postarray['network'] = NETWORK_TWITTER; $postarray['network'] = Protocol::TWITTER;
$postarray['uid'] = $uid; $postarray['uid'] = $uid;
$postarray['wall'] = 0; $postarray['wall'] = 0;
$postarray['uri'] = "twitter::" . $post->id_str; $postarray['uri'] = "twitter::" . $post->id_str;