Move Temporal::convert() to DateTimeFormat::convert()

This commit is contained in:
Hypolite Petovan 2018-01-26 21:38:34 -05:00
parent b7a7355292
commit 5e7285b9ba
64 changed files with 568 additions and 551 deletions

View file

@ -28,7 +28,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
use Friendica\Model\Contact;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
use Friendida\Core\L10n;
require_once 'include/text.php';
@ -1142,14 +1142,14 @@ function feed_birthday($uid, $tz)
if (DBM::is_result($p)) {
$tmp_dob = substr($p[0]['dob'], 5);
if (intval($tmp_dob)) {
$y = Temporal::timezoneNow($tz, 'Y');
$y = DateTimeFormat::timezoneNow($tz, 'Y');
$bd = $y . '-' . $tmp_dob . ' 00:00';
$t_dob = strtotime($bd);
$now = strtotime(Temporal::timezoneNow($tz));
$now = strtotime(DateTimeFormat::timezoneNow($tz));
if ($t_dob < $now) {
$bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
}
$birthday = Temporal::convert($bd, 'UTC', $tz, Temporal::ATOM);
$birthday = DateTimeFormat::convert($bd, 'UTC', $tz, DateTimeFormat::ATOM);
}
}

View file

@ -36,8 +36,8 @@ use Friendica\Network\HTTPException\TooManyRequestsException;
use Friendica\Network\HTTPException\UnauthorizedException;
use Friendica\Object\Image;
use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Temporal;
use Friendica\Util\XML;
require_once 'include/bbcode.php';
@ -111,7 +111,7 @@ function api_source()
function api_date($str)
{
// Wed May 23 06:01:13 +0000 2007
return Temporal::utc($str, "D M d H:i:s +0000 Y");
return DateTimeFormat::utc($str, "D M d H:i:s +0000 Y");
}
/**
@ -460,7 +460,7 @@ function api_rss_extra(App $a, $arr, $user_info)
'self' => System::baseUrl() . "/" . $a->query_string,
'base' => System::baseUrl(),
'updated' => api_date(null),
'atom_updated' => Temporal::utcNow(Temporal::ATOM),
'atom_updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
'language' => $user_info['language'],
'logo' => System::baseUrl() . "/images/friendica-32.png",
];
@ -1162,7 +1162,7 @@ function api_statuses_update($type)
// Check for throttling (maximum posts per day, week and month)
$throttle_day = Config::get('system', 'throttle_limit_day');
if ($throttle_day > 0) {
$datefrom = date(Temporal::MYSQL, time() - 24*60*60);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
$r = q(
"SELECT COUNT(*) AS `posts_day` FROM `item` WHERE `uid`=%d AND `wall`
@ -1186,7 +1186,7 @@ function api_statuses_update($type)
$throttle_week = Config::get('system', 'throttle_limit_week');
if ($throttle_week > 0) {
$datefrom = date(Temporal::MYSQL, time() - 24*60*60*7);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
$r = q(
"SELECT COUNT(*) AS `posts_week` FROM `item` WHERE `uid`=%d AND `wall`
@ -1210,7 +1210,7 @@ function api_statuses_update($type)
$throttle_month = Config::get('system', 'throttle_limit_month');
if ($throttle_month > 0) {
$datefrom = date(Temporal::MYSQL, time() - 24*60*60*30);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
$r = q(
"SELECT COUNT(*) AS `posts_month` FROM `item` WHERE `uid`=%d AND `wall`
@ -3207,7 +3207,7 @@ function api_account_rate_limit_status($type)
'@attributes' => ["type" => "integer"],
'hourly-limit' => '150',
'@attributes2' => ["type" => "integer"],
'reset-time' => Temporal::utc('now + 1 hour', Temporal::ATOM),
'reset-time' => DateTimeFormat::utc('now + 1 hour', DateTimeFormat::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::utc('now + 1 hour', Temporal::ATOM)),
'reset_time' => api_date(DateTimeFormat::utc('now + 1 hour', DateTimeFormat::ATOM)),
];
}
@ -4216,7 +4216,7 @@ function api_fr_photo_create_update($type)
$result = q(
"UPDATE `photo` SET %s, `edited`='%s' WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'",
$sql_extra,
Temporal::utcNow(), // update edited timestamp
DateTimeFormat::utcNow(), // update edited timestamp
intval(api_user()),
dbesc($photo_id),
dbesc($album)
@ -4420,7 +4420,7 @@ function api_account_update_profile_image($type)
q(
"UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
intval(local_user())
);

View file

@ -7,7 +7,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
use League\HTMLToMarkdown\HtmlConverter;
require_once 'include/event.php';
@ -245,15 +245,15 @@ function format_event_diaspora($ev) {
// @todo What. Is. Going. On. With. This. Useless. Ternary. Operator? - mrpetovan
$o .= L10n::t('Starts:') . ' ' . '[' . day_translate(
$ev['adjust'] ? Temporal::utc($ev['start'], $bd_format) : Temporal::utc($ev['start'], $bd_format)
$ev['adjust'] ? DateTimeFormat::utc($ev['start'], $bd_format) : DateTimeFormat::utc($ev['start'], $bd_format)
)
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::utc($ev['start'])) . ")\n";
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(DateTimeFormat::utc($ev['start'])) . ")\n";
if (! $ev['nofinish']) {
$o .= L10n::t('Finishes:') . ' ' . '[' . day_translate(
$ev['adjust'] ? Temporal::utc($ev['finish'], $bd_format) : Temporal::utc($ev['finish'], $bd_format)
$ev['adjust'] ? DateTimeFormat::utc($ev['finish'], $bd_format) : DateTimeFormat::utc($ev['finish'], $bd_format)
)
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::utc($ev['finish'])) . ")\n";
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(DateTimeFormat::utc($ev['finish'])) . ")\n";
}
if (strlen($ev['location'])) {

View file

@ -17,7 +17,7 @@ use Friendica\Model\Profile;
use Friendica\Object\Post;
use Friendica\Util\XML;
use Friendica\Object\Thread;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once "include/bbcode.php";
require_once "include/acl_selectors.php";
@ -790,7 +790,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
'categories' => $categories,
'folders' => $folders,
'text' => strip_tags($body_e),
'localtime' => Temporal::local($item['created'], 'r'),
'localtime' => DateTimeFormat::local($item['created'], 'r'),
'ago' => (($item['app']) ? L10n::t('%s from %s', relative_date($item['created']),$item['app']) : relative_date($item['created'])),
'location' => $location_e,
'indent' => '',

View file

@ -4,7 +4,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once('include/datetime.php');
@ -190,7 +190,7 @@ class dba {
if ($log) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log_index"], Temporal::utcNow()."\t".
@file_put_contents($a->config["system"]["db_log_index"], DateTimeFormat::utcNow()."\t".
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
basename($backtrace[1]["file"])."\t".
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
@ -495,7 +495,7 @@ class dba {
$duration = round($duration, 3);
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log"], Temporal::utcNow()."\t".$duration."\t".
@file_put_contents($a->config["system"]["db_log"], DateTimeFormat::utcNow()."\t".$duration."\t".
basename($backtrace[1]["file"])."\t".
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
substr(self::replace_parameters($sql, $args), 0, 2000)."\n", FILE_APPEND);

View file

@ -8,8 +8,8 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Friendica\Util\Temporal;
require_once 'include/bbcode.php';
require_once 'include/html2bbcode.php';
@ -451,7 +451,7 @@ function notification($params)
$datarray['name_cache'] = strip_tags(bbcode($params['source_name']));
$datarray['url'] = $params['source_link'];
$datarray['photo'] = $params['source_photo'];
$datarray['date'] = Temporal::utcNow();
$datarray['date'] = DateTimeFormat::utcNow();
$datarray['uid'] = $params['uid'];
$datarray['link'] = $itemlink;
$datarray['iid'] = $item_id;

View file

@ -12,8 +12,8 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
use Friendica\Util\Temporal;
require_once 'include/bbcode.php';
require_once 'include/datetime.php';
@ -28,14 +28,14 @@ function format_event_html($ev, $simple = false) {
$event_start = day_translate(
$ev['adjust'] ?
Temporal::local($ev['start'], $bd_format)
: Temporal::utc($ev['start'], $bd_format)
DateTimeFormat::local($ev['start'], $bd_format)
: DateTimeFormat::utc($ev['start'], $bd_format)
);
$event_end = day_translate(
$ev['adjust'] ?
Temporal::local($ev['finish'], $bd_format)
: Temporal::utc($ev['finish'], $bd_format)
DateTimeFormat::local($ev['finish'], $bd_format)
: DateTimeFormat::utc($ev['finish'], $bd_format)
);
if ($simple) {
@ -61,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>&nbsp;<span class="dtstart" title="'
. Temporal::utc($ev['start'], (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
. DateTimeFormat::utc($ev['start'], (($ev['adjust']) ? DateTimeFormat::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>&nbsp;<span class="dtend" title="'
. Temporal::utc($ev['finish'], (($ev['adjust']) ? Temporal::ATOM : 'Y-m-d\TH:i:s' ))
. DateTimeFormat::utc($ev['finish'], (($ev['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s' ))
. '" >'.$event_end
. '</span></div>' . "\r\n";
}
@ -200,8 +200,8 @@ function sort_by_date($a) {
function ev_compare($a,$b) {
$date_a = (($a['adjust']) ? Temporal::local($a['start']) : $a['start']);
$date_b = (($b['adjust']) ? Temporal::local($b['start']) : $b['start']);
$date_a = (($a['adjust']) ? DateTimeFormat::local($a['start']) : $a['start']);
$date_b = (($b['adjust']) ? DateTimeFormat::local($b['start']) : $b['start']);
if ($date_a === $date_b) {
return strcasecmp($a['desc'], $b['desc']);
@ -244,8 +244,8 @@ function event_store($arr) {
$a = get_app();
$arr['created'] = (($arr['created']) ? $arr['created'] : Temporal::utcNow());
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : Temporal::utcNow());
$arr['created'] = (($arr['created']) ? $arr['created'] : DateTimeFormat::utcNow());
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : DateTimeFormat::utcNow());
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
$arr['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid']));
@ -595,15 +595,15 @@ function process_events($arr) {
$fmt = L10n::t('l, F j');
if (count($arr)) {
foreach ($arr as $rr) {
$j = (($rr['adjust']) ? Temporal::local($rr['start'], 'j') : Temporal::utc($rr['start'], 'j'));
$d = (($rr['adjust']) ? Temporal::local($rr['start'], $fmt) : Temporal::utc($rr['start'], $fmt));
$j = (($rr['adjust']) ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j'));
$d = (($rr['adjust']) ? DateTimeFormat::local($rr['start'], $fmt) : DateTimeFormat::utc($rr['start'], $fmt));
$d = day_translate($d);
$start = (($rr['adjust']) ? Temporal::local($rr['start'], 'c') : Temporal::utc($rr['start'], 'c'));
$start = (($rr['adjust']) ? DateTimeFormat::local($rr['start'], 'c') : DateTimeFormat::utc($rr['start'], 'c'));
if ($rr['nofinish']) {
$end = null;
} else {
$end = (($rr['adjust']) ? Temporal::local($rr['finish'], 'c') : Temporal::utc($rr['finish'], 'c'));
$end = (($rr['adjust']) ? DateTimeFormat::local($rr['finish'], 'c') : DateTimeFormat::utc($rr['finish'], 'c'));
}
$is_first = ($d !== $last_date);
@ -930,27 +930,27 @@ function format_event_item($item) {
// Convert the time to different formats.
$dtstart_dt = day_translate(
$item['event-adjust'] ?
Temporal::local($item['event-start'], $dformat)
: Temporal::utc($item['event-start'], $dformat)
DateTimeFormat::local($item['event-start'], $dformat)
: DateTimeFormat::utc($item['event-start'], $dformat)
);
$dtstart_title = Temporal::utc($item['event-start'], $item['event-adjust'] ? Temporal::ATOM : 'Y-m-d\TH:i:s');
$dtstart_title = DateTimeFormat::utc($item['event-start'], $item['event-adjust'] ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s');
// Format: Jan till Dec.
$month_short = day_short_translate(
$item['event-adjust'] ?
Temporal::local($item['event-start'], 'M')
: Temporal::utc($item['event-start'], 'M')
DateTimeFormat::local($item['event-start'], 'M')
: DateTimeFormat::utc($item['event-start'], 'M')
);
// Format: 1 till 31.
$date_short = $item['event-adjust'] ?
Temporal::local($item['event-start'], 'j')
: Temporal::utc($item['event-start'], 'j');
DateTimeFormat::local($item['event-start'], 'j')
: DateTimeFormat::utc($item['event-start'], 'j');
$start_time = $item['event-adjust'] ?
Temporal::local($item['event-start'], $tformat)
: Temporal::utc($item['event-start'], $tformat);
DateTimeFormat::local($item['event-start'], $tformat)
: DateTimeFormat::utc($item['event-start'], $tformat);
$start_short = day_short_translate(
$item['event-adjust'] ?
Temporal::local($item['event-start'], $dformat_short)
: Temporal::utc($item['event-start'], $dformat_short)
DateTimeFormat::local($item['event-start'], $dformat_short)
: DateTimeFormat::utc($item['event-start'], $dformat_short)
);
// If the option 'nofinisch' isn't set, we need to format the finish date/time.
@ -958,18 +958,18 @@ function format_event_item($item) {
$finish = true;
$dtend_dt = day_translate(
$item['event-adjust'] ?
Temporal::local($item['event-finish'], $dformat)
: Temporal::utc($item['event-finish'], $dformat)
DateTimeFormat::local($item['event-finish'], $dformat)
: DateTimeFormat::utc($item['event-finish'], $dformat)
);
$dtend_title = Temporal::utc($item['event-finish'], $item['event-adjust'] ? Temporal::ATOM : 'Y-m-d\TH:i:s');
$dtend_title = DateTimeFormat::utc($item['event-finish'], $item['event-adjust'] ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s');
$end_short = day_short_translate(
$item['event-adjust'] ?
Temporal::local($item['event-finish'], $dformat_short)
: Temporal::utc($item['event-finish'], $dformat_short)
DateTimeFormat::local($item['event-finish'], $dformat_short)
: DateTimeFormat::utc($item['event-finish'], $dformat_short)
);
$end_time = $item['event-adjust'] ?
Temporal::local($item['event-finish'], $tformat)
: Temporal::utc($item['event-finish'], $tformat);
DateTimeFormat::local($item['event-finish'], $tformat)
: DateTimeFormat::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;

View file

@ -9,22 +9,14 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Term;
use Friendica\Model\User;
use Friendica\Object\Image;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Feed;
use Friendica\Util\Network;
use Friendica\Protocol\OStatus;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Temporal;
require_once 'include/bbcode.php';
require_once 'include/tags.php';
@ -416,7 +408,7 @@ function drop_item($id) {
/* arrange the list in years */
function list_post_dates($uid, $wall) {
$dnow = Temporal::localNow('Y-m-d');
$dnow = DateTimeFormat::localNow('Y-m-d');
$dthen = Item::firstPostDate($uid, $wall);
if (!$dthen) {
@ -437,14 +429,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::utc($dstart, 'Y-m-d');
$end_month = Temporal::utc($dend, 'Y-m-d');
$str = day_translate(Temporal::utc($dnow, 'F'));
$start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
$end_month = DateTimeFormat::utc($dend, 'Y-m-d');
$str = day_translate(DateTimeFormat::utc($dnow, 'F'));
if (!$ret[$dyear]) {
$ret[$dyear] = [];
}
$ret[$dyear][] = [$str, $end_month, $start_month];
$dnow = Temporal::utc($dnow . ' -1 month', 'Y-m-d');
$dnow = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d');
}
return $ret;
}
@ -474,7 +466,7 @@ function posted_date_widget($url, $uid, $wall) {
return $o;
}
$cutoff_year = intval(Temporal::localNow('Y')) - $visible_years;
$cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[

View file

@ -10,7 +10,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Group;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
/**
* @brief Calculate the hash that is needed for the "Friendica" cookie
@ -142,10 +142,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] . '"');
if ($login_initial || $login_refresh) {
dba::update('user', ['login_date' => Temporal::utcNow()], ['uid' => $_SESSION['uid']]);
dba::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
// Set the login date for all identities of the user
dba::update('user', ['login_date' => Temporal::utcNow()],
dba::update('user', ['login_date' => DateTimeFormat::utcNow()],
['password' => $master_record['password'], 'email' => $master_record['email'], 'account_removed' => false]);
}

View file

@ -15,8 +15,8 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Profile;
use Friendica\Model\Term;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
use Friendica\Util\Temporal;
require_once "mod/proxy.php";
require_once "include/conversation.php";
@ -723,7 +723,7 @@ function logger($msg, $level = 0) {
$callers = debug_backtrace();
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
Temporal::utcNow(Temporal::ATOM),
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
$process_id,
$LOGGER_LEVELS[$level],
basename($callers[0]['file']),
@ -789,7 +789,7 @@ function dlogger($msg, $level = 0) {
$callers = debug_backtrace();
$logline = sprintf("%s@\t%s:\t%s:\t%s\t%s\t%s\n",
Temporal::utcNow(),
DateTimeFormat::utcNow(),
$process_id,
basename($callers[0]['file']),
$callers[0]['line'],

View file

@ -20,7 +20,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\Login;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'include/enotify.php';
require_once 'include/text.php';
@ -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::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
} elseif ((strtotime(DateTimeFormat::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

@ -17,7 +17,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Profile;
use Friendica\Protocol\DFRN;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'include/event.php';
@ -152,8 +152,8 @@ function cal_content(App $a)
// The view mode part is similiar to /mod/events.php
if ($mode == 'view') {
$thisyear = Temporal::localNow('Y');
$thismonth = Temporal::localNow('m');
$thisyear = DateTimeFormat::localNow('Y');
$thismonth = DateTimeFormat::localNow('m');
if (!$y) {
$y = intval($thisyear);
}
@ -203,11 +203,11 @@ function cal_content(App $a)
}
}
$start = Temporal::utc($start);
$finish = Temporal::utc($finish);
$start = DateTimeFormat::utc($start);
$finish = DateTimeFormat::utc($finish);
$adjust_start = Temporal::local($start);
$adjust_finish = Temporal::local($finish);
$adjust_start = DateTimeFormat::local($start);
$adjust_finish = DateTimeFormat::local($finish);
// put the event parametes in an array so we can better transmit them
$event_params = [
@ -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::local($rr['start'], 'j') : Temporal::utc($rr['start'], 'j');
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if (!x($links, $j)) {
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
}

View file

@ -17,7 +17,7 @@ use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'mod/proxy.php';
@ -540,7 +540,7 @@ function contacts_content(App $a)
$insecure = L10n::t('Private communications are not available for this contact.');
$last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : Temporal::local($contact['last-update'], 'D, j M Y, g:i A'));
$last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
if ($contact['last-update'] > NULL_DATE) {
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t("\x28Update was successful\x29") : L10n::t("\x28Update was not successful\x29"));
@ -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'] < Temporal::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
$fetch_further_information = null;
if ($contact['network'] == NETWORK_FEED) {

View file

@ -31,8 +31,8 @@ use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Temporal;
use Friendica\Util\XML;
require_once 'include/enotify.php';
@ -327,8 +327,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`network` = '%s' WHERE `id` = %d
",
intval($new_relation),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::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::utcNow()),
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::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::utcNow()),
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::utcNow()),
intval($duplex),
intval($forum),
intval($prv),

View file

@ -24,8 +24,8 @@ use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Module\Login;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Temporal;
require_once 'include/enotify.php';
@ -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::utcNow(),
DateTimeFormat::utcNow(),
dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url)),
$parms['addr'],
@ -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::utc('now - 24 hours')),
dbesc(DateTimeFormat::utc('now - 24 hours')),
intval($uid)
);
if (DBM::is_result($r) && count($r) > $maxreq) {
@ -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::utcNow()),
dbesc(DateTimeFormat::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::utcNow())
dbesc(DateTimeFormat::utcNow())
);
}

View file

@ -12,7 +12,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'include/bbcode.php';
require_once 'include/datetime.php';
@ -76,14 +76,14 @@ function events_post(App $a) {
}
if ($adjust) {
$start = Temporal::convert($start, 'UTC', date_default_timezone_get());
$start = DateTimeFormat::convert($start, 'UTC', date_default_timezone_get());
if (! $nofinish) {
$finish = Temporal::convert($finish, 'UTC', date_default_timezone_get());
$finish = DateTimeFormat::convert($finish, 'UTC', date_default_timezone_get());
}
} else {
$start = Temporal::utc($start);
$start = DateTimeFormat::utc($start);
if (! $nofinish) {
$finish = Temporal::utc($finish);
$finish = DateTimeFormat::utc($finish);
}
}
@ -276,8 +276,8 @@ function events_content(App $a) {
// The view mode part is similiar to /mod/cal.php
if ($mode == 'view') {
$thisyear = Temporal::localNow('Y');
$thismonth = Temporal::localNow('m');
$thisyear = DateTimeFormat::localNow('Y');
$thismonth = DateTimeFormat::localNow('m');
if (! $y) {
$y = intval($thisyear);
}
@ -323,11 +323,11 @@ function events_content(App $a) {
}
}
$start = Temporal::utc($start);
$finish = Temporal::utc($finish);
$start = DateTimeFormat::utc($start);
$finish = DateTimeFormat::utc($finish);
$adjust_start = Temporal::local($start);
$adjust_finish = Temporal::local($finish);
$adjust_start = DateTimeFormat::local($start);
$adjust_finish = DateTimeFormat::local($finish);
// put the event parametes in an array so we can better transmit them
$event_params = [
@ -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::local($rr['start'], 'j') : Temporal::utc($rr['start'], 'j');
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if (! x($links,$j)) {
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
}
@ -465,19 +465,19 @@ function events_content(App $a) {
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
}
$syear = Temporal::convert($sdt, $tz, 'UTC', 'Y');
$smonth = Temporal::convert($sdt, $tz, 'UTC', 'm');
$sday = Temporal::convert($sdt, $tz, 'UTC', 'd');
$syear = DateTimeFormat::convert($sdt, $tz, 'UTC', 'Y');
$smonth = DateTimeFormat::convert($sdt, $tz, 'UTC', 'm');
$sday = DateTimeFormat::convert($sdt, $tz, 'UTC', 'd');
$shour = ((x($orig_event)) ? Temporal::convert($sdt, $tz, 'UTC', 'H') : 0);
$sminute = ((x($orig_event)) ? Temporal::convert($sdt, $tz, 'UTC', 'i') : 0);
$shour = ((x($orig_event)) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'H') : 0);
$sminute = ((x($orig_event)) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'i') : 0);
$fyear = Temporal::convert($fdt, $tz, 'UTC', 'Y');
$fmonth = Temporal::convert($fdt, $tz, 'UTC', 'm');
$fday = Temporal::convert($fdt, $tz, 'UTC', 'd');
$fyear = DateTimeFormat::convert($fdt, $tz, 'UTC', 'Y');
$fmonth = DateTimeFormat::convert($fdt, $tz, 'UTC', 'm');
$fday = DateTimeFormat::convert($fdt, $tz, 'UTC', 'd');
$fhour = ((x($orig_event)) ? Temporal::convert($fdt, $tz, 'UTC', 'H') : 0);
$fminute = ((x($orig_event)) ? Temporal::convert($fdt, $tz, 'UTC', 'i') : 0);
$fhour = ((x($orig_event)) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : 0);
$fminute = ((x($orig_event)) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : 0);
require_once 'include/acl_selectors.php' ;

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
function fsuggest_post(App $a)
{
@ -52,7 +52,7 @@ function fsuggest_post(App $a)
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(Temporal::utcNow())
dbesc(DateTimeFormat::utcNow())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
dbesc($hash),

View file

@ -12,7 +12,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Protocol\Email;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
function invite_post(App $a)
{
@ -62,7 +62,7 @@ function invite_post(App $a)
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
dbesc($code),
dbesc(Temporal::utcNow())
dbesc(DateTimeFormat::utcNow())
);
if (! is_site_admin()) {

View file

@ -28,8 +28,8 @@ use Friendica\Model\GContact;
use Friendica\Model\Item;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Friendica\Util\Temporal;
require_once 'include/enotify.php';
require_once 'include/tags.php';
@ -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::utcNow();
$datarray['edited'] = Temporal::utcNow();
$datarray['commented'] = Temporal::utcNow();
$datarray['received'] = Temporal::utcNow();
$datarray['changed'] = Temporal::utcNow();
$datarray['created'] = DateTimeFormat::utcNow();
$datarray['edited'] = DateTimeFormat::utcNow();
$datarray['commented'] = DateTimeFormat::utcNow();
$datarray['received'] = DateTimeFormat::utcNow();
$datarray['changed'] = DateTimeFormat::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::utcNow(),
'changed' => Temporal::utcNow()];
'edited' => DateTimeFormat::utcNow(),
'changed' => DateTimeFormat::utcNow()];
Item::update($fields, ['id' => $post_id]);

View file

@ -20,7 +20,7 @@ function localtime_post(App $a)
$bd_format = L10n::t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
if ($_POST['timezone']) {
$a->data['mod-localtime'] = Temporal::convert($t, $_POST['timezone'], 'UTC', $bd_format);
$a->data['mod-localtime'] = DateTimeFormat::convert($t, $_POST['timezone'], 'UTC', $bd_format);
}
}

View file

@ -8,7 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\User;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'boot.php';
require_once 'include/datetime.php';
@ -33,7 +33,7 @@ function lostpass_post(App $a)
$fields = [
'pwdreset' => $pwdreset_token,
'pwdreset_time' => Temporal::utcNow()
'pwdreset_time' => DateTimeFormat::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
@ -92,7 +92,7 @@ function lostpass_content(App $a)
}
// Password reset requests expire in 60 minutes
if ($user['pwdreset_time'] < Temporal::utc('now - 1 hour')) {
if ($user['pwdreset_time'] < DateTimeFormat::utc('now - 1 hour')) {
$fields = [
'pwdreset' => null,
'pwdreset_time' => null

View file

@ -11,7 +11,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'include/acl_selectors.php';
require_once 'include/conversation.php';
@ -397,7 +397,7 @@ function message_content(App $a)
'body' => $body_e,
'delete' => L10n::t('Delete message'),
'to_name' => $to_name_e,
'date' => Temporal::local($message['created'], 'D, d M Y - g:i A'),
'date' => DateTimeFormat::local($message['created'], 'D, d M Y - g:i A'),
'ago' => relative_date($message['created']),
];
@ -498,7 +498,7 @@ function render_messages(array $msg, $t)
'$delete' => L10n::t('Delete conversation'),
'$body' => $body_e,
'$to_name' => $to_name_e,
'$date' => Temporal::local($rr['mailcreated'], L10n::t('D, d M Y - g:i A')),
'$date' => DateTimeFormat::local($rr['mailcreated'], L10n::t('D, d M Y - g:i A')),
'$ago' => relative_date($rr['mailcreated']),
'$seen' => $rr['mailseen'],
'$count' => L10n::tt('%d message', '%d messages', $rr['count']),

View file

@ -19,7 +19,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Profile;
use Friendica\Module\Login;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
require_once 'include/conversation.php';
require_once 'include/items.php';
@ -681,11 +681,11 @@ function networkThreadedView(App $a, $update = 0)
if ($datequery) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ",
dbesc(Temporal::convert($datequery, 'UTC', date_default_timezone_get()))));
dbesc(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
}
if ($datequery2) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ",
dbesc(Temporal::convert($datequery2, 'UTC', date_default_timezone_get()))));
dbesc(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
}
$sql_order = '';
@ -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::utcNow();
$bottom_limit = Temporal::utcNow();
$top_limit = DateTimeFormat::utcNow();
$bottom_limit = DateTimeFormat::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::utcNow();
$top_limit = DateTimeFormat::utcNow();
}
$items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item`

View file

@ -20,8 +20,8 @@ use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\DFRN;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
use Friendica\Util\Temporal;
require_once 'include/items.php';
require_once 'include/acl_selectors.php';
@ -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::utcNow()),
dbesc(DateTimeFormat::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::utcNow()),
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc($i[0]['uri']),
intval($page_owner_uid)
);
@ -402,7 +402,7 @@ function photos_post(App $a)
$resource_id = $a->argv[2];
if (!strlen($albname)) {
$albname = Temporal::localNow('Y');
$albname = DateTimeFormat::localNow('Y');
}
if (x($_POST,'rotate') !== false &&
@ -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::utcNow()),
dbesc(Temporal::utcNow()),
dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::utcNow()),
intval($item_id),
intval($page_owner_uid)
);
@ -738,7 +738,7 @@ function photos_post(App $a)
if (strlen($newalbum)) {
$album = $newalbum;
} else {
$album = Temporal::localNow('Y');
$album = DateTimeFormat::localNow('Y');
}
}
@ -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::utcNow('ymdhis'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . DateTimeFormat::utcNow('ymdhis'),
'height' => $hires['height'],
'width' => $hires['width'],
'album' => $hires['album'],

View file

@ -14,7 +14,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Util\Temporal;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\XML;
require_once 'include/datetime.php';
@ -225,8 +225,8 @@ 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::utc('now + 7 days')),
dbesc(Temporal::utcNow())
dbesc(DateTimeFormat::utc('now + 7 days')),
dbesc(DateTimeFormat::utcNow())
);
if (DBM::is_result($ev)) {
Cache::set($cachekey, $ev, CACHE_HOUR);
@ -237,7 +237,7 @@ function ping_init(App $a)
$all_events = count($ev);
if ($all_events) {
$str_now = Temporal::timezoneNow($a->timezone, 'Y-m-d');
$str_now = DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d');
foreach ($ev as $x) {
$bd = false;
if ($x['type'] === 'birthday') {
@ -246,7 +246,7 @@ function ping_init(App $a)
} else {
$events ++;
}
if (Temporal::convert($x['start'], ((intval($x['adjust'])) ? $a->timezone : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
if (DateTimeFormat::convert($x['start'], ((intval($x['adjust'])) ? $a->timezone : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
$all_events_today ++;