Skip to content

Commit 18341ee

Browse files
committed
Added the website management module.
1 parent 7ae9f9d commit 18341ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3377
-14
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_whe
760760
} else {
761761
if($primary_id != 0) {
762762
$sql_update = substr($sql_update,0,-2);
763-
$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
763+
$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
764764
if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
765765
} else {
766766
$app->error("Primary ID fehlt!");
@@ -796,20 +796,21 @@ function showForm() {
796796
// definiere Tabs
797797
foreach( $this->formDef["tabs"] as $key => $tab) {
798798

799-
$tab['name'] = $key;
799+
$tab['name'] = $key;
800800
if($tab['name'] == $active_tab) {
801801

802-
// Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
803-
if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
802+
// Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
803+
if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
804804

805-
// überprüfe, ob das Template existiert, wenn nicht
806-
// dann generiere das Template
807-
if(!is_file($tab["template"])) {
808-
$app->uses('tform_tpl_generator');
809-
$app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
810-
}
805+
// überprüfe, ob das Template existiert, wenn nicht
806+
// dann generiere das Template
807+
808+
if(!is_file($tab["template"])) {
809+
$app->uses('tform_tpl_generator');
810+
$app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
811+
}
811812

812-
$app->tpl->setInclude('content_tpl',$tab["template"]);
813+
$app->tpl->setInclude('content_tpl',$tab["template"]);
813814
$tab["active"] = 1;
814815
$_SESSION["s"]["form"]["tab"] = $tab['name'];
815816
} else {
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
Form Definition
33+
34+
Tabellendefinition
35+
36+
Datentypen:
37+
- INTEGER (Wandelt Ausdrücke in Int um)
38+
- DOUBLE
39+
- CURRENCY (Formatiert Zahlen nach Währungsnotation)
40+
- VARCHAR (kein weiterer Format Check)
41+
- TEXT (kein weiterer Format Check)
42+
- DATE (Datumsformat, Timestamp Umwandlung)
43+
44+
Formtype:
45+
- TEXT (normales Textfeld)
46+
- TEXTAREA (normales Textfeld)
47+
- PASSWORD (Feldinhalt wird nicht angezeigt)
48+
- SELECT (Gibt Werte als option Feld aus)
49+
- RADIO
50+
- CHECKBOX
51+
- FILE
52+
53+
VALUE:
54+
- Wert oder Array
55+
56+
Hinweis:
57+
Das ID-Feld ist nicht bei den Table Values einzufügen.
58+
59+
60+
*/
61+
62+
$form["title"] = "IP Addresses";
63+
$form["description"] = "Form to edit system IP Addresses";
64+
$form["name"] = "server_ip";
65+
$form["action"] = "server_ip_edit.php";
66+
$form["db_table"] = "server_ip";
67+
$form["db_table_idx"] = "server_ip_id";
68+
$form["db_history"] = "yes";
69+
$form["tab_default"] = "server_ip";
70+
$form["list_default"] = "server_ip_list.php";
71+
$form["auth"] = 'yes';
72+
73+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
74+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
75+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
76+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
77+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
78+
79+
$form["tabs"]['server_ip'] = array (
80+
'title' => "IP Address",
81+
'width' => 80,
82+
'template' => "templates/server_ip_edit.htm",
83+
'fields' => array (
84+
##################################
85+
# Beginn Datenbankfelder
86+
##################################
87+
'server_id' => array (
88+
'datatype' => 'INTEGER',
89+
'formtype' => 'SELECT',
90+
'default' => '',
91+
'datasource' => array ( 'type' => 'SQL',
92+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
93+
'keyfield'=> 'server_id',
94+
'valuefield'=> 'server_name'
95+
),
96+
'value' => ''
97+
),
98+
'ip_address' => array (
99+
'datatype' => 'VARCHAR',
100+
'formtype' => 'TEXT',
101+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
102+
'errmsg'=> 'ip_error_empty'),
103+
1 => array ( 'type' => 'UNIQUE',
104+
'errmsg'=> 'ip_error_unique'),
105+
2 => array ( 'type' => 'REGEX',
106+
'regex' => '/^[0-9\.]{7,15}$/',
107+
'errmsg'=> 'ip_err'),
108+
),
109+
'default' => '',
110+
'value' => '',
111+
'separator' => '',
112+
'width' => '15',
113+
'maxlength' => '15',
114+
'rows' => '',
115+
'cols' => ''
116+
),
117+
'virtualhost' => array (
118+
'datatype' => 'VARCHAR',
119+
'formtype' => 'CHECKBOX',
120+
'default' => 'y',
121+
'value' => array(0 => 'n',1 => 'y')
122+
),
123+
##################################
124+
# ENDE Datenbankfelder
125+
##################################
126+
)
127+
);
128+
?>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Server';
3+
$wb["ip_address_txt"] = 'IP Address';
4+
$wb["virtualhost_txt"] = 'Virtualhost';
5+
$wb["ip_err"] = 'IP address invalid';
6+
$wb["btn_save_txt"] = 'Save';
7+
$wb["btn_cancel_txt"] = 'Cancel';
8+
?>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
$wb["list_head_txt"] = 'IP Addresses';
3+
$wb["server_id_txt"] = 'Server';
4+
$wb["ip_address_txt"] = 'IP Address';
5+
$wb["page_txt"] = 'Page';
6+
$wb["page_of_txt"] = 'of';
7+
$wb["page_next_txt"] = 'Next';
8+
$wb["page_back_txt"] = 'Back';
9+
$wb["delete_txt"] = 'Delete';
10+
$wb["filter_txt"] = 'Filter';
11+
$wb["add_new_record_txt"] = 'Add new IP Address';
12+
?>

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@
4949
'target' => 'content',
5050
'link' => 'admin/server_list.php');
5151

52-
52+
$items[] = array( 'title' => "Add Server IP",
53+
'target' => 'content',
54+
'link' => 'admin/server_ip_edit.php');
55+
56+
$items[] = array( 'title' => "Edit Server IP",
57+
'target' => 'content',
58+
'link' => 'admin/server_ip_list.php');
59+
60+
5361
$module["nav"][] = array( 'title' => 'Servers',
5462
'open' => 1,
5563
'items' => $items);
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/*
4+
Datentypen:
5+
- INTEGER (Wandelt Ausdrücke in Int um)
6+
- DOUBLE
7+
- CURRENCY (Formatiert Zahlen nach Währungsnotation)
8+
- VARCHAR (kein weiterer Format Check)
9+
- TEXT (kein weiterer Format Check)
10+
- DATE (Datumsformat, Timestamp Umwandlung)
11+
*/
12+
13+
14+
15+
// Name der Liste
16+
$liste["name"] = "server_ip";
17+
18+
// Datenbank Tabelle
19+
$liste["table"] = "server_ip";
20+
21+
// Index Feld der datenbank
22+
$liste["table_idx"] = "server_ip_id";
23+
24+
// Search Field Prefix
25+
$liste["search_prefix"] = "search_";
26+
27+
// Einträge pro Seite
28+
$liste["records_per_page"] = 15;
29+
30+
// Script File der Liste
31+
$liste["file"] = "server_ip_list.php";
32+
33+
// Script File der Liste
34+
$liste["edit_file"] = "server_ip_edit.php";
35+
36+
// Script File der Liste
37+
$liste["delete_file"] = "server_ip_del.php";
38+
39+
// Paging Template
40+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
41+
42+
// Script File der Liste
43+
$liste["auth"] = "no";
44+
45+
46+
/*****************************************************
47+
* Suchfelder
48+
*****************************************************/
49+
50+
$liste["item"][] = array( 'field' => "server_id",
51+
'datatype' => "VARCHAR",
52+
'formtype' => "SELECT",
53+
'op' => "like",
54+
'prefix' => "%",
55+
'suffix' => "%",
56+
'datasource' => array ( 'type' => 'SQL',
57+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
58+
'keyfield'=> 'server_id',
59+
'valuefield'=> 'server_name'
60+
),
61+
'width' => "",
62+
'value' => "");
63+
64+
$liste["item"][] = array( 'field' => "ip_address",
65+
'datatype' => "VARCHAR",
66+
'op' => "=",
67+
'prefix' => "",
68+
'suffix' => "",
69+
'width' => "");
70+
71+
72+
73+
?>
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/server_ip.list.php";
36+
$tform_def_file = "form/server_ip.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"],'admin')) {
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)