Introduced the raw: search label for auditors

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2021-05-02 14:01:37 +02:00
parent c0fa39b992
commit 7b47ce3ca2
3 changed files with 14 additions and 16 deletions

View File

@ -1,4 +1,5 @@
- Introduced the archive_address feature, see etc/example.conf for the details
- Introduced the raw: search label
1.3.12:
-------

View File

@ -15,6 +15,7 @@ class ControllerSearchHelper extends Controller {
'folders' => '',
'extra_folders' => '',
'id' => '',
'raw' => '',
'match' => array()
);
@ -49,7 +50,7 @@ class ControllerSearchHelper extends Controller {
if($this->request->post['searchtype'] == 'expert'){
if(isset($this->request->post['search']) && preg_match("/(from|to|subject|body|direction|d|size|date1|date2|attachment|a|tag|note|id)\:/", $this->request->post['search'])) {
if(isset($this->request->post['search']) && preg_match("/(from|to|subject|body|direction|d|size|date1|date2|attachment|a|tag|note|id|raw)\:/", $this->request->post['search'])) {
$this->a = $this->model_search_search->preprocess_post_expert_request($this->request->post);
}
else {

View File

@ -112,7 +112,6 @@ class ModelSearchSearch extends Model {
$session = Registry::get('session');
$i = 0;
while(list($k, $v) = each($data['match'])) {
if($v == "@attachment_types") {
@ -163,6 +162,10 @@ class ModelSearchSearch extends Model {
$match = implode(" ", $data['match']);
if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 0 && $data['raw']) {
$match .= $data['raw'];
}
if($emailfilter) {
if(strlen($match) > 2) { $match = "( $match ) & $emailfilter"; }
else { $match = $emailfilter; }
@ -327,6 +330,7 @@ class ModelSearchSearch extends Model {
'folders' => '',
'extra_folders' => '',
'id' => '',
'raw' => '',
'match' => array()
);
@ -351,15 +355,12 @@ class ModelSearchSearch extends Model {
else if($v == 'subject:') { $token = 'match'; $a['match'][] = '@subject'; continue; }
else if($v == 'body:') { $token = 'match'; $a['match'][] = '@body'; continue; }
else if($v == 'direction:' || $v == 'd:') { $token = 'direction'; continue; }
else if($v == 'size:') { $token = 'size'; continue; }
else if($v == 'date1:') { $token = 'date1'; continue; }
else if($v == 'date2:') { $token = 'date2'; continue; }
else if($v == 'attachment:' || $v == 'a:') { $token = 'match'; $a['match'][] = '@attachment_types'; continue; }
else if($v == 'size') { $token = 'size'; continue; }
else if($v == 'tag:') { $token = 'tag'; continue; }
else if($v == 'note:') { $token = 'note'; continue; }
else if($v == 'ref:') { $token = 'ref'; continue; }
else if($v == 'id:') { $token = 'id'; continue; }
else if(in_array($v, ['size:', 'date1:', 'date2:', 'tag:', 'note:', 'ref:', 'id:', 'raw:'])) {
$token = substr($v, 0, strlen($v)-1); continue;
}
else if($token != 'date1' && $token != 'date2') {
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v) || preg_match("/\d{1,2}\/\d{1,2}\/\d{4}/", $v)) {
$ndate++;
@ -368,12 +369,7 @@ class ModelSearchSearch extends Model {
}
if($token == 'match') { $a['match'][] = $v; }
else if($token == 'date1') { $a['date1'] = ' ' . $v; }
else if($token == 'date2') { $a['date2'] = ' ' . $v; }
else if($token == 'tag') { $a['tag'] .= ' ' . $v; }
else if($token == 'note') { $a['note'] .= ' ' . $v; }
else if($token == 'ref') { $a['ref'] = ' ' . $v; }
else if($token == 'id') { $a['id'] .= ' ' . $v; }
else if(in_array($token, ['date1', 'date2', 'ref', 'tag', 'note', 'id', 'raw'])) { $a[$token] .= ' ' . $v; }
else if($token == 'direction') {
if($v == 'inbound') { $a['direction'] = "0"; }