Commit 3645f760 authored by Marius Cramer's avatar Marius Cramer
Browse files

Merge branch 'Cambra/ispconfig3-master'

parents 47568c88 dbf29d99
......@@ -50,7 +50,7 @@ class auth {
$userid = $app->functions->intval($userid);
$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");
if($client['limit_client'] > 0) {
if($client['limit_client'] != 0) {
return true;
} else {
return false;
......
......@@ -149,5 +149,6 @@ $wb['strength_4'] = 'Strong';
$wb['strength_5'] = 'Very Strong';
$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}".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['domain_owner_changed'] = 'You have changed the owner of domain {domain}, please change website and mail domain owner for this domain accordingly.';
?>
......@@ -148,4 +148,5 @@ $wb['strength_5'] = 'Muy fuerte';
$wb['weak_password_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres y una fortaleza \"{strength}\".';
$wb['weak_password_length_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres.';
$wb['Firewall'] = 'Cortafuegos';
$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.';
?>
......@@ -147,9 +147,10 @@ class page_action extends tform_actions {
}
else {
/*
* We edit a existing one, but there is nothing to edit
* We edit a existing one, but domain name can't be changed
*/
$this->dataRecord = $app->tform->getDataRecord($this->id);
$oldData = $app->tform->getDataRecord($this->id);
$this->dataRecord["domain"] = $oldData["domain"];
}
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
if ($this->id == 0) {
......@@ -165,9 +166,10 @@ class page_action extends tform_actions {
}
else {
/*
* We edit a existing one, but there is nothing to edit
* We edit a existing one, but domain name can't be changed
*/
$this->dataRecord = $app->tform->getDataRecord($this->id);
$oldData = $app->tform->getDataRecord($this->id);
$this->dataRecord["domain"] = $oldData["domain"];
}
} else {
if($this->id > 0) {
......@@ -199,6 +201,26 @@ class page_action extends tform_actions {
}
}
function onAfterUpdate() {
global $app, $conf;
if($_SESSION["s"]["user"]["typ"] != 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
$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");
$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";
$this->dataRecord["client_group_id"] = $group["groupid"];
}
// make sure that the record belongs to the client group and not the admin group when admin inserts it
// also make sure that the user can not delete domain created by a admin
if(isset($this->dataRecord["client_group_id"])) {
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
$lng_text = $app->lng("domain_owner_changed");
$_SESSION['show_warning_msg'] = str_replace("{domain}", $this->dataRecord["domain"], $lng_text);
}
}
}
$page = new page_action;
......
......@@ -46,6 +46,11 @@ $app->auth->check_module_permissions('client');
$app->uses('listform_actions');
if(isset($_SESSION['show_warning_msg'])) {
$app->tpl->setVar('warning_msg', $_SESSION['show_warning_msg']);
unset($_SESSION['show_warning_msg']);
}
$app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain';
$app->listform_actions->onLoad();
......
......@@ -7,22 +7,16 @@
<div class="ctrlHolder">
<label for="domain">{tmpl_var name='domain_txt'}</label>
<tmpl_if name="edit_disabled">
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" readonly="readonly" />
<tmpl_else>
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
</tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
<tmpl_if name="edit_disabled">
<select name="client_group_id" id="client_group_id" class="selectInput" disabled="disabled">
{tmpl_var name='client_group_id'}
</select>
<tmpl_else>
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
</select>
</tmpl_if>
</div>
</fieldset>
......
......@@ -4,6 +4,16 @@
<div class="panel panel_list_domain">
<div class="pnl_toolsarea">
<div>
<tmpl_if name='warning_msg'>
<div class="systemmonitor-state state-warning">
<div class="status"></div>
<div class="statusMsg">
{tmpl_var name='warning_msg'}
</div>
</div>
</tmpl_if>
</div>
<fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
<div class="buttons">
<button class="button iconstxt icoAdd" type="button" onclick="loadContent('client/domain_edit.php');">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment