Skip to content

Commit ef55b57

Browse files
committed
- New feature: you can now add directive snippets for Apache, nginx, and PHP under System > Directive Snippets. These snippets are then available on the Options tab of a web site where they can be easily added to the respective textarea by simply clicking the name of the directive snippet.
1 parent cece69b commit ef55b57

21 files changed

+559
-3
lines changed

install/sql/incremental/upd_0040.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,23 @@
22
-- Removal of the domain module
33
UPDATE sys_user SET startmodule = 'dashboard' WHERE startmodule = 'domain';
44
UPDATE sys_user SET modules = replace(modules, ',domain', '') WHERE modules like '%domain%';
5+
6+
-- --------------------------------------------------------
7+
8+
--
9+
-- Table structure for table `directive_snippets`
10+
--
11+
12+
CREATE TABLE IF NOT EXISTS `directive_snippets` (
13+
`directive_snippets_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
14+
`sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
15+
`sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
16+
`sys_perm_user` varchar(5) DEFAULT NULL,
17+
`sys_perm_group` varchar(5) DEFAULT NULL,
18+
`sys_perm_other` varchar(5) DEFAULT NULL,
19+
`name` varchar(255) DEFAULT NULL,
20+
`type` varchar(255) DEFAULT NULL,
21+
`snippet` mediumtext,
22+
`active` enum('n','y') NOT NULL DEFAULT 'y',
23+
PRIMARY KEY (`directive_snippets_id`)
24+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

install/sql/ispconfig3.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,26 @@ CREATE TABLE `cron` (
347347

348348
-- --------------------------------------------------------
349349

350+
--
351+
-- Table structure for table `directive_snippets`
352+
--
353+
354+
CREATE TABLE IF NOT EXISTS `directive_snippets` (
355+
`directive_snippets_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
356+
`sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
357+
`sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
358+
`sys_perm_user` varchar(5) DEFAULT NULL,
359+
`sys_perm_group` varchar(5) DEFAULT NULL,
360+
`sys_perm_other` varchar(5) DEFAULT NULL,
361+
`name` varchar(255) DEFAULT NULL,
362+
`type` varchar(255) DEFAULT NULL,
363+
`snippet` mediumtext,
364+
`active` enum('n','y') NOT NULL DEFAULT 'y',
365+
PRIMARY KEY (`directive_snippets_id`)
366+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
367+
368+
-- --------------------------------------------------------
369+
350370
--
351371
-- Table structure for table `dns_rr`
352372
--
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) 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/directive_snippets.list.php";
36+
$tform_def_file = "form/directive_snippets.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: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/*
3+
Copyright (c) 2007, 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/directive_snippets.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+
50+
// let tform_actions handle the page
51+
$app->tform_actions->onLoad();
52+
53+
?>
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/directive_snippets.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: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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"] = "Directive Snippets";
37+
$form["description"] = "";
38+
$form["name"] = "directive_snippets";
39+
$form["action"] = "directive_snippets_edit.php";
40+
$form["db_table"] = "directive_snippets";
41+
$form["db_table_idx"] = "directive_snippets_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "directive_snippets";
44+
$form["list_default"] = "directive_snippets_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"]['directive_snippets'] = array (
54+
'title' => "Directive Snippets",
55+
'width' => 100,
56+
'template' => "templates/directive_snippets_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'name' => array (
62+
'datatype' => 'VARCHAR',
63+
'formtype' => 'TEXT',
64+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
65+
'errmsg'=> 'directive_snippets_name_empty'),
66+
1 => array ( 'type' => 'UNIQUE',
67+
'errmsg'=> 'directive_snippets_name_error_unique'),
68+
),
69+
'default' => '',
70+
'value' => '',
71+
'width' => '30',
72+
'maxlength' => '255'
73+
),
74+
'type' => array (
75+
'datatype' => 'VARCHAR',
76+
'formtype' => 'SELECT',
77+
'default' => '',
78+
'value' => array('apache' => 'Apache','nginx' => 'nginx','php' => 'PHP'),
79+
),
80+
'snippet' => array (
81+
'datatype' => 'TEXT',
82+
'formtype' => 'TEXT',
83+
'default' => '',
84+
'value' => '',
85+
'width' => '30',
86+
'maxlength' => '255'
87+
),
88+
'active' => array (
89+
'datatype' => 'VARCHAR',
90+
'formtype' => 'CHECKBOX',
91+
'default' => 'y',
92+
'value' => array(0 => 'n',1 => 'y')
93+
),
94+
##################################
95+
# ENDE Datatable fields
96+
##################################
97+
)
98+
);
99+
100+
101+
?>

interface/web/admin/lib/lang/de.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $wb['Jailkit'] = 'Jailkit';
2828
$wb['Rescue'] = 'Rescue';
2929
$wb['Server IP addresses'] = 'Server IP-Adressen';
3030
$wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen';
31+
$wb['Directive Snippets'] = 'Direktiven-Schnipsel';
3132
$wb['Firewall'] = 'Firewall';
3233
$wb['Interface'] = 'Interface';
3334
$wb['Interface Config'] = 'Main Config';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["Directive Snippets"] = 'Direktiven-Schnipsel';
3+
$wb["name_txt"] = 'Name des Schnipsels';
4+
$wb["type_txt"] = 'Typ';
5+
$wb["snippet_txt"] = 'Schnipsel';
6+
$wb["active_txt"] = 'Aktiv';
7+
$wb["directive_snippets_name_empty"] = 'Bitte geben Sie einen Namen für den Schnipsel an.';
8+
$wb["directive_snippets_name_error_unique"] = 'Es existiert schon ein Direktiven-Schnipsel mit diesem Namen.';
9+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Direcktiven-Schnipsel';
3+
$wb["active_txt"] = 'Aktiv';
4+
$wb["name_txt"] = 'Name des Schnipsels';
5+
$wb["type_txt"] = 'Typ';
6+
$wb["add_new_record_txt"] = 'Direcktiven-Schnipsel hinzufügen';
7+
?>

interface/web/admin/lib/lang/en.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ $wb['Server Config'] = 'Server Config';
3636
$wb['Rescue'] = 'Rescue';
3737
$wb['Server IP addresses'] = 'Server IP addresses';
3838
$wb['Additional PHP Versions'] = 'Additional PHP Versions';
39+
$wb['Directive Snippets'] = 'Directive Snippets';
3940
$wb['Firewall'] = 'Firewall';
4041

4142
$wb['Interface'] = 'Interface';

0 commit comments

Comments
 (0)