Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/migrateto20.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
striptodos TINYINT(1) NULL,
stripalarms TINYINT(1) NULL,
stripattachments TINYINT(1) NULL,
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
UNIQUE(principaluri, uri)
);
");
Expand Down Expand Up @@ -360,7 +360,7 @@
addressbookid INT(11) UNSIGNED NOT NULL,
carddata MEDIUMBLOB,
uri VARCHAR(200),
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
etag VARBINARY(32),
size INT(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Expand Down
2 changes: 1 addition & 1 deletion bin/migrateto21.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
principaluri VARCHAR(255),
calendardata MEDIUMBLOB,
uri VARCHAR(200),
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
etag VARCHAR(32),
size INT(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Expand Down
11 changes: 5 additions & 6 deletions examples/addressbookserver.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?php

/*

Addressbook/CardDAV server example

This server features CardDAV support

*/

// settings
date_default_timezone_set('Canada/Eastern');

// Make sure this setting is turned on and reflect the root url for your WebDAV server.
// This can be for example the root / or a complete path to your server script
$baseUri = '/';
$baseUri = '/dav/addressbookserver.php';

/* Database */
$pdo = new PDO('sqlite:data/db.sqlite');
//$pdo = new PDO('sqlite:data/db.sqlite');
$pdo = new PDO('mysql:dbname=sabredav;host=127.0.0.1', 'username', 'password');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Autoloader
Expand All @@ -27,6 +25,7 @@
$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$carddavBackend = new Sabre\CardDAV\Backend\PDO($pdo);
//$caldavBackend = new Sabre\CalDAV\Backend\PDO($pdo);
$authBackend->setRealm('SabreDAV');

// Setting up the directory tree //
$nodes = [
Expand All @@ -48,4 +47,4 @@
$server->addPlugin(new Sabre\DAV\Sync\Plugin());

// And off we go!
$server->start();
$server->exec();
11 changes: 5 additions & 6 deletions examples/calendarserver.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?php

/*

CalendarServer example

This server features CalDAV support

*/

// settings
date_default_timezone_set('Canada/Eastern');

// If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
// You can override the baseUri here.
// $baseUri = '/';
$baseUri = '/dav/calendarserver.php';

/* Database */
$pdo = new PDO('sqlite:data/db.sqlite');
//$pdo = new PDO('sqlite:data/db.sqlite');
$pdo = new PDO('mysql:dbname=sabredav;host=127.0.0.1', 'username', 'password');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Files we need
Expand All @@ -26,6 +24,7 @@
$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$calendarBackend = new Sabre\CalDAV\Backend\PDO($pdo);
$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$authBackend->setRealm('SabreDAV');

// Directory structure
$tree = [
Expand Down Expand Up @@ -72,4 +71,4 @@
$server->addPlugin($browser);

// And off we go!
$server->start();
$server->exec();
2 changes: 1 addition & 1 deletion examples/sql/mysql.addressbooks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CREATE TABLE cards (
addressbookid INT(11) UNSIGNED NOT NULL,
carddata MEDIUMBLOB,
uri VARBINARY(200),
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
etag VARBINARY(32),
size INT(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Expand Down
10 changes: 5 additions & 5 deletions examples/sql/mysql.calendars.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ CREATE TABLE calendarobjects (
calendardata MEDIUMBLOB,
uri VARBINARY(200),
calendarid INTEGER UNSIGNED NOT NULL,
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
etag VARBINARY(32),
size INT(11) UNSIGNED NOT NULL,
componenttype VARBINARY(8),
firstoccurence INT(11) UNSIGNED,
lastoccurence INT(11) UNSIGNED,
firstoccurence BIGINT(11) UNSIGNED,
lastoccurence BIGINT(11) UNSIGNED,
uid VARBINARY(200),
UNIQUE(calendarid, uri),
INDEX calendarid_time (calendarid, firstoccurence)
Expand Down Expand Up @@ -61,7 +61,7 @@ CREATE TABLE calendarsubscriptions (
striptodos TINYINT(1) NULL,
stripalarms TINYINT(1) NULL,
stripattachments TINYINT(1) NULL,
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
UNIQUE(principaluri, uri)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Expand All @@ -70,7 +70,7 @@ CREATE TABLE schedulingobjects (
principaluri VARBINARY(255),
calendardata MEDIUMBLOB,
uri VARBINARY(200),
lastmodified INT(11) UNSIGNED,
lastmodified BIGINT(11) UNSIGNED,
etag VARBINARY(32),
size INT(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2 changes: 1 addition & 1 deletion examples/sql/pgsql.addressbooks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CREATE TABLE cards (
addressbookid INTEGER NOT NULL,
carddata BYTEA,
uri VARCHAR(200),
lastmodified INTEGER,
lastmodified BIGINT,
etag VARCHAR(32),
size INTEGER NOT NULL
);
Expand Down
10 changes: 5 additions & 5 deletions examples/sql/pgsql.calendars.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ CREATE TABLE calendarobjects (
calendardata BYTEA,
uri VARCHAR(200),
calendarid INTEGER NOT NULL,
lastmodified INTEGER,
lastmodified BIGINT,
etag VARCHAR(32),
size INTEGER NOT NULL,
componenttype VARCHAR(8),
firstoccurence INTEGER,
lastoccurence INTEGER,
firstoccurence BIGINT,
lastoccurence BIGINT,
uid VARCHAR(200)
);

Expand Down Expand Up @@ -71,7 +71,7 @@ CREATE TABLE calendarsubscriptions (
striptodos SMALLINT NULL,
stripalarms SMALLINT NULL,
stripattachments SMALLINT NULL,
lastmodified INTEGER
lastmodified BIGINT
);

ALTER TABLE ONLY calendarsubscriptions
Expand Down Expand Up @@ -99,7 +99,7 @@ CREATE TABLE schedulingobjects (
principaluri VARCHAR(255),
calendardata BYTEA,
uri VARCHAR(200),
lastmodified INTEGER,
lastmodified BIGINT,
etag VARCHAR(32),
size INTEGER NOT NULL
);
Expand Down
9 changes: 7 additions & 2 deletions lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* in 2038-01-19 to avoid problems when the date is converted
* to a unix timestamp.
*/
const MAX_DATE = '2038-01-01';
//2026-MAR-22 buckaroo-labs increase maximum date on 64-bit system (see MAX_DATE usage below).
const MAX_DATE = '2038-01-01';

/**
* pdo.
Expand Down Expand Up @@ -662,7 +663,11 @@ protected function getDenormalizedData($calendarData)
}
} else {
$it = new VObject\Recur\EventIterator($vObject, (string) $component->UID);
$maxDate = new \DateTime(self::MAX_DATE);

//2026-MAR-22 buckaroo-labs increase MAX_DATE on 64-bit system.
if (PHP_INT_SIZE<8) $maxDate = new \DateTime(self::MAX_DATE);
else $maxDate = new \DateTime('5000-01-01');

if ($it->isInfinite()) {
$lastOccurence = $maxDate->getTimeStamp();
} else {
Expand Down