piler/webui/controller/policy/archiving.php

61 lines
1.4 KiB
PHP
Raw Normal View History

2012-02-08 23:14:28 +01:00
<?php
class ControllerPolicyArchiving extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "policy/archiving.tpl";
$this->layout = "common/layout";
$request = Registry::get('request');
$db = Registry::get('db');
$lang = Registry::get('language');
2012-02-08 23:14:28 +01:00
$this->load->model('policy/archiving');
$this->document->title = $this->data['text_archiving_rules'];
$this->data['rules'] = array();
$this->data['error'] = '';
2012-02-19 22:59:47 +01:00
if(Registry::get('admin_user') == 0) {
die("go away");
}
2012-02-08 23:14:28 +01:00
if($_SERVER['REQUEST_METHOD'] == 'POST') {
2013-02-03 16:50:56 +01:00
if($this->validate() == true) {
$rc = $this->model_policy_archiving->add_new_rule($this->request->post);
} else {
$this->data['error'] = $lang->data['text_invalid_data'];
}
2012-02-08 23:14:28 +01:00
}
$this->data['rules'] = $this->model_policy_archiving->get_rules();
$this->render();
}
private function validate() {
if($this->request->post['from'] == '' && $this->request->post['to'] == '' &&
$this->request->post['subject'] == '' && $this->request->post['size'] == '' &&
$this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
$this->request->post['spam'] == -1
) {
return false;
}
return true;
}
2012-02-08 23:14:28 +01:00
}
?>