diff options
author | Friendika <info@friendika.com> | 2011-10-03 05:10:15 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-03 05:10:15 -0700 |
commit | 8edab8067390a5f565f6abb889ec8dd1b18583d4 (patch) | |
tree | 7e37732d38f1368ae76fa33912cb8fa6e0ee00af | |
parent | 70911731313d58458e48a50e76c4b3b8a4d2c934 (diff) | |
download | volse-hubzilla-8edab8067390a5f565f6abb889ec8dd1b18583d4.tar.gz volse-hubzilla-8edab8067390a5f565f6abb889ec8dd1b18583d4.tar.bz2 volse-hubzilla-8edab8067390a5f565f6abb889ec8dd1b18583d4.zip |
add tagmatch
-rw-r--r-- | mod/tagmatch.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mod/tagmatch.php b/mod/tagmatch.php new file mode 100644 index 000000000..b2313694b --- /dev/null +++ b/mod/tagmatch.php @@ -0,0 +1,54 @@ +<?php + + +function tagmatch_content(&$a) { + + $search = $_REQUEST['search']; + + $o = ''; + if(! local_user()) + return; + + $o .= '<h2>' . t('Tag Match') . ' - ' . notags($search) . '</h2>'; + + + if($search) { + $params['s'] = $search; + if($a->pager['page'] != 1) + $params['p'] = $a->pager['page']; + + if(strlen(get_config('system','directory_submit_url'))) + $x = fetch_url('http://dir.friendika.com/lsearch?f=&search=' . urlencode($search)); +// else +// $x = post_url($a->get_baseurl() . '/msearch', $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; +} |