From: Hypolite Petovan Date: Fri, 26 Jan 2018 03:00:29 +0000 (-0500) Subject: Add Temporal::MYSQL constant X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6d23de1bdb6b53226006fa3d35849d45bc6bfec4;p=friendica-addons.git Add Temporal::MYSQL constant --- diff --git a/dav/common/calendar.fnk.php b/dav/common/calendar.fnk.php index 11f31f7d..1245ee2e 100644 --- a/dav/common/calendar.fnk.php +++ b/dav/common/calendar.fnk.php @@ -1,5 +1,6 @@ format("U"); } diff --git a/dav/common/calendar_rendering.fnk.php b/dav/common/calendar_rendering.fnk.php index d80892f7..ae6e39dd 100644 --- a/dav/common/calendar_rendering.fnk.php +++ b/dav/common/calendar_rendering.fnk.php @@ -1,5 +1,6 @@ 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("Y-m-d H:i:s"), $notified + CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format(Temporal::MYSQL), $notified ); } diff --git a/dav/common/wdcal_backend.inc.php b/dav/common/wdcal_backend.inc.php index a3e18eb3..5418c90a 100644 --- a/dav/common/wdcal_backend.inc.php +++ b/dav/common/wdcal_backend.inc.php @@ -1,6 +1,7 @@ setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type); + $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type); $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); - $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type); + $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type); $component->add($datetime_start); $component->add($datetime_end); @@ -182,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("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type); + $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type); $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); - $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type); + $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type); $component->__unset("DTSTART"); $component->__unset("DTEND"); diff --git a/dav/common/wdcal_edit.inc.php b/dav/common/wdcal_edit.inc.php index f4ac90c9..8154a68b 100644 --- a/dav/common/wdcal_edit.inc.php +++ b/dav/common/wdcal_edit.inc.php @@ -1,6 +1,7 @@ setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_start)), $type); + $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_start)), $type); $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); - $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_end)), $type); + $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_end)), $type); $component->__unset("DTSTART"); $component->__unset("DTEND"); @@ -598,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("Y-m-d H:i:s", $date)), Sabre\VObject\Property\DateTime::DATE); + $datetime_until->setDateTime(new DateTime(date(Temporal::MYSQL, $date)), Sabre\VObject\Property\DateTime::DATE); break; case "count": $part_until = ";COUNT=" . IntVal($_REQUEST["rec_until_count"]); @@ -645,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("Y-m-d H:i:s", $except)); + $arr[] = new DateTime(date(Temporal::MYSQL, $except)); } /** @var Sabre\VObject\Property\MultiDateTime $prop */ $prop = Sabre\VObject\Property::create("EXDATE"); diff --git a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php index 405bbb19..3baaa10c 100644 --- a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php +++ b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php @@ -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("Y-m-d H:i:s", $ts_start)), $type); + $datetime_start->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_start)), $type); $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); - $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_end)), $type); + $datetime_end->setDateTime(new DateTime(date(Temporal::MYSQL, $ts_end)), $type); $component->add($datetime_start); $component->add($datetime_end); @@ -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("Y-m-d H:i:s", $date_from) . "'"; + if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date(Temporal::MYSQL, $date_from) . "'"; else $sql_where .= " AND `finish` >= '" . dbesc($date_from) . "'"; } if ($date_to != "") { - if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'"; + if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date(Temporal::MYSQL, $date_to) . "'"; else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'"; } $ret = []; diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index bdc56795..7e34eab3 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -672,7 +672,7 @@ function pumpio_sync(&$a) { if ($abandon_days < 1) $abandon_days = 0; - $abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400); + $abandon_limit = date(Temporal::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)) { diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 57095412..c5b62a5d 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -760,7 +760,7 @@ function statusnet_cron(App $a, $b) $abandon_days = 0; } - $abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400); + $abandon_limit = date(Temporal::MYSQL, time() - $abandon_days * 86400); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()"); if (count($r)) { diff --git a/twitter/twitter.php b/twitter/twitter.php index d6d0ba7b..9c2804b1 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -682,7 +682,7 @@ function twitter_cron(App $a, $b) $abandon_days = 0; } - $abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400); + $abandon_limit = date(Temporal::MYSQL, time() - $abandon_days * 86400); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'"); if (count($r)) {