mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 02:18:48 +00:00
Move Temporal::convert() to DateTimeFormat::convert()
This commit is contained in:
parent
13fb4a312d
commit
1900da6c42
15 changed files with 77 additions and 77 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue