diff options
author | friendica <info@friendica.com> | 2013-01-16 03:18:32 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-01-16 03:18:32 -0800 |
commit | af066d7383edfc9c47ceb64076ec38efd6f39edb (patch) | |
tree | b97da0065416bdabf5f8948652f6d5757f2f197b | |
parent | 4fd833b9530c93b71dcb2b1587a4b3c5869915ce (diff) | |
download | volse-hubzilla-af066d7383edfc9c47ceb64076ec38efd6f39edb.tar.gz volse-hubzilla-af066d7383edfc9c47ceb64076ec38efd6f39edb.tar.bz2 volse-hubzilla-af066d7383edfc9c47ceb64076ec38efd6f39edb.zip |
mopping up the events issues so I can move on to other stuff
-rw-r--r-- | include/event.php | 19 | ||||
-rw-r--r-- | include/zot.php | 8 | ||||
-rwxr-xr-x | mod/events.php | 6 | ||||
-rw-r--r-- | mod/ping.php | 17 |
4 files changed, 33 insertions, 17 deletions
diff --git a/include/event.php b/include/event.php index e5a62ceec..685842fc3 100644 --- a/include/event.php +++ b/include/event.php @@ -271,10 +271,6 @@ function event_store($arr) { intval($arr['uid']) ); - - -// FIXME - if($r) { $obj = json_encode(array( @@ -324,14 +320,13 @@ function event_store($arr) { $hash = random_string(); - $r = q("INSERT INTO `event` ( `uid`,`aid`,`event_xchan`,`event_hash`, `message_id`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`, + $r = q("INSERT INTO `event` ( `uid`,`aid`,`event_xchan`,`event_hash`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`, `adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`) - VALUES ( %d, %d, '%s', '%s', '%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['account']), dbesc($arr['event_xchan']), dbesc($hash), - dbesc($arr['uri']), dbesc($arr['created']), dbesc($arr['edited']), dbesc($arr['start']), @@ -350,7 +345,7 @@ function event_store($arr) { ); $r = q("SELECT * FROM `event` WHERE `event_hash` = '%s' AND `uid` = %d LIMIT 1", - dbesc($arr['event_hash']), + dbesc($hash), intval($arr['uid']) ); if(count($r)) @@ -369,6 +364,9 @@ function event_store($arr) { $item_flags |= ITEM_ORIGIN; } + + $uri = item_message_id(); + $private = (($arr['allow_cid'] || $arr['allow_gid'] || $arr['deny_cid'] || $arr['deny_gid']) ? 1 : 0); if($private) $item_flags |= ITEM_PRIVATE; @@ -377,8 +375,9 @@ function event_store($arr) { $item_arr['uid'] = $arr['uid']; $item_arr['author_xchan'] = $arr['event_xchan']; - $item_arr['uri'] = $arr['message_id']; - $item_arr['parent_uri'] = $arr['message_id']; + $item_arr['uri'] = $uri; + $item_arr['parent_uri'] = $uri; + $item_arr['item_flags'] = $item_flags; $item_arr['owner_xchan'] = (($wall) ? $z[0]['channel_hash'] : $arr['event_xchan']); diff --git a/include/zot.php b/include/zot.php index f01b0f63f..28ecdc4dc 100644 --- a/include/zot.php +++ b/include/zot.php @@ -893,7 +893,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { // for events, extract the event info and create and event linked to an item - if((x($arr,'obj_type')) && (activity_compare($arr['obj_type'],ACTIVITY_OBJ_EVENT))) { + if((x($arr,'obj_type')) && (activity_match($arr['obj_type'],ACTIVITY_OBJ_EVENT))) { require_once('include/event.php'); $ev = bbtoevent($arr['body']); if(x($ev,'desc') && x($ev,'start')) { @@ -905,13 +905,15 @@ function process_delivery($sender,$arr,$deliveries,$relay) { // is this an edit? $r = q("SELECT * FROM event left join item on resource_id = event_hash WHERE resource_type = 'event' and - `uri` = '%s' AND `uid` = %d LIMIT 1", + `uri` = '%s' AND event.uid = %d LIMIT 1", dbesc($arr['uri']), - intval($importer['uid']) + intval($channel['channel_id']) ); if($r) $ev['event_hash'] = $r[0]['event_hash']; + dbg(1); $xyz = event_store($ev); + dbg(0); $result = array($d['hash'],'event processed'); continue; } diff --git a/mod/events.php b/mod/events.php index 9bcad1f87..975278618 100755 --- a/mod/events.php +++ b/mod/events.php @@ -236,10 +236,11 @@ function events_content(&$a) { intval($_GET['id']) ); } else { + $r = q("SELECT * from event left join item on event_hash = resource_id where resource_type = 'event' and event.uid = %d and event.ignore = %d - AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' ) - OR ( `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ", + AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' ) + OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' )) ", intval(local_user()), intval($ignored), dbesc($start), @@ -247,6 +248,7 @@ function events_content(&$a) { dbesc($adjust_start), dbesc($adjust_finish) ); + } $links = array(); diff --git a/mod/ping.php b/mod/ping.php index 347b26eb3..477b9ff0d 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -183,6 +183,8 @@ function ping_init(&$a) { if(argc() > 1 && (argv(1) === 'all_events')) { + $bd_format = t('g A l F d') ; // 8 AM Friday January 18 + $result = array(); $r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash @@ -195,12 +197,23 @@ function ping_init(&$a) { if($r) { foreach($r as $rr) { + if($rr['adjust']) + $md = datetime_convert('UTC',date_default_timezone_get(),$rr['start'],'Y/m'); + else + $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m'); + + $strt = datetime_convert('UTC',$rr['convert'] ? date_default_timezone_get() : 'UTC',$rr['start']); + $today = ((substr($strt,0,10) === datetime_convert('UTC',date_default_timezone_get(),'now','Y-m-d')) ? true : false); + + $when = day_translate(datetime_convert('UTC', $rr['adjust'] ? date_default_timezone_get() : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); + + $result[] = array( - 'notify_link' => $a->get_baseurl() . '/events/' . $rr['event_hash'], + 'notify_link' => $a->get_baseurl() . '/events/event/' . $rr['event_hash'], 'name' => $rr['xchan_name'], 'url' => $rr['xchan_url'], 'photo' => $rr['xchan_photo_s'], - 'when' => relative_date($rr['start']), + 'when' => $when, 'class' => ('notify-unseen'), 'message' => t('posted an event') ); |