some issues with saved search - tags and connection searches weren't being saved.
This commit is contained in:
parent
8ba1bf02a4
commit
fa8febbb31
@ -61,6 +61,7 @@ class Network extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$search = (($_GET['search']) ? $_GET['search'] : '');
|
$search = (($_GET['search']) ? $_GET['search'] : '');
|
||||||
if($search) {
|
if($search) {
|
||||||
|
$_GET['netsearch'] = escape_tags($search);
|
||||||
if(strpos($search,'@') === 0) {
|
if(strpos($search,'@') === 0) {
|
||||||
$r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1",
|
$r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1",
|
||||||
dbesc(substr($search,1)),
|
dbesc(substr($search,1)),
|
||||||
|
@ -936,7 +936,7 @@ function searchbox($s,$id='search-box',$url='/search',$save = false) {
|
|||||||
'$action_url' => z_root() . '/' . $url,
|
'$action_url' => z_root() . '/' . $url,
|
||||||
'$search_label' => t('Search'),
|
'$search_label' => t('Search'),
|
||||||
'$save_label' => t('Save'),
|
'$save_label' => t('Save'),
|
||||||
'$savedsearch' => feature_enabled(local_channel(),'savedsearch')
|
'$savedsearch' => ($save && feature_enabled(local_channel(),'savedsearch'))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,9 @@ function widget_savedsearch($arr) {
|
|||||||
if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
|
if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
|
||||||
return '';
|
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) {
|
if(x($_GET,'searchsave') && $search) {
|
||||||
$r = q("select * from `term` where `uid` = %d and `ttype` = %d and `term` = '%s' limit 1",
|
$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;
|
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) {
|
function widget_filer($arr) {
|
||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
[region=aside]
|
[region=aside]
|
||||||
[widget=savedsearch][/widget]
|
[widget=sitesearch][/widget]
|
||||||
[/region]
|
[/region]
|
||||||
|
5
view/tpl/sitesearch.tpl
Normal file
5
view/tpl/sitesearch.tpl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<div class="widget saved-search-widget">
|
||||||
|
<h3 id="search">{{$title}}</h3>
|
||||||
|
{{$searchbox}}
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
Reference in New Issue
Block a user