2012-02-20 14:20:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class ControllerPolicyRetention extends Controller {
|
|
|
|
private $error = array();
|
|
|
|
|
|
|
|
public function index(){
|
|
|
|
|
|
|
|
$this->id = "content";
|
|
|
|
$this->template = "policy/retention.tpl";
|
|
|
|
$this->layout = "common/layout";
|
|
|
|
|
|
|
|
|
|
|
|
$request = Registry::get('request');
|
|
|
|
|
|
|
|
$db = Registry::get('db');
|
|
|
|
|
|
|
|
$this->load->model('policy/retention');
|
|
|
|
|
|
|
|
$this->document->title = $this->data['text_retention_rules'];
|
|
|
|
|
|
|
|
$this->data['rules'] = array();
|
2013-03-29 18:05:58 +01:00
|
|
|
$this->data['error'] = '';
|
2012-02-20 14:20:19 +01:00
|
|
|
|
2013-08-24 13:53:14 +02:00
|
|
|
$this->data['search'] = '';
|
|
|
|
|
|
|
|
if(isset($this->request->post['search'])) { $this->data['search'] = $this->request->post['search']; }
|
|
|
|
else if(isset($this->request->get['search'])) { $this->data['search'] = $this->request->get['search']; }
|
|
|
|
|
2012-02-20 14:20:19 +01:00
|
|
|
if(Registry::get('admin_user') == 0) {
|
|
|
|
die("go away");
|
|
|
|
}
|
|
|
|
|
2013-03-29 18:05:58 +01:00
|
|
|
$lang = Registry::get('language');
|
|
|
|
|
2012-02-20 14:20:19 +01:00
|
|
|
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
2013-03-09 20:41:44 +01:00
|
|
|
if($this->validate() == true) {
|
|
|
|
$rc = $this->model_policy_retention->add_new_rule($this->request->post);
|
|
|
|
} else {
|
2013-03-29 18:05:58 +01:00
|
|
|
$this->data['error'] = $lang->data['text_missing_data'];
|
2013-03-09 20:41:44 +01:00
|
|
|
}
|
|
|
|
|
2012-02-20 14:20:19 +01:00
|
|
|
}
|
|
|
|
|
2018-09-23 08:38:36 +02:00
|
|
|
$this->data['rules'] = htmlentities_on_array($this->model_policy_retention->get_rules($this->data['search']));
|
2012-02-20 14:20:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
$this->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-09 20:41:44 +01:00
|
|
|
private function validate() {
|
|
|
|
if($this->request->post['days'] == '' || $this->request->post['days'] < 1) { return false; }
|
|
|
|
|
|
|
|
if($this->request->post['from'] == '' && $this->request->post['to'] == '' &&
|
2015-03-11 12:54:31 +01:00
|
|
|
$this->request->post['subject'] == '' && $this->request->post['body'] == '' && $this->request->post['size'] == '' &&
|
2013-11-11 11:48:13 +01:00
|
|
|
$this->request->post['attachment_name'] == '' && $this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
|
2013-03-09 20:41:44 +01:00
|
|
|
$this->request->post['spam'] == -1
|
|
|
|
) {
|
2013-07-31 10:57:45 +02:00
|
|
|
if(ENABLE_SAAS == 1 && strlen($this->request->post['domain']) > 3) { return true; }
|
2013-03-09 20:41:44 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-20 14:20:19 +01:00
|
|
|
}
|