mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-26 07:10:12 +01:00
commit
9d52d89331
@ -69,6 +69,7 @@ struct _parse_rule config_parse_rules[] =
|
|||||||
{ "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)},
|
{ "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)},
|
||||||
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
|
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
|
||||||
{ "enable_cjk", "integer", (void*) int_parser, offsetof(struct __config, enable_cjk), "0", sizeof(int)},
|
{ "enable_cjk", "integer", (void*) int_parser, offsetof(struct __config, enable_cjk), "0", sizeof(int)},
|
||||||
|
{ "enable_folders", "integer", (void*) int_parser, offsetof(struct __config, enable_folders), "0", sizeof(int)},
|
||||||
{ "encrypt_messages", "integer", (void*) int_parser, offsetof(struct __config, encrypt_messages), "1", sizeof(int)},
|
{ "encrypt_messages", "integer", (void*) int_parser, offsetof(struct __config, encrypt_messages), "1", sizeof(int)},
|
||||||
{ "extra_to_field", "string", (void*) string_parser, offsetof(struct __config, extra_to_field), "", MAXVAL-1},
|
{ "extra_to_field", "string", (void*) string_parser, offsetof(struct __config, extra_to_field), "", MAXVAL-1},
|
||||||
{ "extract_attachments", "integer", (void*) int_parser, offsetof(struct __config, extract_attachments), "1", sizeof(int)},
|
{ "extract_attachments", "integer", (void*) int_parser, offsetof(struct __config, extract_attachments), "1", sizeof(int)},
|
||||||
|
@ -93,6 +93,8 @@ struct __config {
|
|||||||
|
|
||||||
int mmap_dedup_test;
|
int mmap_dedup_test;
|
||||||
|
|
||||||
|
int enable_folders;
|
||||||
|
|
||||||
int debug;
|
int debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.2.0-master"
|
#define VERSION "1.2.0-master"
|
||||||
|
|
||||||
#define BUILD 919
|
#define BUILD 921
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
@ -91,6 +91,7 @@
|
|||||||
#define SQL_CUSTOMER_TABLE "customer"
|
#define SQL_CUSTOMER_TABLE "customer"
|
||||||
#define SQL_IMPORT_TABLE "import"
|
#define SQL_IMPORT_TABLE "import"
|
||||||
#define SQL_LEGAL_HOLD_TABLE "legal_hold"
|
#define SQL_LEGAL_HOLD_TABLE "legal_hold"
|
||||||
|
#define SQL_FOLDER_MESSAGE_TABLE "folder_message"
|
||||||
#define SQL_MESSAGES_VIEW "v_messages"
|
#define SQL_MESSAGES_VIEW "v_messages"
|
||||||
#define SQL_ATTACHMENTS_VIEW "v_attachment"
|
#define SQL_ATTACHMENTS_VIEW "v_attachment"
|
||||||
|
|
||||||
@ -107,7 +108,7 @@
|
|||||||
#define SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE "INSERT INTO `" SQL_FOLDER_TABLE "` (`name`, `parent_id`) VALUES(?,?)"
|
#define SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE "INSERT INTO `" SQL_FOLDER_TABLE "` (`name`, `parent_id`) VALUES(?,?)"
|
||||||
#define SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE "UPDATE " SQL_METADATA_TABLE " SET reference=? WHERE message_id=? AND reference=''"
|
#define SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE "UPDATE " SQL_METADATA_TABLE " SET reference=? WHERE message_id=? AND reference=''"
|
||||||
#define SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS "SELECT id, type, username, password, server FROM " SQL_IMPORT_TABLE " WHERE started=0 ORDER BY id LIMIT 0,1"
|
#define SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS "SELECT id, type, username, password, server FROM " SQL_IMPORT_TABLE " WHERE started=0 ORDER BY id LIMIT 0,1"
|
||||||
|
#define SQL_PREPARED_STMT_INSERT_FOLDER_MESSAGE "INSERT INTO " SQL_FOLDER_MESSAGE_TABLE " (`folder_id`, `id`) VALUES(?,?)"
|
||||||
|
|
||||||
/* Error codes */
|
/* Error codes */
|
||||||
|
|
||||||
|
@ -315,6 +315,7 @@ struct __data {
|
|||||||
MYSQL_STMT *stmt_insert_into_sphinx_table;
|
MYSQL_STMT *stmt_insert_into_sphinx_table;
|
||||||
MYSQL_STMT *stmt_insert_into_meta_table;
|
MYSQL_STMT *stmt_insert_into_meta_table;
|
||||||
MYSQL_STMT *stmt_insert_into_attachment_table;
|
MYSQL_STMT *stmt_insert_into_attachment_table;
|
||||||
|
MYSQL_STMT *stmt_insert_into_folder_message_table;
|
||||||
MYSQL_STMT *stmt_get_attachment_id_by_signature;
|
MYSQL_STMT *stmt_get_attachment_id_by_signature;
|
||||||
MYSQL_STMT *stmt_get_attachment_pointer;
|
MYSQL_STMT *stmt_get_attachment_pointer;
|
||||||
MYSQL_STMT *stmt_query_attachment;
|
MYSQL_STMT *stmt_query_attachment;
|
||||||
|
@ -129,6 +129,23 @@ int store_recipients(struct session_data *sdata, struct __data *data, char *to,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int store_folder_id(struct session_data *sdata, struct __data *data, uint64 id, struct __config *cfg){
|
||||||
|
int rc = ERR;
|
||||||
|
|
||||||
|
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_folder_message_table), SQL_PREPARED_STMT_INSERT_FOLDER_MESSAGE, cfg) == ERR) return rc;
|
||||||
|
|
||||||
|
p_bind_init(data);
|
||||||
|
|
||||||
|
data->sql[data->pos] = (char *)&data->folder; data->type[data->pos] = TYPE_LONGLONG; data->pos++;
|
||||||
|
data->sql[data->pos] = (char *)&id; data->type[data->pos] = TYPE_LONGLONG; data->pos++;
|
||||||
|
|
||||||
|
if(p_exec_query(sdata, data->stmt_insert_into_folder_message_table, data) == OK) rc = OK;
|
||||||
|
close_prepared_statement(data->stmt_insert_into_folder_message_table);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int update_metadata_reference(struct session_data *sdata, struct _state *state, struct __data *data, char *ref, struct __config *cfg){
|
int update_metadata_reference(struct session_data *sdata, struct _state *state, struct __data *data, char *ref, struct __config *cfg){
|
||||||
int ret = ERR;
|
int ret = ERR;
|
||||||
|
|
||||||
@ -223,6 +240,11 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __d
|
|||||||
|
|
||||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored indexdata, rc=%d", sdata->ttmpfile, rc);
|
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored indexdata, rc=%d", sdata->ttmpfile, rc);
|
||||||
|
|
||||||
|
if(cfg->enable_folders == 1){
|
||||||
|
rc = store_folder_id(sdata, data, id, cfg);
|
||||||
|
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored folderdata, rc=%d", sdata->ttmpfile, rc);
|
||||||
|
}
|
||||||
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class ControllerFolderList extends Controller {
|
|||||||
$this->document->title = $this->data['text_folders'];
|
$this->document->title = $this->data['text_folders'];
|
||||||
|
|
||||||
if(isset($this->request->post['name']) && $this->request->post['name']) {
|
if(isset($this->request->post['name']) && $this->request->post['name']) {
|
||||||
$this->model_folder_folder->add_extra_folder($this->request->post['name']);
|
$this->model_folder_folder->add_folder($this->request->post['name']);
|
||||||
|
|
||||||
Header("Location: folders.php");
|
Header("Location: folders.php");
|
||||||
return;
|
return;
|
||||||
@ -27,7 +27,7 @@ class ControllerFolderList extends Controller {
|
|||||||
|
|
||||||
|
|
||||||
if(isset($this->request->get['id']) && $this->request->get['id'] > 0) {
|
if(isset($this->request->get['id']) && $this->request->get['id'] > 0) {
|
||||||
$this->model_folder_folder->remove_extra_folder($this->request->get['id']);
|
$this->model_folder_folder->remove_folder($this->request->get['id']);
|
||||||
|
|
||||||
Header("Location: folders.php");
|
Header("Location: folders.php");
|
||||||
return;
|
return;
|
||||||
@ -36,7 +36,7 @@ class ControllerFolderList extends Controller {
|
|||||||
|
|
||||||
$this->data['page_len'] = get_page_length();
|
$this->data['page_len'] = get_page_length();
|
||||||
|
|
||||||
$this->data['extra_folders'] = $this->model_folder_folder->get_extra_folders_for_user();
|
$this->data['extra_folders'] = $this->model_folder_folder->get_folders_for_user();
|
||||||
|
|
||||||
$this->render();
|
$this->render();
|
||||||
}
|
}
|
||||||
|
31
webui/controller/message/folder.php
Normal file
31
webui/controller/message/folder.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
class ControllerMessageFolder extends Controller {
|
||||||
|
private $error = array();
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
|
||||||
|
$this->id = "content";
|
||||||
|
$this->template = "message/note.tpl";
|
||||||
|
$this->layout = "common/layout-empty";
|
||||||
|
|
||||||
|
$session = Registry::get('session');
|
||||||
|
$request = Registry::get('request');
|
||||||
|
$db = Registry::get('db');
|
||||||
|
$sphx = Registry::get('sphx');
|
||||||
|
|
||||||
|
$this->load->model('search/search');
|
||||||
|
$this->load->model('folder/folder');
|
||||||
|
|
||||||
|
if(isset($this->request->post['folder_id']) && isset($this->request->post['id'])) {
|
||||||
|
|
||||||
|
if($this->model_search_search->check_your_permission_by_id($this->request->post['id']) == 1) {
|
||||||
|
$this->model_folder_folder->update_message_folder($this->request->post['id'], $this->request->post['folder_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -19,6 +19,10 @@ class ControllerMessageView extends Controller {
|
|||||||
|
|
||||||
$this->load->model('user/user');
|
$this->load->model('user/user');
|
||||||
|
|
||||||
|
if(ENABLE_FOLDER_RESTRICTIONS == 1) {
|
||||||
|
$this->load->model('folder/folder');
|
||||||
|
}
|
||||||
|
|
||||||
$this->document->title = $this->data['text_message'];
|
$this->document->title = $this->data['text_message'];
|
||||||
|
|
||||||
$this->data['id'] = '';
|
$this->data['id'] = '';
|
||||||
@ -83,6 +87,11 @@ class ControllerMessageView extends Controller {
|
|||||||
$this->data['can_download'] = $this->model_audit_audit->can_download();
|
$this->data['can_download'] = $this->model_audit_audit->can_download();
|
||||||
$this->data['can_restore'] = $this->model_audit_audit->can_restore();
|
$this->data['can_restore'] = $this->model_audit_audit->can_restore();
|
||||||
|
|
||||||
|
if(ENABLE_FOLDER_RESTRICTIONS == 1) {
|
||||||
|
$this->data['folders'] = $this->model_folder_folder->get_folders_for_user();
|
||||||
|
$this->data['folder_id'] = $this->model_folder_folder->get_folder_id_by_id($this->data['id']);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->data['attachments'] as $a) {
|
foreach($this->data['attachments'] as $a) {
|
||||||
if(preg_match("/image/", $a['type'])) {
|
if(preg_match("/image/", $a['type'])) {
|
||||||
$attachment = $this->model_search_message->get_attachment_by_id($a['id']);
|
$attachment = $this->model_search_message->get_attachment_by_id($a['id']);
|
||||||
|
@ -14,8 +14,8 @@ class ControllerSearchFolder extends Controller {
|
|||||||
|
|
||||||
$this->load->model('folder/folder');
|
$this->load->model('folder/folder');
|
||||||
|
|
||||||
$this->data['folders'] = $this->model_folder_folder->get_folders_for_user();
|
$this->data['extra_folders'] = $this->model_folder_folder->get_folders_for_user();
|
||||||
$this->data['extra_folders'] = $this->model_folder_folder->get_extra_folders_for_user();
|
array_unshift($this->data['extra_folders'], array('id' => 0, 'name' => '---'));
|
||||||
|
|
||||||
$this->data['folders_by_hier'] = $this->model_folder_folder->get_all_folder_ids_hier($session->get("uid"));
|
$this->data['folders_by_hier'] = $this->model_folder_folder->get_all_folder_ids_hier($session->get("uid"));
|
||||||
|
|
||||||
|
@ -61,7 +61,11 @@ class ModelFolderFolder extends Model {
|
|||||||
$q = str_repeat("?,", count($session->get("folders")));
|
$q = str_repeat("?,", count($session->get("folders")));
|
||||||
$q = preg_replace("/\,$/", "", $q);
|
$q = preg_replace("/\,$/", "", $q);
|
||||||
|
|
||||||
|
if(isAuditorUser() == 1) {
|
||||||
|
$query = $this->db->query("SELECT `id`, `name` FROM `" . TABLE_FOLDER);
|
||||||
|
} else {
|
||||||
$query = $this->db->query("SELECT `id`, `name` FROM `" . TABLE_FOLDER . "` WHERE id IN ($q)", $session->get("folders"));
|
$query = $this->db->query("SELECT `id`, `name` FROM `" . TABLE_FOLDER . "` WHERE id IN ($q)", $session->get("folders"));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($query->rows)) { return $query->rows; }
|
if(isset($query->rows)) { return $query->rows; }
|
||||||
|
|
||||||
@ -69,21 +73,12 @@ class ModelFolderFolder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_extra_folders_for_user() {
|
private function is_your_folder($folder_id = 0) {
|
||||||
$session = Registry::get('session');
|
$session = Registry::get('session');
|
||||||
|
|
||||||
$query = $this->db->query("SELECT `id`, `name` FROM `" . TABLE_FOLDER_EXTRA . "` WHERE uid=? ORDER BY name", array($session->get("uid")));
|
if(isAuditorUser() == 1) { return 1; }
|
||||||
|
|
||||||
if(isset($query->rows)) { return $query->rows; }
|
$query = $this->db->query("SELECT f.id AS id FROM `" . TABLE_FOLDER . "` f, " . TABLE_FOLDER_USER . "` fu WHERE f.id=fu.id AND fu.uid=? AND f.id=?", array($session->get("uid"), $folder_id));
|
||||||
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function is_your_extra_folder($folder_id = 0) {
|
|
||||||
$session = Registry::get('session');
|
|
||||||
|
|
||||||
$query = $this->db->query("SELECT `id` FROM `" . TABLE_FOLDER_EXTRA . "` WHERE uid=? AND id=?", array($session->get("uid"), $folder_id));
|
|
||||||
if(isset($query->row['id'])) { return 1; }
|
if(isset($query->row['id'])) { return 1; }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -91,17 +86,21 @@ class ModelFolderFolder extends Model {
|
|||||||
|
|
||||||
|
|
||||||
public function copy_message_to_folder_by_id($folder_id = 0, $meta_id = 0) {
|
public function copy_message_to_folder_by_id($folder_id = 0, $meta_id = 0) {
|
||||||
if(!$this->is_your_extra_folder($folder_id)) { return -1; }
|
if(!$this->is_your_folder($folder_id)) { return -1; }
|
||||||
|
|
||||||
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_MESSAGE . " (folder_id, id) VALUES(?,?)", array($folder_id, $meta_id));
|
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_MESSAGE . " (folder_id, id) VALUES(?,?)", array($folder_id, $meta_id));
|
||||||
return $this->db->countAffected();
|
return $this->db->countAffected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_all_folder_ids($uid = 0) {
|
public function get_folder_id_array_for_user($uid = 0, $is_admin = 0) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
||||||
|
if($is_admin == 2) {
|
||||||
|
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER);
|
||||||
|
} else {
|
||||||
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER_USER . "` WHERE uid=?", array($uid));
|
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER_USER . "` WHERE uid=?", array($uid));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($query->rows)) {
|
if(isset($query->rows)) {
|
||||||
foreach ($query->rows as $q) {
|
foreach ($query->rows as $q) {
|
||||||
@ -132,21 +131,6 @@ class ModelFolderFolder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_all_extra_folder_ids($uid = 0) {
|
|
||||||
$arr = array();
|
|
||||||
|
|
||||||
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER_EXTRA . "` WHERE uid=?", array($uid));
|
|
||||||
|
|
||||||
if(isset($query->rows)) {
|
|
||||||
foreach ($query->rows as $q) {
|
|
||||||
array_push($arr, $q['id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function get_sub_folders($id = 0, &$arr = array()) {
|
private function get_sub_folders($id = 0, &$arr = array()) {
|
||||||
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER . "` WHERE parent_id=?", array($id));
|
$query = $this->db->query("SELECT id FROM `" . TABLE_FOLDER . "` WHERE parent_id=?", array($id));
|
||||||
|
|
||||||
@ -203,32 +187,55 @@ class ModelFolderFolder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function add_extra_folder($name = '') {
|
public function get_folder_id_by_id($id = 0) {
|
||||||
|
$query = $this->db->query("SELECT folder_id FROM `" . TABLE_FOLDER_MESSAGE . "` WHERE id=?", array($id));
|
||||||
|
|
||||||
|
if(isset($query->row)) { return $query->row['folder_id']; }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update_message_folder($id = 0, $folder_id = 0) {
|
||||||
|
$query = $this->db->query("UPDATE `" . TABLE_FOLDER_MESSAGE . "` SET folder_id=? WHERE id=?", array($folder_id, $id));
|
||||||
|
|
||||||
|
//$query = $this->sphx->query("UPDATE " . SPHINX_MAIN_INDEX . " SET folder=? WHERE id=?", array($folder_id, $id));
|
||||||
|
$query = $this->sphx->query("UPDATE " . SPHINX_MAIN_INDEX . " SET folder=$folder_id WHERE id=$id");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function add_folder($name = '') {
|
||||||
if($name == '') { return -1; }
|
if($name == '') { return -1; }
|
||||||
|
|
||||||
$session = Registry::get('session');
|
$session = Registry::get('session');
|
||||||
|
|
||||||
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_EXTRA . " (uid, name) VALUES(?,?)", array($session->get("uid"), $name));
|
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER . " (name) VALUES(?)", array($name));
|
||||||
|
|
||||||
|
if(isAuditorUser() == 0) {
|
||||||
$last_id = $this->db->getLastId();
|
$last_id = $this->db->getLastId();
|
||||||
|
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_USER . " (id, uid) VALUES(?,?)", array($last_id, $session->get("uid")));
|
||||||
|
|
||||||
$extra_folders = $session->get("extra_folders");
|
$folders = $session->get("folders");
|
||||||
|
if(!isset($folders[$last_id])) { array_push($folders, $last_id); $session->set("folders", $folders); }
|
||||||
if(!isset($extra_folders[$last_id])) { array_push($extra_folders, $last_id); }
|
}
|
||||||
|
|
||||||
return $this->db->countAffected();
|
return $this->db->countAffected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function remove_extra_folder($id = 0) {
|
public function remove_folder($id = 0) {
|
||||||
if($id == 0) { return -1; }
|
if($id <= 0) { return -1; }
|
||||||
|
|
||||||
$session = Registry::get('session');
|
$session = Registry::get('session');
|
||||||
|
|
||||||
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER_EXTRA . " WHERE id=? AND uid=?", array($id, $session->get("uid")));
|
if($this->is_your_folder($id) == 1) {
|
||||||
if($this->db->countAffected() == 1) {
|
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER . " WHERE id=?", array($id));
|
||||||
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER_MESSAGE . " WHERE folder_id=?", array($id));
|
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER_USER . " WHERE id=? AND uid=?", array($id, $session->get("uid")));
|
||||||
return $this->db->countAffected();
|
|
||||||
|
$folders = $session->get("folders");
|
||||||
|
if(isset($folders[$id])) { unset($folders[$id]); $session->set("folders", $folders); }
|
||||||
|
|
||||||
|
// shall we delete the existing message - folder id assignments from folder_message?
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -223,9 +223,10 @@ class ModelSearchSearch extends Model {
|
|||||||
list ($total_found, $num_rows, $id_list) = $this->get_sphinx_id_list($data['note'], SPHINX_NOTE_INDEX, 'note', $page);
|
list ($total_found, $num_rows, $id_list) = $this->get_sphinx_id_list($data['note'], SPHINX_NOTE_INDEX, 'note', $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);
|
$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);
|
||||||
}
|
}
|
||||||
else if(ENABLE_FOLDER_RESTRICTIONS == 1 && isset($data['extra_folders']) && $data['extra_folders']) {
|
else if(ENABLE_FOLDER_RESTRICTIONS == 1 && isset($data['extra_folders']) && strlen($data['extra_folders']) > 0) {
|
||||||
list ($total_found, $num_rows, $ids_in_extra_folders) = $this->get_sphinx_id_list_by_extra_folders($data['extra_folders'], $page);
|
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $a $id $date $attachment $direction $size folder IN (" . preg_replace("/ /", ",", $data['extra_folders']) . ") AND MATCH('$match') $sortorder LIMIT $offset,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $a $id $date $attachment $direction $size MATCH('$match') AND id IN ($ids_in_extra_folders) $sortorder LIMIT 0,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
$total_found = $query->total_found;
|
||||||
|
$num_rows = $query->num_rows;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $a $id $date $attachment $direction $size $folders MATCH('$match') $sortorder LIMIT $offset,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $a $id $date $attachment $direction $size $folders MATCH('$match') $sortorder LIMIT $offset,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||||
|
@ -16,7 +16,6 @@ class ModelUserAuth extends Model {
|
|||||||
$session->set("emails", $data['emails']);
|
$session->set("emails", $data['emails']);
|
||||||
|
|
||||||
$session->set("folders", $data['folders']);
|
$session->set("folders", $data['folders']);
|
||||||
$session->set("extra_folders", $data['extra_folders']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ class ModelUserAuth extends Model {
|
|||||||
$data['auditdomains'] = array();
|
$data['auditdomains'] = array();
|
||||||
$data['emails'] = array();
|
$data['emails'] = array();
|
||||||
$data['folders'] = array();
|
$data['folders'] = array();
|
||||||
$data['extra_folders'] = array();
|
|
||||||
|
|
||||||
if($username == '' || $password == '') { return 0; }
|
if($username == '' || $password == '') { return 0; }
|
||||||
|
|
||||||
@ -114,8 +112,7 @@ class ModelUserAuth extends Model {
|
|||||||
$extra_emails = $this->model_user_user->get_email_addresses_from_groups($data['emails']);
|
$extra_emails = $this->model_user_user->get_email_addresses_from_groups($data['emails']);
|
||||||
$data['emails'] = array_merge($data['emails'], $extra_emails);
|
$data['emails'] = array_merge($data['emails'], $extra_emails);
|
||||||
|
|
||||||
$data['folders'] = $this->model_folder_folder->get_all_folder_ids($query->row['uid']);
|
$data['folders'] = $this->model_folder_folder->get_folder_id_array_for_user($query->row['uid'], $data['admin_user']);
|
||||||
$data['extra_folders'] = $this->model_folder_folder->get_all_extra_folder_ids($query->row['uid']);
|
|
||||||
|
|
||||||
$session->set("auth_data", $data);
|
$session->set("auth_data", $data);
|
||||||
|
|
||||||
@ -323,7 +320,6 @@ class ModelUserAuth extends Model {
|
|||||||
$data['auditdomains'] = $this->model_domain_domain->get_your_all_domains_by_email($email);
|
$data['auditdomains'] = $this->model_domain_domain->get_your_all_domains_by_email($email);
|
||||||
$data['emails'] = $emails;
|
$data['emails'] = $emails;
|
||||||
$data['folders'] = array();
|
$data['folders'] = array();
|
||||||
$data['extra_folders'] = array();
|
|
||||||
|
|
||||||
$uid = $this->model_user_user->get_uid_by_email($email);
|
$uid = $this->model_user_user->get_uid_by_email($email);
|
||||||
if($uid < 1) {
|
if($uid < 1) {
|
||||||
|
@ -41,8 +41,7 @@ class ModelUserGoogle extends Model {
|
|||||||
$session->set("realname", $query->row['realname']);
|
$session->set("realname", $query->row['realname']);
|
||||||
|
|
||||||
$session->set("emails", $this->model_user_user->get_users_all_email_addresses($user['uid']));
|
$session->set("emails", $this->model_user_user->get_users_all_email_addresses($user['uid']));
|
||||||
$session->set("folders", $this->model_folder_folder->get_all_folder_ids($user['uid']));
|
$session->set("folders", $this->model_folder_folder->get_folder_id_array_for_user($user['uid']));
|
||||||
$session->set("extra_folders", $this->model_folder_folder->get_all_extra_folder_ids($user['uid']));
|
|
||||||
|
|
||||||
AUDIT(ACTION_LOGIN, $user['username'], '', '', 'successful auth against Google');
|
AUDIT(ACTION_LOGIN, $user['username'], '', '', 'successful auth against Google');
|
||||||
|
|
||||||
|
@ -425,6 +425,23 @@ var Piler =
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
update_message_folder:function(id, msg)
|
||||||
|
{
|
||||||
|
Piler.log("[update_message_folder]", id, msg);
|
||||||
|
|
||||||
|
Piler.poor_mans_keepalive_for_dummy_browsers();
|
||||||
|
|
||||||
|
jQuery.ajax('index.php?route=message/folder', {
|
||||||
|
data: { id: id, folder_id: $('#folder_id').val() },
|
||||||
|
type: "POST"
|
||||||
|
})
|
||||||
|
.done( function(a) {})
|
||||||
|
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
|
||||||
|
|
||||||
|
Piler.show_message('messagebox1', msg, 0.85);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
tag_search_results:function(msg)
|
tag_search_results:function(msg)
|
||||||
{
|
{
|
||||||
Piler.log("[tag_search_results]", msg);
|
Piler.log("[tag_search_results]", msg);
|
||||||
|
@ -1658,6 +1658,7 @@ html,body{height:auto !important;height:100%;min-height:100%;}
|
|||||||
#popupx{position:absolute;right:10px;top:5px;margin:10px;cursor:pointer;}
|
#popupx{position:absolute;right:10px;top:5px;margin:10px;cursor:pointer;}
|
||||||
#restorebox{position:absolute;top:40px;left:15%;display:none;font-weight:bold;padding:15px;z-index:1;}
|
#restorebox{position:absolute;top:40px;left:15%;display:none;font-weight:bold;padding:15px;z-index:1;}
|
||||||
#notesbox{position:absolute;top:8px;right:8px;}
|
#notesbox{position:absolute;top:8px;right:8px;}
|
||||||
|
#folderbox{position:absolute;top:8px;right:380px;}
|
||||||
#sspinner{display:none;}
|
#sspinner{display:none;}
|
||||||
.message_highlight{background:lightblue;}
|
.message_highlight{background:lightblue;}
|
||||||
#searchcontainer{text-align:center;min-width:320px;}
|
#searchcontainer{text-align:center;min-width:320px;}
|
||||||
@ -1669,7 +1670,7 @@ html,body{height:auto !important;height:100%;min-height:100%;}
|
|||||||
#searchcontainer #button_search,#searchcontainer #button_options{width:30%;}
|
#searchcontainer #button_search,#searchcontainer #button_options{width:30%;}
|
||||||
#mainscreen{position:absolute;top:120px;right:20px;bottom:20px;left:20px;min-width:320px;z-index:0;}
|
#mainscreen{position:absolute;top:120px;right:20px;bottom:20px;left:20px;min-width:320px;z-index:0;}
|
||||||
#mailleftcontainer{position:absolute;top:0;left:0;bottom:0;width:195px;}
|
#mailleftcontainer{position:absolute;top:0;left:0;bottom:0;width:195px;}
|
||||||
#mailboxlist-container{position:absolute;top:0;left:0;width:100%;bottom:0;border:1px solid #999999;border-top:none;background-color:#f9f9f9;overflow:hidden;}
|
#mailboxlist-container{position:absolute;top:0;left:0;width:100%;bottom:0;border:1px solid #999999;border-top:none;background-color:#f9f9f9;overflow:auto;}
|
||||||
.boxlistcontent{position:absolute;top:0px;bottom:34px;left:0;right:0;width:100%;overflow-y:auto;overflow-x:hidden;height:auto;}
|
.boxlistcontent{position:absolute;top:0px;bottom:34px;left:0;right:0;width:100%;overflow-y:auto;overflow-x:hidden;height:auto;}
|
||||||
.boxfooter{position:absolute;bottom:0px;left:0px;right:0px;overflow:hidden;height:33px;border-top:1px solid #ccc;background-color:#f6f6f6;min-width:320px;}
|
.boxfooter{position:absolute;bottom:0px;left:0px;right:0px;overflow:hidden;height:33px;border-top:1px solid #ccc;background-color:#f6f6f6;min-width:320px;}
|
||||||
#mailboxlist{position:relative;height:auto;margin:0px;padding:0px;list-style-image:none;list-style-type:none;overflow:hidden;white-space:nowrap;background-color:#FFF;}
|
#mailboxlist{position:relative;height:auto;margin:0px;padding:0px;list-style-image:none;list-style-type:none;overflow:hidden;white-space:nowrap;background-color:#FFF;}
|
||||||
@ -1730,4 +1731,6 @@ body#loginpage{background-color:#fcfcfc;padding-top:40px;padding-bottom:40px;}
|
|||||||
.control-group.success .fileupload .fileupload-preview{color:#468847;}
|
.control-group.success .fileupload .fileupload-preview{color:#468847;}
|
||||||
.control-group.success .fileupload .thumbnail{border-color:#468847;}
|
.control-group.success .fileupload .thumbnail{border-color:#468847;}
|
||||||
.bottomborder { border-bottom: 1px solid black; }
|
.bottomborder { border-bottom: 1px solid black; }
|
||||||
|
.folderlabel{display: block; padding-left: 35px; text-indent: -15px;}
|
||||||
|
.foldercheckbox{vertical-align: center; position: relative; top: -1px; margin:0; padding: 0; height: 13px; width: 13px;}
|
||||||
@media (min-width:980px){body{padding-top:65px;}}@media (max-width:980px){.navbar-fixed-top{margin-bottom:10px;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{font-weight:normal;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} .nav-collapse .nav>li>a:hover,.nav-collapse ul.nav li.dropdown ul.dropdown-menu li a:hover{color:#fff;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:#555555;} .navbar .nav li.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;} .dropdown-menu li>a:hover{background-color:#00f;}}@media (max-width:767px){#mainscreen{top:162px;} #pagingrow{border-bottom:1px solid #ccc;} #pagingbox{border-right:none;} #functionbox{border-left:none;} .boxlistcontent{bottom:68px;overflow:scroll;} .boxfooter{height:67px;}}
|
@media (min-width:980px){body{padding-top:65px;}}@media (max-width:980px){.navbar-fixed-top{margin-bottom:10px;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{font-weight:normal;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} .nav-collapse .nav>li>a:hover,.nav-collapse ul.nav li.dropdown ul.dropdown-menu li a:hover{color:#fff;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:#555555;} .navbar .nav li.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;} .dropdown-menu li>a:hover{background-color:#00f;}}@media (max-width:767px){#mainscreen{top:162px;} #pagingrow{border-bottom:1px solid #ccc;} #pagingbox{border-right:none;} #functionbox{border-left:none;} .boxlistcontent{bottom:68px;overflow:scroll;} .boxfooter{height:67px;}}
|
||||||
|
@ -43,6 +43,18 @@
|
|||||||
<input type="button" class="btn btn-info" value="<?php print $text_save; ?>" class="message_button" onclick="Piler.add_note_to_message(<?php print $id; ?>, '<?php print $text_saved; ?>'); " />
|
<input type="button" class="btn btn-info" value="<?php print $text_save; ?>" class="message_button" onclick="Piler.add_note_to_message(<?php print $id; ?>, '<?php print $text_saved; ?>'); " />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if(ENABLE_FOLDER_RESTRICTIONS == 1) { ?>
|
||||||
|
<div id="folderbox" class="input-prepend input-append">
|
||||||
|
<span class="add-on"><i class="icon-folder-open-alt icon-large"></i> <?php print $text_folder; ?>:</span>
|
||||||
|
<select name="folder_id" id="folder_id" class="span2">
|
||||||
|
<option value="0" <?php if($folder_id == 0) { ?>selected="selected"<?php } ?>>---</option>
|
||||||
|
<?php foreach ($folders as $folder) { ?>
|
||||||
|
<option value="<?php print $folder['id']; ?>" <?php if($folder_id == $folder['id']) { ?>selected="selected"<?php } ?>><?php print $folder['name']; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<input type="button" class="btn btn-info" value="<?php print $text_save; ?>" class="message_button" onclick="Piler.update_message_folder(<?php print $id; ?>, '<?php print $text_saved; ?>'); " />
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div id="messageblock">
|
<div id="messageblock">
|
||||||
|
|
||||||
|
@ -2,17 +2,12 @@
|
|||||||
|
|
||||||
<div id="folders">
|
<div id="folders">
|
||||||
|
|
||||||
|
|
||||||
<?php foreach ($extra_folders as $folder) { ?>
|
<?php foreach ($extra_folders as $folder) { ?>
|
||||||
<blockquote class="folder">
|
<div>
|
||||||
<form class="form-search sleek">
|
<label class="folderlabel"><input type="checkbox" id="extra_folder_<?php print $folder['id']; ?>" name="extra_folder_<?php print $folder['id']; ?>" style="margin:0;" class="foldercheckbox" /> <?php print $folder['name']; ?></label>
|
||||||
<img src="<?php print ICON_EMPTY; ?>" width="12" height="12" alt="" /> <input type="checkbox" id="extra_folder_<?php print $folder['id']; ?>" name="extra_folder_<?php print $folder['id']; ?>" /> <input type="text" ondrop="Piler.copy_message_to_folder('<?php print $folder['id']; ?>', Piler.current_message_id, '<?php print $text_copied; ?>'); return false;" class="input-small bold" style="color: #850505; border:none; background: transparent; " value="<?php print $folder['name']; ?>" />
|
</div>
|
||||||
</form>
|
|
||||||
</blockquote>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function display_folders($arr = array(), &$i) {
|
function display_folders($arr = array(), &$i) {
|
||||||
@ -43,7 +38,7 @@ function display_folders($arr = array(), &$i) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
display_folders($folders_by_hier, $i);
|
//display_folders($folders_by_hier, $i);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user