commit | author | age
|
ba747c
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
436ed8
|
4 |
Copyright (c) 2007, Till Brehm, projektfarm Gmbh |
ba747c
|
5 |
All rights reserved. |
T |
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 |
class getconf { |
|
32 |
|
|
33 |
var $config; |
7fe908
|
34 |
|
ba747c
|
35 |
function get_server_config($server_id, $section = '') { |
T |
36 |
global $app; |
e38d14
|
37 |
|
ba747c
|
38 |
if(!is_array($this->config[$server_id])) { |
T |
39 |
$app->uses('ini_parser'); |
|
40 |
$server_id = intval($server_id); |
458767
|
41 |
$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id); |
J |
42 |
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config'])); |
ba747c
|
43 |
} |
7fe908
|
44 |
|
ba747c
|
45 |
if($section == '') { |
T |
46 |
return $this->config[$server_id]; |
|
47 |
} else { |
|
48 |
return $this->config[$server_id][$section]; |
|
49 |
} |
|
50 |
} |
7fe908
|
51 |
|
db5aa6
|
52 |
public function get_global_config($section = '') { |
T |
53 |
global $app; |
7fe908
|
54 |
|
df76de
|
55 |
if(!@is_array($this->config['global'])) { |
db5aa6
|
56 |
$app->uses('ini_parser'); |
458767
|
57 |
$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1'); |
J |
58 |
$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp['config'])); |
db5aa6
|
59 |
} |
T |
60 |
return ($section == '') ? $this->config['global'] : $this->config['global'][$section]; |
ba747c
|
61 |
} |
9edea9
|
62 |
|
TB |
63 |
public function get_security_config($section = '') { |
|
64 |
global $app; |
|
65 |
|
|
66 |
$app->uses('ini_parser'); |
|
67 |
$security_config = $app->ini_parser->parse_ini_string(file_get_contents('/usr/local/ispconfig/security/security_settings.ini')); |
|
68 |
|
|
69 |
return ($section == '') ? $security_config : $security_config[$section]; |
|
70 |
} |
7fe908
|
71 |
|
ba747c
|
72 |
} |
T |
73 |
|
458767
|
74 |
?> |