/
configure_extensions.php
138 lines (133 loc) · 5.34 KB
/
configure_extensions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
require_once('include_database.php');
require_once('include_system.php');
?>
<table class="box">
<tr>
<td class="box-headline">>> <?php echo $GLOBALS['language']['configure']['ext_ext']; ?></td>
</tr>
<tr>
<td>
<form name="config_extensions" action="configure.php?section=extensions" method="POST">
<table class="box" style="border-style: none;">
<?php
$db_working = false;
$db = db_get_dbclass();
$db->do_connect();
if (!$db->connection_handle) {
} else {
$db->do_select_db();
if (!$db->selected_database) {
} else {
$db_working = true;
}
}
if ($db_working) {
?>
<!-- Apache Virtual Hosts -->
<?php
$have_table = $db->get_table_exists('vhtable');
?>
<tr>
<td width="175" class="box-sel-head"><?php echo $language['configure']['ext_vhost']; ?>:</td>
<td width="*" class="box-sel" align="right">
<select name="frm_enable_vhost" style="width: 514px;" <?php if (!$have_table && $config_ext['vhosts']['enabled'] == 0) echo 'disabled'; ?>>
<option value="1" <?php if($config_ext['vhosts']['enabled'] == 1) echo 'selected'; ?>><?php echo $language['general']['enabled']; ?></option>
<option value="0" <?php if($config_ext['vhosts']['enabled'] == 0) echo 'selected'; ?>><?php echo $language['general']['disabled']; ?></option>
</select>
</td>
</tr>
<?php
if (!$have_table) {
if ($config_ext['vhosts']['enabled'] == 1) notify($language['configure']['ext_vhost_no_table_activated']);
else notify($language['configure']['ext_vhost_no_table'], 'black');
}
?>
<!-- Quota -->
<?php
$have_table = $db->get_table_exists('ftpquotalimits') && $db->get_table_exists('ftpquotatallies');
$have_modules = false;
$have_section = true;
if (sys_statusavailable() != 0) {
$system = sys_getinfoclass();
if ($system->get_have_ftpmodule('mod_quotatab.c') && $system->get_have_ftpmodule('mod_quotatab_sql.c')) {
$have_modules = true;
}
$have_section = $system->have_section_proftpd();
} else {
// Can't tell, but assume we have the module anyway
$have_modules = true;
}
?>
<tr>
<td width="175" class="box-sel-head"><?php echo $language['configure']['ext_quota']; ?>:</td>
<td width="*" class="box-sel" align="right">
<select name="frm_enable_quota" style="width: 514px;" <?php if ((!$have_table || !$have_modules) && $config_ext['quota']['enabled'] == 0) echo 'disabled'; ?>>
<option value="1" <?php if($config_ext['quota']['enabled'] == 1) echo 'selected'; ?>><?php echo $language['general']['enabled']; ?></option>
<option value="0" <?php if($config_ext['quota']['enabled'] == 0) echo 'selected'; ?>><?php echo $language['general']['disabled']; ?></option>
</select>
</td>
</tr>
<?php
if (!$have_table) {
if ($config_ext['quota']['enabled'] == 1) notify($language['configure']['ext_quota_no_table_activated']);
else notify($language['configure']['ext_quota_no_table'], 'black');
}
if (!$have_modules && $have_section) {
$color = 'black';
if ($config_ext['quota']['enabled'] == 1) $color = 'red';
notify($language['configure']['ext_quota_no_mods'], $color);
}
if($config_ext['quota']['enabled'] == 0) {
$db = db_get_dbclass();
$db->do_connect();
if ($db->connection_handle) {
$db->do_select_db();
if ($db->selected_database) {
if ($db->get_quotas_exists()) {
notify($language['configure']['ext_quota_no_activated'], 'red');
}
}
}
}
?>
<!-- Power DNS -->
<?php
$have_table = $db->get_table_exists('domains') && $db->get_table_exists('records') && $db->get_table_exists('supermasters');
?>
<tr>
<td width="175" class="box-sel-head"><?php echo $language['configure']['ext_pdns']; ?>:</td>
<td width="*" class="box-sel" align="right">
<select name="frm_enable_pdns" style="width: 514px;" <?php if (!$have_table && $config_ext['pdns']['enabled'] == 0) echo 'disabled'; ?>>
<option value="1" <?php if($config_ext['pdns']['enabled'] == 1) echo 'selected'; ?>><?php echo $language['general']['enabled']; ?></option>
<option value="0" <?php if($config_ext['pdns']['enabled'] == 0) echo 'selected'; ?>><?php echo $language['general']['disabled']; ?></option>
</select>
</td>
</tr>
<?php
if (!$have_table) {
if ($config_ext['pdns']['enabled'] == 1) notify($language['configure']['ext_pdns_no_table_activated']);
else notify($language['configure']['ext_pdns_no_table'], 'black');
}
} else {
notify($language['configure']['ext_no_db']);
}
?>
</table>
</form>
</td>
</tr>
</table>
<?php
$alter_menu[$GLOBALS['language']['menu']['reset']] = 'javascript:document.config_extensions.reset()';
$alter_menu[$GLOBALS['language']['menu']['submit']] = 'javascript:document.config_extensions.submit()';
doMenu($alter_menu);
function notify($text, $colour = 'red') {
echo '<tr>';
echo ' <td width="175" class="box-sel-head" align="right" valign="top"><img src="style/' . $GLOBALS['config_style_name'] . '/alert.' . $colour . '.gif" style="border: none;" align="right"></td>';
echo ' <td width="*" class="box-sel" align="justify" valign="top">';
echo $text;
echo ' </td>';
echo '</tr>';
}
?>