create fetch_tags function, make search work again, change logo

This commit is contained in:
friendica
2012-07-10 19:28:02 -07:00
parent 94fabe3a29
commit e7957e1448
12 changed files with 61 additions and 49 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -156,7 +156,7 @@ function nav(&$a) {
$banner = get_config('system','banner');
if($banner === false)
$banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">red</a></span>';
$banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/fred-32.png" alt="logo" /></a>';
$tpl = get_markup_template('nav.tpl');

View File

@@ -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']) ? ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . $t['term'] . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>' : '');
$x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8')
. ((local_user() == $item['uid']) ? ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . urlencode($t['term']) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>' : '');
}
if(strlen($x))
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
@@ -947,7 +947,8 @@ function prepare_body($item,$attach = false) {
foreach($terms as $t) {
if(strlen($x))
$x .= '&nbsp;&nbsp;&nbsp;';
$x .= $t['term'] . ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . $t['term'] . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
$x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8')
. ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
}
if(strlen($x) && (local_user() == $item['uid']))
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
@@ -1499,8 +1500,8 @@ function format_term_for_display($term) {
elseif($term['type'] == TERM_MENTION)
$s .= '@';
if($term['url']) $s .= '<a target="extlink" href="' . $term['url'] . '">' . $term['term'] . '</a>';
else $s .= $term['term'];
if($term['url']) $s .= '<a target="extlink" href="' . $term['url'] . '">' . htmlspecialchars($term['term']) . '</a>';
else $s .= htmlspecialchars($term['term']);
return $s;
}