\ No newline at end of file
diff --git a/interface/web/sites/templates/aps_packages_list.htm b/interface/web/sites/templates/aps_packages_list.htm
index 4765f2edefdf591cf504c1da2023b0d4b962287a..1042e711694182feff40abd67c4fa8bbd1adeb5d 100644
--- a/interface/web/sites/templates/aps_packages_list.htm
+++ b/interface/web/sites/templates/aps_packages_list.htm
@@ -1,55 +1,55 @@
-
-
-
-
{tmpl_var name="list_head_txt"} ({tmpl_var name='package_count'})
-
-
-
-
+
{tmpl_var name="list_head_txt"}
+
+
+
+
+
{tmpl_var name="list_head_txt"} ({tmpl_var name='package_count'})
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_aliasdomain_advanced.htm b/interface/web/sites/templates/web_aliasdomain_advanced.htm
index 293b87124431868510e5b912295e962adcea5bb8..4c605ca94cc75433c8d1ebc6914f26aa999e83b7 100644
--- a/interface/web/sites/templates/web_aliasdomain_advanced.htm
+++ b/interface/web/sites/templates/web_aliasdomain_advanced.htm
@@ -1,37 +1,37 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_subdomain_advanced.htm b/interface/web/sites/templates/web_subdomain_advanced.htm
index d2beb4275d5924ba81cf4a362f3b6e3cabc8841f..3924362a362cf976c0ec1751c8413ca008bb59fa 100644
--- a/interface/web/sites/templates/web_subdomain_advanced.htm
+++ b/interface/web/sites/templates/web_subdomain_advanced.htm
@@ -1,37 +1,37 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index c3c4f97e697f11dd105617e7a17935f5ed375e4f..5e26a14a53a55faac7e1afcd2f8327da8a100f6a 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -1,1025 +1,1025 @@
-auth->check_module_permissions('sites');
-
-// Loading classes
-$app->uses('tpl,tform,tform_actions,tools_sites');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
- //* Returna a "3/2/1" path hash from a numeric id '123'
- function id_hash($id,$levels) {
- $hash = "" . $id % 10 ;
- $id /= 10 ;
- $levels -- ;
- while ( $levels > 0 ) {
- $hash .= "/" . $id % 10 ;
- $id /= 10 ;
- $levels-- ;
- }
- return $hash;
- }
-
- function onShowNew() {
- global $app, $conf;
-
- // we will check only users, not admins
- if($_SESSION["s"]["user"]["typ"] == 'user') {
- if(!$app->tform->checkClientLimit('limit_web_domain',"type = 'vhost'")) {
- $app->error($app->tform->wordbook["limit_web_domain_txt"]);
- }
- if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) {
- $app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]);
- }
-
- // Get the limits of the client
- $client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
- $app->tpl->setVar("server_id_value", $client['default_webserver']);
- }
- $app->tform->formDef['tabs']['domain']['readonly'] = false;
-
- parent::onShowNew();
- }
-
- function onShowEnd() {
- global $app, $conf;
-
- $app->uses('ini_parser,getconf');
-
- $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-
- //* 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, client." . implode(", client.", $read_limits) . " 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 = ".intval($client['default_webserver']));
- $app->tpl->setVar("server_id","
$tmp[server_name] ");
- unset($tmp);
-
- //* 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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ip_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- //* Fill the IPv6 select field with the IP addresses that are allowed for this client
- $sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
- $ips = $app->db->queryAllRecords($sql);
- $ip_select = "
";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ipv6_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- if($this->dataRecord['php'] == 'fast-cgi'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- // add limits to template to be able to hide settings
- foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-
-
- //* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
- } elseif ($_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.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " 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 = ".intval($client['default_webserver']));
- $app->tpl->setVar("server_id","
$tmp[server_name] ");
- unset($tmp);
-
- // Fill the client select field
- $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
- $records = $app->db->queryAllRecords($sql);
- $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
- $client_select = '
'.$client['contactname'].' ';
- //$tmp_data_record = $app->tform->getDataRecord($this->id);
- if(is_array($records)) {
- $selected_client_group_id = 0; // needed to get list of PHP versions
- foreach( $records as $rec) {
- if(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $rec["groupid"];
- $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
- if($selected == 'SELECTED') $selected_client_group_id = $rec["groupid"];
- $client_select .= "
$rec[contactname] \r\n";
- }
- }
- $app->tpl->setVar("client_group_id",$client_select);
-
- //* 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 = ".intval($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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ip_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- //* Fill the IPv6 select field with the IP addresses that are allowed for this client
- $sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
- $ips = $app->db->queryAllRecords($sql);
- $ip_select = "
";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ipv6_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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';
- $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $selected_client_group_id");
- //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")";
- $sql_where = " AND (client_id = 0 OR client_id = ".intval($selected_client['client_id']).")";
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver'])).$sql_where);
- }
- if($this->dataRecord['php'] == 'fast-cgi') {
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver'])).$sql_where);
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- // add limits to template to be able to hide settings
- foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-
-
- //* Admin: If the logged in user is admin
- } else {
-
- // The user is admin, so we fill in all IP addresses of the server
- if($this->id > 0) {
- if(!isset($this->dataRecord["server_id"])){
- $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- $this->dataRecord["server_id"] = $tmp["server_id"];
- unset($tmp);
- }
- $server_id = intval(@$this->dataRecord["server_id"]);
- } else {
- // Get the first server ID
- $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
- $server_id = intval($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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ip_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- //* Fill the IPv6 select field
- $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = $server_id";
- $ips = $app->db->queryAllRecords($sql);
- $ip_select = "
";
- //$ip_select = "";
- if(is_array($ips)) {
- foreach( $ips as $ip) {
- $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
- $ip_select .= "
$ip[ip_address] \r\n";
- }
- }
- $app->tpl->setVar("ipv6_address",$ip_select);
- unset($tmp);
- unset($ips);
-
- // Fill the client select field
- $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
- $clients = $app->db->queryAllRecords($sql);
- $client_select = "
";
- //$tmp_data_record = $app->tform->getDataRecord($this->id);
- if(is_array($clients)) {
- $selected_client_group_id = 0; // needed to get list of PHP versions
- foreach($clients as $client) {
- if(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $client["groupid"];
- //$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
- $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
- if($selected == 'SELECTED') $selected_client_group_id = $client["groupid"];
- $client_select .= "
$client[contactname] \r\n";
- }
- }
- $app->tpl->setVar("client_group_id",$client_select);
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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';
- $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $selected_client_group_id");
- //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")";
- $sql_where = " AND (client_id = 0 OR client_id = ".intval($selected_client['client_id']).")";
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where);
- }
- if($this->dataRecord['php'] == 'fast-cgi') {
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id".$sql_where);
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-
- // Directive Snippets
- $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
- $php_directive_snippets_txt = '';
- if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
- foreach($php_directive_snippets as $php_directive_snippet){
- $php_directive_snippets_txt .= '
['.$php_directive_snippet['name'].']'.htmlentities($php_directive_snippet['snippet']).' ';
- }
- }
- if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
- $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-
- if($server_type == 'apache'){
- $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
- $apache_directive_snippets_txt = '';
- if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
- foreach($apache_directive_snippets as $apache_directive_snippet){
- $apache_directive_snippets_txt .= '
['.$apache_directive_snippet['name'].']'.htmlentities($apache_directive_snippet['snippet']).' ';
- }
- }
- if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
- $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
- }
-
- if($server_type == 'nginx'){
- $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
- $nginx_directive_snippets_txt = '';
- if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
- foreach($nginx_directive_snippets as $nginx_directive_snippet){
- $nginx_directive_snippets_txt .= '
['.$nginx_directive_snippet['name'].']'.htmlentities($nginx_directive_snippet['snippet']).' ';
- }
- }
- if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
- $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
- }
-
- $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
- $proxy_directive_snippets_txt = '';
- if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
- foreach($proxy_directive_snippets as $proxy_directive_snippet){
- $proxy_directive_snippets_txt .= '
['.$proxy_directive_snippet['name'].']'.htmlentities($proxy_directive_snippet['snippet']).' ';
- }
- }
- if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
- $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
- }
-
- $ssl_domain_select = '';
- $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
- $ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"],'*.'.$tmp["domain"]);
- if(is_array($ssl_domains)) {
- foreach( $ssl_domains as $ssl_domain) {
- $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
- $ssl_domain_select .= "
$ssl_domain \r\n";
- }
- }
- $app->tpl->setVar("ssl_domain",$ssl_domain_select);
- unset($ssl_domain_select);
- unset($ssl_domains);
- unset($ssl_domain);
-
- if($this->id > 0) {
- //* we are editing a existing record
- $app->tpl->setVar("edit_disabled", 1);
- $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
- } else {
- $app->tpl->setVar("edit_disabled", 0);
- }
-
- $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'
('.$app->tform->lng('traffic_quota_exceeded_txt').') ':'';
- $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt);
-
- /*
- * Now we have to check, if we should use the domain-module to select the domain
- * or not
- */
- $settings = $app->getconf->get_global_config('domains');
- if ($settings['use_domain_module'] == 'y') {
- /*
- * The domain-module is in use.
- */
- $domains = $app->tools_sites->getDomainModuleDomains();
- $domain_select = '';
- if(is_array($domains) && sizeof($domains) > 0) {
- /* We have domains in the list, so create the drop-down-list */
- foreach( $domains as $domain) {
- $domain_select .= "
functions->idn_decode($domain['domain']) . " \r\n";
- }
- }
- else {
- /*
- * We have no domains in the domain-list. This means, we can not add ANY new domain.
- * To avoid, that the variable "domain_option" is empty and so the user can
- * free enter a domain, we have to create a empty option!
- */
- $domain_select .= "
\r\n";
- }
- $app->tpl->setVar("domain_option",$domain_select);
- }
-
- // check for configuration errors in sys_datalog
- if($this->id > 0) {
- $datalog = $app->db->queryOneRecord("SELECT sys_datalog.error, sys_log.tstamp FROM sys_datalog, sys_log WHERE sys_datalog.dbtable = 'web_domain' AND sys_datalog.dbidx = 'domain_id:".$this->id."' AND sys_datalog.datalog_id = sys_log.datalog_id AND sys_log.message = CONCAT('Processed datalog_id ',sys_log.datalog_id) ORDER BY sys_datalog.tstamp DESC");
- if(is_array($datalog) && !empty($datalog)){
- if(trim($datalog['error']) != ''){
- $app->tpl->setVar("config_error_msg",nl2br(htmlentities($datalog['error'])));
- $app->tpl->setVar("config_error_tstamp",date($app->lng('conf_format_datetime'), $datalog['tstamp']));
- }
- }
- }
-
- parent::onShowEnd();
- }
-
- function onShowEdit() {
- global $app;
- if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
- parent::onShowEdit();
- }
-
- function onSubmit() {
- global $app, $conf;
-
- /* check if the domain module is used - and check if the selected domain can be used! */
- if($app->tform->getCurrentTab() == 'domain') {
- $app->uses('ini_parser,getconf');
- $settings = $app->getconf->get_global_config('domains');
- if ($settings['use_domain_module'] == 'y') {
- $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
- if(!$domain_check) {
- // invalid domain selected
- $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
";
- } else {
- $this->dataRecord['domain'] = $domain_check;
- }
- }
- }
-
- // nginx: if redirect type is proxy and redirect path is no URL, display error
- //if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
- // $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."
";
- //}
-
- // Set a few fixed values
- $this->dataRecord["parent_domain_id"] = 0;
- $this->dataRecord["type"] = 'vhost';
- $this->dataRecord["vhost_type"] = 'name';
-
- $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-
-
- if($_SESSION["s"]["user"]["typ"] != 'admin') {
- // Get the limits of the client
- $client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-
- if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
- if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
- if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
- if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
- if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
- if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
- if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
- if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
- if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-
- // only generate quota and traffic warnings if value has changed
- if($this->id > 0) {
- $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- } else {
- $old_web_values = $_POST;
- }
-
- //* Check the website quota of the client
- if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
- $webquota = $tmp["webquota"];
- $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
- if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) {
- $max_free_quota = floor($client["limit_web_quota"] - $webquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["hd_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
-
- //* Check the traffic quota of the client
- if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
- $trafficquota = $tmp["trafficquota"];
- $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
- if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) {
- $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["traffic_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
-
- if($client['parent_client_id'] > 0) {
- // Get the limits of the reseller
- $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
-
- //* Check the website quota of the client
- if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
- $webquota = $tmp["webquota"];
- $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
- if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) {
- $max_free_quota = floor($reseller["limit_web_quota"] - $webquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["hd_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
-
- //* Check the traffic quota of the client
- if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
- $trafficquota = $tmp["trafficquota"];
- $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
- if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) {
- $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["traffic_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
- }
-
- // When the record is updated
- if($this->id > 0) {
- // restore the server ID if the user is not admin and record is edited
- $tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- $this->dataRecord["server_id"] = $tmp["server_id"];
-
- // set the settings to current if not provided (or cleared due to limits)
- if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
- if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
- if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
- if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
- if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
- if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
- if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
- if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
- if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-
- unset($tmp);
- // When the record is inserted
- } else {
- //* set the server ID to the default webserver of the client
- $this->dataRecord["server_id"] = $client["default_webserver"];
-
- // Check if the user may add another web_domain
- if($client["limit_web_domain"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'");
- if($tmp["number"] >= $client["limit_web_domain"]) {
- $app->error($app->tform->wordbook["limit_web_domain_txt"]);
- }
- }
-
- }
-
- // Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
- if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
- }
-
- //* make sure that the email domain is lowercase
- if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-
- //* get the server config for this server
- $app->uses("getconf");
- if($this->id > 0){
- $web_rec = $app->tform->getDataRecord($this->id);
- $server_id = $web_rec["server_id"];
- } else {
- // Get the first server ID
- $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
- $server_id = intval($tmp['server_id']);
- }
- $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id),'web');
- //* Check for duplicate ssl certs per IP if SNI is disabled
- if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
- $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
- $tmp = $app->db->queryOneRecord($sql);
- if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
- }
-
- // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
- if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
- if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-
- } else {
- $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
';
- }
- }
-
- // Check rewrite rules
- $server_type = $web_config['server_type'];
-
- if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
- $rewrite_rules = trim($this->dataRecord['rewrite_rules']);
- $rewrites_are_valid = true;
- // use this counter to make sure all curly brackets are properly closed
- $if_level = 0;
- // Make sure we only have Unix linebreaks
- $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules);
- $rewrite_rules = str_replace("\r", "\n", $rewrite_rules);
- $rewrite_rule_lines = explode("\n", $rewrite_rules);
- if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
- foreach($rewrite_rule_lines as $rewrite_rule_line){
- // ignore comments
- if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
- // empty lines
- if(trim($rewrite_rule_line) == '') continue;
- // rewrite
- if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue;
- // if
- if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){
- $if_level += 1;
- continue;
- }
- // if - check for files, directories, etc.
- if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){
- $if_level += 1;
- continue;
- }
- // break
- if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){
- continue;
- }
- // return code [ text ]
- if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue;
- // return code URL
- // return URL
- if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue;
- // set
- if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue;
- // closing curly bracket
- if(trim($rewrite_rule_line) == '}'){
- $if_level -= 1;
- continue;
- }
- $rewrites_are_valid = false;
- break;
- }
- }
-
- if(!$rewrites_are_valid || $if_level != 0){
- $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
';
- }
- }
-
- parent::onSubmit();
- }
-
- function onAfterInsert() {
- global $app, $conf;
-
- // make sure that the record belongs to the clinet group and not the admin group when admin inserts it
- // also make sure that the user can not delete domain created by a admin
- if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
- $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
- }
- if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
- $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id);
- }
-
- // Get configuration for the web system
- $app->uses("getconf");
- $web_rec = $app->tform->getDataRecord($this->id);
- $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
- $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
- $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
- $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
- $document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
- $document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
-
- // get the ID of the client
- if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
- $client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
- $client_id = $app->functions->intval($client["client_id"]);
- } else {
- //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
- $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($this->dataRecord["client_group_id"]));
- $client_id = $app->functions->intval($client["client_id"]);
- }
-
- // Set the values for document_root, system_user and system_group
- $system_user = $app->db->quote('web'.$this->id);
- $system_group = $app->db->quote('client'.$client_id);
- $document_root = str_replace("[client_id]",$client_id,$document_root);
- $document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
- $document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
- $document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
- $document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
- $document_root = $app->db->quote($document_root);
- $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
- $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
- $htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);
-
- $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
-
- function onBeforeUpdate () {
- global $app, $conf;
-
- //* Check if the server has been changed
- // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
- if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
- if (isset($this->dataRecord["server_id"])) {
- $rec = $app->db->queryOneRecord("SELECT server_id from web_domain WHERE domain_id = ".$this->id);
- if($rec['server_id'] != $this->dataRecord["server_id"]) {
- //* Add a error message and switch back to old server
- $app->tform->errorMessage .= $app->lng('The Server can not be changed.');
- $this->dataRecord["server_id"] = $rec['server_id'];
- }
- unset($rec);
- }
- //* If the user is neither admin nor reseller
- } else {
- //* We do not allow users to change a domain which has been created by the admin
- $rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain, ip_address, ipv6_address from web_domain WHERE domain_id = ".$this->id);
- if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
- //* Add a error message and switch back to old server
- $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
- $this->dataRecord["domain"] = $rec['domain'];
- }
- if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
- $this->dataRecord["ip_address"] = $rec['ip_address'];
- }
- if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
- $this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
- }
- unset($rec);
- }
-
- //* Check that all fields for the SSL cert creation are filled
- if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
- if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
';
- if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
';
- if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
';
- if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
';
- if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
';
- }
-
- if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
- if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
';
- }
-
- }
-
- function onAfterUpdate() {
- global $app, $conf;
-
- // make sure that the record belongs to the client group and not the admin group when a admin inserts it
- // also make sure that the user can not delete domain created by a admin
- if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
- $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
- }
- if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
- $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id);
- }
-
- // Get configuration for the web system
- $app->uses("getconf");
- $web_rec = $app->tform->getDataRecord($this->id);
- $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
- $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
- $page_formid = isset($page_form->id) ? $page_form->id : '';
- $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
- $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
- $document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
- $document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
-
- // get the ID of the client
- if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
- $client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
- $client_id = $app->functions->intval($client["client_id"]);
- } elseif (isset($this->dataRecord["client_group_id"])) {
- $client_group_id = $this->dataRecord["client_group_id"];
- $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval(@$this->dataRecord["client_group_id"]));
- $client_id = $app->functions->intval($client["client_id"]);
- } else {
- $client_group_id = $web_rec['sys_groupid'];
- $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($client_group_id));
- $client_id = $app->functions->intval($client["client_id"]);
- }
-
- if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"]) {
- // Set the values for document_root, system_user and system_group
- $system_user = $app->db->quote('web'.$this->id);
- $system_group = $app->db->quote('client'.$client_id);
- $document_root = str_replace("[client_id]",$client_id,$document_root);
- $document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
- $document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
- $document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
- $document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
- $document_root = $app->db->quote($document_root);
-
- $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
- //$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
-
- // Update the FTP user(s) too
- $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $app->db->datalogUpdate('ftp_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', uid = '$system_user', gid = '$system_group', dir = '$document_root'", 'ftp_user_id', $rec['ftp_user_id']);
- }
- unset($records);
- unset($rec);
-
- // Update the Shell user(s) too
- $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $app->db->datalogUpdate('shell_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', puser = '$system_user', pgroup = '$system_group', dir = '$document_root'", 'shell_user_id', $rec['shell_user_id']);
- }
- unset($records);
- unset($rec);
-
- //* Update all subdomains and alias domains
- $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
- if($rec['type'] == 'vhostsubdomain') {
- $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$rec['web_folder'],$web_config["php_open_basedir"]);
- $php_open_basedir = str_replace("[website_domain]/web",$rec['domain'].'/'.$rec['web_folder'],$php_open_basedir);
- $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
- $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$rec['domain'],$php_open_basedir));
-
- $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
- }
- $app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']);
- }
- unset($records);
- unset($rec);
-
- //* Update all databases
- $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $app->db->datalogUpdate('web_database', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'", 'database_id', $rec['database_id']);
- }
- unset($records);
- unset($rec);
-
- }
-
- //* If the domain name has been changed, we will have to change all subdomains + APS instances
- if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
- $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
- foreach($records as $rec) {
- $subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
- $app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']);
- }
- unset($records);
- unset($rec);
- unset($subdomain);
-
- // Update APS instances
- $records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'");
- if(is_array($records) && !empty($records)){
- foreach($records as $rec){
- $app->db->datalogUpdate('aps_instances_settings', "value = '".$this->dataRecord["domain"]."'", 'id', $rec['id']);
- // Reinstall of package needed?
- //$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']);
- }
- }
- unset($records);
- unset($rec);
- }
-
- //* Set allow_override if empty
- if($web_rec['allow_override'] == '') {
- $sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
-
- //* Set php_open_basedir if empty or domain or client has been changed
- if(empty($web_rec['php_open_basedir']) ||
- (!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
- $php_open_basedir = $web_rec['php_open_basedir'];
- $php_open_basedir = str_replace($this->oldDataRecord['domain'],$web_rec['domain'],$php_open_basedir);
- $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
- if(empty($web_rec['php_open_basedir']) ||
- (isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
- $document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
- $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
- $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
- $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
-
- //* Change database backup options when web backup options have been changed
- if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
- //* Update all databases
- $backup_interval = $this->dataRecord['backup_interval'];
- $backup_copies = $this->dataRecord['backup_copies'];
- $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $app->db->datalogUpdate('web_database', "backup_interval = '$backup_interval', backup_copies = '$backup_copies'", 'database_id', $rec['database_id']);
- }
- unset($records);
- unset($rec);
- unset($backup_copies);
- unset($backup_interval);
- }
-
- //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
- if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
- $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
- foreach($records as $rec) {
- $app->db->datalogUpdate('web_domain', "ip_address = '".$web_rec['ip_address']."', ipv6_address = '".$web_rec['ipv6_address']."'", 'domain_id', $rec['domain_id']);
- }
- unset($records);
- unset($rec);
- }
- }
-
- function onAfterDelete() {
- global $app, $conf;
-
- // Delete the sub and alias domains
- $child_domains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$this->id);
- foreach($child_domains as $d) {
- // Saving record to datalog when db_history enabled
- if($app->tform->formDef["db_history"] == 'yes') {
- $app->tform->datalogSave('DELETE',$d["domain_id"],$d,array());
- }
-
- $app->db->query("DELETE FROM web_domain WHERE domain_id = ".$d["domain_id"]." LIMIT 0,1");
- }
- unset($child_domains);
- unset($d);
-
- }
-
-}
-
-$page = new page_action;
-$page->onLoad();
-
+auth->check_module_permissions('sites');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions,tools_sites');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ //* Returna a "3/2/1" path hash from a numeric id '123'
+ function id_hash($id,$levels) {
+ $hash = "" . $id % 10 ;
+ $id /= 10 ;
+ $levels -- ;
+ while ( $levels > 0 ) {
+ $hash .= "/" . $id % 10 ;
+ $id /= 10 ;
+ $levels-- ;
+ }
+ return $hash;
+ }
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+ if(!$app->tform->checkClientLimit('limit_web_domain',"type = 'vhost'")) {
+ $app->error($app->tform->wordbook["limit_web_domain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]);
+ }
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $app->tpl->setVar("server_id_value", $client['default_webserver']);
+ }
+ $app->tform->formDef['tabs']['domain']['readonly'] = false;
+
+ parent::onShowNew();
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $app->uses('ini_parser,getconf');
+
+ $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+ //* 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, client." . implode(", client.", $read_limits) . " 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 = ".intval($client['default_webserver']));
+ $app->tpl->setVar("server_id","
$tmp[server_name] ");
+ unset($tmp);
+
+ //* 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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ip_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ //* Fill the IPv6 select field with the IP addresses that are allowed for this client
+ $sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+ $ips = $app->db->queryAllRecords($sql);
+ $ip_select = "
";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ipv6_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ if($this->dataRecord['php'] == 'fast-cgi'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver']))." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ // add limits to template to be able to hide settings
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
+ //* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+ } elseif ($_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.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " 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 = ".intval($client['default_webserver']));
+ $app->tpl->setVar("server_id","
$tmp[server_name] ");
+ unset($tmp);
+
+ // Fill the client select field
+ $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+ $records = $app->db->queryAllRecords($sql);
+ $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
+ $client_select = '
'.$client['contactname'].' ';
+ //$tmp_data_record = $app->tform->getDataRecord($this->id);
+ if(is_array($records)) {
+ $selected_client_group_id = 0; // needed to get list of PHP versions
+ foreach( $records as $rec) {
+ if(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $rec["groupid"];
+ $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+ if($selected == 'SELECTED') $selected_client_group_id = $rec["groupid"];
+ $client_select .= "
$rec[contactname] \r\n";
+ }
+ }
+ $app->tpl->setVar("client_group_id",$client_select);
+
+ //* 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 = ".intval($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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ip_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ //* Fill the IPv6 select field with the IP addresses that are allowed for this client
+ $sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+ $ips = $app->db->queryAllRecords($sql);
+ $ip_select = "
";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ipv6_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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';
+ $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $selected_client_group_id");
+ //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")";
+ $sql_where = " AND (client_id = 0 OR client_id = ".intval($selected_client['client_id']).")";
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver'])).$sql_where);
+ }
+ if($this->dataRecord['php'] == 'fast-cgi') {
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : intval($client['default_webserver'])).$sql_where);
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ // add limits to template to be able to hide settings
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
+ //* Admin: If the logged in user is admin
+ } else {
+
+ // The user is admin, so we fill in all IP addresses of the server
+ if($this->id > 0) {
+ if(!isset($this->dataRecord["server_id"])){
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ $this->dataRecord["server_id"] = $tmp["server_id"];
+ unset($tmp);
+ }
+ $server_id = intval(@$this->dataRecord["server_id"]);
+ } else {
+ // Get the first server ID
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
+ $server_id = intval($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 = ($web_config['enable_ip_wildcard'] == 'y')?"
* ":"";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ip_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ //* Fill the IPv6 select field
+ $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = $server_id";
+ $ips = $app->db->queryAllRecords($sql);
+ $ip_select = "
";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':'';
+ $ip_select .= "
$ip[ip_address] \r\n";
+ }
+ }
+ $app->tpl->setVar("ipv6_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ // Fill the client select field
+ $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+ $clients = $app->db->queryAllRecords($sql);
+ $client_select = "
";
+ //$tmp_data_record = $app->tform->getDataRecord($this->id);
+ if(is_array($clients)) {
+ $selected_client_group_id = 0; // needed to get list of PHP versions
+ foreach($clients as $client) {
+ if(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $client["groupid"];
+ //$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
+ $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+ if($selected == 'SELECTED') $selected_client_group_id = $client["groupid"];
+ $client_select .= "
$client[contactname] \r\n";
+ }
+ }
+ $app->tpl->setVar("client_group_id",$client_select);
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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';
+ $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $selected_client_group_id");
+ //$sql_where = " AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id']." OR client_id = ".intval($selected_client['client_id']).")";
+ $sql_where = " AND (client_id = 0 OR client_id = ".intval($selected_client['client_id']).")";
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where);
+ }
+ if($this->dataRecord['php'] == 'fast-cgi') {
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id".$sql_where);
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
+ // Directive Snippets
+ $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
+ $php_directive_snippets_txt = '';
+ if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
+ foreach($php_directive_snippets as $php_directive_snippet){
+ $php_directive_snippets_txt .= '
['.$php_directive_snippet['name'].']'.htmlentities($php_directive_snippet['snippet']).' ';
+ }
+ }
+ if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
+ $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
+
+ if($server_type == 'apache'){
+ $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
+ $apache_directive_snippets_txt = '';
+ if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
+ foreach($apache_directive_snippets as $apache_directive_snippet){
+ $apache_directive_snippets_txt .= '
['.$apache_directive_snippet['name'].']'.htmlentities($apache_directive_snippet['snippet']).' ';
+ }
+ }
+ if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
+ $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+ }
+
+ if($server_type == 'nginx'){
+ $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
+ $nginx_directive_snippets_txt = '';
+ if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
+ foreach($nginx_directive_snippets as $nginx_directive_snippet){
+ $nginx_directive_snippets_txt .= '
['.$nginx_directive_snippet['name'].']'.htmlentities($nginx_directive_snippet['snippet']).' ';
+ }
+ }
+ if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
+ $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+ }
+
+ $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
+ $proxy_directive_snippets_txt = '';
+ if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
+ foreach($proxy_directive_snippets as $proxy_directive_snippet){
+ $proxy_directive_snippets_txt .= '
['.$proxy_directive_snippet['name'].']'.htmlentities($proxy_directive_snippet['snippet']).' ';
+ }
+ }
+ if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
+ $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+ }
+
+ $ssl_domain_select = '';
+ $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
+ $ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"],'*.'.$tmp["domain"]);
+ if(is_array($ssl_domains)) {
+ foreach( $ssl_domains as $ssl_domain) {
+ $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
+ $ssl_domain_select .= "
$ssl_domain \r\n";
+ }
+ }
+ $app->tpl->setVar("ssl_domain",$ssl_domain_select);
+ unset($ssl_domain_select);
+ unset($ssl_domains);
+ unset($ssl_domain);
+
+ if($this->id > 0) {
+ //* we are editing a existing record
+ $app->tpl->setVar("edit_disabled", 1);
+ $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
+ } else {
+ $app->tpl->setVar("edit_disabled", 0);
+ }
+
+ $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'
('.$app->tform->lng('traffic_quota_exceeded_txt').') ':'';
+ $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt);
+
+ /*
+ * Now we have to check, if we should use the domain-module to select the domain
+ * or not
+ */
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ /*
+ * The domain-module is in use.
+ */
+ $domains = $app->tools_sites->getDomainModuleDomains();
+ $domain_select = '';
+ if(is_array($domains) && sizeof($domains) > 0) {
+ /* We have domains in the list, so create the drop-down-list */
+ foreach( $domains as $domain) {
+ $domain_select .= "
functions->idn_decode($domain['domain']) . " \r\n";
+ }
+ }
+ else {
+ /*
+ * We have no domains in the domain-list. This means, we can not add ANY new domain.
+ * To avoid, that the variable "domain_option" is empty and so the user can
+ * free enter a domain, we have to create a empty option!
+ */
+ $domain_select .= "
\r\n";
+ }
+ $app->tpl->setVar("domain_option",$domain_select);
+ }
+
+ // check for configuration errors in sys_datalog
+ if($this->id > 0) {
+ $datalog = $app->db->queryOneRecord("SELECT sys_datalog.error, sys_log.tstamp FROM sys_datalog, sys_log WHERE sys_datalog.dbtable = 'web_domain' AND sys_datalog.dbidx = 'domain_id:".$this->id."' AND sys_datalog.datalog_id = sys_log.datalog_id AND sys_log.message = CONCAT('Processed datalog_id ',sys_log.datalog_id) ORDER BY sys_datalog.tstamp DESC");
+ if(is_array($datalog) && !empty($datalog)){
+ if(trim($datalog['error']) != ''){
+ $app->tpl->setVar("config_error_msg",nl2br(htmlentities($datalog['error'])));
+ $app->tpl->setVar("config_error_tstamp",date($app->lng('conf_format_datetime'), $datalog['tstamp']));
+ }
+ }
+ }
+
+ parent::onShowEnd();
+ }
+
+ function onShowEdit() {
+ global $app;
+ if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
+ parent::onShowEdit();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ /* check if the domain module is used - and check if the selected domain can be used! */
+ if($app->tform->getCurrentTab() == 'domain') {
+ $app->uses('ini_parser,getconf');
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+ if(!$domain_check) {
+ // invalid domain selected
+ $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
";
+ } else {
+ $this->dataRecord['domain'] = $domain_check;
+ }
+ }
+ }
+
+ // nginx: if redirect type is proxy and redirect path is no URL, display error
+ //if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
+ // $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."
";
+ //}
+
+ // Set a few fixed values
+ $this->dataRecord["parent_domain_id"] = 0;
+ $this->dataRecord["type"] = 'vhost';
+ $this->dataRecord["vhost_type"] = 'name';
+
+ $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+ if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+ if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+ if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+ if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+ if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
+ if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+ if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+ if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
+ // only generate quota and traffic warnings if value has changed
+ if($this->id > 0) {
+ $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ } else {
+ $old_web_values = $_POST;
+ }
+
+ //* Check the website quota of the client
+ if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
+ $webquota = $tmp["webquota"];
+ $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
+ if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) {
+ $max_free_quota = floor($client["limit_web_quota"] - $webquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["hd_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+
+ //* Check the traffic quota of the client
+ if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
+ $trafficquota = $tmp["trafficquota"];
+ $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
+ if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) {
+ $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["traffic_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+
+ if($client['parent_client_id'] > 0) {
+ // Get the limits of the reseller
+ $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
+
+ //* Check the website quota of the client
+ if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
+ $webquota = $tmp["webquota"];
+ $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
+ if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) {
+ $max_free_quota = floor($reseller["limit_web_quota"] - $webquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["hd_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+
+ //* Check the traffic quota of the client
+ if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
+ $trafficquota = $tmp["trafficquota"];
+ $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
+ if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) {
+ $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["traffic_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+ }
+
+ // When the record is updated
+ if($this->id > 0) {
+ // restore the server ID if the user is not admin and record is edited
+ $tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ $this->dataRecord["server_id"] = $tmp["server_id"];
+
+ // set the settings to current if not provided (or cleared due to limits)
+ if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+ if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+ if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+ if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+ if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+ if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+ if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+ if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+ if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
+ unset($tmp);
+ // When the record is inserted
+ } else {
+ //* set the server ID to the default webserver of the client
+ $this->dataRecord["server_id"] = $client["default_webserver"];
+
+ // Check if the user may add another web_domain
+ if($client["limit_web_domain"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'");
+ if($tmp["number"] >= $client["limit_web_domain"]) {
+ $app->error($app->tform->wordbook["limit_web_domain_txt"]);
+ }
+ }
+
+ }
+
+ // Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
+ if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
+ }
+
+ //* make sure that the email domain is lowercase
+ if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
+
+ //* get the server config for this server
+ $app->uses("getconf");
+ if($this->id > 0){
+ $web_rec = $app->tform->getDataRecord($this->id);
+ $server_id = $web_rec["server_id"];
+ } else {
+ // Get the first server ID
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
+ $server_id = intval($tmp['server_id']);
+ }
+ $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id),'web');
+ //* Check for duplicate ssl certs per IP if SNI is disabled
+ if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
+ $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
+ $tmp = $app->db->queryOneRecord($sql);
+ if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
+ }
+
+ // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
+ if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
+ if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
+
+ } else {
+ $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
';
+ }
+ }
+
+ // Check rewrite rules
+ $server_type = $web_config['server_type'];
+
+ if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
+ $rewrite_rules = trim($this->dataRecord['rewrite_rules']);
+ $rewrites_are_valid = true;
+ // use this counter to make sure all curly brackets are properly closed
+ $if_level = 0;
+ // Make sure we only have Unix linebreaks
+ $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules);
+ $rewrite_rules = str_replace("\r", "\n", $rewrite_rules);
+ $rewrite_rule_lines = explode("\n", $rewrite_rules);
+ if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
+ foreach($rewrite_rule_lines as $rewrite_rule_line){
+ // ignore comments
+ if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+ // empty lines
+ if(trim($rewrite_rule_line) == '') continue;
+ // rewrite
+ if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue;
+ // if
+ if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+ $if_level += 1;
+ continue;
+ }
+ // if - check for files, directories, etc.
+ if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+ $if_level += 1;
+ continue;
+ }
+ // break
+ if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){
+ continue;
+ }
+ // return code [ text ]
+ if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue;
+ // return code URL
+ // return URL
+ if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue;
+ // set
+ if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue;
+ // closing curly bracket
+ if(trim($rewrite_rule_line) == '}'){
+ $if_level -= 1;
+ continue;
+ }
+ $rewrites_are_valid = false;
+ break;
+ }
+ }
+
+ if(!$rewrites_are_valid || $if_level != 0){
+ $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
';
+ }
+ }
+
+ parent::onSubmit();
+ }
+
+ function onAfterInsert() {
+ global $app, $conf;
+
+ // make sure that the record belongs to the clinet group and not the admin group when admin inserts it
+ // also make sure that the user can not delete domain created by a admin
+ if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
+ }
+ if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id);
+ }
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_rec = $app->tform->getDataRecord($this->id);
+ $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+ $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+ $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
+ $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
+ $document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
+ $document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
+
+ // get the ID of the client
+ if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
+ $client_id = $app->functions->intval($client["client_id"]);
+ } else {
+ //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($this->dataRecord["client_group_id"]));
+ $client_id = $app->functions->intval($client["client_id"]);
+ }
+
+ // Set the values for document_root, system_user and system_group
+ $system_user = $app->db->quote('web'.$this->id);
+ $system_group = $app->db->quote('client'.$client_id);
+ $document_root = str_replace("[client_id]",$client_id,$document_root);
+ $document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
+ $document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
+ $document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
+ $document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+ $document_root = $app->db->quote($document_root);
+ $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
+ $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+ $htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);
+
+ $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+ function onBeforeUpdate () {
+ global $app, $conf;
+
+ //* Check if the server has been changed
+ // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
+ if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ if (isset($this->dataRecord["server_id"])) {
+ $rec = $app->db->queryOneRecord("SELECT server_id from web_domain WHERE domain_id = ".$this->id);
+ if($rec['server_id'] != $this->dataRecord["server_id"]) {
+ //* Add a error message and switch back to old server
+ $app->tform->errorMessage .= $app->lng('The Server can not be changed.');
+ $this->dataRecord["server_id"] = $rec['server_id'];
+ }
+ unset($rec);
+ }
+ //* If the user is neither admin nor reseller
+ } else {
+ //* We do not allow users to change a domain which has been created by the admin
+ $rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain, ip_address, ipv6_address from web_domain WHERE domain_id = ".$this->id);
+ if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+ //* Add a error message and switch back to old server
+ $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
+ $this->dataRecord["domain"] = $rec['domain'];
+ }
+ if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
+ $this->dataRecord["ip_address"] = $rec['ip_address'];
+ }
+ if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
+ $this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
+ }
+ unset($rec);
+ }
+
+ //* Check that all fields for the SSL cert creation are filled
+ if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
+ if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
';
+ if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
';
+ if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
';
+ if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
';
+ if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
';
+ }
+
+ if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
+ if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
';
+ }
+
+ }
+
+ function onAfterUpdate() {
+ global $app, $conf;
+
+ // make sure that the record belongs to the client group and not the admin group when a admin inserts it
+ // also make sure that the user can not delete domain created by a admin
+ if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
+ }
+ if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id);
+ }
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_rec = $app->tform->getDataRecord($this->id);
+ $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+ $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+ $page_formid = isset($page_form->id) ? $page_form->id : '';
+ $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
+ $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
+ $document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
+ $document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
+
+ // get the ID of the client
+ if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
+ $client_id = $app->functions->intval($client["client_id"]);
+ } elseif (isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $this->dataRecord["client_group_id"];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval(@$this->dataRecord["client_group_id"]));
+ $client_id = $app->functions->intval($client["client_id"]);
+ } else {
+ $client_group_id = $web_rec['sys_groupid'];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($client_group_id));
+ $client_id = $app->functions->intval($client["client_id"]);
+ }
+
+ if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"]) {
+ // Set the values for document_root, system_user and system_group
+ $system_user = $app->db->quote('web'.$this->id);
+ $system_group = $app->db->quote('client'.$client_id);
+ $document_root = str_replace("[client_id]",$client_id,$document_root);
+ $document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
+ $document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
+ $document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
+ $document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+ $document_root = $app->db->quote($document_root);
+
+ $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
+ //$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+
+ // Update the FTP user(s) too
+ $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $app->db->datalogUpdate('ftp_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', uid = '$system_user', gid = '$system_group', dir = '$document_root'", 'ftp_user_id', $rec['ftp_user_id']);
+ }
+ unset($records);
+ unset($rec);
+
+ // Update the Shell user(s) too
+ $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $app->db->datalogUpdate('shell_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', puser = '$system_user', pgroup = '$system_group', dir = '$document_root'", 'shell_user_id', $rec['shell_user_id']);
+ }
+ unset($records);
+ unset($rec);
+
+ //* Update all subdomains and alias domains
+ $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
+ if($rec['type'] == 'vhostsubdomain') {
+ $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$rec['web_folder'],$web_config["php_open_basedir"]);
+ $php_open_basedir = str_replace("[website_domain]/web",$rec['domain'].'/'.$rec['web_folder'],$php_open_basedir);
+ $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
+ $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$rec['domain'],$php_open_basedir));
+
+ $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
+ }
+ $app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']);
+ }
+ unset($records);
+ unset($rec);
+
+ //* Update all databases
+ $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $app->db->datalogUpdate('web_database', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'", 'database_id', $rec['database_id']);
+ }
+ unset($records);
+ unset($rec);
+
+ }
+
+ //* If the domain name has been changed, we will have to change all subdomains + APS instances
+ if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
+ $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
+ foreach($records as $rec) {
+ $subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
+ $app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']);
+ }
+ unset($records);
+ unset($rec);
+ unset($subdomain);
+
+ // Update APS instances
+ $records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'");
+ if(is_array($records) && !empty($records)){
+ foreach($records as $rec){
+ $app->db->datalogUpdate('aps_instances_settings', "value = '".$this->dataRecord["domain"]."'", 'id', $rec['id']);
+ // Reinstall of package needed?
+ //$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']);
+ }
+ }
+ unset($records);
+ unset($rec);
+ }
+
+ //* Set allow_override if empty
+ if($web_rec['allow_override'] == '') {
+ $sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+ //* Set php_open_basedir if empty or domain or client has been changed
+ if(empty($web_rec['php_open_basedir']) ||
+ (!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
+ $php_open_basedir = $web_rec['php_open_basedir'];
+ $php_open_basedir = str_replace($this->oldDataRecord['domain'],$web_rec['domain'],$php_open_basedir);
+ $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+ if(empty($web_rec['php_open_basedir']) ||
+ (isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
+ $document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
+ $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
+ $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+ $sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+ //* Change database backup options when web backup options have been changed
+ if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
+ //* Update all databases
+ $backup_interval = $this->dataRecord['backup_interval'];
+ $backup_copies = $this->dataRecord['backup_copies'];
+ $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $app->db->datalogUpdate('web_database', "backup_interval = '$backup_interval', backup_copies = '$backup_copies'", 'database_id', $rec['database_id']);
+ }
+ unset($records);
+ unset($rec);
+ unset($backup_copies);
+ unset($backup_interval);
+ }
+
+ //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
+ if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
+ $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
+ foreach($records as $rec) {
+ $app->db->datalogUpdate('web_domain', "ip_address = '".$web_rec['ip_address']."', ipv6_address = '".$web_rec['ipv6_address']."'", 'domain_id', $rec['domain_id']);
+ }
+ unset($records);
+ unset($rec);
+ }
+ }
+
+ function onAfterDelete() {
+ global $app, $conf;
+
+ // Delete the sub and alias domains
+ $child_domains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$this->id);
+ foreach($child_domains as $d) {
+ // Saving record to datalog when db_history enabled
+ if($app->tform->formDef["db_history"] == 'yes') {
+ $app->tform->datalogSave('DELETE',$d["domain_id"],$d,array());
+ }
+
+ $app->db->query("DELETE FROM web_domain WHERE domain_id = ".$d["domain_id"]." LIMIT 0,1");
+ }
+ unset($child_domains);
+ unset($d);
+
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
?>
\ No newline at end of file
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index f5989f9d15d6f4a7829a9afeef3ce23a3f7f4dbd..9c1a1966f427fb1592c5c2312572e0e3002b3029 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -1,619 +1,619 @@
-auth->check_module_permissions('sites');
-
-// Loading classes
-$app->uses('tpl,tform,tform_actions,tools_sites');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
- //* Returna a "3/2/1" path hash from a numeric id '123'
- function id_hash($id,$levels) {
- $hash = "" . $id % 10 ;
- $id /= 10 ;
- $levels -- ;
- while ( $levels > 0 ) {
- $hash .= "/" . $id % 10 ;
- $id /= 10 ;
- $levels-- ;
- }
- return $hash;
- }
-
- function onShowNew() {
- global $app, $conf;
-
- // we will check only users, not admins
- if($_SESSION["s"]["user"]["typ"] == 'user') {
- if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
- $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
- }
- if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
- $app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
- }
- }
- parent::onShowNew();
- }
-
- function onShowEnd() {
- global $app, $conf;
-
- $app->uses('ini_parser,getconf');
-
- $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-
- $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
-
- //* 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_subdomain, client.default_webserver, client." . implode(", client.", $read_limits) . " 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($parent_domain['server_id'], 'web');
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- if($this->dataRecord['php'] == 'fast-cgi'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- // add limits to template to be able to hide settings
- foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-
-
- //* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
- } elseif ($_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.client_id, client.limit_web_subdomain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " 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($parent_domain['server_id'], 'web');
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- if($this->dataRecord['php'] == 'fast-cgi') {
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- // add limits to template to be able to hide settings
- foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-
-
- //* Admin: If the logged in user is admin
- } else {
-
- //* get global web config
- $web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
-
- //PHP Version Selection (FastCGI)
- $server_type = 'apache';
- 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'){
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = " . $parent_domain['server_id']);
- }
- if($this->dataRecord['php'] == 'fast-cgi') {
- $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = " . $parent_domain['server_id']);
- }
- $php_select = "
Default ";
- if(is_array($php_records) && !empty($php_records)) {
- foreach( $php_records as $php_record) {
- if($this->dataRecord['php'] == 'php-fpm'){
- $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
- } else {
- $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
- }
- $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
- $php_select .= "
".$php_record['name']." \r\n";
- }
- }
- $app->tpl->setVar("fastcgi_php_version",$php_select);
- unset($php_records);
-
- foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-
- // Directive Snippets
- $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
- $php_directive_snippets_txt = '';
- if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
- foreach($php_directive_snippets as $php_directive_snippet){
- $php_directive_snippets_txt .= '
['.$php_directive_snippet['name'].']'.$php_directive_snippet['snippet'].' ';
- }
- }
- if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
- $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-
- if($server_type == 'apache'){
- $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
- $apache_directive_snippets_txt = '';
- if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
- foreach($apache_directive_snippets as $apache_directive_snippet){
- $apache_directive_snippets_txt .= '
['.$apache_directive_snippet['name'].']'.$apache_directive_snippet['snippet'].' ';
- }
- }
- if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
- $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
- }
-
- if($server_type == 'nginx'){
- $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
- $nginx_directive_snippets_txt = '';
- if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
- foreach($nginx_directive_snippets as $nginx_directive_snippet){
- $nginx_directive_snippets_txt .= '
['.$nginx_directive_snippet['name'].']'.$nginx_directive_snippet['snippet'].' ';
- }
- }
- if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
- $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
- }
-
- $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
- $proxy_directive_snippets_txt = '';
- if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
- foreach($proxy_directive_snippets as $proxy_directive_snippet){
- $proxy_directive_snippets_txt .= '
['.$proxy_directive_snippet['name'].']'.$proxy_directive_snippet['snippet'].' ';
- }
- }
- if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
- $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
- }
-
- $ssl_domain_select = '';
- $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
- $ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"]);
- if(is_array($ssl_domains)) {
- foreach( $ssl_domains as $ssl_domain) {
- $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
- $ssl_domain_select .= "
$ssl_domain \r\n";
- }
- }
-
- if($this->id > 0) {
- $app->tpl->setVar('fixed_folder', 'y');
- $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
- } else {
- $app->tpl->setVar('fixed_folder', 'n');
- $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
- }
-
- $app->tpl->setVar("ssl_domain",$ssl_domain_select);
- unset($ssl_domain_select);
- unset($ssl_domains);
- unset($ssl_domain);
-
- $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'
('.$app->tform->lng('traffic_quota_exceeded_txt').') ':'';
- $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt);
-
-
- $app->uses('ini_parser,getconf');
- $settings = $app->getconf->get_global_config('domains');
- if ($settings['use_domain_module'] == 'y') {
- /*
- * The domain-module is in use.
- */
- $domains = $app->tools_sites->getDomainModuleDomains();
- $domain_select = '';
- $selected_domain = '';
- if(is_array($domains) && sizeof($domains) > 0) {
- /* We have domains in the list, so create the drop-down-list */
- foreach( $domains as $domain) {
- $domain_select .= "
functions->idn_decode($domain['domain']) . " \r\n";
- }
- }
- else {
- /*
- * We have no domains in the domain-list. This means, we can not add ANY new domain.
- * To avoid, that the variable "domain_option" is empty and so the user can
- * free enter a domain, we have to create a empty option!
- */
- $domain_select .= "
\r\n";
- }
- $app->tpl->setVar("domain_option",$domain_select);
- $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
- } else {
-
- // remove the parent domain part of the domain name before we show it in the text field.
- $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
- }
- $app->tpl->setVar("domain",$this->dataRecord["domain"]);
-
- parent::onShowEnd();
- }
-
- function onSubmit() {
- global $app, $conf;
-
- // Get the record of the parent domain
- if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
- $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
- unset($tmp);
- }
-
- $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
- if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-
- // Set a few fixed values
- $this->dataRecord["type"] = 'vhostsubdomain';
- $this->dataRecord["server_id"] = $parent_domain["server_id"];
- $this->dataRecord["ip_address"] = $parent_domain["ip_address"];
- $this->dataRecord["ipv6_address"] = $parent_domain["ipv6_address"];
- $this->dataRecord["client_group_id"] = $parent_domain["client_group_id"];
- $this->dataRecord["vhost_type"] = 'name';
-
- $this->parent_domain_record = $parent_domain;
-
- $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-
- if($app->tform->getCurrentTab() == 'domain') {
-
- /* check if the domain module is used - and check if the selected domain can be used! */
- $app->uses('ini_parser,getconf');
- $settings = $app->getconf->get_global_config('domains');
- if ($settings['use_domain_module'] == 'y') {
- $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
- if(!$domain_check) {
- // invalid domain selected
- $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
";
- } else {
- $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
- }
- } else {
- $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
- }
-
-
- $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
- if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1);
- if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1);
- $forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
- $check_folder = strtolower($this->dataRecord['web_folder']);
- if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
- if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
- if(in_array($check_folder, $forbidden_folders)) {
- $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
";
- }
-
- // vhostsubdomains do not have a quota of their own
- $this->dataRecord["hd_quota"] = 0;
-
- // check for duplicate folder usage
- /*
- $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'");
- if($check && $check['cnt'] > 0) {
- $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
";
- }
- */
- } else {
- $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
- }
-
- if($_SESSION["s"]["user"]["typ"] != 'admin') {
- // Get the limits of the client
- $client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-
- if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
- if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
- if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
- if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
- if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
- if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
- if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
- if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
- if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-
- // only generate quota and traffic warnings if value has changed
- if($this->id > 0) {
- $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- } else {
- $old_web_values = $_POST;
- }
-
- //* Check the traffic quota of the client
- if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
- $trafficquota = $tmp["trafficquota"];
- $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
- if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) {
- $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["traffic_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
-
- if($client['parent_client_id'] > 0) {
- // Get the limits of the reseller
- $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
-
- //* Check the traffic quota of the client
- if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
- $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
- $trafficquota = $tmp["trafficquota"];
- $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
- if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) {
- $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota);
- if($max_free_quota < 0) $max_free_quota = 0;
- $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
- // Set the quota field to the max free space
- $this->dataRecord["traffic_quota"] = $max_free_quota;
- }
- unset($tmp);
- unset($tmp_quota);
- }
- }
-
- // When the record is updated
- if($this->id > 0) {
- // restore the server ID if the user is not admin and record is edited
- $tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
- $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
-
- // set the settings to current if not provided (or cleared due to limits)
- if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
- if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
- if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
- if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
- if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
- if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
- if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
- if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
- if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-
- unset($tmp);
- // When the record is inserted
- } else {
- // Check if the user may add another web_domain
- if($client["limit_web_subdomain"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and (type = 'subdomain' OR type = 'vhostsubdomain')");
- if($tmp["number"] >= $client["limit_web_subdomain"]) {
- $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
- }
- }
- }
- }
-
- //* make sure that the domain is lowercase
- if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-
- //* get the server config for this server
- $app->uses("getconf");
- $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
- //* Check for duplicate ssl certs per IP if SNI is disabled
- if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
- $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
- $tmp = $app->db->queryOneRecord($sql);
- if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
- }
-
- // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
- if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
- if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-
- } else {
- $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
';
- }
- }
-
- // Check rewrite rules
- $server_type = $web_config['server_type'];
-
- if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
- $rewrite_rules = trim($this->dataRecord['rewrite_rules']);
- $rewrites_are_valid = true;
- // use this counter to make sure all curly brackets are properly closed
- $if_level = 0;
- // Make sure we only have Unix linebreaks
- $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules);
- $rewrite_rules = str_replace("\r", "\n", $rewrite_rules);
- $rewrite_rule_lines = explode("\n", $rewrite_rules);
- if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
- foreach($rewrite_rule_lines as $rewrite_rule_line){
- // ignore comments
- if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
- // empty lines
- if(trim($rewrite_rule_line) == '') continue;
- // rewrite
- if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue;
- // if
- if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){
- $if_level += 1;
- continue;
- }
- // if - check for files, directories, etc.
- if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){
- $if_level += 1;
- continue;
- }
- // break
- if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){
- continue;
- }
- // return code [ text ]
- if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue;
- // return code URL
- // return URL
- if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue;
- // set
- if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue;
- // closing curly bracket
- if(trim($rewrite_rule_line) == '}'){
- $if_level -= 1;
- continue;
- }
- $rewrites_are_valid = false;
- break;
- }
- }
-
- if(!$rewrites_are_valid || $if_level != 0){
- $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
';
- }
- }
-
- parent::onSubmit();
- }
-
- function onAfterInsert() {
- global $app, $conf;
-
- // Get configuration for the web system
- $app->uses("getconf");
- $web_rec = $app->tform->getDataRecord($this->id);
- $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
- //var_dump($this->parent_domain_record, $web_rec);
- // Set the values for document_root, system_user and system_group
- $system_user = $app->db->quote($this->parent_domain_record['system_user']);
- $system_group = $app->db->quote($this->parent_domain_record['system_group']);
- $document_root = $app->db->quote($this->parent_domain_record['document_root']);
- $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
- $php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
- $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
- $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
- $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
-
- $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
-
- function onBeforeUpdate () {
- global $app, $conf;
-
- //* Check that all fields for the SSL cert creation are filled
- if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
- if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
';
- if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
';
- if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
';
- if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
';
- if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
';
- }
-
- if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
- if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
';
- }
-
- }
-
- function onAfterUpdate() {
- global $app, $conf;
-
- // Get configuration for the web system
- $app->uses("getconf");
- $web_rec = $app->tform->getDataRecord($this->id);
- $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-
- // Set the values for document_root, system_user and system_group
- $system_user = $app->db->quote($this->parent_domain_record['system_user']);
- $system_group = $app->db->quote($this->parent_domain_record['system_group']);
- $document_root = $app->db->quote($this->parent_domain_record['document_root']);
- $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
- $php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
- $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
- $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
- $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
-
- $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
- $app->db->query($sql);
- }
-
-}
-
-$page = new page_action;
-$page->onLoad();
-
+auth->check_module_permissions('sites');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions,tools_sites');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ //* Returna a "3/2/1" path hash from a numeric id '123'
+ function id_hash($id,$levels) {
+ $hash = "" . $id % 10 ;
+ $id /= 10 ;
+ $levels -- ;
+ while ( $levels > 0 ) {
+ $hash .= "/" . $id % 10 ;
+ $id /= 10 ;
+ $levels-- ;
+ }
+ return $hash;
+ }
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+ if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+ $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
+ }
+ }
+ parent::onShowNew();
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $app->uses('ini_parser,getconf');
+
+ $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
+ //* 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_subdomain, client.default_webserver, client." . implode(", client.", $read_limits) . " 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($parent_domain['server_id'], 'web');
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ if($this->dataRecord['php'] == 'fast-cgi'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ // add limits to template to be able to hide settings
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
+ //* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+ } elseif ($_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.client_id, client.limit_web_subdomain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " 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($parent_domain['server_id'], 'web');
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ if($this->dataRecord['php'] == 'fast-cgi') {
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$parent_domain['server_id']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ // add limits to template to be able to hide settings
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
+ //* Admin: If the logged in user is admin
+ } else {
+
+ //* get global web config
+ $web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
+
+ //PHP Version Selection (FastCGI)
+ $server_type = 'apache';
+ 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'){
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = " . $parent_domain['server_id']);
+ }
+ if($this->dataRecord['php'] == 'fast-cgi') {
+ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = " . $parent_domain['server_id']);
+ }
+ $php_select = "
Default ";
+ if(is_array($php_records) && !empty($php_records)) {
+ foreach( $php_records as $php_record) {
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+ } else {
+ $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+ }
+ $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
+ $php_select .= "
".$php_record['name']." \r\n";
+ }
+ }
+ $app->tpl->setVar("fastcgi_php_version",$php_select);
+ unset($php_records);
+
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
+ // Directive Snippets
+ $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
+ $php_directive_snippets_txt = '';
+ if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
+ foreach($php_directive_snippets as $php_directive_snippet){
+ $php_directive_snippets_txt .= '
['.$php_directive_snippet['name'].']'.$php_directive_snippet['snippet'].' ';
+ }
+ }
+ if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
+ $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
+
+ if($server_type == 'apache'){
+ $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
+ $apache_directive_snippets_txt = '';
+ if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
+ foreach($apache_directive_snippets as $apache_directive_snippet){
+ $apache_directive_snippets_txt .= '
['.$apache_directive_snippet['name'].']'.$apache_directive_snippet['snippet'].' ';
+ }
+ }
+ if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
+ $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+ }
+
+ if($server_type == 'nginx'){
+ $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
+ $nginx_directive_snippets_txt = '';
+ if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
+ foreach($nginx_directive_snippets as $nginx_directive_snippet){
+ $nginx_directive_snippets_txt .= '
['.$nginx_directive_snippet['name'].']'.$nginx_directive_snippet['snippet'].' ';
+ }
+ }
+ if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
+ $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+ }
+
+ $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
+ $proxy_directive_snippets_txt = '';
+ if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
+ foreach($proxy_directive_snippets as $proxy_directive_snippet){
+ $proxy_directive_snippets_txt .= '
['.$proxy_directive_snippet['name'].']'.$proxy_directive_snippet['snippet'].' ';
+ }
+ }
+ if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
+ $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+ }
+
+ $ssl_domain_select = '';
+ $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
+ $ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"]);
+ if(is_array($ssl_domains)) {
+ foreach( $ssl_domains as $ssl_domain) {
+ $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
+ $ssl_domain_select .= "
$ssl_domain \r\n";
+ }
+ }
+
+ if($this->id > 0) {
+ $app->tpl->setVar('fixed_folder', 'y');
+ $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+ } else {
+ $app->tpl->setVar('fixed_folder', 'n');
+ $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+ }
+
+ $app->tpl->setVar("ssl_domain",$ssl_domain_select);
+ unset($ssl_domain_select);
+ unset($ssl_domains);
+ unset($ssl_domain);
+
+ $tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'
('.$app->tform->lng('traffic_quota_exceeded_txt').') ':'';
+ $app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt);
+
+
+ $app->uses('ini_parser,getconf');
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ /*
+ * The domain-module is in use.
+ */
+ $domains = $app->tools_sites->getDomainModuleDomains();
+ $domain_select = '';
+ $selected_domain = '';
+ if(is_array($domains) && sizeof($domains) > 0) {
+ /* We have domains in the list, so create the drop-down-list */
+ foreach( $domains as $domain) {
+ $domain_select .= "
functions->idn_decode($domain['domain']) . " \r\n";
+ }
+ }
+ else {
+ /*
+ * We have no domains in the domain-list. This means, we can not add ANY new domain.
+ * To avoid, that the variable "domain_option" is empty and so the user can
+ * free enter a domain, we have to create a empty option!
+ */
+ $domain_select .= "
\r\n";
+ }
+ $app->tpl->setVar("domain_option",$domain_select);
+ $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
+ } else {
+
+ // remove the parent domain part of the domain name before we show it in the text field.
+ $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
+ }
+ $app->tpl->setVar("domain",$this->dataRecord["domain"]);
+
+ parent::onShowEnd();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Get the record of the parent domain
+ if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
+ $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
+ unset($tmp);
+ }
+
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+ if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
+ // Set a few fixed values
+ $this->dataRecord["type"] = 'vhostsubdomain';
+ $this->dataRecord["server_id"] = $parent_domain["server_id"];
+ $this->dataRecord["ip_address"] = $parent_domain["ip_address"];
+ $this->dataRecord["ipv6_address"] = $parent_domain["ipv6_address"];
+ $this->dataRecord["client_group_id"] = $parent_domain["client_group_id"];
+ $this->dataRecord["vhost_type"] = 'name';
+
+ $this->parent_domain_record = $parent_domain;
+
+ $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+ if($app->tform->getCurrentTab() == 'domain') {
+
+ /* check if the domain module is used - and check if the selected domain can be used! */
+ $app->uses('ini_parser,getconf');
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
+ if(!$domain_check) {
+ // invalid domain selected
+ $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
";
+ } else {
+ $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
+ }
+ } else {
+ $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+ }
+
+
+ $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
+ if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1);
+ if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1);
+ $forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
+ $check_folder = strtolower($this->dataRecord['web_folder']);
+ if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
+ if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
+ if(in_array($check_folder, $forbidden_folders)) {
+ $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
";
+ }
+
+ // vhostsubdomains do not have a quota of their own
+ $this->dataRecord["hd_quota"] = 0;
+
+ // check for duplicate folder usage
+ /*
+ $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'");
+ if($check && $check['cnt'] > 0) {
+ $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
";
+ }
+ */
+ } else {
+ $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+ }
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+ if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+ if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+ if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+ if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+ if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
+ if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+ if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+ if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
+ // only generate quota and traffic warnings if value has changed
+ if($this->id > 0) {
+ $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ } else {
+ $old_web_values = $_POST;
+ }
+
+ //* Check the traffic quota of the client
+ if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
+ $trafficquota = $tmp["trafficquota"];
+ $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
+ if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) {
+ $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["traffic_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+
+ if($client['parent_client_id'] > 0) {
+ // Get the limits of the reseller
+ $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
+
+ //* Check the traffic quota of the client
+ if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
+ $trafficquota = $tmp["trafficquota"];
+ $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
+ if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) {
+ $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota);
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";
+ // Set the quota field to the max free space
+ $this->dataRecord["traffic_quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+ }
+
+ // When the record is updated
+ if($this->id > 0) {
+ // restore the server ID if the user is not admin and record is edited
+ $tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+ $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
+
+ // set the settings to current if not provided (or cleared due to limits)
+ if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+ if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+ if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+ if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+ if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+ if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+ if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+ if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+ if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
+ unset($tmp);
+ // When the record is inserted
+ } else {
+ // Check if the user may add another web_domain
+ if($client["limit_web_subdomain"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and (type = 'subdomain' OR type = 'vhostsubdomain')");
+ if($tmp["number"] >= $client["limit_web_subdomain"]) {
+ $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
+ }
+ }
+ }
+ }
+
+ //* make sure that the domain is lowercase
+ if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
+
+ //* get the server config for this server
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
+ //* Check for duplicate ssl certs per IP if SNI is disabled
+ if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
+ $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
+ $tmp = $app->db->queryOneRecord($sql);
+ if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
+ }
+
+ // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
+ if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
+ if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
+
+ } else {
+ $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
';
+ }
+ }
+
+ // Check rewrite rules
+ $server_type = $web_config['server_type'];
+
+ if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
+ $rewrite_rules = trim($this->dataRecord['rewrite_rules']);
+ $rewrites_are_valid = true;
+ // use this counter to make sure all curly brackets are properly closed
+ $if_level = 0;
+ // Make sure we only have Unix linebreaks
+ $rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules);
+ $rewrite_rules = str_replace("\r", "\n", $rewrite_rules);
+ $rewrite_rule_lines = explode("\n", $rewrite_rules);
+ if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
+ foreach($rewrite_rule_lines as $rewrite_rule_line){
+ // ignore comments
+ if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+ // empty lines
+ if(trim($rewrite_rule_line) == '') continue;
+ // rewrite
+ if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue;
+ // if
+ if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+ $if_level += 1;
+ continue;
+ }
+ // if - check for files, directories, etc.
+ if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+ $if_level += 1;
+ continue;
+ }
+ // break
+ if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){
+ continue;
+ }
+ // return code [ text ]
+ if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue;
+ // return code URL
+ // return URL
+ if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue;
+ // set
+ if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue;
+ // closing curly bracket
+ if(trim($rewrite_rule_line) == '}'){
+ $if_level -= 1;
+ continue;
+ }
+ $rewrites_are_valid = false;
+ break;
+ }
+ }
+
+ if(!$rewrites_are_valid || $if_level != 0){
+ $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'
';
+ }
+ }
+
+ parent::onSubmit();
+ }
+
+ function onAfterInsert() {
+ global $app, $conf;
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_rec = $app->tform->getDataRecord($this->id);
+ $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+ //var_dump($this->parent_domain_record, $web_rec);
+ // Set the values for document_root, system_user and system_group
+ $system_user = $app->db->quote($this->parent_domain_record['system_user']);
+ $system_group = $app->db->quote($this->parent_domain_record['system_group']);
+ $document_root = $app->db->quote($this->parent_domain_record['document_root']);
+ $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
+ $php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
+ $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
+ $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+ $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
+
+ $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+ function onBeforeUpdate () {
+ global $app, $conf;
+
+ //* Check that all fields for the SSL cert creation are filled
+ if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
+ if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'
';
+ if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'
';
+ if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'
';
+ if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'
';
+ if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'
';
+ }
+
+ if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
+ if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'
';
+ }
+
+ }
+
+ function onAfterUpdate() {
+ global $app, $conf;
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_rec = $app->tform->getDataRecord($this->id);
+ $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+
+ // Set the values for document_root, system_user and system_group
+ $system_user = $app->db->quote($this->parent_domain_record['system_user']);
+ $system_group = $app->db->quote($this->parent_domain_record['system_group']);
+ $document_root = $app->db->quote($this->parent_domain_record['document_root']);
+ $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
+ $php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
+ $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
+ $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+ $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
+
+ $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
?>
\ No newline at end of file
diff --git a/interface/web/themes/default-304/css/screen/redmond/jquery-ui-1.8.16.custom.css b/interface/web/themes/default-304/css/screen/redmond/jquery-ui-1.8.16.custom.css
index 88353fe6a8df26718f7db109ad8f833629517295..e3e05d1d9ee93d5720023297afea0e4028db2061 100644
--- a/interface/web/themes/default-304/css/screen/redmond/jquery-ui-1.8.16.custom.css
+++ b/interface/web/themes/default-304/css/screen/redmond/jquery-ui-1.8.16.custom.css
@@ -1,444 +1,444 @@
-/*
- * jQuery UI CSS Framework 1.8.16
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- */
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
-.ui-helper-clearfix { display: inline-block; }
-/* required comment for clearfix to work in Opera \*/
-* html .ui-helper-clearfix { height:1%; }
-.ui-helper-clearfix { display:block; }
-/* end clearfix */
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-
-/*
- * jQuery UI CSS Framework 1.8.16
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- *
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=0px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=0px
- */
-
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
-.ui-widget .ui-widget { font-size: 1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
-.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
-.ui-widget-content a { color: #222222; }
-.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
-.ui-widget-header a { color: #ffffff; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
-.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
-.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
-.ui-widget :active { outline: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
-.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
-.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
-.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
-.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-off { background-position: -96px -144px; }
-.ui-icon-radio-on { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-
-/* Overlays */
-.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
-.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }/*
- * jQuery UI Autocomplete 1.8.16
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Autocomplete#theming
- */
-.ui-autocomplete { position: absolute; cursor: default; }
-
-/* workarounds */
-* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
-
-/*
- * jQuery UI Menu 1.8.16
- *
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Menu#theming
- */
-.ui-menu {
- list-style:none;
- padding: 2px;
- margin: 0;
- display:block;
- float: left;
-}
-.ui-menu .ui-menu {
- margin-top: -3px;
-}
-.ui-menu .ui-menu-item {
- margin:0;
- padding: 0;
- zoom: 1;
- float: left;
- clear: left;
- width: 100%;
-}
-.ui-menu .ui-menu-item a {
- text-decoration:none;
- display:block;
- padding:.2em .4em;
- line-height:1.5;
- zoom:1;
-}
-.ui-menu .ui-menu-item a.ui-state-hover,
-.ui-menu .ui-menu-item a.ui-state-active {
- font-weight: normal;
- margin: -1px;
-}
-/*
- * jQuery UI Button 1.8.16
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Button#theming
- */
-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
-.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
-button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; }
-button.ui-button-icons-only { width: 3.7em; }
-
-/*button text element */
-.ui-button .ui-button-text { display: block; line-height: 1.4; }
-.ui-button-text-only .ui-button-text { padding: .4em 1em; }
-.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
-.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
-.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
-/* no icon support for input elements, provide padding by default */
-input.ui-button { padding: .4em 1em; }
-
-/*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
-.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
-.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-
-/*button sets*/
-.ui-buttonset { margin-right: 7px; }
-.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
-
-/* workarounds */
-button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
-/*
- * jQuery UI Datepicker 1.8.16
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Datepicker#theming
- */
-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
- display: none; /*sorry for IE5*/
- display/**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=0px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=0px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.16
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
}
\ No newline at end of file
diff --git a/interface/web/themes/default-304/css/screen/tipsy.css b/interface/web/themes/default-304/css/screen/tipsy.css
index 3d6295408849a6a80062536a55f65657a67888d4..ea735c76278167dbe19710a84f890b3ee2f17d12 100644
--- a/interface/web/themes/default-304/css/screen/tipsy.css
+++ b/interface/web/themes/default-304/css/screen/tipsy.css
@@ -1,25 +1,25 @@
-.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
- .tipsy-inner { background-color: #000; color: #FFF; max-width: 350px; padding: 5px 8px 4px 8px; text-align: left; }
-
- /* Rounded corners */
- .tipsy-inner { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
-
- /* Uncomment for shadow */
- /*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
-
- .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
-
- /* Rules to colour arrows */
- .tipsy-arrow-n { border-bottom-color: #000; }
- .tipsy-arrow-s { border-top-color: #000; }
- .tipsy-arrow-e { border-left-color: #000; }
- .tipsy-arrow-w { border-right-color: #000; }
-
- .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
- .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
- .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
- .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
- .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
- .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
- .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
- .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
+.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
+ .tipsy-inner { background-color: #000; color: #FFF; max-width: 350px; padding: 5px 8px 4px 8px; text-align: left; }
+
+ /* Rounded corners */
+ .tipsy-inner { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
+
+ /* Uncomment for shadow */
+ /*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
+
+ .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
+
+ /* Rules to colour arrows */
+ .tipsy-arrow-n { border-bottom-color: #000; }
+ .tipsy-arrow-s { border-top-color: #000; }
+ .tipsy-arrow-e { border-left-color: #000; }
+ .tipsy-arrow-w { border-right-color: #000; }
+
+ .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
+ .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
+ .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
+ .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
+ .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
+ .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
+ .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
+ .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
diff --git a/interface/web/themes/default-304/templates/monitor/show_sys_state.htm b/interface/web/themes/default-304/templates/monitor/show_sys_state.htm
index 740141b26998f91426e3559dda7aed00839aadc8..9a5830c19c0a89834aadab9a32b7d9416a792652 100644
--- a/interface/web/themes/default-304/templates/monitor/show_sys_state.htm
+++ b/interface/web/themes/default-304/templates/monitor/show_sys_state.htm
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/themes/default-304/templates/sites/aps_install_package.htm b/interface/web/themes/default-304/templates/sites/aps_install_package.htm
index e6ce02a445cf01565835fddbbc0933b56bd227ed..eeed54f970f1d6545fb18184e3a96b9be3877186 100644
--- a/interface/web/themes/default-304/templates/sites/aps_install_package.htm
+++ b/interface/web/themes/default-304/templates/sites/aps_install_package.htm
@@ -1,56 +1,56 @@
-
- {tmpl_var name='installation_txt'}: {tmpl_var name='pkg_name'} {tmpl_var name='pkg_version'}-{tmpl_var name='pkg_release'}
-
-
-
-
-
-
-
-
- ERROR {tmpl_var name='error'}
-
-
-
-
-
-
+
+ {tmpl_var name='installation_txt'}: {tmpl_var name='pkg_name'} {tmpl_var name='pkg_version'}-{tmpl_var name='pkg_release'}
+
+
+
+
+
+
+
+
+ ERROR {tmpl_var name='error'}
+
+
+
\ No newline at end of file
diff --git a/interface/web/themes/default-304/templates/sites/aps_instances_list.htm b/interface/web/themes/default-304/templates/sites/aps_instances_list.htm
index 640c0bb96c8ab99e50f9efb0d225107e63cfebc9..6f4ab80e875e0b4d5f1068ebbfcb2fd7e00a76de 100644
--- a/interface/web/themes/default-304/templates/sites/aps_instances_list.htm
+++ b/interface/web/themes/default-304/templates/sites/aps_instances_list.htm
@@ -1,62 +1,62 @@
-
{tmpl_var name="list_head_txt"}
-
-
-
-
-
{tmpl_var name="list_head_txt"}
-
-
-
-
+
{tmpl_var name="list_head_txt"}
+
+
+
+
+
{tmpl_var name="list_head_txt"}
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/themes/default-304/templates/sites/aps_packagedetails_show.htm b/interface/web/themes/default-304/templates/sites/aps_packagedetails_show.htm
index 351d3ac0460a708d0fdcc02d175149bd8ef3a4b5..18a6fc9e96b0639c44281840cd8068dc7a01cb81 100644
--- a/interface/web/themes/default-304/templates/sites/aps_packagedetails_show.htm
+++ b/interface/web/themes/default-304/templates/sites/aps_packagedetails_show.htm
@@ -1,139 +1,139 @@
-
-
-
-
- {tmpl_var name='pkg_name'}
-
-
{tmpl_var name='pkg_summary'}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {tmpl_var name='version_txt'}
- {tmpl_var name='pkg_version'} (Release {tmpl_var name='pkg_release'})
-
-
- {tmpl_var name='category_txt'}
- {tmpl_var name='pkg_category'}
-
-
- {tmpl_var name='description_txt'}
- {tmpl_var name='pkg_description'}
-
-
- {tmpl_var name='homepage_txt'}
-
- {tmpl_var name='pkg_homepage'}
-
-
-
- {tmpl_var name='installed_size_txt'}
- {tmpl_var name='pkg_installed_size'}
-
-
- {tmpl_var name='supported_languages_txt'}
- {tmpl_var name='pkg_languages'}
-
-
- {tmpl_var name='config_script_txt'}
- {tmpl_var name='pkg_config_script'}
-
-
- {tmpl_var name='license_txt'}
-
- {tmpl_var name='pkg_license_name'}
- {tmpl_var name='pkg_license_content'}
-
-
-
-
-
-
-
-
-
-
-
- {tmpl_var name='ScreenDescription'}
-
-
-
-
-
-
-
-
-
-
- {tmpl_var name='ChangelogVersion'}
-
-
- {tmpl_var name='ChangelogDescription'}
-
-
-
-
-
-
-
-
-
- {tmpl_var name='php_extensions_txt'}
- {tmpl_var name='pkg_requirements_php_extensions'}
-
-
- {tmpl_var name='php_settings_txt'}
-
- {tmpl_var name='PHPSettingName'} = {tmpl_var name='PHPSettingValue'}
-
-
-
- {tmpl_var name='supported_php_versions_txt'}
- {tmpl_var name='pkg_requirements_supported_php_versions'}
-
-
- {tmpl_var name='database_txt'}
- {tmpl_var name='pkg_requirements_database'}
-
-
-
-
-
-
+
+
+
+
+ {tmpl_var name='pkg_name'}
+
+
{tmpl_var name='pkg_summary'}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {tmpl_var name='version_txt'}
+ {tmpl_var name='pkg_version'} (Release {tmpl_var name='pkg_release'})
+
+
+ {tmpl_var name='category_txt'}
+ {tmpl_var name='pkg_category'}
+
+
+ {tmpl_var name='description_txt'}
+ {tmpl_var name='pkg_description'}
+
+
+ {tmpl_var name='homepage_txt'}
+
+ {tmpl_var name='pkg_homepage'}
+
+
+
+ {tmpl_var name='installed_size_txt'}
+ {tmpl_var name='pkg_installed_size'}
+
+
+ {tmpl_var name='supported_languages_txt'}
+ {tmpl_var name='pkg_languages'}
+
+
+ {tmpl_var name='config_script_txt'}
+ {tmpl_var name='pkg_config_script'}
+
+
+ {tmpl_var name='license_txt'}
+
+ {tmpl_var name='pkg_license_name'}
+ {tmpl_var name='pkg_license_content'}
+
+
+
+
+
+
+
+
+
+
+
+ {tmpl_var name='ScreenDescription'}
+
+
+
+
+
+
+
+
+
+
+ {tmpl_var name='ChangelogVersion'}
+
+
+ {tmpl_var name='ChangelogDescription'}
+
+
+
+
+
+
+
+
+
+ {tmpl_var name='php_extensions_txt'}
+ {tmpl_var name='pkg_requirements_php_extensions'}
+
+
+ {tmpl_var name='php_settings_txt'}
+
+ {tmpl_var name='PHPSettingName'} = {tmpl_var name='PHPSettingValue'}
+
+
+
+ {tmpl_var name='supported_php_versions_txt'}
+ {tmpl_var name='pkg_requirements_supported_php_versions'}
+
+
+ {tmpl_var name='database_txt'}
+ {tmpl_var name='pkg_requirements_database'}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/themes/default-304/templates/sites/aps_packages_list.htm b/interface/web/themes/default-304/templates/sites/aps_packages_list.htm
index e7db3e84a4e7b5313658dac83414c8a443f005f1..fe997430398297845e1d4b38b8f0f29d38c57836 100644
--- a/interface/web/themes/default-304/templates/sites/aps_packages_list.htm
+++ b/interface/web/themes/default-304/templates/sites/aps_packages_list.htm
@@ -1,50 +1,50 @@
-
{tmpl_var name="list_head_txt"}
-
-
-
-
-
{tmpl_var name="list_head_txt"} ({tmpl_var name='package_count'})
-
-
-
-
+
{tmpl_var name="list_head_txt"}
+
+
+
+
+
{tmpl_var name="list_head_txt"} ({tmpl_var name='package_count'})
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/themes/default/CHANGELOG b/interface/web/themes/default/CHANGELOG
index cae152a05c5b9b204c0f6c31e13c0ad99f6b5339..454964210b1c78a57d230d7230ffbaf243d4ce40 100644
--- a/interface/web/themes/default/CHANGELOG
+++ b/interface/web/themes/default/CHANGELOG
@@ -1,32 +1,32 @@
-CHANGELOG
-default -> default-v2
-source: default $3241 07/06/2012 @ 12:00 UTC+2
-resources @ https://github.com/foe-services/ispc-resources
-
-- changed doctype to (HTML5)
-- rm yaml/*
-- rm css/patches/*
-- cp yaml/patches/iehacks.css css/*
-- rm