mirror of
https://github.com/friendica/friendica
synced 2025-05-09 19:44:10 +02:00
Refactor datetime_convert into Temporal::convert
- Changed parameter order to save space - Refactor select_timezone into Temporal::getTimezoneSelect - Refactor field_timezone into Temporal::getTimezoneField
This commit is contained in:
parent
d478ef6c6d
commit
dc366bf1f7
62 changed files with 512 additions and 432 deletions
|
@ -76,7 +76,7 @@ class Diaspora
|
|||
$r = q(
|
||||
"INSERT INTO `contact` (`uid`, `created`, `name`, `nick`, `addr`, `url`, `nurl`, `batch`, `network`, `rel`, `blocked`, `pending`, `writable`, `name-date`, `uri-date`, `avatar-date`)
|
||||
VALUES (0, '%s', '%s', 'relay', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, '%s', '%s', '%s')",
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
dbesc($addr),
|
||||
dbesc($addr),
|
||||
dbesc($server),
|
||||
|
@ -84,9 +84,9 @@ class Diaspora
|
|||
dbesc($batch),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval(CONTACT_IS_FOLLOWER),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
|
||||
$relais = q("SELECT `batch`, `id`, `name`,`network` FROM `contact` WHERE `uid` = 0 AND `batch` = '%s' LIMIT 1", dbesc($batch));
|
||||
|
@ -870,7 +870,7 @@ class Diaspora
|
|||
dbesc($arr["confirm"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($arr["url"]),
|
||||
dbesc($arr["network"])
|
||||
);
|
||||
|
@ -893,7 +893,7 @@ class Diaspora
|
|||
dbesc($arr["network"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1653,9 +1653,9 @@ class Diaspora
|
|||
$text = unxmlify($data->text);
|
||||
|
||||
if (isset($data->created_at)) {
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
} else {
|
||||
$created_at = datetime_convert();
|
||||
$created_at = Temporal::convert();
|
||||
}
|
||||
|
||||
if (isset($data->thread_parent_guid)) {
|
||||
|
@ -1785,7 +1785,7 @@ class Diaspora
|
|||
$msg_guid = notags(unxmlify($mesg->guid));
|
||||
$msg_conversation_guid = notags(unxmlify($mesg->conversation_guid));
|
||||
$msg_text = unxmlify($mesg->text);
|
||||
$msg_created_at = datetime_convert("UTC", "UTC", notags(unxmlify($mesg->created_at)));
|
||||
$msg_created_at = Temporal::convert(notags(unxmlify($mesg->created_at)));
|
||||
|
||||
if ($msg_conversation_guid != $guid) {
|
||||
logger("message conversation guid does not belong to the current conversation.");
|
||||
|
@ -1830,7 +1830,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => datetime_convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
|
||||
notification(
|
||||
[
|
||||
|
@ -1864,7 +1864,7 @@ class Diaspora
|
|||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$subject = notags(unxmlify($data->subject));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$participants = notags(unxmlify($data->participants));
|
||||
|
||||
$messages = $data->message;
|
||||
|
@ -1896,7 +1896,7 @@ class Diaspora
|
|||
dbesc($guid),
|
||||
dbesc($author),
|
||||
dbesc($created_at),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($subject),
|
||||
dbesc($participants)
|
||||
);
|
||||
|
@ -2097,7 +2097,7 @@ class Diaspora
|
|||
$guid = notags(unxmlify($data->guid));
|
||||
$conversation_guid = notags(unxmlify($data->conversation_guid));
|
||||
$text = unxmlify($data->text);
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
|
||||
$contact = self::allowedContactByHandle($importer, $author, true);
|
||||
if (!$contact) {
|
||||
|
@ -2163,7 +2163,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => datetime_convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2314,7 +2314,7 @@ class Diaspora
|
|||
$birthday = str_replace("1000", "1901", $birthday);
|
||||
|
||||
if ($birthday != "") {
|
||||
$birthday = datetime_convert("UTC", "UTC", $birthday, "Y-m-d");
|
||||
$birthday = Temporal::convert($birthday, "UTC", "UTC", "Y-m-d");
|
||||
}
|
||||
|
||||
// this is to prevent multiple birthday notifications in a single year
|
||||
|
@ -2330,7 +2330,7 @@ class Diaspora
|
|||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($author),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($birthday),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
|
@ -2536,7 +2536,7 @@ class Diaspora
|
|||
intval($importer["uid"]),
|
||||
dbesc($ret["network"]),
|
||||
dbesc($ret["addr"]),
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
dbesc($ret["url"]),
|
||||
dbesc(normalise_link($ret["url"])),
|
||||
dbesc($batch),
|
||||
|
@ -2579,7 +2579,7 @@ class Diaspora
|
|||
0,
|
||||
dbesc(L10n::t("Sharing notification from Diaspora network")),
|
||||
dbesc($hash),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
} else {
|
||||
// automatic friend approval
|
||||
|
@ -2610,8 +2610,8 @@ class Diaspora
|
|||
WHERE `id` = %d
|
||||
",
|
||||
intval($new_relation),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($contact_record["id"])
|
||||
);
|
||||
|
||||
|
@ -2715,7 +2715,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$root_author = notags(unxmlify($data->root_author));
|
||||
$root_guid = notags(unxmlify($data->root_guid));
|
||||
/// @todo handle unprocessed property "provider_display_name"
|
||||
|
@ -2851,8 +2851,8 @@ class Diaspora
|
|||
'deleted' => true,
|
||||
'title' => '',
|
||||
'body' => '',
|
||||
'edited' => datetime_convert(),
|
||||
'changed' => datetime_convert()],
|
||||
'edited' => Temporal::convert(),
|
||||
'changed' => Temporal::convert()],
|
||||
['id' => $item["id"]]
|
||||
);
|
||||
|
||||
|
@ -2929,7 +2929,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$public = notags(unxmlify($data->public));
|
||||
$text = unxmlify($data->text);
|
||||
$provider_display_name = notags(unxmlify($data->provider_display_name));
|
||||
|
@ -3606,10 +3606,10 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($event['start']) {
|
||||
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
||||
$eventdata['start'] = Temporal::convert($event['start'], "UTC", $eventdata['timezone'], $mask);
|
||||
}
|
||||
if ($event['finish'] && !$event['nofinish']) {
|
||||
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
||||
$eventdata['end'] = Temporal::convert($event['finish'], "UTC", $eventdata['timezone'], $mask);
|
||||
}
|
||||
if ($event['summary']) {
|
||||
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
|
||||
|
@ -3651,7 +3651,7 @@ class Diaspora
|
|||
|
||||
$public = (($item["private"]) ? "false" : "true");
|
||||
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
// Detect a share element and do a reshare
|
||||
if (!$item['private'] && ($ret = self::isReshare($item["body"]))) {
|
||||
|
@ -3854,7 +3854,7 @@ class Diaspora
|
|||
$parent = $p[0];
|
||||
|
||||
$text = html_entity_decode(bb2diaspora($item["body"]));
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
$comment = ["author" => self::myHandle($owner),
|
||||
"guid" => $item["guid"],
|
||||
|
@ -4085,12 +4085,12 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", 'Y-m-d\TH:i:s\Z'),
|
||||
"participants" => $cnv["recips"]
|
||||
];
|
||||
|
||||
$body = bb2diaspora($item["body"]);
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
$msg = [
|
||||
"author" => $myaddr,
|
||||
|
@ -4108,7 +4108,7 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", 'Y-m-d\TH:i:s\Z'),
|
||||
"participants" => $cnv["recips"],
|
||||
"message" => $msg];
|
||||
|
||||
|
@ -4216,7 +4216,7 @@ class Diaspora
|
|||
if ($year < 1004) {
|
||||
$year = 1004;
|
||||
}
|
||||
$dob = datetime_convert('UTC', 'UTC', $year . '-' . $month . '-'. $day, 'Y-m-d');
|
||||
$dob = Temporal::convert($year . '-' . $month . '-'. $day, 'UTC', 'UTC', 'Y-m-d');
|
||||
}
|
||||
|
||||
$about = $profile['about'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue