mirror of
https://github.com/friendica/friendica
synced 2025-05-05 22:24:11 +02:00
Use short form array syntax everywhere
- Add short form array syntax to po2php.php generation
This commit is contained in:
parent
77dfbaa0bf
commit
e36f2bb1fb
212 changed files with 5160 additions and 5160 deletions
|
@ -88,7 +88,7 @@ Class Cron {
|
|||
Worker::add(PRIORITY_LOW, "CronJobs", "update_photo_albums");
|
||||
|
||||
// Delete all done workerqueue entries
|
||||
dba::delete('workerqueue', array('`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR'));
|
||||
dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR']);
|
||||
|
||||
// check upstream version?
|
||||
Worker::add(PRIORITY_LOW, 'CheckVersion');
|
||||
|
@ -181,11 +181,11 @@ Class Cron {
|
|||
}
|
||||
|
||||
// Friendica and OStatus are checked once a day
|
||||
if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS))) {
|
||||
if (in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
|
||||
$contact['priority'] = 2;
|
||||
}
|
||||
|
||||
if ($contact['subhub'] && in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS))) {
|
||||
if ($contact['subhub'] && in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
|
||||
/*
|
||||
* We should be getting everything via a hub. But just to be sure, let's check once a day.
|
||||
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
|
||||
|
@ -262,7 +262,7 @@ Class Cron {
|
|||
|
||||
logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
|
||||
|
||||
Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']);
|
||||
Worker::add(['priority' => $priority, 'dont_fork' => true], 'OnePoll', (int)$contact['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class CronJobs
|
|||
$r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $user) {
|
||||
dba::delete('user', array('uid' => $user['uid']));
|
||||
dba::delete('user', ['uid' => $user['uid']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,15 +164,15 @@ class CronJobs
|
|||
if (!$cachetime) {
|
||||
$cachetime = PROXY_DEFAULT_TIME;
|
||||
}
|
||||
$condition = array('`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime);
|
||||
$condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime];
|
||||
dba::delete('photo', $condition);
|
||||
}
|
||||
|
||||
// Delete the cached OEmbed entries that are older than three month
|
||||
dba::delete('oembed', array("`created` < NOW() - INTERVAL 3 MONTH"));
|
||||
dba::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Delete the cached "parse_url" entries that are older than three month
|
||||
dba::delete('parsed_url', array("`created` < NOW() - INTERVAL 3 MONTH"));
|
||||
dba::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Maximum table size in megabyte
|
||||
$max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
|
||||
|
|
|
@ -83,7 +83,7 @@ class DBClean {
|
|||
logger("found global item orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', array('id' => $orphan["id"]));
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
|
||||
} else {
|
||||
|
@ -105,7 +105,7 @@ class DBClean {
|
|||
logger("found item orphans without parents: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', array('id' => $orphan["id"]));
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
|
||||
} else {
|
||||
|
@ -131,7 +131,7 @@ class DBClean {
|
|||
logger("found thread orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["iid"];
|
||||
dba::delete('thread', array('iid' => $orphan["iid"]));
|
||||
dba::delete('thread', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 3, $last_id);
|
||||
} else {
|
||||
|
@ -157,7 +157,7 @@ class DBClean {
|
|||
logger("found notify orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify', array('iid' => $orphan["iid"]));
|
||||
dba::delete('notify', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 4, $last_id);
|
||||
} else {
|
||||
|
@ -183,7 +183,7 @@ class DBClean {
|
|||
logger("found notify-threads orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('notify-threads', array('id' => $orphan["id"]));
|
||||
dba::delete('notify-threads', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 5, $last_id);
|
||||
} else {
|
||||
|
@ -209,7 +209,7 @@ class DBClean {
|
|||
logger("found sign orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('sign', array('iid' => $orphan["iid"]));
|
||||
dba::delete('sign', ['iid' => $orphan["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 6, $last_id);
|
||||
} else {
|
||||
|
@ -235,7 +235,7 @@ class DBClean {
|
|||
logger("found term orphans: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["tid"];
|
||||
dba::delete('term', array('oid' => $orphan["oid"]));
|
||||
dba::delete('term', ['oid' => $orphan["oid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 7, $last_id);
|
||||
} else {
|
||||
|
@ -274,7 +274,7 @@ class DBClean {
|
|||
logger("found expired threads: ".$count);
|
||||
while ($thread = dba::fetch($r)) {
|
||||
$last_id = $thread["iid"];
|
||||
dba::delete('thread', array('iid' => $thread["iid"]));
|
||||
dba::delete('thread', ['iid' => $thread["iid"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 8, $last_id);
|
||||
} else {
|
||||
|
@ -302,7 +302,7 @@ class DBClean {
|
|||
logger("found global item entries from expired threads: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
dba::delete('item', array('id' => $orphan["id"]));
|
||||
dba::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
|
||||
} else {
|
||||
|
@ -324,7 +324,7 @@ class DBClean {
|
|||
logger("found old conversations: ".$count);
|
||||
while ($orphan = dba::fetch($r)) {
|
||||
$last_id = $orphan["received"];
|
||||
dba::delete('conversation', array('item-uri' => $orphan["item-uri"]));
|
||||
dba::delete('conversation', ['item-uri' => $orphan["item-uri"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 10, $last_id);
|
||||
} else {
|
||||
|
|
|
@ -35,8 +35,8 @@ class Delivery {
|
|||
$fsuggest = false;
|
||||
$relocate = false;
|
||||
$top_level = false;
|
||||
$recipients = array();
|
||||
$url_recipients = array();
|
||||
$recipients = [];
|
||||
$url_recipients = [];
|
||||
$followup = false;
|
||||
|
||||
$normal_mode = true;
|
||||
|
@ -108,7 +108,7 @@ class Delivery {
|
|||
}
|
||||
|
||||
$icontacts = null;
|
||||
$contacts_arr = array();
|
||||
$contacts_arr = [];
|
||||
foreach ($items as $item) {
|
||||
if (!in_array($item['contact-id'],$contacts_arr)) {
|
||||
$contacts_arr[] = intval($item['contact-id']);
|
||||
|
@ -238,7 +238,7 @@ class Delivery {
|
|||
} elseif ($relocate) {
|
||||
$atom = DFRN::relocate($owner, $uid);
|
||||
} elseif ($followup) {
|
||||
$msgitems = array();
|
||||
$msgitems = [];
|
||||
foreach ($items as $item) { // there is only one item
|
||||
if (!$item['parent']) {
|
||||
return;
|
||||
|
@ -250,7 +250,7 @@ class Delivery {
|
|||
}
|
||||
$atom = DFRN::entries($msgitems,$owner);
|
||||
} else {
|
||||
$msgitems = array();
|
||||
$msgitems = [];
|
||||
foreach ($items as $item) {
|
||||
if (!$item['parent']) {
|
||||
return;
|
||||
|
|
|
@ -25,7 +25,7 @@ class Directory {
|
|||
|
||||
$dir .= "/submit";
|
||||
|
||||
$arr = array('url' => $url);
|
||||
$arr = ['url' => $url];
|
||||
|
||||
call_hooks('globaldir_update', $arr);
|
||||
|
||||
|
|
|
@ -164,13 +164,13 @@ class DiscoverPoCo {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
|
||||
"identi.ca", "alpha.app.net"))) {
|
||||
$networks = array("www.facebook.com" => NETWORK_FACEBOOK,
|
||||
if (in_array($urlparts["host"], ["www.facebook.com", "facebook.com", "twitter.com",
|
||||
"identi.ca", "alpha.app.net"])) {
|
||||
$networks = ["www.facebook.com" => NETWORK_FACEBOOK,
|
||||
"facebook.com" => NETWORK_FACEBOOK,
|
||||
"twitter.com" => NETWORK_TWITTER,
|
||||
"identi.ca" => NETWORK_PUMPIO,
|
||||
"alpha.app.net" => NETWORK_APPNET);
|
||||
"alpha.app.net" => NETWORK_APPNET];
|
||||
|
||||
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc($networks[$urlparts["host"]]), dbesc(normalise_link($user["url"])));
|
||||
|
|
|
@ -27,7 +27,7 @@ class Expire {
|
|||
// physically remove anything that has been deleted for more than two months
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
|
||||
while ($row = dba::fetch($r)) {
|
||||
dba::delete('item', array('id' => $row['id']));
|
||||
dba::delete('item', ['id' => $row['id']]);
|
||||
}
|
||||
dba::close($r);
|
||||
|
||||
|
@ -58,13 +58,13 @@ class Expire {
|
|||
|
||||
logger('expire: start');
|
||||
|
||||
Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', 'delete');
|
||||
|
||||
$r = dba::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
|
||||
while ($row = dba::fetch($r)) {
|
||||
logger('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG);
|
||||
Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', (int)$row['uid']);
|
||||
}
|
||||
dba::close($r);
|
||||
|
@ -74,7 +74,7 @@ class Expire {
|
|||
if (is_array($a->hooks) && array_key_exists('expire', $a->hooks)) {
|
||||
foreach ($a->hooks['expire'] as $hook) {
|
||||
logger("Calling expire hook for '" . $hook[1] . "'", LOGGER_DEBUG);
|
||||
Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Expire', 'hook', $hook[1]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class GProbe {
|
|||
|
||||
$result = Cache::get("gprobe:".$urlparts["host"]);
|
||||
if (!is_null($result)) {
|
||||
if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
|
||||
if (in_array($result["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
|
||||
logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class GProbe {
|
|||
Cache::set("gprobe:".$urlparts["host"], $arr);
|
||||
}
|
||||
|
||||
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
|
||||
if (!in_array($arr["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
|
||||
GContact::update($arr);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ class Notifier {
|
|||
$fsuggest = false;
|
||||
$relocate = false;
|
||||
$top_level = false;
|
||||
$recipients = array();
|
||||
$url_recipients = array();
|
||||
$recipients = [];
|
||||
$url_recipients = [];
|
||||
|
||||
$normal_mode = true;
|
||||
|
||||
|
@ -284,8 +284,8 @@ class Notifier {
|
|||
$followup = true;
|
||||
$public_message = false; // not public
|
||||
$conversant_str = dbesc($parent['contact-id']);
|
||||
$recipients = array($parent['contact-id']);
|
||||
$recipients_followup = array($parent['contact-id']);
|
||||
$recipients = [$parent['contact-id']];
|
||||
$recipients_followup = [$parent['contact-id']];
|
||||
|
||||
logger('notifier: followup '.$target_item["guid"].' to '.$conversant_str, LOGGER_DEBUG);
|
||||
|
||||
|
@ -349,7 +349,7 @@ class Notifier {
|
|||
Worker::add($a->queue['priority'], 'Notifier', 'uplink', $item_id);
|
||||
}
|
||||
|
||||
$conversants = array();
|
||||
$conversants = [];
|
||||
|
||||
foreach ($items as $item) {
|
||||
$recipients[] = $item['contact-id'];
|
||||
|
@ -484,7 +484,7 @@ class Notifier {
|
|||
}
|
||||
logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
|
||||
|
||||
Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Delivery', $cmd, $item_id, (int)$contact['id']);
|
||||
}
|
||||
}
|
||||
|
@ -507,8 +507,8 @@ class Notifier {
|
|||
|
||||
if ($public_message) {
|
||||
|
||||
$r0 = array();
|
||||
$r1 = array();
|
||||
$r0 = [];
|
||||
$r1 = [];
|
||||
|
||||
if ($diaspora_delivery) {
|
||||
if (!$followup) {
|
||||
|
@ -554,7 +554,7 @@ class Notifier {
|
|||
|
||||
if (!$mail && !$fsuggest && !$followup) {
|
||||
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
|
||||
Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'Delivery', $cmd, $item_id, (int)$rr['id']);
|
||||
}
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ class Notifier {
|
|||
logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
|
||||
|
||||
// Handling the pubsubhubbub requests
|
||||
Worker::add(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'PubSubPublish');
|
||||
}
|
||||
|
||||
|
|
|
@ -75,11 +75,11 @@ Class OnePoll
|
|||
$last_updated = $contact['last-item'];
|
||||
}
|
||||
|
||||
$fields = array('last-item' => $last_updated, 'last-update' => $updated, 'success_update' => $updated);
|
||||
$fields = ['last-item' => $last_updated, 'last-update' => $updated, 'success_update' => $updated];
|
||||
self::updateContact($contact, $fields);
|
||||
Contact::unmarkForArchival($contact);
|
||||
} else {
|
||||
self::updateContact($contact, array('last-update' => $updated, 'failure_update' => $updated));
|
||||
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
|
||||
Contact::markForArchival($contact);
|
||||
logger('Contact '.$contact['id'].' is marked for archival', LOGGER_DEBUG);
|
||||
}
|
||||
|
@ -168,8 +168,8 @@ Class OnePoll
|
|||
// But this may be our first communication, so set the writable flag if it isn't set already.
|
||||
|
||||
if (!intval($contact['writable'])) {
|
||||
$fields = array('writable' => true);
|
||||
dba::update('contact', $fields, array('id' => $contact['id']));
|
||||
$fields = ['writable' => true];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
||||
|
@ -203,7 +203,7 @@ Class OnePoll
|
|||
Contact::markForArchival($contact);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
$fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
return;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ Class OnePoll
|
|||
|
||||
Contact::markForArchival($contact);
|
||||
|
||||
$fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
return;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ Class OnePoll
|
|||
|
||||
// we may not be friends anymore. Will keep trying for one month.
|
||||
// set the last-update so we don't keep polling
|
||||
$fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
|
||||
Contact::markForArchival($contact);
|
||||
|
@ -242,11 +242,11 @@ Class OnePoll
|
|||
}
|
||||
|
||||
if (((float)$res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
||||
$fields = array('poco' => str_replace('/profile/', '/poco/', $contact['url']));
|
||||
dba::update('contact', $fields, array('id' => $contact['id']));
|
||||
$fields = ['poco' => str_replace('/profile/', '/poco/', $contact['url'])];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
$postvars = array();
|
||||
$postvars = [];
|
||||
|
||||
$sent_dfrn_id = hex2bin((string) $res->dfrn_id);
|
||||
$challenge = hex2bin((string) $res->challenge);
|
||||
|
@ -299,8 +299,8 @@ Class OnePoll
|
|||
}
|
||||
|
||||
if ($stat_writeable != $contact['writable']) {
|
||||
$fields = array('writable' => $stat_writeable);
|
||||
dba::update('contact', $fields, array('id' => $contact['id']));
|
||||
$fields = ['writable' => $stat_writeable];
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
// Are we allowed to import from this person?
|
||||
|
@ -312,7 +312,7 @@ Class OnePoll
|
|||
}
|
||||
|
||||
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
|
||||
$ret = z_fetch_url($contact['poll'], false, $redirects, array('cookiejar' => $cookiejar));
|
||||
$ret = z_fetch_url($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
|
||||
unlink($cookiejar);
|
||||
|
||||
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||
|
@ -351,8 +351,8 @@ Class OnePoll
|
|||
unset($password);
|
||||
logger("Mail: Connect to " . $mailconf['user']);
|
||||
if ($mbox) {
|
||||
$fields = array('last_check' => datetime_convert());
|
||||
dba::update('mailacct', $fields, array('id' => $mailconf['id']));
|
||||
$fields = ['last_check' => datetime_convert()];
|
||||
dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
logger("Mail: Connected to " . $mailconf['user']);
|
||||
} else {
|
||||
logger("Mail: Connection error ".$mailconf['user']." ".print_r(imap_errors(), true));
|
||||
|
@ -374,7 +374,7 @@ Class OnePoll
|
|||
foreach ($msgs as $msg_uid => $meta) {
|
||||
logger("Mail: Parsing mail ".$msg_uid, LOGGER_DATA);
|
||||
|
||||
$datarray = array();
|
||||
$datarray = [];
|
||||
$datarray['verb'] = ACTIVITY_POST;
|
||||
$datarray['object-type'] = ACTIVITY_OBJ_NOTE;
|
||||
// $meta = Email::messageMeta($mbox, $msg_uid);
|
||||
|
@ -391,8 +391,8 @@ Class OnePoll
|
|||
// Only delete when mails aren't automatically moved or deleted
|
||||
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
|
||||
if ($meta->deleted && ! $item['deleted']) {
|
||||
$fields = array('deleted' => true, 'changed' => datetime_convert());
|
||||
dba::update('item', $fields, array('id' => $item['id']));
|
||||
$fields = ['deleted' => true, 'changed' => datetime_convert()];
|
||||
dba::update('item', $fields, ['id' => $item['id']]);
|
||||
}
|
||||
|
||||
switch ($mailconf['action']) {
|
||||
|
@ -430,7 +430,7 @@ Class OnePoll
|
|||
$refs_arr = explode(' ', $raw_refs);
|
||||
if (count($refs_arr)) {
|
||||
for ($x = 0; $x < count($refs_arr); $x ++) {
|
||||
$refs_arr[$x] = "'" . Email::msgid2iri(str_replace(array('<', '>', ' '),array('', '', ''),dbesc($refs_arr[$x]))) . "'";
|
||||
$refs_arr[$x] = "'" . Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''],dbesc($refs_arr[$x]))) . "'";
|
||||
}
|
||||
}
|
||||
$qstr = implode(',', $refs_arr);
|
||||
|
@ -532,10 +532,10 @@ Class OnePoll
|
|||
|
||||
$stored_item = item_store($datarray);
|
||||
|
||||
$condition = array('parent-uri' => $datarray['parent-uri'], 'uid' => $importer_uid);
|
||||
dba::update('item', array('last-child' => false), $condition);
|
||||
$condition = ['parent-uri' => $datarray['parent-uri'], 'uid' => $importer_uid];
|
||||
dba::update('item', ['last-child' => false], $condition);
|
||||
|
||||
dba::update('item', array('last-child' => true), array('id' => $stored_item));
|
||||
dba::update('item', ['last-child' => true], ['id' => $stored_item]);
|
||||
|
||||
switch ($mailconf['action']) {
|
||||
case 0:
|
||||
|
@ -573,7 +573,7 @@ Class OnePoll
|
|||
if (!strstr($xml, '<')) {
|
||||
logger('post_handshake: response from ' . $url . ' did not contain XML.');
|
||||
|
||||
$fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
|
@ -619,25 +619,25 @@ Class OnePoll
|
|||
|
||||
$updated = datetime_convert();
|
||||
|
||||
self::updateContact($contact, array('last-update' => $updated, 'success_update' => $updated));
|
||||
dba::update('gcontact', array('last_contact' => $updated), array('nurl' => $contact['nurl']));
|
||||
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
|
||||
dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::unmarkForArchival($contact);
|
||||
} elseif (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED))) {
|
||||
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
|
||||
$updated = datetime_convert();
|
||||
|
||||
self::updateContact($contact, array('last-update' => $updated, 'failure_update' => $updated));
|
||||
dba::update('gcontact', array('last_failure' => $updated), array('nurl' => $contact['nurl']));
|
||||
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
|
||||
dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::markForArchival($contact);
|
||||
} else {
|
||||
$updated = datetime_convert();
|
||||
dba::update('contact', array('last-update' => $updated), array('id' => $contact['id']));
|
||||
dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private static function RemoveReply($subject) {
|
||||
while (in_array(strtolower(substr($subject, 0, 3)), array("re:", "aw:"))) {
|
||||
while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
|
||||
$subject = trim(substr($subject, 4));
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ Class OnePoll
|
|||
* @param array $fields The fields that are updated
|
||||
*/
|
||||
private static function updateContact($contact, $fields) {
|
||||
dba::update('contact', $fields, array('id' => $contact['id']));
|
||||
dba::update('contact', $fields, array('uid' => 0, 'nurl' => $contact['nurl']));
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class PubSubPublish {
|
|||
|
||||
foreach ($r as $rr) {
|
||||
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
|
||||
Worker::add(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true],
|
||||
'PubSubPublish', (int)$rr["id"]);
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ class PubSubPublish {
|
|||
|
||||
$hmac_sig = hash_hmac("sha1", $params, $rr['secret']);
|
||||
|
||||
$headers = array("Content-type: application/atom+xml",
|
||||
$headers = ["Content-type: application/atom+xml",
|
||||
sprintf("Link: <%s>;rel=hub,<%s>;rel=self",
|
||||
System::baseUrl().'/pubsubhubbub/'.$rr['nickname'],
|
||||
$rr['topic']),
|
||||
"X-Hub-Signature: sha1=".$hmac_sig);
|
||||
"X-Hub-Signature: sha1=".$hmac_sig];
|
||||
|
||||
logger('POST '.print_r($headers, true)."\n".$params, LOGGER_DEBUG);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class Queue
|
|||
logger('queue: start');
|
||||
|
||||
// Handling the pubsubhubbub requests
|
||||
Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'PubSubPublish');
|
||||
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'PubSubPublish');
|
||||
|
||||
$r = q(
|
||||
"SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue`
|
||||
|
@ -60,7 +60,7 @@ class Queue
|
|||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $q_item) {
|
||||
logger('Call queue for id ' . $q_item['id']);
|
||||
Worker::add(array('priority' => PRIORITY_LOW, 'dont_fork' => true), "Queue", (int) $q_item['id']);
|
||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "Queue", (int) $q_item['id']);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -158,7 +158,7 @@ class Queue
|
|||
break;
|
||||
|
||||
default:
|
||||
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
|
||||
$params = ['owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false];
|
||||
call_hooks('queue_deliver', $params);
|
||||
|
||||
if ($params['result']) {
|
||||
|
|
|
@ -14,12 +14,12 @@ class RemoveContact {
|
|||
public static function execute($id) {
|
||||
|
||||
// Only delete if the contact doesn't exist (anymore)
|
||||
$r = dba::exists('contact', array('id' => $id));
|
||||
$r = dba::exists('contact', ['id' => $id]);
|
||||
if ($r) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we delete all the depending table entries
|
||||
dba::delete('contact', array('id' => $id));
|
||||
dba::delete('contact', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ class UpdateGContact {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
||||
if (!in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = Probe::uri($r[0]["url"]);
|
||||
|
||||
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
||||
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
|
||||
if ($r[0]["server_url"] != "")
|
||||
PortableContact::checkServer($r[0]["server_url"], $r[0]["network"]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue