From e7957e14489ce8eb3b69ebede928dfe441a4924d Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Jul 2012 19:28:02 -0700 Subject: create fetch_tags function, make search work again, change logo --- include/conversation.php | 15 +-------------- include/items.php | 29 +++++++++++++++++++++++++++++ include/nav.php | 2 +- include/text.php | 11 ++++++----- 4 files changed, 37 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index f81a7e7d2..ce8f5779c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1102,26 +1102,13 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { } -function conv_sort($arr,$tags,$order) { +function conv_sort($arr,$order) { if((!(is_array($arr) && count($arr)))) return array(); $parents = array(); - - for($x = 0; $x < count($arr); $x ++) { - if(count($tags)) { - foreach($tags as $t) { - if($t['oid'] == $arr[$x]['item_id']) { - if(! is_array($arr[$x]['term'])) - $arr[$x]['term'] = array(); - $arr[$x]['term'][] = $t; - } - } - } - } - foreach($arr as $x) if($x['id'] == $x['parent']) $parents[] = $x; diff --git a/include/items.php b/include/items.php index 1f90a1d05..d48a04da5 100755 --- a/include/items.php +++ b/include/items.php @@ -3697,3 +3697,32 @@ function store_diaspora_retract_sig($item, $user, $baseurl) { return; } + +function fetch_post_tags($items) { + + $tag_finder = array(); + if(count($items)) + foreach($items as $item) + if(! in_array($item['item_id'],$tag_finder)) + $tag_finder[] = $item['item_id']; + $tag_finder_str = implode(', ', $tag_finder); + + $tags = q("select * from term where oid in ( %s ) and otype = %d", + dbesc($tag_finder_str), + intval(TERM_OBJ_POST) + ); + + for($x = 0; $x < count($items); $x ++) { + if(count($tags)) { + foreach($tags as $t) { + if($t['oid'] == $items[$x]['item_id']) { + if(! is_array($items[$x]['term'])) + $items[$x]['term'] = array(); + $items[$x]['term'][] = $t; + } + } + } + } + + return $items; +} diff --git a/include/nav.php b/include/nav.php index a52e4afa3..318512373 100644 --- a/include/nav.php +++ b/include/nav.php @@ -156,7 +156,7 @@ function nav(&$a) { $banner = get_config('system','banner'); if($banner === false) - $banner .= 'logored'; + $banner .= 'logo'; $tpl = get_markup_template('nav.tpl'); diff --git a/include/text.php b/include/text.php index 59ef5a88f..aa377dd68 100644 --- a/include/text.php +++ b/include/text.php @@ -932,8 +932,8 @@ function prepare_body($item,$attach = false) { foreach($terms as $t) { if(strlen($x)) $x .= ','; - $x .= $t['term'] - . ((local_user() == $item['uid']) ? ' ' . t('[remove]') . '' : ''); + $x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8') + . ((local_user() == $item['uid']) ? ' ' . t('[remove]') . '' : ''); } if(strlen($x)) $s .= '
' . t('Categories:') . ' ' . $x . '
'; @@ -947,7 +947,8 @@ function prepare_body($item,$attach = false) { foreach($terms as $t) { if(strlen($x)) $x .= '   '; - $x .= $t['term'] . ' ' . t('[remove]') . ''; + $x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8') + . ' ' . t('[remove]') . ''; } if(strlen($x) && (local_user() == $item['uid'])) $s .= '
' . t('Filed under:') . ' ' . $x . '
'; @@ -1499,8 +1500,8 @@ function format_term_for_display($term) { elseif($term['type'] == TERM_MENTION) $s .= '@'; - if($term['url']) $s .= '' . $term['term'] . ''; - else $s .= $term['term']; + if($term['url']) $s .= '' . htmlspecialchars($term['term']) . ''; + else $s .= htmlspecialchars($term['term']); return $s; } -- cgit v1.2.3