Skip to content

Commit 8651ee8

Browse files
committed
- Added form and list for firewalls
- added server module for firewall and database.
1 parent 7120b51 commit 8651ee8

File tree

11 files changed

+478
-3
lines changed

11 files changed

+478
-3
lines changed
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/firewall.list.php";
36+
$tform_def_file = "form/firewall.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('admin');
47+
48+
$app->uses("tform_actions");
49+
$app->tform_actions->onDelete();
50+
51+
?>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/*
3+
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
31+
/******************************************
32+
* Begin Form configuration
33+
******************************************/
34+
35+
$tform_def_file = "form/firewall.tform.php";
36+
37+
/******************************************
38+
* End Form configuration
39+
******************************************/
40+
41+
require_once('../../lib/config.inc.php');
42+
require_once('../../lib/app.inc.php');
43+
44+
//* Check permissions for module
45+
$app->auth->check_module_permissions('admin');
46+
47+
// Loading classes
48+
$app->uses('tpl,tform,tform_actions');
49+
$app->load('tform_actions');
50+
51+
class page_action extends tform_actions {
52+
53+
}
54+
55+
$page = new page_action;
56+
$page->onLoad();
57+
58+
?>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
require_once('../../lib/config.inc.php');
32+
require_once('../../lib/app.inc.php');
33+
34+
/******************************************
35+
* Begin Form configuration
36+
******************************************/
37+
38+
$list_def_file = "list/firewall.list.php";
39+
40+
/******************************************
41+
* End Form configuration
42+
******************************************/
43+
44+
//* Check permissions for module
45+
$app->auth->check_module_permissions('admin');
46+
47+
$app->uses('listform_actions');
48+
49+
$app->listform_actions->onLoad();
50+
51+
52+
?>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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"] = "Firewall";
37+
$form["description"] = "";
38+
$form["name"] = "firewall";
39+
$form["action"] = "firewall_edit.php";
40+
$form["db_table"] = "firewall";
41+
$form["db_table_idx"] = "firewall_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "firewall";
44+
$form["list_default"] = "firewall_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"]['firewall'] = array (
54+
'title' => "Firewall",
55+
'width' => 100,
56+
'template' => "templates/firewall_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
66+
'errmsg'=> 'firewall_error_unique'),
67+
),
68+
'datasource' => array ( 'type' => 'SQL',
69+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
70+
'keyfield'=> 'server_id',
71+
'valuefield'=> 'server_name'
72+
),
73+
'value' => ''
74+
),
75+
'tcp_port' => array (
76+
'datatype' => 'VARCHAR',
77+
'formtype' => 'TEXT',
78+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
79+
'regex' => '/^[\s0-9\,]{0,255}$/',
80+
'errmsg'=> 'tcp_ports_error_regex'),
81+
),
82+
'default' => '',
83+
'value' => '',
84+
'width' => '30',
85+
'maxlength' => '255'
86+
),
87+
'udp_port' => array (
88+
'datatype' => 'VARCHAR',
89+
'formtype' => 'TEXT',
90+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
91+
'regex' => '/^[\s0-9\,]{0,255}$/',
92+
'errmsg'=> 'tcp_ports_error_regex'),
93+
),
94+
'default' => '',
95+
'value' => '',
96+
'width' => '30',
97+
'maxlength' => '255'
98+
),
99+
'active' => array (
100+
'datatype' => 'VARCHAR',
101+
'formtype' => 'CHECKBOX',
102+
'default' => 'y',
103+
'value' => array(0 => 'n',1 => 'y')
104+
),
105+
##################################
106+
# ENDE Datatable fields
107+
##################################
108+
)
109+
);
110+
111+
112+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Server';
3+
$wb["tcp_port_txt"] = 'Open TCP ports';
4+
$wb["udp_port_txt"] = 'Open UDP ports';
5+
$wb["tcp_port_help_txt"] = 'Separated by comma';
6+
$wb["udp_port_help_txt"] = 'Separated by comma';
7+
$wb["active_txt"] = 'Active';
8+
$wb["btn_save_txt"] = 'Save';
9+
$wb["btn_cancel_txt"] = 'Cancel';
10+
$wb["firewall_error_unique"] = 'There is already a firewall record for this server.';
11+
?>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Firewall';
3+
$wb["active_txt"] = 'Active';
4+
$wb["server_id_txt"] = 'Server';
5+
$wb["tcp_port_txt"] = 'Open TCP ports';
6+
$wb["udp_port_txt"] = 'Open UDP ports';
7+
$wb["page_txt"] = 'Page';
8+
$wb["page_of_txt"] = 'of';
9+
$wb["page_next_txt"] = 'Next';
10+
$wb["page_back_txt"] = 'Back';
11+
$wb["delete_txt"] = 'Delete';
12+
$wb["filter_txt"] = 'Filter';
13+
$wb["add_new_record_txt"] = 'Add Firewall record';
14+
?>

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@
6868
$module['nav'][] = array( 'title' => 'Servers',
6969
'open' => 1,
7070
'items' => $items);
71+
// cleanup
72+
unset($items);
73+
74+
75+
$items[] = array( 'title' => 'Firewall',
76+
'target' => 'content',
77+
'link' => 'admin/firewall_list.php');
78+
79+
80+
$module['nav'][] = array( 'title' => 'Firewall',
81+
'open' => 1,
82+
'items' => $items);
7183

7284

7385
// cleanup
@@ -117,7 +129,7 @@
117129
'items' => $items);
118130

119131

120-
// aufr�umen
132+
// cleanup
121133
unset($items);
122134

123135
/*
@@ -135,7 +147,7 @@
135147
'items' => $items);
136148
137149
138-
// aufr�umen
150+
// cleanup
139151
unset($items);
140152
*/
141153

0 commit comments

Comments
 (0)