Skip to content

Commit 327124d

Browse files
committed
Fixed: SSL vhost configuration not created when not all fields are filled.
1 parent d4d985e commit 327124d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

interface/web/sites/lib/lang/en_web_domain.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,10 @@ $wb["domain_error_unique"] = 'Domain must be unique.';
4141
$wb["domain_error_regex"] = 'Domain name invalid.';
4242
$wb["hd_quota_error_empty"] = 'Harddisk quota is empty.';
4343
$wb["traffic_quota_error_empty"] = 'Traffic quota is empty.';
44+
$wb['error_ssl_state_empty'] = 'SSL State is empty.';
45+
$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
46+
$wb['error_ssl_organisation_empty'] = 'SSL Organisation is empty.';
47+
$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
48+
$wb['error_ssl_country_empty'] = 'SSL Country is empty.';
49+
4450
?>

interface/web/sites/web_domain_edit.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function onShowNew() {
7575
function onShowEnd() {
7676
global $app, $conf;
7777

78+
// If the logged in user is not admin and has no sub clients (no rseller)
7879
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
7980

8081
// Get the limits of the client
@@ -89,7 +90,8 @@ function onShowEnd() {
8990
// Fill the IP select field with the IP addresses that are allowed for this client
9091
$ip_select = "<option value='*'>*</option>";
9192
$app->tpl->setVar("ip_address",$ip_select);
92-
93+
94+
// If the logged in user is not admin and has sub clients (is a rseller)
9395
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
9496

9597
// Get the limits of the client
@@ -116,12 +118,13 @@ function onShowEnd() {
116118
// Fill the IP select field with the IP addresses that are allowed for this client
117119
$ip_select = "<option value='*'>*</option>";
118120
$app->tpl->setVar("ip_address",$ip_select);
119-
121+
122+
// If the logged in user is admin
120123
} else {
121124

122125
// The user is admin, so we fill in all IP addresses of the server
123126
if($this->id > 0) {
124-
$server_id = $this->dataRecord["server_id"];
127+
$server_id = @$this->dataRecord["server_id"];
125128
} else {
126129
// Get the first server ID
127130
$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
@@ -242,6 +245,22 @@ function onAfterInsert() {
242245
$app->db->query($sql);
243246
}
244247

248+
function onBeforeUpdate () {
249+
global $app, $conf;
250+
251+
//* Check that all fields for the SSL cert creation are filled
252+
if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
253+
if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'<br />';
254+
if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'<br />';
255+
if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'<br />';
256+
if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
257+
if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
258+
}
259+
260+
}
261+
262+
263+
245264
function onAfterUpdate() {
246265
global $app, $conf;
247266

0 commit comments

Comments
 (0)