aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-04 17:35:06 -0700
committerFriendika <info@friendika.com>2011-09-04 17:35:06 -0700
commit481853d2cc44a4bf6c540e72c741ff453305a925 (patch)
treec29357adbc460d0e3096ef57e2a4844d44eaaef1 /mod
parentf6a43afb8da061ac13d778eb7fba6e2ea6dda6d7 (diff)
downloadvolse-hubzilla-481853d2cc44a4bf6c540e72c741ff453305a925.tar.gz
volse-hubzilla-481853d2cc44a4bf6c540e72c741ff453305a925.tar.bz2
volse-hubzilla-481853d2cc44a4bf6c540e72c741ff453305a925.zip
saved searches on network page
Diffstat (limited to 'mod')
-rw-r--r--mod/network.php46
1 files changed, 45 insertions, 1 deletions
diff --git a/mod/network.php b/mod/network.php
index 54fb2a0a4..663814ab7 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -16,8 +16,26 @@ function network_init(&$a) {
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
$srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '');
+ if(x($_GET,'save')) {
+ $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ if(! count($r)) {
+ q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+ }
+ if(x($_GET,'remove')) {
+ q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
- $a->page['aside'] .= search($search,'netsearch-box',$srchurl);
+ $a->page['aside'] .= search($search,'netsearch-box',$srchurl,true);
$a->page['aside'] .= '<div id="network-new-link">';
@@ -49,9 +67,35 @@ function network_init(&$a) {
$a->page['aside'] .= '</div>';
$a->page['aside'] .= group_side('network','network',true,$group_id);
+
+ $a->page['aside'] .= saved_searches();
+
+}
+
+function saved_searches() {
+
+ $o = '';
+
+ $r = q("select `term` from `search` WHERE `uid` = %d",
+ intval(local_user())
+ );
+
+ if(count($r)) {
+ $o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
+ $o .= '<div id="saved-search-list"><ul id="saved-search-ul">' . "\r\n";
+ foreach($r as $rr) {
+ $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ }
+ $o .= '</ul></div>' . "\r\n";
+ }
+
+ return $o;
+
}
+
+
function network_content(&$a, $update = 0) {
require_once('include/conversation.php');