added retention rules to piler core

This commit is contained in:
SJ 2012-02-19 22:59:47 +01:00
parent e51af89e5d
commit 020756fa1c
24 changed files with 181 additions and 59 deletions

25
LICENSE
View File

@ -1,19 +1,16 @@
Copyright (C) 2011, SJ <sj@acts.hu>
piler, an enterprise level email archiving application
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Copyright (C) 2012, Janos SUTO <sj@acts.hu>
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
3. This notice may not be removed or altered from any source distribution.

View File

@ -11,6 +11,12 @@ verbosity=1
; it it was started by root
username=piler
; by default (unless a specific retention rule applies),
; preserve an email for this many days. The purge utility
; won't harm the message until its retention days are gone.
; The default is 7 years + 2 days (=7*365+2=2557 days)
default_retention_days=2557
; this is a 16 character long vector
iv=****************

View File

@ -63,6 +63,7 @@ struct _parse_rule config_parse_rules[] =
{ "clamd_addr", "string", (void*) string_parser, offsetof(struct __config, clamd_addr), "", MAXVAL-1},
{ "clamd_port", "integer", (void*) int_parser, offsetof(struct __config, clamd_port), "0", sizeof(int)},
{ "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1},
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
{ "listen_addr", "string", (void*) string_parser, offsetof(struct __config, listen_addr), "127.0.0.1", MAXVAL-1},

View File

@ -47,6 +47,8 @@ struct __config {
char spam_header_line[MAXVAL];
int default_retention_days;
// mysql stuff
char mysqlhost[MAXVAL];

View File

@ -78,6 +78,7 @@
#define SQL_ATTACHMENT_TABLE "attachment"
#define SQL_RECIPIENT_TABLE "rcpt"
#define SQL_ARCHIVING_RULE_TABLE "archiving_rule"
#define SQL_RETENTION_RULE_TABLE "retention_rule"
#define SQL_COUNTER_TABLE "counter"
#define SQL_MESSAGES_VIEW "messages"

View File

@ -93,13 +93,17 @@ struct rule {
regex_t subject;
regex_t attachment_type;
#endif
int spam;
int size;
char _size[4];
int attachment_size;
char _attachment_size[4];
int days;
char *rulestr;
char compiled;
struct rule *r;
};
@ -165,7 +169,7 @@ struct session_data {
float __acquire, __parsed, __av, __store, __compress, __encrypt;
char bodydigest[2*DIGEST_LENGTH+1];
char digest[2*DIGEST_LENGTH+1];
time_t now, sent;
time_t now, sent, retained;
#ifdef NEED_MYSQL
MYSQL mysql;
#endif
@ -217,7 +221,8 @@ struct memcached_server {
struct __data {
#ifdef HAVE_TRE
struct rule *rules;
struct rule *archiving_rules;
struct rule *retention_rules;
#endif
#ifdef HAVE_MEMCACHED

View File

@ -278,7 +278,7 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __c
subj = state->b_subject;
if(*subj == ' ') subj++;
snprintf(s, sizeof(s)-1, "%llu+%s%s%s%ld%ld%d%d%d%d%s%s%s", id, subj, state->b_from, state->message_id, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, sdata->digest, sdata->bodydigest);
snprintf(s, sizeof(s)-1, "%llu+%s%s%s%ld%ld%ld%d%d%d%d%s%s%s", id, subj, state->b_from, state->message_id, sdata->now, sdata->sent, sdata->retained, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, sdata->digest, sdata->bodydigest);
digest_string(s, &vcode[0]);
@ -286,7 +286,7 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __c
if(strlen(state->reference) > 10) digest_string(state->reference, &ref[0]);
snprintf(s, MAXBUFSIZE-1, "INSERT INTO %s (`from`,`fromdomain`,`subject`,`spam`,`arrived`,`sent`,`size`,`hlen`,`direction`,`attachments`,`piler_id`,`message_id`,`reference`,`digest`,`bodydigest`,`vcode`) VALUES(?,?,?,%d,%ld,%ld,%d,%d,%d,%d,'%s',?,'%s','%s','%s','%s')", SQL_METADATA_TABLE, sdata->spam_message, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, ref, sdata->digest, sdata->bodydigest, vcode);
snprintf(s, MAXBUFSIZE-1, "INSERT INTO %s (`from`,`fromdomain`,`subject`,`spam`,`arrived`,`sent`,`retained`,`size`,`hlen`,`direction`,`attachments`,`piler_id`,`message_id`,`reference`,`digest`,`bodydigest`,`vcode`) VALUES(?,?,?,%d,%ld,%ld,%ld,%d,%d,%d,%d,'%s',?,'%s','%s','%s','%s')", SQL_METADATA_TABLE, sdata->spam_message, sdata->now, sdata->sent, sdata->retained, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, ref, sdata->digest, sdata->bodydigest, vcode);
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: meta sql: *%s*", sdata->ttmpfile, s);
@ -412,6 +412,8 @@ int process_message(struct session_data *sdata, struct _state *state, struct __d
}
sdata->retained += query_retain_period(data->retention_rules, state, sdata->tot_len, sdata->spam_message, cfg);
rc = store_meta_data(sdata, state, cfg);
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored metadata, rc=%d", sdata->ttmpfile, rc);
if(rc == ERR_EXISTS) return ERR_EXISTS;

View File

@ -405,7 +405,7 @@ void init_session_data(struct session_data *sdata){
for(i=0; i<MAX_RCPT_TO; i++) memset(sdata->rcptto[i], 0, SMALLBUFSIZE);
time(&(sdata->now));
sdata->sent = sdata->now;
sdata->sent = sdata->retained = sdata->now;
}

View File

@ -238,7 +238,8 @@ void clean_exit(){
kill_children(SIGTERM);
free_rule(data.rules);
free_rule(data.archiving_rules);
free_rule(data.retention_rules);
syslog(LOG_PRIORITY, "%s has been terminated", PROGNAME);
@ -282,8 +283,11 @@ void initialise_configuration(){
setlocale(LC_CTYPE, cfg.locale);
free_rule(data.rules);
data.rules = NULL;
free_rule(data.archiving_rules);
free_rule(data.retention_rules);
data.archiving_rules = NULL;
data.retention_rules = NULL;
mysql_init(&(sdata.mysql));
mysql_options(&(sdata.mysql), MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&cfg.mysql_connect_timeout);
@ -292,7 +296,8 @@ void initialise_configuration(){
return;
}
load_archiving_rules(&sdata, &(data.rules));
load_rules(&sdata, &(data.archiving_rules), SQL_ARCHIVING_RULE_TABLE);
load_rules(&sdata, &(data.retention_rules), SQL_RETENTION_RULE_TABLE);
mysql_close(&(sdata.mysql));
@ -334,7 +339,8 @@ int main(int argc, char **argv){
(void) openlog(PROGNAME, LOG_PID, LOG_MAIL);
data.rules = NULL;
data.archiving_rules = NULL;
data.retention_rules = NULL;
initialise_configuration();

View File

@ -228,14 +228,15 @@ int main(int argc, char **argv){
{"to", required_argument, 0, 'r' },
{"start-date", required_argument, 0, 'a' },
{"stop-date", required_argument, 0, 'b' },
{"id", required_argument, 0, 'i' },
{0,0,0,0}
};
int option_index = 0;
c = getopt_long(argc, argv, "c:s:S:f:r:a:b:Adhv?", long_options, &option_index);
c = getopt_long(argc, argv, "c:s:S:f:r:a:b:i:Adhv?", long_options, &option_index);
#else
c = getopt(argc, argv, "c:s:S:f:r:a:b:Adhv?");
c = getopt(argc, argv, "c:s:S:f:r:a:b:i:Adhv?");
#endif
if(c == -1) break;

View File

@ -50,7 +50,11 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
if(sdata->sent > sdata->now) sdata->sent = sdata->now;
if(sdata->sent == -1) sdata->sent = 0;
rule = check_againt_ruleset(data->rules, &state, st.st_size);
/* fat chances that you won't import emails before 1990.01.01 */
if(sdata->sent > 631148400) sdata->retained = sdata->sent;
rule = check_againt_ruleset(data->archiving_rules, &state, st.st_size, sdata->spam_message);
if(rule){
printf("discarding %s by archiving policy: %s\n", filename, rule);
@ -230,9 +234,11 @@ int main(int argc, char **argv){
setlocale(LC_CTYPE, cfg.locale);
data.rules = NULL;
data.archiving_rules = NULL;
data.retention_rules = NULL;
load_archiving_rules(&sdata, &(data.rules));
load_rules(&sdata, &(data.archiving_rules), SQL_ARCHIVING_RULE_TABLE);
load_rules(&sdata, &(data.retention_rules), SQL_RETENTION_RULE_TABLE);
@ -242,7 +248,8 @@ int main(int argc, char **argv){
free_rule(data.rules);
free_rule(data.archiving_rules);
free_rule(data.retention_rules);
mysql_close(&(sdata.mysql));

View File

@ -10,18 +10,18 @@
#include "rules.h"
void load_archiving_rules(struct session_data *sdata, struct rule **rules){
void load_rules(struct session_data *sdata, struct rule **rules, char *table){
char s[SMALLBUFSIZE];
MYSQL_RES *res;
MYSQL_ROW row;
snprintf(s, sizeof(s)-1, "SELECT `from`, `to`, `subject`, `_size`, `size`, `attachment_type`, `_attachment_size`, `attachment_size` FROM `%s`", SQL_ARCHIVING_RULE_TABLE);
snprintf(s, sizeof(s)-1, "SELECT `from`, `to`, `subject`, `_size`, `size`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table);
if(mysql_real_query(&(sdata->mysql), s, strlen(s)) == 0){
res = mysql_store_result(&(sdata->mysql));
if(res != NULL){
while((row = mysql_fetch_row(res))){
append_rule(rules, (char*)row[0], (char*)row[1], (char*)row[2], (char*)row[3], atoi(row[4]), (char*)row[5], (char*)row[6], atoi(row[7]));
append_rule(rules, (char*)row[0], (char*)row[1], (char*)row[2], (char*)row[3], atoi(row[4]), (char*)row[5], (char*)row[6], atoi(row[7]), atoi(row[8]), atoi(row[9]));
}
mysql_free_result(res);
@ -32,7 +32,7 @@ void load_archiving_rules(struct session_data *sdata, struct rule **rules){
}
int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size){
int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days){
struct rule *q, *t, *u=NULL;
q = *rule;
@ -42,7 +42,7 @@ int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_
q = q->r;
}
t = create_rule_item(from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size);
t = create_rule_item(from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days);
if(t){
if(*rule == NULL)
*rule = t;
@ -56,7 +56,7 @@ int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_
}
struct rule *create_rule_item(char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size){
struct rule *create_rule_item(char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days){
struct rule *h=NULL;
char empty = '\0';
int len;
@ -76,6 +76,9 @@ struct rule *create_rule_item(char *from, char *to, char *subject, char *_size,
if(!subject) subject = &empty;
if(regcomp(&(h->subject), subject, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
h->spam = spam;
h->days = days;
h->size = size;
if(!_size) _size = &empty;
@ -91,12 +94,12 @@ struct rule *create_rule_item(char *from, char *to, char *subject, char *_size,
if(!_attachment_size) _attachment_size = &empty;
snprintf(h->_attachment_size, 3, "%s", _attachment_size);
len = strlen(from)+6 + strlen(to)+4 + strlen(subject)+9 + strlen(_size)+6 + strlen(attachment_type)+10 + strlen(_attachment_size)+10 + 15 + 15;
len = strlen(from)+6 + strlen(to)+4 + strlen(subject)+9 + strlen(_size)+6 + strlen(attachment_type)+10 + strlen(_attachment_size)+10 + 8 + 15 + 15;
h->rulestr = malloc(len);
if(h->rulestr) snprintf(h->rulestr, len-1, "from=%s,to=%s,subject=%s,size%s%d,att.type=%s,att.size%s%d", from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size);
if(h->rulestr) snprintf(h->rulestr, len-1, "from=%s,to=%s,subject=%s,size%s%d,att.type=%s,att.size%s%d,spam=%d", from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam);
else h->compiled = 0;
h->r = NULL;
@ -105,7 +108,7 @@ struct rule *create_rule_item(char *from, char *to, char *subject, char *_size,
}
char *check_againt_ruleset(struct rule *rule, struct _state *state, int size){
char *check_againt_ruleset(struct rule *rule, struct _state *state, int size, int spam){
size_t nmatch=0;
struct rule *p;
@ -119,7 +122,8 @@ char *check_againt_ruleset(struct rule *rule, struct _state *state, int size){
regexec(&(p->to), state->b_to, nmatch, NULL, 0) == 0 &&
regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0 &&
check_size_rule(size, p->size, p->_size) == 1 &&
check_attachment_rule(state, p) == 1
check_attachment_rule(state, p) == 1 &&
check_spam_rule(spam, p->spam) == 1
){
return p->rulestr;
}
@ -131,6 +135,33 @@ char *check_againt_ruleset(struct rule *rule, struct _state *state, int size){
}
unsigned long query_retain_period(struct rule *rule, struct _state *state, int size, int spam, struct __config *cfg){
size_t nmatch=0;
struct rule *p;
p = rule;
while(p != NULL){
if(
p->compiled == 1 &&
regexec(&(p->from), state->b_from, nmatch, NULL, 0) == 0 &&
regexec(&(p->to), state->b_to, nmatch, NULL, 0) == 0 &&
regexec(&(p->subject), state->b_subject, nmatch, NULL, 0) == 0 &&
check_size_rule(size, p->size, p->_size) == 1 &&
check_attachment_rule(state, p) == 1 &&
check_spam_rule(spam, p->spam) == 1
){
return p->days * 86400;
}
p = p->r;
}
return cfg->default_retention_days * 86400;
}
int check_size_rule(int message_size, int size, char *_size){
if(size <= 0) return 1;
@ -143,6 +174,13 @@ int check_size_rule(int message_size, int size, char *_size){
}
int check_spam_rule(int is_spam, int spam){
if(spam == -1) return 1;
if(is_spam == spam) return 1;
return 0;
}
int check_attachment_rule(struct _state *state, struct rule *rule){
int i;
size_t nmatch=0;

View File

@ -7,11 +7,13 @@
#include "defs.h"
void load_archiving_rules(struct session_data *sdata, struct rule **rules);
int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size);
struct rule *create_rule_item(char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size);
char *check_againt_ruleset(struct rule *rule, struct _state *state, int size);
void load_rules(struct session_data *sdata, struct rule **rules, char *table);
int append_rule(struct rule **rule, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days);
struct rule *create_rule_item(char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days);
char *check_againt_ruleset(struct rule *rule, struct _state *state, int size, int spam);
unsigned long query_retain_period(struct rule *rule, struct _state *state, int size, int spam, struct __config *cfg);
int check_size_rule(int message_size, int size, char *_size);
int check_spam_rule(int is_spam, int spam);
int check_attachment_rule(struct _state *state, struct rule *rule);
void free_rule(struct rule *rule);

View File

@ -193,7 +193,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
/* check message against archiving rules */
arule = check_againt_ruleset(data->rules, &sstate, sdata.tot_len);
arule = check_againt_ruleset(data->archiving_rules, &sstate, sdata.tot_len, sdata.spam_message);
if(arule){
syslog(LOG_PRIORITY, "%s: discarding message by archiving policy: *%s*", sdata.ttmpfile, arule);

View File

@ -51,9 +51,11 @@ int main(int argc, char **argv){
printf("locale: %s\n", setlocale(LC_MESSAGES, cfg.locale));
setlocale(LC_CTYPE, cfg.locale);
data.rules = NULL;
data.archiving_rules = NULL;
data.retention_rules = NULL;
load_archiving_rules(&sdata, &(data.rules));
load_rules(&sdata, &(data.archiving_rules), SQL_ARCHIVING_RULE_TABLE);
load_rules(&sdata, &(data.retention_rules), SQL_RETENTION_RULE_TABLE);
rc = 0;
@ -82,13 +84,18 @@ int main(int argc, char **argv){
printf("hdr len: %d\n", sdata.hdr_len);
rule = check_againt_ruleset(data.rules, &state, st.st_size);
rule = check_againt_ruleset(data.archiving_rules, &state, st.st_size, sdata.spam_message);
printf("body digest: %s\n", sdata.bodydigest);
printf("rules check: %s\n", rule);
free_rule(data.rules);
sdata.retained = sdata.now + query_retain_period(data.retention_rules, &state, st.st_size, sdata.spam_message, &cfg);
printf("retention period: %ld\n", sdata.retained);
free_rule(data.archiving_rules);
free_rule(data.retention_rules);
for(i=1; i<=state.n_attachments; i++){
printf("i:%d, name=*%s*, type: *%s*, size: %d, int.name: %s, digest: %s\n", i, state.attachments[i].filename, state.attachments[i].type, state.attachments[i].size, state.attachments[i].internalname, state.attachments[i].digest);

View File

@ -38,6 +38,7 @@ create table if not exists `metadata` (
`spam` tinyint(1) default 0,
`arrived` int not null,
`sent` int not null,
`retained` int not null,
`deleted` tinyint(1) default 0,
`size` int default 0,
`hlen` int default 0,
@ -58,6 +59,7 @@ create index metadata_idx3 on metadata(`reference`);
create index metadata_idx4 on metadata(`bodydigest`);
create index metadata_idx5 on metadata(`deleted`);
create index metadata_idx6 on metadata(`arrived`);
create index metadata_idx7 on metadata(`retained`);
drop table if exists `rcpt`;
@ -113,8 +115,28 @@ create table if not exists `archiving_rule` (
`attachment_type` char(128) character set 'latin1' 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`)
unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
) ENGINE=InnoDB;
drop table if exists `retention_rule`;
create table if not exists `retention_rule` (
`id` bigint unsigned not null auto_increment,
`from` char(128) character set 'latin1' default null,
`to` char(255) character set 'latin1' default null,
`subject` char(255) character set 'latin1' default null,
`_size` char(2) default null,
`size` int default 0,
`attachment_type` char(128) character set 'latin1' 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`)
) ENGINE=InnoDB;

View File

@ -91,6 +91,7 @@ define('TABLE_DOMAIN', 'domain');
define('TABLE_COUNTER', 'counter');
define('TABLE_AUDIT', 'audit');
define('TABLE_ARCHIVING_RULE', 'archiving_rule');
define('TABLE_RETENTION_RULE', 'retention_rule');
define('VIEW_MESSAGES', 'messages');
define('SPHINX_DRIVER', 'sphinx');

View File

@ -21,16 +21,16 @@ class ControllerPolicyArchiving extends Controller {
$this->data['rules'] = array();
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);
}
$this->data['rules'] = $this->model_policy_archiving->get_rules();
//print_r($this->data['rules']);
$this->render();
}

View File

@ -170,6 +170,7 @@ $_['text_non_existent_queue_directory'] = "The queue directory you have specifie
$_['text_non_existing_user'] = "Non existing user";
$_['text_not_found'] = "Not found";
$_['text_not_running'] = "not running";
$_['text_not_spam'] = "not spam";
$_['title_not_found'] = "Page not found";
$_['text_number_of_messages_in_quarantine'] = "Number of messages in the quarantine matching your search criteria";
$_['text_number_of_spam_messages_in_quarantine'] = "Number of spam messages in the quarantine matching your search criteria";
@ -239,6 +240,8 @@ $_['text_simple'] = "Simple";
$_['text_simple_search'] = "Simple search";
$_['text_size'] = "Size";
$_['text_smtp_status'] = "SMTP status";
$_['text_spam'] = "Spam";
$_['text_spam2'] = "spam";
$_['text_statistics'] = "Statistics";
$_['text_status'] = "Status";
$_['text_subject'] = "Subject";

View File

@ -171,6 +171,7 @@ $_['text_non_existent_queue_directory'] = "A megadott queue k
$_['text_non_existing_user'] = "Nem létező felhasználó";
$_['text_not_found'] = "Nincs találat";
$_['text_not_running'] = "nem fut";
$_['text_not_spam'] = "nem spam";
$_['title_not_found'] = "Az oldal nem található";
$_['text_number_of_messages_in_quarantine'] = "A keresési feltételnek megfelelő üzenetek száma a karanténban";
$_['text_number_of_spam_messages_in_quarantine'] = "A keresési feltételnek megfelelő spam üzenetek száma a karanténban";
@ -240,6 +241,8 @@ $_['text_simple'] = "Egyszer
$_['text_simple_search'] = "Egyszerű keresés";
$_['text_size'] = "Méret";
$_['text_smtp_status'] = "SMTP státusz";
$_['text_spam'] = "Spam";
$_['text_spam2'] = "spam";
$_['text_statistics'] = "Statisztika";
$_['text_status'] = "Státusz";
$_['text_subject'] = "Tárgy";

View File

@ -171,6 +171,7 @@ $_['text_non_existent_queue_directory'] = "A megadott queue könyvtár nem léte
$_['text_non_existing_user'] = "Nem létező felhasználó";
$_['text_not_found'] = "Nincs találat";
$_['text_not_running'] = "nem fut";
$_['text_not_spam'] = "nem spam";
$_['title_not_found'] = "Az oldal nem található";
$_['text_number_of_messages_in_quarantine'] = "A keresési feltételnek megfelelő üzenetek száma a karanténban";
$_['text_number_of_spam_messages_in_quarantine'] = "A keresési feltételnek megfelelő spam üzenetek száma a karanténban";
@ -240,6 +241,8 @@ $_['text_simple'] = "Egyszerű";
$_['text_simple_search'] = "Egyszerű keresés";
$_['text_size'] = "Méret";
$_['text_smtp_status'] = "SMTP státusz";
$_['text_spam'] = "Spam";
$_['text_spam2'] = "spam";
$_['text_statistics'] = "Statisztika";
$_['text_status'] = "Státusz";
$_['text_subject'] = "Tárgy";

View File

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

View File

@ -11,10 +11,11 @@
<div class="mcell" style="width: 350px; border: 0px solid red;">
<ul class="dropdown">
<li class="search_li" style="padding: 0;"><a href="search.php"<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "search.php")){ ?> id="active"<?php } ?>><?php print $text_simple_search; ?></a> | </li>
<li class="search_li" style="padding: 0; padding-left: 2px;"><a href="advanced.php"<?php if(strstr($_SERVER['REQUEST_URI'], "advanced.php")){ ?> id="active"<?php } ?>><?php print $text_advanced_search; ?></a> | </li>
<li class="search_li" style=""><a href="search.php"<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "search.php")){ ?> id="active"<?php } ?>><?php print $text_simple; ?></a> / </li>
<li class="search_li" style=""><a href="advanced.php"<?php if(strstr($_SERVER['REQUEST_URI'], "advanced.php")){ ?> id="active"<?php } ?>><?php print $text_advanced; ?></a></li>
<li class="no_search_li" style=""><?php print $text_search2; ?> | </li>
<li class="search_li" style="padding:0; padding-left: 2px;"><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "stat/") || strstr($_SERVER['QUERY_STRING'], "health/") || strstr($_SERVER['QUERY_STRING'], "audit/") ) { ?> id="active"<?php } ?>><?php print $text_monitor; ?></a> |
<li class="search_li" style=""><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "stat/") || strstr($_SERVER['QUERY_STRING'], "health/") || strstr($_SERVER['QUERY_STRING'], "audit/") ) { ?> id="active"<?php } ?>><?php print $text_monitor; ?></a> |
<ul class="sub_menu">
<li><a href="index.php?route=stat/stat&timespan=daily"><?php print $text_statistics; ?></a></li>
<li><a href="index.php?route=health/health"><?php print $text_health; ?></a></li>
@ -22,7 +23,7 @@
</ul>
</li>
<li class="search_li" style="padding:0; padding-left: 2px;"><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "domain/") || ($_SERVER['QUERY_STRING'] != "route=user/settings" && strstr($_SERVER['QUERY_STRING'], "user/")) || strstr($_SERVER['QUERY_STRING'], "policy/") || strstr($_SERVER['QUERY_STRING'], "import/")) { ?> id="active"<?php } ?>><?php print $text_administration; ?></a>
<li class="search_li" style=""><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "domain/") || ($_SERVER['QUERY_STRING'] != "route=user/settings" && strstr($_SERVER['QUERY_STRING'], "user/")) || strstr($_SERVER['QUERY_STRING'], "policy/") || strstr($_SERVER['QUERY_STRING'], "import/")) { ?> id="active"<?php } ?>><?php print $text_administration; ?></a>
<ul class="sub_menu">
<li><a href="index.php?route=user/list"><?php print $text_user_management; ?></a></li>
<li><a href="index.php?route=domain/domain"><?php print $text_domain; ?></a></li>

View File

@ -43,6 +43,18 @@
<input type="text" class="ruletext" name="attachment_size" />
</div>
</div>
<div class="row">
<div class="domaincell"><?php print $text_spam; ?>:</div>
<div class="domaincell">
<select class="ruleselect" name="spam">
<option value="-1">-</option>
<option value="0"><?php print $text_not_spam; ?></option>
<option value="1"><?php print $text_spam2; ?></option>
</select>
<input type="text" class="ruletext" name="attachment_size" />
</div>
</div>
<div class="row">
<div class="domaincell">&nbsp;</div>
@ -58,11 +70,12 @@
<?php if(isset($rules)){ ?>
<div id="ss1" style="margin-top: 10px; width: 600px; border: 1px solid red;">
<div id="ss1" style="margin-top: 10px; border: 1px solid red;">
<div class="domainrow">
<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_spam; ?></div>
<div class="domaincell"><?php print $text_size; ?></div>
<div class="domaincell"><?php print $text_attachment_type; ?></div>
<div class="domaincell"><?php print $text_attachment_size; ?></div>
@ -74,6 +87,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 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_type']; ?></div>
<div class="domaincell"><?php if($rule['attachment_size'] > 0) { print $rule['_attachment_size']; ?> <?php print $rule['attachment_size']; } ?></div>