Skip to content

Commit 3645f76

Browse files
author
Marius Cramer
committed
Merge branch 'Cambra/ispconfig3-master'
2 parents 47568c8 + dbf29d9 commit 3645f76

File tree

7 files changed

+45
-12
lines changed

7 files changed

+45
-12
lines changed

interface/lib/classes/auth.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function has_clients($userid) {
5050

5151
$userid = $app->functions->intval($userid);
5252
$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
53-
if($client['limit_client'] > 0) {
53+
if($client['limit_client'] != 0) {
5454
return true;
5555
} else {
5656
return false;

interface/lib/lang/en.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,6 @@ $wb['strength_4'] = 'Strong';
149149
$wb['strength_5'] = 'Very Strong';
150150
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of "{strength}".';
151151
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
152+
$wb['domain_owner_changed'] = 'You have changed the owner of domain {domain}, please change website and mail domain owner for this domain accordingly.';
152153

153154
?>

interface/lib/lang/es.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,5 @@ $wb['strength_5'] = 'Muy fuerte';
148148
$wb['weak_password_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres y una fortaleza \"{strength}\".';
149149
$wb['weak_password_length_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres.';
150150
$wb['Firewall'] = 'Cortafuegos';
151+
$wb['domain_owner_changed'] = 'Has cambiado el propietario del dominio {domain}, por favor cambia también el propietario del sitio web y dominio de correo de este dominio.';
151152
?>

interface/web/client/domain_edit.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ function onSubmit() {
147147
}
148148
else {
149149
/*
150-
* We edit a existing one, but there is nothing to edit
150+
* We edit a existing one, but domain name can't be changed
151151
*/
152-
$this->dataRecord = $app->tform->getDataRecord($this->id);
152+
$oldData = $app->tform->getDataRecord($this->id);
153+
$this->dataRecord["domain"] = $oldData["domain"];
153154
}
154155
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
155156
if ($this->id == 0) {
@@ -165,9 +166,10 @@ function onSubmit() {
165166
}
166167
else {
167168
/*
168-
* We edit a existing one, but there is nothing to edit
169+
* We edit a existing one, but domain name can't be changed
169170
*/
170-
$this->dataRecord = $app->tform->getDataRecord($this->id);
171+
$oldData = $app->tform->getDataRecord($this->id);
172+
$this->dataRecord["domain"] = $oldData["domain"];
171173
}
172174
} else {
173175
if($this->id > 0) {
@@ -199,6 +201,26 @@ function onAfterInsert() {
199201
}
200202
}
201203

204+
function onAfterUpdate() {
205+
global $app, $conf;
206+
207+
if($_SESSION["s"]["user"]["typ"] != 'admin' && isset($this->dataRecord["client_group_id"])) {
208+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
209+
$client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
210+
$group = $app->db->queryOneRecord("SELECT sys_group.groupid FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." AND sys_group.groupid = ".$this->dataRecord["client_group_id"]." ORDER BY client.company_name, client.contact_name, sys_group.name";
211+
$this->dataRecord["client_group_id"] = $group["groupid"];
212+
}
213+
214+
// make sure that the record belongs to the client group and not the admin group when admin inserts it
215+
// also make sure that the user can not delete domain created by a admin
216+
if(isset($this->dataRecord["client_group_id"])) {
217+
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
218+
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
219+
$lng_text = $app->lng("domain_owner_changed");
220+
$_SESSION['show_warning_msg'] = str_replace("{domain}", $this->dataRecord["domain"], $lng_text);
221+
}
222+
}
223+
202224
}
203225

204226
$page = new page_action;

interface/web/client/domain_list.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646

4747
$app->uses('listform_actions');
4848

49+
if(isset($_SESSION['show_warning_msg'])) {
50+
$app->tpl->setVar('warning_msg', $_SESSION['show_warning_msg']);
51+
unset($_SESSION['show_warning_msg']);
52+
}
53+
4954
$app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain';
5055
$app->listform_actions->onLoad();
5156

interface/web/client/templates/domain_edit.htm

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@
77
<div class="ctrlHolder">
88
<label for="domain">{tmpl_var name='domain_txt'}</label>
99
<tmpl_if name="edit_disabled">
10-
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
10+
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" readonly="readonly" />
1111
<tmpl_else>
1212
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
1313
</tmpl_if>
1414
</div>
1515
<div class="ctrlHolder">
1616
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
17-
<tmpl_if name="edit_disabled">
18-
<select name="client_group_id" id="client_group_id" class="selectInput" disabled="disabled">
19-
{tmpl_var name='client_group_id'}
20-
</select>
21-
<tmpl_else>
2217
<select name="client_group_id" id="client_group_id" class="selectInput">
2318
{tmpl_var name='client_group_id'}
2419
</select>
25-
</tmpl_if>
2620
</div>
2721
</fieldset>
2822

interface/web/client/templates/domain_list.htm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ <h2><tmpl_var name="list_head_txt"></h2>
44
<div class="panel panel_list_domain">
55

66
<div class="pnl_toolsarea">
7+
<div>
8+
<tmpl_if name='warning_msg'>
9+
<div class="systemmonitor-state state-warning">
10+
<div class="status"></div>
11+
<div class="statusMsg">
12+
{tmpl_var name='warning_msg'}
13+
</div>
14+
</div>
15+
</tmpl_if>
16+
</div>
717
<fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
818
<div class="buttons">
919
<button class="button iconstxt icoAdd" type="button" onclick="loadContent('client/domain_edit.php');">

0 commit comments

Comments
 (0)