X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=2a8bf1484ec3e62495ee7a1bc4969635d4e48800;hb=df7702709b07560af1d469f0835586af317f39b0;hp=f7ce75905a80b23c6616baf39da485d2da594423;hpb=5ec4a4e6deb5d28cbfab54093f8b4180912738d4;p=friendica.git diff --git a/mod/search.php b/mod/search.php index f7ce75905a..2a8bf1484e 100644 --- a/mod/search.php +++ b/mod/search.php @@ -1,5 +1,63 @@ '; + $o .= '

' . t('Saved Searches') . '

' . "\r\n"; + $o .= '
' . "\r\n"; + } + + return $o; + +} + + +function search_init(&$a) { + + $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); + + if(local_user()) { + if(x($_GET,'save') && $search) { + $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') && $search) { + q("delete from `search` where `uid` = %d and `term` = '%s' limit 1", + intval(local_user()), + dbesc($search) + ); + } + + $a->page['aside'] .= search_saved_searches(); + + } + else + unset($_SESSION['theme']); + + + +} + + function search_post(&$a) { if(x($_POST,'search')) @@ -20,19 +78,16 @@ function search_content(&$a) { require_once('include/security.php'); require_once('include/conversation.php'); - if(x($_SESSION,'theme')) - unset($_SESSION['theme']); - $o = '' . "\r\n"; - $o .= '

' . t('Search') . '

'; + $o .= '

' . t('Search This Site') . '

'; if(x($a->data,'search')) $search = notags(trim($a->data['search'])); else $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); - $o .= search($search); + $o .= search($search,'search-box','/search',((local_user()) ? true : false)); if(! $search) return $o; @@ -88,12 +143,11 @@ function search_content(&$a) { ); - + $o .= '

Search results for: ' . $search . '

'; $o .= conversation($a,$r,'search',false); $o .= paginate($a); - $o .= cc_license(); return $o; }