diff --git a/include/nav.php b/include/nav.php index 3d27be13be..e1661644d1 100644 --- a/include/nav.php +++ b/include/nav.php @@ -26,7 +26,7 @@ function nav(&$a) { $tpl = get_markup_template('nav.tpl'); $a->page['nav'] .= replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => $a->get_baseurl(), '$langselector' => lang_selector(), '$sitelocation' => $nav_info['sitelocation'], '$nav' => $nav_info['nav'], @@ -118,6 +118,12 @@ function nav_info(&$a) { $nav['search'] = array('search', t('Search'), "", t('Search site content')); + $nav['searchoption'] = array( + t("Full Text"), + t("Tags"), + t("Contacts"), + t("Forums")); + $gdirpath = 'directory'; if(strlen(get_config('system','singleuser'))) { diff --git a/include/text.php b/include/text.php index 4747a376fe..9a65224af9 100644 --- a/include/text.php +++ b/include/text.php @@ -986,16 +986,26 @@ if(! function_exists('search')) { * @param string $url search url * @param boolean $savedsearch show save search button */ -function search($s,$id='search-box',$url='/search',$save = false) { +function search($s,$id='search-box',$url='/search',$save = false, $aside = true) { $a = get_app(); - return replace_macros(get_markup_template('searchbox.tpl'), array( - '$s' => $s, - '$id' => $id, - '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url, - '$search_label' => t('Search'), - '$save_label' => t('Save'), - '$savedsearch' => feature_enabled(local_user(),'savedsearch'), - )); + + $values = array( + '$s' => $s, + '$id' => $id, + '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url, + '$search_label' => t('Search'), + '$save_label' => t('Save'), + '$savedsearch' => feature_enabled(local_user(),'savedsearch'), + ); + + if (!$aside) + $values['$searchoption'] = array( + t("Full Text"), + t("Tags"), + t("Contacts"), + t("Forums")); + + return replace_macros(get_markup_template('searchbox.tpl'), $values); }} if(! function_exists('valid_email')) { diff --git a/mod/dirfind.php b/mod/dirfind.php index e70dfe9680..3cee6c1330 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -14,13 +14,13 @@ function dirfind_init(&$a) { -function dirfind_content(&$a) { +function dirfind_content(&$a, $prefix = "") { $community = false; $local = get_config('system','poco_local_search'); - $search = notags(trim($_REQUEST['search'])); + $search = $prefix.notags(trim($_REQUEST['search'])); if(strpos($search,'@') === 0) $search = substr($search,1); diff --git a/mod/search.php b/mod/search.php index a01984d244..d9a2852dd4 100644 --- a/mod/search.php +++ b/mod/search.php @@ -1,4 +1,8 @@ ' . t('Search') . ''; @@ -110,21 +111,34 @@ function search_content(&$a) { } - $o .= search($search,'search-box','/search',((local_user()) ? true : false)); + $o .= search($search,'search-box','/search',((local_user()) ? true : false), false); if(strpos($search,'#') === 0) { $tag = true; $search = substr($search,1); } if(strpos($search,'@') === 0) { - require_once('mod/dirfind.php'); return dirfind_content($a); } if(strpos($search,'!') === 0) { - require_once('mod/dirfind.php'); return dirfind_content($a); } + if(x($_GET,'search-option')) + switch($_GET['search-option']) { + case 'fulltext': + break; + case 'tags': + $tag = true; + break; + case 'contacts': + return dirfind_content($a, "@"); + break; + case 'forums': + return dirfind_content($a, "!"); + break; + } + if(! $search) return $o; diff --git a/view/templates/searchbox.tpl b/view/templates/searchbox.tpl index c3b8752942..9c1be50cf6 100644 --- a/view/templates/searchbox.tpl +++ b/view/templates/searchbox.tpl @@ -2,6 +2,15 @@
{{strip}} + {{if $searchoption}} + + {{/if}} + {{if $savedsearch}} diff --git a/view/theme/vier/templates/nav.tpl b/view/theme/vier/templates/nav.tpl index 8a40d6dd77..5483113f33 100644 --- a/view/theme/vier/templates/nav.tpl +++ b/view/theme/vier/templates/nav.tpl @@ -72,6 +72,12 @@
{{/if}}