Add Temporal::utcNow()

This commit is contained in:
Hypolite Petovan 2018-01-25 23:26:51 -05:00
commit 8aff8a76eb
51 changed files with 191 additions and 180 deletions

View file

@ -740,7 +740,7 @@ function admin_page_summary(App $a)
if (!$last_worker_call) {
$showwarning = true;
$warningtext[] = L10n::t('The worker was never executed. Please check your database structure!');
} elseif ((strtotime(Temporal::convert()) - strtotime($last_worker_call)) > 60 * 60) {
} elseif ((strtotime(Temporal::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
$showwarning = true;
$warningtext[] = L10n::t('The last worker execution was on %s UTC. This is older than one hour. Please check your crontab settings.', $last_worker_call);
}

View file

@ -554,7 +554,7 @@ function contacts_content(App $a)
// tabs
$tab_str = contacts_tab($a, $contact_id, 2);
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('', '', 'now')) ? L10n::t('Communications lost with this contact!') : '');
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < Temporal::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
$fetch_further_information = null;
if ($contact['network'] == NETWORK_FEED) {

View file

@ -327,8 +327,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`network` = '%s' WHERE `id` = %d
",
intval($new_relation),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($duplex),
intval($hidden),
dbesc(NETWORK_DFRN),
@ -378,8 +378,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`rel` = %d
WHERE `id` = %d
",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($addr),
dbesc($notify),
dbesc($poll),
@ -619,8 +619,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`network` = '%s' WHERE `id` = %d
",
intval($new_relation),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($duplex),
intval($forum),
intval($prv),

View file

@ -137,7 +137,7 @@ function dfrn_request_post(App $a)
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`, `blocked`, `pending`)
VALUES ( %d, '%s', '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d)",
intval(local_user()),
Temporal::convert(),
Temporal::utcNow(),
dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url)),
$parms['addr'],
@ -382,7 +382,7 @@ function dfrn_request_post(App $a)
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `blocked`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
intval($uid),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
$parms['url'],
dbesc(normalise_link($url)),
$parms['addr'],
@ -430,7 +430,7 @@ function dfrn_request_post(App $a)
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
dbesc(notags(trim($_POST['dfrn-request-message']))),
dbesc($hash),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
}

View file

@ -52,7 +52,7 @@ function fsuggest_post(App $a)
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
dbesc($hash),

View file

@ -62,7 +62,7 @@ function invite_post(App $a)
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
dbesc($code),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
if (! is_site_admin()) {

View file

@ -601,11 +601,11 @@ function item_post(App $a) {
$datarray['author-link'] = $author['url'];
$datarray['author-avatar'] = $author['thumb'];
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link'], 0);
$datarray['created'] = Temporal::convert();
$datarray['edited'] = Temporal::convert();
$datarray['commented'] = Temporal::convert();
$datarray['received'] = Temporal::convert();
$datarray['changed'] = Temporal::convert();
$datarray['created'] = Temporal::utcNow();
$datarray['edited'] = Temporal::utcNow();
$datarray['commented'] = Temporal::utcNow();
$datarray['received'] = Temporal::utcNow();
$datarray['changed'] = Temporal::utcNow();
$datarray['extid'] = $extid;
$datarray['guid'] = $guid;
$datarray['uri'] = $uri;
@ -709,8 +709,8 @@ function item_post(App $a) {
'file' => $datarray['file'],
'rendered-html' => $datarray['rendered-html'],
'rendered-hash' => $datarray['rendered-hash'],
'edited' => Temporal::convert(),
'changed' => Temporal::convert()];
'edited' => Temporal::utcNow(),
'changed' => Temporal::utcNow()];
Item::update($fields, ['id' => $post_id]);

View file

@ -33,7 +33,7 @@ function lostpass_post(App $a)
$fields = [
'pwdreset' => $pwdreset_token,
'pwdreset_time' => Temporal::convert()
'pwdreset_time' => Temporal::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {

View file

@ -790,8 +790,8 @@ function networkThreadedView(App $a, $update = 0)
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date'];
} else {
$top_limit = Temporal::convert();
$bottom_limit = Temporal::convert();
$top_limit = Temporal::utcNow();
$bottom_limit = Temporal::utcNow();
}
// When checking for updates we need to fetch from the newest date to the newest date before
@ -804,7 +804,7 @@ function networkThreadedView(App $a, $update = 0)
$top_limit = $last_date;
} elseif ($a->pager['page'] == 1) {
// Highest possible top limit when we are on the first page
$top_limit = Temporal::convert();
$top_limit = Temporal::utcNow();
}
$items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item`

View file

@ -291,7 +291,7 @@ function photos_post(App $a)
if (DBM::is_result($r)) {
foreach ($r as $rr) {
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc($rr['parent-uri']),
intval($page_owner_uid)
);
@ -364,8 +364,8 @@ function photos_post(App $a)
);
if (DBM::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($i[0]['uri']),
intval($page_owner_uid)
);
@ -649,8 +649,8 @@ function photos_post(App $a)
$r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($newtag),
dbesc($newinform),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($item_id),
intval($page_owner_uid)
);
@ -1361,7 +1361,7 @@ function photos_content(App $a)
$photo = [
'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> L10n::t('View Full Size'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . Temporal::convert('now', 'UTC', 'UTC', 'ymdhis'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . Temporal::utcNow('ymdhis'),
'height' => $hires['height'],
'width' => $hires['width'],
'album' => $hires['album'],

View file

@ -226,7 +226,7 @@ function ping_init(App $a)
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(Temporal::convert('now + 7 days')),
dbesc(Temporal::convert('now'))
dbesc(Temporal::utcNow())
);
if (DBM::is_result($ev)) {
Cache::set($cachekey, $ev, CACHE_HOUR);

View file

@ -130,7 +130,7 @@ function profile_photo_post(App $a) {
// so that browsers will do a cache update unconditionally
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
@ -230,7 +230,7 @@ function profile_photo_content(App $a) {
);
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);

View file

@ -487,7 +487,7 @@ function profiles_post(App $a) {
if ($namechanged && $is_default) {
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc($name),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",

View file

@ -188,7 +188,7 @@ function proxy_init(App $a) {
die();
}
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => Temporal::convert(), 'edited' => Temporal::convert(),
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => Temporal::utcNow(), 'edited' => Temporal::utcNow(),
'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image),
'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0,
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime];

View file

@ -139,7 +139,7 @@ function pubsubhubbub_init(App $a) {
dbesc($hub_callback));
if ($subscribe) {
$last_update = Temporal::convert();
$last_update = Temporal::utcNow();
$push_flag = 0;
// if we are just updating an old subscription, keep the

View file

@ -118,7 +118,7 @@ function register_post(App $a)
$hash = random_string();
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language`, `note` ) VALUES ( '%s', '%s', %d, '%s', '%s', '%s' ) ",
dbesc($hash),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval($user['uid']),
dbesc($result['password']),
dbesc($lang),

View file

@ -631,7 +631,7 @@ function settings_post(App $a)
if ($name_change) {
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
dbesc($username),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
}

View file

@ -170,8 +170,8 @@ function videos_post(App $a) {
//echo "<pre>"; var_dump($i); killme();
if (DBM::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($i[0]['uri']),
intval(local_user())
);

View file

@ -124,7 +124,7 @@ function wall_attach_post(App $a) {
$filedata = @file_get_contents($src);
$mimetype = Mimetype::getContentType($filename);
$hash = get_guid(64);
$created = Temporal::convert();
$created = Temporal::utcNow();
$fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,