added body option for the rules check

This commit is contained in:
SJ
2015-03-11 12:54:31 +01:00
parent 1e74472480
commit 30a4b8d782
17 changed files with 85 additions and 21 deletions

View File

@ -50,7 +50,7 @@ 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['subject'] == '' && $this->request->post['body'] == '' && $this->request->post['size'] == '' &&
$this->request->post['attachment_name'] == '' && $this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
$this->request->post['spam'] == -1
) {

View File

@ -53,7 +53,7 @@ class ControllerPolicyRetention extends Controller {
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['subject'] == '' && $this->request->post['body'] == '' && $this->request->post['size'] == '' &&
$this->request->post['attachment_name'] == '' && $this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
$this->request->post['spam'] == -1
) {

View File

@ -5,7 +5,7 @@ class ModelPolicyArchiving extends Model {
public function get_rules($s = '') {
if($s) {
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " WHERE `from` LIKE ? OR `to` LIKE ? OR subject LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " WHERE `from` LIKE ? OR `to` LIKE ? OR `subject` LIKE ? OR `body` LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
} else {
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " ORDER BY id");
}
@ -26,7 +26,7 @@ class ModelPolicyArchiving extends Model {
public function add_new_rule($data = array()) {
$query = $this->db->query("INSERT INTO " . TABLE_ARCHIVING_RULE . " (`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) VALUES(?,?,?,?,?,?,?,?,?,?)", array($data['from'], $data['to'], $data['subject'], $data['_size'], $data['size'], $data['attachment_name'], $data['attachment_type'], $data['_attachment_size'], $data['attachment_size'], $data['spam']));
$query = $this->db->query("INSERT INTO " . TABLE_ARCHIVING_RULE . " (`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) VALUES(?,?,?,?,?,?,?,?,?,?,?)", array($data['from'], $data['to'], $data['subject'], $data['body'], $data['_size'], $data['size'], $data['attachment_name'], $data['attachment_type'], $data['_attachment_size'], $data['attachment_size'], $data['spam']));
return $this->db->countAffected();
}

View File

@ -5,7 +5,7 @@ class ModelPolicyRetention extends Model {
public function get_rules($s = '') {
if($s) {
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " WHERE domain LIKE ? OR `from` LIKE ? OR subject LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " WHERE domain LIKE ? OR `from` LIKE ? OR `subject` LIKE ? OR `body` LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
} else {
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " ORDER BY domain, id");
}
@ -30,7 +30,7 @@ class ModelPolicyRetention extends Model {
if(isset($data['domain'])) { $domain = $data['domain']; }
$query = $this->db->query("INSERT INTO " . TABLE_RETENTION_RULE . " (`domain`,`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`,`days`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", array($domain, $data['from'], $data['to'], $data['subject'], $data['_size'], $data['size'], $data['attachment_name'], $data['attachment_type'], $data['_attachment_size'], $data['attachment_size'], $data['spam'], $data['days']) );
$query = $this->db->query("INSERT INTO " . TABLE_RETENTION_RULE . " (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`,`days`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)", array($domain, $data['from'], $data['to'], $data['subject'], $data['body'], $data['_size'], $data['size'], $data['attachment_name'], $data['attachment_type'], $data['_attachment_size'], $data['attachment_size'], $data['spam'], $data['days']) );
return $this->db->countAffected();
}

View File

@ -26,6 +26,12 @@
<input type="text" class="text" name="subject" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="body"><?php print $text_body; ?>:</label>
<div class="controls">
<input type="text" class="text" name="body" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
<div class="controls">
@ -89,6 +95,7 @@
<th><?php print $text_from; ?></th>
<th><?php print $text_to; ?></th>
<th><?php print $text_subject; ?></th>
<th><?php print $text_body; ?></th>
<th><?php print $text_spam; ?></th>
<th><?php print $text_size; ?></th>
<th><?php print $text_attachment_name; ?></th>
@ -102,6 +109,7 @@
<td><?php print $rule['from']; ?></td>
<td><?php print $rule['to']; ?></td>
<td><?php print $rule['subject']; ?></td>
<td><?php print $rule['body']; ?></td>
<td><?php if($rule['spam'] == -1) { print "-"; } else if($rule['spam'] == 0) { print $text_not_spam; } else { print $text_spam; } ?></td>
<td><?php if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></td>
<td><?php print $rule['attachment_name']; ?></td>

View File

@ -15,6 +15,7 @@
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
if($rule['body']) { print $text_body . ': ' . $rule['body'] . ', '; }
if($rule['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }

View File

@ -14,6 +14,7 @@
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
if($rule['body']) { print $text_body . ': ' . $rule['body'] . ', '; }
if($rule['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }

View File

@ -36,6 +36,12 @@
<input type="text" class="text" name="subject" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="body"><?php print $text_body; ?>:</label>
<div class="controls">
<input type="text" class="text" name="body" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
<div class="controls">
@ -104,6 +110,7 @@
<th><?php print $text_from; ?></th>
<th><?php print $text_to; ?></th>
<th><?php print $text_subject; ?></th>
<th><?php print $text_body; ?></th>
<th><?php print $text_spam; ?></th>
<th><?php print $text_size; ?></th>
<th><?php print $text_attachment_name; ?></th>
@ -124,6 +131,7 @@
<td><?php print $rule['from']; ?></td>
<td><?php print $rule['to']; ?></td>
<td><?php print $rule['subject']; ?></td>
<td><?php print $rule['body']; ?></td>
<td><?php if($rule['spam'] == -1) { print "-"; } else if($rule['spam'] == 0) { print $text_not_spam; } else { print $text_spam; } ?></td>
<td><?php if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></td>
<td><?php print $rule['attachment_name']; ?></td>

View File

@ -23,6 +23,10 @@
<div class="domaincell"><?php print $text_subject; ?>:</div>
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_body; ?>:</div>
<div class="domaincell"><input type="text" name="body" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_size; ?>:</div>
<div class="domaincell">
@ -87,6 +91,7 @@
<div class="domaincell"><?php print $text_from; ?></div>
<div class="domaincell"><?php print $text_to; ?></div>
<div class="domaincell"><?php print $text_subject; ?></div>
<div class="domaincell"><?php print $text_body; ?></div>
<div class="domaincell"><?php print $text_spam; ?></div>
<div class="domaincell"><?php print $text_size; ?></div>
<div class="domaincell"><?php print $text_attachment_name; ?></div>
@ -100,6 +105,7 @@
<div class="domaincell"><?php print $rule['from']; ?></div>
<div class="domaincell"><?php print $rule['to']; ?></div>
<div class="domaincell"><?php print $rule['subject']; ?></div>
<div class="domaincell"><?php print $rule['body']; ?></div>
<div class="domaincell"><?php if($rule['spam'] == -1) { print "-"; } else if($rule['spam'] == 0) { print $text_not_spam; } else { print $text_spam; } ?></div>
<div class="domaincell"><?php if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></div>
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>

View File

@ -12,6 +12,7 @@ if($rule['domain']) { print $text_domain . ': ' . $rule['domain'] . ', '; }
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
if($rule['body']) { print $text_body . ': ' . $rule['body'] . ', '; }
if($rule['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }

View File

@ -12,6 +12,7 @@ if($rule['domain']) { print $text_domain . ': ' . $rule['domain'] . ', '; }
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
if($rule['body']) { print $text_body . ': ' . $rule['body'] . ', '; }
if($rule['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }

View File

@ -29,6 +29,10 @@
<div class="domaincell"><?php print $text_subject; ?>:</div>
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_body; ?>:</div>
<div class="domaincell"><input type="text" name="body" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_size; ?>:</div>
<div class="domaincell">
@ -100,6 +104,7 @@
<div class="domaincell"><?php print $text_from; ?></div>
<div class="domaincell"><?php print $text_to; ?></div>
<div class="domaincell"><?php print $text_subject; ?></div>
<div class="domaincell"><?php print $text_body; ?></div>
<div class="domaincell"><?php print $text_spam; ?></div>
<div class="domaincell"><?php print $text_size; ?></div>
<div class="domaincell"><?php print $text_attachment_name; ?></div>
@ -120,6 +125,7 @@
<div class="domaincell"><?php print $rule['from']; ?></div>
<div class="domaincell"><?php print $rule['to']; ?></div>
<div class="domaincell"><?php print $rule['subject']; ?></div>
<div class="domaincell"><?php print $rule['body']; ?></div>
<div class="domaincell"><?php if($rule['spam'] == -1) { print "-"; } else if($rule['spam'] == 0) { print $text_not_spam; } else { print $text_spam; } ?></div>
<div class="domaincell"><?php if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></div>
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>