From af066d7383edfc9c47ceb64076ec38efd6f39edb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 16 Jan 2013 03:18:32 -0800 Subject: mopping up the events issues so I can move on to other stuff --- mod/events.php | 6 ++++-- mod/ping.php | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'mod') 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') ); -- cgit v1.2.3