mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-01-26 13:49:59 +01:00
prevent adding empty retention rule
This commit is contained in:
parent
32287100e1
commit
7a096bceb7
@ -26,7 +26,12 @@ class ControllerPolicyRetention extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
if($this->validate() == true) {
|
||||||
$rc = $this->model_policy_retention->add_new_rule($this->request->post);
|
$rc = $this->model_policy_retention->add_new_rule($this->request->post);
|
||||||
|
} else {
|
||||||
|
$this->data['error'] = $lang->data['text_invalid_data'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data['rules'] = $this->model_policy_retention->get_rules();
|
$this->data['rules'] = $this->model_policy_retention->get_rules();
|
||||||
@ -36,6 +41,21 @@ class ControllerPolicyRetention extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function validate() {
|
||||||
|
if($this->request->post['days'] == '' || $this->request->post['days'] < 1) { return false; }
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user