diff options
author | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-10-05 20:59:21 +0200 |
---|---|---|
committer | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-10-05 20:59:21 +0200 |
commit | 90870d4872dbc8ff408183a79fd005b905aa86c2 (patch) | |
tree | cdd66eea79a7638b520576d381d08368b05a19c1 /mod/tagmatch.php | |
parent | e88a8564c849b199ca552fa307f385b422d5d00a (diff) | |
parent | 5cb0b0ed4591a578720e0c985974db2d95f3810a (diff) | |
download | volse-hubzilla-90870d4872dbc8ff408183a79fd005b905aa86c2.tar.gz volse-hubzilla-90870d4872dbc8ff408183a79fd005b905aa86c2.tar.bz2 volse-hubzilla-90870d4872dbc8ff408183a79fd005b905aa86c2.zip |
Merge branch 'master' of git://github.com/friendika/Free-Friendika
Diffstat (limited to 'mod/tagmatch.php')
-rw-r--r-- | mod/tagmatch.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mod/tagmatch.php b/mod/tagmatch.php new file mode 100644 index 000000000..8023fa433 --- /dev/null +++ b/mod/tagmatch.php @@ -0,0 +1,52 @@ +<?php + + +function tagmatch_content(&$a) { + + $search = notags(trim($_REQUEST['search'])); + + $o = ''; + + $o .= '<h2>' . t('Tag Match') . ' - ' . $search . '</h2>'; + + if($search) { + + $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : ''); + + if(strlen(get_config('system','directory_submit_url'))) + $x = fetch_url('http://dir.friendika.com/lsearch?f=' . $p . '&search=' . urlencode($search)); + +//TODO fallback local search if global dir not available. +// else +// $x = post_url($a->get_baseurl() . '/lsearch', $params); + + $j = json_decode($x); + + if($j->total) { + $a->set_pager_total($j->total); + $a->set_pager_itemspage($j->items_page); + } + + if(count($j->results)) { + + $tpl = get_markup_template('match.tpl'); + foreach($j->results as $jj) { + + $o .= replace_macros($tpl,array( + '$url' => $jj->url, + '$name' => $jj->name, + '$photo' => $jj->photo, + '$tags' => $jj->tags + )); + } + } + else { + info( t('No matches') . EOL); + } + + } + + $o .= '<div class="clear"></div>'; + $o .= paginate($a); + return $o; +} |