aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-08-31 21:57:08 -0700
committerredmatrix <mike@macgirvin.com>2016-08-31 21:57:08 -0700
commitfa8febbb31dee83d608849e3f1a2f56d664d1f13 (patch)
tree62d250109a876df4afafd2f3f1cead0095c14384 /include
parent8ba1bf02a479941740847cd9fad707f2fc86390c (diff)
downloadvolse-hubzilla-fa8febbb31dee83d608849e3f1a2f56d664d1f13.tar.gz
volse-hubzilla-fa8febbb31dee83d608849e3f1a2f56d664d1f13.tar.bz2
volse-hubzilla-fa8febbb31dee83d608849e3f1a2f56d664d1f13.zip
some issues with saved search - tags and connection searches weren't being saved.
Diffstat (limited to 'include')
-rw-r--r--include/text.php2
-rw-r--r--include/widgets.php38
2 files changed, 38 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php
index 99ac59ca7..2c7716d11 100644
--- a/include/text.php
+++ b/include/text.php
@@ -936,7 +936,7 @@ function searchbox($s,$id='search-box',$url='/search',$save = false) {
'$action_url' => z_root() . '/' . $url,
'$search_label' => t('Search'),
'$save_label' => t('Save'),
- '$savedsearch' => feature_enabled(local_channel(),'savedsearch')
+ '$savedsearch' => ($save && feature_enabled(local_channel(),'savedsearch'))
));
}
diff --git a/include/widgets.php b/include/widgets.php
index 16582d084..c57cbd749 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -209,7 +209,9 @@ function widget_savedsearch($arr) {
if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
return '';
- $search = ((x($_GET,'search')) ? $_GET['search'] : '');
+ $search = ((x($_GET,'netsearch')) ? $_GET['netsearch'] : '');
+ if(! $search)
+ $search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $search) {
$r = q("select * from `term` where `uid` = %d and `ttype` = %d and `term` = '%s' limit 1",
@@ -287,6 +289,40 @@ function widget_savedsearch($arr) {
return $o;
}
+function widget_sitesearch($arr) {
+
+ $search = ((x($_GET,'search')) ? $_GET['search'] : '');
+
+ $srchurl = App::$query_string;
+
+ $srchurl = rtrim(preg_replace('/search\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ $srchurl = rtrim(preg_replace('/submit\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
+
+
+ $hasq = ((strpos($srchurl,'?') !== false) ? true : false);
+ $hasamp = ((strpos($srchurl,'&') !== false) ? true : false);
+
+ if(($hasamp) && (! $hasq))
+ $srchurl = substr($srchurl,0,strpos($srchurl,'&')) . '?f=&' . substr($srchurl,strpos($srchurl,'&')+1);
+
+ $o = '';
+
+ $saved = array();
+
+ $tpl = get_markup_template("sitesearch.tpl");
+ $o = replace_macros($tpl, array(
+ '$title' => t('Search'),
+ '$searchbox' => searchbox($search, 'netsearch-box', $srchurl . (($hasq) ? '' : '?f='), false),
+ '$saved' => $saved,
+ ));
+
+ return $o;
+}
+
+
+
+
function widget_filer($arr) {
if(! local_channel())