mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 02:01:58 +01:00
prevent you to shoot yourself in the foot very badly with an archiving rule
This commit is contained in:
parent
f522ed9267
commit
c6d4cf051d
@ -14,6 +14,7 @@ class ControllerPolicyArchiving extends Controller {
|
||||
$request = Registry::get('request');
|
||||
|
||||
$db = Registry::get('db');
|
||||
$lang = Registry::get('language');
|
||||
|
||||
$this->load->model('policy/archiving');
|
||||
|
||||
@ -21,12 +22,18 @@ class ControllerPolicyArchiving extends Controller {
|
||||
|
||||
$this->data['rules'] = array();
|
||||
|
||||
$this->data['error'] = '';
|
||||
|
||||
if(Registry::get('admin_user') == 0) {
|
||||
die("go away");
|
||||
}
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$rc = $this->model_policy_archiving->add_new_rule($this->request->post);
|
||||
if($this->validate == true) {
|
||||
$rc = $this->model_policy_archiving->add_new_rule($this->request->post);
|
||||
} else {
|
||||
$this->data['error'] = $lang->data['text_invalid_data'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['rules'] = $this->model_policy_archiving->get_rules();
|
||||
@ -36,6 +43,18 @@ class ControllerPolicyArchiving extends Controller {
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -166,6 +166,7 @@
|
||||
.fcell { display: table-cell; font: bold 12px Arial, sans-serif; padding: 5px; vertical-align: top; }
|
||||
.domain { font: normal 12px Arial, sans-serif; font-weight: bold; text-align:left; width: 408px;}
|
||||
|
||||
p.error { margin-bottom: 20px; color: red; font-weight: bold; }
|
||||
|
||||
#dhtmltooltip { position: absolute; width: 150px; border: 2px solid black; padding: 2px; background-color: yellow; color: #ffffff; visibility: hidden; z-index: 100; }
|
||||
|
||||
|
@ -65,6 +65,10 @@
|
||||
|
||||
</form>
|
||||
|
||||
<?php if($error) { ?>
|
||||
<p class="error"><?php print $text_error; ?>: <?php print $error; ?></p>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<h4><?php print $text_existing_rules; ?></h4>
|
||||
|
||||
@ -101,4 +105,3 @@
|
||||
<?php print $text_not_found; ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user