Events are now shared with Diaspora.
This commit is contained in:
parent
5222bd2264
commit
55ee80338f
6 changed files with 36 additions and 15 deletions
2
boot.php
2
boot.php
|
@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1210 );
|
define ( 'DB_UPDATE_VERSION', 1211 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 3.5.1-dev (Asparagus)
|
-- Friendica 3.5.1-dev (Asparagus)
|
||||||
-- DB_UPDATE_VERSION 1210
|
-- DB_UPDATE_VERSION 1211
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,6 +212,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS `event` (
|
CREATE TABLE IF NOT EXISTS `event` (
|
||||||
`id` int(11) NOT NULL auto_increment,
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||||
`uid` int(11) NOT NULL DEFAULT 0,
|
`uid` int(11) NOT NULL DEFAULT 0,
|
||||||
`cid` int(11) NOT NULL DEFAULT 0,
|
`cid` int(11) NOT NULL DEFAULT 0,
|
||||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
|
|
@ -622,6 +622,7 @@ function db_definition($charset) {
|
||||||
$database["event"] = array(
|
$database["event"] = array(
|
||||||
"fields" => array(
|
"fields" => array(
|
||||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||||
|
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||||
"cid" => 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" => ""),
|
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
|
|
|
@ -2949,7 +2949,7 @@ class Diaspora {
|
||||||
*/
|
*/
|
||||||
private static function build_event($event_id) {
|
private static function build_event($event_id) {
|
||||||
|
|
||||||
$r = q("SELECT `uid`, `start`, `finish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
|
$r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
|
||||||
if (!dbm::is_result($r)) {
|
if (!dbm::is_result($r)) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -2965,22 +2965,37 @@ class Diaspora {
|
||||||
|
|
||||||
$user = $r[0];
|
$user = $r[0];
|
||||||
|
|
||||||
if ($event['adjust']) {
|
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$owner = $r[0];
|
||||||
|
|
||||||
|
$eventdata['author'] = self::my_handle($owner);
|
||||||
|
|
||||||
|
if ($event['guid']) {
|
||||||
|
$eventdata['guid'] = $event['guid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$mask = 'Y-m-d\TH:i:s\Z';
|
||||||
|
|
||||||
|
/// @todo
|
||||||
|
$eventdata["all_day"] = "false";
|
||||||
|
|
||||||
|
if (!$event['adjust']) {
|
||||||
$eventdata['timezone'] = $user['timezone'];
|
$eventdata['timezone'] = $user['timezone'];
|
||||||
|
|
||||||
if ($eventdata['timezone'] == "") {
|
if ($eventdata['timezone'] == "") {
|
||||||
$eventdata['timezone'] = 'UTC';
|
$eventdata['timezone'] = 'UTC';
|
||||||
}
|
}
|
||||||
$mask = 'Y-m-d\TH:i:s\Z';
|
|
||||||
} else {
|
|
||||||
$mask = 'Y-m-d\TH:i:s';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event['start']) {
|
if ($event['start']) {
|
||||||
$eventdata['start'] = datetime_convert("UTC", "UTC", $event['start'], $mask);
|
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
||||||
}
|
}
|
||||||
if ($event['finish']) {
|
if ($event['finish'] AND !$event['nofinish']) {
|
||||||
$eventdata['end'] = datetime_convert("UTC", "UTC", $event['finish'], $mask);
|
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
||||||
}
|
}
|
||||||
if ($event['summary']) {
|
if ($event['summary']) {
|
||||||
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
|
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
|
||||||
|
@ -3083,6 +3098,9 @@ class Diaspora {
|
||||||
$event = self::build_event($item['event-id']);
|
$event = self::build_event($item['event-id']);
|
||||||
if (count($event)) {
|
if (count($event)) {
|
||||||
$message['event'] = $event;
|
$message['event'] = $event;
|
||||||
|
|
||||||
|
/// @todo Once Diaspora supports it, we will remove the body
|
||||||
|
// $message['raw_message'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,7 @@ function event_store($arr) {
|
||||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
$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['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid']));
|
||||||
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
$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",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
|
@ -333,16 +334,16 @@ function event_store($arr) {
|
||||||
call_hooks("event_updated", $arr['id']);
|
call_hooks("event_updated", $arr['id']);
|
||||||
|
|
||||||
return $item_id;
|
return $item_id;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
// New event. Store it.
|
// New event. Store it.
|
||||||
|
|
||||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
$r = q("INSERT INTO `event` (`uid`,`cid`,`guid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||||
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
||||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||||
intval($arr['uid']),
|
intval($arr['uid']),
|
||||||
intval($arr['cid']),
|
intval($arr['cid']),
|
||||||
|
dbesc($arr['guid']),
|
||||||
dbesc($arr['uri']),
|
dbesc($arr['uri']),
|
||||||
dbesc($arr['created']),
|
dbesc($arr['created']),
|
||||||
dbesc($arr['edited']),
|
dbesc($arr['edited']),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('UPDATE_VERSION' , 1210);
|
define('UPDATE_VERSION' , 1211);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue