aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
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');