mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 01:31:58 +01:00
folder fixed for the gui
Change-Id: Ibd358671616d68a92205b6c6afbd9f2195fca9bd
This commit is contained in:
parent
eca0fd7280
commit
40fbd59173
@ -214,6 +214,7 @@ $config['SPHINX_MAIN_INDEX'] = 'main1,dailydelta1,delta1';
|
||||
$config['SPHINX_ATTACHMENT_INDEX'] = 'att1';
|
||||
$config['SPHINX_TAG_INDEX'] = 'tag1';
|
||||
$config['SPHINX_NOTE_INDEX'] = 'note1';
|
||||
$config['SPHINX_FOLDER_INDEX'] = 'folder1';
|
||||
|
||||
$config['RELOAD_COMMAND'] = 'sudo -n /etc/init.d/rc.piler reload';
|
||||
$config['PILERIMPORT_IMAP_COMMAND'] = '/usr/local/bin/pilerimport -d /var/piler/imap -q -r';
|
||||
@ -346,7 +347,7 @@ define('TABLE_GROUP_USER', 'group_user');
|
||||
define('TABLE_GROUP_EMAIL', 'group_email');
|
||||
define('TABLE_FOLDER', 'folder');
|
||||
define('TABLE_FOLDER_USER', 'folder_user');
|
||||
define('TABLE_FOLDER_EXTRA', 'folder_extra');
|
||||
define('TABLE_FOLDER_EMAIL', 'folder_email');
|
||||
define('TABLE_FOLDER_MESSAGE', 'folder_message');
|
||||
define('TABLE_EMAIL', 'email');
|
||||
define('TABLE_META', 'metadata');
|
||||
|
@ -45,7 +45,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|aname|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|aname|tag|note|id|folder)\:/", $this->request->post['search'])) {
|
||||
$this->a = $this->model_search_search->preprocess_post_expert_request($this->request->post);
|
||||
}
|
||||
else {
|
||||
|
@ -93,6 +93,21 @@ class ModelFolderFolder extends Model {
|
||||
}
|
||||
|
||||
|
||||
public function get_folder_names_for_user($email='') {
|
||||
$arr = array();
|
||||
|
||||
$query = $this->db->query("SELECT folder_id, name FROM `" . TABLE_FOLDER . "` WHERE uid IN (SELECT uid FROM `" . TABLE_FOLDER_EMAIL . "` WHERE email=?)", array($email));
|
||||
|
||||
if(isset($query->rows)) {
|
||||
foreach ($query->rows as $q) {
|
||||
$arr[$q['name']] = $q['folder_id'];
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
public function get_folder_id_array_for_user($uid = 0, $is_admin = 0) {
|
||||
$arr = array();
|
||||
|
||||
|
@ -106,7 +106,6 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
$session = Registry::get('session');
|
||||
|
||||
|
||||
$i = 0;
|
||||
while(list($k, $v) = each($data['match'])) {
|
||||
if($v == "@attachment_types") {
|
||||
@ -215,6 +214,19 @@ class ModelSearchSearch extends Model {
|
||||
$total_found = $query->total_found;
|
||||
$num_rows = $query->num_rows;
|
||||
}
|
||||
else if(isset($data['folder']) && $data['folder']) {
|
||||
$folder_id = 0;
|
||||
|
||||
$folders = $session->get("folders");
|
||||
|
||||
$data['folder'] = trim($data['folder']);
|
||||
|
||||
if(isset($folders[$data['folder']])) {
|
||||
$folder_id = $folders[$data['folder']];
|
||||
}
|
||||
|
||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_FOLDER_INDEX . " WHERE folder_id=$folder_id LIMIT 0,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||
}
|
||||
else if(isset($data['tag']) && $data['tag']) {
|
||||
list ($total_found, $num_rows, $id_list) = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag', $page);
|
||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $folders id IN ($id_list) $sortorder LIMIT 0,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||
@ -332,6 +344,7 @@ class ModelSearchSearch extends Model {
|
||||
'folders' => '',
|
||||
'extra_folders' => '',
|
||||
'id' => '',
|
||||
'folder' => '',
|
||||
'match' => array()
|
||||
);
|
||||
|
||||
@ -366,6 +379,7 @@ class ModelSearchSearch extends Model {
|
||||
else if($v == 'note:') { $token = 'note'; continue; }
|
||||
else if($v == 'ref:') { $token = 'ref'; continue; }
|
||||
else if($v == 'id:') { $token = 'id'; continue; }
|
||||
else if($v == 'folder:') { $token = 'folder'; 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++;
|
||||
@ -387,6 +401,7 @@ class ModelSearchSearch extends Model {
|
||||
else if($token == 'note') { $a['note'] .= ' ' . $v; }
|
||||
else if($token == 'ref') { $a['ref'] = ' ' . $v; }
|
||||
else if($token == 'id') { $a['id'] .= ' ' . $v; }
|
||||
else if($token == 'folder') { $a['folder'] .= ' ' . $v; }
|
||||
|
||||
else if($token == 'direction') {
|
||||
if($v == 'inbound') { $a['direction'] = "0"; }
|
||||
|
@ -124,7 +124,8 @@ class ModelUserAuth extends Model {
|
||||
$extra_emails = $this->model_user_user->get_email_addresses_from_groups($data['emails']);
|
||||
$data['emails'] = array_merge($data['emails'], $extra_emails);
|
||||
|
||||
$data['folders'] = $this->model_folder_folder->get_folder_id_array_for_user($query->row['uid'], $data['admin_user']);
|
||||
//$data['folders'] = $this->model_folder_folder->get_folder_id_array_for_user($query->row['uid'], $data['admin_user']);
|
||||
$data['folders'] = $this->model_folder_folder->get_folder_names_for_user($data['email']);
|
||||
|
||||
$session->set("auth_data", $data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user