Merge remote-tracking branch 'upstream/develop' into rewrites/coding-convention
Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
commit
09851331a9
17
boot.php
17
boot.php
|
@ -39,7 +39,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
|||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||
define ( 'FRIENDICA_VERSION', '3.5.2-dev' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1215 );
|
||||
define ( 'DB_UPDATE_VERSION', 1216 );
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
|
@ -441,10 +441,17 @@ define('SR_SCOPE_ALL', 'all');
|
|||
define('SR_SCOPE_TAGS', 'tags');
|
||||
/* @}*/
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined("SIGTERM"))
|
||||
define("SIGTERM", 15);
|
||||
/**
|
||||
* Lowest possible date time value
|
||||
*/
|
||||
|
||||
define ('NULL_DATE', '0001-01-01 00:00:00');
|
||||
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined("SIGTERM")) {
|
||||
define("SIGTERM", 15);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
||||
|
@ -2064,7 +2071,7 @@ function proc_run($cmd){
|
|||
}
|
||||
|
||||
// Checking number of workers
|
||||
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
|
||||
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));
|
||||
|
||||
// Get number of allowed number of worker threads
|
||||
$queues = intval(get_config("system", "worker_queues"));
|
||||
|
|
126
database.sql
126
database.sql
|
@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS `attach` (
|
|||
`filetype` varchar(64) NOT NULL DEFAULT '',
|
||||
`filesize` int(11) NOT NULL DEFAULT 0,
|
||||
`data` longblob NOT NULL,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`allow_cid` mediumtext,
|
||||
`allow_gid` mediumtext,
|
||||
`deny_cid` mediumtext,
|
||||
|
@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `cache` (
|
|||
`k` varbinary(255) NOT NULL,
|
||||
`v` mediumtext,
|
||||
`expire_mode` int(11) NOT NULL DEFAULT 0,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`k`),
|
||||
INDEX `expire_mode_updated` (`expire_mode`,`updated`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS `config` (
|
|||
CREATE TABLE IF NOT EXISTS `contact` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`self` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`remote_self` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`rel` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -145,14 +145,14 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
`usehub` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`subhub` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`hub-verify` varchar(255) NOT NULL DEFAULT '',
|
||||
`last-update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`success_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`failure_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`name-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`avatar-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`term-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last-item` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`priority` tinyint(3) NOT NULL DEFAULT 0,
|
||||
`blocked` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`readonly` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -197,8 +197,8 @@ CREATE TABLE IF NOT EXISTS `conv` (
|
|||
`recips` text,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`creator` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`subject` text,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`)
|
||||
|
@ -213,10 +213,10 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`summary` text,
|
||||
`desc` text,
|
||||
`location` text,
|
||||
|
@ -252,7 +252,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
|
|||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`pubkey` text,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `addr` (`addr`(32)),
|
||||
INDEX `url` (`url`)
|
||||
|
@ -293,7 +293,7 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
|
|||
`request` varchar(255) NOT NULL DEFAULT '',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '',
|
||||
`note` text,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
@ -320,10 +320,10 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
|
|||
`nurl` varchar(255) NOT NULL DEFAULT '',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '',
|
||||
`connect` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`updated` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
`location` varchar(255) NOT NULL DEFAULT '',
|
||||
`about` text,
|
||||
`keywords` text,
|
||||
|
@ -357,7 +357,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
|
|||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`gcid` int(11) NOT NULL DEFAULT 0,
|
||||
`zcid` int(11) NOT NULL DEFAULT 0,
|
||||
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
|
||||
INDEX `gcid` (`gcid`)
|
||||
|
@ -405,10 +405,10 @@ CREATE TABLE IF NOT EXISTS `gserver` (
|
|||
`noscrape` varchar(255) NOT NULL DEFAULT '',
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
`platform` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_poco_query` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`last_poco_query` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `nurl` (`nurl`(32))
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -438,7 +438,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
|
|||
`duplex` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`note` text,
|
||||
`hash` varchar(255) NOT NULL DEFAULT '',
|
||||
`datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`blocked` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`ignore` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`)
|
||||
|
@ -461,11 +461,11 @@ CREATE TABLE IF NOT EXISTS `item` (
|
|||
`parent-uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`extid` varchar(255) NOT NULL DEFAULT '',
|
||||
`thr-parent` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`owner-id` int(11) NOT NULL DEFAULT 0,
|
||||
`owner-name` varchar(255) NOT NULL DEFAULT '',
|
||||
`owner-link` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -564,7 +564,7 @@ CREATE TABLE IF NOT EXISTS `locks` (
|
|||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(128) NOT NULL DEFAULT '',
|
||||
`locked` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
@ -588,7 +588,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
|||
`unknown` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`parent-uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid_seen` (`uid`,`seen`),
|
||||
INDEX `convid` (`convid`),
|
||||
|
@ -612,7 +612,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
|
|||
`action` int(11) NOT NULL DEFAULT 0,
|
||||
`movetofolder` varchar(255) NOT NULL DEFAULT '',
|
||||
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
@ -637,7 +637,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
|
|||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`msg` mediumtext,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`link` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -673,7 +673,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
|
|||
CREATE TABLE IF NOT EXISTS `oembed` (
|
||||
`url` varbinary(255) NOT NULL,
|
||||
`content` mediumtext,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`url`),
|
||||
INDEX `created` (`created`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -686,7 +686,7 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
|
|||
`guessing` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`oembed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`content` mediumtext,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`url`,`guessing`,`oembed`),
|
||||
INDEX `created` (`created`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -713,8 +713,8 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
||||
`resource-id` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`desc` text,
|
||||
`album` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -776,7 +776,7 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
|
|||
CREATE TABLE IF NOT EXISTS `process` (
|
||||
`pid` int(10) unsigned NOT NULL,
|
||||
`command` varbinary(32) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`pid`),
|
||||
INDEX `command` (`command`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -802,7 +802,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
|
|||
`gender` varchar(32) NOT NULL DEFAULT '',
|
||||
`marital` varchar(255) NOT NULL DEFAULT '',
|
||||
`with` text,
|
||||
`howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`sexual` varchar(255) NOT NULL DEFAULT '',
|
||||
`politic` varchar(255) NOT NULL DEFAULT '',
|
||||
`religion` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -854,7 +854,7 @@ CREATE TABLE IF NOT EXISTS `push_subscriber` (
|
|||
`topic` varchar(255) NOT NULL DEFAULT '',
|
||||
`nickname` varchar(255) NOT NULL DEFAULT '',
|
||||
`push` int(11) NOT NULL DEFAULT 0,
|
||||
`last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`secret` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
@ -866,8 +866,8 @@ CREATE TABLE IF NOT EXISTS `queue` (
|
|||
`id` int(11) NOT NULL auto_increment,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`content` mediumtext,
|
||||
`batch` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
|
@ -884,7 +884,7 @@ CREATE TABLE IF NOT EXISTS `queue` (
|
|||
CREATE TABLE IF NOT EXISTS `register` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`hash` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`uid` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`password` varchar(255) NOT NULL DEFAULT '',
|
||||
`language` varchar(16) NOT NULL DEFAULT '',
|
||||
|
@ -938,7 +938,7 @@ CREATE TABLE IF NOT EXISTS `spam` (
|
|||
`spam` int(11) NOT NULL DEFAULT 0,
|
||||
`ham` int(11) NOT NULL DEFAULT 0,
|
||||
`term` varchar(255) NOT NULL DEFAULT '',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `spam` (`spam`),
|
||||
|
@ -957,8 +957,8 @@ CREATE TABLE IF NOT EXISTS `term` (
|
|||
`term` varchar(255) NOT NULL DEFAULT '',
|
||||
`url` varchar(255) NOT NULL DEFAULT '',
|
||||
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`global` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`aid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -979,11 +979,11 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
|||
`gcontact-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`owner-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`author-id` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`wall` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`private` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -1035,8 +1035,8 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
`openid` varchar(255) NOT NULL DEFAULT '',
|
||||
`timezone` varchar(128) NOT NULL DEFAULT '',
|
||||
`language` varchar(32) NOT NULL DEFAULT 'en',
|
||||
`register_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`login_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`default-location` varchar(255) NOT NULL DEFAULT '',
|
||||
`allow_location` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`theme` varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -1060,8 +1060,8 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
`expire` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`account_removed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`account_expired` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`account_expires_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`service_class` varchar(32) NOT NULL DEFAULT '',
|
||||
`def_gid` int(11) NOT NULL DEFAULT 0,
|
||||
`allow_cid` mediumtext,
|
||||
|
@ -1090,9 +1090,9 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
|
|||
`id` int(11) NOT NULL auto_increment,
|
||||
`parameter` text,
|
||||
`priority` tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`pid` int(11) NOT NULL DEFAULT 0,
|
||||
`executed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
) DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
|
|
@ -122,12 +122,14 @@ function terminate_friendship($user,$self,$contact) {
|
|||
// This provides for the possibility that their database is temporarily messed
|
||||
// up or some other transient event and that there's a possibility we could recover from it.
|
||||
|
||||
function mark_for_death($contact) {
|
||||
function mark_for_death(array $contact) {
|
||||
|
||||
if ($contact['archive'])
|
||||
if ($contact['archive']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($contact['term-date'] == '0000-00-00 00:00:00') {
|
||||
/// @TODO Comparison of strings this way may lead to bugs/incompatibility, better switch to DateTime
|
||||
if ($contact['term-date'] <= NULL_DATE) {
|
||||
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
intval($contact['id'])
|
||||
|
@ -185,13 +187,13 @@ function unmark_for_death($contact) {
|
|||
|
||||
// It's a miracle. Our dead contact has inexplicably come back to life.
|
||||
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d",
|
||||
dbesc('0000-00-00 00:00:00'),
|
||||
dbesc(NULL_DATE),
|
||||
intval($contact['id'])
|
||||
);
|
||||
|
||||
if ($contact['url'] != '') {
|
||||
q("UPDATE `contact` SET `term-date` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc('0000-00-00 00:00:00'),
|
||||
dbesc(NULL_DATE),
|
||||
dbesc(normalise_link($contact['url']))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ function cron_update_photo_albums() {
|
|||
function cron_expire_and_remove_users() {
|
||||
// expire any expired accounts
|
||||
q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0
|
||||
AND `account_expires_on` != '0000-00-00 00:00:00'
|
||||
AND `account_expires_on` < UTC_TIMESTAMP() ");
|
||||
AND `account_expires_on` > '%s'
|
||||
AND `account_expires_on` < UTC_TIMESTAMP()", dbesc(NULL_DATE));
|
||||
|
||||
// delete user and contact records for recently removed accounts
|
||||
$r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
|
||||
|
@ -214,11 +214,13 @@ function cron_poll_contacts($argc, $argv) {
|
|||
|
||||
$xml = false;
|
||||
|
||||
if ($manual_id)
|
||||
$contact['last-update'] = '0000-00-00 00:00:00';
|
||||
if ($manual_id) {
|
||||
$contact['last-update'] = NULL_DATE;
|
||||
}
|
||||
|
||||
if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS)))
|
||||
if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
|
||||
$contact['priority'] = 2;
|
||||
}
|
||||
|
||||
if ($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
|
||||
// We should be getting everything via a hub. But just to be sure, let's check once a day.
|
||||
|
|
|
@ -339,7 +339,7 @@ function relative_date($posted_date, $format = null) {
|
|||
|
||||
$abs = strtotime($localtime);
|
||||
|
||||
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
||||
if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === False) {
|
||||
return t('never');
|
||||
}
|
||||
|
||||
|
|
|
@ -96,17 +96,10 @@ class dbm {
|
|||
public static function date($date = 'now') {
|
||||
$timestamp = strtotime($date);
|
||||
|
||||
// Workaround for 3.5.1
|
||||
if ($timestamp < -62135596800) {
|
||||
return '0000-00-00 00:00:00';
|
||||
}
|
||||
|
||||
// The above will be removed in 3.5.2
|
||||
// The following will then be enabled
|
||||
// Don't allow lower date strings as '0001-01-01 00:00:00'
|
||||
//if ($timestamp < -62135596800) {
|
||||
// $timestamp = -62135596800;
|
||||
//}
|
||||
if ($timestamp < -62135596800) {
|
||||
$timestamp = -62135596800;
|
||||
}
|
||||
|
||||
return date('Y-m-d H:i:s', $timestamp);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
require_once("boot.php");
|
||||
require_once("include/text.php");
|
||||
|
||||
|
@ -144,7 +147,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
global $a, $db;
|
||||
|
||||
if ($action) {
|
||||
set_config('system', 'maintenance', 1);
|
||||
Config::set('system', 'maintenance', 1);
|
||||
Config::set('system', 'maintenance_reason', 'Database update');
|
||||
}
|
||||
|
||||
if (isset($a->config["system"]["db_charset"])) {
|
||||
|
@ -361,8 +365,10 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action)
|
||||
set_config('system', 'maintenance', 0);
|
||||
if ($action) {
|
||||
Config::set('system', 'maintenance', 0);
|
||||
Config::set('system', 'maintenance_reason', '');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
@ -536,8 +542,8 @@ function db_definition($charset) {
|
|||
"filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
|
||||
"filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"data" => array("type" => "longblob", "not null" => "1"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"allow_cid" => array("type" => "mediumtext"),
|
||||
"allow_gid" => array("type" => "mediumtext"),
|
||||
"deny_cid" => array("type" => "mediumtext"),
|
||||
|
@ -564,7 +570,7 @@ function db_definition($charset) {
|
|||
"k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
|
||||
"v" => array("type" => "mediumtext"),
|
||||
"expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("k"),
|
||||
|
@ -613,7 +619,7 @@ function db_definition($charset) {
|
|||
"fields" => array(
|
||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
|
@ -651,14 +657,14 @@ function db_definition($charset) {
|
|||
"usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
|
||||
"blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
|
||||
"readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
|
@ -703,8 +709,8 @@ function db_definition($charset) {
|
|||
"recips" => array("type" => "text"),
|
||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"subject" => array("type" => "text"),
|
||||
),
|
||||
"indexes" => array(
|
||||
|
@ -719,10 +725,10 @@ function db_definition($charset) {
|
|||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"summary" => array("type" => "text"),
|
||||
"desc" => array("type" => "text"),
|
||||
"location" => array("type" => "text"),
|
||||
|
@ -758,7 +764,7 @@ function db_definition($charset) {
|
|||
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"pubkey" => array("type" => "text"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -799,7 +805,7 @@ function db_definition($charset) {
|
|||
"request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"note" => array("type" => "text"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -826,10 +832,10 @@ function db_definition($charset) {
|
|||
"nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"updated" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
"last_contact" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
"last_failure" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"about" => array("type" => "text"),
|
||||
"keywords" => array("type" => "text"),
|
||||
|
@ -863,7 +869,7 @@ function db_definition($charset) {
|
|||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -911,10 +917,10 @@ function db_definition($charset) {
|
|||
"noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
"last_contact" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
"last_failure" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -944,7 +950,7 @@ function db_definition($charset) {
|
|||
"duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"note" => array("type" => "text"),
|
||||
"hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
|
||||
"ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
),
|
||||
|
@ -967,11 +973,11 @@ function db_definition($charset) {
|
|||
"parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
@ -1070,7 +1076,7 @@ function db_definition($charset) {
|
|||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
||||
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1094,7 +1100,7 @@ function db_definition($charset) {
|
|||
"unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1118,7 +1124,7 @@ function db_definition($charset) {
|
|||
"action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1143,7 +1149,7 @@ function db_definition($charset) {
|
|||
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"msg" => array("type" => "mediumtext"),
|
||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
@ -1179,7 +1185,7 @@ function db_definition($charset) {
|
|||
"fields" => array(
|
||||
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
|
||||
"content" => array("type" => "mediumtext"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("url"),
|
||||
|
@ -1192,7 +1198,7 @@ function db_definition($charset) {
|
|||
"guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
|
||||
"oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
|
||||
"content" => array("type" => "mediumtext"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("url", "guessing", "oembed"),
|
||||
|
@ -1219,8 +1225,8 @@ function db_definition($charset) {
|
|||
"contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||
"guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
|
||||
"resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"desc" => array("type" => "text"),
|
||||
"album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
@ -1282,7 +1288,7 @@ function db_definition($charset) {
|
|||
"fields" => array(
|
||||
"pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
|
||||
"command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("pid"),
|
||||
|
@ -1308,7 +1314,7 @@ function db_definition($charset) {
|
|||
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"with" => array("type" => "text"),
|
||||
"howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
@ -1360,7 +1366,7 @@ function db_definition($charset) {
|
|||
"topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
),
|
||||
"indexes" => array(
|
||||
|
@ -1372,8 +1378,8 @@ function db_definition($charset) {
|
|||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"content" => array("type" => "mediumtext"),
|
||||
"batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
),
|
||||
|
@ -1390,7 +1396,7 @@ function db_definition($charset) {
|
|||
"fields" => array(
|
||||
"id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
|
||||
|
@ -1444,7 +1450,7 @@ function db_definition($charset) {
|
|||
"spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1463,8 +1469,8 @@ function db_definition($charset) {
|
|||
"term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||
|
@ -1485,11 +1491,11 @@ function db_definition($charset) {
|
|||
"gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
|
@ -1541,8 +1547,8 @@ function db_definition($charset) {
|
|||
"openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
||||
"language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
|
||||
"register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
@ -1566,8 +1572,8 @@ function db_definition($charset) {
|
|||
"expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
|
||||
"account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"allow_cid" => array("type" => "mediumtext"),
|
||||
|
@ -1596,9 +1602,9 @@ function db_definition($charset) {
|
|||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"parameter" => array("type" => "text"),
|
||||
"priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
"pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
|
||||
"executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
|
|
@ -1182,7 +1182,8 @@ class dfrn {
|
|||
return 3;
|
||||
}
|
||||
|
||||
if ($contact['term-date'] != '0000-00-00 00:00:00') {
|
||||
/// @TODO Really compare with > here? Maybe DateTime (which allows such comparison again) is much safer/correcter
|
||||
if ($contact['term-date'] > NULL_DATE) {
|
||||
logger("dfrn_deliver: $url back from the dead - removing mark for death");
|
||||
require_once('include/Contact.php');
|
||||
unmark_for_death($contact);
|
||||
|
|
|
@ -4,39 +4,42 @@
|
|||
* @brief functions specific to event handling
|
||||
*/
|
||||
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/map.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/map.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
function format_event_html($ev, $simple = false) {
|
||||
|
||||
if (! ((is_array($ev)) && count($ev)))
|
||||
if (! ((is_array($ev)) && count($ev))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
|
||||
|
||||
$event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
||||
$ev['start'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['start'] , $bd_format)));
|
||||
|
||||
$event_end = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
|
||||
$ev['finish'] , $bd_format ))
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
: day_translate(datetime_convert('UTC', 'UTC',
|
||||
$ev['finish'] , $bd_format )));
|
||||
|
||||
if ($simple) {
|
||||
$o = "<h3>".bbcode($ev['summary'])."</h3>";
|
||||
$o = "<h3>" . bbcode($ev['summary']) . "</h3>";
|
||||
|
||||
$o .= "<p>".bbcode($ev['desc'])."</p>";
|
||||
$o .= "<p>" . bbcode($ev['desc']) . "</p>";
|
||||
|
||||
$o .= "<h4>".t('Starts:')."</h4><p>".$event_start."</p>";
|
||||
$o .= "<h4>" . t('Starts:') . "</h4><p>" . $event_start . "</p>";
|
||||
|
||||
if (! $ev['nofinish'])
|
||||
$o .= "<h4>".t('Finishes:')."</h4><p>".$event_end."</p>";
|
||||
if (! $ev['nofinish']) {
|
||||
$o .= "<h4>" . t('Finishes:') . "</h4><p>" . $event_end ."</p>";
|
||||
}
|
||||
|
||||
if (strlen($ev['location']))
|
||||
$o .= "<h4>".t('Location:')."</h4><p>".$ev['location']."</p>";
|
||||
if (strlen($ev['location'])) {
|
||||
$o .= "<h4>" . t('Location:') . "</h4><p>" . $ev['location'] . "</p>";
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
@ -44,31 +47,34 @@ function format_event_html($ev, $simple = false) {
|
|||
$o = '<div class="vevent">' . "\r\n";
|
||||
|
||||
|
||||
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
|
||||
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
|
||||
|
||||
$o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
|
||||
$o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
|
||||
|
||||
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
|
||||
. datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. '" >'.$event_start
|
||||
. '</abbr></p>' . "\r\n";
|
||||
|
||||
if (! $ev['nofinish'])
|
||||
if (! $ev['nofinish']) {
|
||||
$o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="'
|
||||
. datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. datetime_convert('UTC', 'UTC', $ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
|
||||
. '" >'.$event_end
|
||||
. '</abbr></p>' . "\r\n";
|
||||
. '</abbr></p>' . "\r\n";
|
||||
}
|
||||
|
||||
if (strlen($ev['location'])){
|
||||
if (strlen($ev['location'])) {
|
||||
$o .= '<p class="event-location"> ' . t('Location:') . ' <span class="location">'
|
||||
. bbcode($ev['location'])
|
||||
. '</span></p>' . "\r\n";
|
||||
|
||||
if (strpos($ev['location'], "[map") !== False) {
|
||||
// Include a map of the location if the [map] BBCode is used
|
||||
if (strpos($ev['location'], "[map") !== false) {
|
||||
$map = generate_named_map($ev['location']);
|
||||
if ($map!==$ev['location']) $o.=$map;
|
||||
if ($map !== $ev['location']) {
|
||||
$o.= $map;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$o .= '</div>' . "\r\n";
|
||||
|
@ -146,63 +152,81 @@ function format_event_bbcode($ev) {
|
|||
|
||||
$o = '';
|
||||
|
||||
if ($ev['summary'])
|
||||
if ($ev['summary']) {
|
||||
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
|
||||
}
|
||||
|
||||
if ($ev['desc'])
|
||||
if ($ev['desc']) {
|
||||
$o .= '[event-description]' . $ev['desc'] . '[/event-description]';
|
||||
}
|
||||
|
||||
if ($ev['start'])
|
||||
if ($ev['start']) {
|
||||
$o .= '[event-start]' . $ev['start'] . '[/event-start]';
|
||||
}
|
||||
|
||||
if (($ev['finish']) && (! $ev['nofinish']))
|
||||
if (($ev['finish']) && (! $ev['nofinish'])) {
|
||||
$o .= '[event-finish]' . $ev['finish'] . '[/event-finish]';
|
||||
}
|
||||
|
||||
if ($ev['location'])
|
||||
if ($ev['location']) {
|
||||
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
|
||||
}
|
||||
|
||||
if ($ev['adjust'])
|
||||
if ($ev['adjust']) {
|
||||
$o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]';
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
function bbtovcal($s) {
|
||||
$o = '';
|
||||
$ev = bbtoevent($s);
|
||||
if ($ev['desc'])
|
||||
|
||||
if ($ev['desc']) {
|
||||
$o = format_event_html($ev);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
function bbtoevent($s) {
|
||||
|
||||
$ev = array();
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is",$s,$match))
|
||||
if (preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is", $s, $match)) {
|
||||
$ev['summary'] = $match[1];
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
|
||||
$ev['desc'] = $match[1];
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is",$s,$match))
|
||||
$ev['start'] = $match[1];
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-finish\](.*?)\[\/event\-finish\]/is",$s,$match))
|
||||
$ev['finish'] = $match[1];
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-location\](.*?)\[\/event\-location\]/is",$s,$match))
|
||||
$ev['location'] = $match[1];
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
|
||||
$ev['adjust'] = $match[1];
|
||||
$ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
return $ev;
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is", $s, $match)) {
|
||||
$ev['desc'] = $match[1];
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is", $s, $match)) {
|
||||
$ev['start'] = $match[1];
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-finish\](.*?)\[\/event\-finish\]/is", $s, $match)) {
|
||||
$ev['finish'] = $match[1];
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-location\](.*?)\[\/event\-location\]/is", $s, $match)) {
|
||||
$ev['location'] = $match[1];
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is", $s, $match)) {
|
||||
$ev['adjust'] = $match[1];
|
||||
}
|
||||
|
||||
$ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
|
||||
return $ev;
|
||||
}
|
||||
|
||||
|
||||
|
@ -212,21 +236,22 @@ function sort_by_date($a) {
|
|||
return $a;
|
||||
}
|
||||
|
||||
|
||||
function ev_compare($a,$b) {
|
||||
|
||||
$date_a = (($a['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$a['start']) : $a['start']);
|
||||
$date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['start']) : $b['start']);
|
||||
$date_a = (($a['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $a['start']) : $a['start']);
|
||||
$date_b = (($b['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $b['start']) : $b['start']);
|
||||
|
||||
if ($date_a === $date_b)
|
||||
return strcasecmp($a['desc'],$b['desc']);
|
||||
if ($date_a === $date_b) {
|
||||
return strcasecmp($a['desc'], $b['desc']);
|
||||
}
|
||||
|
||||
return strcmp($date_a,$date_b);
|
||||
return strcmp($date_a, $date_b);
|
||||
}
|
||||
|
||||
function event_delete($event_id) {
|
||||
if ($event_id == 0)
|
||||
if ($event_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
q("DELETE FROM `event` WHERE `id` = %d", intval($event_id));
|
||||
logger("Deleted event ".$event_id, LOGGER_DEBUG);
|
||||
|
@ -234,32 +259,34 @@ function event_delete($event_id) {
|
|||
|
||||
function event_store($arr) {
|
||||
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/items.php');
|
||||
require_once('include/bbcode.php');
|
||||
require_once 'include/datetime.php';
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
||||
$a = get_app();
|
||||
|
||||
$arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
|
||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
||||
$arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid']));
|
||||
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
||||
$arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
|
||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
||||
$arr['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid']));
|
||||
$arr['private'] = ((x($arr, 'private')) ? intval($arr['private']) : 0);
|
||||
$arr['guid'] = get_guid(32);
|
||||
|
||||
if ($arr['cid'])
|
||||
if ($arr['cid']) {
|
||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($arr['cid']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
else
|
||||
} else {
|
||||
$c = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
intval($arr['uid'])
|
||||
);
|
||||
}
|
||||
|
||||
if (count($c))
|
||||
if (dbm::is_result($c)) {
|
||||
$contact = $c[0];
|
||||
}
|
||||
|
||||
|
||||
// Existing event being modified
|
||||
|
@ -280,7 +307,7 @@ function event_store($arr) {
|
|||
intval($arr['id']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
return((dbm::is_result($r)) ? $r[0]['id'] : 0);
|
||||
return ((dbm::is_result($r)) ? $r[0]['id'] : 0);
|
||||
}
|
||||
|
||||
// The event changed. Update it.
|
||||
|
@ -318,7 +345,6 @@ function event_store($arr) {
|
|||
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
|
||||
$object .= '</object>' . "\n";
|
||||
|
||||
|
||||
q("UPDATE `item` SET `body` = '%s', `object` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||
dbesc(format_event_bbcode($arr)),
|
||||
dbesc($object),
|
||||
|
@ -328,8 +354,9 @@ function event_store($arr) {
|
|||
);
|
||||
|
||||
$item_id = $r[0]['id'];
|
||||
} else
|
||||
} else {
|
||||
$item_id = 0;
|
||||
}
|
||||
|
||||
call_hooks("event_updated", $arr['id']);
|
||||
|
||||
|
@ -366,8 +393,9 @@ function event_store($arr) {
|
|||
dbesc($arr['uri']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$event = $r[0];
|
||||
}
|
||||
|
||||
$item_arr = array();
|
||||
|
||||
|
@ -399,7 +427,7 @@ function event_store($arr) {
|
|||
$item_arr['body'] = format_event_bbcode($event);
|
||||
|
||||
|
||||
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
|
||||
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
|
||||
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
|
||||
$item_arr['object'] .= '</object>' . "\n";
|
||||
|
||||
|
@ -433,12 +461,17 @@ function event_store($arr) {
|
|||
}
|
||||
|
||||
function get_event_strings() {
|
||||
|
||||
// First day of the week (0 = Sunday)
|
||||
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
|
||||
if ($firstDay === false) $firstDay=0;
|
||||
$firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week');
|
||||
if ($firstDay === false) {
|
||||
$firstDay = 0;
|
||||
}
|
||||
|
||||
$i18n = array(
|
||||
"firstDay" => $firstDay,
|
||||
"allday" => t("all-day"),
|
||||
|
||||
"Sun" => t("Sun"),
|
||||
"Mon" => t("Mon"),
|
||||
"Tue" => t("Tue"),
|
||||
|
@ -446,13 +479,15 @@ function get_event_strings() {
|
|||
"Thu" => t("Thu"),
|
||||
"Fri" => t("Fri"),
|
||||
"Sat" => t("Sat"),
|
||||
"Sunday" => t("Sunday"),
|
||||
"Monday" => t("Monday"),
|
||||
"Tuesday" => t("Tuesday"),
|
||||
|
||||
"Sunday" => t("Sunday"),
|
||||
"Monday" => t("Monday"),
|
||||
"Tuesday" => t("Tuesday"),
|
||||
"Wednesday" => t("Wednesday"),
|
||||
"Thursday" => t("Thursday"),
|
||||
"Friday" => t("Friday"),
|
||||
"Saturday" => t("Saturday"),
|
||||
"Thursday" => t("Thursday"),
|
||||
"Friday" => t("Friday"),
|
||||
"Saturday" => t("Saturday"),
|
||||
|
||||
"Jan" => t("Jan"),
|
||||
"Feb" => t("Feb"),
|
||||
"Mar" => t("Mar"),
|
||||
|
@ -465,47 +500,49 @@ function get_event_strings() {
|
|||
"Oct" => t("Oct"),
|
||||
"Nov" => t("Nov"),
|
||||
"Dec" => t("Dec"),
|
||||
"January" => t("January"),
|
||||
"February" => t("February"),
|
||||
"March" => t("March"),
|
||||
"April" => t("April"),
|
||||
"May" => t("May"),
|
||||
"June" => t("June"),
|
||||
"July" => t("July"),
|
||||
"August" => t("August"),
|
||||
|
||||
"January" => t("January"),
|
||||
"February" => t("February"),
|
||||
"March" => t("March"),
|
||||
"April" => t("April"),
|
||||
"May" => t("May"),
|
||||
"June" => t("June"),
|
||||
"July" => t("July"),
|
||||
"August" => t("August"),
|
||||
"September" => t("September"),
|
||||
"October" => t("October"),
|
||||
"November" => t("November"),
|
||||
"December" => t("December"),
|
||||
"October" => t("October"),
|
||||
"November" => t("November"),
|
||||
"December" => t("December"),
|
||||
|
||||
"today" => t("today"),
|
||||
"month" => t("month"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
"allday" => t("all-day"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
|
||||
"noevent" => t("No events to display"),
|
||||
|
||||
"dtstart_label" => t("Starts:"),
|
||||
"dtend_label" => t("Finishes:"),
|
||||
"dtstart_label" => t("Starts:"),
|
||||
"dtend_label" => t("Finishes:"),
|
||||
"location_label" => t("Location:")
|
||||
);
|
||||
|
||||
return $i18n;
|
||||
}
|
||||
|
||||
/// @todo We should replace this with a separate update function if there is some time left
|
||||
/**
|
||||
* @brief Removes duplicated birthday events
|
||||
*
|
||||
* @param array $dates Array of possibly duplicated events
|
||||
* @return array Cleaned events
|
||||
*
|
||||
* @todo We should replace this with a separate update function if there is some time left
|
||||
*/
|
||||
function event_remove_duplicates($dates) {
|
||||
$dates2 = array();
|
||||
|
||||
foreach ($dates AS $date) {
|
||||
if ($date['type'] == 'birthday') {
|
||||
$dates2[$date['uid']."-".$date['cid']."-".$date['start']] = $date;
|
||||
$dates2[$date['uid'] . "-" . $date['cid'] . "-" . $date['start']] = $date;
|
||||
} else {
|
||||
$dates2[] = $date;
|
||||
}
|
||||
|
@ -524,10 +561,11 @@ function event_remove_duplicates($dates) {
|
|||
*/
|
||||
function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') {
|
||||
// ownly allow events if there is a valid owner_id
|
||||
if ($owner_uid == 0)
|
||||
if ($owner_uid == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// query for the event by event id
|
||||
// Query for the event by event id
|
||||
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
|
||||
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`
|
||||
LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`
|
||||
|
@ -556,11 +594,12 @@ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') {
|
|||
* @return array Query results
|
||||
*/
|
||||
function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') {
|
||||
// ownly allow events if there is a valid owner_id
|
||||
if ($owner_uid == 0)
|
||||
// Only allow events if there is a valid owner_id
|
||||
if ($owner_uid == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// query for the event by date
|
||||
// Query for the event by date
|
||||
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
|
||||
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`
|
||||
LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`
|
||||
|
@ -590,51 +629,59 @@ function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') {
|
|||
* @return array Event array for the template
|
||||
*/
|
||||
function process_events($arr) {
|
||||
$events=array();
|
||||
$events = array();
|
||||
|
||||
$last_date = '';
|
||||
$fmt = t('l, F j');
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $rr) {
|
||||
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||
$d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt));
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
|
||||
$d = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt));
|
||||
$d = day_translate($d);
|
||||
|
||||
$start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
|
||||
if ($rr['nofinish']){
|
||||
$start = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c'));
|
||||
if ($rr['nofinish']) {
|
||||
$end = null;
|
||||
} else {
|
||||
$end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
|
||||
$end = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c'));
|
||||
}
|
||||
|
||||
|
||||
$is_first = ($d !== $last_date);
|
||||
|
||||
$last_date = $d;
|
||||
$edit = ((! $rr['cid']) ? array(App::get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
|
||||
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
|
||||
|
||||
// Show edit and drop actions only if the user is the owner of the event and the event
|
||||
// is a real event (no bithdays)
|
||||
if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') {
|
||||
$edit = ((! $rr['cid']) ? array(App::get_baseurl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null);
|
||||
$drop = array(App::get_baseurl() . '/events/drop/' . $rr['id'], t('Delete event'), '', '');
|
||||
}
|
||||
|
||||
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
|
||||
if (! $title) {
|
||||
list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
|
||||
$title = strip_tags(html_entity_decode($title,ENT_QUOTES,'UTF-8'));
|
||||
list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
|
||||
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
|
||||
$html = format_event_html($rr);
|
||||
$rr['desc'] = bbcode($rr['desc']);
|
||||
$rr['location'] = bbcode($rr['location']);
|
||||
$events[] = array(
|
||||
'id'=>$rr['id'],
|
||||
'start'=> $start,
|
||||
'end' => $end,
|
||||
'id' => $rr['id'],
|
||||
'start' => $start,
|
||||
'end' => $end,
|
||||
'allDay' => false,
|
||||
'title' => $title,
|
||||
'title' => $title,
|
||||
|
||||
'j' => $j,
|
||||
'd' => $d,
|
||||
'is_first'=>$is_first,
|
||||
'item'=>$rr,
|
||||
'html'=>$html,
|
||||
'plink' => array($rr['plink'],t('link to source'),'',''),
|
||||
'j' => $j,
|
||||
'd' => $d,
|
||||
'edit' => $edit,
|
||||
'drop' => $drop,
|
||||
'is_first' => $is_first,
|
||||
'item' => $rr,
|
||||
'html' => $html,
|
||||
'plink' => array($rr['plink'], t('link to source'), '', ''),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -652,34 +699,36 @@ function process_events($arr) {
|
|||
* @return string Content according to selected export format
|
||||
*/
|
||||
function event_format_export ($events, $format = 'ical', $timezone) {
|
||||
if (! ((is_array($events)) && count($events)))
|
||||
if (! ((is_array($events)) && count($events))) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($format) {
|
||||
// format the exported data as a CSV file
|
||||
// Format the exported data as a CSV file
|
||||
case "csv":
|
||||
header("Content-type: text/csv");
|
||||
$o = '"Subject", "Start Date", "Start Time", "Description", "End Date", "End Time", "Location"' . PHP_EOL;
|
||||
|
||||
foreach ($events as $event) {
|
||||
/// @todo the time / date entries don't include any information about the
|
||||
// timezone the event is scheduled in :-/
|
||||
/// @todo The time / date entries don't include any information about the
|
||||
/// timezone the event is scheduled in :-/
|
||||
$tmp1 = strtotime($event['start']);
|
||||
$tmp2 = strtotime($event['finish']);
|
||||
$time_format = "%H:%M:%S";
|
||||
$date_format = "%Y-%m-%d";
|
||||
$o .= '"'.$event['summary'].'", "'.strftime($date_format, $tmp1) .
|
||||
'", "'.strftime($time_format, $tmp1).'", "'.$event['desc'] .
|
||||
'", "'.strftime($date_format, $tmp2) .
|
||||
'", "'.strftime($time_format, $tmp2) .
|
||||
'", "'.$event['location'].'"' . PHP_EOL;
|
||||
|
||||
$o .= '"' . $event['summary'] . '", "' . strftime($date_format, $tmp1) .
|
||||
'", "' . strftime($time_format, $tmp1) . '", "' . $event['desc'] .
|
||||
'", "' . strftime($date_format, $tmp2) .
|
||||
'", "' . strftime($time_format, $tmp2) .
|
||||
'", "' . $event['location'] . '"' . PHP_EOL;
|
||||
}
|
||||
break;
|
||||
|
||||
// format the exported data as a ics file
|
||||
// Format the exported data as a ics file
|
||||
case "ical":
|
||||
header("Content-type: text/ics");
|
||||
$o = 'BEGIN:VCALENDAR'. PHP_EOL
|
||||
$o = 'BEGIN:VCALENDAR' . PHP_EOL
|
||||
. 'VERSION:2.0' . PHP_EOL
|
||||
. 'PRODID:-//friendica calendar export//0.1//EN' . PHP_EOL;
|
||||
/// @todo include timezone informations in cases were the time is not in UTC
|
||||
|
@ -691,35 +740,43 @@ function event_format_export ($events, $format = 'ical', $timezone) {
|
|||
// but test your solution against http://icalvalid.cloudapp.net/
|
||||
// also long lines SHOULD be split at 75 characters length
|
||||
foreach ($events as $event) {
|
||||
|
||||
if ($event['adjust'] == 1) {
|
||||
$UTC = 'Z';
|
||||
} else {
|
||||
$UTC = '';
|
||||
}
|
||||
$o .= 'BEGIN:VEVENT' . PHP_EOL;
|
||||
if ($event[start]) {
|
||||
|
||||
if ($event['start']) {
|
||||
$tmp = strtotime($event['start']);
|
||||
$dtformat = "%Y%m%dT%H%M%S".$UTC;
|
||||
$o .= 'DTSTART:'.strftime($dtformat, $tmp).PHP_EOL;
|
||||
$dtformat = "%Y%m%dT%H%M%S" . $UTC;
|
||||
$o .= 'DTSTART:' . strftime($dtformat, $tmp) . PHP_EOL;
|
||||
}
|
||||
|
||||
if (!$event['nofinish']) {
|
||||
$tmp = strtotime($event['finish']);
|
||||
$dtformat = "%Y%m%dT%H%M%S".$UTC;
|
||||
$o .= 'DTEND:'.strftime($dtformat, $tmp).PHP_EOL;
|
||||
$dtformat = "%Y%m%dT%H%M%S" . $UTC;
|
||||
$o .= 'DTEND:' . strftime($dtformat, $tmp) . PHP_EOL;
|
||||
}
|
||||
if ($event['summary'])
|
||||
|
||||
if ($event['summary']) {
|
||||
$tmp = $event['summary'];
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL . ' ', $tmp);
|
||||
$tmp = addcslashes($tmp, ',;');
|
||||
$o .= 'SUMMARY:' . $tmp . PHP_EOL;
|
||||
if ($event['desc'])
|
||||
}
|
||||
|
||||
if ($event['desc']) {
|
||||
$tmp = $event['desc'];
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL . ' ', $tmp);
|
||||
$tmp = addcslashes($tmp, ',;');
|
||||
$o .= 'DESCRIPTION:' . $tmp . PHP_EOL;
|
||||
}
|
||||
|
||||
if ($event['location']) {
|
||||
$tmp = $event['location'];
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
|
||||
$tmp = str_replace(PHP_EOL, PHP_EOL . ' ', $tmp);
|
||||
$tmp = addcslashes($tmp, ',;');
|
||||
$o .= 'LOCATION:' . $tmp . PHP_EOL;
|
||||
}
|
||||
|
@ -759,9 +816,9 @@ function events_by_uid($uid = 0, $sql_extra = '') {
|
|||
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' ";
|
||||
}
|
||||
|
||||
// does the user who requests happen to be the owner of the events
|
||||
// requested? then show all of your events, otherwise only those that
|
||||
// don't have limitations set in allow_cid and allow_gid
|
||||
// Does the user who requests happen to be the owner of the events
|
||||
// requested? then show all of your events, otherwise only those that
|
||||
// don't have limitations set in allow_cid and allow_gid
|
||||
if (local_user() == $uid) {
|
||||
$r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location`, `nofinish`
|
||||
FROM `event` WHERE `uid`= %d AND `cid` = 0 ",
|
||||
|
@ -795,18 +852,18 @@ function event_export($uid, $format = 'ical') {
|
|||
|
||||
$process = false;
|
||||
|
||||
// we are allowed to show events
|
||||
// We are allowed to show events
|
||||
// get the timezone the user is in
|
||||
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
|
||||
if (dbm::is_result($r)) {
|
||||
$timezone = $r[0]['timezone'];
|
||||
}
|
||||
|
||||
// get all events which are owned by a uid (respects permissions);
|
||||
// Get all events which are owned by a uid (respects permissions);
|
||||
$events = events_by_uid($uid);
|
||||
|
||||
// we have the events that are available for the requestor
|
||||
// now format the output according to the requested format
|
||||
// We have the events that are available for the requestor
|
||||
// now format the output according to the requested format
|
||||
if (count($events)) {
|
||||
$res = event_format_export($events, $format, $timezone);
|
||||
}
|
||||
|
@ -816,7 +873,7 @@ function event_export($uid, $format = 'ical') {
|
|||
$process = true;
|
||||
}
|
||||
|
||||
// get the file extension for the format
|
||||
// Get the file extension for the format
|
||||
switch ($format) {
|
||||
case "ical":
|
||||
$file_ext = "ics";
|
||||
|
@ -831,10 +888,10 @@ function event_export($uid, $format = 'ical') {
|
|||
}
|
||||
|
||||
$arr = array(
|
||||
'success' => $process,
|
||||
'format' => $format,
|
||||
'success' => $process,
|
||||
'format' => $format,
|
||||
'extension' => $file_ext,
|
||||
'content' => $res,
|
||||
'content' => $res,
|
||||
);
|
||||
|
||||
return $arr;
|
||||
|
@ -883,5 +940,4 @@ function widget_events() {
|
|||
'$export_csv' => t("Export calendar as csv"),
|
||||
'$user' => $user
|
||||
));
|
||||
|
||||
}
|
||||
|
|
|
@ -652,7 +652,7 @@ function advanced_profile(App $a) {
|
|||
$profile['marital']['with'] = $a->profile['with'];
|
||||
}
|
||||
|
||||
if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
|
||||
if (strlen($a->profile['howlong']) && $a->profile['howlong'] >= NULL_DATE) {
|
||||
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
|||
|
||||
if (! function_exists('unlock_function')) {
|
||||
function unlock_function($fn_name) {
|
||||
$r = q("UPDATE `locks` SET `locked` = 0, `created` = '0000-00-00 00:00:00' WHERE `name` = '%s'",
|
||||
$r = q("UPDATE `locks` SET `locked` = 0, `created` = '%s' WHERE `name` = '%s'",
|
||||
dbesc(NULL_DATE),
|
||||
dbesc($fn_name)
|
||||
);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ function onepoll_run(&$argv, &$argc){
|
|||
|
||||
logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
|
||||
|
||||
$last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE)
|
||||
? datetime_convert('UTC','UTC','now - 7 days', ATOM_TIME)
|
||||
: datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
|
||||
);
|
||||
|
@ -239,7 +239,7 @@ function onepoll_run(&$argv, &$argc){
|
|||
intval($contact['id'])
|
||||
);
|
||||
mark_for_death($contact);
|
||||
} elseif ($contact['term-date'] != '0000-00-00 00:00:00') {
|
||||
} elseif ($contact['term-date'] > NULL_DATE) {
|
||||
logger("poller: $url back from the dead - removing mark for death");
|
||||
unmark_for_death($contact);
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ function poller_max_connections_reached() {
|
|||
*
|
||||
*/
|
||||
function poller_kill_stale_workers() {
|
||||
$r = q("SELECT `pid`, `executed`, `priority`, `parameter` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
|
||||
$r = q("SELECT `pid`, `executed`, `priority`, `parameter` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));
|
||||
|
||||
if (!dbm::is_result($r)) {
|
||||
// No processing here needed
|
||||
|
@ -366,14 +366,15 @@ function poller_kill_stale_workers() {
|
|||
|
||||
foreach ($r AS $pid)
|
||||
if (!posix_kill($pid["pid"], 0)) {
|
||||
q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",
|
||||
intval($pid["pid"]));
|
||||
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
|
||||
dbesc(NULL_DATE), intval($pid["pid"]));
|
||||
} else {
|
||||
// Kill long running processes
|
||||
|
||||
// Check if the priority is in a valid range
|
||||
if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE)))
|
||||
if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE))) {
|
||||
$pid["priority"] = PRIORITY_MEDIUM;
|
||||
}
|
||||
|
||||
// Define the maximum durations
|
||||
$max_duration_defaults = array(PRIORITY_CRITICAL => 360, PRIORITY_HIGH => 10, PRIORITY_MEDIUM => 60, PRIORITY_LOW => 180, PRIORITY_NEGLIGIBLE => 360);
|
||||
|
@ -391,8 +392,9 @@ function poller_kill_stale_workers() {
|
|||
// We killed the stale process.
|
||||
// To avoid a blocking situation we reschedule the process at the beginning of the queue.
|
||||
// Additionally we are lowering the priority.
|
||||
q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `created` = '%s',
|
||||
q("UPDATE `workerqueue` SET `executed` = '%s', `created` = '%s',
|
||||
`priority` = %d, `pid` = 0 WHERE `pid` = %d",
|
||||
dbesc(NULL_DATE),
|
||||
dbesc(datetime_convert()),
|
||||
intval(PRIORITY_NEGLIGIBLE),
|
||||
intval($pid["pid"]));
|
||||
|
@ -400,6 +402,7 @@ function poller_kill_stale_workers() {
|
|||
logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -426,15 +429,15 @@ function poller_too_much_workers() {
|
|||
$slope = $maxworkers / pow($maxsysload, $exponent);
|
||||
$queues = ceil($slope * pow(max(0, $maxsysload - $load), $exponent));
|
||||
|
||||
$s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00'");
|
||||
$s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE));
|
||||
$entries = $s[0]["total"];
|
||||
|
||||
if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($entries > 0) AND ($active >= $queues)) {
|
||||
$s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority` LIMIT 1");
|
||||
$s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE));
|
||||
$top_priority = $s[0]["priority"];
|
||||
|
||||
$s = q("SELECT `id` FROM `workerqueue` WHERE `priority` <= %d AND `executed` != '0000-00-00 00:00:00' LIMIT 1",
|
||||
intval($top_priority));
|
||||
$s = q("SELECT `id` FROM `workerqueue` WHERE `priority` <= %d AND `executed` > '%s' LIMIT 1",
|
||||
intval($top_priority), dbesc(NULL_DATE));
|
||||
$high_running = dbm::is_result($s);
|
||||
|
||||
if (!$high_running AND ($top_priority > PRIORITY_UNDEFINED) AND ($top_priority < PRIORITY_NEGLIGIBLE)) {
|
||||
|
@ -554,21 +557,25 @@ function poller_worker_process() {
|
|||
if (poller_passing_slow($highest_priority)) {
|
||||
// Are there waiting processes with a higher priority than the currently highest?
|
||||
$r = q("SELECT * FROM `workerqueue`
|
||||
WHERE `executed` = '0000-00-00 00:00:00' AND `priority` < %d
|
||||
ORDER BY `priority`, `created` LIMIT 1", dbesc($highest_priority));
|
||||
if (dbm::is_result($r))
|
||||
WHERE `executed` <= '%s' AND `priority` < %d
|
||||
ORDER BY `priority`, `created` LIMIT 1",
|
||||
dbesc(NULL_DATE),
|
||||
intval($highest_priority));
|
||||
if (dbm::is_result($r)) {
|
||||
return $r;
|
||||
|
||||
}
|
||||
// Give slower processes some processing time
|
||||
$r = q("SELECT * FROM `workerqueue`
|
||||
WHERE `executed` = '0000-00-00 00:00:00' AND `priority` > %d
|
||||
ORDER BY `priority`, `created` LIMIT 1", dbesc($highest_priority));
|
||||
WHERE `executed` <= '%s' AND `priority` > %d
|
||||
ORDER BY `priority`, `created` LIMIT 1",
|
||||
dbesc(NULL_DATE),
|
||||
intval($highest_priority));
|
||||
}
|
||||
|
||||
// If there is no result (or we shouldn't pass lower processes) we check without priority limit
|
||||
if (($highest_priority == 0) OR !dbm::is_result($r))
|
||||
$r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority`, `created` LIMIT 1");
|
||||
|
||||
if (($highest_priority == 0) OR !dbm::is_result($r)) {
|
||||
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,21 +55,25 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
$a->user = $user_record;
|
||||
|
||||
if ($interactive) {
|
||||
if ($a->user['login_date'] === '0000-00-00 00:00:00') {
|
||||
/// @TODO Comparison of strings this way may lead to bugs/incompatiblities
|
||||
if ($a->user['login_date'] <= NULL_DATE) {
|
||||
$_SESSION['return_url'] = 'profile_photo/new';
|
||||
$a->module = 'profile_photo';
|
||||
info( t("Welcome ") . $a->user['username'] . EOL);
|
||||
info( t('Please upload a profile photo.') . EOL);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
info( t("Welcome back ") . $a->user['username'] . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
$member_since = strtotime($a->user['register_date']);
|
||||
if (time() < ($member_since + ( 60 * 60 * 24 * 14)))
|
||||
|
||||
if (time() < ($member_since + ( 60 * 60 * 24 * 14))) {
|
||||
$_SESSION['new_member'] = true;
|
||||
else
|
||||
} else {
|
||||
$_SESSION['new_member'] = false;
|
||||
}
|
||||
|
||||
if (strlen($a->user['timezone'])) {
|
||||
date_default_timezone_set($a->user['timezone']);
|
||||
$a->timezone = $a->user['timezone'];
|
||||
|
|
|
@ -81,7 +81,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
|||
$connect_url = '';
|
||||
$name = '';
|
||||
$network = '';
|
||||
$updated = '0000-00-00 00:00:00';
|
||||
$updated = NULL_DATE;
|
||||
$location = '';
|
||||
$about = '';
|
||||
$keywords = '';
|
||||
|
@ -239,12 +239,12 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
);
|
||||
|
||||
if (count($x)) {
|
||||
if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET))
|
||||
if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET)) {
|
||||
$network = $x[0]["network"];
|
||||
|
||||
if ($updated == "0000-00-00 00:00:00")
|
||||
}
|
||||
if ($updated <= NULL_DATE) {
|
||||
$updated = $x[0]["updated"];
|
||||
|
||||
}
|
||||
$created = $x[0]["created"];
|
||||
$server_url = $x[0]["server_url"];
|
||||
$nick = $x[0]["nick"];
|
||||
|
@ -252,7 +252,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
$alias = $x[0]["alias"];
|
||||
$notify = $x[0]["notify"];
|
||||
} else {
|
||||
$created = "0000-00-00 00:00:00";
|
||||
$created = NULL_DATE;
|
||||
$server_url = "";
|
||||
|
||||
$urlparts = parse_url($profile_url);
|
||||
|
@ -465,10 +465,10 @@ function poco_last_updated($profile, $force = false) {
|
|||
$gcontacts = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
dbesc(normalise_link($profile)));
|
||||
|
||||
if ($gcontacts[0]["created"] == "0000-00-00 00:00:00")
|
||||
if ($gcontacts[0]["created"] <= NULL_DATE) {
|
||||
q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
|
||||
|
||||
}
|
||||
if ($gcontacts[0]["server_url"] != "") {
|
||||
$server_url = $gcontacts[0]["server_url"];
|
||||
}
|
||||
|
@ -664,10 +664,11 @@ function poco_last_updated($profile, $force = false) {
|
|||
}
|
||||
|
||||
// Maybe there aren't any entries. Then check if it is a valid feed
|
||||
if ($last_updated == "")
|
||||
if ($xpath->query('/atom:feed')->length > 0)
|
||||
$last_updated = "0000-00-00 00:00:00";
|
||||
|
||||
if ($last_updated == "") {
|
||||
if ($xpath->query('/atom:feed')->length > 0) {
|
||||
$last_updated = NULL_DATE;
|
||||
}
|
||||
}
|
||||
q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc(dbm::date($last_updated)), dbesc(dbm::date()), dbesc(normalise_link($profile)));
|
||||
|
||||
|
@ -946,10 +947,10 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
$servers = q("SELECT * FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
|
||||
if (dbm::is_result($servers)) {
|
||||
|
||||
if ($servers[0]["created"] == "0000-00-00 00:00:00")
|
||||
if ($servers[0]["created"] <= NULL_DATE) {
|
||||
q("UPDATE `gserver` SET `created` = '%s' WHERE `nurl` = '%s'",
|
||||
dbesc(datetime_convert()), dbesc(normalise_link($server_url)));
|
||||
|
||||
}
|
||||
$poco = $servers[0]["poco"];
|
||||
$noscrape = $servers[0]["noscrape"];
|
||||
|
||||
|
@ -977,8 +978,8 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
$info = "";
|
||||
$register_policy = -1;
|
||||
|
||||
$last_contact = "0000-00-00 00:00:00";
|
||||
$last_failure = "0000-00-00 00:00:00";
|
||||
$last_contact = NULL_DATE;
|
||||
$last_failure = NULL_DATE;
|
||||
}
|
||||
logger("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$servers[0]["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
|
||||
|
||||
|
@ -1503,7 +1504,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
|||
where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d )
|
||||
AND NOT `gcontact`.`name` IN (SELECT `name` FROM `contact` WHERE `uid` = %d)
|
||||
AND NOT `gcontact`.`id` IN (SELECT `gcid` FROM `gcign` WHERE `uid` = %d)
|
||||
AND `gcontact`.`updated` != '0000-00-00 00:00:00'
|
||||
AND `gcontact`.`updated` >= '%s'
|
||||
AND `gcontact`.`last_contact` >= `gcontact`.`last_failure`
|
||||
AND `gcontact`.`network` IN (%s)
|
||||
GROUP BY `glink`.`gcid` ORDER BY `gcontact`.`updated` DESC,`total` DESC LIMIT %d, %d",
|
||||
|
@ -1511,6 +1512,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
|||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
dbesc(NULL_DATE),
|
||||
$sql_network,
|
||||
intval($start),
|
||||
intval($limit)
|
||||
|
@ -1529,13 +1531,14 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
|||
WHERE `glink`.`uid` = 0 AND `glink`.`cid` = 0 AND `glink`.`zcid` = 0 AND NOT `gcontact`.`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = %d)
|
||||
AND NOT `gcontact`.`name` IN (SELECT `name` FROM `contact` WHERE `uid` = %d)
|
||||
AND NOT `gcontact`.`id` IN (SELECT `gcid` FROM `gcign` WHERE `uid` = %d)
|
||||
AND `gcontact`.`updated` != '0000-00-00 00:00:00'
|
||||
AND `gcontact`.`updated` >= '%s'
|
||||
AND `gcontact`.`last_contact` >= `gcontact`.`last_failure`
|
||||
AND `gcontact`.`network` IN (%s)
|
||||
ORDER BY rand() LIMIT %d, %d",
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
dbesc(NULL_DATE),
|
||||
$sql_network,
|
||||
intval($start),
|
||||
intval($limit)
|
||||
|
@ -1784,7 +1787,7 @@ function poco_discover_server($data, $default_generation = 0) {
|
|||
$connect_url = '';
|
||||
$name = '';
|
||||
$network = '';
|
||||
$updated = '0000-00-00 00:00:00';
|
||||
$updated = NULL_DATE;
|
||||
$location = '';
|
||||
$about = '';
|
||||
$keywords = '';
|
||||
|
|
|
@ -183,8 +183,8 @@ function import_account(App $a, $file) {
|
|||
}
|
||||
}
|
||||
if ($contact['uid'] == $olduid && $contact['self'] == '0') {
|
||||
// set contacts 'avatar-date' to "0000-00-00 00:00:00" to let poller to update urls
|
||||
$contact["avatar-date"] = "0000-00-00 00:00:00" ;
|
||||
// set contacts 'avatar-date' to NULL_DATE to let poller to update urls
|
||||
$contact["avatar-date"] = NULL_DATE;
|
||||
|
||||
|
||||
switch ($contact['network']) {
|
||||
|
|
|
@ -36,7 +36,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
|
|||
* Include the {@link shared.make_timestamp.php} plugin
|
||||
*/
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
||||
if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') {
|
||||
if ($string != '' && $string > '0001-01-01' && $string > NULL_DATE) {
|
||||
$timestamp = smarty_make_timestamp($string);
|
||||
} elseif ($default_date != '') {
|
||||
$timestamp = smarty_make_timestamp($default_date);
|
||||
|
|
129
mod/contacts.php
129
mod/contacts.php
|
@ -99,13 +99,22 @@ function contacts_init(App $a) {
|
|||
|
||||
function contacts_batch_actions(App $a) {
|
||||
$contacts_id = $_POST['contact_batch'];
|
||||
if (!is_array($contacts_id)) return;
|
||||
if (!is_array($contacts_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
|
||||
implode(",", $contacts_id),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
if (!dbm::is_result($orig_records)) {
|
||||
/// @TODO EOL really needed?
|
||||
notice( t('Could not access contact record(s).') . EOL);
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
$count_actions=0;
|
||||
foreach ($orig_records as $orig_record) {
|
||||
$contact_id = $orig_record['id'];
|
||||
|
@ -130,7 +139,8 @@ function contacts_batch_actions(App $a) {
|
|||
$count_actions++;
|
||||
}
|
||||
}
|
||||
if ($count_actions>0) {
|
||||
|
||||
if ($count_actions > 0) {
|
||||
info ( sprintf( tt("%d contact edited.", "%d contacts edited.", $count_actions), $count_actions) );
|
||||
}
|
||||
|
||||
|
@ -164,7 +174,8 @@ function contacts_post(App $a) {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if (! count($orig_record)) {
|
||||
if (! dbm::is_result($orig_record)) {
|
||||
/// @TODO EOL really needed?
|
||||
notice( t('Could not access contact record.') . EOL);
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
|
@ -213,6 +224,7 @@ function contacts_post(App $a) {
|
|||
intval($contact_id),
|
||||
intval(local_user())
|
||||
);
|
||||
/// @TODO Decide to use dbm::is_result() here, what does $r include?
|
||||
if ($r) {
|
||||
info( t('Contact updated.') . EOL);
|
||||
} else {
|
||||
|
@ -235,40 +247,47 @@ function contacts_post(App $a) {
|
|||
/*contact actions*/
|
||||
function _contact_update($contact_id) {
|
||||
$r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
if (!$r)
|
||||
if (!dbm::is_result($r)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = $r[0]["uid"];
|
||||
|
||||
if ($uid != local_user())
|
||||
if ($uid != local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($r[0]["network"] == NETWORK_OSTATUS) {
|
||||
$result = new_contact($uid, $r[0]["url"], false);
|
||||
|
||||
if ($result['success'])
|
||||
if ($result['success']) {
|
||||
$r = q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d",
|
||||
intval($contact_id));
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
proc_run(PRIORITY_HIGH, "include/onepoll.php", $contact_id, "force");
|
||||
}
|
||||
}
|
||||
|
||||
function _contact_update_profile($contact_id) {
|
||||
$r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
if (!$r)
|
||||
if (!dbm::is_result($r)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = $r[0]["uid"];
|
||||
|
||||
if ($uid != local_user())
|
||||
if ($uid != local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = probe_url($r[0]["url"]);
|
||||
|
||||
// "Feed" or "Unknown" is mostly a sign of communication problems
|
||||
if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"]))
|
||||
if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm",
|
||||
"poco", "network", "alias");
|
||||
|
@ -277,30 +296,36 @@ function _contact_update_profile($contact_id) {
|
|||
if ($data["network"] == NETWORK_OSTATUS) {
|
||||
$result = new_contact($uid, $data["url"], false);
|
||||
|
||||
if ($result['success'])
|
||||
if ($result['success']) {
|
||||
$update["subhub"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($updatefields AS $field)
|
||||
if (isset($data[$field]) AND ($data[$field] != ""))
|
||||
foreach ($updatefields AS $field) {
|
||||
if (isset($data[$field]) AND ($data[$field] != "")) {
|
||||
$update[$field] = $data[$field];
|
||||
}
|
||||
}
|
||||
|
||||
$update["nurl"] = normalise_link($data["url"]);
|
||||
|
||||
$query = "";
|
||||
|
||||
if (isset($data["priority"]) AND ($data["priority"] != 0))
|
||||
if (isset($data["priority"]) AND ($data["priority"] != 0)) {
|
||||
$query = "`priority` = ".intval($data["priority"]);
|
||||
}
|
||||
|
||||
foreach ($update AS $key => $value) {
|
||||
if ($query != "")
|
||||
if ($query != "") {
|
||||
$query .= ", ";
|
||||
}
|
||||
|
||||
$query .= "`".$key."` = '".dbesc($value)."'";
|
||||
}
|
||||
|
||||
if ($query == "")
|
||||
if ($query == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
$r = q("UPDATE `contact` SET $query WHERE `id` = %d AND `uid` = %d",
|
||||
intval($contact_id),
|
||||
|
@ -368,8 +393,9 @@ function contacts_content(App $a) {
|
|||
if ($a->argc == 3) {
|
||||
|
||||
$contact_id = intval($a->argv[1]);
|
||||
if (! $contact_id)
|
||||
if (! $contact_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cmd = $a->argv[2];
|
||||
|
||||
|
@ -378,7 +404,7 @@ function contacts_content(App $a) {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if (! count($orig_record)) {
|
||||
if (! dbm::is_result($orig_record)) {
|
||||
notice( t('Could not access contact record.') . EOL);
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
|
@ -398,6 +424,7 @@ function contacts_content(App $a) {
|
|||
|
||||
if ($cmd === 'block') {
|
||||
$r = _contact_block($contact_id, $orig_record[0]);
|
||||
/// @TODO is $r a database result?
|
||||
if ($r) {
|
||||
$blocked = (($orig_record[0]['blocked']) ? 0 : 1);
|
||||
info((($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')).EOL);
|
||||
|
@ -409,6 +436,7 @@ function contacts_content(App $a) {
|
|||
|
||||
if ($cmd === 'ignore') {
|
||||
$r = _contact_ignore($contact_id, $orig_record[0]);
|
||||
/// @TODO is $r a database result?
|
||||
if ($r) {
|
||||
$readonly = (($orig_record[0]['readonly']) ? 0 : 1);
|
||||
info((($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')).EOL);
|
||||
|
@ -421,6 +449,7 @@ function contacts_content(App $a) {
|
|||
|
||||
if ($cmd === 'archive') {
|
||||
$r = _contact_archive($contact_id, $orig_record[0]);
|
||||
/// @TODO is $r a database result?
|
||||
if ($r) {
|
||||
$archived = (($orig_record[0]['archive']) ? 0 : 1);
|
||||
info((($archived) ? t('Contact has been archived') : t('Contact has been unarchived')).EOL);
|
||||
|
@ -463,8 +492,7 @@ function contacts_content(App $a) {
|
|||
if ($_REQUEST['canceled']) {
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
goaway('contacts');
|
||||
}
|
||||
}
|
||||
|
@ -473,8 +501,7 @@ function contacts_content(App $a) {
|
|||
info( t('Contact has been removed.') . EOL );
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
goaway('contacts');
|
||||
}
|
||||
return; // NOTREACHED
|
||||
|
@ -538,13 +565,13 @@ function contacts_content(App $a) {
|
|||
|
||||
$insecure = t('Private communications are not available for this contact.');
|
||||
|
||||
$last_update = (($contact['last-update'] == '0000-00-00 00:00:00')
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE)
|
||||
? t('Never')
|
||||
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
|
||||
|
||||
if ($contact['last-update'] !== '0000-00-00 00:00:00')
|
||||
if ($contact['last-update'] !== NULL_DATE) {
|
||||
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
|
||||
|
||||
}
|
||||
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
|
||||
|
||||
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
|
||||
|
@ -562,26 +589,28 @@ function contacts_content(App $a) {
|
|||
// tabs
|
||||
$tab_str = contacts_tab($a, $contact_id, 2);
|
||||
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
|
||||
if ($contact['network'] == NETWORK_FEED)
|
||||
if ($contact['network'] == NETWORK_FEED) {
|
||||
$fetch_further_information = array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),
|
||||
array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords')));
|
||||
|
||||
if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)))
|
||||
}
|
||||
if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2))) {
|
||||
$poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
|
||||
}
|
||||
|
||||
if ($contact['network'] == NETWORK_DFRN)
|
||||
if ($contact['network'] == NETWORK_DFRN) {
|
||||
$profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
|
||||
}
|
||||
|
||||
if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND
|
||||
($contact['rel'] == CONTACT_IS_FOLLOWER))
|
||||
($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||
$follow = App::get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
|
||||
}
|
||||
|
||||
// Load contactact related actions like hide, suggest, delete and others
|
||||
$contact_actions = contact_actions($contact);
|
||||
|
||||
|
||||
$o .= replace_macros($tpl, array(
|
||||
//'$header' => t('Contact Editor'),
|
||||
'$header' => t("Contact"),
|
||||
|
@ -668,25 +697,21 @@ function contacts_content(App $a) {
|
|||
if (($a->argc == 2) && ($a->argv[1] === 'all')) {
|
||||
$sql_extra = '';
|
||||
$all = true;
|
||||
}
|
||||
elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
|
||||
} elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
|
||||
$sql_extra = " AND `blocked` = 1 ";
|
||||
$blocked = true;
|
||||
}
|
||||
elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
|
||||
} elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
|
||||
$sql_extra = " AND `hidden` = 1 ";
|
||||
$hidden = true;
|
||||
}
|
||||
elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
|
||||
} elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
|
||||
$sql_extra = " AND `readonly` = 1 ";
|
||||
$ignored = true;
|
||||
}
|
||||
elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
|
||||
} elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
|
||||
$sql_extra = " AND `archive` = 1 ";
|
||||
$archived = true;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$sql_extra = " AND `blocked` = 0 ";
|
||||
}
|
||||
|
||||
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
|
||||
$nets = ((x($_GET,'nets')) ? notags(trim($_GET['nets'])) : '');
|
||||
|
@ -758,8 +783,6 @@ function contacts_content(App $a) {
|
|||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||
$t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
|
||||
|
||||
|
||||
|
||||
$searching = false;
|
||||
if ($search) {
|
||||
$search_hdr = $search;
|
||||
|
@ -768,12 +791,12 @@ function contacts_content(App $a) {
|
|||
}
|
||||
$sql_extra .= (($searching) ? " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt' OR nick REGEXP '$search_txt') " : "");
|
||||
|
||||
if ($nets)
|
||||
if ($nets) {
|
||||
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
|
||||
}
|
||||
|
||||
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
|
||||
intval($_SESSION['uid']));
|
||||
|
@ -861,23 +884,25 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
|
||||
// Show this tab only if there is visible friend list
|
||||
$x = count_all_friends(local_user(), $contact_id);
|
||||
if ($x)
|
||||
if ($x) {
|
||||
$tabs[] = array('label'=>t('Contacts'),
|
||||
'url' => "allfriends/".$contact_id,
|
||||
'sel' => (($active_tab == 3)?'active':''),
|
||||
'title' => t('View all contacts'),
|
||||
'id' => 'allfriends-tab',
|
||||
'accesskey' => 't');
|
||||
}
|
||||
|
||||
// Show this tab only if there is visible common friend list
|
||||
$common = count_common_friends(local_user(),$contact_id);
|
||||
if ($common)
|
||||
if ($common) {
|
||||
$tabs[] = array('label'=>t('Common Friends'),
|
||||
'url' => "common/loc/".local_user()."/".$contact_id,
|
||||
'sel' => (($active_tab == 4)?'active':''),
|
||||
'title' => t('View all common friends'),
|
||||
'id' => 'common-loc-tab',
|
||||
'accesskey' => 'd');
|
||||
}
|
||||
|
||||
$tabs[] = array('label' => t('Advanced'),
|
||||
'url' => 'crepair/' . $contact_id,
|
||||
|
@ -895,12 +920,13 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
function contact_posts($a, $contact_id) {
|
||||
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||
if ($r) {
|
||||
if (dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$a->page['aside'] = "";
|
||||
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
|
||||
} else
|
||||
} else {
|
||||
$profile = "";
|
||||
}
|
||||
|
||||
$tab_str = contacts_tab($a, $contact_id, 1);
|
||||
|
||||
|
@ -932,8 +958,7 @@ function _contact_detail_for_template($rr){
|
|||
if (($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
|
||||
$url = "redir/{$rr['id']}";
|
||||
$sparkle = ' class="sparkle" ';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$url = $rr['url'];
|
||||
$sparkle = '';
|
||||
}
|
||||
|
|
323
mod/events.php
323
mod/events.php
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* @fiel mod/events.php
|
||||
* @file mod/events.php
|
||||
* @brief The events module
|
||||
*/
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/event.php');
|
||||
require_once('include/items.php');
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/datetime.php';
|
||||
require_once 'include/event.php';
|
||||
require_once 'include/items.php';
|
||||
|
||||
function events_init(App $a) {
|
||||
if (! local_user()) {
|
||||
|
@ -14,10 +14,11 @@ function events_init(App $a) {
|
|||
}
|
||||
|
||||
if ($a->argc == 1) {
|
||||
// if it's a json request abort here becaus we don't
|
||||
// If it's a json request abort here because we don't
|
||||
// need the widget data
|
||||
if ($a->argv[1] === 'json')
|
||||
if ($a->argv[1] === 'json') {
|
||||
return;
|
||||
}
|
||||
|
||||
$cal_widget = widget_events();
|
||||
|
||||
|
@ -33,17 +34,17 @@ function events_init(App $a) {
|
|||
|
||||
function events_post(App $a) {
|
||||
|
||||
logger('post: ' . print_r($_REQUEST,true));
|
||||
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||
|
||||
if (! local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
|
||||
$cid = ((x($_POST,'cid')) ? intval($_POST['cid']) : 0);
|
||||
$uid = local_user();
|
||||
$event_id = ((x($_POST, 'event_id')) ? intval($_POST['event_id']) : 0);
|
||||
$cid = ((x($_POST, 'cid')) ? intval($_POST['cid']) : 0);
|
||||
$uid = local_user();
|
||||
|
||||
$start_text = escape_tags($_REQUEST['start_text']);
|
||||
$start_text = escape_tags($_REQUEST['start_text']);
|
||||
$finish_text = escape_tags($_REQUEST['finish_text']);
|
||||
|
||||
$adjust = intval($_POST['adjust']);
|
||||
|
@ -52,34 +53,26 @@ function events_post(App $a) {
|
|||
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||
$private_event = false;
|
||||
|
||||
$start = NULL_DATE;
|
||||
$finish = NULL_DATE;
|
||||
|
||||
if ($start_text) {
|
||||
$start = $start_text;
|
||||
}
|
||||
else {
|
||||
$start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
|
||||
}
|
||||
|
||||
if ($nofinish) {
|
||||
$finish = '0000-00-00 00:00:00';
|
||||
}
|
||||
|
||||
if ($finish_text) {
|
||||
$finish = $finish_text;
|
||||
}
|
||||
else {
|
||||
$finish = sprintf('%d-%d-%d %d:%d:0',$finishyear,$finishmonth,$finishday,$finishhour,$finishminute);
|
||||
}
|
||||
|
||||
if ($adjust) {
|
||||
$start = datetime_convert(date_default_timezone_get(),'UTC',$start);
|
||||
$start = datetime_convert(date_default_timezone_get(), 'UTC', $start);
|
||||
if (! $nofinish) {
|
||||
$finish = datetime_convert(date_default_timezone_get(),'UTC',$finish);
|
||||
$finish = datetime_convert(date_default_timezone_get(), 'UTC', $finish);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$start = datetime_convert('UTC','UTC',$start);
|
||||
} else {
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
if (! $nofinish) {
|
||||
$finish = datetime_convert('UTC','UTC',$finish);
|
||||
$finish = datetime_convert('UTC', 'UTC', $finish);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,19 +89,19 @@ function events_post(App $a) {
|
|||
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
|
||||
$onerror_url = App::get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
|
||||
|
||||
if (strcmp($finish,$start) < 0 && !$nofinish) {
|
||||
notice( t('Event can not end before it has started.') . EOL);
|
||||
if (strcmp($finish, $start) < 0 && !$nofinish) {
|
||||
notice(t('Event can not end before it has started.') . EOL);
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
echo( t('Event can not end before it has started.'));
|
||||
echo t('Event can not end before it has started.');
|
||||
killme();
|
||||
}
|
||||
goaway($onerror_url);
|
||||
}
|
||||
|
||||
if ((! $summary) || (! $start)) {
|
||||
notice( t('Event title and start time are required.') . EOL);
|
||||
if ((! $summary) || ($start === NULL_DATE)) {
|
||||
notice(t('Event title and start time are required.') . EOL);
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
echo( t('Event title and start time are required.'));
|
||||
echo t('Event title and start time are required.');
|
||||
killme();
|
||||
}
|
||||
goaway($onerror_url);
|
||||
|
@ -116,13 +109,14 @@ function events_post(App $a) {
|
|||
|
||||
$share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0);
|
||||
|
||||
$c = q("select id from contact where uid = %d and self = 1 limit 1",
|
||||
$c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if (count($c))
|
||||
if (dbm::is_result($c)) {
|
||||
$self = $c[0]['id'];
|
||||
else
|
||||
} else {
|
||||
$self = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($share) {
|
||||
|
@ -132,67 +126,63 @@ function events_post(App $a) {
|
|||
$str_contact_deny = perms2str($_POST['contact_deny']);
|
||||
|
||||
// Undo the pseudo-contact of self, since there are real contacts now
|
||||
if ( strpos($str_contact_allow, '<' . $self . '>') !== false )
|
||||
{
|
||||
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
|
||||
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
|
||||
}
|
||||
// Make sure to set the `private` field as true. This is necessary to
|
||||
// have the posts show up correctly in Diaspora if an event is created
|
||||
// as visible only to self at first, but then edited to display to others.
|
||||
if ( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) )
|
||||
{
|
||||
if (strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) {
|
||||
$private_event = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Note: do not set `private` field for self-only events. It will
|
||||
// keep even you from seeing them!
|
||||
$str_contact_allow = '<' . $self . '>';
|
||||
$str_group_allow = $str_contact_deny = $str_group_deny = '';
|
||||
}
|
||||
|
||||
|
||||
/// @TODO One-time array initialization, one large block
|
||||
$datarray = array();
|
||||
$datarray['guid'] = get_guid(32);
|
||||
$datarray['start'] = $start;
|
||||
$datarray['finish'] = $finish;
|
||||
$datarray['summary'] = $summary;
|
||||
$datarray['desc'] = $desc;
|
||||
$datarray['location'] = $location;
|
||||
$datarray['type'] = $type;
|
||||
$datarray['adjust'] = $adjust;
|
||||
$datarray['nofinish'] = $nofinish;
|
||||
$datarray['uid'] = $uid;
|
||||
$datarray['cid'] = $cid;
|
||||
$datarray['guid'] = get_guid(32);
|
||||
$datarray['start'] = $start;
|
||||
$datarray['finish'] = $finish;
|
||||
$datarray['summary'] = $summary;
|
||||
$datarray['desc'] = $desc;
|
||||
$datarray['location'] = $location;
|
||||
$datarray['type'] = $type;
|
||||
$datarray['adjust'] = $adjust;
|
||||
$datarray['nofinish'] = $nofinish;
|
||||
$datarray['uid'] = $uid;
|
||||
$datarray['cid'] = $cid;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
$datarray['allow_gid'] = $str_group_allow;
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['private'] = (($private_event) ? 1 : 0);
|
||||
$datarray['id'] = $event_id;
|
||||
$datarray['created'] = $created;
|
||||
$datarray['edited'] = $edited;
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['private'] = (($private_event) ? 1 : 0);
|
||||
$datarray['id'] = $event_id;
|
||||
$datarray['created'] = $created;
|
||||
$datarray['edited'] = $edited;
|
||||
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
$html = format_event_html($datarray);
|
||||
echo $html;
|
||||
killme();
|
||||
killme();
|
||||
}
|
||||
|
||||
$item_id = event_store($datarray);
|
||||
|
||||
if (! $cid)
|
||||
if (! $cid) {
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "event", $item_id);
|
||||
}
|
||||
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function events_content(App $a) {
|
||||
|
||||
if (! local_user()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
notice(t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -201,14 +191,14 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
|
||||
$r = q("update event set ignore = 1 where id = %d and uid = %d",
|
||||
$r = q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
||||
if (($a->argc > 2) && ($a->argv[1] === 'unignore') && intval($a->argv[2])) {
|
||||
$r = q("update event set ignore = 0 where id = %d and uid = %d",
|
||||
$r = q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d",
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
|
@ -224,7 +214,7 @@ function events_content(App $a) {
|
|||
$i18n = get_event_strings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl,array(
|
||||
$a->page['htmlhead'] .= replace_macros($htpl, array(
|
||||
'$baseurl' => App::get_baseurl(),
|
||||
'$module_url' => '/events',
|
||||
'$modparams' => 1,
|
||||
|
@ -232,27 +222,30 @@ function events_content(App $a) {
|
|||
));
|
||||
|
||||
$etpl = get_markup_template('event_end.tpl');
|
||||
$a->page['end'] .= replace_macros($etpl,array(
|
||||
$a->page['end'] .= replace_macros($etpl, array(
|
||||
'$baseurl' => App::get_baseurl(),
|
||||
));
|
||||
|
||||
$o ="";
|
||||
$o = '';
|
||||
// tabs
|
||||
if ($a->theme_events_in_profile)
|
||||
$tabs = profile_tabs($a, True);
|
||||
|
||||
|
||||
if ($a->theme_events_in_profile) {
|
||||
$tabs = profile_tabs($a, true);
|
||||
}
|
||||
|
||||
$mode = 'view';
|
||||
$y = 0;
|
||||
$m = 0;
|
||||
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
|
||||
$ignored = ((x($_REQUEST, 'ignored')) ? intval($_REQUEST['ignored']) : 0);
|
||||
|
||||
if ($a->argc > 1) {
|
||||
if ($a->argc > 2 && $a->argv[1] == 'event') {
|
||||
$mode = 'edit';
|
||||
$event_id = intval($a->argv[2]);
|
||||
}
|
||||
if ($a->argc > 2 && $a->argv[1] == 'drop') {
|
||||
$mode = 'drop';
|
||||
$event_id = intval($a->argv[2]);
|
||||
}
|
||||
if ($a->argv[1] === 'new') {
|
||||
$mode = 'new';
|
||||
$event_id = 0;
|
||||
|
@ -267,9 +260,8 @@ function events_content(App $a) {
|
|||
// The view mode part is similiar to /mod/cal.php
|
||||
if ($mode == 'view') {
|
||||
|
||||
|
||||
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
||||
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
||||
$thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
|
||||
$thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
|
||||
if (! $y) {
|
||||
$y = intval($thisyear);
|
||||
}
|
||||
|
@ -290,46 +282,46 @@ function events_content(App $a) {
|
|||
$nextyear = $y;
|
||||
$nextmonth = $m + 1;
|
||||
if ($nextmonth > 12) {
|
||||
$nextmonth = 1;
|
||||
$nextmonth = 1;
|
||||
$nextyear ++;
|
||||
}
|
||||
|
||||
$prevyear = $y;
|
||||
if ($m > 1)
|
||||
if ($m > 1) {
|
||||
$prevmonth = $m - 1;
|
||||
else {
|
||||
} else {
|
||||
$prevmonth = 12;
|
||||
$prevyear --;
|
||||
}
|
||||
|
||||
$dim = get_dim($y,$m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59);
|
||||
$dim = get_dim($y, $m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
|
||||
if ($a->argv[1] === 'json'){
|
||||
if (x($_GET,'start')) $start = $_GET['start'];
|
||||
if (x($_GET,'end')) $finish = $_GET['end'];
|
||||
if ($a->argv[1] === 'json') {
|
||||
if (x($_GET, 'start')) {$start = $_GET['start'];}
|
||||
if (x($_GET, 'end')) {$finish = $_GET['end'];}
|
||||
}
|
||||
|
||||
$start = datetime_convert('UTC','UTC',$start);
|
||||
$finish = datetime_convert('UTC','UTC',$finish);
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
$finish = datetime_convert('UTC', 'UTC', $finish);
|
||||
|
||||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = array(
|
||||
'event_id' => (x($_GET,'id') ? $_GET["id"] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'event_id' => (x($_GET, 'id') ? $_GET['id'] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'adjust_finish' => $adjust_finish,
|
||||
'ignored' => $ignored,
|
||||
'ignored' => $ignored,
|
||||
);
|
||||
|
||||
// get events by id or by date
|
||||
if (x($_GET,'id')){
|
||||
if (x($_GET, 'id')) {
|
||||
$r = event_by_id(local_user(), $event_params);
|
||||
} else {
|
||||
$r = events_by_date(local_user(), $event_params);
|
||||
|
@ -340,7 +332,7 @@ function events_content(App $a) {
|
|||
if (dbm::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
|
||||
if (! x($links,$j)) {
|
||||
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
@ -356,53 +348,51 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
if ($a->argv[1] === 'json'){
|
||||
echo json_encode($events); killme();
|
||||
echo json_encode($events);
|
||||
killme();
|
||||
}
|
||||
|
||||
// links: array('href', 'text', 'extra css classes', 'title')
|
||||
if (x($_GET,'id')){
|
||||
if (x($_GET, 'id')) {
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
} else {
|
||||
// if (get_config('experimentals','new_calendar')==1){
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
// } else {
|
||||
// $tpl = get_markup_template("events.tpl");
|
||||
// }
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
}
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
foreach ($events as $key => $event) {
|
||||
$event_item = array();
|
||||
foreach ($event['item'] as $k => $v) {
|
||||
$k = str_replace('-','_',$k);
|
||||
$k = str_replace('-' ,'_', $k);
|
||||
$event_item[$k] = $v;
|
||||
}
|
||||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, array(
|
||||
'$baseurl' => App::get_baseurl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => t('Events'),
|
||||
'$view' => t('View'),
|
||||
'$new_event' => array(App::get_baseurl().'/events/new',t('Create New Event'),'',''),
|
||||
'$previous' => array(App::get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
|
||||
'$next' => array(App::get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
|
||||
'$calendar' => cal($y,$m,$links, ' eventcal'),
|
||||
'$baseurl' => App::get_baseurl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => t('Events'),
|
||||
'$view' => t('View'),
|
||||
'$new_event' => array(App::get_baseurl() . '/events/new', t('Create New Event'), '', ''),
|
||||
'$previous' => array(App::get_baseurl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''),
|
||||
'$next' => array(App::get_baseurl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''),
|
||||
'$calendar' => cal($y, $m, $links, ' eventcal'),
|
||||
|
||||
'$events' => $events,
|
||||
'$events' => $events,
|
||||
|
||||
"today" => t("today"),
|
||||
"month" => t("month"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
"list" => t("list"),
|
||||
'$today' => t('today'),
|
||||
'$month' => t('month'),
|
||||
'$week' => t('week'),
|
||||
'$day' => t('day'),
|
||||
'$list' => t('list'),
|
||||
));
|
||||
|
||||
if (x($_GET,'id')){ echo $o; killme(); }
|
||||
if (x($_GET, 'id')) {
|
||||
echo $o;
|
||||
killme();
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
if ($mode === 'edit' && $event_id) {
|
||||
|
@ -410,46 +400,45 @@ function events_content(App $a) {
|
|||
intval($event_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$orig_event = $r[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Passed parameters overrides anything found in the DB
|
||||
if ($mode === 'edit' || $mode === 'new') {
|
||||
if (!x($orig_event)) $orig_event = array();
|
||||
if (!x($orig_event)) {
|
||||
$orig_event = array();
|
||||
}
|
||||
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
||||
if (x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
|
||||
if (x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
|
||||
if (x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
|
||||
if (x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
|
||||
if (x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
|
||||
if (x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
|
||||
if (x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
|
||||
}
|
||||
|
||||
if ($mode === 'edit' || $mode === 'new') {
|
||||
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
||||
if (x($_REQUEST, 'summary')) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||
if (x($_REQUEST, 'description')) {$orig_event['description'] = $_REQUEST['description'];}
|
||||
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
||||
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
||||
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||
|
||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
|
||||
$d_orig = ((x($orig_event)) ? $orig_event['desc'] : '');
|
||||
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
|
||||
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
|
||||
$cid = ((x($orig_event)) ? $orig_event['cid'] : 0);
|
||||
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
|
||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||
|
||||
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
|
||||
$d_orig = ((x($orig_event)) ? $orig_event['desc'] : '');
|
||||
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
|
||||
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
|
||||
$cid = ((x($orig_event)) ? $orig_event['cid'] : 0);
|
||||
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
|
||||
|
||||
if (! x($orig_event)) {
|
||||
$sh_checked = '';
|
||||
} else {
|
||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
|
||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ');
|
||||
}
|
||||
|
||||
if ($cid OR ($mode !== 'new')) {
|
||||
$sh_checked .= ' disabled="disabled" ';
|
||||
}
|
||||
|
||||
|
||||
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
|
||||
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
|
||||
|
||||
|
@ -458,18 +447,18 @@ function events_content(App $a) {
|
|||
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
|
||||
}
|
||||
|
||||
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
|
||||
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
|
||||
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
|
||||
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
|
||||
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
|
||||
|
||||
$shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0);
|
||||
$shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0);
|
||||
$sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : 0);
|
||||
|
||||
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
|
||||
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
|
||||
$fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
|
||||
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
|
||||
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
|
||||
|
||||
$fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0);
|
||||
$fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0);
|
||||
$fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0);
|
||||
|
||||
$f = get_config('system','event_input_format');
|
||||
|
@ -477,10 +466,11 @@ function events_content(App $a) {
|
|||
$f = 'ymd';
|
||||
}
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
require_once 'include/acl_selectors.php' ;
|
||||
|
||||
if ($mode === 'new')
|
||||
if ($mode === 'new') {
|
||||
$acl = (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user)));
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('event_form.tpl');
|
||||
|
||||
|
@ -493,11 +483,11 @@ function events_content(App $a) {
|
|||
'$title' => t('Event details'),
|
||||
'$desc' => t('Starting date and Title are required.'),
|
||||
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>',
|
||||
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),t('Event Starts:'),'start_text',true,true,'','',true),
|
||||
'$s_dsel' => datetimesel($f, new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), t('Event Starts:'), 'start_text', true, true, '', '', true),
|
||||
'$n_text' => t('Finish date/time is not known or not relevant'),
|
||||
'$n_checked' => $n_checked,
|
||||
'$f_text' => t('Event Finishes:'),
|
||||
'$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),t('Event Finishes:'),'finish_text',true,true,'start_text'),
|
||||
'$f_dsel' => datetimesel($f, new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
|
||||
'$a_text' => t('Adjust for viewer timezone'),
|
||||
'$a_checked' => $a_checked,
|
||||
'$d_text' => t('Description:'),
|
||||
|
@ -515,12 +505,33 @@ function events_content(App $a) {
|
|||
'$preview' => t('Preview'),
|
||||
'$acl' => $acl,
|
||||
'$submit' => t('Submit'),
|
||||
'$basic' => t("Basic"),
|
||||
'$advanced' => t("Advanced"),
|
||||
'$basic' => t('Basic'),
|
||||
'$advanced' => t('Advanced'),
|
||||
'$permissions' => t('Permissions'),
|
||||
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
// Remove an event from the calendar and its related items
|
||||
if ($mode === 'drop' && $event_id) {
|
||||
$del = 0;
|
||||
|
||||
$params = array('event_id' => ($event_id));
|
||||
$ev = event_by_id(local_user(), $params);
|
||||
|
||||
// Delete only real events (no birthdays)
|
||||
if (dbm::is_result($ev) && $ev[0]['type'] == 'event') {
|
||||
$del = drop_item($ev[0]['itemid'], false);
|
||||
}
|
||||
|
||||
if ($del == 0) {
|
||||
notice(t('Failed to remove event' ) . EOL);
|
||||
} else {
|
||||
info(t('Event removed') . EOL);
|
||||
}
|
||||
|
||||
goaway(App::get_baseurl() . '/events');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
function maintenance_content(App $a) {
|
||||
|
||||
$reason = Config::get('system', 'maintenance_reason');
|
||||
|
||||
if (substr(normalise_link($reason), 0, 7) == 'http://') {
|
||||
header("HTTP/1.1 307 Temporary Redirect");
|
||||
header("Location:".$reason);
|
||||
return;
|
||||
}
|
||||
|
||||
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 600');
|
||||
|
||||
return replace_macros(get_markup_template('maintenance.tpl'), array(
|
||||
'$sysdown' => t('System down for maintenance')
|
||||
'$sysdown' => t('System down for maintenance'),
|
||||
'$reason' => $reason
|
||||
));
|
||||
}
|
||||
|
|
|
@ -234,11 +234,11 @@ function profiles_post(App $a) {
|
|||
|
||||
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
|
||||
|
||||
if (! strlen($howlong))
|
||||
$howlong = '0000-00-00 00:00:00';
|
||||
else
|
||||
if (! strlen($howlong)) {
|
||||
$howlong = NULL_DATE;
|
||||
} else {
|
||||
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
|
||||
|
||||
}
|
||||
// linkify the relationship target if applicable
|
||||
|
||||
$withchanged = false;
|
||||
|
@ -248,11 +248,13 @@ function profiles_post(App $a) {
|
|||
$withchanged = true;
|
||||
$prf = '';
|
||||
$lookup = $with;
|
||||
if (strpos($lookup,'@') === 0)
|
||||
if (strpos($lookup,'@') === 0) {
|
||||
$lookup = substr($lookup,1);
|
||||
}
|
||||
$lookup = str_replace('_',' ', $lookup);
|
||||
if (strpos($lookup,'@') || (strpos($lookup,'http://'))) {
|
||||
$newname = $lookup;
|
||||
/// @TODO Maybe kill those error/debugging-surpressing @ characters
|
||||
$links = @Probe::lrdd($lookup);
|
||||
if (count($links)) {
|
||||
foreach ($links as $link) {
|
||||
|
@ -261,8 +263,7 @@ function profiles_post(App $a) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$newname = $lookup;
|
||||
/* if (strstr($lookup,' ')) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
|
@ -722,7 +723,7 @@ function profiles_content(App $a) {
|
|||
'$gender' => gender_selector($r[0]['gender']),
|
||||
'$marital' => marital_selector($r[0]['marital']),
|
||||
'$with' => array('with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')),
|
||||
'$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
|
||||
'$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
|
||||
'$sexual' => sexpref_selector($r[0]['sexual']),
|
||||
'$about' => array('about', t('Tell us about yourself...'), $r[0]['about']),
|
||||
'$xmpp' => array('xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")),
|
||||
|
|
|
@ -885,7 +885,7 @@ function settings_content(App $a) {
|
|||
$mail_pubmail = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_action = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
|
||||
$mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
|
||||
$mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
|
||||
$mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : NULL_DATE);
|
||||
|
||||
|
||||
$tpl = get_markup_template("settings_connectors.tpl");
|
||||
|
|
41
update.php
41
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define('UPDATE_VERSION' , 1215);
|
||||
define('UPDATE_VERSION' , 1216);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,8 +48,8 @@ function update_1000() {
|
|||
|
||||
q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` ");
|
||||
q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` ");
|
||||
q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
|
||||
q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`");
|
||||
q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXTCHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
|
||||
q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `avatar-date`");
|
||||
}
|
||||
|
||||
function update_1001() {
|
||||
|
@ -243,8 +243,8 @@ function update_1022() {
|
|||
}
|
||||
|
||||
function update_1023() {
|
||||
q("ALTER TABLE `user` ADD `register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `timezone` ,
|
||||
ADD `login_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `register_date` ");
|
||||
q("ALTER TABLE `user` ADD `register_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `timezone` ,
|
||||
ADD `login_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `register_date` ");
|
||||
}
|
||||
|
||||
function update_1024() {
|
||||
|
@ -350,7 +350,7 @@ function update_1034() {
|
|||
|
||||
function update_1035() {
|
||||
|
||||
q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `last-update` ");
|
||||
q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `last-update` ");
|
||||
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ function update_1049() {
|
|||
`user` CHAR( 255 ) NOT NULL ,
|
||||
`pass` CHAR( 255 ) NOT NULL ,
|
||||
`reply_to` CHAR( 255 ) NOT NULL ,
|
||||
`last_check` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
`last_check` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'
|
||||
) ENGINE = MYISAM ");
|
||||
}
|
||||
|
||||
|
@ -453,8 +453,8 @@ function update_1050() {
|
|||
`filetype` CHAR( 64 ) NOT NULL ,
|
||||
`filesize` INT NOT NULL ,
|
||||
`data` LONGBLOB NOT NULL ,
|
||||
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`allow_cid` MEDIUMTEXT NOT NULL ,
|
||||
`allow_gid` MEDIUMTEXT NOT NULL ,
|
||||
`deny_cid` MEDIUMTEXT NOT NULL ,
|
||||
|
@ -532,6 +532,7 @@ function update_1065() {
|
|||
function update_1066() {
|
||||
$r = q("ALTER TABLE `item` ADD `received` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
|
||||
|
||||
/// @TODO Decide to use dbm::is_result() here, what does $r include?
|
||||
if ($r) {
|
||||
q("ALTER TABLE `item` ADD INDEX ( `received` ) ");
|
||||
}
|
||||
|
@ -676,7 +677,7 @@ function update_1079() {
|
|||
}
|
||||
|
||||
function update_1080() {
|
||||
q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'");
|
||||
}
|
||||
|
||||
function update_1081() {
|
||||
|
@ -736,7 +737,7 @@ function update_1086() {
|
|||
}
|
||||
|
||||
function update_1087() {
|
||||
q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
|
||||
q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` ");
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
|
||||
if (dbm::is_result($r)) {
|
||||
|
@ -757,8 +758,8 @@ function update_1087() {
|
|||
|
||||
function update_1088() {
|
||||
q("ALTER TABLE `user` ADD `account_expired` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `expire` ,
|
||||
ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expired` ,
|
||||
ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expires_on` ");
|
||||
ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `account_expired` ,
|
||||
ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `account_expires_on` ");
|
||||
}
|
||||
|
||||
function update_1089() {
|
||||
|
@ -943,8 +944,8 @@ ADD INDEX ( `hidden` ) ");
|
|||
|
||||
function update_1109() {
|
||||
q("ALTER TABLE `conv` ADD `creator` CHAR( 255 ) NOT NULL ,
|
||||
ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
ADD `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
ADD `updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
ADD `subject` MEDIUMTEXT NOT NULL,
|
||||
ADD INDEX ( `created` ), ADD INDEX ( `updated` ) ");
|
||||
}
|
||||
|
@ -1644,11 +1645,11 @@ function update_1169() {
|
|||
`iid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`contact-id` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`wall` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`private` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`pubmail` tinyint(1) NOT NULL DEFAULT '0',
|
||||
|
|
|
@ -20,7 +20,19 @@ $maint_mode = 1;
|
|||
if ($argc > 1) {
|
||||
$maint_mode = intval($argv[1]);
|
||||
}
|
||||
set_config('system', 'maintenance', $maint_mode);
|
||||
|
||||
Config::set('system', 'maintenance', $maint_mode);
|
||||
|
||||
if ($maint_mode AND ($argc > 2)) {
|
||||
$reason_arr = $argv;
|
||||
array_shift($reason_arr);
|
||||
array_shift($reason_arr);
|
||||
|
||||
$reason = implode(' ', $reason_arr);
|
||||
Config::set('system', 'maintenance_reason', $reason);
|
||||
} else {
|
||||
Config::set('system', 'maintenance_reason', '');
|
||||
}
|
||||
|
||||
if ($maint_mode) {
|
||||
$mode_str = "maintenance mode";
|
||||
|
@ -28,8 +40,23 @@ if ($maint_mode) {
|
|||
$mode_str = "normal mode";
|
||||
}
|
||||
|
||||
echo "\n\tSystem set in $mode_str\n\n";
|
||||
echo "Usage:\n\n";
|
||||
echo "\tphp {$argv[0]} [1]\tSet the system in maintenance mode\n";
|
||||
echo "\tphp {$argv[0]} 0 \tSet the system in normal mode\n\n";
|
||||
echo "\n\tSystem set in $mode_str\n";
|
||||
|
||||
if ($reason != '') {
|
||||
echo "\tMaintenance reason: $reason\n\n";
|
||||
} else {
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo "Usage:\n\n";
|
||||
echo "\tphp {$argv[0]} [1] [Maintenance reason|redirection url]\n";
|
||||
echo "\t\tSet the system in maintenance mode\n\n";
|
||||
echo "\t\tIf the optionally entered maintenance reason is an url\n";
|
||||
echo "\t\tthe visitor is redirected to that page.\n";
|
||||
echo "\n";
|
||||
echo "\t\tExamples:\n";
|
||||
echo "\t\t\tphp {$argv[0]} 1 System upgrade\n";
|
||||
echo "\t\t\tphp {$argv[0]} 1 http://domain.tld/downtime\n";
|
||||
echo "\n";
|
||||
echo "\tphp {$argv[0]} 0\n";
|
||||
echo "\t\tSet the system in normal mode\n\n";
|
||||
|
|
12329
util/messages.po
12329
util/messages.po
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@
|
|||
{{$event.html}}
|
||||
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" target="_blank" class="plink-event-link icon s22 remote-link"></a>{{/if}}
|
||||
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}}
|
||||
{{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link icon s22 delete"></a>{{/if}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
{{/foreach}}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
|
||||
<div id="maintenance-message">{{$sysdown}}</div>
|
||||
<h1 id="maintenance-message">{{$sysdown}}</h1>
|
||||
<div id="maintenance-reason">{{$reason}}</div>
|
||||
|
|
|
@ -2193,6 +2193,9 @@ ul li:hover .contact-wrapper a.contact-action-link:hover {
|
|||
#event-edit-form-wrapper #event-edit-time {
|
||||
padding: 10px 0;
|
||||
}
|
||||
.event-buttons .plink-event-link {
|
||||
margin-left: 20px;
|
||||
}
|
||||
/* Profiles Page */
|
||||
.profile-listing-table {
|
||||
display: table;
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
</div>
|
||||
|
||||
<div class="event-buttons pull-right">
|
||||
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}}
|
||||
{{if $event.edit}}<a onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}" class="btn"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}
|
||||
{{if $event.edit}}<a onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}" class="edit-event-link btn"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}
|
||||
{{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link btn"><i class="fa fa-trash-o" aria-hidden="true"></i></a>{{/if}}
|
||||
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user