Skip to content

Commit 1c36558

Browse files
author
Marius Cramer
committed
Copied missing changes of web_domain module to vhost subdomain module
1 parent 99a911d commit 1c36558

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

interface/web/sites/web_domain_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ function onSubmit() {
531531
// only generate quota and traffic warnings if value has changed
532532
if($this->id > 0) {
533533
$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
534-
} else {
534+
} else {
535535
$old_web_values = array();
536536
}
537537

interface/web/sites/web_vhost_subdomain_edit.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function onShowEnd() {
203203
$php_directive_snippets_txt = '';
204204
if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
205205
foreach($php_directive_snippets as $php_directive_snippet){
206-
$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
206+
$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
207207
}
208208
}
209209
if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
@@ -214,7 +214,7 @@ function onShowEnd() {
214214
$apache_directive_snippets_txt = '';
215215
if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
216216
foreach($apache_directive_snippets as $apache_directive_snippet){
217-
$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
217+
$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
218218
}
219219
}
220220
if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
@@ -226,7 +226,7 @@ function onShowEnd() {
226226
$nginx_directive_snippets_txt = '';
227227
if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
228228
foreach($nginx_directive_snippets as $nginx_directive_snippet){
229-
$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
229+
$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
230230
}
231231
}
232232
if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
@@ -237,7 +237,7 @@ function onShowEnd() {
237237
$proxy_directive_snippets_txt = '';
238238
if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
239239
foreach($proxy_directive_snippets as $proxy_directive_snippet){
240-
$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
240+
$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
241241
}
242242
}
243243
if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
@@ -246,13 +246,17 @@ function onShowEnd() {
246246

247247
$ssl_domain_select = '';
248248
$tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
249-
$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"]);
249+
$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"], '*.'.$tmp["domain"]);
250250
if(is_array($ssl_domains)) {
251251
foreach( $ssl_domains as $ssl_domain) {
252252
$selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
253253
$ssl_domain_select .= "<option value='$ssl_domain' $selected>$ssl_domain</option>\r\n";
254254
}
255255
}
256+
$app->tpl->setVar("ssl_domain", $ssl_domain_select);
257+
unset($ssl_domain_select);
258+
unset($ssl_domains);
259+
unset($ssl_domain);
256260

257261
if($this->id > 0) {
258262
$app->tpl->setVar('fixed_folder', 'y');
@@ -262,11 +266,6 @@ function onShowEnd() {
262266
$app->tpl->setVar('server_id_value', $parent_domain['server_id']);
263267
}
264268

265-
$app->tpl->setVar("ssl_domain", $ssl_domain_select);
266-
unset($ssl_domain_select);
267-
unset($ssl_domains);
268-
unset($ssl_domain);
269-
270269
$tmp_txt = ($this->dataRecord['traffic_quota_lock'] == 'y')?'<b>('.$app->tform->lng('traffic_quota_exceeded_txt').')</b>':'';
271270
$app->tpl->setVar("traffic_quota_exceeded_txt", $tmp_txt);
272271

@@ -308,6 +307,17 @@ function onShowEnd() {
308307
}
309308
$app->tpl->setVar("domain", $this->dataRecord["domain"]);
310309

310+
// check for configuration errors in sys_datalog
311+
if($this->id > 0) {
312+
$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:".$app->functions->intval($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");
313+
if(is_array($datalog) && !empty($datalog)){
314+
if(trim($datalog['error']) != ''){
315+
$app->tpl->setVar("config_error_msg", nl2br(htmlentities($datalog['error'])));
316+
$app->tpl->setVar("config_error_tstamp", date($app->lng('conf_format_datetime'), $datalog['tstamp']));
317+
}
318+
}
319+
}
320+
311321
parent::onShowEnd();
312322
}
313323

@@ -389,7 +399,7 @@ function onSubmit() {
389399
if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
390400
if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
391401
if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
392-
if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
402+
if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
393403
if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
394404
if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
395405
if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
@@ -398,7 +408,7 @@ function onSubmit() {
398408
if($this->id > 0) {
399409
$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
400410
} else {
401-
$old_web_values = $_POST;
411+
$old_web_values = array();
402412
}
403413

404414
//* Check the traffic quota of the client

0 commit comments

Comments
 (0)