Add Temporal::utc() shorthand to Temporal::convert()

This commit is contained in:
Hypolite Petovan 2018-01-26 07:30:06 -05:00
parent e4f32f8ac8
commit cbc89d147d
5 changed files with 16 additions and 16 deletions

View File

@ -520,12 +520,12 @@ function fromgplus_fetch($a, $uid) {
if (function_exists("share_header"))
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
$item->object->actor->image->url, "",
Temporal::convert($item->object->published),$item->object->url);
Temporal::utc($item->object->published),$item->object->url);
else
$post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
"' profile='".$item->object->actor->url.
"' avatar='".$item->object->actor->image->url.
"' posted='".Temporal::convert($item->object->published).
"' posted='".Temporal::utc($item->object->published).
"' link='".$item->object->url."']";
$post .= fromgplus_html2bbcode($item->object->content);

View File

@ -39,7 +39,7 @@ function public_server_register_account($a,$b) {
return;
$r = q("UPDATE user set account_expires_on = '%s', expire = %d where uid = %d",
dbesc(Temporal::convert('now +' . $days . ' days')),
dbesc(Temporal::utc('now +' . $days . ' days')),
intval($days_posts),
intval($uid)
);
@ -87,7 +87,7 @@ function public_server_cron($a,$b) {
if(count($r)) {
foreach($r as $rr)
q("update user set account_expires_on = '%s' where uid = %d",
dbesc(Temporal::convert('now +' . '6 days')),
dbesc(Temporal::utc('now +' . '6 days')),
intval($rr['uid'])
);
}
@ -100,7 +100,7 @@ function public_server_cron($a,$b) {
if(count($r)) {
foreach($r as $rr)
q("update user set account_expires_on = '%s' where uid = %d",
dbesc(Temporal::convert('now +' . '6 days')),
dbesc(Temporal::utc('now +' . '6 days')),
intval($rr['uid'])
);
}
@ -138,7 +138,7 @@ function public_server_login($a,$b) {
if(! $days)
return;
$r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'",
dbesc(Temporal::convert('now +' . $days . ' days')),
dbesc(Temporal::utc('now +' . $days . ' days')),
local_user()
);
}

View File

@ -1211,11 +1211,11 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if ($post->object->displayName != "")
$postarray['title'] = $post->object->displayName;
$postarray['created'] = Temporal::convert($post->published);
$postarray['created'] = Temporal::utc($post->published);
if (isset($post->updated))
$postarray['edited'] = Temporal::convert($post->updated);
$postarray['edited'] = Temporal::utc($post->updated);
elseif (isset($post->received))
$postarray['edited'] = Temporal::convert($post->received);
$postarray['edited'] = Temporal::utc($post->received);
else
$postarray['edited'] = $postarray['created'];
@ -1230,7 +1230,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$postarray['body'] = share_header($share_author, $post->object->author->url,
$post->object->author->image->url, "",
Temporal::convert($post->object->created),
Temporal::utc($post->object->created),
$post->links->self->href).
$postarray['body']."[/share]";

View File

@ -983,7 +983,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
} else {
// update profile photos once every two weeks as we have no notification of when they change.
//$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false);
$update_photo = ($r[0]['avatar-date'] < Temporal::convert('now -12 hours'));
$update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours'));
// check that we have all the photos, this has been known to fail on occasion
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
@ -1197,8 +1197,8 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];
$postarray['created'] = Temporal::convert($content->created_at);
$postarray['edited'] = Temporal::convert($content->created_at);
$postarray['created'] = Temporal::utc($content->created_at);
$postarray['edited'] = Temporal::utc($content->created_at);
if (is_string($content->place->name)) {
$postarray["location"] = $content->place->name;

View File

@ -1070,7 +1070,7 @@ function twitter_fetch_contact($uid, $contact, $create_user)
} else {
// update profile photos once every two weeks as we have no notification of when they change.
//$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false);
$update_photo = ($r[0]['avatar-date'] < Temporal::convert('now -12 hours'));
$update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours'));
// check that we have all the photos, this has been known to fail on occasion
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
@ -1490,8 +1490,8 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
$converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture);
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];
$postarray['created'] = Temporal::convert($post->created_at);
$postarray['edited'] = Temporal::convert($post->created_at);
$postarray['created'] = Temporal::utc($post->created_at);
$postarray['edited'] = Temporal::utc($post->created_at);
$statustext = $converted["plain"];