From da188214c304cefaa6fe0a36e1f60932da2f3bfb Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Jan 2013 15:12:16 -0800 Subject: events are still buggered and aren't anywhere close to working, but not buggered quite as much as before. --- include/contact_widgets.php | 36 +----------------------------------- include/event.php | 10 ++++++---- mod/events.php | 17 +++++++++-------- version.inc | 2 +- view/tpl/nets.tpl | 10 ---------- view/tpl/smarty3/nets.tpl | 10 ---------- 6 files changed, 17 insertions(+), 68 deletions(-) delete mode 100644 view/tpl/nets.tpl delete mode 100644 view/tpl/smarty3/nets.tpl diff --git a/include/contact_widgets.php b/include/contact_widgets.php index e0c9ca0e8..47945e66e 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -40,41 +40,6 @@ function findpeople_widget() { } -function networks_widget($baseurl,$selected = '') { - - $a = get_app(); - - if(! local_user()) - return ''; - - - $r = q("select distinct(network) from contact where uid = %d and self = 0", - intval(local_user()) - ); - - $nets = array(); - if(count($r)) { - require_once('include/contact_selectors.php'); - foreach($r as $rr) { - if($rr['network']) - $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' )); - } - } - - if(count($nets) < 2) - return ''; - - return replace_macros(get_markup_template('nets.tpl'),array( - '$title' => t('Networks'), - '$desc' => '', - '$sel_all' => (($selected == '') ? 'selected' : ''), - '$all' => t('All Networks'), - '$nets' => $nets, - '$base' => $baseurl, - - )); -} - function fileas_widget($baseurl,$selected = '') { $a = get_app(); @@ -150,6 +115,7 @@ function common_friends_visitor_widget($profile_uid) { } } +// FIXME if(! $cid) { if(get_my_url()) { $r = q("select id from contact where nurl = '%s' and uid = %d limit 1", diff --git a/include/event.php b/include/event.php index e4a01cf7d..6f9ba779c 100644 --- a/include/event.php +++ b/include/event.php @@ -177,10 +177,10 @@ function bbtoevent($s) { } -function sort_by_date($a) { - - usort($a,'ev_compare'); - return $a; +function sort_by_date($arr) { + if(is_array($arr)) + usort($arr,'ev_compare'); + return $arr; } @@ -212,6 +212,8 @@ function event_store($arr) { $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']), diff --git a/mod/events.php b/mod/events.php index 7886f27c0..0002bf11c 100755 --- a/mod/events.php +++ b/mod/events.php @@ -238,16 +238,13 @@ function events_content(&$a) { if (x($_GET,'id')){ - $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, - `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` - WHERE `event`.`uid` = %d AND `event`.`id` = %d", + $r = q("SELECT event.*, item.* from event left join item on event.id = item.resource_id where resource_type = 'event' and event.uid = %d and event.id = %d limit 1", intval(local_user()), intval($_GET['id']) ); } else { - $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, - `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` - WHERE `event`.`uid` = %d and ignore = %d + $r = q("SELECT event.*, item.* from event left join item on event.id = item.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' )) ", intval(local_user()), @@ -262,7 +259,11 @@ function events_content(&$a) { $links = array(); if($r) { + xchan_query($r); + $r = fetch_post_tags($r); + $r = sort_by_date($r); + foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) @@ -277,10 +278,9 @@ function events_content(&$a) { $fmt = t('l, F j'); if($r) { - $r = sort_by_date($r); + foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); $d = day_translate($d); @@ -296,6 +296,7 @@ function events_content(&$a) { $is_first = ($d !== $last_date); $last_date = $d; +// FIXME $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null); $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); if(! $title) { diff --git a/version.inc b/version.inc index 19d7676b1..53facb6b4 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-01-06.192 +2013-01-07.193 diff --git a/view/tpl/nets.tpl b/view/tpl/nets.tpl deleted file mode 100644 index 920c2332b..000000000 --- a/view/tpl/nets.tpl +++ /dev/null @@ -1,10 +0,0 @@ -
-

$title

-
$desc
- $all - -
diff --git a/view/tpl/smarty3/nets.tpl b/view/tpl/smarty3/nets.tpl deleted file mode 100644 index f514626ac..000000000 --- a/view/tpl/smarty3/nets.tpl +++ /dev/null @@ -1,10 +0,0 @@ -
-

{{$title}}

-
{{$desc}}
- {{$all}} - -
-- cgit v1.2.3