aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-05-29 21:25:19 -0700
committerfriendica <info@friendica.com>2014-05-29 21:25:19 -0700
commit832cbbec15ae2abbd04d775e4cfb056e797722f1 (patch)
tree157792443a0eb07be3cbeb4e805d0e18ba17df53 /include
parent22ed5b1d03314d2bc7ff41b4724526fe00472904 (diff)
downloadvolse-hubzilla-832cbbec15ae2abbd04d775e4cfb056e797722f1.tar.gz
volse-hubzilla-832cbbec15ae2abbd04d775e4cfb056e797722f1.tar.bz2
volse-hubzilla-832cbbec15ae2abbd04d775e4cfb056e797722f1.zip
testing new event code
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php2
-rw-r--r--include/event.php18
2 files changed, 13 insertions, 7 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index ad2692624..b6a9a2897 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -201,7 +201,7 @@ class Item extends BaseObject {
}
$has_event = false;
- if(activity_compare($item['obj_type'],ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user())
+ if(($item['obj_type'] === ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user())
$has_event = true;
if($this->is_commentable()) {
diff --git a/include/event.php b/include/event.php
index 498d2ab99..0f337867c 100644
--- a/include/event.php
+++ b/include/event.php
@@ -135,6 +135,8 @@ function event_store_event($arr) {
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
$arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
+
+
// Existing event being modified
if($arr['id'] || $arr['event_hash']) {
@@ -154,6 +156,7 @@ function event_store_event($arr) {
);
}
+
if(! $r)
return false;
@@ -205,9 +208,6 @@ function event_store_event($arr) {
$hash = random_string();
- if(! $arr['mid'])
- $arr['mid'] = item_message_id();
-
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid)
@@ -261,13 +261,14 @@ function event_addtocal($item_id, $uid) {
intval($channel['channel_id'])
);
- if((! $r) || (! activity_match($r[0]['obj_type'],ACTIVITY_OBJ_EVENT)))
+ if((! $r) || ($r[0]['obj_type'] !== ACTIVITY_OBJ_EVENT))
return false;
$item = $r[0];
$ev = bbtoevent($r[0]['body']);
- if(x($ev,'description') && x($ev,'start')) {
+
+ if(x($ev,'summary') && x($ev,'start')) {
$ev['event_xchan'] = $item['author_xchan'];
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
@@ -284,6 +285,7 @@ function event_addtocal($item_id, $uid) {
$event = event_store_event($ev);
if($event) {
$r = q("update item set resource_id = '%s', resource_type = 'event' where id = %d and uid = %d limit 1",
+ dbesc($event['event_hash']),
intval($item['id']),
intval($channel['channel_id'])
);
@@ -317,7 +319,7 @@ function event_store_item($arr,$event) {
}
$r = q("SELECT * FROM item left join xchan on author_xchan = xchan_hash WHERE resource_id = '%s' AND resource_type = 'event' and uid = %d LIMIT 1",
- dbesc($event['hash']),
+ dbesc($event['event_hash']),
intval($arr['uid'])
);
@@ -386,6 +388,10 @@ function event_store_item($arr,$event) {
$item_arr['item_flags'] = $item_flags;
}
+ if(! $arr['mid'])
+ $arr['mid'] = item_message_id();
+
+
$item_arr['uid'] = $arr['uid'];
$item_arr['author_xchan'] = $arr['event_xchan'];
$item_arr['mid'] = $arr['mid'];