Skip to content

Commit d1018a8

Browse files
committed
Added the form and list for mail filtering rules in the interface.
1 parent a171d63 commit d1018a8

12 files changed

+470
-39
lines changed

interface/web/mail/form/mail_user.tform.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,37 @@
177177
)
178178
);
179179

180+
$form["tabs"]['filter_records'] = array (
181+
'title' => "Mail Filter",
182+
'width' => 100,
183+
'template' => "templates/mail_user_mailfilter_edit.htm",
184+
'fields' => array (
185+
##################################
186+
# Begin Datatable fields
187+
##################################
188+
189+
##################################
190+
# ENDE Datatable fields
191+
##################################
192+
),
193+
'plugins' => array (
194+
'filter_records' => array (
195+
'class' => 'plugin_listview',
196+
'options' => array(
197+
'listdef' => 'list/mail_user_filter.list.php',
198+
'sqlextwhere' => "mailuser_id = ".@intval(@$_REQUEST['id']),
199+
'sql_order_by' => "ORDER BY rulename"
200+
)
201+
)
202+
)
203+
);
204+
180205
if($_SESSION["s"]["user"]["typ"] == 'admin') {
181206

182207
$form["tabs"]['mailfilter'] = array (
183-
'title' => "Mailfilter",
208+
'title' => "Custom Rules",
184209
'width' => 100,
185-
'template' => "templates/mail_user_mailfilter_edit.htm",
210+
'template' => "templates/mail_user_custom_rules_edit.htm",
186211
'fields' => array (
187212
##################################
188213
# Begin Datatable fields
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Email filter";
37+
$form["description"] = "";
38+
$form["name"] = "mail_user_filter";
39+
$form["action"] = "mail_user_filter_edit.php";
40+
$form["db_table"] = "mail_user_filter";
41+
$form["db_table_idx"] = "filter_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "filter";
44+
$form["list_default"] = "mail_user_filter_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['filter'] = array (
54+
'title' => "Filter",
55+
'width' => 100,
56+
'template' => "templates/mail_user_filter_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'mailuser_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'TEXT',
64+
'default' => @intval($_REQUEST["mailuser_id"]),
65+
'value' => '',
66+
'width' => '30',
67+
'maxlength' => '255'
68+
),
69+
'rulename' => array (
70+
'datatype' => 'VARCHAR',
71+
'formtype' => 'TEXT',
72+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
73+
'errmsg'=> 'rulename_error_empty'),
74+
),
75+
'default' => '',
76+
'value' => '',
77+
'width' => '30',
78+
'maxlength' => '255'
79+
),
80+
'source' => array (
81+
'datatype' => 'VARCHAR',
82+
'formtype' => 'SELECT',
83+
'default' => '',
84+
'value' => array('Subject' => 'Subject','From'=>'From','To'=>'To','Header'=>'Custom Header')
85+
),
86+
'op' => array (
87+
'datatype' => 'VARCHAR',
88+
'formtype' => 'SELECT',
89+
'default' => '',
90+
'value' => array('contains'=>'Contains','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
91+
),
92+
'searchterm' => array (
93+
'datatype' => 'VARCHAR',
94+
'formtype' => 'TEXT',
95+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
96+
'errmsg'=> 'searchterm_is_empty'),
97+
),
98+
'default' => '',
99+
'value' => '',
100+
'width' => '30',
101+
'maxlength' => '255'
102+
),
103+
'action' => array (
104+
'datatype' => 'VARCHAR',
105+
'formtype' => 'SELECT',
106+
'default' => '',
107+
'value' => array('move' => 'Move to','delete'=>'Delete')
108+
),
109+
'target' => array (
110+
'datatype' => 'VARCHAR',
111+
'formtype' => 'TEXT',
112+
'default' => '',
113+
'value' => '',
114+
'width' => '30',
115+
'maxlength' => '255'
116+
),
117+
'active' => array (
118+
'datatype' => 'VARCHAR',
119+
'formtype' => 'CHECKBOX',
120+
'default' => 'y',
121+
'value' => array(0 => 'n',1 => 'y')
122+
),
123+
##################################
124+
# ENDE Datatable fields
125+
##################################
126+
)
127+
);
128+
129+
130+
131+
?>
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
<?php
2-
$wb["custom_mailfilter_txt"] = 'custom_mailfilter';
3-
$wb["btn_save_txt"] = 'Save';
4-
$wb["btn_cancel_txt"] = 'Cancel';
5-
$wb["email_txt"] = 'Email';
6-
$wb["cryptpwd_txt"] = 'Password';
7-
$wb["active_txt"] = 'Active';
8-
$wb["email_error_isemail"] = 'Email address is invalid.';
9-
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
10-
$wb["autoresponder_text_txt"] = 'Text';
11-
$wb["autoresponder_txt"] = 'Autoresponder';
12-
$wb["no_domain_perm"] = 'You have no permission for this domain.';
13-
$wb["error_no_pwd"] = 'Password is empty.';
14-
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
15-
$wb["quota_txt"] = 'quota';
16-
$wb["server_id_txt"] = 'server_id';
17-
$wb["password_txt"] = 'password';
18-
$wb["maildir_txt"] = 'maildir';
19-
$wb["postfix_txt"] = 'Enable Receiving';
20-
$wb["access_txt"] = 'Enable Access';
21-
$wb["policy_txt"] = 'Spamfilter';
22-
$wb["no_policy"] = '- not enabled -';
23-
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
24-
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
25-
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
26-
$wb["welcome_mail_message"] = 'Welcome to your new email account.\n\nYour webmaster.';
27-
$wb['custom_mailfilter_txt'] = 'Custom mail filter recipe';
1+
<?php
2+
$wb["custom_mailfilter_txt"] = 'Custom mail filter recipe';
3+
$wb["btn_save_txt"] = 'Save';
4+
$wb["btn_cancel_txt"] = 'Cancel';
5+
$wb["email_txt"] = 'Email';
6+
$wb["cryptpwd_txt"] = 'Password';
7+
$wb["active_txt"] = 'Active';
8+
$wb["email_error_isemail"] = 'Email address is invalid.';
9+
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
10+
$wb["autoresponder_text_txt"] = 'Text';
11+
$wb["autoresponder_txt"] = 'Autoresponder';
12+
$wb["no_domain_perm"] = 'You have no permission for this domain.';
13+
$wb["error_no_pwd"] = 'Password is empty.';
14+
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
15+
$wb["quota_txt"] = 'quota';
16+
$wb["server_id_txt"] = 'server_id';
17+
$wb["password_txt"] = 'password';
18+
$wb["maildir_txt"] = 'maildir';
19+
$wb["postfix_txt"] = 'Enable Receiving';
20+
$wb["access_txt"] = 'Enable Access';
21+
$wb["policy_txt"] = 'Spamfilter';
22+
$wb["no_policy"] = '- not enabled -';
23+
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
24+
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
25+
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
26+
$wb["welcome_mail_message"] = 'Welcome to your new email account.\n\nYour webmaster.';
2827
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$wb["rulename_txt"] = 'Name';
3+
$wb["action_txt"] = 'Action';
4+
$wb["target_txt"] = 'Folder';
5+
$wb["active_txt"] = 'Active';
6+
$wb["btn_save_txt"] = 'Save';
7+
$wb["btn_cancel_txt"] = 'Cancel';
8+
$wb["rulename_error_empty"] = 'Name is empty.';
9+
$wb["searchterm_is_empty"] = 'Search term is empty.';
10+
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$wb["rulename_txt"] = 'Name';
3+
$wb["page_txt"] = 'Page';
4+
$wb["page_of_txt"] = 'of';
5+
$wb["page_next_txt"] = 'Next';
6+
$wb["page_back_txt"] = 'Back';
7+
$wb["delete_txt"] = 'Delete';
8+
$wb["filter_txt"] = 'Filter';
9+
$wb["add_new_record_txt"] = 'Add new Filter';
10+
?>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/*
4+
Datatypes:
5+
- INTEGER
6+
- DOUBLE
7+
- CURRENCY
8+
- VARCHAR
9+
- TEXT
10+
- DATE
11+
*/
12+
13+
14+
15+
// Name of the list
16+
$liste["name"] = "mail_user_filter";
17+
18+
// Database table
19+
$liste["table"] = "mail_user_filter";
20+
21+
// Index index field of the database table
22+
$liste["table_idx"] = "filter_id";
23+
24+
// Search Field Prefix
25+
$liste["search_prefix"] = "search_";
26+
27+
// Records per page
28+
$liste["records_per_page"] = 15;
29+
30+
// Script File of the list
31+
$liste["file"] = "mail_user_filter_list.php";
32+
33+
// Script file of the edit form
34+
$liste["edit_file"] = "mail_user_filter_edit.php";
35+
36+
// Script File of the delete script
37+
$liste["delete_file"] = "mail_user_filter_del.php";
38+
39+
// Paging Template
40+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
41+
42+
// Enable auth
43+
$liste["auth"] = "yes";
44+
45+
46+
/*****************************************************
47+
* Suchfelder
48+
*****************************************************/
49+
50+
$liste["item"][] = array( 'field' => "rulename",
51+
'datatype' => "VARCHAR",
52+
'formtype' => "TEXT",
53+
'op' => "like",
54+
'prefix' => "%",
55+
'suffix' => "%",
56+
'width' => "",
57+
'value' => "");
58+
59+
60+
?>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of ISPConfig nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
/******************************************
32+
* Begin Form configuration
33+
******************************************/
34+
35+
$list_def_file = "list/mail_user_filter.list.php";
36+
$tform_def_file = "form/mail_user_filter.tform.php";
37+
38+
/******************************************
39+
* End Form configuration
40+
******************************************/
41+
42+
require_once('../../lib/config.inc.php');
43+
require_once('../../lib/app.inc.php');
44+
45+
//* Check permissions for module
46+
$app->auth->check_module_permissions('mail');
47+
48+
$app->uses("tform_actions");
49+
$app->tform_actions->onDelete();
50+
51+
?>

0 commit comments

Comments
 (0)