mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
added body option for the rules check
This commit is contained in:
parent
1e74472480
commit
30a4b8d782
@ -105,6 +105,7 @@ struct rule {
|
|||||||
regex_t from;
|
regex_t from;
|
||||||
regex_t to;
|
regex_t to;
|
||||||
regex_t subject;
|
regex_t subject;
|
||||||
|
regex_t body;
|
||||||
regex_t attachment_name;
|
regex_t attachment_name;
|
||||||
regex_t attachment_type;
|
regex_t attachment_type;
|
||||||
#endif
|
#endif
|
||||||
@ -119,7 +120,7 @@ struct rule {
|
|||||||
|
|
||||||
int days;
|
int days;
|
||||||
|
|
||||||
char emptyfrom, emptyto, emptysubject, emptyaname, emptyatype;
|
char emptyfrom, emptyto, emptysubject, emptybody, emptyaname, emptyatype;
|
||||||
|
|
||||||
char *rulestr;
|
char *rulestr;
|
||||||
char compiled;
|
char compiled;
|
||||||
|
38
src/rules.c
38
src/rules.c
@ -12,20 +12,21 @@
|
|||||||
|
|
||||||
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table){
|
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table){
|
||||||
char s[SMALLBUFSIZE];
|
char s[SMALLBUFSIZE];
|
||||||
char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_name[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE];
|
char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], body[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_name[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE];
|
||||||
int size=0, attachment_size=0, spam=0, days=0;
|
int size=0, attachment_size=0, spam=0, days=0;
|
||||||
|
|
||||||
memset(domain, 0, sizeof(domain));
|
memset(domain, 0, sizeof(domain));
|
||||||
memset(from, 0, sizeof(from));
|
memset(from, 0, sizeof(from));
|
||||||
memset(to, 0, sizeof(to));
|
memset(to, 0, sizeof(to));
|
||||||
memset(subject, 0, sizeof(subject));
|
memset(subject, 0, sizeof(subject));
|
||||||
|
memset(body, 0, sizeof(body));
|
||||||
memset(_size, 0, sizeof(_size));
|
memset(_size, 0, sizeof(_size));
|
||||||
memset(attachment_name, 0, sizeof(attachment_name));
|
memset(attachment_name, 0, sizeof(attachment_name));
|
||||||
memset(attachment_type, 0, sizeof(attachment_type));
|
memset(attachment_type, 0, sizeof(attachment_type));
|
||||||
memset(_attachment_size, 0, sizeof(_attachment_size));
|
memset(_attachment_size, 0, sizeof(_attachment_size));
|
||||||
|
|
||||||
|
|
||||||
snprintf(s, sizeof(s)-1, "SELECT `domain`, `from`, `to`, `subject`, `_size`, `size`, `attachment_name`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table);
|
snprintf(s, sizeof(s)-1, "SELECT `domain`, `from`, `to`, `subject`, `body`, `_size`, `size`, `attachment_name`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table);
|
||||||
|
|
||||||
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return;
|
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return;
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
|
|||||||
data->sql[data->pos] = &from[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(from)-2; data->pos++;
|
data->sql[data->pos] = &from[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(from)-2; data->pos++;
|
||||||
data->sql[data->pos] = &to[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(to)-2; data->pos++;
|
data->sql[data->pos] = &to[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(to)-2; data->pos++;
|
||||||
data->sql[data->pos] = &subject[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(subject)-2; data->pos++;
|
data->sql[data->pos] = &subject[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(subject)-2; data->pos++;
|
||||||
|
data->sql[data->pos] = &body[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(body)-2; data->pos++;
|
||||||
data->sql[data->pos] = &_size[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(_size)-2; data->pos++;
|
data->sql[data->pos] = &_size[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(_size)-2; data->pos++;
|
||||||
data->sql[data->pos] = (char *)&size; data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(size); data->pos++;
|
data->sql[data->pos] = (char *)&size; data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(size); data->pos++;
|
||||||
data->sql[data->pos] = &attachment_name[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(attachment_name)-2; data->pos++;
|
data->sql[data->pos] = &attachment_name[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(attachment_name)-2; data->pos++;
|
||||||
@ -56,12 +58,13 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
|
|||||||
p_store_results(sdata, data->stmt_generic, data);
|
p_store_results(sdata, data->stmt_generic, data);
|
||||||
|
|
||||||
while(p_fetch_results(data->stmt_generic) == OK){
|
while(p_fetch_results(data->stmt_generic) == OK){
|
||||||
append_rule(xhash, domain, from, to, subject, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
|
append_rule(xhash, domain, from, to, subject, body, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
|
||||||
|
|
||||||
memset(domain, 0, sizeof(domain));
|
memset(domain, 0, sizeof(domain));
|
||||||
memset(from, 0, sizeof(from));
|
memset(from, 0, sizeof(from));
|
||||||
memset(to, 0, sizeof(to));
|
memset(to, 0, sizeof(to));
|
||||||
memset(subject, 0, sizeof(subject));
|
memset(subject, 0, sizeof(subject));
|
||||||
|
memset(body, 0, sizeof(body));
|
||||||
memset(_size, 0, sizeof(_size));
|
memset(_size, 0, sizeof(_size));
|
||||||
memset(attachment_name, 0, sizeof(attachment_name));
|
memset(attachment_name, 0, sizeof(attachment_name));
|
||||||
memset(attachment_type, 0, sizeof(attachment_type));
|
memset(attachment_type, 0, sizeof(attachment_type));
|
||||||
@ -78,7 +81,7 @@ ENDE:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
|
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
|
||||||
struct node *q, *Q=NULL, *node;
|
struct node *q, *Q=NULL, *node;
|
||||||
struct rule *rule;
|
struct rule *rule;
|
||||||
int rc=0;
|
int rc=0;
|
||||||
@ -88,11 +91,11 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
|
|||||||
memset(node, 0, sizeof(struct node));
|
memset(node, 0, sizeof(struct node));
|
||||||
node->r = NULL;
|
node->r = NULL;
|
||||||
|
|
||||||
rule = create_rule_item(domain, from, to, subject, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
|
rule = create_rule_item(domain, from, to, subject, body, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
|
||||||
|
|
||||||
if(rule == NULL){
|
if(rule == NULL){
|
||||||
free(node);
|
free(node);
|
||||||
syslog(LOG_INFO, "could not load rule=%s/%s/%s/%s/%s,%d", domain, from, to, subject, _size, size);
|
syslog(LOG_INFO, "could not load rule=%s/%s/%s/%s/%s/%s,%d", domain, from, to, subject, body, _size, size);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +119,7 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
|
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
|
||||||
struct rule *h=NULL;
|
struct rule *h=NULL;
|
||||||
char empty = '\0';
|
char empty = '\0';
|
||||||
int len;
|
int len;
|
||||||
@ -151,6 +154,9 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
|
|||||||
if(!subject || strlen(subject) < 1){ subject = ∅ h->emptysubject = 1; }
|
if(!subject || strlen(subject) < 1){ subject = ∅ h->emptysubject = 1; }
|
||||||
if(regcomp(&(h->subject), subject, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
if(regcomp(&(h->subject), subject, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||||
|
|
||||||
|
if(!body || strlen(body) < 1){ body = ∅ h->emptybody = 1; }
|
||||||
|
if(regcomp(&(h->body), body, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||||
|
|
||||||
h->spam = spam;
|
h->spam = spam;
|
||||||
h->days = days;
|
h->days = days;
|
||||||
|
|
||||||
@ -171,12 +177,12 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
|
|||||||
if(!_attachment_size) _attachment_size = ∅
|
if(!_attachment_size) _attachment_size = ∅
|
||||||
snprintf(h->_attachment_size, 3, "%s", _attachment_size);
|
snprintf(h->_attachment_size, 3, "%s", _attachment_size);
|
||||||
|
|
||||||
len = strlen(domain)+8 + strlen(from)+6 + strlen(to)+4 + strlen(subject)+9 + strlen(_size)+6 + strlen(attachment_name)+10 + strlen(attachment_type)+10 + strlen(_attachment_size)+10 + 9 + 15 + 15;
|
len = strlen(domain)+8 + strlen(from)+6 + strlen(to)+4 + strlen(subject)+9 + strlen(body)+6 + strlen(_size)+6 + strlen(attachment_name)+10 + strlen(attachment_type)+10 + strlen(_attachment_size)+10 + 9 + 15 + 15;
|
||||||
h->rulestr = malloc(len);
|
h->rulestr = malloc(len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(h->rulestr) snprintf(h->rulestr, len-1, "domain=%s,from=%s,to=%s,subject=%s,size%s%d,att.name=%s,att.type=%s,att.size%s%d,spam=%d", domain, from, to, subject, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam);
|
if(h->rulestr) snprintf(h->rulestr, len-1, "domain=%s,from=%s,to=%s,subject=%s,body=%s,size%s%d,att.name=%s,att.type=%s,att.size%s%d,spam=%d", domain, from, to, subject, body, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam);
|
||||||
else h->compiled = 0;
|
else h->compiled = 0;
|
||||||
|
|
||||||
h->r = NULL;
|
h->r = NULL;
|
||||||
@ -220,6 +226,12 @@ char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size,
|
|||||||
ismatch += RULE_UNDEF;
|
ismatch += RULE_UNDEF;
|
||||||
}
|
}
|
||||||
else if(regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
else if(regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
||||||
|
|
||||||
|
if(p->emptybody == 1){
|
||||||
|
ismatch += RULE_UNDEF;
|
||||||
|
}
|
||||||
|
else if(regexec(&(p->body), state->b_body, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ismatch > 0){
|
if(ismatch > 0){
|
||||||
@ -278,6 +290,12 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int
|
|||||||
ismatch += RULE_UNDEF;
|
ismatch += RULE_UNDEF;
|
||||||
}
|
}
|
||||||
else if(regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
else if(regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
||||||
|
|
||||||
|
if(p->emptybody == 1){
|
||||||
|
ismatch += RULE_UNDEF;
|
||||||
|
}
|
||||||
|
else if(regexec(&(p->body), state->b_body, nmatch, NULL, 0) == 0) ismatch += RULE_MATCH; else ismatch += RULE_NO_MATCH;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ismatch > 0){
|
if(ismatch > 0){
|
||||||
@ -373,6 +391,8 @@ void clearrules(struct node *xhash[]){
|
|||||||
|
|
||||||
regfree(&(rule->from));
|
regfree(&(rule->from));
|
||||||
regfree(&(rule->to));
|
regfree(&(rule->to));
|
||||||
|
regfree(&(rule->subject));
|
||||||
|
regfree(&(rule->body));
|
||||||
regfree(&(rule->attachment_name));
|
regfree(&(rule->attachment_name));
|
||||||
regfree(&(rule->attachment_type));
|
regfree(&(rule->attachment_type));
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table);
|
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table);
|
||||||
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
|
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
|
||||||
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
|
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
|
||||||
char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, int spam);
|
char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, int spam);
|
||||||
unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg);
|
unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg);
|
||||||
int check_size_rule(int message_size, int size, char *_size);
|
int check_size_rule(int message_size, int size, char *_size);
|
||||||
|
@ -112,6 +112,7 @@ create table if not exists `archiving_rule` (
|
|||||||
`from` varchar(128) default null,
|
`from` varchar(128) default null,
|
||||||
`to` varchar(128) default null,
|
`to` varchar(128) default null,
|
||||||
`subject` varchar(128) default null,
|
`subject` varchar(128) default null,
|
||||||
|
`body` varchar(128) default null,
|
||||||
`_size` char(2) default null,
|
`_size` char(2) default null,
|
||||||
`size` int default 0,
|
`size` int default 0,
|
||||||
`attachment_name` varchar(128) default null,
|
`attachment_name` varchar(128) default null,
|
||||||
@ -121,7 +122,7 @@ create table if not exists `archiving_rule` (
|
|||||||
`spam` tinyint(1) default -1,
|
`spam` tinyint(1) default -1,
|
||||||
`days` int default 0,
|
`days` int default 0,
|
||||||
primary key (`id`),
|
primary key (`id`),
|
||||||
unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
|
unique(`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
|
||||||
@ -131,6 +132,7 @@ create table if not exists `retention_rule` (
|
|||||||
`from` varchar(128) default null,
|
`from` varchar(128) default null,
|
||||||
`to` varchar(128) default null,
|
`to` varchar(128) default null,
|
||||||
`subject` varchar(128) default null,
|
`subject` varchar(128) default null,
|
||||||
|
`body` varchar(128) default null,
|
||||||
`_size` char(2) default null,
|
`_size` char(2) default null,
|
||||||
`size` int default 0,
|
`size` int default 0,
|
||||||
`attachment_name` varchar(128) default null,
|
`attachment_name` varchar(128) default null,
|
||||||
@ -140,7 +142,7 @@ create table if not exists `retention_rule` (
|
|||||||
`spam` tinyint(1) default -1,
|
`spam` tinyint(1) default -1,
|
||||||
`days` int default 0,
|
`days` int default 0,
|
||||||
primary key (`id`),
|
primary key (`id`),
|
||||||
unique (`domain`,`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
|
unique (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ create table if not exists `user_settings` (
|
|||||||
`lang` char(2) default null,
|
`lang` char(2) default null,
|
||||||
`ga_enabled` int default 0,
|
`ga_enabled` int default 0,
|
||||||
`ga_secret` varchar(255) default null
|
`ga_secret` varchar(255) default null
|
||||||
);
|
) Engine=InnoDB;
|
||||||
|
|
||||||
create index `user_settings_idx` on `user_settings`(`username`);
|
create index `user_settings_idx` on `user_settings`(`username`);
|
||||||
|
|
||||||
|
9
util/db-upgrade-1.1.0-vs-1.2.0.sql
Normal file
9
util/db-upgrade-1.1.0-vs-1.2.0.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
-- 2015.03.10
|
||||||
|
|
||||||
|
alter table archiving_rule add column `body` varchar(128) default null;
|
||||||
|
alter table retention_rule add column `body` varchar(128) default null;
|
||||||
|
|
||||||
|
create unique index `entry` on archiving_rule (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`);
|
||||||
|
create unique index `entry` on retention_rule (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`);
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ class ControllerPolicyArchiving extends Controller {
|
|||||||
|
|
||||||
private function validate() {
|
private function validate() {
|
||||||
if($this->request->post['from'] == '' && $this->request->post['to'] == '' &&
|
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['attachment_name'] == '' && $this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
|
||||||
$this->request->post['spam'] == -1
|
$this->request->post['spam'] == -1
|
||||||
) {
|
) {
|
||||||
|
@ -53,7 +53,7 @@ class ControllerPolicyRetention extends Controller {
|
|||||||
if($this->request->post['days'] == '' || $this->request->post['days'] < 1) { return false; }
|
if($this->request->post['days'] == '' || $this->request->post['days'] < 1) { return false; }
|
||||||
|
|
||||||
if($this->request->post['from'] == '' && $this->request->post['to'] == '' &&
|
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['attachment_name'] == '' && $this->request->post['attachment_type'] == '' && $this->request->post['attachment_size'] == '' &&
|
||||||
$this->request->post['spam'] == -1
|
$this->request->post['spam'] == -1
|
||||||
) {
|
) {
|
||||||
|
@ -5,7 +5,7 @@ class ModelPolicyArchiving extends Model {
|
|||||||
|
|
||||||
public function get_rules($s = '') {
|
public function get_rules($s = '') {
|
||||||
if($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 {
|
} else {
|
||||||
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " ORDER BY id");
|
$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()) {
|
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();
|
return $this->db->countAffected();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ class ModelPolicyRetention extends Model {
|
|||||||
|
|
||||||
public function get_rules($s = '') {
|
public function get_rules($s = '') {
|
||||||
if($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 {
|
} else {
|
||||||
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " ORDER BY domain, id");
|
$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']; }
|
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();
|
return $this->db->countAffected();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,12 @@
|
|||||||
<input type="text" class="text" name="subject" />
|
<input type="text" class="text" name="subject" />
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="control-group">
|
||||||
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
|
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
@ -89,6 +95,7 @@
|
|||||||
<th><?php print $text_from; ?></th>
|
<th><?php print $text_from; ?></th>
|
||||||
<th><?php print $text_to; ?></th>
|
<th><?php print $text_to; ?></th>
|
||||||
<th><?php print $text_subject; ?></th>
|
<th><?php print $text_subject; ?></th>
|
||||||
|
<th><?php print $text_body; ?></th>
|
||||||
<th><?php print $text_spam; ?></th>
|
<th><?php print $text_spam; ?></th>
|
||||||
<th><?php print $text_size; ?></th>
|
<th><?php print $text_size; ?></th>
|
||||||
<th><?php print $text_attachment_name; ?></th>
|
<th><?php print $text_attachment_name; ?></th>
|
||||||
@ -102,6 +109,7 @@
|
|||||||
<td><?php print $rule['from']; ?></td>
|
<td><?php print $rule['from']; ?></td>
|
||||||
<td><?php print $rule['to']; ?></td>
|
<td><?php print $rule['to']; ?></td>
|
||||||
<td><?php print $rule['subject']; ?></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['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 if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></td>
|
||||||
<td><?php print $rule['attachment_name']; ?></td>
|
<td><?php print $rule['attachment_name']; ?></td>
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
||||||
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
||||||
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
|
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['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
|
||||||
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
||||||
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
||||||
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
||||||
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
|
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['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
|
||||||
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
||||||
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
||||||
|
@ -36,6 +36,12 @@
|
|||||||
<input type="text" class="text" name="subject" />
|
<input type="text" class="text" name="subject" />
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="control-group">
|
||||||
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
|
<label class="control-label" for="size"><?php print $text_size; ?>:</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
@ -104,6 +110,7 @@
|
|||||||
<th><?php print $text_from; ?></th>
|
<th><?php print $text_from; ?></th>
|
||||||
<th><?php print $text_to; ?></th>
|
<th><?php print $text_to; ?></th>
|
||||||
<th><?php print $text_subject; ?></th>
|
<th><?php print $text_subject; ?></th>
|
||||||
|
<th><?php print $text_body; ?></th>
|
||||||
<th><?php print $text_spam; ?></th>
|
<th><?php print $text_spam; ?></th>
|
||||||
<th><?php print $text_size; ?></th>
|
<th><?php print $text_size; ?></th>
|
||||||
<th><?php print $text_attachment_name; ?></th>
|
<th><?php print $text_attachment_name; ?></th>
|
||||||
@ -124,6 +131,7 @@
|
|||||||
<td><?php print $rule['from']; ?></td>
|
<td><?php print $rule['from']; ?></td>
|
||||||
<td><?php print $rule['to']; ?></td>
|
<td><?php print $rule['to']; ?></td>
|
||||||
<td><?php print $rule['subject']; ?></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['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 if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></td>
|
||||||
<td><?php print $rule['attachment_name']; ?></td>
|
<td><?php print $rule['attachment_name']; ?></td>
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
<div class="domaincell"><?php print $text_subject; ?>:</div>
|
<div class="domaincell"><?php print $text_subject; ?>:</div>
|
||||||
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
|
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
|
||||||
</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="row">
|
||||||
<div class="domaincell"><?php print $text_size; ?>:</div>
|
<div class="domaincell"><?php print $text_size; ?>:</div>
|
||||||
<div class="domaincell">
|
<div class="domaincell">
|
||||||
@ -87,6 +91,7 @@
|
|||||||
<div class="domaincell"><?php print $text_from; ?></div>
|
<div class="domaincell"><?php print $text_from; ?></div>
|
||||||
<div class="domaincell"><?php print $text_to; ?></div>
|
<div class="domaincell"><?php print $text_to; ?></div>
|
||||||
<div class="domaincell"><?php print $text_subject; ?></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_spam; ?></div>
|
||||||
<div class="domaincell"><?php print $text_size; ?></div>
|
<div class="domaincell"><?php print $text_size; ?></div>
|
||||||
<div class="domaincell"><?php print $text_attachment_name; ?></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['from']; ?></div>
|
||||||
<div class="domaincell"><?php print $rule['to']; ?></div>
|
<div class="domaincell"><?php print $rule['to']; ?></div>
|
||||||
<div class="domaincell"><?php print $rule['subject']; ?></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['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 if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></div>
|
||||||
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>
|
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>
|
||||||
|
@ -12,6 +12,7 @@ if($rule['domain']) { print $text_domain . ': ' . $rule['domain'] . ', '; }
|
|||||||
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
||||||
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
||||||
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
|
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['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
|
||||||
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
||||||
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
||||||
|
@ -12,6 +12,7 @@ if($rule['domain']) { print $text_domain . ': ' . $rule['domain'] . ', '; }
|
|||||||
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
if($rule['from']) { print $text_from . ': ' . $rule['from'] . ', '; }
|
||||||
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
if($rule['to']) { print $text_to . ': ' . $rule['to'] . ', '; }
|
||||||
if($rule['subject']) { print $text_subject . ': ' . $rule['subject'] . ', '; }
|
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['size'] > 0) { print $text_size . ': ' . $rule['_size'] . ' ' . $rule['size'] . ', '; }
|
||||||
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
if($rule['attachment_name']) { print $text_attachment_name . ': ' . $rule['attachment_name'] . ', '; }
|
||||||
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
if($rule['attachment_type']) { print $text_attachment_type . ': ' . $rule['attachment_type'] . ', '; }
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
<div class="domaincell"><?php print $text_subject; ?>:</div>
|
<div class="domaincell"><?php print $text_subject; ?>:</div>
|
||||||
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
|
<div class="domaincell"><input type="text" name="subject" class="input-medium span5" /></div>
|
||||||
</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="row">
|
||||||
<div class="domaincell"><?php print $text_size; ?>:</div>
|
<div class="domaincell"><?php print $text_size; ?>:</div>
|
||||||
<div class="domaincell">
|
<div class="domaincell">
|
||||||
@ -100,6 +104,7 @@
|
|||||||
<div class="domaincell"><?php print $text_from; ?></div>
|
<div class="domaincell"><?php print $text_from; ?></div>
|
||||||
<div class="domaincell"><?php print $text_to; ?></div>
|
<div class="domaincell"><?php print $text_to; ?></div>
|
||||||
<div class="domaincell"><?php print $text_subject; ?></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_spam; ?></div>
|
||||||
<div class="domaincell"><?php print $text_size; ?></div>
|
<div class="domaincell"><?php print $text_size; ?></div>
|
||||||
<div class="domaincell"><?php print $text_attachment_name; ?></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['from']; ?></div>
|
||||||
<div class="domaincell"><?php print $rule['to']; ?></div>
|
<div class="domaincell"><?php print $rule['to']; ?></div>
|
||||||
<div class="domaincell"><?php print $rule['subject']; ?></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['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 if($rule['size'] > 0) { print $rule['_size']; ?> <?php print $rule['size']; } ?></div>
|
||||||
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>
|
<div class="domaincell"><?php print $rule['attachment_name']; ?></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user