]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
add photo upload link to album widget and "upload to this album" ability
[friendica.git] / mod / search.php
index 819100204c3bdfd875fce1d533e9840695c49442..3f98b607f0dd92ab0a0a179eee25337fa9c37670 100644 (file)
@@ -4,7 +4,7 @@ function search_saved_searches() {
 
        $o = '';
 
-       $r = q("select `term` from `search` WHERE `uid` = %d",
+       $r = q("select `id`,`term` from `search` WHERE `uid` = %d",
                intval(local_user())
        );
 
@@ -96,17 +96,10 @@ function search_content(&$a) {
        // Only public wall posts can be shown
        // OR your own posts if you are a logged in member
 
-       $escaped_search = str_replace(array('[',']'),array('\\[','\\]'),$search);
-
-//     $s_bool  = sprintf("AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )", dbesc($search));
        $s_regx  = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", 
-               dbesc($escaped_search), dbesc('\\]' . $escaped_search . '\\['));
-
-//     if(mb_strlen($search) >= 3)
-//             $search_alg = $s_bool;
-//     else
+               dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\['));
 
-               $search_alg = $s_regx;
+       $search_alg = $s_regx;
 
        $r = q("SELECT COUNT(*) AS `total`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`