commit | author | age
|
7848ce
|
1 |
<?php |
T |
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/server_config.tform.php"; |
|
36 |
|
|
37 |
/****************************************** |
|
38 |
* End Form configuration |
|
39 |
******************************************/ |
|
40 |
|
7fe908
|
41 |
require_once '../../lib/config.inc.php'; |
MC |
42 |
require_once '../../lib/app.inc.php'; |
7848ce
|
43 |
|
T |
44 |
//* Check permissions for module |
|
45 |
$app->auth->check_module_permissions('admin'); |
9edea9
|
46 |
$app->auth->check_security_permissions('admin_allow_server_config'); |
TB |
47 |
|
7848ce
|
48 |
|
T |
49 |
// Loading classes |
|
50 |
$app->uses('tpl,tform,tform_actions'); |
|
51 |
$app->load('tform_actions'); |
|
52 |
|
|
53 |
class page_action extends tform_actions { |
7fe908
|
54 |
|
7848ce
|
55 |
function onShowEdit() { |
T |
56 |
global $app, $conf; |
7fe908
|
57 |
|
7848ce
|
58 |
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); |
7fe908
|
59 |
|
7848ce
|
60 |
if($app->tform->errorMessage == '') { |
T |
61 |
$app->uses('ini_parser,getconf'); |
7fe908
|
62 |
|
7848ce
|
63 |
$section = $this->active_tab; |
T |
64 |
$server_id = $this->id; |
7fe908
|
65 |
|
MC |
66 |
$this->dataRecord = $app->getconf->get_server_config($server_id, $section); |
7848ce
|
67 |
} |
7fe908
|
68 |
|
MC |
69 |
$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT'); |
|
70 |
|
7848ce
|
71 |
$record['id'] = $this->id; |
T |
72 |
$app->tpl->setVar($record); |
|
73 |
} |
7fe908
|
74 |
|
7848ce
|
75 |
function onUpdateSave($sql) { |
7fe908
|
76 |
global $app, $conf; |
MC |
77 |
|
7848ce
|
78 |
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); |
T |
79 |
$app->uses('ini_parser,getconf'); |
7fe908
|
80 |
|
91624b
|
81 |
if($conf['demo_mode'] != true) { |
T |
82 |
$section = $app->tform->getCurrentTab(); |
|
83 |
$server_id = $this->id; |
7fe908
|
84 |
|
91624b
|
85 |
$server_config_array = $app->getconf->get_server_config($server_id); |
7fe908
|
86 |
|
10b4c8
|
87 |
foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) { |
T |
88 |
if ($field['formtype'] == 'CHECKBOX') { |
|
89 |
if($this->dataRecord[$key] == '') { |
|
90 |
// if a checkbox is not set, we set it to the unchecked value |
|
91 |
$this->dataRecord[$key] = $field['value'][0]; |
|
92 |
} |
|
93 |
} |
|
94 |
} |
7fe908
|
95 |
|
MC |
96 |
$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section); |
91624b
|
97 |
$server_config_str = $app->ini_parser->get_ini_string($server_config_array); |
7fe908
|
98 |
|
91624b
|
99 |
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id); |
T |
100 |
} |
7848ce
|
101 |
} |
7fe908
|
102 |
|
7848ce
|
103 |
} |
T |
104 |
|
|
105 |
$app->tform_actions = new page_action; |
|
106 |
$app->tform_actions->onLoad(); |
|
107 |
|
|
108 |
|
7fe908
|
109 |
?> |