aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php2
-rw-r--r--include/event.php40
-rw-r--r--install/database.sql4
-rw-r--r--install/update.php9
-rw-r--r--version.inc2
5 files changed, 38 insertions, 19 deletions
diff --git a/boot.php b/boot.php
index cc5a01a4e..fab29db51 100644
--- a/boot.php
+++ b/boot.php
@@ -16,7 +16,7 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1017 );
+define ( 'DB_UPDATE_VERSION', 1019 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/include/event.php b/include/event.php
index 6f9ba779c..bcb7eb395 100644
--- a/include/event.php
+++ b/include/event.php
@@ -208,12 +208,13 @@ function event_store($arr) {
$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['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
$arr['message_id'] = (x($arr,'message_id') ? $arr['message_id'] : get_message_id());
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
// FIXME
+/*
if($arr['cid'])
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($arr['cid']),
@@ -226,7 +227,7 @@ function event_store($arr) {
if(count($c))
$contact = $c[0];
-
+*/
// Existing event being modified
@@ -283,15 +284,22 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1",
+
+ $r = q("SELECT * FROM item WHERE resource_id = %d AND resource_type = 'event' and uid = %d LIMIT 1",
intval($arr['id']),
intval($arr['uid'])
);
+
+// FIXME
+
if(count($r)) {
+
+/*
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['message_id']) . '</id>';
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
$object .= '</object>' . "\n";
-
+*/
+/*
q("UPDATE `item` SET `body` = '%s', `object` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `edited` = '%s', `private` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc(format_event_bbcode($arr)),
@@ -305,7 +313,7 @@ function event_store($arr) {
intval($r[0]['id']),
intval($arr['uid'])
);
-
+*/
$item_id = $r[0]['id'];
}
else
@@ -319,12 +327,12 @@ function event_store($arr) {
// New event. Store it.
- $r = q("INSERT INTO `event` ( `uid`,`account`,`cid`,`message_id`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
+ $r = q("INSERT INTO `event` ( `uid`,`account`,`event_xchan`,`message_id`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
- VALUES ( %d, %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['account']),
intval($arr['uid']),
- intval($arr['cid']),
+ intval($arr['event_xchan']),
dbesc($arr['uri']),
dbesc($arr['created']),
dbesc($arr['edited']),
@@ -354,10 +362,10 @@ function event_store($arr) {
$item_arr['uid'] = $arr['uid'];
- $item_arr['contact-id'] = $arr['cid'];
+/* $item_arr['contact-id'] = $arr['cid']; */
$item_arr['uri'] = $arr['message_id'];
$item_arr['parent_uri'] = $arr['message_id'];
- $item_arr['type'] = 'activity';
+/* $item_arr['type'] = 'activity';
$item_arr['wall'] = (($arr['cid']) ? 0 : 1);
$item_arr['contact-id'] = $contact['id'];
$item_arr['owner-name'] = $contact['name'];
@@ -366,24 +374,28 @@ function event_store($arr) {
$item_arr['author-name'] = $contact['name'];
$item_arr['author-link'] = $contact['url'];
$item_arr['author-avatar'] = $contact['thumb'];
+*/
$item_arr['title'] = '';
$item_arr['allow_cid'] = $arr['allow_cid'];
$item_arr['allow_gid'] = $arr['allow_gid'];
$item_arr['deny_cid'] = $arr['deny_cid'];
$item_arr['deny_gid'] = $arr['deny_gid'];
- $item_arr['private'] = $arr['private'];
+
+/* $item_arr['private'] = $arr['private'];
$item_arr['last-child'] = 1;
$item_arr['visible'] = 1;
+*/
$item_arr['verb'] = ACTIVITY_POST;
$item_arr['obj_type'] = ACTIVITY_OBJ_EVENT;
- $item_arr['origin'] = ((intval($arr['cid']) == 0) ? 1 : 0);
- $item_arr['body'] = format_event_bbcode($event);
+/* $item_arr['origin'] = ((intval($arr['cid']) == 0) ? 1 : 0); */
+ $item_arr['body'] = format_event_bbcode($event);
+/*
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['message_id']) . '</id>';
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
$item_arr['object'] .= '</object>' . "\n";
-
+*/
$item_id = item_store($item_arr);
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
diff --git a/install/database.sql b/install/database.sql
index 00eada940..addf797a7 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`aid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(11) NOT NULL,
- `cid` int(11) NOT NULL,
+ `event_xchan` char(255) NOT NULL DEFAULT '',
`message_id` char(255) NOT NULL,
`created` datetime NOT NULL,
`edited` datetime NOT NULL,
@@ -241,7 +241,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`deny_gid` mediumtext NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
- KEY `cid` (`cid`),
+ KEY `event_xchan` (`event_xchan`),
KEY `uri` (`message_id`),
KEY `type` (`type`),
KEY `start` (`start`),
diff --git a/install/update.php b/install/update.php
index c29a5fcea..63d65c89c 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1017 );
+define( 'UPDATE_VERSION' , 1018 );
/**
*
@@ -262,3 +262,10 @@ function update_r1016() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1017() {
+ $r = q("ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
diff --git a/version.inc b/version.inc
index 7c4eb7825..9a868e78e 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-01-14.200
+2013-01-15.201