Refactor datetime_convert into Temporal::convert
- Changed parameter order to save space - Refactor select_timezone into Temporal::getTimezoneSelect - Refactor field_timezone into Temporal::getTimezoneField
This commit is contained in:
parent
d478ef6c6d
commit
dc366bf1f7
62 changed files with 512 additions and 432 deletions
15
boot.php
15
boot.php
|
@ -21,16 +21,15 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendida\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendida\Core\L10n;
|
||||
|
||||
require_once 'include/text.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -1144,14 +1143,14 @@ function feed_birthday($uid, $tz)
|
|||
if (DBM::is_result($p)) {
|
||||
$tmp_dob = substr($p[0]['dob'], 5);
|
||||
if (intval($tmp_dob)) {
|
||||
$y = datetime_convert($tz, $tz, 'now', 'Y');
|
||||
$y = Temporal::convert('now', $tz, $tz, 'Y');
|
||||
$bd = $y . '-' . $tmp_dob . ' 00:00';
|
||||
$t_dob = strtotime($bd);
|
||||
$now = strtotime(datetime_convert($tz, $tz, 'now'));
|
||||
$now = strtotime(Temporal::convert('now', $tz, $tz));
|
||||
if ($t_dob < $now) {
|
||||
$bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
|
||||
}
|
||||
$birthday = datetime_convert($tz, 'UTC', $bd, ATOM_TIME);
|
||||
$birthday = Temporal::convert($bd, 'UTC', $tz, ATOM_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,24 +5,25 @@
|
|||
* @file include/api.php
|
||||
* @todo Automatically detect if incoming data is HTML or BBCode
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\FKOAuth1;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -31,11 +32,12 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
|
|||
use Friendica\Network\HTTPException\MethodNotAllowedException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Friendica\Network\HTTPException\NotImplementedException;
|
||||
use Friendica\Network\HTTPException\UnauthorizedException;
|
||||
use Friendica\Network\HTTPException\TooManyRequestsException;
|
||||
use Friendica\Network\HTTPException\UnauthorizedException;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -109,7 +111,7 @@ function api_source()
|
|||
function api_date($str)
|
||||
{
|
||||
// Wed May 23 06:01:13 +0000 2007
|
||||
return datetime_convert('UTC', 'UTC', $str, "D M d H:i:s +0000 Y");
|
||||
return Temporal::convert($str, 'UTC', 'UTC', "D M d H:i:s +0000 Y");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -458,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' => datetime_convert('UTC', 'UTC', 'now', ATOM_TIME),
|
||||
'atom_updated' => Temporal::convert('now', 'UTC', 'UTC', ATOM_TIME),
|
||||
'language' => $user_info['language'],
|
||||
'logo' => System::baseUrl() . "/images/friendica-32.png",
|
||||
];
|
||||
|
@ -3205,7 +3207,7 @@ function api_account_rate_limit_status($type)
|
|||
'@attributes' => ["type" => "integer"],
|
||||
'hourly-limit' => '150',
|
||||
'@attributes2' => ["type" => "integer"],
|
||||
'reset-time' => datetime_convert('UTC', 'UTC', 'now + 1 hour', ATOM_TIME),
|
||||
'reset-time' => Temporal::convert('now + 1 hour', 'UTC', 'UTC', ATOM_TIME),
|
||||
'@attributes3' => ["type" => "datetime"],
|
||||
'reset_time_in_seconds' => strtotime('now + 1 hour'),
|
||||
'@attributes4' => ["type" => "integer"],
|
||||
|
@ -3215,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(datetime_convert('UTC', 'UTC', 'now + 1 hour', ATOM_TIME)),
|
||||
'reset_time' => api_date(Temporal::convert('now + 1 hour', 'UTC', 'UTC', ATOM_TIME)),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -4214,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,
|
||||
datetime_convert(), // update edited timestamp
|
||||
Temporal::convert(), // update edited timestamp
|
||||
intval(api_user()),
|
||||
dbesc($photo_id),
|
||||
dbesc($album)
|
||||
|
@ -4418,7 +4420,7 @@ function api_account_update_profile_image($type)
|
|||
|
||||
q(
|
||||
"UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Temporal;
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
|
||||
require_once 'include/event.php';
|
||||
|
@ -241,20 +243,19 @@ function format_event_diaspora($ev) {
|
|||
|
||||
$o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n";
|
||||
|
||||
// @todo What. Is. Going. On. With. This. Useless. Ternary. Operator? - mrpetovan
|
||||
$o .= L10n::t('Starts:') . ' ' . '['
|
||||
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['start'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['start'] , $bd_format)))
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
|
||||
. (($ev['adjust']) ? day_translate(Temporal::convert($ev['start'], 'UTC', 'UTC', $bd_format))
|
||||
: day_translate(Temporal::convert($ev['start'], 'UTC', 'UTC', $bd_format))
|
||||
)
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::convert($ev['start'])) . ")\n";
|
||||
|
||||
if (! $ev['nofinish']) {
|
||||
$o .= L10n::t('Finishes:') . ' ' . '['
|
||||
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['finish'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['finish'] , $bd_format )))
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n";
|
||||
. (($ev['adjust']) ? day_translate(Temporal::convert($ev['finish'], 'UTC', 'UTC', $bd_format))
|
||||
: day_translate(Temporal::convert($ev['finish'], 'UTC', 'UTC', $bd_format))
|
||||
)
|
||||
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(Temporal::convert($ev['finish'])) . ")\n";
|
||||
}
|
||||
|
||||
if (strlen($ev['location'])) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file include/conversation.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
|
@ -13,9 +14,10 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Object\Thread;
|
||||
use Friendica\Object\Post;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Object\Thread;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once "include/bbcode.php";
|
||||
require_once "include/acl_selectors.php";
|
||||
|
@ -788,7 +790,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
'categories' => $categories,
|
||||
'folders' => $folders,
|
||||
'text' => strip_tags($body_e),
|
||||
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
|
||||
'localtime' => Temporal::convert($item['created'], date_default_timezone_get(), 'UTC', 'r'),
|
||||
'ago' => (($item['app']) ? L10n::t('%s from %s', relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
||||
'location' => $location_e,
|
||||
'indent' => '',
|
||||
|
|
|
@ -7,18 +7,6 @@
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function select_timezone($current = 'America/Los_Angeles') {
|
||||
return Temporal::getTimezoneSelect($current);
|
||||
}
|
||||
|
||||
function field_timezone($name='timezone', $label='', $current = 'America/Los_Angeles', $help = ''){
|
||||
return Temporal::getTimezoneField($name, $label, $current, $help);
|
||||
}
|
||||
|
||||
function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d H:i:s") {
|
||||
return Temporal::convert($s, $to, $from, $fmt);
|
||||
}
|
||||
|
||||
function dob($dob) {
|
||||
return Temporal::getDateofBirthField($dob);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
||||
|
@ -187,7 +190,7 @@ class dba {
|
|||
|
||||
if ($log) {
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
@file_put_contents($a->config["system"]["db_log_index"], datetime_convert()."\t".
|
||||
@file_put_contents($a->config["system"]["db_log_index"], Temporal::convert()."\t".
|
||||
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
|
||||
basename($backtrace[1]["file"])."\t".
|
||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||
|
@ -492,7 +495,7 @@ class dba {
|
|||
$duration = round($duration, 3);
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
|
||||
@file_put_contents($a->config["system"]["db_log"], datetime_convert()."\t".$duration."\t".
|
||||
@file_put_contents($a->config["system"]["db_log"], Temporal::convert()."\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);
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
/**
|
||||
* @file include/enotify.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Emailer;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/html2bbcode.php';
|
||||
|
@ -450,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'] = datetime_convert();
|
||||
$datarray['date'] = Temporal::convert();
|
||||
$datarray['uid'] = $params['uid'];
|
||||
$datarray['link'] = $itemlink;
|
||||
$datarray['iid'] = $item_id;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* @brief functions specific to event handling
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -14,6 +13,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -26,15 +26,13 @@ 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(datetime_convert('UTC', date_default_timezone_get(),
|
||||
$ev['start'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['start'] , $bd_format)));
|
||||
$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_end = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
||||
$ev['finish'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['finish'] , $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 )));
|
||||
|
||||
if ($simple) {
|
||||
$o = "<h3>" . bbcode($ev['summary']) . "</h3>";
|
||||
|
@ -59,13 +57,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="'
|
||||
. datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. Temporal::convert($ev['start'], 'UTC', 'UTC', (($ev['adjust']) ? ATOM_TIME : '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="'
|
||||
. datetime_convert('UTC', 'UTC', $ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. Temporal::convert($ev['finish'], 'UTC', 'UTC', (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. '" >'.$event_end
|
||||
. '</span></div>' . "\r\n";
|
||||
}
|
||||
|
@ -198,8 +196,8 @@ function sort_by_date($a) {
|
|||
|
||||
function ev_compare($a,$b) {
|
||||
|
||||
$date_a = (($a['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $a['start']) : $a['start']);
|
||||
$date_b = (($b['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $b['start']) : $b['start']);
|
||||
$date_a = (($a['adjust']) ? Temporal::convert($a['start'], date_default_timezone_get()) : $a['start']);
|
||||
$date_b = (($b['adjust']) ? Temporal::convert($b['start'], date_default_timezone_get()) : $b['start']);
|
||||
|
||||
if ($date_a === $date_b) {
|
||||
return strcasecmp($a['desc'], $b['desc']);
|
||||
|
@ -242,8 +240,8 @@ function event_store($arr) {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
$arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
|
||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||
$arr['created'] = (($arr['created']) ? $arr['created'] : Temporal::convert());
|
||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : Temporal::convert());
|
||||
$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']));
|
||||
|
@ -593,15 +591,15 @@ function process_events($arr) {
|
|||
$fmt = L10n::t('l, F j');
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $rr) {
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
|
||||
$d = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt));
|
||||
$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));
|
||||
$d = day_translate($d);
|
||||
|
||||
$start = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c'));
|
||||
$start = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'c') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'c'));
|
||||
if ($rr['nofinish']) {
|
||||
$end = null;
|
||||
} else {
|
||||
$end = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c'));
|
||||
$end = (($rr['adjust']) ? Temporal::convert($rr['finish'], date_default_timezone_get(), 'UTC', 'c') : Temporal::convert($rr['finish'], 'UTC', 'UTC', 'c'));
|
||||
}
|
||||
|
||||
$is_first = ($d !== $last_date);
|
||||
|
@ -926,22 +924,22 @@ 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(datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], $dformat)) : day_translate(datetime_convert('UTC', 'UTC', $item['event-start'], $dformat)));
|
||||
$dtstart_title = datetime_convert('UTC', 'UTC', $item['event-start'], (($item['event-adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s'));
|
||||
$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']) ? ATOM_TIME : 'Y-m-d\TH:i:s'));
|
||||
// Format: Jan till Dec.
|
||||
$month_short = (($item['event-adjust']) ? day_short_translate(datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], 'M')) : day_short_translate(datetime_convert('UTC', 'UTC', $item['event-start'], 'M')));
|
||||
$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')));
|
||||
// Format: 1 till 31.
|
||||
$date_short = (($item['event-adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], 'j') : datetime_convert('UTC', 'UTC', $item['event-start'], 'j'));
|
||||
$start_time = (($item['event-adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], $tformat) : datetime_convert('UTC', 'UTC', $item['event-start'], $tformat));
|
||||
$start_short = (($item['event-adjust']) ? day_short_translate(datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], $dformat_short)) : day_short_translate(datetime_convert('UTC', 'UTC', $item['event-start'], $dformat_short)));
|
||||
$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)));
|
||||
|
||||
// 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(datetime_convert('UTC', date_default_timezone_get(), $item['event-finish'], $dformat)) : day_translate(datetime_convert('UTC', 'UTC', $item['event-finish'], $dformat)));
|
||||
$dtend_title = datetime_convert('UTC', 'UTC', $item['event-finish'], (($item['event-adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s'));
|
||||
$end_short = (($item['event-adjust']) ? day_short_translate(datetime_convert('UTC', date_default_timezone_get(), $item['event-finish'], $dformat_short)) : day_short_translate(datetime_convert('UTC', 'UTC', $item['event-finish'], $dformat_short)));
|
||||
$end_time = (($item['event-adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $item['event-finish'], $tformat) : datetime_convert('UTC', 'UTC', $item['event-finish'], $tformat));
|
||||
$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']) ? ATOM_TIME : '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));
|
||||
// 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;
|
||||
|
|
|
@ -2,28 +2,29 @@
|
|||
/**
|
||||
* @file include/items.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
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\Model\Item;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Feed;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/tags.php';
|
||||
|
@ -415,7 +416,7 @@ function drop_item($id) {
|
|||
|
||||
/* arrange the list in years */
|
||||
function list_post_dates($uid, $wall) {
|
||||
$dnow = datetime_convert('',date_default_timezone_get(), 'now','Y-m-d');
|
||||
$dnow = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y-m-d');
|
||||
|
||||
$dthen = Item::firstPostDate($uid, $wall);
|
||||
if (!$dthen) {
|
||||
|
@ -436,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 = datetime_convert('', '', $dstart, 'Y-m-d');
|
||||
$end_month = datetime_convert('', '', $dend, 'Y-m-d');
|
||||
$str = day_translate(datetime_convert('', '', $dnow, 'F'));
|
||||
$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'));
|
||||
if (!$ret[$dyear]) {
|
||||
$ret[$dyear] = [];
|
||||
}
|
||||
$ret[$dyear][] = [$str, $end_month, $start_month];
|
||||
$dnow = datetime_convert('', '', $dnow . ' -1 month', 'Y-m-d');
|
||||
$dnow = Temporal::convert($dnow . ' -1 month', 'UTC', 'UTC', 'Y-m-d');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
@ -473,7 +474,7 @@ function posted_date_widget($url, $uid, $wall) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(), 'now', 'Y')) - $visible_years;
|
||||
$cutoff_year = intval(Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y')) - $visible_years;
|
||||
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
|
||||
|
||||
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* @file include/security.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -10,6 +10,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
/**
|
||||
* @brief Calculate the hash that is needed for the "Friendica" cookie
|
||||
|
@ -141,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' => datetime_convert()], ['uid' => $_SESSION['uid']]);
|
||||
dba::update('user', ['login_date' => Temporal::convert()], ['uid' => $_SESSION['uid']]);
|
||||
|
||||
// Set the login date for all identities of the user
|
||||
dba::update('user', ['login_date' => datetime_convert()],
|
||||
dba::update('user', ['login_date' => Temporal::convert()],
|
||||
['password' => $master_record['password'], 'email' => $master_record['email'], 'account_removed' => false]);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file include/text.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
|
@ -15,6 +16,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once "mod/proxy.php";
|
||||
require_once "include/conversation.php";
|
||||
|
@ -721,7 +723,7 @@ function logger($msg, $level = 0) {
|
|||
|
||||
$callers = debug_backtrace();
|
||||
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
||||
datetime_convert('UTC', 'UTC', 'now', 'Y-m-d\TH:i:s\Z'),
|
||||
Temporal::convert('now', 'UTC', 'UTC', 'Y-m-d\TH:i:s\Z'),
|
||||
$process_id,
|
||||
$LOGGER_LEVELS[$level],
|
||||
basename($callers[0]['file']),
|
||||
|
@ -787,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",
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
$process_id,
|
||||
basename($callers[0]['file']),
|
||||
$callers[0]['line'],
|
||||
|
|
|
@ -17,9 +17,10 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -739,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(datetime_convert()) - strtotime($last_worker_call)) > 60 * 60) {
|
||||
} elseif ((strtotime(Temporal::convert()) - 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);
|
||||
}
|
||||
|
|
16
mod/cal.php
16
mod/cal.php
|
@ -5,6 +5,7 @@
|
|||
* This calendar is for profile visitors and contains only the events
|
||||
* of the profile owner
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
|
@ -16,6 +17,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/event.php';
|
||||
|
||||
|
@ -150,8 +152,8 @@ function cal_content(App $a)
|
|||
|
||||
// The view mode part is similiar to /mod/events.php
|
||||
if ($mode == 'view') {
|
||||
$thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
|
||||
$thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
|
||||
$thisyear = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
$thismonth = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'm');
|
||||
if (!$y) {
|
||||
$y = intval($thisyear);
|
||||
}
|
||||
|
@ -201,11 +203,11 @@ function cal_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
$finish = datetime_convert('UTC', 'UTC', $finish);
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
|
||||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
|
@ -229,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']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
if (!x($links, $j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/contacts.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Nav;
|
||||
|
@ -16,6 +17,7 @@ use Friendica\Model\GContact;
|
|||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'mod/proxy.php';
|
||||
|
||||
|
@ -538,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') : datetime_convert('UTC', date_default_timezone_get(), $contact['last-update'], 'D, j M Y, g:i A'));
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : Temporal::convert($contact['last-update'], date_default_timezone_get(), 'UTC', '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"));
|
||||
|
|
|
@ -32,6 +32,7 @@ use Friendica\Network\Probe;
|
|||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
|
@ -326,8 +327,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
`network` = '%s' WHERE `id` = %d
|
||||
",
|
||||
intval($new_relation),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($duplex),
|
||||
intval($hidden),
|
||||
dbesc(NETWORK_DFRN),
|
||||
|
@ -377,8 +378,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
`rel` = %d
|
||||
WHERE `id` = %d
|
||||
",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($addr),
|
||||
dbesc($notify),
|
||||
dbesc($poll),
|
||||
|
@ -618,8 +619,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
`network` = '%s' WHERE `id` = %d
|
||||
",
|
||||
intval($new_relation),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($duplex),
|
||||
intval($forum),
|
||||
intval($prv),
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* You also find a graphic which describes the confirmation process at
|
||||
* https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_request.png
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -19,11 +20,12 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
|
||||
|
@ -135,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()),
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
dbesc($dfrn_url),
|
||||
dbesc(normalise_link($dfrn_url)),
|
||||
$parms['addr'],
|
||||
|
@ -239,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(datetime_convert('UTC', 'UTC', 'now - 24 hours')),
|
||||
dbesc(Temporal::convert('now - 24 hours')),
|
||||
intval($uid)
|
||||
);
|
||||
if (DBM::is_result($r) && count($r) > $maxreq) {
|
||||
|
@ -380,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
$parms['url'],
|
||||
dbesc(normalise_link($url)),
|
||||
$parms['addr'],
|
||||
|
@ -428,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(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
* @file mod/events.php
|
||||
* @brief The events module
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -75,14 +76,14 @@ function events_post(App $a) {
|
|||
}
|
||||
|
||||
if ($adjust) {
|
||||
$start = datetime_convert(date_default_timezone_get(), 'UTC', $start);
|
||||
$start = Temporal::convert($start, 'UTC', date_default_timezone_get());
|
||||
if (! $nofinish) {
|
||||
$finish = datetime_convert(date_default_timezone_get(), 'UTC', $finish);
|
||||
$finish = Temporal::convert($finish, 'UTC', date_default_timezone_get());
|
||||
}
|
||||
} else {
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
$start = Temporal::convert($start);
|
||||
if (! $nofinish) {
|
||||
$finish = datetime_convert('UTC', 'UTC', $finish);
|
||||
$finish = Temporal::convert($finish);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,8 +276,8 @@ function events_content(App $a) {
|
|||
// The view mode part is similiar to /mod/cal.php
|
||||
if ($mode == 'view') {
|
||||
|
||||
$thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
|
||||
$thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
|
||||
$thisyear = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
$thismonth = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'm');
|
||||
if (! $y) {
|
||||
$y = intval($thisyear);
|
||||
}
|
||||
|
@ -322,11 +323,11 @@ function events_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
$finish = datetime_convert('UTC', 'UTC', $finish);
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
|
||||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
|
@ -350,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']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
if (! x($links,$j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
@ -464,19 +465,19 @@ function events_content(App $a) {
|
|||
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
|
||||
}
|
||||
|
||||
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
|
||||
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
|
||||
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
|
||||
$syear = Temporal::convert($sdt, $tz, 'UTC', 'Y');
|
||||
$smonth = Temporal::convert($sdt, $tz, 'UTC', 'm');
|
||||
$sday = Temporal::convert($sdt, $tz, 'UTC', 'd');
|
||||
|
||||
$shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0);
|
||||
$sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : 0);
|
||||
$shour = ((x($orig_event)) ? Temporal::convert($sdt, $tz, 'UTC', 'H') : 0);
|
||||
$sminute = ((x($orig_event)) ? Temporal::convert($sdt, $tz, 'UTC', 'i') : 0);
|
||||
|
||||
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
|
||||
$fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
|
||||
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
|
||||
$fyear = Temporal::convert($fdt, $tz, 'UTC', 'Y');
|
||||
$fmonth = Temporal::convert($fdt, $tz, 'UTC', 'm');
|
||||
$fday = Temporal::convert($fdt, $tz, 'UTC', 'd');
|
||||
|
||||
$fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0);
|
||||
$fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0);
|
||||
$fhour = ((x($orig_event)) ? Temporal::convert($fdt, $tz, 'UTC', 'H') : 0);
|
||||
$fminute = ((x($orig_event)) ? Temporal::convert($fdt, $tz, 'UTC', 'i') : 0);
|
||||
|
||||
require_once 'include/acl_selectors.php' ;
|
||||
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
/**
|
||||
* @file mod/fsuggest.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function fsuggest_post(App $a)
|
||||
{
|
||||
|
@ -50,7 +52,7 @@ function fsuggest_post(App $a)
|
|||
dbesc($r[0]['request']),
|
||||
dbesc($r[0]['photo']),
|
||||
dbesc($hash),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($hash),
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/install.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
|
@ -9,6 +10,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
$install_wizard_pass = 1;
|
||||
|
||||
|
@ -279,7 +281,7 @@ function install_content(App $a) {
|
|||
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
|
||||
|
||||
|
||||
'$timezone' => field_timezone('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
|
||||
'$timezone' => Temporal::getTimezoneField('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
|
||||
'$language' => ['language', L10n::t('System Language:'), 'en', L10n::t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices],
|
||||
'$baseurl' => System::baseUrl(),
|
||||
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
* Send email invitations to join social network
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function invite_post(App $a)
|
||||
{
|
||||
|
@ -60,7 +62,7 @@ function invite_post(App $a)
|
|||
|
||||
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
|
||||
dbesc($code),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
|
||||
if (! is_site_admin()) {
|
||||
|
|
17
mod/item.php
17
mod/item.php
|
@ -14,6 +14,7 @@
|
|||
* All of these become an "item" which is our basic unit of
|
||||
* information.
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
|
@ -25,10 +26,10 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Util\Emailer;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
require_once 'include/tags.php';
|
||||
|
@ -600,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'] = datetime_convert();
|
||||
$datarray['edited'] = datetime_convert();
|
||||
$datarray['commented'] = datetime_convert();
|
||||
$datarray['received'] = datetime_convert();
|
||||
$datarray['changed'] = datetime_convert();
|
||||
$datarray['created'] = Temporal::convert();
|
||||
$datarray['edited'] = Temporal::convert();
|
||||
$datarray['commented'] = Temporal::convert();
|
||||
$datarray['received'] = Temporal::convert();
|
||||
$datarray['changed'] = Temporal::convert();
|
||||
$datarray['extid'] = $extid;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $uri;
|
||||
|
@ -708,8 +709,8 @@ function item_post(App $a) {
|
|||
'file' => $datarray['file'],
|
||||
'rendered-html' => $datarray['rendered-html'],
|
||||
'rendered-hash' => $datarray['rendered-hash'],
|
||||
'edited' => datetime_convert(),
|
||||
'changed' => datetime_convert()];
|
||||
'edited' => Temporal::convert(),
|
||||
'changed' => Temporal::convert()];
|
||||
|
||||
Item::update($fields, ['id' => $post_id]);
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
/**
|
||||
* @file mod/localtime.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
|
@ -18,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'] = datetime_convert('UTC', $_POST['timezone'], $t, $bd_format);
|
||||
$a->data['mod-localtime'] = Temporal::convert($t, $_POST['timezone'], 'UTC', $bd_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +52,7 @@ function localtime_content(App $a)
|
|||
|
||||
$o .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
|
||||
|
||||
$o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
|
||||
$o .= Temporal::getTimezoneSelect(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
|
||||
|
||||
$o .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -32,7 +33,7 @@ function lostpass_post(App $a)
|
|||
|
||||
$fields = [
|
||||
'pwdreset' => $pwdreset_token,
|
||||
'pwdreset_time' => datetime_convert()
|
||||
'pwdreset_time' => Temporal::convert()
|
||||
];
|
||||
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
|
||||
if ($result) {
|
||||
|
@ -91,7 +92,7 @@ function lostpass_content(App $a)
|
|||
}
|
||||
|
||||
// Password reset requests expire in 60 minutes
|
||||
if ($user['pwdreset_time'] < datetime_convert('UTC', 'UTC', 'now - 1 hour')) {
|
||||
if ($user['pwdreset_time'] < Temporal::convert('now - 1 hour')) {
|
||||
$fields = [
|
||||
'pwdreset' => null,
|
||||
'pwdreset_time' => null
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/message.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Smilies;
|
||||
|
@ -10,6 +11,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/conversation.php';
|
||||
|
@ -395,7 +397,7 @@ function message_content(App $a)
|
|||
'body' => $body_e,
|
||||
'delete' => L10n::t('Delete message'),
|
||||
'to_name' => $to_name_e,
|
||||
'date' => datetime_convert('UTC', date_default_timezone_get(), $message['created'], 'D, d M Y - g:i A'),
|
||||
'date' => Temporal::convert($message['created'], date_default_timezone_get(), 'UTC', 'D, d M Y - g:i A'),
|
||||
'ago' => relative_date($message['created']),
|
||||
];
|
||||
|
||||
|
@ -496,7 +498,7 @@ function render_messages(array $msg, $t)
|
|||
'$delete' => L10n::t('Delete conversation'),
|
||||
'$body' => $body_e,
|
||||
'$to_name' => $to_name_e,
|
||||
'$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['mailcreated'], L10n::t('D, d M Y - g:i A')),
|
||||
'$date' => Temporal::convert($rr['mailcreated'], date_default_timezone_get(), 'UTC', 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']),
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
/**
|
||||
* @file mod/network.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -18,6 +19,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/items.php';
|
||||
|
@ -679,11 +681,11 @@ function networkThreadedView(App $a, $update = 0)
|
|||
|
||||
if ($datequery) {
|
||||
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ",
|
||||
dbesc(datetime_convert(date_default_timezone_get(), '', $datequery))));
|
||||
dbesc(Temporal::convert($datequery, 'UTC', date_default_timezone_get()))));
|
||||
}
|
||||
if ($datequery2) {
|
||||
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ",
|
||||
dbesc(datetime_convert(date_default_timezone_get(), '', $datequery2))));
|
||||
dbesc(Temporal::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
||||
}
|
||||
|
||||
$sql_order = '';
|
||||
|
@ -788,8 +790,8 @@ function networkThreadedView(App $a, $update = 0)
|
|||
$top_limit = current($r)['order_date'];
|
||||
$bottom_limit = end($r)['order_date'];
|
||||
} else {
|
||||
$top_limit = datetime_convert();
|
||||
$bottom_limit = datetime_convert();
|
||||
$top_limit = Temporal::convert();
|
||||
$bottom_limit = Temporal::convert();
|
||||
}
|
||||
|
||||
// When checking for updates we need to fetch from the newest date to the newest date before
|
||||
|
@ -802,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 = datetime_convert();
|
||||
$top_limit = Temporal::convert();
|
||||
}
|
||||
|
||||
$items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item`
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
/**
|
||||
* @file mod/photos.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -19,6 +20,8 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
@ -288,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($rr['parent-uri']),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
@ -361,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(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($i[0]['uri']),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
@ -399,7 +402,7 @@ function photos_post(App $a)
|
|||
$resource_id = $a->argv[2];
|
||||
|
||||
if (!strlen($albname)) {
|
||||
$albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
|
||||
$albname = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
}
|
||||
|
||||
if (x($_POST,'rotate') !== false &&
|
||||
|
@ -646,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(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($item_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
@ -735,7 +738,7 @@ function photos_post(App $a)
|
|||
if (strlen($newalbum)) {
|
||||
$album = $newalbum;
|
||||
} else {
|
||||
$album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
|
||||
$album = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1358,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=' . datetime_convert('','','','ymdhis'),
|
||||
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . Temporal::convert('now', 'UTC', 'UTC', 'ymdhis'),
|
||||
'height' => $hires['height'],
|
||||
'width' => $hires['width'],
|
||||
'album' => $hires['album'],
|
||||
|
|
14
mod/ping.php
14
mod/ping.php
|
@ -2,17 +2,19 @@
|
|||
/**
|
||||
* @file include/ping.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -223,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(datetime_convert('UTC', 'UTC', 'now + 7 days')),
|
||||
dbesc(datetime_convert('UTC', 'UTC', 'now'))
|
||||
dbesc(Temporal::convert('now + 7 days')),
|
||||
dbesc(Temporal::convert('now'))
|
||||
);
|
||||
if (DBM::is_result($ev)) {
|
||||
Cache::set($cachekey, $ev, CACHE_HOUR);
|
||||
|
@ -235,7 +237,7 @@ function ping_init(App $a)
|
|||
$all_events = count($ev);
|
||||
|
||||
if ($all_events) {
|
||||
$str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d');
|
||||
$str_now = Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d');
|
||||
foreach ($ev as $x) {
|
||||
$bd = false;
|
||||
if ($x['type'] === 'birthday') {
|
||||
|
@ -244,7 +246,7 @@ function ping_init(App $a)
|
|||
} else {
|
||||
$events ++;
|
||||
}
|
||||
if (datetime_convert('UTC', ((intval($x['adjust'])) ? $a->timezone : 'UTC'), $x['start'], 'Y-m-d') === $str_now) {
|
||||
if (Temporal::convert($x['start'], ((intval($x['adjust'])) ? $a->timezone : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
|
||||
$all_events_today ++;
|
||||
if ($bd) {
|
||||
$birthdays_today ++;
|
||||
|
@ -360,7 +362,7 @@ function ping_init(App $a)
|
|||
$notif['photo'] = proxy_url($notif['photo'], false, PROXY_SIZE_MICRO);
|
||||
}
|
||||
|
||||
$local_time = datetime_convert('UTC', date_default_timezone_get(), $notif['date']);
|
||||
$local_time = Temporal::convert($notif['date'], date_default_timezone_get());
|
||||
|
||||
$notifications[] = [
|
||||
'id' => $notif['id'],
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
/**
|
||||
* @file mod/profile.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -15,6 +16,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function profile_init(App $a)
|
||||
{
|
||||
|
@ -270,10 +272,10 @@ function profile_content(App $a, $update = 0)
|
|||
}
|
||||
|
||||
if ($datequery) {
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(), '', $datequery))));
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", dbesc(Temporal::convert($datequery, 'UTC', date_default_timezone_get()))));
|
||||
}
|
||||
if ($datequery2) {
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(), '', $datequery2))));
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(Temporal::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
||||
}
|
||||
|
||||
// Belongs the profile page to a forum?
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/profile_photo.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -11,6 +12,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function profile_photo_init(App $a)
|
||||
{
|
||||
|
@ -128,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
|
@ -228,7 +230,7 @@ function profile_photo_content(App $a) {
|
|||
);
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/profiles.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
|
@ -17,6 +18,7 @@ use Friendica\Model\GContact;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function profiles_init(App $a) {
|
||||
|
||||
|
@ -216,7 +218,7 @@ function profiles_post(App $a) {
|
|||
$ignore_year = true;
|
||||
$dob = substr($dob, 5);
|
||||
}
|
||||
$dob = datetime_convert('UTC', 'UTC', (($ignore_year) ? '1900-' . $dob : $dob), (($ignore_year) ? 'm-d' : 'Y-m-d'));
|
||||
$dob = Temporal::convert((($ignore_year) ? '1900-' . $dob : $dob), 'UTC', 'UTC', (($ignore_year) ? 'm-d' : 'Y-m-d'));
|
||||
|
||||
if ($ignore_year) {
|
||||
$dob = '0000-' . $dob;
|
||||
|
@ -250,7 +252,7 @@ function profiles_post(App $a) {
|
|||
if (! strlen($howlong)) {
|
||||
$howlong = NULL_DATE;
|
||||
} else {
|
||||
$howlong = datetime_convert(date_default_timezone_get(), 'UTC', $howlong);
|
||||
$howlong = Temporal::convert($howlong, 'UTC', date_default_timezone_get());
|
||||
}
|
||||
// linkify the relationship target if applicable
|
||||
|
||||
|
@ -485,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",
|
||||
|
@ -722,7 +724,7 @@ function profiles_content(App $a) {
|
|||
'$gender' => ContactSelector::gender($r[0]['gender']),
|
||||
'$marital' => ContactSelector::maritalStatus($r[0]['marital']),
|
||||
'$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
|
||||
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))],
|
||||
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : Temporal::convert($r[0]['howlong'], date_default_timezone_get()))],
|
||||
'$sexual' => ContactSelector::sexualPreference($r[0]['sexual']),
|
||||
'$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']],
|
||||
'$xmpp' => ['xmpp', L10n::t("XMPP \x28Jabber\x29 address:"), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")],
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
|
||||
|
||||
|
@ -187,7 +188,7 @@ function proxy_init(App $a) {
|
|||
die();
|
||||
}
|
||||
|
||||
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => datetime_convert(), 'edited' => datetime_convert(),
|
||||
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => Temporal::convert(), 'edited' => Temporal::convert(),
|
||||
'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];
|
||||
|
|
|
@ -5,6 +5,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function post_var($name) {
|
||||
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
|
||||
|
@ -138,7 +139,7 @@ function pubsubhubbub_init(App $a) {
|
|||
dbesc($hub_callback));
|
||||
|
||||
if ($subscribe) {
|
||||
$last_update = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
|
||||
$last_update = Temporal::convert();
|
||||
$push_flag = 0;
|
||||
|
||||
// if we are just updating an old subscription, keep the
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/register.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
|
@ -10,6 +11,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -116,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($user['uid']),
|
||||
dbesc($result['password']),
|
||||
dbesc($lang),
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function get_theme_config_file($theme)
|
||||
{
|
||||
|
@ -630,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(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
@ -1210,7 +1211,7 @@ function settings_content(App $a)
|
|||
'$h_basic' => L10n::t('Basic Settings'),
|
||||
'$username' => ['username', L10n::t('Full Name:'), $username, ''],
|
||||
'$email' => ['email', L10n::t('Email Address:'), $email, '', '', '', 'email'],
|
||||
'$timezone' => ['timezone_select' , L10n::t('Your Timezone:'), select_timezone($timezone), ''],
|
||||
'$timezone' => ['timezone_select' , L10n::t('Your Timezone:'), Temporal::getTimezoneSelect($timezone), ''],
|
||||
'$language' => ['language', L10n::t('Your Language:'), $language, L10n::t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
|
||||
'$defloc' => ['defloc', L10n::t('Default Post Location:'), $defloc, ''],
|
||||
'$allowloc' => ['allow_location', L10n::t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''],
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/videos.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config;
|
||||
|
@ -13,6 +14,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
@ -168,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(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($i[0]['uri']),
|
||||
intval(local_user())
|
||||
);
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
/**
|
||||
* @file mod/wall_attach.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Mimetype;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
|
@ -122,7 +124,7 @@ function wall_attach_post(App $a) {
|
|||
$filedata = @file_get_contents($src);
|
||||
$mimetype = Mimetype::getContentType($filename);
|
||||
$hash = get_guid(64);
|
||||
$created = datetime_convert();
|
||||
$created = Temporal::convert();
|
||||
|
||||
$fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
|
||||
'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Content/OEmbed.php
|
||||
*/
|
||||
|
@ -6,16 +7,18 @@ namespace Friendica\Content;
|
|||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use DOMNode;
|
||||
use DOMText;
|
||||
use DOMXPath;
|
||||
use Exception;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -110,7 +113,7 @@ class OEmbed
|
|||
'url' => normalise_link($embedurl),
|
||||
'maxwidth' => $a->videowidth,
|
||||
'content' => $txt,
|
||||
'created' => datetime_convert()
|
||||
'created' => Temporal::convert()
|
||||
], true);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Memcache;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -34,7 +35,7 @@ class Cache
|
|||
$memcache_host = Config::get('system', 'memcache_host', '127.0.0.1');
|
||||
$memcache_port = Config::get('system', 'memcache_port', 11211);
|
||||
|
||||
$memcache = new \Memcache;
|
||||
$memcache = new Memcache;
|
||||
|
||||
if (!$memcache->connect($memcache_host, $memcache_port)) {
|
||||
return false;
|
||||
|
@ -146,7 +147,7 @@ class Cache
|
|||
$memcache->set(get_app()->get_hostname().":".$key, serialize($value), MEMCACHE_COMPRESSED, self::duration($duration));
|
||||
return;
|
||||
}
|
||||
$fields = ['v' => serialize($value), 'expire_mode' => $duration, 'updated' => datetime_convert()];
|
||||
$fields = ['v' => serialize($value), 'expire_mode' => $duration, 'updated' => Temporal::convert()];
|
||||
$condition = ['k' => $key];
|
||||
dba::update('cache', $fields, $condition, true);
|
||||
}
|
||||
|
@ -164,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 30 days"),
|
||||
Temporal::convert("now - 30 days"),
|
||||
CACHE_MONTH];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
||||
if ($max_level <= CACHE_WEEK) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 7 days"),
|
||||
Temporal::convert("now - 7 days"),
|
||||
CACHE_WEEK];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
||||
if ($max_level <= CACHE_DAY) {
|
||||
$condition = ["`updated` < ? AND `expire_mode` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 1 days"),
|
||||
Temporal::convert("now - 1 days"),
|
||||
CACHE_DAY];
|
||||
dba::delete('cache', $condition);
|
||||
}
|
||||
|
@ -187,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 1 hours"),
|
||||
Temporal::convert("now - 1 hours"),
|
||||
CACHE_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -196,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 30 minutes"),
|
||||
Temporal::convert("now - 30 minutes"),
|
||||
CACHE_HALF_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -205,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 15 minutes"),
|
||||
Temporal::convert("now - 15 minutes"),
|
||||
CACHE_QUARTER_HOUR];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -214,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 5 minutes"),
|
||||
Temporal::convert("now - 5 minutes"),
|
||||
CACHE_FIVE_MINUTES];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
@ -223,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` = ?",
|
||||
datetime_convert('UTC', 'UTC', "now - 1 minutes"),
|
||||
Temporal::convert("now - 1 minutes"),
|
||||
CACHE_MINUTE];
|
||||
dba::delete('cache', $condition);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/html2plain.php';
|
||||
|
@ -42,7 +43,7 @@ class NotificationsManager extends BaseObject
|
|||
{
|
||||
$rets = [];
|
||||
foreach ($notes as $n) {
|
||||
$local_time = datetime_convert('UTC', date_default_timezone_get(), $n['date']);
|
||||
$local_time = Temporal::convert($n['date'], date_default_timezone_get());
|
||||
$n['timestamp'] = strtotime($local_time);
|
||||
$n['date_rel'] = relative_date($n['date']);
|
||||
$n['msg_html'] = bbcode($n['msg'], false, false, false, false);
|
||||
|
@ -243,7 +244,7 @@ class NotificationsManager extends BaseObject
|
|||
$default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO);
|
||||
$default_item_url = $it['url'];
|
||||
$default_item_text = strip_tags(bbcode($it['msg']));
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['date'], 'r');
|
||||
$default_item_when = Temporal::convert($it['date'], date_default_timezone_get(), 'UTC', 'r');
|
||||
$default_item_ago = relative_date($it['date']);
|
||||
break;
|
||||
|
||||
|
@ -253,7 +254,7 @@ class NotificationsManager extends BaseObject
|
|||
$default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
|
||||
$default_item_url = $it['author-link'];
|
||||
$default_item_text = L10n::t("%s commented on %s's post", $it['author-name'], $it['pname']);
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
|
||||
$default_item_when = Temporal::convert($it['created'], date_default_timezone_get(), 'UTC', 'r');
|
||||
$default_item_ago = relative_date($it['created']);
|
||||
break;
|
||||
|
||||
|
@ -265,7 +266,7 @@ class NotificationsManager extends BaseObject
|
|||
$default_item_text = (($it['id'] == $it['parent'])
|
||||
? L10n::t("%s created a new post", $it['author-name'])
|
||||
: L10n::t("%s commented on %s's post", $it['author-name'], $it['pname']));
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
|
||||
$default_item_when = Temporal::convert($it['created'], date_default_timezone_get(), 'UTC', 'r');
|
||||
$default_item_ago = relative_date($it['created']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Process;
|
||||
use Friendica\Util\Lock;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -233,7 +235,7 @@ class Worker
|
|||
|
||||
if ($age > 1) {
|
||||
$stamp = (float)microtime(true);
|
||||
dba::update('workerqueue', ['executed' => datetime_convert()], ['pid' => $mypid, 'done' => false]);
|
||||
dba::update('workerqueue', ['executed' => Temporal::convert()], ['pid' => $mypid, 'done' => false]);
|
||||
self::$db_duration += (microtime(true) - $stamp);
|
||||
}
|
||||
|
||||
|
@ -243,7 +245,7 @@ class Worker
|
|||
|
||||
$stamp = (float)microtime(true);
|
||||
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
Config::set('system', 'last_poller_execution', datetime_convert());
|
||||
Config::set('system', 'last_poller_execution', Temporal::convert());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
|
||||
|
@ -276,7 +278,7 @@ class Worker
|
|||
|
||||
if ($age > 1) {
|
||||
$stamp = (float)microtime(true);
|
||||
dba::update('workerqueue', ['executed' => datetime_convert()], ['pid' => $mypid, 'done' => false]);
|
||||
dba::update('workerqueue', ['executed' => Temporal::convert()], ['pid' => $mypid, 'done' => false]);
|
||||
self::$db_duration += (microtime(true) - $stamp);
|
||||
}
|
||||
|
||||
|
@ -284,7 +286,7 @@ class Worker
|
|||
|
||||
$stamp = (float)microtime(true);
|
||||
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
Config::set('system', 'last_poller_execution', datetime_convert());
|
||||
Config::set('system', 'last_poller_execution', Temporal::convert());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
} else {
|
||||
|
@ -572,7 +574,7 @@ class Worker
|
|||
}
|
||||
dba::update(
|
||||
'workerqueue',
|
||||
['executed' => NULL_DATE, 'created' => datetime_convert(), 'priority' => $new_priority, 'pid' => 0],
|
||||
['executed' => NULL_DATE, 'created' => Temporal::convert(), 'priority' => $new_priority, 'pid' => 0],
|
||||
['id' => $entry["id"]]
|
||||
);
|
||||
} else {
|
||||
|
@ -823,7 +825,7 @@ class Worker
|
|||
if ($found) {
|
||||
$condition = "`id` IN (".substr(str_repeat("?, ", count($ids)), 0, -2).") AND `pid` = 0 AND NOT `done`";
|
||||
array_unshift($ids, $condition);
|
||||
dba::update('workerqueue', ['executed' => datetime_convert(), 'pid' => $mypid], $ids);
|
||||
dba::update('workerqueue', ['executed' => Temporal::convert(), 'pid' => $mypid], $ids);
|
||||
}
|
||||
|
||||
return $found;
|
||||
|
@ -951,7 +953,7 @@ class Worker
|
|||
|
||||
/// @todo We should clean up the corresponding workerqueue entries as well
|
||||
$condition = ["`created` < ? AND `command` = 'worker.php'",
|
||||
datetime_convert('UTC', 'UTC', "now - ".$timeout." minutes")];
|
||||
Temporal::convert("now - ".$timeout." minutes")];
|
||||
dba::delete('process', $condition);
|
||||
}
|
||||
|
||||
|
@ -1038,7 +1040,7 @@ class Worker
|
|||
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
$dont_fork = Config::get("system", "worker_dont_fork");
|
||||
$created = datetime_convert();
|
||||
$created = Temporal::convert();
|
||||
|
||||
if (is_int($run_parameter)) {
|
||||
$priority = $run_parameter;
|
||||
|
|
|
@ -112,7 +112,7 @@ class Contact extends BaseObject
|
|||
|
||||
$return = dba::insert('contact', [
|
||||
'uid' => $user['uid'],
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'self' => 1,
|
||||
'name' => $user['username'],
|
||||
'nick' => $user['nickname'],
|
||||
|
@ -129,9 +129,9 @@ class Contact extends BaseObject
|
|||
'poll' => System::baseUrl() . '/dfrn_poll/' . $user['nickname'],
|
||||
'confirm' => System::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
|
||||
'poco' => System::baseUrl() . '/poco/' . $user['nickname'],
|
||||
'name-date' => datetime_convert(),
|
||||
'uri-date' => datetime_convert(),
|
||||
'avatar-date' => datetime_convert(),
|
||||
'name-date' => Temporal::convert(),
|
||||
'uri-date' => Temporal::convert(),
|
||||
'avatar-date' => Temporal::convert(),
|
||||
'closeness' => 0
|
||||
]);
|
||||
|
||||
|
@ -210,10 +210,10 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
if ($contact['term-date'] <= NULL_DATE) {
|
||||
dba::update('contact', ['term-date' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['term-date' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
|
||||
if ($contact['url'] != '') {
|
||||
dba::update('contact', ['term-date' => datetime_convert()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
dba::update('contact', ['term-date' => Temporal::convert()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
}
|
||||
} else {
|
||||
/* @todo
|
||||
|
@ -224,7 +224,7 @@ class Contact extends BaseObject
|
|||
|
||||
/// @todo Check for contact vitality via probing
|
||||
$expiry = $contact['term-date'] . ' + 32 days ';
|
||||
if (datetime_convert() > datetime_convert('UTC', 'UTC', $expiry)) {
|
||||
if (Temporal::convert() > Temporal::convert($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'] < datetime_convert('', '', 'now -7 days'));
|
||||
$update_contact = ($contact['avatar-date'] < Temporal::convert('now -7 days'));
|
||||
|
||||
// We force the update if the avatar is empty
|
||||
if (!x($contact, 'avatar')) {
|
||||
|
@ -728,7 +728,7 @@ class Contact extends BaseObject
|
|||
if (!$contact_id) {
|
||||
dba::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'url' => $data["url"],
|
||||
'nurl' => normalise_link($data["url"]),
|
||||
'addr' => $data["addr"],
|
||||
|
@ -749,9 +749,9 @@ class Contact extends BaseObject
|
|||
'request' => $data["request"],
|
||||
'confirm' => $data["confirm"],
|
||||
'poco' => $data["poco"],
|
||||
'name-date' => datetime_convert(),
|
||||
'uri-date' => datetime_convert(),
|
||||
'avatar-date' => datetime_convert(),
|
||||
'name-date' => Temporal::convert(),
|
||||
'uri-date' => Temporal::convert(),
|
||||
'avatar-date' => Temporal::convert(),
|
||||
'writable' => 1,
|
||||
'blocked' => 0,
|
||||
'readonly' => 0,
|
||||
|
@ -823,13 +823,13 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
if (($data["addr"] != $contact["addr"]) || ($data["alias"] != $contact["alias"])) {
|
||||
$updated['uri-date'] = datetime_convert();
|
||||
$updated['uri-date'] = Temporal::convert();
|
||||
}
|
||||
if (($data["name"] != $contact["name"]) || ($data["nick"] != $contact["nick"])) {
|
||||
$updated['name-date'] = datetime_convert();
|
||||
$updated['name-date'] = Temporal::convert();
|
||||
}
|
||||
|
||||
$updated['avatar-date'] = datetime_convert();
|
||||
$updated['avatar-date'] = Temporal::convert();
|
||||
|
||||
dba::update('contact', $updated, ['id' => $contact_id], $contact);
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ class Contact extends BaseObject
|
|||
if ($photos) {
|
||||
dba::update(
|
||||
'contact',
|
||||
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => datetime_convert()],
|
||||
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => Temporal::convert()],
|
||||
['id' => $cid]
|
||||
);
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ class Contact extends BaseObject
|
|||
// create contact record
|
||||
dba::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'url' => $ret['url'],
|
||||
'nurl' => normalise_link($ret['url']),
|
||||
'addr' => $ret['addr'],
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/GlobalContact.php
|
||||
* @brief This file includes the GlobalContact class with directory related functions
|
||||
|
@ -14,6 +15,7 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Exception;
|
||||
|
||||
|
@ -118,12 +120,12 @@ class GContact
|
|||
intval($uid),
|
||||
intval($gcid),
|
||||
intval($zcid),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
} else {
|
||||
q(
|
||||
"UPDATE `glink` SET `updated` = '%s' WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($cid),
|
||||
intval($uid),
|
||||
intval($gcid),
|
||||
|
@ -715,8 +717,8 @@ class GContact
|
|||
dbesc($contact["url"]),
|
||||
dbesc(normalise_link($contact["url"])),
|
||||
dbesc($contact["photo"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($contact["location"]),
|
||||
dbesc($contact["about"]),
|
||||
intval($contact["hide"]),
|
||||
|
@ -1048,7 +1050,7 @@ class GContact
|
|||
|
||||
foreach ($r as $server) {
|
||||
self::fetchGsUsers($server["url"]);
|
||||
q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"]));
|
||||
q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(Temporal::convert()), dbesc($server["nurl"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use Friendica\Model\Term;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Text_LanguageDetect;
|
||||
|
||||
|
@ -148,7 +149,7 @@ class Item extends BaseObject
|
|||
|
||||
// Set the item to "deleted"
|
||||
dba::update('item', ['deleted' => true, 'title' => '', 'body' => '',
|
||||
'edited' => datetime_convert(), 'changed' => datetime_convert()],
|
||||
'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
|
||||
['id' => $item['id']]);
|
||||
|
||||
create_tags_from_item($item['id']);
|
||||
|
@ -300,11 +301,11 @@ class Item extends BaseObject
|
|||
$arr['owner-name'] = trim(defaults($arr, 'owner-name', ''));
|
||||
$arr['owner-link'] = trim(defaults($arr, 'owner-link', ''));
|
||||
$arr['owner-avatar'] = trim(defaults($arr, 'owner-avatar', ''));
|
||||
$arr['received'] = ((x($arr, 'received') !== false) ? datetime_convert('UTC','UTC', $arr['received']) : datetime_convert());
|
||||
$arr['created'] = ((x($arr, 'created') !== false) ? datetime_convert('UTC','UTC', $arr['created']) : $arr['received']);
|
||||
$arr['edited'] = ((x($arr, 'edited') !== false) ? datetime_convert('UTC','UTC', $arr['edited']) : $arr['created']);
|
||||
$arr['changed'] = ((x($arr, 'changed') !== false) ? datetime_convert('UTC','UTC', $arr['changed']) : $arr['created']);
|
||||
$arr['commented'] = ((x($arr, 'commented') !== false) ? datetime_convert('UTC','UTC', $arr['commented']) : $arr['created']);
|
||||
$arr['received'] = ((x($arr, 'received') !== false) ? Temporal::convert($arr['received']) : Temporal::convert());
|
||||
$arr['created'] = ((x($arr, 'created') !== false) ? Temporal::convert($arr['created']) : $arr['received']);
|
||||
$arr['edited'] = ((x($arr, 'edited') !== false) ? Temporal::convert($arr['edited']) : $arr['created']);
|
||||
$arr['changed'] = ((x($arr, 'changed') !== false) ? Temporal::convert($arr['changed']) : $arr['created']);
|
||||
$arr['commented'] = ((x($arr, 'commented') !== false) ? Temporal::convert($arr['commented']) : $arr['created']);
|
||||
$arr['title'] = trim(defaults($arr, 'title', ''));
|
||||
$arr['location'] = trim(defaults($arr, 'location', ''));
|
||||
$arr['coord'] = trim(defaults($arr, 'coord', ''));
|
||||
|
@ -340,13 +341,13 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Items cannot be stored before they happen ...
|
||||
if ($arr['created'] > datetime_convert()) {
|
||||
$arr['created'] = datetime_convert();
|
||||
if ($arr['created'] > Temporal::convert()) {
|
||||
$arr['created'] = Temporal::convert();
|
||||
}
|
||||
|
||||
// We haven't invented time travel by now.
|
||||
if ($arr['edited'] > datetime_convert()) {
|
||||
$arr['edited'] = datetime_convert();
|
||||
if ($arr['edited'] > Temporal::convert()) {
|
||||
$arr['edited'] = Temporal::convert();
|
||||
}
|
||||
|
||||
if (($arr['author-link'] == "") && ($arr['owner-link'] == "")) {
|
||||
|
@ -740,9 +741,9 @@ class Item extends BaseObject
|
|||
// update the commented timestamp on the parent
|
||||
// Only update "commented" if it is really a comment
|
||||
if (($arr['verb'] == ACTIVITY_POST) || !Config::get("system", "like_no_comment")) {
|
||||
dba::update('item', ['commented' => datetime_convert(), 'changed' => datetime_convert()], ['id' => $parent_id]);
|
||||
dba::update('item', ['commented' => Temporal::convert(), 'changed' => Temporal::convert()], ['id' => $parent_id]);
|
||||
} else {
|
||||
dba::update('item', ['changed' => datetime_convert()], ['id' => $parent_id]);
|
||||
dba::update('item', ['changed' => Temporal::convert()], ['id' => $parent_id]);
|
||||
}
|
||||
|
||||
if ($dsprsig) {
|
||||
|
@ -1642,7 +1643,7 @@ class Item extends BaseObject
|
|||
intval($wall ? 1 : 0)
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
return substr(datetime_convert('',date_default_timezone_get(), $r[0]['created']),0,10);
|
||||
return substr(Temporal::convert($r[0]['created'], date_default_timezone_get()),0,10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Mail.php
|
||||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -80,7 +82,7 @@ class Mail
|
|||
$handles = $recip_handle . ';' . $sender_handle;
|
||||
|
||||
$fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => datetime_convert(), 'updated' => datetime_convert(),
|
||||
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
|
@ -114,7 +116,7 @@ class Mail
|
|||
'replied' => 0,
|
||||
'uri' => $uri,
|
||||
'parent-uri' => $replyto,
|
||||
'created' => datetime_convert()
|
||||
'created' => Temporal::convert()
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -194,12 +196,12 @@ class Mail
|
|||
|
||||
$convid = null;
|
||||
$fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => datetime_convert(), 'updated' => datetime_convert(),
|
||||
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
}
|
||||
|
||||
|
||||
if (!$convid) {
|
||||
logger('send message: conversation not found.');
|
||||
return -4;
|
||||
|
@ -222,7 +224,7 @@ class Mail
|
|||
'replied' => 0,
|
||||
'uri' => $uri,
|
||||
'parent-uri' => $replyto,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'unknown' => 1
|
||||
]
|
||||
);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Photo.php
|
||||
* @brief This file contains the Photo class for database interface
|
||||
|
@ -8,11 +9,11 @@ namespace Friendica\Model;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -54,8 +55,8 @@ class Photo
|
|||
'contact-id' => $cid,
|
||||
'guid' => $guid,
|
||||
'resource-id' => $rid,
|
||||
'created' => datetime_convert(),
|
||||
'edited' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'edited' => Temporal::convert(),
|
||||
'filename' => basename($filename),
|
||||
'type' => $Image->getType(),
|
||||
'album' => $album,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -33,7 +34,7 @@ class Process extends BaseObject
|
|||
dba::transaction();
|
||||
|
||||
if (!dba::exists('process', ['pid' => $pid])) {
|
||||
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => datetime_convert()]);
|
||||
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => Temporal::convert()]);
|
||||
}
|
||||
|
||||
dba::commit();
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -555,8 +556,8 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
datetime_convert('UTC', 'UTC', 'now + 6 days'),
|
||||
datetime_convert('UTC', 'UTC', 'now')
|
||||
Temporal::convert('now + 6 days'),
|
||||
Temporal::convert('now')
|
||||
);
|
||||
if (DBM::is_result($s)) {
|
||||
$r = dba::inArray($s);
|
||||
|
@ -599,7 +600,7 @@ class Profile
|
|||
|
||||
$rr['link'] = $url;
|
||||
$rr['title'] = $rr['name'];
|
||||
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['date'] = day_translate(Temporal::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['startime'] = null;
|
||||
$rr['today'] = $today;
|
||||
}
|
||||
|
@ -643,8 +644,8 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
datetime_convert('UTC', 'UTC', 'now + 7 days'),
|
||||
datetime_convert('UTC', 'UTC', 'now - 1 days')
|
||||
Temporal::convert('now + 7 days'),
|
||||
Temporal::convert('now - 1 days')
|
||||
);
|
||||
|
||||
$r = [];
|
||||
|
@ -657,8 +658,8 @@ class Profile
|
|||
$total ++;
|
||||
}
|
||||
|
||||
$strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start'], 'Y-m-d');
|
||||
if ($strt === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
|
||||
$strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
|
||||
if ($strt === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
|
||||
$istoday = true;
|
||||
}
|
||||
|
||||
|
@ -673,17 +674,17 @@ class Profile
|
|||
$description = L10n::t('[No description]');
|
||||
}
|
||||
|
||||
$strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start']);
|
||||
$strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC');
|
||||
|
||||
if (substr($strt, 0, 10) < datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
|
||||
if (substr($strt, 0, 10) < Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$today = ((substr($strt, 0, 10) === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) ? true : false);
|
||||
$today = ((substr($strt, 0, 10) === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) ? true : false);
|
||||
|
||||
$rr['title'] = $title;
|
||||
$rr['description'] = $description;
|
||||
$rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['date'] = day_translate(Temporal::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['startime'] = $strt;
|
||||
$rr['today'] = $today;
|
||||
|
||||
|
@ -729,8 +730,8 @@ class Profile
|
|||
$short_bd_format = L10n::t('j F');
|
||||
|
||||
$val = intval($a->profile['dob']) ?
|
||||
day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format))
|
||||
: day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
|
||||
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));
|
||||
|
||||
$profile['birthday'] = [L10n::t('Birthday:'), $val];
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -19,9 +20,9 @@ class Queue
|
|||
public static function updateTime($id)
|
||||
{
|
||||
logger('queue: requeue item ' . $id);
|
||||
dba::update('queue', ['last' => datetime_convert()], ['id' => $id]);
|
||||
dba::update('queue', ['last' => Temporal::convert()], ['id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $id id
|
||||
*/
|
||||
|
@ -30,7 +31,7 @@ class Queue
|
|||
logger('queue: remove queue item ' . $id);
|
||||
dba::delete('queue', ['id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Checks if the communication with a given contact had problems recently
|
||||
*
|
||||
|
@ -45,9 +46,9 @@ class Queue
|
|||
AND `last` > UTC_TIMESTAMP() - INTERVAL 15 MINUTE LIMIT 1",
|
||||
intval($cid)
|
||||
);
|
||||
|
||||
|
||||
$was_delayed = DBM::is_result($r);
|
||||
|
||||
|
||||
// We set "term-date" to a current date if the communication has problems.
|
||||
// If the communication works again we reset this value.
|
||||
if ($was_delayed) {
|
||||
|
@ -56,10 +57,10 @@ class Queue
|
|||
);
|
||||
$was_delayed = !DBM::is_result($r);
|
||||
}
|
||||
|
||||
|
||||
return $was_delayed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $cid cid
|
||||
* @param string $network network
|
||||
|
@ -68,17 +69,17 @@ class Queue
|
|||
*/
|
||||
public static function add($cid, $network, $msg, $batch = false)
|
||||
{
|
||||
|
||||
|
||||
$max_queue = Config::get('system', 'max_contact_queue');
|
||||
if ($max_queue < 1) {
|
||||
$max_queue = 500;
|
||||
}
|
||||
|
||||
|
||||
$batch_queue = Config::get('system', 'max_batch_queue');
|
||||
if ($batch_queue < 1) {
|
||||
$batch_queue = 1000;
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `queue` INNER JOIN `contact` ON `queue`.`cid` = `contact`.`id`
|
||||
WHERE `queue`.`cid` = %d AND `contact`.`self` = 0 ",
|
||||
intval($cid)
|
||||
|
@ -93,7 +94,7 @@ class Queue
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => datetime_convert(), 'last' => datetime_convert(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
|
||||
|
||||
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => Temporal::convert(), 'last' => Temporal::convert(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -18,8 +18,10 @@ use Friendica\Model\Photo;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Exception;
|
||||
use LightOpenID;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
|
@ -286,7 +288,7 @@ class User
|
|||
$_SESSION['register'] = 1;
|
||||
$_SESSION['openid'] = $openid_url;
|
||||
|
||||
$openid = new \LightOpenID;
|
||||
$openid = new LightOpenID;
|
||||
$openid->identity = $openid_url;
|
||||
$openid->returnUrl = System::baseUrl() . '/openid';
|
||||
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
|
||||
|
@ -394,7 +396,7 @@ class User
|
|||
'verified' => $verified,
|
||||
'blocked' => $blocked,
|
||||
'timezone' => 'UTC',
|
||||
'register_date' => datetime_convert(),
|
||||
'register_date' => Temporal::convert(),
|
||||
'default-location' => ''
|
||||
]);
|
||||
|
||||
|
@ -611,7 +613,7 @@ class User
|
|||
dba::insert('userd', ['username' => $user['nickname']]);
|
||||
|
||||
// The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
|
||||
dba::update('user', ['account_removed' => true, 'account_expires_on' => datetime_convert()], ['uid' => $uid]);
|
||||
dba::update('user', ['account_removed' => true, 'account_expires_on' => Temporal::convert()], ['uid' => $uid]);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
|
|
|
@ -11,7 +11,10 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Exception;
|
||||
use LightOpenID;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -68,7 +71,7 @@ class Login extends BaseModule
|
|||
|
||||
// Otherwise it's probably an openid.
|
||||
try {
|
||||
$openid = new \LightOpenID;
|
||||
$openid = new LightOpenID;
|
||||
$openid->identity = $openid_url;
|
||||
$_SESSION['openid'] = $openid_url;
|
||||
$_SESSION['remember'] = $_POST['remember'];
|
||||
|
@ -118,7 +121,7 @@ class Login extends BaseModule
|
|||
|
||||
// if we haven't failed up this point, log them in.
|
||||
$_SESSION['remember'] = $_POST['remember'];
|
||||
$_SESSION['last_login_date'] = datetime_convert('UTC', 'UTC');
|
||||
$_SESSION['last_login_date'] = Temporal::convert();
|
||||
authenticate_success($record, true, true);
|
||||
|
||||
if (x($_SESSION, 'return_url')) {
|
||||
|
@ -217,10 +220,10 @@ class Login extends BaseModule
|
|||
// stays logged in for a long time, e.g. with "Remember Me"
|
||||
$login_refresh = false;
|
||||
if (!x($_SESSION['last_login_date'])) {
|
||||
$_SESSION['last_login_date'] = datetime_convert('UTC', 'UTC');
|
||||
$_SESSION['last_login_date'] = Temporal::convert();
|
||||
}
|
||||
if (strcmp(datetime_convert('UTC', 'UTC', 'now - 12 hours'), $_SESSION['last_login_date']) > 0) {
|
||||
$_SESSION['last_login_date'] = datetime_convert('UTC', 'UTC');
|
||||
if (strcmp(Temporal::convert('now - 12 hours'), $_SESSION['last_login_date']) > 0) {
|
||||
$_SESSION['last_login_date'] = Temporal::convert();
|
||||
$login_refresh = true;
|
||||
}
|
||||
authenticate_success($user, false, false, $login_refresh);
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\FKOAuthDataStore;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use OAuthServer;
|
||||
use OAuthSignatureMethod_HMAC_SHA1;
|
||||
|
@ -67,7 +68,7 @@ class FKOAuth1 extends OAuthServer
|
|||
$_SESSION['cid'] = $a->cid;
|
||||
}
|
||||
|
||||
dba::update('user', ['login_date' => datetime_convert()], ['uid' => $_SESSION['uid']]);
|
||||
dba::update('user', ['login_date' => Temporal::convert()], ['uid' => $_SESSION['uid']]);
|
||||
|
||||
Addon::callHooks('logged_in', $a->user);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -123,7 +124,7 @@ class Post extends BaseObject
|
|||
if (strtotime($item['edited']) - strtotime($item['created']) > 1) {
|
||||
$edited = [
|
||||
'label' => L10n::t('This entry was edited'),
|
||||
'date' => datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r'),
|
||||
'date' => Temporal::convert($item['edited'], date_default_timezone_get(), 'UTC', 'r'),
|
||||
'relative' => relative_date($item['edited'])
|
||||
];
|
||||
}
|
||||
|
@ -300,7 +301,7 @@ class Post extends BaseObject
|
|||
|
||||
$comment = $this->getCommentBox($indent);
|
||||
|
||||
if (strcmp(datetime_convert('UTC', 'UTC', $item['created']), datetime_convert('UTC', 'UTC', 'now - 12 hours')) > 0) {
|
||||
if (strcmp(Temporal::convert($item['created']), Temporal::convert('now - 12 hours')) > 0) {
|
||||
$shiny = 'shiny';
|
||||
}
|
||||
|
||||
|
@ -363,7 +364,7 @@ class Post extends BaseObject
|
|||
'osparkle' => $osparkle,
|
||||
'sparkle' => $sparkle,
|
||||
'title' => $title_e,
|
||||
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
|
||||
'localtime' => Temporal::convert($item['created'], date_default_timezone_get(), 'UTC', 'r'),
|
||||
'ago' => $item['app'] ? L10n::t('%s from %s', relative_date($item['created']), $item['app']) : relative_date($item['created']),
|
||||
'app' => $item['app'],
|
||||
'created' => relative_date($item['created']),
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Object\Image;
|
|||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
|
||||
|
@ -228,7 +229,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$check_date = datetime_convert('UTC', 'UTC', $last_update, 'Y-m-d H:i:s');
|
||||
$check_date = Temporal::convert($last_update);
|
||||
|
||||
$r = q(
|
||||
"SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
|
@ -420,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", datetime_convert('UTC', 'UTC', $item['created'] . '+00:00', ATOM_TIME));
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", Temporal::convert($item['created'] . '+00:00', 'UTC', 'UTC', ATOM_TIME));
|
||||
XML::addElement($doc, $mail, "dfrn:subject", $item['title']);
|
||||
XML::addElement($doc, $mail, "dfrn:content", $item['body']);
|
||||
|
||||
|
@ -586,7 +587,7 @@ class DFRN
|
|||
|
||||
/// @todo We need a way to transmit the different page flags like "PAGE_PRVGROUP"
|
||||
|
||||
XML::addElement($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME));
|
||||
XML::addElement($doc, $root, "updated", Temporal::convert("now", "UTC", "UTC", ATOM_TIME));
|
||||
|
||||
$author = self::addAuthor($doc, $owner, $authorelement, $public);
|
||||
$root->appendChild($author);
|
||||
|
@ -621,9 +622,9 @@ class DFRN
|
|||
|
||||
$author = $doc->createElement($authorelement);
|
||||
|
||||
$namdate = datetime_convert('UTC', 'UTC', $owner['name-date'].'+00:00', ATOM_TIME);
|
||||
$uridate = datetime_convert('UTC', 'UTC', $owner['uri-date'].'+00:00', ATOM_TIME);
|
||||
$picdate = datetime_convert('UTC', 'UTC', $owner['avatar-date'].'+00:00', ATOM_TIME);
|
||||
$namdate = Temporal::convert($owner['name-date'].'+00:00', 'UTC', 'UTC', ATOM_TIME);
|
||||
$uridate = Temporal::convert($owner['uri-date'].'+00:00', 'UTC', 'UTC', ATOM_TIME);
|
||||
$picdate = Temporal::convert($owner['avatar-date'].'+00:00', 'UTC', 'UTC', ATOM_TIME);
|
||||
|
||||
$attributes = [];
|
||||
|
||||
|
@ -902,7 +903,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
$attributes = ["ref" => $item['uri'], "when" => datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00', ATOM_TIME)];
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::convert($item['edited'] . '+00:00', 'UTC', 'UTC', ATOM_TIME)];
|
||||
return XML::createElement($doc, "at:deleted-entry", "", $attributes);
|
||||
}
|
||||
|
||||
|
@ -982,8 +983,8 @@ class DFRN
|
|||
XML::addElement($doc, $entry, "id", $item["uri"]);
|
||||
XML::addElement($doc, $entry, "title", $item["title"]);
|
||||
|
||||
XML::addElement($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"] . "+00:00", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"] . "+00:00", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "published", Temporal::convert($item["created"] . "+00:00", "UTC", "UTC", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::convert($item["edited"] . "+00:00", "UTC", "UTC", ATOM_TIME));
|
||||
|
||||
// "dfrn:env" is used to read the content
|
||||
XML::addElement($doc, $entry, "dfrn:env", base64url_encode($body, true));
|
||||
|
@ -1387,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(datetime_convert("UTC", "UTC", $birthday)),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc("birthday")
|
||||
);
|
||||
|
||||
|
@ -1405,10 +1406,10 @@ class DFRN
|
|||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
|
||||
intval($contact["uid"]),
|
||||
intval($contact["id"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert("UTC", "UTC", $birthday)),
|
||||
dbesc(datetime_convert("UTC", "UTC", $birthday . " + 1 day ")),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::convert($birthday . " + 1 day ")),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc("birthday")
|
||||
|
@ -1888,7 +1889,7 @@ class DFRN
|
|||
intval($suggest["cid"]),
|
||||
dbesc($suggest["body"]),
|
||||
dbesc($hash),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval(0)
|
||||
);
|
||||
|
||||
|
@ -2080,13 +2081,13 @@ class DFRN
|
|||
|
||||
if (self::isEditedTimestampNewer($current, $item)) {
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if (datetime_convert("UTC", "UTC", $item["edited"]) < $current["edited"]) {
|
||||
if (Temporal::convert($item["edited"]) < $current["edited"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = ['title' => $item["title"], 'body' => $item["body"],
|
||||
'tag' => $item["tag"], 'changed' => datetime_convert(),
|
||||
'edited' => datetime_convert("UTC", "UTC", $item["edited"])];
|
||||
'tag' => $item["tag"], 'changed' => Temporal::convert(),
|
||||
'edited' => Temporal::convert($item["edited"])];
|
||||
|
||||
$condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]];
|
||||
dba::update('item', $fields, $condition);
|
||||
|
@ -2421,7 +2422,7 @@ class DFRN
|
|||
|
||||
// Is there an existing item?
|
||||
if (DBM::is_result($current) && self::isEditedTimestampNewer($current[0], $item)
|
||||
&& (datetime_convert("UTC", "UTC", $item["edited"]) < $current[0]["edited"])
|
||||
&& (Temporal::convert($item["edited"]) < $current[0]["edited"])
|
||||
) {
|
||||
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -2752,9 +2753,9 @@ class DFRN
|
|||
}
|
||||
}
|
||||
if ($when) {
|
||||
$when = datetime_convert("UTC", "UTC", $when, "Y-m-d H:i:s");
|
||||
$when = Temporal::convert($when);
|
||||
} else {
|
||||
$when = datetime_convert("UTC", "UTC", "now", "Y-m-d H:i:s");
|
||||
$when = Temporal::convert("now");
|
||||
}
|
||||
|
||||
if (!$uri || !$importer["id"]) {
|
||||
|
@ -2835,7 +2836,7 @@ class DFRN
|
|||
`body` = '', `title` = ''
|
||||
WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
|
||||
dbesc($when),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($uri),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
@ -2848,7 +2849,7 @@ class DFRN
|
|||
`body` = '', `title` = ''
|
||||
WHERE `uri` = '%s' AND `uid` IN (0, %d)",
|
||||
dbesc($when),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($uri),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
@ -3156,8 +3157,8 @@ class DFRN
|
|||
return false;
|
||||
}
|
||||
|
||||
$existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
|
||||
$update_edited = datetime_convert('UTC', 'UTC', $update['edited']);
|
||||
$existing_edited = Temporal::convert($existing['edited']);
|
||||
$update_edited = Temporal::convert($update['edited']);
|
||||
|
||||
return (strcmp($existing_edited, $update_edited) < 0);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class Diaspora
|
|||
$r = q(
|
||||
"INSERT INTO `contact` (`uid`, `created`, `name`, `nick`, `addr`, `url`, `nurl`, `batch`, `network`, `rel`, `blocked`, `pending`, `writable`, `name-date`, `uri-date`, `avatar-date`)
|
||||
VALUES (0, '%s', '%s', 'relay', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, '%s', '%s', '%s')",
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
dbesc($addr),
|
||||
dbesc($addr),
|
||||
dbesc($server),
|
||||
|
@ -84,9 +84,9 @@ class Diaspora
|
|||
dbesc($batch),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval(CONTACT_IS_FOLLOWER),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
|
||||
$relais = q("SELECT `batch`, `id`, `name`,`network` FROM `contact` WHERE `uid` = 0 AND `batch` = '%s' LIMIT 1", dbesc($batch));
|
||||
|
@ -870,7 +870,7 @@ class Diaspora
|
|||
dbesc($arr["confirm"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($arr["url"]),
|
||||
dbesc($arr["network"])
|
||||
);
|
||||
|
@ -893,7 +893,7 @@ class Diaspora
|
|||
dbesc($arr["network"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1653,9 +1653,9 @@ class Diaspora
|
|||
$text = unxmlify($data->text);
|
||||
|
||||
if (isset($data->created_at)) {
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
} else {
|
||||
$created_at = datetime_convert();
|
||||
$created_at = Temporal::convert();
|
||||
}
|
||||
|
||||
if (isset($data->thread_parent_guid)) {
|
||||
|
@ -1785,7 +1785,7 @@ class Diaspora
|
|||
$msg_guid = notags(unxmlify($mesg->guid));
|
||||
$msg_conversation_guid = notags(unxmlify($mesg->conversation_guid));
|
||||
$msg_text = unxmlify($mesg->text);
|
||||
$msg_created_at = datetime_convert("UTC", "UTC", notags(unxmlify($mesg->created_at)));
|
||||
$msg_created_at = Temporal::convert(notags(unxmlify($mesg->created_at)));
|
||||
|
||||
if ($msg_conversation_guid != $guid) {
|
||||
logger("message conversation guid does not belong to the current conversation.");
|
||||
|
@ -1830,7 +1830,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => datetime_convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
|
||||
notification(
|
||||
[
|
||||
|
@ -1864,7 +1864,7 @@ class Diaspora
|
|||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$subject = notags(unxmlify($data->subject));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$participants = notags(unxmlify($data->participants));
|
||||
|
||||
$messages = $data->message;
|
||||
|
@ -1896,7 +1896,7 @@ class Diaspora
|
|||
dbesc($guid),
|
||||
dbesc($author),
|
||||
dbesc($created_at),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($subject),
|
||||
dbesc($participants)
|
||||
);
|
||||
|
@ -2097,7 +2097,7 @@ class Diaspora
|
|||
$guid = notags(unxmlify($data->guid));
|
||||
$conversation_guid = notags(unxmlify($data->conversation_guid));
|
||||
$text = unxmlify($data->text);
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
|
||||
$contact = self::allowedContactByHandle($importer, $author, true);
|
||||
if (!$contact) {
|
||||
|
@ -2163,7 +2163,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => datetime_convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2314,7 +2314,7 @@ class Diaspora
|
|||
$birthday = str_replace("1000", "1901", $birthday);
|
||||
|
||||
if ($birthday != "") {
|
||||
$birthday = datetime_convert("UTC", "UTC", $birthday, "Y-m-d");
|
||||
$birthday = Temporal::convert($birthday, "UTC", "UTC", "Y-m-d");
|
||||
}
|
||||
|
||||
// this is to prevent multiple birthday notifications in a single year
|
||||
|
@ -2330,7 +2330,7 @@ class Diaspora
|
|||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($author),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($birthday),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
|
@ -2536,7 +2536,7 @@ class Diaspora
|
|||
intval($importer["uid"]),
|
||||
dbesc($ret["network"]),
|
||||
dbesc($ret["addr"]),
|
||||
datetime_convert(),
|
||||
Temporal::convert(),
|
||||
dbesc($ret["url"]),
|
||||
dbesc(normalise_link($ret["url"])),
|
||||
dbesc($batch),
|
||||
|
@ -2579,7 +2579,7 @@ class Diaspora
|
|||
0,
|
||||
dbesc(L10n::t("Sharing notification from Diaspora network")),
|
||||
dbesc($hash),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
} else {
|
||||
// automatic friend approval
|
||||
|
@ -2610,8 +2610,8 @@ class Diaspora
|
|||
WHERE `id` = %d
|
||||
",
|
||||
intval($new_relation),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($contact_record["id"])
|
||||
);
|
||||
|
||||
|
@ -2715,7 +2715,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$root_author = notags(unxmlify($data->root_author));
|
||||
$root_guid = notags(unxmlify($data->root_guid));
|
||||
/// @todo handle unprocessed property "provider_display_name"
|
||||
|
@ -2851,8 +2851,8 @@ class Diaspora
|
|||
'deleted' => true,
|
||||
'title' => '',
|
||||
'body' => '',
|
||||
'edited' => datetime_convert(),
|
||||
'changed' => datetime_convert()],
|
||||
'edited' => Temporal::convert(),
|
||||
'changed' => Temporal::convert()],
|
||||
['id' => $item["id"]]
|
||||
);
|
||||
|
||||
|
@ -2929,7 +2929,7 @@ class Diaspora
|
|||
{
|
||||
$author = notags(unxmlify($data->author));
|
||||
$guid = notags(unxmlify($data->guid));
|
||||
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
$public = notags(unxmlify($data->public));
|
||||
$text = unxmlify($data->text);
|
||||
$provider_display_name = notags(unxmlify($data->provider_display_name));
|
||||
|
@ -3606,10 +3606,10 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($event['start']) {
|
||||
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
||||
$eventdata['start'] = Temporal::convert($event['start'], "UTC", $eventdata['timezone'], $mask);
|
||||
}
|
||||
if ($event['finish'] && !$event['nofinish']) {
|
||||
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
||||
$eventdata['end'] = Temporal::convert($event['finish'], "UTC", $eventdata['timezone'], $mask);
|
||||
}
|
||||
if ($event['summary']) {
|
||||
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
|
||||
|
@ -3651,7 +3651,7 @@ class Diaspora
|
|||
|
||||
$public = (($item["private"]) ? "false" : "true");
|
||||
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
// Detect a share element and do a reshare
|
||||
if (!$item['private'] && ($ret = self::isReshare($item["body"]))) {
|
||||
|
@ -3854,7 +3854,7 @@ class Diaspora
|
|||
$parent = $p[0];
|
||||
|
||||
$text = html_entity_decode(bb2diaspora($item["body"]));
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
$comment = ["author" => self::myHandle($owner),
|
||||
"guid" => $item["guid"],
|
||||
|
@ -4085,12 +4085,12 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", 'Y-m-d\TH:i:s\Z'),
|
||||
"participants" => $cnv["recips"]
|
||||
];
|
||||
|
||||
$body = bb2diaspora($item["body"]);
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
$created = Temporal::convert($item["created"], "UTC", "UTC", 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
$msg = [
|
||||
"author" => $myaddr,
|
||||
|
@ -4108,7 +4108,7 @@ class Diaspora
|
|||
"author" => $cnv["creator"],
|
||||
"guid" => $cnv["guid"],
|
||||
"subject" => $cnv["subject"],
|
||||
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
|
||||
"created_at" => Temporal::convert($cnv['created'], "UTC", "UTC", 'Y-m-d\TH:i:s\Z'),
|
||||
"participants" => $cnv["recips"],
|
||||
"message" => $msg];
|
||||
|
||||
|
@ -4216,7 +4216,7 @@ class Diaspora
|
|||
if ($year < 1004) {
|
||||
$year = 1004;
|
||||
}
|
||||
$dob = datetime_convert('UTC', 'UTC', $year . '-' . $month . '-'. $day, 'Y-m-d');
|
||||
$dob = Temporal::convert($year . '-' . $month . '-'. $day, 'UTC', 'UTC', 'Y-m-d');
|
||||
}
|
||||
|
||||
$about = $profile['about'];
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
|
@ -12,13 +11,14 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Lock;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use dba;
|
||||
use DOMDocument;
|
||||
|
@ -199,7 +199,7 @@ class OStatus
|
|||
$contact["location"] = $value;
|
||||
}
|
||||
|
||||
$contact['name-date'] = datetime_convert();
|
||||
$contact['name-date'] = Temporal::convert();
|
||||
|
||||
dba::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
|
||||
|
@ -220,7 +220,7 @@ class OStatus
|
|||
'nurl' => normalise_link($author["author-link"]),
|
||||
'nick' => $contact["nick"], 'alias' => $contact["alias"],
|
||||
'about' => $contact["about"], 'location' => $contact["location"],
|
||||
'success_update' => datetime_convert(), 'last-update' => datetime_convert()];
|
||||
'success_update' => Temporal::convert(), 'last-update' => Temporal::convert()];
|
||||
|
||||
dba::update('contact', $fields, ['id' => $cid], $old_contact);
|
||||
|
||||
|
@ -558,7 +558,7 @@ class OStatus
|
|||
dba::update(
|
||||
'item',
|
||||
['deleted' => true, 'title' => '', 'body' => '',
|
||||
'edited' => datetime_convert(), 'changed' => datetime_convert()],
|
||||
'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
|
||||
['id' => $deleted["id"]]
|
||||
);
|
||||
|
||||
|
@ -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", datetime_convert("UTC", "UTC", "now", ATOM_TIME));
|
||||
XML::addElement($doc, $root, "updated", Temporal::convert("now", "UTC", "UTC", ATOM_TIME));
|
||||
|
||||
$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", datetime_convert("UTC", "UTC", $contact["success_update"]."+00:00", ATOM_TIME));
|
||||
XML::addElement($doc, $source, "updated", Temporal::convert($contact["success_update"]."+00:00", "UTC", "UTC", ATOM_TIME));
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
@ -1923,8 +1923,8 @@ class OStatus
|
|||
|
||||
XML::addElement($doc, $entry, "activity:verb", $verb);
|
||||
|
||||
XML::addElement($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"]."+00:00", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"]."+00:00", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "published", Temporal::convert($item["created"]."+00:00", "UTC", "UTC", ATOM_TIME));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::convert($item["edited"]."+00:00", "UTC", "UTC", ATOM_TIME));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2127,7 +2127,7 @@ class OStatus
|
|||
$last_update = 'now -30 days';
|
||||
}
|
||||
|
||||
$check_date = datetime_convert('UTC', 'UTC', $last_update, 'Y-m-d H:i:s');
|
||||
$check_date = Temporal::convert($last_update);
|
||||
$authorid = Contact::getIdForURL($owner["url"], 0);
|
||||
|
||||
$sql_extra = '';
|
||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\Model\GContact;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
|
@ -314,7 +315,7 @@ class PortableContact
|
|||
$contact = ["url" => $profile];
|
||||
|
||||
if ($gcontacts[0]["created"] <= NULL_DATE) {
|
||||
$contact['created'] = datetime_convert();
|
||||
$contact['created'] = Temporal::convert();
|
||||
}
|
||||
|
||||
if ($force) {
|
||||
|
@ -337,7 +338,7 @@ class PortableContact
|
|||
if ($server_url != "") {
|
||||
if (!self::checkServer($server_url, $gcontacts[0]["network"], $force)) {
|
||||
if ($force) {
|
||||
$fields = ['last_failure' => datetime_convert()];
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
|
@ -411,14 +412,14 @@ class PortableContact
|
|||
|
||||
// Set the date of the last contact
|
||||
/// @todo By now the function "update_gcontact" doesn't work with this field
|
||||
//$contact["last_contact"] = datetime_convert();
|
||||
//$contact["last_contact"] = Temporal::convert();
|
||||
|
||||
$contact = array_merge($contact, $noscrape);
|
||||
|
||||
GContact::update($contact);
|
||||
|
||||
if (trim($noscrape["updated"]) != "") {
|
||||
$fields = ['last_contact' => datetime_convert()];
|
||||
$fields = ['last_contact' => Temporal::convert()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
|
||||
|
@ -467,7 +468,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (($data["poll"] == "") || (in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM]))) {
|
||||
$fields = ['last_failure' => datetime_convert()];
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
|
@ -483,7 +484,7 @@ class PortableContact
|
|||
$feedret = Network::curl($data["poll"]);
|
||||
|
||||
if (!$feedret["success"]) {
|
||||
$fields = ['last_failure' => datetime_convert()];
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
|
@ -532,7 +533,7 @@ class PortableContact
|
|||
|
||||
public static function updateNeeded($created, $updated, $last_failure, $last_contact)
|
||||
{
|
||||
$now = strtotime(datetime_convert());
|
||||
$now = strtotime(Temporal::convert());
|
||||
|
||||
if ($updated > $last_contact) {
|
||||
$contact_time = strtotime($updated);
|
||||
|
@ -921,7 +922,7 @@ class PortableContact
|
|||
$gserver = dba::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
if (DBM::is_result($gserver)) {
|
||||
if ($gserver["created"] <= NULL_DATE) {
|
||||
$fields = ['created' => datetime_convert()];
|
||||
$fields = ['created' => Temporal::convert()];
|
||||
$condition = ['nurl' => normalise_link($server_url)];
|
||||
dba::update('gserver', $fields, $condition);
|
||||
}
|
||||
|
@ -968,7 +969,7 @@ class PortableContact
|
|||
// Mastodon uses the "@" for user profiles.
|
||||
// But this can be misunderstood.
|
||||
if (parse_url($server_url, PHP_URL_USER) != '') {
|
||||
dba::update('gserver', ['last_failure' => datetime_convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -984,7 +985,7 @@ class PortableContact
|
|||
if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
|
||||
($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => datetime_convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -999,7 +1000,7 @@ class PortableContact
|
|||
// Quit if there is a timeout
|
||||
if ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => datetime_convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1331,9 +1332,9 @@ class PortableContact
|
|||
|
||||
if ($failure) {
|
||||
$last_contact = $orig_last_contact;
|
||||
$last_failure = datetime_convert();
|
||||
$last_failure = Temporal::convert();
|
||||
} else {
|
||||
$last_contact = datetime_convert();
|
||||
$last_contact = Temporal::convert();
|
||||
$last_failure = $orig_last_failure;
|
||||
}
|
||||
|
||||
|
@ -1361,7 +1362,7 @@ class PortableContact
|
|||
dba::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
|
||||
} elseif (!$failure) {
|
||||
$fields['nurl'] = normalise_link($server_url);
|
||||
$fields['created'] = datetime_convert();
|
||||
$fields['created'] = Temporal::convert();
|
||||
dba::insert('gserver', $fields);
|
||||
}
|
||||
logger("End discovery for server " . $server_url, LOGGER_DEBUG);
|
||||
|
@ -1525,7 +1526,7 @@ class PortableContact
|
|||
}
|
||||
}
|
||||
|
||||
$fields = ['last_poco_query' => datetime_convert()];
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return true;
|
||||
|
@ -1534,7 +1535,7 @@ class PortableContact
|
|||
self::checkServer($server["url"], $server["network"], true);
|
||||
|
||||
// If we couldn't reach the server, we will try it some time later
|
||||
$fields = ['last_poco_query' => datetime_convert()];
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return false;
|
||||
|
@ -1560,7 +1561,7 @@ class PortableContact
|
|||
foreach ($r as $server) {
|
||||
if (!self::checkServer($server["url"], $server["network"])) {
|
||||
// The server is not reachable? Okay, then we will try it later
|
||||
$fields = ['last_poco_query' => datetime_convert()];
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,8 @@ class ParseUrl
|
|||
[
|
||||
'url' => normalise_link($url), 'guessing' => !$no_guessing,
|
||||
'oembed' => $do_oembed, 'content' => serialize($data),
|
||||
'created' => datetime_convert()],
|
||||
'created' => Temporal::convert()
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -70,7 +71,7 @@ Class Cron {
|
|||
|
||||
// once daily run birthday_updates and then expire in background
|
||||
$d1 = Config::get('system', 'last_expire_day');
|
||||
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
|
||||
$d2 = intval(Temporal::convert('now', 'UTC', 'UTC', 'd'));
|
||||
|
||||
if ($d2 != intval($d1)) {
|
||||
|
||||
|
@ -141,7 +142,7 @@ Class Cron {
|
|||
|
||||
Addon::reload();
|
||||
|
||||
$d = datetime_convert();
|
||||
$d = Temporal::convert();
|
||||
|
||||
// Only poll from those with suitable relationships,
|
||||
// and which have a polling address and ignore Diaspora since
|
||||
|
@ -217,33 +218,33 @@ Class Cron {
|
|||
*/
|
||||
switch ($contact['priority']) {
|
||||
case 5:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 month")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 1 month")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 week")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 1 week")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 1 day")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 12 hour")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 12 hour")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 1 hour")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + ".$min_poll_interval." minute")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + ".$min_poll_interval." minute")) {
|
||||
$update = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
Class CronHooks {
|
||||
public static function execute($hook = '') {
|
||||
|
@ -44,7 +45,7 @@ Class CronHooks {
|
|||
|
||||
logger('cronhooks: start');
|
||||
|
||||
$d = datetime_convert();
|
||||
$d = Temporal::convert();
|
||||
|
||||
if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
|
||||
foreach ($a->hooks["cron"] as $hook) {
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Model\GContact;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
|
@ -197,7 +198,7 @@ class DiscoverPoCo {
|
|||
}
|
||||
} else {
|
||||
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc(datetime_convert()), dbesc(normalise_link($user["url"])));
|
||||
dbesc(Temporal::convert()), dbesc(normalise_link($user["url"])));
|
||||
}
|
||||
|
||||
// Quit the loop after 3 minutes
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Protocol\Email;
|
|||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -43,7 +44,7 @@ class OnePoll
|
|||
return;
|
||||
}
|
||||
|
||||
$d = datetime_convert();
|
||||
$d = Temporal::convert();
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -69,7 +70,7 @@ class OnePoll
|
|||
// Diaspora users, archived users and followers are only checked if they still exist.
|
||||
if ($contact['archive'] || ($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == CONTACT_IS_FOLLOWER)) {
|
||||
$last_updated = PortableContact::lastUpdated($contact["url"], true);
|
||||
$updated = datetime_convert();
|
||||
$updated = Temporal::convert();
|
||||
if ($last_updated) {
|
||||
logger('Contact '.$contact['id'].' had last update on '.$last_updated, LOGGER_DEBUG);
|
||||
|
||||
|
@ -98,7 +99,7 @@ class OnePoll
|
|||
$contact['priority'] = intval($poll_interval);
|
||||
$hub_update = false;
|
||||
|
||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
|
||||
if (Temporal::convert('now') > Temporal::convert($t . " + 1 day")) {
|
||||
$hub_update = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -106,8 +107,8 @@ class OnePoll
|
|||
}
|
||||
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE)
|
||||
? datetime_convert('UTC', 'UTC', 'now - 7 days', ATOM_TIME)
|
||||
: datetime_convert('UTC', 'UTC', $contact['last-update'], ATOM_TIME)
|
||||
? Temporal::convert('now - 7 days', 'UTC', 'UTC', ATOM_TIME)
|
||||
: Temporal::convert($contact['last-update'], 'UTC', 'UTC', ATOM_TIME)
|
||||
);
|
||||
|
||||
// Update the contact entry
|
||||
|
@ -116,7 +117,7 @@ class OnePoll
|
|||
logger("Skipping probably dead contact ".$contact['url']);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -125,7 +126,7 @@ class OnePoll
|
|||
logger('Contact is marked dead');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
} else {
|
||||
Contact::unmarkForArchival($contact);
|
||||
|
@ -136,7 +137,7 @@ class OnePoll
|
|||
logger('Ignore public contacts');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,7 +149,7 @@ class OnePoll
|
|||
logger('No self contact for user '.$importer_uid);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -184,7 +185,7 @@ class OnePoll
|
|||
|
||||
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -206,7 +207,7 @@ class OnePoll
|
|||
Contact::markForArchival($contact);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
$fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
return;
|
||||
}
|
||||
|
@ -216,7 +217,7 @@ class OnePoll
|
|||
|
||||
Contact::markForArchival($contact);
|
||||
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
$fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
return;
|
||||
}
|
||||
|
@ -229,7 +230,7 @@ class OnePoll
|
|||
|
||||
// we may not be friends anymore. Will keep trying for one month.
|
||||
// set the last-update so we don't keep polling
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
$fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
|
||||
Contact::markForArchival($contact);
|
||||
|
@ -240,7 +241,7 @@ class OnePoll
|
|||
|
||||
if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,7 +276,7 @@ class OnePoll
|
|||
logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ class OnePoll
|
|||
|
||||
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ class OnePoll
|
|||
|
||||
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -334,7 +335,7 @@ class OnePoll
|
|||
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if ($mail_disabled) {
|
||||
// set the last-update so we don't keep polling
|
||||
dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
}
|
||||
|
@ -354,7 +355,7 @@ class OnePoll
|
|||
unset($password);
|
||||
logger("Mail: Connect to " . $mailconf['user']);
|
||||
if ($mbox) {
|
||||
$fields = ['last_check' => datetime_convert()];
|
||||
$fields = ['last_check' => Temporal::convert()];
|
||||
dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
|
||||
logger("Mail: Connected to " . $mailconf['user']);
|
||||
} else {
|
||||
|
@ -394,7 +395,7 @@ class OnePoll
|
|||
// Only delete when mails aren't automatically moved or deleted
|
||||
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
|
||||
if ($meta->deleted && ! $item['deleted']) {
|
||||
$fields = ['deleted' => true, 'changed' => datetime_convert()];
|
||||
$fields = ['deleted' => true, 'changed' => Temporal::convert()];
|
||||
dba::update('item', $fields, ['id' => $item['id']]);
|
||||
}
|
||||
|
||||
|
@ -458,7 +459,7 @@ class OnePoll
|
|||
$datarray['title'] = notags(trim($datarray['title']));
|
||||
|
||||
//$datarray['title'] = notags(trim($meta->subject));
|
||||
$datarray['created'] = datetime_convert('UTC', 'UTC', $meta->date);
|
||||
$datarray['created'] = Temporal::convert($meta->date);
|
||||
|
||||
// Is it a reply?
|
||||
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") ||
|
||||
|
@ -571,7 +572,7 @@ class OnePoll
|
|||
if (!strstr($xml, '<')) {
|
||||
logger('post_handshake: response from ' . $url . ' did not contain XML.');
|
||||
|
||||
$fields = ['last-update' => datetime_convert(), 'failure_update' => datetime_convert()];
|
||||
$fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
|
||||
self::updateContact($contact, $fields);
|
||||
Contact::markForArchival($contact);
|
||||
return;
|
||||
|
@ -615,19 +616,19 @@ class OnePoll
|
|||
}
|
||||
}
|
||||
|
||||
$updated = datetime_convert();
|
||||
$updated = Temporal::convert();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
|
||||
dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::unmarkForArchival($contact);
|
||||
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
|
||||
$updated = datetime_convert();
|
||||
$updated = Temporal::convert();
|
||||
|
||||
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
|
||||
dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
|
||||
Contact::markForArchival($contact);
|
||||
} else {
|
||||
$updated = datetime_convert();
|
||||
$updated = Temporal::convert();
|
||||
dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Worker/UpdateGcontact.php
|
||||
*/
|
||||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
class UpdateGContact {
|
||||
public static function execute($contact_id) {
|
||||
class UpdateGContact
|
||||
{
|
||||
public static function execute($contact_id)
|
||||
{
|
||||
global $a;
|
||||
|
||||
logger('update_gcontact: start');
|
||||
|
@ -33,25 +37,30 @@ class UpdateGContact {
|
|||
$data = Probe::uri($r[0]["url"]);
|
||||
|
||||
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
|
||||
if ($r[0]["server_url"] != "")
|
||||
if ($r[0]["server_url"] != "") {
|
||||
PortableContact::checkServer($r[0]["server_url"], $r[0]["network"]);
|
||||
}
|
||||
|
||||
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `id` = %d",
|
||||
dbesc(datetime_convert()), intval($contact_id));
|
||||
dbesc(Temporal::convert()), intval($contact_id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (($data["name"] == "") && ($r[0]['name'] != ""))
|
||||
if (($data["name"] == "") && ($r[0]['name'] != "")) {
|
||||
$data["name"] = $r[0]['name'];
|
||||
}
|
||||
|
||||
if (($data["nick"] == "") && ($r[0]['nick'] != ""))
|
||||
if (($data["nick"] == "") && ($r[0]['nick'] != "")) {
|
||||
$data["nick"] = $r[0]['nick'];
|
||||
}
|
||||
|
||||
if (($data["addr"] == "") && ($r[0]['addr'] != ""))
|
||||
if (($data["addr"] == "") && ($r[0]['addr'] != "")) {
|
||||
$data["addr"] = $r[0]['addr'];
|
||||
}
|
||||
|
||||
if (($data["photo"] == "") && ($r[0]['photo'] != ""))
|
||||
if (($data["photo"] == "") && ($r[0]['photo'] != "")) {
|
||||
$data["photo"] = $r[0]['photo'];
|
||||
}
|
||||
|
||||
|
||||
q("UPDATE `gcontact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `photo` = '%s'
|
||||
|
@ -60,8 +69,8 @@ class UpdateGContact {
|
|||
dbesc($data["nick"]),
|
||||
dbesc($data["addr"]),
|
||||
dbesc($data["photo"]),
|
||||
intval($contact_id)
|
||||
);
|
||||
intval($contact_id)
|
||||
);
|
||||
|
||||
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `photo` = '%s'
|
||||
WHERE `uid` = 0 AND `addr` = '' AND `nurl` = '%s'",
|
||||
|
@ -70,12 +79,12 @@ class UpdateGContact {
|
|||
dbesc($data["addr"]),
|
||||
dbesc($data["photo"]),
|
||||
dbesc(normalise_link($data["url"]))
|
||||
);
|
||||
);
|
||||
|
||||
q("UPDATE `contact` SET `addr` = '%s'
|
||||
WHERE `uid` != 0 AND `addr` = '' AND `nurl` = '%s'",
|
||||
dbesc($data["addr"]),
|
||||
dbesc(normalise_link($data["url"]))
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue