From 3bb9ef8a12ee71a16887ca73a86b6fc8eaa183fe Mon Sep 17 00:00:00 2001
From: Dominik <info@profi-webdesign.com>
Date: Tue, 14 Apr 2015 18:08:05 -0400
Subject: [PATCH] changed sql-syntax
---
interface/web/sites/web_vhost_domain_edit.php | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 20544a0..6e7d434 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -121,6 +121,10 @@
$server_id = intval($settings['default_webserver']);
$app->tform->formDef['tabs']['domain']['fields']['server_id']['default'] = $server_id;
}
+ if(!$server_id){
+ $default_web_server = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = ? ORDER BY server_id LIMIT 0,1", 1);
+ $server_id = $default_web_server['server_id'];
+ }
$web_config = $app->getconf->get_server_config($server_id, 'web');
$app->tform->formDef['tabs']['domain']['fields']['php']['default'] = $web_config['php_handler'];
$app->tform->formDef['tabs']['domain']['readonly'] = false;
@@ -138,6 +142,8 @@
$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
if($this->_vhostdomain_type != 'domain') $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
+ $is_admin = false;
//* 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'])) {
@@ -187,7 +193,7 @@
if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
// check if server is in client's servers or add it.
$chk_sid = explode(',', $client['web_servers']);
- if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) {
+ if(in_array($this->dataRecord["server_id"], explode(',', $client['web_servers'])) == false) {
if($client['web_servers'] != '') $client['web_servers'] .= ',';
$client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]);
}
@@ -447,6 +453,8 @@
//* Admin: If the logged in user is admin
} else {
+
+ $is_admin = true;
if($this->_vhostdomain_type == 'domain') {
// The user is admin, so we fill in all IP addresses of the server
@@ -609,8 +617,15 @@
}
$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"]);
+ $ssl_domains = array();
+ $tmpd = $app->db->queryAllRecords("SELECT domain, type FROM web_domain WHERE domain_id = ".$this->id." OR parent_domain_id = ".$this->id);
+ foreach($tmpd as $tmp) {
+ if($tmp['type'] == 'subdomain' || $tmp['type'] == 'vhostsubdomain') {
+ $ssl_domains[] = $tmp["domain"];
+ } else {
+ $ssl_domains = array_merge($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':'';
@@ -687,6 +702,16 @@
}
$app->tpl->setVar('vhostdomain_type', $this->_vhostdomain_type);
+
+ $app->tpl->setVar('is_spdy_enabled', ($web_config['enable_spdy'] === 'y'));
+ $app->tpl->setVar("is_admin", $is_admin);
+
+ if($this->id > 0) {
+ $tmp_web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", intval($this->id));
+ $tmp_sys_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE groupid = ?", intval($tmp_web['sys_groupid']));
+ if(intval($tmp_sys_group['client_id']) > 0) $tmp_client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", intval($tmp_sys_group['client_id']));
+ if(is_array($tmp_client) && !empty($tmp_client) && trim($this->dataRecord['ssl_organisation']) == '' && trim($this->dataRecord['ssl_locality']) == '' && trim($this->dataRecord['ssl_state']) == '' && trim($this->dataRecord['ssl_organisation_unit']) == '') $app->tpl->setVar("show_helper_links", true);
+ }
parent::onShowEnd();
}
@@ -889,9 +914,11 @@
// 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));
+ $tmp = $app->db->queryOneRecord("SELECT server_id, `system_user`, `system_group`, `web_folder`, `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"];
$this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
+ $this->dataRecord['system_user'] = $tmp['system_user'];
+ $this->dataRecord['system_group'] = $tmp['system_group'];
// set the settings to current if not provided (or cleared due to limits)
if($this->dataRecord['cgi'] == 'n') $this->dataRecord['cgi'] = $tmp['cgi'];
@@ -1055,6 +1082,10 @@
}
}
+ if($web_config['enable_spdy'] === 'n') {
+ unset($app->tform->formDef["tabs"]['ssl']['fields']['enable_spdy']);
+ }
+
parent::onSubmit();
}
--
Gitblit v1.9.1