aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/event.php16
-rwxr-xr-xmod/events.php19
2 files changed, 34 insertions, 1 deletions
diff --git a/include/event.php b/include/event.php
index 6670bc53b..44c172e98 100644
--- a/include/event.php
+++ b/include/event.php
@@ -446,6 +446,20 @@ function event_addtocal($item_id, $uid) {
intval($channel['channel_id'])
);
+ $item['resource_id'] = $event['event_hash'];
+ $item['resource_type'] = 'event';
+
+ $i = array($item);
+ xchan_query($i);
+ $sync_item = fetch_post_tags($i);
+ $z = q("select * from event where event_hash = '%s' and uid = %d limit 1",
+ dbesc($event['event_hash']),
+ intval($channel['channel_id'])
+ );
+ if($z) {
+ build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z));
+ }
+
return true;
}
}
@@ -959,4 +973,4 @@ function tasks_fetch($arr) {
return $ret;
-} \ No newline at end of file
+}
diff --git a/mod/events.php b/mod/events.php
index 9120f8713..ca09385ef 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -205,6 +205,19 @@ function events_post(&$a) {
$item_id = event_store_item($datarray,$event);
+ if($r) {
+ xchan_query($r);
+ $sync_item = fetch_post_tags($r);
+ $z = q("select * from event where event_hash = '%s' and uid = %d limit 1",
+ dbesc($r[0]['resource_id']),
+ intval($channel['channel_id'])
+ );
+ if($z) {
+ build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z));
+ }
+ }
+
+
if($share)
proc_run('php',"include/notifier.php","event","$item_id");
@@ -528,6 +541,9 @@ function events_content(&$a) {
dbesc($event_id),
intval(local_channel())
);
+
+ $sync_event = $r[0];
+
if($r) {
$r = q("delete from event where event_hash = '%s' and uid = %d limit 1",
dbesc($event_id),
@@ -538,6 +554,9 @@ function events_content(&$a) {
dbesc($event_id),
intval(local_channel())
);
+ $sync_event['event_deleted'] = 1;
+ build_sync_packet(0,array('event' => array($sync_event)));
+
info( t('Event removed') . EOL);
}
else {