]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
move plink sparkles to the right html element in dispy
[friendica.git] / mod / search.php
index 635c87b705cb0084c0fb9aca834e69ca13e0c3a5..320ffddcef2fbc0df671e6c58e5c26937372711a 100644 (file)
@@ -71,7 +71,7 @@ function search_content(&$a) {
                notice( t('Public access denied.') . EOL);
                return;
        }
-       
+
        nav_set_selected('search');
 
        require_once("include/bbcode.php");
@@ -80,7 +80,7 @@ function search_content(&$a) {
 
        $o = '<div id="live-search"></div>' . "\r\n";
 
-       $o .= '<h3>' . t('Search This Site') . '</h3>';
+       $o .= '<h3>' . t('Search') . '</h3>';
 
        if(x($a->data,'search'))
                $search = notags(trim($a->data['search']));
@@ -96,19 +96,29 @@ function search_content(&$a) {
 
        $o .= search($search,'search-box','/search',((local_user()) ? true : 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(! $search)
                return $o;
 
-       if($tag)
-               $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ",  dbesc('\\]' . preg_quote($search) . '\\['));
-       else
-               $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(preg_quote($search)));
+       if (get_config('system','use_fulltext_engine')) {
+               if($tag)
+                       $sql_extra = sprintf(" AND MATCH (`item`.`tag`) AGAINST ('".'"%s"'."' in boolean mode) ", '#'.dbesc(protect_sprintf($search)));
+               else
+                       $sql_extra = sprintf(" AND MATCH (`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) ", dbesc(protect_sprintf($search)));
+       } else {
+               if($tag)
+                       $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ",  dbesc('\\]' . protect_sprintf(preg_quote($search)) . '\\['));
+               else
+                       $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+       }
 
 
 
@@ -136,7 +146,7 @@ function search_content(&$a) {
        }
 
        $r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`, 
-               `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
+               `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
                `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, 
                `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
                `user`.`nickname`