Commit 02384bde authored by tbrehm's avatar tbrehm

Implemented: FS#1977 - IP address(es) and *

parent 5d6ed4c9
......@@ -65,6 +65,7 @@ php_ini_path_apache=/etc/php5/apache2/php.ini
php_ini_path_cgi=/etc/php5/cgi/php.ini
check_apache_config=y
enable_sni=y
enable_ip_wildcard=y
nginx_cgi_socket=/var/run/fcgiwrap.socket
php_fpm_init_script=php5-fpm
php_fpm_ini_path=/etc/php5/fpm/php.ini
......
......@@ -480,6 +480,12 @@ $form["tabs"]['web'] = array(
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'enable_ip_wildcard' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'user' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -163,5 +163,6 @@ $wb["php_settings_txt"] = 'PHP Settings';
$wb["apps_vhost_settings_txt"] = 'Apps Vhost Settings';
$wb["awstats_settings_txt"] = 'AWStats Settings';
$wb["firewall_txt"] = 'Firewall';
$wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistic';
$wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistics';
$wb["enable_ip_wildcard_txt"] = 'Enable IP wildcard (*)';
?>
\ No newline at end of file
......@@ -85,6 +85,12 @@
<label for="htaccess_allow_override">{tmpl_var name='htaccess_allow_override_txt'}</label>
<input name="htaccess_allow_override" id="htaccess_allow_override" value="{tmpl_var name='htaccess_allow_override'}" size="40" maxlength="255" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='enable_ip_wildcard_txt'}</p>
<div class="multiField">
{tmpl_var name='enable_ip_wildcard'}
</div>
</div>
<div class="subsectiontoggle"><span></span>{tmpl_var name='ssl_settings_txt'}<em></em></div>
<div style="display:none;">
<div class="ctrlHolder">
......
......@@ -33,6 +33,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('sites');
$app->uses('getconf');
$server_id = intval($_GET["server_id"]);
$client_group_id = intval($_GET["client_group_id"]);
......@@ -40,23 +41,26 @@ $ip_type = $app->db->quote($_GET['ip_type']);
if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
//* Get global web config
$web_config = $app->getconf->get_server_config($server_id, 'web');
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = '$ip_type' AND server_id = $server_id";
$ips = $app->db->queryAllRecords($sql);
// $ip_select = "<option value=''></option>";
if($ip_type == 'IPv4'){
$ip_select = "*";
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":"";
} else {
$ip_select = "";
$ip_select = "#";
}
if(is_array($ips)) {
foreach( $ips as $ip) {
//$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
$ip_select .= "#$ip[ip_address]";
$ip_select .= "$ip[ip_address]#";
}
}
unset($tmp);
unset($ips);
}
echo $ip_select;
echo substr($ip_select,0,-1);
?>
\ No newline at end of file
......@@ -89,13 +89,17 @@ class page_action extends tform_actions {
$app->uses('ini_parser,getconf');
//* Client: If the logged in user is not admin and has no sub clients (no reseller)
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$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");
//* Get global web config
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
// Set the webserver to the default server of the client
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
......@@ -104,7 +108,7 @@ class page_action extends tform_actions {
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
$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'].")";
$ips = $app->db->queryAllRecords($sql);
$ip_select = "<option value='*'>*</option>";
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
//$ip_select = "";
if(is_array($ips)) {
foreach( $ips as $ip) {
......@@ -133,7 +137,6 @@ class page_action extends tform_actions {
//PHP Version Selection (FastCGI)
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
if($this->dataRecord['php'] == 'php-fpm'){
......@@ -163,7 +166,10 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$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");
//* Get global web config
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
// Set the webserver to the default server of the client
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
......@@ -186,7 +192,7 @@ class page_action extends tform_actions {
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
$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'].")";
$ips = $app->db->queryAllRecords($sql);
$ip_select = "<option value='*'>*</option>";
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
//$ip_select = "";
if(is_array($ips)) {
foreach( $ips as $ip) {
......@@ -215,7 +221,6 @@ class page_action extends tform_actions {
//PHP Version Selection (FastCGI)
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
if($this->dataRecord['php'] == 'php-fpm'){
......@@ -255,11 +260,14 @@ class page_action extends tform_actions {
$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
$server_id = $tmp['server_id'];
}
//* get global web config
$web_config = $app->getconf->get_server_config($server_id, 'web');
//* Fill the IPv4 select field
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = $server_id";
$ips = $app->db->queryAllRecords($sql);
$ip_select = "<option value='*'>*</option>";
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
//$ip_select = "";
if(is_array($ips)) {
foreach( $ips as $ip) {
......@@ -288,7 +296,6 @@ class page_action extends tform_actions {
//PHP Version Selection (FastCGI)
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($server_id, 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
if($this->dataRecord['php'] == 'php-fpm'){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment