From 41cd10f9035f52dce664aea443f06b15d3463994 Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Thu, 7 Mar 2013 02:05:19 -0500 Subject: some fixes related to events - add backticks around column "desc" in sql query - fixed query for data passed to showEvent - showEvent was picking up on id from item instead of id from event - fixed references to author info in template --- include/event.php | 2 +- mod/events.php | 9 +++++---- view/tpl/event.tpl | 2 +- view/tpl/smarty3/event.tpl | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/event.php b/include/event.php index 6a35bd0ad..e334c5a4f 100644 --- a/include/event.php +++ b/include/event.php @@ -332,7 +332,7 @@ function event_store($arr) { $arr['uri'] = item_message_id(); - $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,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', %d, %d, '%s', '%s', '%s', '%s' ) ", intval($arr['uid']), diff --git a/mod/events.php b/mod/events.php index 8c509cfea..dd1f92f66 100755 --- a/mod/events.php +++ b/mod/events.php @@ -229,9 +229,9 @@ function events_content(&$a) { $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); - if (x($_GET,'id')){ - $r = q("SELECT * from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1", + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan + from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1", intval(local_user()), intval($_GET['id']) ); @@ -242,8 +242,8 @@ function events_content(&$a) { // Noting this for now - it will need to be fixed here and in Friendica. // Ultimately the finish date shouldn't be involved in the query. - - $r = q("SELECT * from event left join item on event_hash = resource_id + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan + 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' or nofinish ) AND `start` <= '%s' ) OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' )) ", @@ -339,6 +339,7 @@ function events_content(&$a) { else { $tpl = get_markup_template("events-js.tpl"); } + $o = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, diff --git a/view/tpl/event.tpl b/view/tpl/event.tpl index 80c1dfc55..f1150c158 100644 --- a/view/tpl/event.tpl +++ b/view/tpl/event.tpl @@ -1,7 +1,7 @@ {{ for $events as $event }}
- {{ if $event.item.author-name }}$event.item.author-name{{ endif }} + {{ if $event.item.author.xchan_name }}$event.item.author.xchan_name{{ endif }} $event.html {{ if $event.item.plink }}{{ endif }} {{ if $event.edit }}{{ endif }} diff --git a/view/tpl/smarty3/event.tpl b/view/tpl/smarty3/event.tpl index 1ba472377..76c9433fd 100644 --- a/view/tpl/smarty3/event.tpl +++ b/view/tpl/smarty3/event.tpl @@ -6,7 +6,7 @@ {{foreach $events as $event}}
- {{if $event.item.author-name}}{{$event.item.author-name}}{{/if}} + {{if $event.item.author.xchan_name}}{{$event.item.author.xchan_name}}{{/if}} {{$event.html}} {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}} -- cgit v1.2.3