mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:37:02 +02:00
major rewrite of the web interface
This commit is contained in:
@ -7,7 +7,7 @@ class ControllerAuditAudit extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "audit/audit.tpl";
|
||||
$this->layout = "common/layout-search";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ControllerCommonLayoutHealth extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
|
||||
$this->data['title'] = $this->document->title;
|
||||
|
||||
$this->template = "common/layout-health.tpl";
|
||||
|
||||
|
||||
$this->children = array(
|
||||
"common/menu",
|
||||
"common/footer"
|
||||
);
|
||||
|
||||
$this->render();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ControllerCommonLayoutMinimal extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
|
||||
$this->data['title'] = $this->document->title;
|
||||
|
||||
$this->template = "common/layout-minimal.tpl";
|
||||
|
||||
|
||||
$this->children = array(
|
||||
"common/menu",
|
||||
"common/footer"
|
||||
);
|
||||
|
||||
$this->render();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
class ControllerCommonLayoutSearch extends Controller {
|
||||
class ControllerCommonLayoutNew extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
|
||||
$this->data['title'] = $this->document->title;
|
||||
|
||||
$this->template = "common/layout-search.tpl";
|
||||
$this->template = "common/layout-new.tpl";
|
||||
|
||||
$this->data['search_args'] = '';
|
||||
|
||||
@ -23,6 +23,8 @@ class ControllerCommonLayoutSearch extends Controller {
|
||||
|
||||
$this->children = array(
|
||||
"common/menu",
|
||||
"search/folder",
|
||||
"search/popup",
|
||||
"common/footer"
|
||||
);
|
||||
|
48
webui/controller/folder/folder.php
Normal file
48
webui/controller/folder/folder.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerFolderFolder extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "user/list.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$language = Registry::get('language');
|
||||
|
||||
$this->load->model('folder/folder');
|
||||
|
||||
|
||||
$this->data['term'] = '';
|
||||
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 2) { die("no data"); }
|
||||
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
$results = $this->model_folder_folder->get_folders_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
|
||||
foreach($results as $result) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $result['name'] . '" },';
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
|
||||
print $s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -7,7 +7,7 @@ class ControllerHealthHealth extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "health/health.tpl";
|
||||
$this->layout = "common/layout-health";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$this->load->model('health/health');
|
||||
|
||||
|
@ -18,6 +18,7 @@ class ControllerLoginLogin extends Controller {
|
||||
$this->load->model('user/auth');
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('user/prefs');
|
||||
$this->load->model('folder/folder');
|
||||
|
||||
$this->document->title = $this->data['text_login'];
|
||||
|
||||
@ -29,6 +30,11 @@ class ControllerLoginLogin extends Controller {
|
||||
|
||||
LOGGER('logged in');
|
||||
|
||||
if(isAdminUser() == 1) {
|
||||
header("Location: " . SITE_URL . "index.php?route=health/health");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($_POST['relocation']) && $_POST['relocation']) {
|
||||
header("Location: " . SITE_URL . $_POST['relocation']);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ class ControllerLoginLogout extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "login/logout.tpl";
|
||||
$this->layout = "common/layout-minimal";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$request = Registry::get('request');
|
||||
|
||||
|
@ -23,7 +23,7 @@ class ControllerMessageBulkrestore extends Controller {
|
||||
|
||||
if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); }
|
||||
|
||||
list($a, $idlist) = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));
|
||||
$idlist = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));
|
||||
|
||||
$download = $this->request->post['download'];
|
||||
|
||||
@ -55,10 +55,14 @@ class ControllerMessageBulkrestore extends Controller {
|
||||
array_push($rcpt, $_SESSION['email']);
|
||||
}
|
||||
|
||||
$x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt,
|
||||
"Received: by piler" . EOL . PILER_HEADER_FIELD . $id . EOL . $this->model_search_message->get_raw_message($id) );
|
||||
if(count($rcpt) > 0) {
|
||||
$piler_id = $this->model_search_message->get_piler_id_by_id($id);
|
||||
|
||||
if($x == 1) { $this->data['restored']++; }
|
||||
$x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt,
|
||||
"Received: by piler" . EOL . PILER_HEADER_FIELD . $id . EOL . $this->model_search_message->get_raw_message($piler_id) );
|
||||
|
||||
if($x == 1) { $this->data['restored']++; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,11 +20,11 @@ class ControllerMessageDownload extends Controller {
|
||||
$this->data['id'] = @$this->request->get['id'];
|
||||
|
||||
if(!verify_piler_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown piler id: ' . $this->data['id']);
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown id: ' . $this->data['id']);
|
||||
die("invalid id: " . $this->data['id']);
|
||||
}
|
||||
|
||||
if(!$this->model_search_search->check_your_permission_by_piler_id($this->data['id'])) {
|
||||
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
@ -32,13 +32,16 @@ class ControllerMessageDownload extends Controller {
|
||||
|
||||
AUDIT(ACTION_DOWNLOAD_MESSAGE, '', '', $this->data['id'], '');
|
||||
|
||||
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
|
||||
|
||||
header("Cache-Control: public, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=" . $this->data['id'] . ".eml");
|
||||
header("Content-Disposition: attachment; filename=" . $this->data['piler_id'] . ".eml");
|
||||
header("Content-Transfer-Encoding: binary\n");
|
||||
|
||||
print $this->model_search_message->get_raw_message($this->data['id']);
|
||||
|
||||
print $this->model_search_message->get_raw_message($this->data['piler_id']);
|
||||
exit;
|
||||
|
||||
$this->render();
|
||||
|
@ -22,18 +22,20 @@ class ControllerMessageHeaders extends Controller {
|
||||
$this->data['id'] = @$this->request->get['id'];
|
||||
|
||||
if(!verify_piler_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown piler id: ' . $this->data['id']);
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown id: ' . $this->data['id']);
|
||||
die("invalid id: " . $this->data['id']);
|
||||
}
|
||||
|
||||
if(!$this->model_search_search->check_your_permission_by_piler_id($this->data['id'])) {
|
||||
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
|
||||
AUDIT(ACTION_VIEW_HEADER, '', '', $this->data['id'], '');
|
||||
|
||||
$this->data['data'] = $this->model_search_message->get_message_headers($this->data['id']);
|
||||
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
|
||||
|
||||
$this->data['data'] = $this->model_search_message->get_message_headers($this->data['piler_id']);
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
30
webui/controller/message/note.php
Normal file
30
webui/controller/message/note.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerMessageNote extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "message/note.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('search/search');
|
||||
$this->load->model('search/message');
|
||||
|
||||
if(isset($this->request->post['note']) && isset($this->request->post['id'])) {
|
||||
|
||||
if($this->model_search_search->check_your_permission_by_id($this->request->post['id']) == 1) {
|
||||
$this->model_search_message->add_message_note($this->request->post['id'], $_SESSION['uid'], $this->request->post['note']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -27,7 +27,7 @@ class ControllerMessageRestore extends Controller {
|
||||
die("invalid id: " . $this->data['id']);
|
||||
}
|
||||
|
||||
if(!$this->model_search_search->check_your_permission_by_piler_id($this->data['id'])) {
|
||||
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
@ -42,16 +42,18 @@ class ControllerMessageRestore extends Controller {
|
||||
|
||||
/* send the email to all the recipients of the original email if we are admin or auditor users */
|
||||
|
||||
if(Registry::get('auditor_user') == 1) {
|
||||
if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
|
||||
$rcpt = $this->model_search_search->get_message_recipients($this->data['id']);
|
||||
|
||||
}
|
||||
else {
|
||||
array_push($rcpt, $_SESSION['email']);
|
||||
}
|
||||
|
||||
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
|
||||
|
||||
$x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt,
|
||||
"Received: by piler" . EOL . PILER_HEADER_FIELD . $this->data['id'] . EOL . $this->model_search_message->get_raw_message($this->data['id']) );
|
||||
"Received: by piler" . EOL . PILER_HEADER_FIELD . $this->data['id'] . EOL . $this->model_search_message->get_raw_message($this->data['piler_id']) );
|
||||
|
||||
if($x == 1) { $this->data['data'] = $this->data['text_restored']; }
|
||||
else { $this->data['data'] = $this->data['text_failed_to_restore']; }
|
||||
|
@ -30,11 +30,11 @@ class ControllerMessageView extends Controller {
|
||||
|
||||
|
||||
if(!verify_piler_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown piler id: ' . $this->data['id']);
|
||||
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown id: ' . $this->data['id']);
|
||||
die("invalid id: " . $this->data['id']);
|
||||
}
|
||||
|
||||
if(!$this->model_search_search->check_your_permission_by_piler_id($this->data['id'])) {
|
||||
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
|
||||
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
@ -57,9 +57,11 @@ class ControllerMessageView extends Controller {
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
|
||||
|
||||
$this->data['message'] = $this->model_search_message->extract_message($this->data['id']);
|
||||
$this->data['message'] = $this->model_search_message->extract_message($this->data['piler_id']);
|
||||
$this->data['message']['tag'] = $this->model_search_message->get_message_tag($this->data['id'], $_SESSION['uid']);
|
||||
$this->data['message']['note'] = $this->model_search_message->get_message_note($this->data['id'], $_SESSION['uid']);
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
24
webui/controller/search/folder.php
Normal file
24
webui/controller/search/folder.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerSearchFolder extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
$this->id = "folder";
|
||||
$this->template = "search/folder.tpl";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('folder/folder');
|
||||
|
||||
$this->data['folders'] = $this->model_folder_folder->get_folders_for_user();
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -4,14 +4,8 @@
|
||||
class ControllerSearchHelper extends Controller {
|
||||
private $error = array();
|
||||
private $a = array(
|
||||
'o_from' => '',
|
||||
'f_from' => '',
|
||||
'o_to' => '',
|
||||
'f_to' => '',
|
||||
'from' => '',
|
||||
'to' => '',
|
||||
'from_domain' => '',
|
||||
'to_domain' => '',
|
||||
'subject' => '',
|
||||
'body' => '',
|
||||
'date1' => '',
|
||||
@ -20,7 +14,9 @@ class ControllerSearchHelper extends Controller {
|
||||
'size' => '',
|
||||
'attachment_type' => '',
|
||||
'tag' => '',
|
||||
'note' => '',
|
||||
'ref' => '',
|
||||
'folders' => '',
|
||||
'any' => ''
|
||||
);
|
||||
|
||||
@ -49,27 +45,26 @@ class ControllerSearchHelper extends Controller {
|
||||
|
||||
$this->data['n'] = -1;
|
||||
|
||||
if($this->request->post['searchtype'] == 'advanced') {
|
||||
if($this->request->post['searchtype'] == 'expert'){
|
||||
|
||||
if(isset($this->request->post['search']) && preg_match("/(from|to|subject|body|direction|size|date1|date2|attachment|tagnote)\:/", $this->request->post['search'])) {
|
||||
$this->preprocess_post_expert_request($this->request->post);
|
||||
}
|
||||
else {
|
||||
$this->naive_preprocess_post_expert_request($this->request->post);
|
||||
}
|
||||
|
||||
$this->preprocess_post_advanced_request($this->request->post);
|
||||
$this->fixup_post_request();
|
||||
|
||||
list ($this->data['n'], $this->data['all_ids'], $this->data['messages']) = $this->model_search_search->search_messages($this->a, ADVANCED_SEARCH, $this->data['page']);
|
||||
}
|
||||
|
||||
else if($this->request->post['searchtype'] == 'expert'){
|
||||
|
||||
$this->preprocess_post_expert_request($this->request->post);
|
||||
$this->fixup_post_request();
|
||||
|
||||
list ($this->data['n'], $this->data['all_ids'], $this->data['messages']) = $this->model_search_search->search_messages($this->a, ADVANCED_SEARCH, $this->data['page']);
|
||||
list ($this->data['n'], $this->data['all_ids'], $this->data['messages']) = $this->model_search_search->search_messages($this->a, $this->data['page']);
|
||||
}
|
||||
|
||||
else {
|
||||
$this->fixup_post_simple_request();
|
||||
list ($this->data['n'], $this->data['all_ids'], $this->data['messages']) = $this->model_search_search->search_messages($this->request->post, SIMPLE_SEARCH, $this->data['page']);
|
||||
list ($this->data['n'], $this->data['all_ids'], $this->data['messages']) = $this->model_search_search->search_messages($this->request->post, $this->data['page']);
|
||||
}
|
||||
|
||||
|
||||
if($this->a['ref']) { $this->data['_ref'] = $this->a['ref']; }
|
||||
if(isset($this->request->post['ref']) && $this->request->post['ref']) { $this->data['_ref'] = $this->request->post['ref']; }
|
||||
|
||||
@ -97,24 +92,43 @@ class ControllerSearchHelper extends Controller {
|
||||
|
||||
|
||||
private function fixup_post_request() {
|
||||
$this->a['o_from'] = substr($this->a['o_from'], 1, strlen($this->a['o_from']));
|
||||
$this->a['f_from'] = substr($this->a['f_from'], 1, strlen($this->a['f_from']));
|
||||
$this->a['o_to'] = substr($this->a['o_to'], 1, strlen($this->a['o_to']));
|
||||
$this->a['f_to'] = substr($this->a['f_to'], 1, strlen($this->a['f_to']));
|
||||
$this->a['from'] = substr($this->a['from'], 1, strlen($this->a['from']));
|
||||
$this->a['to'] = substr($this->a['to'], 1, strlen($this->a['to']));
|
||||
$this->a['from_domain'] = substr($this->a['from_domain'], 1, strlen($this->a['from_domain']));
|
||||
$this->a['to_domain'] = substr($this->a['to_domain'], 1, strlen($this->a['to_domain']));
|
||||
|
||||
if(isset($this->request->post['ref'])) { $this->a['ref'] = $this->request->post['ref']; }
|
||||
if(isset($this->request->post['folders'])) { $this->a['folders'] = $this->request->post['folders']; }
|
||||
|
||||
$this->a['sort'] = $this->request->post['sort'];
|
||||
$this->a['order'] = $this->request->post['order'];
|
||||
}
|
||||
|
||||
|
||||
private function naive_preprocess_post_expert_request($data = array()) {
|
||||
$ndate = 0;
|
||||
|
||||
if(!isset($data['search'])) { return; }
|
||||
|
||||
$b = preg_split("/\s/", $data['search']);
|
||||
|
||||
while(list($k, $v) = each($b)) {
|
||||
if($v == '') { continue; }
|
||||
|
||||
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v)) {
|
||||
$ndate++;
|
||||
$this->a["date$ndate"] = $v;
|
||||
}
|
||||
else if(strchr($v, '@')) {
|
||||
$this->a['from'] .= " $v";
|
||||
}
|
||||
else { $this->a['any'] .= ' ' . $v; }
|
||||
}
|
||||
|
||||
if($this->a['date1'] && $this->a['date2'] == '') { $this->a['date2'] = $this->a['date1']; }
|
||||
|
||||
if($this->a['any'] == ' ' . $this->data['text_enter_search_terms']) { $this->a['any'] = ''; }
|
||||
}
|
||||
|
||||
|
||||
private function preprocess_post_expert_request($data = array()) {
|
||||
$token = '';
|
||||
$ndate = 0;
|
||||
|
||||
if(!isset($data['search'])) { return; }
|
||||
|
||||
@ -137,41 +151,37 @@ class ControllerSearchHelper extends Controller {
|
||||
else if($v == 'attachment:' || $v == 'a:') { $token = 'attachment_type'; 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 { $this->a['any'] .= ' ' . $v; }
|
||||
else {
|
||||
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v)) {
|
||||
$ndate++;
|
||||
$this->a["date$ndate"] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($token == 'from') {
|
||||
$v = fix_email_address($v);
|
||||
|
||||
if(substr($v, 0, 1) == '@') { $this->a['from_domain'] .= "|$v"; }
|
||||
else if(strstr($v, '@')) {
|
||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
||||
}
|
||||
else {
|
||||
$this->a['from'] .= " $v";
|
||||
}
|
||||
if($v == 'OR') { continue; }
|
||||
$this->a['from'] .= " $v";
|
||||
}
|
||||
|
||||
else if($token == 'to') {
|
||||
$v = fix_email_address($v);
|
||||
|
||||
if(substr($v, 0, 1) == '@') { $this->a['to_domain'] .= "|$v"; }
|
||||
else if(strstr($v, '@')) {
|
||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
||||
}
|
||||
else {
|
||||
$this->a['to'] .= " $v";
|
||||
}
|
||||
if($v == 'OR') { continue; }
|
||||
$this->a['to'] .= " $v";
|
||||
}
|
||||
|
||||
else if($token == 'subject') { $this->a['subject'] .= ' ' . $v; }
|
||||
else if($token == 'body') { $this->a['body'] .= ' ' . $v; }
|
||||
else if($token == 'date1') { $this->a['date1'] = ' ' . $v; }
|
||||
else if($token == 'date2') { $this->a['date2'] = ' ' . $v; }
|
||||
else if($token == 'attachment_type') { $this->a['attachment_type'] .= '|' . $v; }
|
||||
else if($token == 'tag') { $this->a['tag'] .= ' ' . $v; }
|
||||
else if($token == 'note') { $this->a['note'] .= ' ' . $v; }
|
||||
else if($token == 'ref') { $this->a['ref'] = ' ' . $v; }
|
||||
|
||||
else if($token == 'direction') {
|
||||
if($v == 'inbound') { $this->a['direction'] = 0; }
|
||||
if($v == 'inbound') { $this->a['direction'] = "0"; }
|
||||
else if($v == 'outbound') { $this->a['direction'] = 2; }
|
||||
else if($v == 'internal') { $this->a['direction'] = 1; }
|
||||
}
|
||||
@ -205,52 +215,6 @@ class ControllerSearchHelper extends Controller {
|
||||
}
|
||||
|
||||
|
||||
private function preprocess_post_advanced_request($data = array()) {
|
||||
|
||||
if(isset($data['f'])) {
|
||||
foreach($data['f'] as $f) {
|
||||
$v = array_shift($data['v']);
|
||||
|
||||
if($v == '') { continue; }
|
||||
|
||||
if($f == 'from') {
|
||||
$v = fix_email_address($v);
|
||||
|
||||
if(substr($v, 0, 1) == '@') { $this->a['from_domain'] .= "|$v"; }
|
||||
else if(strstr($v, '@')) {
|
||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
||||
}
|
||||
else {
|
||||
$this->a['from'] .= " $v";
|
||||
}
|
||||
}
|
||||
|
||||
if($f == 'to') {
|
||||
$v = fix_email_address($v);
|
||||
|
||||
if(substr($v, 0, 1) == '@') { $this->a['to_domain'] .= "|$v"; }
|
||||
else if(strstr($v, '@')) {
|
||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
||||
}
|
||||
else {
|
||||
$this->a['to'] .= " $v";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($f == 'subject') { $this->a['subject'] .= ' ' . $v; }
|
||||
if($f == 'body') { $this->a['body'] .= ' ' . $v; }
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['attachment_type'])) { $this->a['attachment_type'] = $data['attachment_type']; }
|
||||
if(isset($data['direction'])) { $this->a['direction'] = $data['direction']; }
|
||||
if(isset($data['tag'])) { $this->a['tag'] = $data['tag']; }
|
||||
if(isset($data['date1'])) { $this->a['date1'] = $data['date1']; }
|
||||
if(isset($data['date2'])) { $this->a['date2'] = $data['date2']; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
17
webui/controller/search/popup.php
Normal file
17
webui/controller/search/popup.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerSearchPopup extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
$this->id = "popup";
|
||||
$this->template = "search/popup.tpl";
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -7,31 +7,16 @@ class ControllerSearchSearch extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "search/search.tpl";
|
||||
$this->layout = "common/layout-search";
|
||||
$this->layout = "common/layout-new";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('search/search');
|
||||
|
||||
$this->document->title = $this->data['text_simple_search'];
|
||||
$this->document->title = $this->data['text_search'];
|
||||
|
||||
$this->data['searchtype'] = 'simple';
|
||||
|
||||
if(isset($this->request->get['type'])) {
|
||||
if($this->request->get['type'] == 'advanced') {
|
||||
$this->template = "search/advanced.tpl";
|
||||
$this->data['searchtype'] = 'advanced';
|
||||
$this->document->title = $this->data['text_advanced_search'];
|
||||
}
|
||||
|
||||
if($this->request->get['type'] == 'expert') {
|
||||
$this->template = "search/expert.tpl";
|
||||
$this->data['searchtype'] = 'expert';
|
||||
$this->document->title = $this->data['text_expert_search'];
|
||||
}
|
||||
|
||||
}
|
||||
$this->data['searchtype'] = 'expert';
|
||||
|
||||
if(isset($this->request->post['searchterm'])) {
|
||||
$this->fixup_post_request();
|
||||
@ -63,30 +48,6 @@ class ControllerSearchSearch extends Controller {
|
||||
if(isset($a['sort'])) { $this->data['sort'] = $a['sort']; }
|
||||
if(isset($a['order'])) { $this->data['order'] = $a['order']; }
|
||||
|
||||
if(isset($a['f'])) {
|
||||
foreach($a['f'] as $f) {
|
||||
$val = array_shift($a['v']);
|
||||
|
||||
if($val == '') { continue; }
|
||||
|
||||
if($i == 0) {
|
||||
$this->data['key0'] = 0;
|
||||
|
||||
if($f == 'from') { $this->data['key0'] = 0; }
|
||||
else if($f == 'to') { $this->data['key0'] = 1; }
|
||||
else if($f == 'subject') { $this->data['key0'] = 2; }
|
||||
else if($f == 'body') { $this->data['key0'] = 3; }
|
||||
|
||||
$this->data['val0'] = $val;
|
||||
}
|
||||
else {
|
||||
array_push($this->data['blocks'], array('key' => $f, 'val' => $val));
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($a['date1'])) { $this->data['date1'] = $a['date1']; }
|
||||
if(isset($a['date2'])) { $this->data['date2'] = $a['date2']; }
|
||||
|
||||
|
@ -19,11 +19,12 @@ class ControllerSearchTag extends Controller {
|
||||
|
||||
if(isset($this->request->post['tag']) && isset($this->request->post['idlist'])) {
|
||||
$idlist = explode(",", $this->request->post['idlist']);
|
||||
|
||||
if(count($idlist) > 0) {
|
||||
|
||||
$q = '';
|
||||
|
||||
list($ids, $a) = $this->model_search_search->check_your_permission_by_id_list($idlist);
|
||||
$ids = $this->model_search_search->check_your_permission_by_id_list($idlist);
|
||||
|
||||
for($i=0; $i<count($ids); $i++) { $q .= ",?"; }
|
||||
$q = preg_replace("/^\,/", "", $q);
|
||||
@ -31,10 +32,6 @@ class ControllerSearchTag extends Controller {
|
||||
$this->model_search_message->bulk_add_message_tag($ids, $_SESSION['uid'], $this->request->post['tag'], $q);
|
||||
}
|
||||
}
|
||||
|
||||
/*$this->data['message'] = 'I tagged this!';
|
||||
|
||||
$this->render();*/
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ class ControllerUserAdd extends Controller {
|
||||
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('group/group');
|
||||
$this->load->model('folder/folder');
|
||||
|
||||
$this->document->title = $this->data['text_add_new_user_alias'];
|
||||
|
||||
@ -61,6 +62,7 @@ class ControllerUserAdd extends Controller {
|
||||
else {
|
||||
$this->data['next_user_id'] = $this->model_user_user->get_next_uid();
|
||||
$this->data['groups'] = $this->model_group_group->get_groups();
|
||||
$this->data['folders'] = $this->model_folder_folder->get_folders();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -20,6 +20,7 @@ class ControllerUserEdit extends Controller {
|
||||
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('group/group');
|
||||
$this->load->model('folder/folder');
|
||||
|
||||
|
||||
$this->document->title = $language->get('text_edit_user');
|
||||
@ -74,6 +75,7 @@ class ControllerUserEdit extends Controller {
|
||||
|
||||
$this->data['user']['group_membership'] = $this->model_user_user->get_additional_uids($this->data['uid']);
|
||||
$this->data['user']['group'] = $this->model_group_group->get_groups_by_uid($this->data['uid']);
|
||||
$this->data['user']['folder'] = $this->model_folder_folder->get_folders_by_uid($this->data['uid']);
|
||||
|
||||
$this->data['emails'] = $this->model_user_user->get_emails($this->data['user']['username']);
|
||||
|
||||
|
@ -17,9 +17,7 @@ class ControllerUserSettings extends Controller {
|
||||
$this->load->model('user/auth');
|
||||
$this->load->model('user/prefs');
|
||||
|
||||
|
||||
$this->document->title = $this->data['text_home'];
|
||||
|
||||
$this->document->title = $this->data['text_settings'];
|
||||
|
||||
if(isset($this->request->post['pagelen']) && isset($this->request->post['lang']) && isset($this->request->post['theme'])) {
|
||||
$this->model_user_prefs->set_user_preferences(Registry::get('username'), $this->request->post);
|
||||
|
Reference in New Issue
Block a user