<?php
+use Friendica\Util\Temporal;
define("DAV_ACL_READ", "{DAV:}read");
define("DAV_ACL_WRITE", "{DAV:}write");
*/
function wdcal_php2MySqlTime($phpDate)
{
- return date("Y-m-d H:i:s", $phpDate);
+ return date(Temporal::MYSQL, $phpDate);
}
/**
*/
function wdcal_mySql2PhpTime($sqlDate)
{
- $ts = DateTime::createFromFormat("Y-m-d H:i:s", $sqlDate);
+ $ts = DateTime::createFromFormat(Temporal::MYSQL, $sqlDate);
return $ts->format("U");
}
<?php
+use Friendica\Util\Temporal;
/**
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("Y-m-d H:i:s", $start),
- date("Y-m-d H:i:s", $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(Temporal::MYSQL, $start),
+ date(Temporal::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("Y-m-d H:i:s"), $notified
+ CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format(Temporal::MYSQL), $notified
);
}
<?php
use Friendica\Core\L10n;
+use Friendica\Util\Temporal;
/**
* @param mixed $obj
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->add($datetime_start);
$component->add($datetime_end);
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");
<?php
use Friendica\Core\L10n;
+use Friendica\Util\Temporal;
/**
* @param wdcal_local $localization
$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", $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");
$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"]);
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");
$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);
}
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 = [];
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)) {
$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)) {
$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)) {