Skip to content
Snippets Groups Projects
Commit 396b7edb authored by matthiasgrimm's avatar matthiasgrimm
Browse files

search fix FS#395

This patch fixes FS#395 and another bug in the fulltext search
which accepts single '+' and '-' signs as search input.

darcs-hash:20050617113855-7ef76-368041107843f805c9ab539253ddc17eb617be61.gz
parent 3aa4badb
No related branches found
No related tags found
No related merge requests found
......@@ -216,15 +216,16 @@ function search_pagename(&$data,$base,$file,$type,$lvl,$opts){
if(!preg_match('#\.txt$#',$file)) return true;
//simple stringmatching
if(strpos($file,$opts['query']) !== false){
//check ACL
$id = pathID($file);
if(auth_quickaclcheck($id) < AUTH_READ){
return false;
}
$data[]['id'] = $id;
if (!empty($opts['query'])){
if(strpos($file,$opts['query']) !== false){
//check ACL
$id = pathID($file);
if(auth_quickaclcheck($id) < AUTH_READ){
return false;
}
$data[]['id'] = $id;
}
}
return true;
}
......@@ -302,10 +303,14 @@ function search_fulltext(&$data,$base,$file,$type,$lvl,$opts){
foreach($qpreg as $word){
switch(substr($word,0,1)){
case '-':
array_push($negwords,preg_quote(substr($word,1),'#'));
if(strlen($word) > 1){ // catch single '-'
array_push($negwords,preg_quote(substr($word,1),'#'));
}
break;
case '+':
array_push($poswords,preg_quote(substr($word,1),'#'));
if(strlen($word) > 1){ // catch single '+'
array_push($poswords,preg_quote(substr($word,1),'#'));
}
break;
default:
array_push($poswords,preg_quote($word,'#'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment