major rewrite of the web interface

This commit is contained in:
SJ
2012-09-06 15:27:20 +02:00
parent e3bd0b987a
commit 853c4ab4f1
88 changed files with 1707 additions and 3839 deletions

View File

@ -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']++; }
}
}

View File

@ -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();

View File

@ -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();
}

View 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']);
}
}
}
}
?>

View File

@ -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']; }

View File

@ -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();
}