]> git.mxchange.org Git - friendica-addons.git/commitdiff
Move Temporal::convert() to DateTimeFormat::convert()
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 27 Jan 2018 02:39:02 +0000 (21:39 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 3 Feb 2018 16:40:39 +0000 (11:40 -0500)
15 files changed:
dav/common/calendar.fnk.php
dav/common/calendar_rendering.fnk.php
dav/common/wdcal_backend.inc.php
dav/common/wdcal_edit.inc.php
dav/friendica/dav_caldav_backend_virtual_friendica.inc.php
dwpost/dwpost.php
fromgplus/fromgplus.php
ijpost/ijpost.php
ljpost/ljpost.php
membersince/membersince.php
public_server/public_server.php
pumpio/pumpio.php
statusnet/statusnet.php
testdrive/testdrive.php
twitter/twitter.php

index 1245ee2e8d86354fb2aa0993dd510d9375a08710..ef1a9b0ccdb61bbaca2c1ca2070e51bd0acc2ebe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 define("DAV_ACL_READ", "{DAV:}read");
 define("DAV_ACL_WRITE", "{DAV:}write");
@@ -151,7 +151,7 @@ function vcard_source_compile($vcardsource)
  */
 function wdcal_php2MySqlTime($phpDate)
 {
-       return date(Temporal::MYSQL, $phpDate);
+       return date(DateTimeFormat::MYSQL, $phpDate);
 }
 
 /**
@@ -160,7 +160,7 @@ function wdcal_php2MySqlTime($phpDate)
  */
 function wdcal_mySql2PhpTime($sqlDate)
 {
-       $ts = DateTime::createFromFormat(Temporal::MYSQL, $sqlDate);
+       $ts = DateTime::createFromFormat(DateTimeFormat::MYSQL, $sqlDate);
        return $ts->format("U");
 }
 
index ae6e39dd0d316b4fc9df2f6439ab6c454d8aa187..bc13ce39fe7250b6e2cc68932cf57d68ed1e5745 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 
 /**
@@ -110,15 +110,15 @@ function renderCalDavEntry_data(&$calendar, &$calendarobject)
 
                q("INSERT INTO %s%sjqcalendar (`calendar_id`, `calendarobject_id`, `Summary`, `StartTime`, `EndTime`, `IsEditable`, `IsAllDayEvent`, `IsRecurring`, `Color`) VALUES
                        (%d, %d, '%s', CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d, %d, %d, '%s')",
-                       CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), dbesc($event["summary"]), date(Temporal::MYSQL, $start),
-                       date(Temporal::MYSQL, $last_end), 1, $allday, $recurring, dbesc(substr($event["color"], 1))
+                       CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), dbesc($event["summary"]), date(DateTimeFormat::MYSQL, $start),
+                       date(DateTimeFormat::MYSQL, $last_end), 1, $allday, $recurring, dbesc(substr($event["color"], 1))
                );
 
                foreach ($alarms as $alarm) {
                        $alarm    = renderCalDavEntry_calcalarm($alarm, $component);
                        $notified = ($alarm->getTimestamp() < time() ? 1 : 0);
                        q("INSERT INTO %s%snotifications (`calendar_id`, `calendarobject_id`, `alert_date`, `notified`) VALUES (%d, %d, CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d)",
-                               CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format(Temporal::MYSQL), $notified
+                               CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format(DateTimeFormat::MYSQL), $notified
                        );
                }
 
index 5418c90a367585ff93296c5a0f54f988d3870c70..d66251f4e78c00762eced0718a83cb6e2d66359d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use Friendica\Core\L10n;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 /**
  * @param mixed $obj
@@ -101,9 +101,9 @@ function wdcal_print_feed($base_path = "")
                                else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
 
                                $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
-                               $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
+                               $datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
                                $datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
-                               $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
+                               $datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
 
                                $component->add($datetime_start);
                                $component->add($datetime_end);
@@ -183,9 +183,9 @@ function wdcal_print_feed($base_path = "")
                                else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
 
                                $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
-                               $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
+                               $datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
                                $datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
-                               $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
+                               $datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
 
                                $component->__unset("DTSTART");
                                $component->__unset("DTEND");
index 8154a68b59087fce72192c777a151e10d09f1ea5..49cc152336979c85cab31ab12809c99d89502438 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use Friendica\Core\L10n;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 /**
  * @param wdcal_local $localization
@@ -521,9 +521,9 @@ function wdcal_set_component_date(&$component, &$localization)
                $type     = Sabre\VObject\Property\DateTime::LOCALTZ;
        }
        $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
-       $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_start)), $type);
+       $datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_start)), $type);
        $datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
-       $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_end)), $type);
+       $datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_end)), $type);
 
        $component->__unset("DTSTART");
        $component->__unset("DTEND");
@@ -599,7 +599,7 @@ function wdcal_set_component_recurrence(&$component, &$localization)
                        $date           = $localization->date_local2timestamp($_REQUEST["rec_until_date"]);
                        $part_until     = ";UNTIL=" . date("Ymd", $date);
                        $datetime_until = new Sabre\VObject\Property\DateTime("UNTIL");
-                       $datetime_until->setDateTime(new DateTime(date(Temporal::MYSQL, $date)), Sabre\VObject\Property\DateTime::DATE);
+                       $datetime_until->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $date)), Sabre\VObject\Property\DateTime::DATE);
                        break;
                case "count":
                        $part_until = ";COUNT=" . IntVal($_REQUEST["rec_until_count"]);
@@ -646,7 +646,7 @@ function wdcal_set_component_recurrence(&$component, &$localization)
        if (isset($_REQUEST["rec_exceptions"])) {
                $arr = array();
                foreach ($_REQUEST["rec_exceptions"] as $except) {
-                       $arr[] = new DateTime(date(Temporal::MYSQL, $except));
+                       $arr[] = new DateTime(date(DateTimeFormat::MYSQL, $except));
                }
                /** @var Sabre\VObject\Property\MultiDateTime $prop */
                $prop = Sabre\VObject\Property::create("EXDATE");
index 092dbbd8028fd975ee89d75e6c1ec4f55e0d0d03..b02b9150a6a754e8856d9d6a67d5169648acbb5d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use Friendica\Core\L10n;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
 {
@@ -68,8 +68,8 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
                        $component = dav_get_eventComponent($vevent);
 
                        if ($row["adjust"]) {
-                               $start  = Temporal::local($row["start"]);
-                               $finish = Temporal::local($row["finish"]);
+                               $start  = DateTimeFormat::local($row["start"]);
+                               $finish = DateTimeFormat::local($row["finish"]);
                        } else {
                                $start  = $row["start"];
                                $finish = $row["finish"];
@@ -88,9 +88,9 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
                        $type           = ($allday ? Sabre\VObject\Property\DateTime::DATE : Sabre\VObject\Property\DateTime::LOCALTZ);
 
                        $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
-                       $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_start)), $type);
+                       $datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_start)), $type);
                        $datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
-                       $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_end)), $type);
+                       $datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_end)), $type);
 
                        $component->add($datetime_start);
                        $component->add($datetime_end);
@@ -116,8 +116,8 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
        private function jqcal2wdcal($row, $calendar, $base_path)
        {
                if ($row["adjust"]) {
-                       $start  = Temporal::local($row["start"]);
-                       $finish = Temporal::local($row["finish"]);
+                       $start  = DateTimeFormat::local($row["start"]);
+                       $finish = DateTimeFormat::local($row["finish"]);
                } else {
                        $start  = $row["start"];
                        $finish = $row["finish"];
@@ -175,11 +175,11 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
                }
 
                if ($date_from != "") {
-                       if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date(Temporal::MYSQL, $date_from) . "'";
+                       if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date(DateTimeFormat::MYSQL, $date_from) . "'";
                        else $sql_where .= " AND `finish` >= '" . dbesc($date_from) . "'";
                }
                if ($date_to != "") {
-                       if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date(Temporal::MYSQL, $date_to) . "'";
+                       if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date(DateTimeFormat::MYSQL, $date_to) . "'";
                        else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
                }
                $ret = [];
index 3730aa2b01a78b92ba8dd3844f7696bdb467371e..fe4a53ef8d044108397a2b8da2d2e1b71aeeccd1 100644 (file)
@@ -187,7 +187,7 @@ function dwpost_send(&$a,&$b) {
                $post = xmlify($post);
                $tags = dwpost_get_tags($b['tag']);
 
-               $date = Temporal::convert($b['created'], $tz);
+               $date = DateTimeFormat::convert($b['created'], $tz);
                $year = intval(substr($date,0,4));
                $mon  = intval(substr($date,5,2));
                $day  = intval(substr($date,8,2));
index a65be28678d294dfdb9a184f73c71dfb2f4f556a..b8d9511a52f48c7628dde6c8f33dec05f8b5d4f2 100644 (file)
@@ -14,8 +14,8 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Object\Image;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Util\Temporal;
 
 require_once 'mod/share.php';
 require_once 'mod/parse_url.php';
@@ -520,12 +520,12 @@ function fromgplus_fetch($a, $uid) {
                                                if (function_exists("share_header"))
                                                        $post .= share_header($item->object->actor->displayName, $item->object->actor->url,
                                                                                $item->object->actor->image->url, "",
-                                                                               Temporal::utc($item->object->published),$item->object->url);
+                                                                               DateTimeFormat::utc($item->object->published),$item->object->url);
                                                else
                                                        $post .= "[share author='".str_replace("'", "&#039;",$item->object->actor->displayName).
                                                                        "' profile='".$item->object->actor->url.
                                                                        "' avatar='".$item->object->actor->image->url.
-                                                                       "' posted='".Temporal::utc($item->object->published).
+                                                                       "' posted='".DateTimeFormat::utc($item->object->published).
                                                                        "' link='".$item->object->url."']";
 
                                                $post .= fromgplus_html2bbcode($item->object->content);
index 3c4e917dda0dfcb5c15a153a5bcab846c691f428..ffafa5ee919e5628ca44d47c9b0a8f6d2c4f2a3a 100644 (file)
@@ -186,7 +186,7 @@ function ijpost_send(&$a,&$b) {
                $post = xmlify($post);
                $tags = ijpost_get_tags($b['tag']);
 
-               $date = Temporal::convert($b['created'], $tz);
+               $date = DateTimeFormat::convert($b['created'], $tz);
                $year = intval(substr($date,0,4));
                $mon  = intval(substr($date,5,2));
                $day  = intval(substr($date,8,2));
index ff89e5e6612f82252f0e1bcf68210a711d570286..2a14172f1cedbbec88279ccb79e40990d88dce1e 100644 (file)
@@ -187,7 +187,7 @@ function ljpost_send(&$a,&$b) {
                $post = xmlify($post);
                $tags = ljpost_get_tags($b['tag']);
 
-               $date = Temporal::convert($b['created'], $tz);
+               $date = DateTimeFormat::convert($b['created'], $tz);
                $year = intval(substr($date,0,4));
                $mon  = intval(substr($date,5,2));
                $day  = intval(substr($date,8,2));
index fb923bde1467e4df26e5dba56878241f17b57109..c1d38b83f762a4cdb3aa64f0bbf0d4bdda85a4ad 100644 (file)
@@ -9,7 +9,7 @@
 
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 require_once 'include/datetime.php';
 
@@ -26,8 +26,8 @@ function membersince_uninstall()
 function membersince_display(&$a, &$b)
 {
        // Works in Vier
-       $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . Temporal::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
+       $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
 
        // Trying for Frio
-       //$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . Temporal::local($a->profile['register_date']) . "</div></div>", $b, 1);
+       //$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . DateTimeFormat::local($a->profile['register_date']) . "</div></div>", $b, 1);
 }
index 29cf0f60f2fd4b557e051f11e35eae1253f5e39a..a5c4cec7ef0a31e25943bf53182098364ff13e20 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Model\User;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 function public_server_install() {
 
@@ -39,7 +39,7 @@ function public_server_register_account($a,$b) {
                return;
 
        $r = q("UPDATE user set account_expires_on = '%s', expire = %d where uid = %d",
-               dbesc(Temporal::utc('now +' . $days . ' days')),
+               dbesc(DateTimeFormat::utc('now +' . $days . ' days')),
                intval($days_posts),
                intval($uid)
        );
@@ -69,7 +69,7 @@ function public_server_cron($a,$b) {
                        ]);
 
                        q("update user set expire_notification_sent = '%s' where uid = %d",
-                               dbesc(Temporal::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
                                intval($rr['uid'])
                        );
                }
@@ -87,7 +87,7 @@ function public_server_cron($a,$b) {
                if(count($r)) {
                        foreach($r as $rr)
                                q("update user set account_expires_on = '%s' where uid = %d",
-                                       dbesc(Temporal::utc('now +' . '6 days')),
+                                       dbesc(DateTimeFormat::utc('now +' . '6 days')),
                                        intval($rr['uid'])
                        );
                }
@@ -100,7 +100,7 @@ function public_server_cron($a,$b) {
                if(count($r)) {
                        foreach($r as $rr)
                                q("update user set account_expires_on = '%s' where uid = %d",
-                                       dbesc(Temporal::utc('now +' . '6 days')),
+                                       dbesc(DateTimeFormat::utc('now +' . '6 days')),
                                        intval($rr['uid'])
                                );
                }
@@ -138,7 +138,7 @@ function public_server_login($a,$b) {
        if(! $days)
                return;
        $r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'",
-       dbesc(Temporal::utc('now +' . $days . ' days')),
+       dbesc(DateTimeFormat::utc('now +' . $days . ' days')),
        local_user()
        );
 }
index 45dd57499de7a5f21dffba9a4baee0cd9bedef2e..1e416f47ea549837f49da1956442ee7b650c009e 100644 (file)
@@ -18,7 +18,7 @@ use Friendica\Model\Item;
 use Friendica\Model\Queue;
 use Friendica\Util\Network;
 use Friendica\Model\User;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 require 'addon/pumpio/oauth/http.php';
 require 'addon/pumpio/oauth/oauth_client.php';
@@ -672,7 +672,7 @@ function pumpio_sync(&$a) {
        if ($abandon_days < 1)
                $abandon_days = 0;
 
-       $abandon_limit = date(Temporal::MYSQL, time() - $abandon_days * 86400);
+       $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'import' AND `v` = '1' ORDER BY RAND() ");
        if(count($r)) {
@@ -871,7 +871,7 @@ function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
        }
 
        $r = q("UPDATE `item` SET `deleted` = 1, `unseen` = 1, `changed` = '%s' WHERE `verb` = '%s' AND `uid` = %d AND `contact-id` = %d AND `thr-parent` = '%s'",
-               dbesc(Temporal::utcNow()),
+               dbesc(DateTimeFormat::utcNow()),
                dbesc(ACTIVITY_LIKE),
                intval($uid),
                intval($contactid),
@@ -1002,7 +1002,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                                        `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
                                VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
                        intval($uid),
-                       dbesc(Temporal::utcNow()),
+                       dbesc(DateTimeFormat::utcNow()),
                        dbesc($contact->url),
                        dbesc(normalise_link($contact->url)),
                        dbesc(str_replace("acct:", "", $contact->id)),
@@ -1211,11 +1211,11 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
        if ($post->object->displayName != "")
                $postarray['title'] = $post->object->displayName;
 
-       $postarray['created'] = Temporal::utc($post->published);
+       $postarray['created'] = DateTimeFormat::utc($post->published);
        if (isset($post->updated))
-               $postarray['edited'] = Temporal::utc($post->updated);
+               $postarray['edited'] = DateTimeFormat::utc($post->updated);
        elseif (isset($post->received))
-               $postarray['edited'] = Temporal::utc($post->received);
+               $postarray['edited'] = DateTimeFormat::utc($post->received);
        else
                $postarray['edited'] = $postarray['created'];
 
@@ -1230,7 +1230,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
 
                        $postarray['body'] = share_header($share_author, $post->object->author->url,
                                                        $post->object->author->image->url, "",
-                                                       Temporal::utc($post->object->created),
+                                                       DateTimeFormat::utc($post->object->created),
                                                        $post->links->self->href).
                                                $postarray['body']."[/share]";
 
@@ -1238,7 +1238,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                        $postarray['body'] = "[share author='".$share_author.
                                        "' profile='".$post->object->author->url.
                                        "' avatar='".$post->object->author->image->url.
-                                       "' posted='".Temporal::convert($post->object->created, 'UTC', 'UTC', ).
+                                       "' posted='".DateTimeFormat::convert($post->object->created, 'UTC', 'UTC', ).
                                        "' link='".$post->links->self->href."']".$postarray['body']."[/share]";
                        */
                } else {
index ae54e2fd11f593d652b76290ef5afbb9b98b8ed9..22e8f5f9c28256032b5283fc464010951b85623b 100644 (file)
@@ -53,8 +53,8 @@ use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Photo;
 use Friendica\Model\User;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Util\Temporal;
 
 function statusnet_install()
 {
@@ -760,7 +760,7 @@ function statusnet_cron(App $a, $b)
                $abandon_days = 0;
        }
 
-       $abandon_limit = date(Temporal::MYSQL, time() - $abandon_days * 86400);
+       $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()");
        if (count($r)) {
@@ -936,7 +936,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                                        `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
                                        VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
                        intval($uid),
-                       dbesc(Temporal::utcNow()),
+                       dbesc(DateTimeFormat::utcNow()),
                        dbesc($contact->statusnet_profile_url),
                        dbesc(normalise_link($contact->statusnet_profile_url)),
                        dbesc(statusnet_address($contact)),
@@ -977,13 +977,13 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                        dbesc($photos[0]),
                        dbesc($photos[1]),
                        dbesc($photos[2]),
-                       dbesc(Temporal::utcNow()),
+                       dbesc(DateTimeFormat::utcNow()),
                        intval($contact_id)
                );
        } else {
                // update profile photos once every two weeks as we have no notification of when they change.
-               //$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false);
-               $update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours'));
+               //$update_photo = (($r[0]['avatar-date'] < DateTimeFormat::convert('now -2 days', '', '', )) ? true : false);
+               $update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('now -12 hours'));
 
                // check that we have all the photos, this has been known to fail on occasion
                if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
@@ -1008,9 +1008,9 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                                dbesc($photos[0]),
                                dbesc($photos[1]),
                                dbesc($photos[2]),
-                               dbesc(Temporal::utcNow()),
-                               dbesc(Temporal::utcNow()),
-                               dbesc(Temporal::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
                                dbesc($contact->statusnet_profile_url),
                                dbesc(normalise_link($contact->statusnet_profile_url)),
                                dbesc(statusnet_address($contact)),
@@ -1197,8 +1197,8 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
        $postarray['body'] = $converted["body"];
        $postarray['tag'] = $converted["tags"];
 
-       $postarray['created'] = Temporal::utc($content->created_at);
-       $postarray['edited'] = Temporal::utc($content->created_at);
+       $postarray['created'] = DateTimeFormat::utc($content->created_at);
+       $postarray['edited'] = DateTimeFormat::utc($content->created_at);
 
        if (is_string($content->place->name)) {
                $postarray["location"] = $content->place->name;
index 4f4341234c831c1497e3b03913a73d2511b5dddc..5c3930cd35188167186d1b21fc185c18debf210e 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Model\User;
-use Friendica\Util\Temporal;
+use Friendica\Util\DateTimeFormat;
 
 function testdrive_install() {
 
@@ -44,7 +44,7 @@ function testdrive_register_account($a,$b) {
                return;
 
        $r = q("UPDATE user set account_expires_on = '%s' where uid = %d",
-               dbesc(Temporal::convert('now +' . $days . ' days')),
+               dbesc(DateTimeFormat::convert('now +' . $days . ' days')),
                intval($uid)
        );
 
@@ -72,7 +72,7 @@ function testdrive_cron($a,$b) {
                        ]);
 
                        q("update user set expire_notification_sent = '%s' where uid = %d",
-                               dbesc(Temporal::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
                                intval($rr['uid'])
                        );
 
index 0bffa4eb11ab895487c40a3ba005789a35a5da11..bf85f081702aa35fd98580cdfd1fcc10596742f5 100644 (file)
@@ -77,8 +77,8 @@ use Friendica\Model\Photo;
 use Friendica\Model\Queue;
 use Friendica\Model\User;
 use Friendica\Object\Image;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Util\Temporal;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
@@ -682,7 +682,7 @@ function twitter_cron(App $a, $b)
                $abandon_days = 0;
        }
 
-       $abandon_limit = date(Temporal::MYSQL, time() - $abandon_days * 86400);
+       $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
        if (count($r)) {
@@ -1017,7 +1017,7 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                                        `location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
                                        VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
                        intval($uid),
-                       dbesc(Temporal::utcNow()),
+                       dbesc(DateTimeFormat::utcNow()),
                        dbesc("https://twitter.com/" . $contact->screen_name),
                        dbesc(normalise_link("https://twitter.com/" . $contact->screen_name)),
                        dbesc($contact->screen_name."@twitter.com"),
@@ -1061,16 +1061,16 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                                dbesc($photos[0]),
                                dbesc($photos[1]),
                                dbesc($photos[2]),
-                               dbesc(Temporal::utcNow()),
-                               dbesc(Temporal::utcNow()),
-                               dbesc(Temporal::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
                                intval($contact_id)
                        );
                }
        } else {
                // update profile photos once every two weeks as we have no notification of when they change.
-               //$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false);
-               $update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours'));
+               //$update_photo = (($r[0]['avatar-date'] < DateTimeFormat::convert('now -2 days', '', '', )) ? true : false);
+               $update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('now -12 hours'));
 
                // check that we have all the photos, this has been known to fail on occasion
                if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
@@ -1096,9 +1096,9 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                                        dbesc($photos[0]),
                                        dbesc($photos[1]),
                                        dbesc($photos[2]),
-                                       dbesc(Temporal::utcNow()),
-                                       dbesc(Temporal::utcNow()),
-                                       dbesc(Temporal::utcNow()),
+                                       dbesc(DateTimeFormat::utcNow()),
+                                       dbesc(DateTimeFormat::utcNow()),
+                                       dbesc(DateTimeFormat::utcNow()),
                                        dbesc("https://twitter.com/".$contact->screen_name),
                                        dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
                                        dbesc($contact->screen_name."@twitter.com"),
@@ -1490,8 +1490,8 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
        $converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture);
        $postarray['body'] = $converted["body"];
        $postarray['tag'] = $converted["tags"];
-       $postarray['created'] = Temporal::utc($post->created_at);
-       $postarray['edited'] = Temporal::utc($post->created_at);
+       $postarray['created'] = DateTimeFormat::utc($post->created_at);
+       $postarray['edited'] = DateTimeFormat::utc($post->created_at);
 
        $statustext = $converted["plain"];