| | |
| | | } |
| | | $server_id = intval(@$this->dataRecord["server_id"]); |
| | | } else { |
| | | $server_id = (isset($web_servers[0])) ? intval($web_servers[0]) : 0; |
| | | $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0; |
| | | } |
| | | |
| | | if($app->functions->intval($this->dataRecord["server_id"]) > 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | //* 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 IN ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; |
| | | $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers'])); |
| | | //* Fill the IPv4 select field with the IP addresses that are allowed for this client on the current server |
| | | $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; |
| | | $ips = $app->db->queryAllRecords($sql, $server_id); |
| | | $ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; |
| | | //if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n"; |
| | | //$ip_select = ""; |
| | |
| | | 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 IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']); |
| | | $ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; |
| | | $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); |
| | | //$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; |
| | | //$ip_select = ""; |
| | | $ip_select = "<option value=''></option>"; |
| | | if(is_array($ips)) { |
| | | foreach( $ips as $ip) { |
| | | $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':''; |
| | |
| | | |
| | | $app->tpl->setVar("server_id", $options_web_servers); |
| | | unset($options_web_servers); |
| | | |
| | | if($this->id > 0) { |
| | | if(!isset($this->dataRecord["server_id"])){ |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ?", $this->id); |
| | | $this->dataRecord["server_id"] = $tmp["server_id"]; |
| | | unset($tmp); |
| | | } |
| | | $server_id = intval(@$this->dataRecord["server_id"]); |
| | | } else { |
| | | $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0; |
| | | } |
| | | |
| | | if ($settings['use_domain_module'] != 'y') { |
| | | // Fill the client select field |
| | |
| | | } |
| | | |
| | | //* 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 IN ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']); |
| | | $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); |
| | | $ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; |
| | | //if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n"; |
| | | //$ip_select = ""; |
| | |
| | | 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 IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, $client['web_servers'], $_SESSION['s']['user']['client_id']); |
| | | $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; |
| | | $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); |
| | | $ip_select = "<option value=''></option>"; |
| | | //$ip_select = ""; |
| | | if(is_array($ips)) { |
| | |
| | | $domain_select .= "<option value=''></option>\r\n"; |
| | | } |
| | | $app->tpl->setVar("domain_option", $domain_select); |
| | | } else { |
| | | |
| | | // remove the parent domain part of the domain name before we show it in the text field. |
| | | if($this->dataRecord["type"] == 'vhostsubdomain') $this->dataRecord["domain"] = str_replace('.'.$selected_domain, '', $this->dataRecord["domain"]); |
| | | |
| | | |
| | | } else { |
| | | // remove the parent domain part of the domain name before we show it in the text field. |
| | | if($this->dataRecord["type"] == 'vhostsubdomain') $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]); |
| | | } |
| | | |
| | | if($this->_vhostdomain_type != 'domain') $app->tpl->setVar("domain", $this->dataRecord["domain"]); |
| | | |
| | | // check for configuration errors in sys_datalog |
| | |
| | | |
| | | // Letsencrypt can not be activated before the website has been created |
| | | // So we deactivate it here and add a datalog update in onAfterInsert |
| | | if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y') { |
| | | if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y' && isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y') { |
| | | // Disable letsencrypt and ssl temporarily |
| | | $this->dataRecord['ssl_letsencrypt'] = 'n'; |
| | | $this->dataRecord['ssl'] = 'n'; |
| | | // Prevent that the datalog history gets written |
| | | $app->tform->formDef['db_history'] = 'no'; |
| | | // Set variable that we check in onAfterInsert |
| | | $this->_letsencrypt_on_insert = true; |
| | | } |
| | | } |
| | |
| | | } |
| | | if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); |
| | | |
| | | // Add a datalog update with letsencrypt enabled (see also onBeforeInsert) |
| | | // Add a datalog insert without letsencrypt and then an update with letsencrypt enabled (see also onBeforeInsert) |
| | | if($this->_letsencrypt_on_insert == true) { |
| | | $tmp = $web_rec; |
| | | $tmp['ssl_letsencrypt'] = 'y'; |
| | | $app->db->datalogUpdate('web_domain', $tmp, 'domain_id', $this->id); |
| | | unset($tmp); |
| | | $new_data_record = $app->tform->getDataRecord($this->id); |
| | | $app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record); |
| | | $new_data_record['ssl_letsencrypt'] = 'y'; |
| | | $new_data_record['ssl'] = 'y'; |
| | | $app->db->datalogUpdate('web_domain', $new_data_record, 'domain_id', $this->id); |
| | | } |
| | | |
| | | } |
| | |
| | | $this->dataRecord["domain"] = $rec['domain']; |
| | | } |
| | | if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') { |
| | | //* Add a error message and switch back to old server |
| | | $app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv4-Address.'); |
| | | $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') { |
| | | //* Add a error message and switch back to old server |
| | | $app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv6-Address.'); |
| | | $this->dataRecord["ipv6_address"] = $rec['ipv6_address']; |
| | | } |
| | | unset($rec); |