]> git.mxchange.org Git - friendica.git/commitdiff
Now you can set search options so that searching for contacts or forums isn't occult...
authorMichael Vogel <icarus@dabo.de>
Mon, 24 Aug 2015 09:55:29 +0000 (11:55 +0200)
committerMichael Vogel <icarus@dabo.de>
Mon, 24 Aug 2015 09:55:29 +0000 (11:55 +0200)
include/nav.php
include/text.php
mod/dirfind.php
mod/search.php
view/templates/searchbox.tpl
view/theme/vier/templates/nav.tpl

index 3d27be13be819bf8e1c4dd66a1da260501200f50..e1661644d180beb92592d3f1dd0cb1e4825d6bac 100644 (file)
@@ -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'))) {
index 4747a376febd64d8d41509496be91e0b6fc3b5b9..f3e44b3ebc09f3d13e9cbaa5bc9f47c6707e3023 100644 (file)
@@ -995,6 +995,11 @@ function search($s,$id='search-box',$url='/search',$save = false) {
                '$search_label' => t('Search'),
                '$save_label' => t('Save'),
                '$savedsearch' => feature_enabled(local_user(),'savedsearch'),
+               '$searchoption' => array(
+                                       t("Full Text"),
+                                       t("Tags"),
+                                       t("Contacts"),
+                                       t("Forums"))
        ));
 }}
 
index e70dfe968080503348e0d6aa1fe9bc10ad5d4e14..3cee6c1330d3779180475b6239aaef8e4a5dce7b 100644 (file)
@@ -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);
index a01984d2444c7255e363489622e266a1e76c7ed3..d5e0dfb208992af0f91f65745fad772add2b9312 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+require_once("include/bbcode.php");
+require_once('include/security.php');
+require_once('include/conversation.php');
+require_once('mod/dirfind.php');
 
 function search_saved_searches() {
 
@@ -92,9 +96,6 @@ function search_content(&$a) {
 
        nav_set_selected('search');
 
-       require_once("include/bbcode.php");
-       require_once('include/security.php');
-       require_once('include/conversation.php');
 
        $o = '<h3>' . t('Search') . '</h3>';
 
@@ -117,14 +118,27 @@ function search_content(&$a) {
                $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;
 
index c3b8752942ecccf97c76697f7626e9eb94eeae7b..b9a01752c0eabbd46c64223bffefb59d20a6b646 100644 (file)
@@ -2,6 +2,13 @@
         <form action="{{$action_url}}" method="get" >
                 {{strip}}
                 <input type="text" name="search" id="search-text" placeholder="{{$search_label}}" value="{{$s}}" />
+               <select name="search-option">
+                       <option value="fulltext">{{$searchoption.0}}</option>
+                       <option value="tags">{{$searchoption.1}}</option>
+                       <option value="contacts">{{$searchoption.2}}</option>
+                       <option value="forums">{{$searchoption.3}}</option>
+               </select>
+
                 <input type="submit" name="submit" id="search-submit" value="{{$search_label}}" />
                 {{if $savedsearch}}
                 <input type="submit" name="save" id="search-save" value="{{$save_label}}" />
index 8a40d6dd77347e297e0fec1c649901d72b1d0d67..5483113f33b2bda14ffb35f451fc4fcd692de5ab 100644 (file)
                        <li role="search" id="search-box">
                                <form method="get" action="{{$nav.search.0}}">
                                        <input accesskey="s" id="search-text" class="nav-menu-search" type="text" value="" name="search">
+                                       <select name="search-option">
+                                               <option value="fulltext">{{$nav.searchoption.0}}</option>
+                                               <option value="tags">{{$nav.searchoption.1}}</option>
+                                               <option value="contacts">{{$nav.searchoption.2}}</option>
+                                               <option value="forums">{{$nav.searchoption.3}}</option>
+                                       </select>
                                </form>
                        </li>
                {{/if}}