예제 #1
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/headers.tpl";
     $this->layout = "common/layout-empty";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = @$this->request->get['id'];
     $messageid = 0;
     if (!verify_piler_id($this->data['id'])) {
         AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown id: ' . $this->data['id']);
         die("invalid id: " . $this->data['id']);
     }
     $this->data['attachment'] = $this->model_search_message->get_attachment_by_id($this->data['id']);
     if (!isset($this->data['attachment']['filename'])) {
         die("invalid filename");
     }
     $messageid = $this->model_search_message->get_id_by_piler_id($this->data['attachment']['piler_id']);
     AUDIT(ACTION_DOWNLOAD_ATTACHMENT, '', '', $messageid, $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['attachment']['filename'] . "\"");
     header("Content-Transfer-Encoding: binary\n");
     print $this->data['attachment']['attachment'];
     exit;
 }
예제 #2
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/headers.tpl";
     $this->layout = "common/layout-empty";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->load->model('message/zip');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = @$this->request->get['id'];
     if (!verify_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_id($this->data['id'])) {
         AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
         die("no permission for " . $this->data['id']);
     }
     $this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
     //AUDIT(ACTION_DOWNLOAD_ATTACHMENT, '', '', $messageid, $this->data['id']);
     $this->model_message_zip->download_attachments_as_zip($this->data['piler_id']);
     exit;
 }
예제 #3
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/journal.tpl";
     $this->layout = "common/layout-empty";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->load->model('user/user');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = @$this->request->get['id'];
     if (!verify_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_id($this->data['id'])) {
         AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
         die("no permission for " . $this->data['id']);
     }
     AUDIT(ACTION_VIEW_JOURNAL, '', '', $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_journal($this->data['piler_id']);
     $this->render();
 }
예제 #4
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/headers.tpl";
     $this->layout = "common/layout-empty";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = @$this->request->get['id'];
     if (!verify_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_id($this->data['id'])) {
         AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
         die("no permission for " . $this->data['id']);
     }
     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['piler_id'] . ".eml");
     header("Content-Transfer-Encoding: binary\n");
     $this->model_search_message->connect_to_pilergetd();
     $msg = $this->model_search_message->get_raw_message($this->data['piler_id']);
     $this->model_search_message->disconnect_from_pilergetd();
     $this->model_search_message->remove_journal($msg);
     print $msg;
 }
예제 #5
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/headers.tpl";
     $this->layout = "common/layout-empty";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->load->model('user/user');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = $this->request->post['id'];
     if (!verify_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_id($this->data['id'])) {
         AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
         die("no permission for " . $this->data['id']);
     }
     AUDIT(ACTION_NOT_SPAM, '', '', $this->data['id'], '');
     if (DEFAULT_RETENTION > 30) {
         $this->model_search_message->not_spam($this->data['id']);
     }
 }
예제 #6
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/restore.tpl";
     $this->layout = "common/layout-empty";
     $session = Registry::get('session');
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->load->model('user/user');
     $this->load->model('mail/mail');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = @$this->request->get['id'];
     $rcpt = array();
     if (RESTORE_OVER_IMAP == 1) {
         require_once 'Zend/Mail/Protocol/Imap.php';
         require_once 'Zend/Mail/Storage/Imap.php';
     }
     if (Registry::get('auditor_user') == 1) {
         $this->data['id'] = @$this->request->post['id'];
         $this->request->post['rcpt'] = urldecode($this->request->post['rcpt']);
         $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']);
     }
     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_RESTORE_MESSAGE, '', '', $this->data['id'], '');
     $this->data['username'] = Registry::get('username');
     /* send the email to all the recipients of the original email if we are admin or auditor users */
     if (Registry::get('auditor_user') == 0) {
         array_push($rcpt, $session->get("email"));
     }
     $this->data['data'] = $this->data['text_failed_to_restore'];
     if (count($rcpt) > 0) {
         $this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
         $this->model_search_message->connect_to_pilergetd();
         $msg = $this->model_search_message->get_raw_message($this->data['piler_id']);
         $this->model_search_message->disconnect_from_pilergetd();
         $this->model_search_message->remove_journal($msg);
         if (RESTORE_OVER_IMAP == 1) {
             if ($this->model_mail_mail->connect_imap()) {
                 $x = $this->imap->append('INBOX', $msg);
                 $this->model_mail_mail->disconnect_imap();
             } else {
                 $x = 0;
             }
         } else {
             if (RESTORE_EMAILS_AS_ATTACHMENT == 1) {
                 $msg = $this->model_mail_mail->message_as_rfc822_attachment($this->data['id'], $msg, $rcpt[0]);
                 $x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt, $msg);
             } else {
                 $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 . $msg);
             }
         }
         if ($x == 1) {
             $this->data['data'] = $this->data['text_restored'];
         }
     }
     $this->render();
 }
예제 #7
0
 public function index()
 {
     $this->id = "content";
     $this->template = "message/view.tpl";
     $this->layout = "common/layout-empty";
     $session = Registry::get('session');
     $request = Registry::get('request');
     $db = Registry::get('db');
     $this->load->model('search/search');
     $this->load->model('search/message');
     $this->load->model('audit/audit');
     $this->load->model('user/user');
     $this->document->title = $this->data['text_message'];
     $this->data['id'] = '';
     $this->data['search'] = '';
     $this->data['rcpt'] = array();
     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'];
         $this->data['search'] = $this->request->post['search'];
     }
     if (substr($this->data['id'], 0, 1) == 'a') {
         $this->template = "message/auto.tpl";
         $this->data['id'] = substr($this->data['id'], 1, 200);
     }
     if (!verify_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_id($this->data['id'])) {
         AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
         die("no permission for " . $this->data['id']);
     }
     AUDIT(ACTION_VIEW_MESSAGE, '', '', $this->data['id'], '');
     $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)) {
         $this->data['username'] = $this->request->get['user'];
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['tag'])) {
         $this->model_search_message->add_message_tag($this->data['id'], $session->get("uid"), $this->request->post['tag']);
         header("Location: " . $_SERVER['HTTP_REFERER']);
         exit;
     }
     $this->data['piler_id'] = $this->model_search_message->get_piler_id_by_id($this->data['id']);
     $this->data['attachments'] = $this->model_search_message->get_attachment_list($this->data['piler_id']);
     $this->data['message'] = $this->model_search_message->extract_message($this->data['piler_id'], $this->data['search']);
     $this->data['message']['tag'] = $this->model_search_message->get_message_tag($this->data['id'], $session->get("uid"));
     $this->data['message']['note'] = $this->model_search_message->get_message_note($this->data['id'], $session->get("uid"));
     $this->data['spam'] = $this->model_search_message->is_message_spam($this->data['id']);
     $this->data['images'] = array();
     foreach ($this->data['attachments'] as $a) {
         if (preg_match("/image/", $a['type'])) {
             $attachment = $this->model_search_message->get_attachment_by_id($a['id']);
             $fp = fopen(DIR_BASE . 'tmp/' . "i." . $a['id'], "w+");
             if ($fp) {
                 fwrite($fp, $attachment['attachment']);
                 fclose($fp);
                 $this->data['images'][] = array('name' => "i." . $a['id']);
             }
         }
     }
     $this->render();
 }