diff --git a/include/conversation.php b/include/conversation.php index b8546ce01..1bdde5e9f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -626,13 +626,12 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $indent .= ' shiny'; + localize_item($item); $body = prepare_body($item,true); - list($categories, $folders) = get_cats_and_terms($item); - - + list($categories,$folders) = get_cats_and_terms($item); $tmp_item = array( // collapse comments in template. I don't like this much... @@ -903,6 +902,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $body = prepare_body($item,true); + list($categories, $folders) = get_cats_and_terms($item); //$tmp_item = replace_macros($tpl,array( $tmp_item = array( diff --git a/include/text.php b/include/text.php index 9b55078cb..23e3e5061 100644 --- a/include/text.php +++ b/include/text.php @@ -1115,24 +1115,25 @@ function get_cats_and_terms($item) { if (count($categories)) $categories[count($categories)-1]['last'] = true; - - $matches = false; $first = true; - $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); - if($cnt) { - foreach($matches as $mtch) { - $folders[] = array( - 'name' => xmlify(file_tag_decode($mtch[1])), - 'url' => "#", - 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""), - 'first' => $first, - 'last' => false - ); - $first = false; + if(local_user() == $item['uid']) { + $matches = false; $first = true; + $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $folders[] = array( + 'name' => xmlify(file_tag_decode($mtch[1])), + 'url' => "#", + 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""), + 'first' => $first, + 'last' => false + ); + $first = false; + } } } if (count($folders)) $folders[count($folders)-1]['last'] = true; - + return array($categories, $folders); } diff --git a/object/Item.php b/object/Item.php index 04d52a896..ed439e4d2 100644 --- a/object/Item.php +++ b/object/Item.php @@ -214,6 +214,10 @@ class Item extends BaseObject { 'tags' => $tags, 'hashtags' => $hashtags, 'mentions' => $mentions, + 'txt_cats' => t('Categories:'), + 'txt_folders' => t('Filed under:'), + 'has_cats' => ((count($categories)) ? 'true' : ''), + 'has_folders' => ((count($folders)) ? 'true' : ''), 'categories' => $categories, 'folders' => $folders, 'body' => template_escape($body), diff --git a/view/search_item.tpl b/view/search_item.tpl index 8d8a0dbd4..de3c58839 100644 --- a/view/search_item.tpl +++ b/view/search_item.tpl @@ -30,6 +30,15 @@
$item.title
$item.body
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wall_item.tpl b/view/wall_item.tpl index e4eabb9e5..7fe8794d8 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -36,6 +36,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wall_thread.tpl b/view/wall_thread.tpl index e3f0436a3..86a937fef 100644 --- a/view/wall_thread.tpl +++ b/view/wall_thread.tpl @@ -47,6 +47,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wallwall_item.tpl b/view/wallwall_item.tpl index e8044532a..ff2bc00e4 100644 --- a/view/wallwall_item.tpl +++ b/view/wallwall_item.tpl @@ -40,6 +40,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wallwall_thread.tpl b/view/wallwall_thread.tpl index 68bb3bc9d..211f95132 100644 --- a/view/wallwall_thread.tpl +++ b/view/wallwall_thread.tpl @@ -47,6 +47,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}