Skip to content

Commit 3dfe1e6

Browse files
committed
Fixed #472: links are all created inside the client0 dir
1 parent 0e9ad67 commit 3dfe1e6

File tree

3 files changed

+724
-724
lines changed

3 files changed

+724
-724
lines changed

interface/web/admin/form/groups.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
$form["action"] = "groups_edit.php";
6666
$form["db_table"] = "sys_group";
6767
$form["db_table_idx"] = "groupid";
68-
$form["db_history"] = "no";
68+
$form["db_history"] = "yes";
6969
$form["tab_default"] = "groups";
7070
$form["list_default"] = "groups_list.php";
7171
$form["auth"] = 'no';

interface/web/client/client_edit.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,18 @@ function onShowEnd() {
9090
function onAfterInsert() {
9191
global $app;
9292
// Create the group for the client
93-
$sql = "INSERT INTO sys_group (name,description,client_id) VALUES ('".mysql_real_escape_string($this->dataRecord["username"])."','',".$this->id.")";
94-
$app->db->query($sql);
95-
$groupid = $app->db->insertID();
93+
$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".mysql_real_escape_string($this->dataRecord["username"])."','',".$this->id.")", 'groupid');
9694
$groups = $groupid;
9795

98-
$username = mysql_real_escape_string($this->dataRecord["username"]);
99-
$password = mysql_real_escape_string($this->dataRecord["password"]);
96+
$username = $app->db->quote($this->dataRecord["username"]);
97+
$password = $app->db->quote($this->dataRecord["password"]);
10098
$modules = ISPC_INTERFACE_MODULES_ENABLED;
10199
if($this->dataRecord["limit_client"] > 0) $modules .= ',client';
102100
$startmodule = 'mail';
103-
$usertheme = mysql_real_escape_string($this->dataRecord["usertheme"]);
101+
$usertheme = $app->db->quote($this->dataRecord["usertheme"]);
104102
$type = 'user';
105103
$active = 1;
106-
$language = mysql_real_escape_string($this->dataRecord["language"]);
104+
$language = $app->db->quote($this->dataRecord["language"]);
107105

108106
// Create the controlpaneluser for the client
109107
$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
@@ -133,17 +131,19 @@ function onAfterUpdate() {
133131

134132
// username changed
135133
if(isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
136-
$username = mysql_real_escape_string($this->dataRecord["username"]);
134+
$username = $app->db->quote($this->dataRecord["username"]);
137135
$client_id = $this->id;
138136
$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
139137
$app->db->query($sql);
140-
$sql = "UPDATE sys_group SET name = '$username' WHERE client_id = $client_id";
141-
$app->db->query($sql);
138+
139+
$tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = $client_id");
140+
$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
141+
unset($tmp);
142142
}
143143

144144
// password changed
145145
if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
146-
$password = mysql_real_escape_string($this->dataRecord["password"]);
146+
$password = $app->db->quote($this->dataRecord["password"]);
147147
$client_id = $this->id;
148148
$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
149149
$app->db->query($sql);
@@ -153,7 +153,7 @@ function onAfterUpdate() {
153153
if(isset($this->dataRecord["limit_client"])) {
154154
$modules = ISPC_INTERFACE_MODULES_ENABLED;
155155
if($this->dataRecord["limit_client"] > 0) $modules .= ',client';
156-
$modules = mysql_real_escape_string($modules);
156+
$modules = $app->db->quote($modules);
157157
$client_id = $this->id;
158158
$sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id";
159159
$app->db->query($sql);

0 commit comments

Comments
 (0)