Skip to content

Commit 02384bd

Browse files
committed
Implemented: FS#1977 - IP address(es) and *
1 parent 5d6ed4c commit 02384bd

File tree

6 files changed

+38
-13
lines changed

6 files changed

+38
-13
lines changed

install/tpl/server.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ php_ini_path_apache=/etc/php5/apache2/php.ini
6565
php_ini_path_cgi=/etc/php5/cgi/php.ini
6666
check_apache_config=y
6767
enable_sni=y
68+
enable_ip_wildcard=y
6869
nginx_cgi_socket=/var/run/fcgiwrap.socket
6970
php_fpm_init_script=php5-fpm
7071
php_fpm_ini_path=/etc/php5/fpm/php.ini

interface/web/admin/form/server_config.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,12 @@
480480
'default' => 'y',
481481
'value' => array(0 => 'n', 1 => 'y')
482482
),
483+
'enable_ip_wildcard' => array(
484+
'datatype' => 'VARCHAR',
485+
'formtype' => 'CHECKBOX',
486+
'default' => 'y',
487+
'value' => array(0 => 'n', 1 => 'y')
488+
),
483489
'user' => array(
484490
'datatype' => 'VARCHAR',
485491
'formtype' => 'TEXT',

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,6 @@ $wb["php_settings_txt"] = 'PHP Settings';
163163
$wb["apps_vhost_settings_txt"] = 'Apps Vhost Settings';
164164
$wb["awstats_settings_txt"] = 'AWStats Settings';
165165
$wb["firewall_txt"] = 'Firewall';
166-
$wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistic';
166+
$wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistics';
167+
$wb["enable_ip_wildcard_txt"] = 'Enable IP wildcard (*)';
167168
?>

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ <h2><tmpl_var name="list_head_txt"></h2>
8585
<label for="htaccess_allow_override">{tmpl_var name='htaccess_allow_override_txt'}</label>
8686
<input name="htaccess_allow_override" id="htaccess_allow_override" value="{tmpl_var name='htaccess_allow_override'}" size="40" maxlength="255" type="text" class="textInput" />
8787
</div>
88+
<div class="ctrlHolder">
89+
<p class="label">{tmpl_var name='enable_ip_wildcard_txt'}</p>
90+
<div class="multiField">
91+
{tmpl_var name='enable_ip_wildcard'}
92+
</div>
93+
</div>
8894
<div class="subsectiontoggle"><span></span>{tmpl_var name='ssl_settings_txt'}<em></em></div>
8995
<div style="display:none;">
9096
<div class="ctrlHolder">

interface/web/sites/ajax_get_ip.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,34 @@
3333

3434
//* Check permissions for module
3535
$app->auth->check_module_permissions('sites');
36+
$app->uses('getconf');
3637

3738
$server_id = intval($_GET["server_id"]);
3839
$client_group_id = intval($_GET["client_group_id"]);
3940
$ip_type = $app->db->quote($_GET['ip_type']);
4041

4142
if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
4243

44+
//* Get global web config
45+
$web_config = $app->getconf->get_server_config($server_id, 'web');
46+
4347
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = '$ip_type' AND server_id = $server_id";
4448
$ips = $app->db->queryAllRecords($sql);
4549
// $ip_select = "<option value=''></option>";
4650
if($ip_type == 'IPv4'){
47-
$ip_select = "*";
51+
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":"";
4852
} else {
49-
$ip_select = "";
53+
$ip_select = "#";
5054
}
5155
if(is_array($ips)) {
5256
foreach( $ips as $ip) {
5357
//$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
54-
$ip_select .= "#$ip[ip_address]";
58+
$ip_select .= "$ip[ip_address]#";
5559
}
5660
}
5761
unset($tmp);
5862
unset($ips);
5963
}
6064

61-
echo $ip_select;
65+
echo substr($ip_select,0,-1);
6266
?>

interface/web/sites/web_domain_edit.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@ function onShowEnd() {
8989

9090
$app->uses('ini_parser,getconf');
9191

92+
9293
//* Client: If the logged in user is not admin and has no sub clients (no reseller)
9394
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
9495

9596
// Get the limits of the client
9697
$client_group_id = $_SESSION["s"]["user"]["default_group"];
9798
$client = $app->db->queryOneRecord("SELECT client.limit_web_domain, client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
98-
99+
100+
//* Get global web config
101+
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
102+
99103
// Set the webserver to the default server of the client
100104
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
101105
$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
@@ -104,7 +108,7 @@ function onShowEnd() {
104108
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
105109
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
106110
$ips = $app->db->queryAllRecords($sql);
107-
$ip_select = "<option value='*'>*</option>";
111+
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
108112
//$ip_select = "";
109113
if(is_array($ips)) {
110114
foreach( $ips as $ip) {
@@ -133,7 +137,6 @@ function onShowEnd() {
133137

134138
//PHP Version Selection (FastCGI)
135139
$server_type = 'apache';
136-
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
137140
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
138141
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
139142
if($this->dataRecord['php'] == 'php-fpm'){
@@ -163,7 +166,10 @@ function onShowEnd() {
163166
// Get the limits of the client
164167
$client_group_id = $_SESSION["s"]["user"]["default_group"];
165168
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
166-
169+
170+
//* Get global web config
171+
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
172+
167173
// Set the webserver to the default server of the client
168174
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
169175
$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
@@ -186,7 +192,7 @@ function onShowEnd() {
186192
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
187193
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
188194
$ips = $app->db->queryAllRecords($sql);
189-
$ip_select = "<option value='*'>*</option>";
195+
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
190196
//$ip_select = "";
191197
if(is_array($ips)) {
192198
foreach( $ips as $ip) {
@@ -215,7 +221,6 @@ function onShowEnd() {
215221

216222
//PHP Version Selection (FastCGI)
217223
$server_type = 'apache';
218-
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
219224
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
220225
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
221226
if($this->dataRecord['php'] == 'php-fpm'){
@@ -255,11 +260,14 @@ function onShowEnd() {
255260
$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
256261
$server_id = $tmp['server_id'];
257262
}
263+
264+
//* get global web config
265+
$web_config = $app->getconf->get_server_config($server_id, 'web');
258266

259267
//* Fill the IPv4 select field
260268
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = $server_id";
261269
$ips = $app->db->queryAllRecords($sql);
262-
$ip_select = "<option value='*'>*</option>";
270+
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
263271
//$ip_select = "";
264272
if(is_array($ips)) {
265273
foreach( $ips as $ip) {
@@ -288,7 +296,6 @@ function onShowEnd() {
288296

289297
//PHP Version Selection (FastCGI)
290298
$server_type = 'apache';
291-
$web_config = $app->getconf->get_server_config($server_id, 'web');
292299
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
293300
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
294301
if($this->dataRecord['php'] == 'php-fpm'){

0 commit comments

Comments
 (0)