added a select option to auditors to define the recipients of the message to be restored

This commit is contained in:
SJ
2012-12-20 14:11:17 +01:00
parent cc55883b35
commit a079c915c6
13 changed files with 123 additions and 28 deletions

View File

@ -46,7 +46,7 @@ class ControllerMessageBulkrestore extends Controller {
$rcpt = array();
/* send the email to all the recipients of the original email if we are admin or auditor users */
/* send the email to all the recipients of the original email if you are an auditor user */
if(Registry::get('auditor_user') == 1) {
$rcpt = $this->model_search_search->get_message_recipients($id);

View File

@ -33,6 +33,8 @@ class ControllerMessageHeaders extends Controller {
AUDIT(ACTION_VIEW_HEADER, '', '', $this->data['id'], '');
if(Registry::get('auditor_user') == 1) { $this->data['rcpt'] = $this->model_search_search->get_message_addresses_in_my_domain($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']);

View File

@ -22,6 +22,14 @@ class ControllerMessageRestore extends Controller {
$this->data['id'] = @$this->request->get['id'];
$rcpt = array();
if(Registry::get('auditor_user') == 1) {
$this->data['id'] = @$this->request->post['id'];
$rcpt = preg_split("/\s/", $this->request->post['rcpt']);
}
if(!verify_piler_id($this->data['id'])) {
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown piler id: ' . $this->data['id']);
die("invalid id: " . $this->data['id']);
@ -37,26 +45,24 @@ class ControllerMessageRestore extends Controller {
$this->data['username'] = Registry::get('username');
$rcpt = array();
/* send the email to all the recipients of the original email if we are admin or auditor users */
if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
$rcpt = $this->model_search_search->get_message_recipients($this->data['id']);
}
else {
if(Registry::get('auditor_user') == 0) {
array_push($rcpt, $_SESSION['email']);
}
$this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
$this->data['data'] = $this->data['text_failed_to_restore'];
$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['piler_id']) );
if(count($rcpt) > 0) {
if($x == 1) { $this->data['data'] = $this->data['text_restored']; }
else { $this->data['data'] = $this->data['text_failed_to_restore']; }
$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['piler_id']) );
if($x == 1) { $this->data['data'] = $this->data['text_restored']; }
}
$this->render();
}

View File

@ -21,8 +21,9 @@ class ControllerMessageView extends Controller {
$this->document->title = $this->data['text_message'];
$this->data['id'] = '';
$this->data['rcpt'] = array();
if(isset($_SERVER['REQUEST_URI'])) { $this->data['id'] = preg_replace("/\/message.php\//", "", $_SERVER['REQUEST_URI']); }
if(isset($_SERVER['REQUEST_URI'])) { $a = preg_split("/\//", $_SERVER['REQUEST_URI']); $this->data['id'] = $a[count($a)-1]; }
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$this->data['id'] = $this->request->post['id'];
@ -44,6 +45,8 @@ class ControllerMessageView extends Controller {
$this->data['username'] = Registry::get('username');
if(Registry::get('auditor_user') == 1) { $this->data['rcpt'] = $this->model_search_search->get_message_addresses_in_my_domain($this->data['id']); }
/* fix username if we are admin */
if(isset($this->request->get['user']) && strlen($this->request->get['user']) > 1 && (Registry::get('admin_user') == 1 || $this->model_user_user->isUserInMyDomain($this->request->get['user']) == 1) ) {