add rule support for attachment filename

This commit is contained in:
SJ 2013-11-11 11:34:00 +01:00
parent 2ca6e5a5c0
commit dc3da74311
18 changed files with 71 additions and 24 deletions

View File

@ -94,6 +94,7 @@ install-piler:
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerexport $(DESTDIR)$(bindir)
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerpurge $(DESTDIR)$(bindir)
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) reindex $(DESTDIR)$(bindir)
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilertest $(DESTDIR)$(bindir)
clean:
rm -f *.o *.a libpiler.so* piler pilerconf pilerget pilergetd pileraget pilerimport pilerexport pilerpurge pilertest reindex

View File

@ -100,6 +100,7 @@ struct rule {
regex_t from;
regex_t to;
regex_t subject;
regex_t attachment_name;
regex_t attachment_type;
#endif
int spam;

View File

@ -12,7 +12,7 @@
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table){
char s[SMALLBUFSIZE];
char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE];
char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_name[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE];
int size=0, attachment_size=0, spam=0, days=0;
memset(domain, 0, sizeof(domain));
@ -20,11 +20,12 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
memset(to, 0, sizeof(to));
memset(subject, 0, sizeof(subject));
memset(_size, 0, sizeof(_size));
memset(attachment_name, 0, sizeof(attachment_name));
memset(attachment_type, 0, sizeof(attachment_type));
memset(_attachment_size, 0, sizeof(_attachment_size));
snprintf(s, sizeof(s)-1, "SELECT `domain`, `from`, `to`, `subject`, `_size`, `size`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table);
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);
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return;
@ -43,6 +44,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
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] = &_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] = &attachment_name[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(attachment_name)-2; data->pos++;
data->sql[data->pos] = &attachment_type[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(attachment_type)-2; data->pos++;
data->sql[data->pos] = &_attachment_size[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(_attachment_size)-2; data->pos++;
data->sql[data->pos] = (char *)&attachment_size; data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(attachment_size); data->pos++;
@ -54,13 +56,14 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
p_store_results(sdata, data->stmt_generic, data);
while(p_fetch_results(data->stmt_generic) == OK){
append_rule(xhash, domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days, data);
append_rule(xhash, domain, from, to, subject, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
memset(domain, 0, sizeof(domain));
memset(from, 0, sizeof(from));
memset(to, 0, sizeof(to));
memset(subject, 0, sizeof(subject));
memset(_size, 0, sizeof(_size));
memset(attachment_name, 0, sizeof(attachment_name));
memset(attachment_type, 0, sizeof(attachment_type));
memset(_attachment_size, 0, sizeof(_attachment_size));
@ -75,7 +78,7 @@ ENDE:
}
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, 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 *_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 rule *rule;
int rc=0;
@ -85,7 +88,7 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
memset(node, 0, sizeof(struct node));
node->r = NULL;
rule = create_rule_item(domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days, data);
rule = create_rule_item(domain, from, to, subject, _size, size, attachment_name, attachment_type, _attachment_size, attachment_size, spam, days, data);
if(rule == NULL){
free(node);
@ -112,7 +115,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_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 *h=NULL;
char empty = '\0';
int len;
@ -152,6 +155,8 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
if(!_size) _size = ∅
snprintf(h->_size, 3, "%s", _size);
if(!attachment_name) attachment_name = ∅
if(regcomp(&(h->attachment_name), attachment_name, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
if(!attachment_type) attachment_type = ∅
if(regcomp(&(h->attachment_type), attachment_type, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
@ -162,12 +167,12 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
if(!_attachment_size) _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_type)+10 + strlen(_attachment_size)+10 + 9 + 15 + 15;
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;
h->rulestr = malloc(len);
if(h->rulestr) snprintf(h->rulestr, len-1, "domain=%s,from=%s,to=%s,subject=%s,size%s%d,att.type=%s,att.size%s%d,spam=%d", domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam);
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);
else h->compiled = 0;
h->r = NULL;
@ -281,6 +286,7 @@ int check_attachment_rule(struct _state *state, struct rule *rule){
for(i=1; i<=state->n_attachments; i++){
if(
regexec(&(rule->attachment_name), state->attachments[i].filename, nmatch, NULL, 0) == 0 &&
regexec(&(rule->attachment_type), state->attachments[i].type, nmatch, NULL, 0) == 0 &&
check_size_rule(state->attachments[i].size, rule->attachment_size, rule->_attachment_size) == 1
){
@ -313,6 +319,7 @@ void clearrules(struct node *xhash[]){
regfree(&(rule->from));
regfree(&(rule->to));
regfree(&(rule->attachment_name));
regfree(&(rule->attachment_type));
free(rule->rulestr);

View File

@ -8,8 +8,8 @@
#include "defs.h"
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_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_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 *_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);
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);
int check_size_rule(int message_size, int size, char *_size);

View File

@ -109,36 +109,38 @@ create table if not exists `tag` (
create table if not exists `archiving_rule` (
`id` bigint unsigned not null auto_increment,
`domain` varchar(128) default null,
`from` char(128) default null,
`to` char(255) default null,
`subject` char(255) default null,
`from` varchar(128) default null,
`to` varchar(128) default null,
`subject` varchar(128) default null,
`_size` char(2) default null,
`size` int default 0,
`attachment_type` char(128) default null,
`attachment_name` varchar(128) default null,
`attachment_type` varchar(128) default null,
`_attachment_size` char(2) default null,
`attachment_size` int default 0,
`spam` tinyint(1) default -1,
`days` int default 0,
primary key (`id`),
unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
) ENGINE=InnoDB;
create table if not exists `retention_rule` (
`id` bigint unsigned not null auto_increment,
`domain` varchar(128) default null,
`from` char(128) default null,
`to` char(255) default null,
`subject` char(255) default null,
`from` varchar(128) default null,
`to` varchar(128) default null,
`subject` varchar(128) default null,
`_size` char(2) default null,
`size` int default 0,
`attachment_type` char(128) default null,
`attachment_name` varchar(128) default null,
`attachment_type` varchar(128) default null,
`_attachment_size` char(2) default null,
`attachment_size` int default 0,
`spam` tinyint(1) default -1,
`days` int default 0,
primary key (`id`),
unique (`domain`,`from`,`to`,`subject`,`_size`,`size`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
unique (`domain`,`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
) ENGINE=InnoDB;

View File

@ -4,4 +4,6 @@ alter table `user_settings` add column `ga_secret` varchar(255) default null;
create index metadata_idx9 on metadata(`sent`);
alter table archiving_rule add column `attachment_name` varchar(128) default null;
alter table retention_rule add column `attachment_name` varchar(128) default null;

View File

@ -26,6 +26,7 @@ $_['text_archive_size'] = "Archivgröße";
$_['text_archived_messages'] = "Archivierte Nachrichten";
$_['text_archiving_rules'] = "Archivierungsregeln";
$_['text_attachment'] = "Anhang";
$_['text_attachment_name'] = "Anhangname";
$_['text_attachment_size'] = "Größe Anhang";
$_['text_attachment_type'] = "Typ Anhang";
$_['text_audit'] = "Revision";

View File

@ -27,6 +27,7 @@ $_['text_archive_size_before_compression'] = "Archive size before compression";
$_['text_archived_messages'] = "Archived messages";
$_['text_archiving_rules'] = "Archiving rules";
$_['text_attachment'] = "Attachment";
$_['text_attachment_name'] = "Attachment name";
$_['text_attachment_size'] = "Attachment size";
$_['text_attachment_type'] = "Attachment type";
$_['text_audit'] = "Audit";

View File

@ -26,6 +26,7 @@ $_['text_archive_size'] = "Tamaño de archivo";
$_['text_archived_messages'] = "Mensajes archivados";
$_['text_archiving_rules'] = "Reglas de archivado";
$_['text_attachment'] = "Adjunto";
$_['text_attachment_name'] = "Nombre de adjunto";
$_['text_attachment_size'] = "Tamaño de adjunto";
$_['text_attachment_type'] = "Tipo de adjunto";
$_['text_audit'] = "Auditar";

View File

@ -27,6 +27,7 @@ $_['text_archive_size_before_compression'] = "Arch
$_['text_archived_messages'] = "Archivált levelek";
$_['text_archiving_rules'] = "Archiválási szabályok";
$_['text_attachment'] = "Melléklet";
$_['text_attachment_name'] = "Melléklet név";
$_['text_attachment_size'] = "Melléklet méret";
$_['text_attachment_type'] = "Melléklet típus";
$_['text_audit'] = "Audit";

View File

@ -27,6 +27,7 @@ $_['text_archive_size_before_compression'] = "Archívum méret tömörítés né
$_['text_archived_messages'] = "Archivált levelek";
$_['text_archiving_rules'] = "Archiválási szabályok";
$_['text_attachment'] = "Melléklet";
$_['text_attachment_name'] = "Melléklet név";
$_['text_attachment_size'] = "Melléklet méret";
$_['text_attachment_type'] = "Melléklet típus";
$_['text_audit'] = "Audit";

View File

@ -25,6 +25,7 @@ $_['text_archive_size'] = "Tamanho do arquivo";
$_['text_archived_messages'] = "Mensagens arquivadas";
$_['text_archiving_rules'] = "Regras de não arquivamento";
$_['text_attachment'] = "Anexo";
$_['text_attachment_name'] = "Nome do anexo";
$_['text_attachment_size'] = "Tamanho do anexo";
$_['text_attachment_type'] = "Tipo de anexo";
$_['text_audit'] = "Auditoria";

View File

@ -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_type`,`_attachment_size`,`attachment_size`,`spam`) VALUES(?,?,?,?,?,?,?,?,?)", array($data['from'], $data['to'], $data['subject'], $data['_size'], $data['size'], $data['attachment_type'], $data['_attachment_size'], $data['attachment_size'], $data['spam']));
$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']));
return $this->db->countAffected();
}

View File

@ -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_type`,`_attachment_size`,`attachment_size`,`spam`,`days`) VALUES(?,?,?,?,?,?,?,?,?,?,?)", array($domain, $data['from'], $data['to'], $data['subject'], $data['_size'], $data['size'], $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`,`_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']) );
return $this->db->countAffected();
}

View File

@ -36,7 +36,13 @@
</select>
<input type="text" class="ruletext" name="size" />
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="attachment_name"><?php print $text_attachment_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="attachment_name" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="attachment_type"><?php print $text_attachment_type; ?>:</label>
<div class="controls">
@ -85,6 +91,7 @@
<th><?php print $text_subject; ?></th>
<th><?php print $text_spam; ?></th>
<th><?php print $text_size; ?></th>
<th><?php print $text_attachment_name; ?></th>
<th><?php print $text_attachment_type; ?></th>
<th><?php print $text_attachment_size; ?></th>
<th>&nbsp;</th>
@ -97,6 +104,7 @@
<td><?php print $rule['subject']; ?></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>
<td><?php print $rule['attachment_type']; ?></td>
<td><?php if($rule['attachment_size'] > 0) { print $rule['_attachment_size']; ?> <?php print $rule['attachment_size']; } ?></td>
<td><a href="index.php?route=policy/removearchiving&amp;id=<?php print $rule['id']; ?>"><?php print $text_remove; ?></a></td>

View File

@ -46,7 +46,13 @@
</select>
<input type="text" class="ruletext" name="size" />
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="attachment_name"><?php print $text_attachment_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="attachment_name" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="attachment_type"><?php print $text_attachment_type; ?>:</label>
<div class="controls">
@ -100,6 +106,7 @@
<th><?php print $text_subject; ?></th>
<th><?php print $text_spam; ?></th>
<th><?php print $text_size; ?></th>
<th><?php print $text_attachment_name; ?></th>
<th><?php print $text_attachment_type; ?></th>
<th><?php print $text_attachment_size; ?></th>
<th><?php print $text_days; ?></th>
@ -119,6 +126,7 @@
<td><?php print $rule['subject']; ?></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>
<td><?php print $rule['attachment_type']; ?></td>
<td><?php if($rule['attachment_size'] > 0) { print $rule['_attachment_size']; ?> <?php print $rule['attachment_size']; } ?></td>
<td><?php print $rule['days']; ?></td>

View File

@ -34,6 +34,10 @@
<input type="text" name="size" class="input-medium span4" />
</div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_attachment_name; ?>:</div>
<div class="domaincell"><input type="text" name="attachment_name" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_attachment_type; ?>:</div>
<div class="domaincell"><input type="text" name="attachment_type" class="input-medium span5" /></div>
@ -85,6 +89,7 @@
<div class="domaincell"><?php print $text_subject; ?></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>
<div class="domaincell"><?php print $text_attachment_type; ?></div>
<div class="domaincell"><?php print $text_attachment_size; ?></div>
<div class="domaincell">&nbsp;</div>
@ -97,6 +102,7 @@
<div class="domaincell"><?php print $rule['subject']; ?></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>
<div class="domaincell"><?php print $rule['attachment_type']; ?></div>
<div class="domaincell"><?php if($rule['attachment_size'] > 0) { print $rule['_attachment_size']; ?> <?php print $rule['attachment_size']; } ?></div>
<div class="domaincell"><a href="index.php?route=policy/removearchiving&amp;confirmed=1&amp;id=<?php print $rule['id']; ?>" onclick="if(confirm('<?php print $text_remove_rule; ?>: ' + '#<?php print $rule['id']; ?>')) return true; return false;"><?php print $text_remove; ?></a></div>

View File

@ -40,6 +40,10 @@
<input type="text" name="size" class="input-medium span4" />
</div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_attachment_name; ?>:</div>
<div class="domaincell"><input type="text" name="attachment_name" class="input-medium span5" /></div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_attachment_type; ?>:</div>
<div class="domaincell"><input type="text" name="attachment_type" class="input-medium span5" /></div>
@ -98,6 +102,7 @@
<div class="domaincell"><?php print $text_subject; ?></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>
<div class="domaincell"><?php print $text_attachment_type; ?></div>
<div class="domaincell"><?php print $text_attachment_size; ?></div>
<div class="domaincell"><?php print $text_days; ?></div>
@ -117,6 +122,7 @@
<div class="domaincell"><?php print $rule['subject']; ?></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>
<div class="domaincell"><?php print $rule['attachment_type']; ?></div>
<div class="domaincell"><?php if($rule['attachment_size'] > 0) { print $rule['_attachment_size']; ?> <?php print $rule['attachment_size']; } ?></div>
<div class="domaincell"><?php print $rule['days']; ?></div>