Add Temporal::utc() shorthand to Temporal::convert()
This commit is contained in:
parent
ca8209a2ce
commit
35d06bd9eb
|
@ -111,7 +111,7 @@ function api_source()
|
|||
function api_date($str)
|
||||
{
|
||||
// Wed May 23 06:01:13 +0000 2007
|
||||
return Temporal::convert($str, 'UTC', 'UTC', "D M d H:i:s +0000 Y");
|
||||
return Temporal::utc($str, "D M d H:i:s +0000 Y");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3207,7 +3207,7 @@ function api_account_rate_limit_status($type)
|
|||
'@attributes' => ["type" => "integer"],
|
||||
'hourly-limit' => '150',
|
||||
'@attributes2' => ["type" => "integer"],
|
||||
'reset-time' => Temporal::convert('now + 1 hour', 'UTC', 'UTC', Temporal::ATOM),
|
||||
'reset-time' => Temporal::utc('now + 1 hour', Temporal::ATOM),
|
||||
'@attributes3' => ["type" => "datetime"],
|
||||
'reset_time_in_seconds' => strtotime('now + 1 hour'),
|
||||
'@attributes4' => ["type" => "integer"],
|
||||
|
@ -3217,7 +3217,7 @@ function api_account_rate_limit_status($type)
|
|||
'reset_time_in_seconds' => strtotime('now + 1 hour'),
|
||||
'remaining_hits' => '150',
|
||||
'hourly_limit' => '150',
|
||||
'reset_time' => api_date(Temporal::convert('now + 1 hour', 'UTC', 'UTC', Temporal::ATOM)),
|
||||
'reset_time' => api_date(Temporal::utc('now + 1 hour', Temporal::ATOM)),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -245,17 +245,17 @@ function format_event_diaspora($ev) {
|
|||
|
||||
// @todo What. Is. Going. On. With. This. Useless. Ternary. Operator? - mrpetovan
|
||||
$o .= L10n::t('Starts:') . ' ' . '['
|
||||
. (($ev['adjust']) ? day_translate(Temporal::convert($ev['start'], 'UTC', 'UTC', $bd_format))
|
||||
: day_translate(Temporal::convert($ev['start'], 'UTC', 'UTC', $bd_format))
|
||||
. (($ev['adjust']) ? day_translate(Temporal::utc($ev['start'], $bd_format))
|
||||
: day_translate(Temporal::convert($ev['start'], $bd_format))
|
||||
)
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::convert($ev['start'])) . ")\n";
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::utc($ev['start'])) . ")\n";
|
||||
|
||||
if (! $ev['nofinish']) {
|
||||
$o .= L10n::t('Finishes:') . ' ' . '['
|
||||
. (($ev['adjust']) ? day_translate(Temporal::convert($ev['finish'], 'UTC', 'UTC', $bd_format))
|
||||
: day_translate(Temporal::convert($ev['finish'], 'UTC', 'UTC', $bd_format))
|
||||
. (($ev['adjust']) ? day_translate(Temporal::utc($ev['finish'], $bd_format))
|
||||
: day_translate(Temporal::utc($ev['finish'], $bd_format))
|
||||
)
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::convert($ev['finish'])) . ")\n";
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::utc($ev['finish'])) . ")\n";
|
||||
}
|
||||
|
||||
if (strlen($ev['location'])) {
|
||||
|
|
|
@ -26,13 +26,17 @@ function format_event_html($ev, $simple = false) {
|
|||
|
||||
$bd_format = L10n::t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM.
|
||||
|
||||
$event_start = (($ev['adjust']) ?
|
||||
day_translate(Temporal::convert($ev['start'], date_default_timezone_get(), 'UTC', $bd_format))
|
||||
: day_translate(Temporal::convert($ev['start'], 'UTC', 'UTC', $bd_format)));
|
||||
$event_start = day_translate(
|
||||
$ev['adjust'] ?
|
||||
Temporal::convert($ev['start'], date_default_timezone_get(), 'UTC', $bd_format)
|
||||
: Temporal::utc($ev['start'], $bd_format)
|
||||
);
|
||||
|
||||
$event_end = (($ev['adjust']) ?
|
||||
day_translate(Temporal::convert($ev['finish'] , date_default_timezone_get(), 'UTC', $bd_format ))
|
||||
: day_translate(Temporal::convert($ev['finish'] , 'UTC', 'UTC', $bd_format )));
|
||||
$event_end = day_translate(
|
||||
$ev['adjust'] ?
|
||||
Temporal::convert($ev['finish'], date_default_timezone_get(), 'UTC', $bd_format)
|
||||
: Temporal::utc($ev['finish'], $bd_format)
|
||||
);
|
||||
|
||||
if ($simple) {
|
||||
$o = "<h3>" . bbcode($ev['summary']) . "</h3>";
|
||||
|
@ -57,13 +61,13 @@ function format_event_html($ev, $simple = false) {
|
|||
$o .= '<div class="summary event-summary">' . bbcode($ev['summary']) . '</div>' . "\r\n";
|
||||
|
||||
$o .= '<div class="event-start"><span class="event-label">' . L10n::t('Starts:') . '</span> <span class="dtstart" title="'
|
||||
. Temporal::convert($ev['start'], 'UTC', 'UTC', (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
|
||||
. Temporal::utc($ev['start'], (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
|
||||
. '" >'.$event_start
|
||||
. '</span></div>' . "\r\n";
|
||||
|
||||
if (! $ev['nofinish']) {
|
||||
$o .= '<div class="event-end" ><span class="event-label">' . L10n::t('Finishes:') . '</span> <span class="dtend" title="'
|
||||
. Temporal::convert($ev['finish'], 'UTC', 'UTC', (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
|
||||
. Temporal::utc($ev['finish'], (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
|
||||
. '" >'.$event_end
|
||||
. '</span></div>' . "\r\n";
|
||||
}
|
||||
|
@ -591,15 +595,15 @@ function process_events($arr) {
|
|||
$fmt = L10n::t('l, F j');
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $rr) {
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
$d = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', $fmt) : Temporal::convert($rr['start'], 'UTC', 'UTC', $fmt));
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::utc($rr['start'], 'j'));
|
||||
$d = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', $fmt) : Temporal::utc($rr['start'], $fmt));
|
||||
$d = day_translate($d);
|
||||
|
||||
$start = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'c') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'c'));
|
||||
$start = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'c') : Temporal::utc($rr['start'], 'c'));
|
||||
if ($rr['nofinish']) {
|
||||
$end = null;
|
||||
} else {
|
||||
$end = (($rr['adjust']) ? Temporal::convert($rr['finish'], date_default_timezone_get(), 'UTC', 'c') : Temporal::convert($rr['finish'], 'UTC', 'UTC', 'c'));
|
||||
$end = (($rr['adjust']) ? Temporal::convert($rr['finish'], date_default_timezone_get(), 'UTC', 'c') : Temporal::utc($rr['finish'], 'c'));
|
||||
}
|
||||
|
||||
$is_first = ($d !== $last_date);
|
||||
|
@ -924,22 +928,48 @@ function format_event_item($item) {
|
|||
$tformat = L10n::t('g:i A'); // 8:01 AM.
|
||||
|
||||
// Convert the time to different formats.
|
||||
$dtstart_dt = (($item['event-adjust']) ? day_translate(Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $dformat)) : day_translate(Temporal::convert($item['event-start'], 'UTC', 'UTC', $dformat)));
|
||||
$dtstart_title = Temporal::convert($item['event-start'], 'UTC', 'UTC', (($item['event-adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s'));
|
||||
$dtstart_dt = day_translate(
|
||||
$item['event-adjust'] ?
|
||||
Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $dformat)
|
||||
: Temporal::utc($item['event-start'], $dformat)
|
||||
);
|
||||
$dtstart_title = Temporal::utc($item['event-start'], $item['event-adjust'] ? Temporal::ATOM : 'Y-m-d\TH:i:s');
|
||||
// Format: Jan till Dec.
|
||||
$month_short = (($item['event-adjust']) ? day_short_translate(Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', 'M')) : day_short_translate(Temporal::convert($item['event-start'], 'UTC', 'UTC', 'M')));
|
||||
$month_short = day_short_translate(
|
||||
$item['event-adjust'] ?
|
||||
Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', 'M')
|
||||
: Temporal::utc($item['event-start'], 'M')
|
||||
);
|
||||
// Format: 1 till 31.
|
||||
$date_short = (($item['event-adjust']) ? Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($item['event-start'], 'UTC', 'UTC', 'j'));
|
||||
$start_time = (($item['event-adjust']) ? Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $tformat) : Temporal::convert($item['event-start'], 'UTC', 'UTC', $tformat));
|
||||
$start_short = (($item['event-adjust']) ? day_short_translate(Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $dformat_short)) : day_short_translate(Temporal::convert($item['event-start'], 'UTC', 'UTC', $dformat_short)));
|
||||
$date_short = $item['event-adjust'] ?
|
||||
Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', 'j')
|
||||
: Temporal::utc($item['event-start'], 'j');
|
||||
$start_time = $item['event-adjust'] ?
|
||||
Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $tformat)
|
||||
: Temporal::utc($item['event-start'], $tformat);
|
||||
$start_short = day_short_translate(
|
||||
$item['event-adjust'] ?
|
||||
Temporal::convert($item['event-start'], date_default_timezone_get(), 'UTC', $dformat_short)
|
||||
: Temporal::utc($item['event-start'], $dformat_short)
|
||||
);
|
||||
|
||||
// If the option 'nofinisch' isn't set, we need to format the finish date/time.
|
||||
if (!$item['event-nofinish']) {
|
||||
$finish = true;
|
||||
$dtend_dt = (($item['event-adjust']) ? day_translate(Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $dformat)) : day_translate(Temporal::convert($item['event-finish'], 'UTC', 'UTC', $dformat)));
|
||||
$dtend_title = Temporal::convert($item['event-finish'], 'UTC', 'UTC', (($item['event-adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s'));
|
||||
$end_short = (($item['event-adjust']) ? day_short_translate(Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $dformat_short)) : day_short_translate(Temporal::convert($item['event-finish'], 'UTC', 'UTC', $dformat_short)));
|
||||
$end_time = (($item['event-adjust']) ? Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $tformat) : Temporal::convert($item['event-finish'], 'UTC', 'UTC', $tformat));
|
||||
$dtend_dt = day_translate(
|
||||
$item['event-adjust'] ?
|
||||
Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $dformat)
|
||||
: Temporal::utc($item['event-finish'], $dformat)
|
||||
);
|
||||
$dtend_title = Temporal::utc($item['event-finish'], $item['event-adjust'] ? Temporal::ATOM : 'Y-m-d\TH:i:s');
|
||||
$end_short = day_short_translate(
|
||||
$item['event-adjust'] ?
|
||||
Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $dformat_short)
|
||||
: Temporal::utc($item['event-finish'], $dformat_short)
|
||||
);
|
||||
$end_time = $item['event-adjust'] ?
|
||||
Temporal::convert($item['event-finish'], date_default_timezone_get(), 'UTC', $tformat)
|
||||
: Temporal::utc($item['event-finish'], $tformat);
|
||||
// Check if start and finish time is at the same day.
|
||||
if (substr($dtstart_title, 0, 10) === substr($dtend_title, 0, 10)) {
|
||||
$same_date = true;
|
||||
|
|
|
@ -437,14 +437,14 @@ function list_post_dates($uid, $wall) {
|
|||
$dyear = intval(substr($dnow, 0, 4));
|
||||
$dstart = substr($dnow, 0, 8) . '01';
|
||||
$dend = substr($dnow, 0, 8) . get_dim(intval($dnow), intval(substr($dnow, 5)));
|
||||
$start_month = Temporal::convert($dstart, 'UTC', 'UTC', 'Y-m-d');
|
||||
$end_month = Temporal::convert($dend, 'UTC', 'UTC', 'Y-m-d');
|
||||
$str = day_translate(Temporal::convert($dnow, 'UTC', 'UTC', 'F'));
|
||||
$start_month = Temporal::utc($dstart, 'Y-m-d');
|
||||
$end_month = Temporal::utc($dend, 'Y-m-d');
|
||||
$str = day_translate(Temporal::utc($dnow, 'F'));
|
||||
if (!$ret[$dyear]) {
|
||||
$ret[$dyear] = [];
|
||||
}
|
||||
$ret[$dyear][] = [$str, $end_month, $start_month];
|
||||
$dnow = Temporal::convert($dnow . ' -1 month', 'UTC', 'UTC', 'Y-m-d');
|
||||
$dnow = Temporal::utc($dnow . ' -1 month', 'Y-m-d');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
@ -203,8 +203,8 @@ function cal_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
$start = Temporal::utc($start);
|
||||
$finish = Temporal::utc($finish);
|
||||
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
@ -231,7 +231,7 @@ function cal_content(App $a)
|
|||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
$j = $rr['adjust'] ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::utc($rr['start'], 'j');
|
||||
if (!x($links, $j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ function dfrn_request_post(App $a)
|
|||
// Block friend request spam
|
||||
if ($maxreq) {
|
||||
$r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
|
||||
dbesc(Temporal::convert('now - 24 hours')),
|
||||
dbesc(Temporal::utc('now - 24 hours')),
|
||||
intval($uid)
|
||||
);
|
||||
if (DBM::is_result($r) && count($r) > $maxreq) {
|
||||
|
|
|
@ -81,9 +81,9 @@ function events_post(App $a) {
|
|||
$finish = Temporal::convert($finish, 'UTC', date_default_timezone_get());
|
||||
}
|
||||
} else {
|
||||
$start = Temporal::convert($start);
|
||||
$start = Temporal::utc($start);
|
||||
if (! $nofinish) {
|
||||
$finish = Temporal::convert($finish);
|
||||
$finish = Temporal::utc($finish);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,8 +323,8 @@ function events_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
$start = Temporal::utc($start);
|
||||
$finish = Temporal::utc($finish);
|
||||
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
@ -351,7 +351,7 @@ function events_content(App $a) {
|
|||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
$j = $rr['adjust'] ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::utc($rr['start'], 'j');
|
||||
if (! x($links,$j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ function lostpass_content(App $a)
|
|||
}
|
||||
|
||||
// Password reset requests expire in 60 minutes
|
||||
if ($user['pwdreset_time'] < Temporal::convert('now - 1 hour')) {
|
||||
if ($user['pwdreset_time'] < Temporal::utc('now - 1 hour')) {
|
||||
$fields = [
|
||||
'pwdreset' => null,
|
||||
'pwdreset_time' => null
|
||||
|
|
|
@ -225,7 +225,7 @@ function ping_init(App $a)
|
|||
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
|
||||
ORDER BY `start` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(Temporal::convert('now + 7 days')),
|
||||
dbesc(Temporal::utc('now + 7 days')),
|
||||
dbesc(Temporal::utcNow())
|
||||
);
|
||||
if (DBM::is_result($ev)) {
|
||||
|
|
|
@ -218,10 +218,11 @@ function profiles_post(App $a) {
|
|||
$ignore_year = true;
|
||||
$dob = substr($dob, 5);
|
||||
}
|
||||
$dob = Temporal::convert((($ignore_year) ? '1900-' . $dob : $dob), 'UTC', 'UTC', (($ignore_year) ? 'm-d' : 'Y-m-d'));
|
||||
|
||||
if ($ignore_year) {
|
||||
$dob = '0000-' . $dob;
|
||||
$dob = '0000-' . Temporal::utc('1900-' . $dob, 'm-d');
|
||||
} else {
|
||||
$dob = Temporal::utc($dob, 'Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,21 +165,21 @@ class Cache
|
|||
if (Config::get("system", "cache_cleared_day") < time() - self::duration(CACHE_DAY)) {
|
||||
if ($max_level == CACHE_MONTH) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 30 days"),
|
||||
Temporal::utc("now - 30 days"),
|
||||
CACHE_MONTH];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
||||
if ($max_level <= CACHE_WEEK) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 7 days"),
|
||||
Temporal::utc("now - 7 days"),
|
||||
CACHE_WEEK];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
||||
if ($max_level <= CACHE_DAY) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 1 days"),
|
||||
Temporal::utc("now - 1 days"),
|
||||
CACHE_DAY];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class Cache
|
|||
|
||||
if (($max_level <= CACHE_HOUR) && (Config::get("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 1 hours"),
|
||||
Temporal::utc("now - 1 hours"),
|
||||
CACHE_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -197,7 +197,7 @@ class Cache
|
|||
|
||||
if (($max_level <= CACHE_HALF_HOUR) && (Config::get("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 30 minutes"),
|
||||
Temporal::utc("now - 30 minutes"),
|
||||
CACHE_HALF_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -206,7 +206,7 @@ class Cache
|
|||
|
||||
if (($max_level <= CACHE_QUARTER_HOUR) && (Config::get("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 15 minutes"),
|
||||
Temporal::utc("now - 15 minutes"),
|
||||
CACHE_QUARTER_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -215,7 +215,7 @@ class Cache
|
|||
|
||||
if (($max_level <= CACHE_FIVE_MINUTES) && (Config::get("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 5 minutes"),
|
||||
Temporal::utc("now - 5 minutes"),
|
||||
CACHE_FIVE_MINUTES];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -224,7 +224,7 @@ class Cache
|
|||
|
||||
if (($max_level <= CACHE_MINUTE) && (Config::get("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
Temporal::convert("now - 1 minutes"),
|
||||
Temporal::utc("now - 1 minutes"),
|
||||
CACHE_MINUTE];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ class Worker
|
|||
|
||||
/// @todo We should clean up the corresponding workerqueue entries as well
|
||||
$condition = ["`created` < ? AND `command` = 'worker.php'",
|
||||
Temporal::convert("now - ".$timeout." minutes")];
|
||||
Temporal::utc("now - ".$timeout." minutes")];
|
||||
dba::delete('process', $condition);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ class Contact extends BaseObject
|
|||
|
||||
/// @todo Check for contact vitality via probing
|
||||
$expiry = $contact['term-date'] . ' + 32 days ';
|
||||
if (Temporal::utcNow() > Temporal::convert($expiry)) {
|
||||
if (Temporal::utcNow() > Temporal::utc($expiry)) {
|
||||
/* Relationship is really truly dead. archive them rather than
|
||||
* delete, though if the owner tries to unarchive them we'll start
|
||||
* the whole process over again.
|
||||
|
@ -688,7 +688,7 @@ class Contact extends BaseObject
|
|||
$contact_id = $contact["id"];
|
||||
|
||||
// Update the contact every 7 days
|
||||
$update_contact = ($contact['avatar-date'] < Temporal::convert('now -7 days'));
|
||||
$update_contact = ($contact['avatar-date'] < Temporal::utc('now -7 days'));
|
||||
|
||||
// We force the update if the avatar is empty
|
||||
if (!x($contact, 'avatar')) {
|
||||
|
@ -1485,7 +1485,7 @@ class Contact extends BaseObject
|
|||
foreach ($r as $rr) {
|
||||
logger('update_contact_birthday: ' . $rr['bd']);
|
||||
|
||||
$nextbd = Temporal::convert('Y') . substr($rr['bd'], 4);
|
||||
$nextbd = Temporal::utcNow('Y') . substr($rr['bd'], 4);
|
||||
|
||||
/*
|
||||
* Add new birthday event for this person
|
||||
|
@ -1497,7 +1497,7 @@ class Contact extends BaseObject
|
|||
|
||||
// Check for duplicates
|
||||
$s = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
|
||||
intval($rr['uid']), intval($rr['id']), dbesc(Temporal::convert($nextbd)), dbesc('birthday'));
|
||||
intval($rr['uid']), intval($rr['id']), dbesc(Temporal::utc($nextbd)), dbesc('birthday'));
|
||||
|
||||
if (DBM::is_result($s)) {
|
||||
continue;
|
||||
|
@ -1508,8 +1508,8 @@ class Contact extends BaseObject
|
|||
|
||||
q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ", intval($rr['uid']), intval($rr['id']),
|
||||
dbesc(Temporal::utcNow()), dbesc(Temporal::utcNow()), dbesc(Temporal::convert($nextbd)),
|
||||
dbesc(Temporal::convert($nextbd . ' + 1 day ')), dbesc($bdtext), dbesc($bdtext2), dbesc('birthday'),
|
||||
dbesc(Temporal::utcNow()), dbesc(Temporal::utcNow()), dbesc(Temporal::utc($nextbd)),
|
||||
dbesc(Temporal::utc($nextbd . ' + 1 day ')), dbesc($bdtext), dbesc($bdtext2), dbesc('birthday'),
|
||||
intval(0)
|
||||
);
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
Temporal::convert('now + 6 days'),
|
||||
Temporal::utc('now + 6 days'),
|
||||
Temporal::utcNow()
|
||||
);
|
||||
if (DBM::is_result($s)) {
|
||||
|
@ -644,8 +644,8 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
Temporal::convert('now + 7 days'),
|
||||
Temporal::convert('now - 1 days')
|
||||
Temporal::utc('now + 7 days'),
|
||||
Temporal::utc('now - 1 days')
|
||||
);
|
||||
|
||||
$r = [];
|
||||
|
@ -729,9 +729,11 @@ class Profile
|
|||
$year_bd_format = L10n::t('j F, Y');
|
||||
$short_bd_format = L10n::t('j F');
|
||||
|
||||
$val = intval($a->profile['dob']) ?
|
||||
day_translate(Temporal::convert($a->profile['dob'] . ' 00:00 +00:00', 'UTC', 'UTC', $year_bd_format))
|
||||
: day_translate(Temporal::convert('2001-' . substr($a->profile['dob'], 'UTC', 'UTC', 5) . ' 00:00 +00:00', $short_bd_format));
|
||||
$val = day_translate(
|
||||
intval($a->profile['dob']) ?
|
||||
Temporal::utc($a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)
|
||||
: Temporal::utc('2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)
|
||||
);
|
||||
|
||||
$profile['birthday'] = [L10n::t('Birthday:'), $val];
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ class Login extends BaseModule
|
|||
if (!x($_SESSION['last_login_date'])) {
|
||||
$_SESSION['last_login_date'] = Temporal::utcNow();
|
||||
}
|
||||
if (strcmp(Temporal::convert('now - 12 hours'), $_SESSION['last_login_date']) > 0) {
|
||||
if (strcmp(Temporal::utc('now - 12 hours'), $_SESSION['last_login_date']) > 0) {
|
||||
$_SESSION['last_login_date'] = Temporal::utcNow();
|
||||
$login_refresh = true;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ class Post extends BaseObject
|
|||
|
||||
$comment = $this->getCommentBox($indent);
|
||||
|
||||
if (strcmp(Temporal::convert($item['created']), Temporal::convert('now - 12 hours')) > 0) {
|
||||
if (strcmp(Temporal::utc($item['created']), Temporal::utc('now - 12 hours')) > 0) {
|
||||
$shiny = 'shiny';
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$check_date = Temporal::convert($last_update);
|
||||
$check_date = Temporal::utc($last_update);
|
||||
|
||||
$r = q(
|
||||
"SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
|
@ -421,7 +421,7 @@ class DFRN
|
|||
|
||||
XML::addElement($doc, $mail, "dfrn:id", $item['uri']);
|
||||
XML::addElement($doc, $mail, "dfrn:in-reply-to", $item['parent-uri']);
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", Temporal::convert($item['created'] . '+00:00', 'UTC', 'UTC', Temporal::ATOM));
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", Temporal::utc($item['created'] . '+00:00', Temporal::ATOM));
|
||||
XML::addElement($doc, $mail, "dfrn:subject", $item['title']);
|
||||
XML::addElement($doc, $mail, "dfrn:content", $item['body']);
|
||||
|
||||
|
@ -587,7 +587,7 @@ class DFRN
|
|||
|
||||
/// @todo We need a way to transmit the different page flags like "PAGE_PRVGROUP"
|
||||
|
||||
XML::addElement($doc, $root, "updated", Temporal::convert("now", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $root, "updated", Temporal::utcNow(Temporal::ATOM));
|
||||
|
||||
$author = self::addAuthor($doc, $owner, $authorelement, $public);
|
||||
$root->appendChild($author);
|
||||
|
@ -622,9 +622,9 @@ class DFRN
|
|||
|
||||
$author = $doc->createElement($authorelement);
|
||||
|
||||
$namdate = Temporal::convert($owner['name-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$uridate = Temporal::convert($owner['uri-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$picdate = Temporal::convert($owner['avatar-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$namdate = Temporal::utc($owner['name-date'].'+00:00', Temporal::ATOM);
|
||||
$uridate = Temporal::utc($owner['uri-date'].'+00:00', Temporal::ATOM);
|
||||
$picdate = Temporal::utc($owner['avatar-date'].'+00:00', Temporal::ATOM);
|
||||
|
||||
$attributes = [];
|
||||
|
||||
|
@ -903,7 +903,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::convert($item['edited'] . '+00:00', 'UTC', 'UTC', Temporal::ATOM)];
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::utc($item['edited'] . '+00:00', Temporal::ATOM)];
|
||||
return XML::createElement($doc, "at:deleted-entry", "", $attributes);
|
||||
}
|
||||
|
||||
|
@ -983,8 +983,8 @@ class DFRN
|
|||
XML::addElement($doc, $entry, "id", $item["uri"]);
|
||||
XML::addElement($doc, $entry, "title", $item["title"]);
|
||||
|
||||
XML::addElement($doc, $entry, "published", Temporal::convert($item["created"] . "+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::convert($item["edited"] . "+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "published", Temporal::utc($item["created"] . "+00:00", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::utc($item["edited"] . "+00:00", Temporal::ATOM));
|
||||
|
||||
// "dfrn:env" is used to read the content
|
||||
XML::addElement($doc, $entry, "dfrn:env", base64url_encode($body, true));
|
||||
|
@ -1388,7 +1388,7 @@ class DFRN
|
|||
"SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
|
||||
intval($contact["uid"]),
|
||||
intval($contact["id"]),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::utc($birthday)),
|
||||
dbesc("birthday")
|
||||
);
|
||||
|
||||
|
@ -1408,8 +1408,8 @@ class DFRN
|
|||
intval($contact["id"]),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::convert($birthday . " + 1 day ")),
|
||||
dbesc(Temporal::utc($birthday)),
|
||||
dbesc(Temporal::utc($birthday . " + 1 day ")),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc("birthday")
|
||||
|
@ -2081,13 +2081,13 @@ class DFRN
|
|||
|
||||
if (self::isEditedTimestampNewer($current, $item)) {
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if (Temporal::convert($item["edited"]) < $current["edited"]) {
|
||||
if (Temporal::utc($item["edited"]) < $current["edited"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = ['title' => $item["title"], 'body' => $item["body"],
|
||||
'tag' => $item["tag"], 'changed' => Temporal::utcNow(),
|
||||
'edited' => Temporal::convert($item["edited"])];
|
||||
'edited' => Temporal::utc($item["edited"])];
|
||||
|
||||
$condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]];
|
||||
dba::update('item', $fields, $condition);
|
||||
|
@ -2422,7 +2422,7 @@ class DFRN
|
|||
|
||||
// Is there an existing item?
|
||||
if (DBM::is_result($current) && self::isEditedTimestampNewer($current[0], $item)
|
||||
&& (Temporal::convert($item["edited"]) < $current[0]["edited"])
|
||||
&& (Temporal::utc($item["edited"]) < $current[0]["edited"])
|
||||
) {
|
||||
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -2753,9 +2753,9 @@ class DFRN
|
|||
}
|
||||
}
|
||||
if ($when) {
|
||||
$when = Temporal::convert($when);
|
||||
$when = Temporal::utc($when);
|
||||
} else {
|
||||
$when = Temporal::convert("now");
|
||||
$when = Temporal::utcNow();
|
||||
}
|
||||
|
||||
if (!$uri || !$importer["id"]) {
|
||||
|
@ -3157,8 +3157,8 @@ class DFRN
|
|||
return false;
|
||||
}
|
||||
|
||||
$existing_edited = Temporal::convert($existing['edited']);
|
||||
$update_edited = Temporal::convert($update['edited']);
|
||||
$existing_edited = Temporal::utc($existing['edited']);
|
||||
$update_edited = Temporal::utc($update['edited']);
|
||||
|
||||
return (strcmp($existing_edited, $update_edited) < 0);
|
||||
}
|
||||
|
|
|
@ -1654,7 +1654,7 @@ class Diaspora
|
|||
$text = unxmlify($data->text);
|
||||
|
||||
if (isset($data->created_at)) {
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::utc(notags(unxmlify($data->created_at)));
|
||||
} else {
|
||||
$created_at = Temporal::utcNow();
|
||||
}
|
||||
|
@ -1786,7 +1786,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 = Temporal::convert(notags(unxmlify($mesg->created_at)));
|
||||
$msg_created_at = Temporal::utc(notags(unxmlify($mesg->created_at)));
|
||||
|
||||
if ($msg_conversation_guid != $guid) {
|
||||
logger("message conversation guid does not belong to the current conversation.");
|
||||
|
@ -1865,7 +1865,7 @@ class Diaspora
|
|||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$subject = notags(unxmlify($data->subject));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::utc(notags(unxmlify($data->created_at)));
|
||||
$participants = notags(unxmlify($data->participants));
|
||||
|
||||
$messages = $data->message;
|
||||
|
@ -2098,7 +2098,7 @@ class Diaspora
|
|||
$guid = notags(unxmlify($data->guid));
|
||||
$conversation_guid = notags(unxmlify($data->conversation_guid));
|
||||
$text = unxmlify($data->text);
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::utc(notags(unxmlify($data->created_at)));
|
||||
|
||||
$contact = self::allowedContactByHandle($importer, $author, true);
|
||||
if (!$contact) {
|
||||
|
@ -2315,7 +2315,7 @@ class Diaspora
|
|||
$birthday = str_replace("1000", "1901", $birthday);
|
||||
|
||||
if ($birthday != "") {
|
||||
$birthday = Temporal::convert($birthday, "UTC", "UTC", "Y-m-d");
|
||||
$birthday = Temporal::utc($birthday, "Y-m-d");
|
||||
}
|
||||
|
||||
// this is to prevent multiple birthday notifications in a single year
|
||||
|
@ -2716,7 +2716,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::utc(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"
|
||||
|
@ -2930,7 +2930,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::utc(notags(unxmlify($data->created_at)));
|
||||
$public = notags(unxmlify($data->public));
|
||||
$text = unxmlify($data->text);
|
||||
$provider_display_name = notags(unxmlify($data->provider_display_name));
|
||||
|
@ -3652,7 +3652,7 @@ class Diaspora
|
|||
|
||||
$public = (($item["private"]) ? "false" : "true");
|
||||
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", Temporal::ATOM);
|
||||
$created = Temporal::utc($item["created"], Temporal::ATOM);
|
||||
|
||||
// Detect a share element and do a reshare
|
||||
if (!$item['private'] && ($ret = self::isReshare($item["body"]))) {
|
||||
|
@ -3855,7 +3855,7 @@ class Diaspora
|
|||
$parent = $p[0];
|
||||
|
||||
$text = html_entity_decode(bb2diaspora($item["body"]));
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", Temporal::ATOM);
|
||||
$created = Temporal::utc($item["created"], Temporal::ATOM);
|
||||
|
||||
$comment = ["author" => self::myHandle($owner),
|
||||
"guid" => $item["guid"],
|
||||
|
@ -4086,12 +4086,12 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", Temporal::ATOM),
|
||||
"created_at" => Temporal::utc($cnv['created'], Temporal::ATOM),
|
||||
"participants" => $cnv["recips"]
|
||||
];
|
||||
|
||||
$body = bb2diaspora($item["body"]);
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", Temporal::ATOM);
|
||||
$created = Temporal::utc($item["created"], Temporal::ATOM);
|
||||
|
||||
$msg = [
|
||||
"author" => $myaddr,
|
||||
|
@ -4109,7 +4109,7 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", Temporal::ATOM),
|
||||
"created_at" => Temporal::utc($cnv['created'], Temporal::ATOM),
|
||||
"participants" => $cnv["recips"],
|
||||
"message" => $msg];
|
||||
|
||||
|
@ -4217,7 +4217,7 @@ class Diaspora
|
|||
if ($year < 1004) {
|
||||
$year = 1004;
|
||||
}
|
||||
$dob = Temporal::convert($year . '-' . $month . '-'. $day, 'UTC', 'UTC', 'Y-m-d');
|
||||
$dob = Temporal::utc($year . '-' . $month . '-'. $day, 'Y-m-d');
|
||||
}
|
||||
|
||||
$about = $profile['about'];
|
||||
|
|
|
@ -1273,7 +1273,7 @@ class OStatus
|
|||
XML::addElement($doc, $root, "title", $title);
|
||||
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], $a->config["sitename"]));
|
||||
XML::addElement($doc, $root, "logo", $owner["photo"]);
|
||||
XML::addElement($doc, $root, "updated", Temporal::convert("now", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $root, "updated", Temporal::utcNow(Temporal::ATOM));
|
||||
|
||||
$author = self::addAuthor($doc, $owner);
|
||||
$root->appendChild($author);
|
||||
|
@ -1539,7 +1539,7 @@ class OStatus
|
|||
XML::addElement($doc, $source, "link", "", ["rel" => "alternate", "type" => "text/html", "href" => $contact["alias"]]);
|
||||
XML::addElement($doc, $source, "link", "", ["rel" => "self", "type" => "application/atom+xml", "href" => $contact["poll"]]);
|
||||
XML::addElement($doc, $source, "icon", $contact["photo"]);
|
||||
XML::addElement($doc, $source, "updated", Temporal::convert($contact["success_update"]."+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $source, "updated", Temporal::utc($contact["success_update"]."+00:00", Temporal::ATOM));
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
@ -1923,8 +1923,8 @@ class OStatus
|
|||
|
||||
XML::addElement($doc, $entry, "activity:verb", $verb);
|
||||
|
||||
XML::addElement($doc, $entry, "published", Temporal::convert($item["created"]."+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::convert($item["edited"]."+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "published", Temporal::utc($item["created"]."+00:00", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::utc($item["edited"]."+00:00", Temporal::ATOM));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2127,7 +2127,7 @@ class OStatus
|
|||
$last_update = 'now -30 days';
|
||||
}
|
||||
|
||||
$check_date = Temporal::convert($last_update);
|
||||
$check_date = Temporal::utc($last_update);
|
||||
$authorid = Contact::getIdForURL($owner["url"], 0);
|
||||
|
||||
$sql_extra = '';
|
||||
|
|
|
@ -113,7 +113,7 @@ class Temporal
|
|||
*/
|
||||
public static function getTimezoneField($name = 'timezone', $label = '', $current = 'America/Los_Angeles', $help = '')
|
||||
{
|
||||
$options = Temporal::getTimezoneSelect($current);
|
||||
$options = self::getTimezoneSelect($current);
|
||||
$options = str_replace('<select id="timezone_select" name="timezone">', '', $options);
|
||||
$options = str_replace('</select>', '', $options);
|
||||
|
||||
|
@ -123,6 +123,18 @@ class Temporal
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert() shorthand for UTC.
|
||||
*
|
||||
* @param string $time A date/time string
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
*/
|
||||
public static function utc($time, $format = self::MYSQL)
|
||||
{
|
||||
return self::convert($time, 'UTC', 'UTC', $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert() shorthand for UTC now.
|
||||
*
|
||||
|
@ -209,7 +221,7 @@ class Temporal
|
|||
if ($dob < '0000-01-01') {
|
||||
$value = '';
|
||||
} else {
|
||||
$value = Temporal::convert(($year > 1000) ? $dob : '1000-' . $month . '-' . $day, 'UTC', 'UTC', 'Y-m-d');
|
||||
$value = self::utc(($year > 1000) ? $dob : '1000-' . $month . '-' . $day, 'Y-m-d');
|
||||
}
|
||||
|
||||
$age = (intval($value) ? age($value, $a->user["timezone"], $a->user["timezone"]) : "");
|
||||
|
@ -445,11 +457,11 @@ class Temporal
|
|||
$viewer_tz = date_default_timezone_get();
|
||||
}
|
||||
|
||||
$birthdate = Temporal::convert($dob . ' 00:00:00+00:00', $owner_tz, 'UTC', 'Y-m-d');
|
||||
$birthdate = self::convert($dob . ' 00:00:00+00:00', $owner_tz, 'UTC', 'Y-m-d');
|
||||
list($year, $month, $day) = explode("-", $birthdate);
|
||||
$year_diff = Temporal::convert('now', $viewer_tz, 'UTC', 'Y') - $year;
|
||||
$curr_month = Temporal::convert('now', $viewer_tz, 'UTC', 'm');
|
||||
$curr_day = Temporal::convert('now', $viewer_tz, 'UTC', 'd');
|
||||
$year_diff = self::convert('now', $viewer_tz, 'UTC', 'Y') - $year;
|
||||
$curr_month = self::convert('now', $viewer_tz, 'UTC', 'm');
|
||||
$curr_day = self::convert('now', $viewer_tz, 'UTC', 'd');
|
||||
|
||||
if (($curr_month < $month) || (($curr_month == $month) && ($curr_day < $day))) {
|
||||
$year_diff--;
|
||||
|
@ -489,7 +501,7 @@ class Temporal
|
|||
{
|
||||
$d = sprintf('%04d-%02d-01 00:00', intval($y), intval($m));
|
||||
|
||||
return Temporal::convert($d, 'UTC', 'UTC', 'w');
|
||||
return self::utc($d, 'w');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -519,8 +531,8 @@ class Temporal
|
|||
'October', 'November', 'December'
|
||||
];
|
||||
|
||||
$thisyear = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
$thismonth = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'm');
|
||||
$thisyear = self::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
$thismonth = self::convert('now', date_default_timezone_get(), 'UTC', 'm');
|
||||
if (!$y) {
|
||||
$y = $thisyear;
|
||||
}
|
||||
|
@ -537,7 +549,7 @@ class Temporal
|
|||
$started = false;
|
||||
|
||||
if (($y == $thisyear) && ($m == $thismonth)) {
|
||||
$tddate = intval(Temporal::convert('now', date_default_timezone_get(), 'UTC', 'j'));
|
||||
$tddate = intval(self::convert('now', date_default_timezone_get(), 'UTC', 'j'));
|
||||
}
|
||||
|
||||
$str_month = day_translate($mtab[$m]);
|
||||
|
|
|
@ -218,33 +218,33 @@ Class Cron {
|
|||
*/
|
||||
switch ($contact['priority']) {
|
||||
case 5:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 1 month")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 1 month")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 1 week")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 1 week")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 1 day")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 1 day")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 12 hour")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 12 hour")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 1 hour")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 1 hour")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + ".$min_poll_interval." minute")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + ".$min_poll_interval." minute")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -99,7 +99,7 @@ class OnePoll
|
|||
$contact['priority'] = intval($poll_interval);
|
||||
$hub_update = false;
|
||||
|
||||
if (Temporal::utcNow() > Temporal::convert($t . " + 1 day")) {
|
||||
if (Temporal::utcNow() > Temporal::utc($t . " + 1 day")) {
|
||||
$hub_update = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -107,8 +107,8 @@ class OnePoll
|
|||
}
|
||||
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE)
|
||||
? Temporal::convert('now - 7 days', 'UTC', 'UTC', Temporal::ATOM)
|
||||
: Temporal::convert($contact['last-update'], 'UTC', 'UTC', Temporal::ATOM)
|
||||
? Temporal::utc('now - 7 days', Temporal::ATOM)
|
||||
: Temporal::utc($contact['last-update'], Temporal::ATOM)
|
||||
);
|
||||
|
||||
// Update the contact entry
|
||||
|
@ -459,7 +459,7 @@ class OnePoll
|
|||
$datarray['title'] = notags(trim($datarray['title']));
|
||||
|
||||
//$datarray['title'] = notags(trim($meta->subject));
|
||||
$datarray['created'] = Temporal::convert($meta->date);
|
||||
$datarray['created'] = Temporal::utc($meta->date);
|
||||
|
||||
// Is it a reply?
|
||||
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") ||
|
||||
|
|
Loading…
Reference in a new issue