Skip to content

Commit 7de96bb

Browse files
committed
added form and list for spamfilter users.
1 parent dbd43c9 commit 7de96bb

11 files changed

+493
-2
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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"] = "Spamfilter users";
37+
$form["description"] = "";
38+
$form["name"] = "spamfilter_users";
39+
$form["action"] = "spamfilter_users_edit.php";
40+
$form["db_table"] = "spamfilter_users";
41+
$form["db_table_idx"] = "id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "users";
44+
$form["list_default"] = "spamfilter_users_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"]['users'] = array (
54+
'title' => "Users",
55+
'width' => 100,
56+
'template' => "templates/spamfilter_users_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'priority' => array (
73+
'datatype' => 'INTEGER',
74+
'formtype' => 'SELECT',
75+
'default' => 5,
76+
'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
77+
),
78+
'policy_id' => array (
79+
'datatype' => 'INTEGER',
80+
'formtype' => 'SELECT',
81+
'default' => '',
82+
'datasource' => array ( 'type' => 'SQL',
83+
'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
84+
'keyfield'=> 'id',
85+
'valuefield'=> 'policy_name'
86+
),
87+
'value' => ''
88+
),
89+
'email' => array (
90+
'datatype' => 'VARCHAR',
91+
'formtype' => 'TEXT',
92+
'default' => '',
93+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
94+
'errmsg'=> 'email_error_notempty'),
95+
),
96+
'value' => '',
97+
'width' => '30',
98+
'maxlength' => '255'
99+
),
100+
'fullname' => array (
101+
'datatype' => 'VARCHAR',
102+
'formtype' => 'TEXT',
103+
'default' => '',
104+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
105+
'errmsg'=> 'fullname_error_notempty'),
106+
),
107+
'value' => '',
108+
'width' => '30',
109+
'maxlength' => '255'
110+
),
111+
'local' => array (
112+
'datatype' => 'VARCHAR',
113+
'formtype' => 'SELECT',
114+
'default' => 'Y',
115+
'value' => array('N' => 'No','Y' => 'Yes')
116+
),
117+
118+
##################################
119+
# ENDE Datatable fields
120+
##################################
121+
)
122+
);
123+
124+
125+
?>

interface/web/mail/lib/lang/en_mail_user.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$wb["email_txt"] = 'email';
2+
$wb["email_txt"] = 'Email';
33
$wb["cryptpwd_txt"] = 'Password';
44
$wb["active_txt"] = 'Active';
55
$wb["btn_save_txt"] = 'Save';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Server';
3+
$wb["priority_txt"] = 'Priority';
4+
$wb["policy_id_txt"] = 'Policy';
5+
$wb["email_txt"] = 'Email (Pattern)';
6+
$wb["fullname_txt"] = 'Name';
7+
$wb["local_txt"] = 'Local';
8+
$wb["btn_save_txt"] = 'Save';
9+
$wb["btn_cancel_txt"] = 'Cancel';
10+
?>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Spamfilter Users';
3+
$wb["local_txt"] = 'Local';
4+
$wb["server_id_txt"] = 'Server';
5+
$wb["priority_txt"] = 'Priority';
6+
$wb["policy_id_txt"] = 'Policy';
7+
$wb["fullname_txt"] = 'Name';
8+
$wb["email_txt"] = 'Email';
9+
$wb["page_txt"] = 'Page';
10+
$wb["page_of_txt"] = 'of';
11+
$wb["page_next_txt"] = 'Next';
12+
$wb["page_back_txt"] = 'Back';
13+
$wb["delete_txt"] = 'Delete';
14+
$wb["filter_txt"] = 'Filter';
15+
$wb["add_new_record_txt"] = 'Add Spamfilter User';
16+
?>

interface/web/mail/lib/module.conf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
array (
9595
'title' => 'User',
9696
'target' => 'content',
97-
'link' => 'mail/spamfilter_user_list.php',
97+
'link' => 'mail/spamfilter_users_list.php',
9898
),
9999
3 =>
100100
array (
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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"] = "spamfilter_users";
17+
18+
// Database table
19+
$liste["table"] = "spamfilter_users";
20+
21+
// Index index field of the database table
22+
$liste["table_idx"] = "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"] = "spamfilter_users_list.php";
32+
33+
// Script file of the edit form
34+
$liste["edit_file"] = "spamfilter_users_edit.php";
35+
36+
// Script File of the delete script
37+
$liste["delete_file"] = "spamfilter_users_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' => "local",
51+
'datatype' => "VARCHAR",
52+
'formtype' => "SELECT",
53+
'op' => "=",
54+
'prefix' => "",
55+
'suffix' => "",
56+
'width' => "",
57+
'value' => array('Y' => "Yes",'N' => "No"));
58+
59+
60+
$liste["item"][] = array( 'field' => "server_id",
61+
'datatype' => "VARCHAR",
62+
'formtype' => "SELECT",
63+
'op' => "like",
64+
'prefix' => "%",
65+
'suffix' => "%",
66+
'datasource' => array ( 'type' => 'SQL',
67+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
68+
'keyfield'=> 'server_id',
69+
'valuefield'=> 'server_name'
70+
),
71+
'width' => "",
72+
'value' => "");
73+
74+
75+
$liste["item"][] = array( 'field' => "priority",
76+
'datatype' => "VARCHAR",
77+
'formtype' => "SELECT",
78+
'op' => "=",
79+
'prefix' => "",
80+
'suffix' => "",
81+
'width' => "",
82+
'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
83+
84+
$liste["item"][] = array( 'field' => "policy_id",
85+
'datatype' => "VARCHAR",
86+
'formtype' => "SELECT",
87+
'op' => "like",
88+
'prefix' => "%",
89+
'suffix' => "%",
90+
'datasource' => array ( 'type' => 'SQL',
91+
'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
92+
'keyfield'=> 'id',
93+
'valuefield'=> 'policy_name'
94+
),
95+
'width' => "",
96+
'value' => "");
97+
98+
$liste["item"][] = array( 'field' => "fullname",
99+
'datatype' => "VARCHAR",
100+
'formtype' => "TEXT",
101+
'op' => "like",
102+
'prefix' => "%",
103+
'suffix' => "%",
104+
'width' => "",
105+
'value' => "");
106+
107+
108+
?>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2007, 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/spamfilter_users.list.php";
36+
$tform_def_file = "form/spamfilter_users.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+
// Checke Berechtigungen für Modul
46+
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
47+
header("Location: ../index.php");
48+
exit;
49+
}
50+
51+
$app->uses("tform_actions");
52+
$app->tform_actions->onDelete();
53+
54+
?>

0 commit comments

Comments
 (0)