Menu

[r15]: / users / edituser.php  Maximize  Restore  History

Download this file

337 lines (294 with data), 11.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<?php
/*
** Application name: phpCollab
** Last Edit page: 02/08/2007
** Path by root: ../includes/calendar.php
** Authors: Ceam / Fullo
**
** =============================================================================
**
** phpCollab - Project Managment
**
** -----------------------------------------------------------------------------
** Please refer to license, copyright, and credits in README.TXT
**
** -----------------------------------------------------------------------------
** FILE: edituser.php
**
** DESC: Screen: displays the details of a client user
**
** HISTORY:
** 02/08/2007 - added Last Viewed Page code - Mindblender
**
** -----------------------------------------------------------------------------
** TO-DO:
**
**
** =============================================================================
*/
$checkSession = "true";
include_once('../includes/library.php');
if ($profilSession != "0") {
headerFunction('../general/permissiondenied.php?'.session_name().'='.session_id());
exit;
}
//case update user
if ($id != "") {
if ($id == "1" && $idSession == "1") {
headerFunction("../preferences/updateuser.php?".session_name()."=".session_id());
exit;
}
//case update user
if ($action == "update") {
if ($htaccessAuth == "true") {
include("../includes/htpasswd.class.php");
$Htpasswd = new Htpasswd;
}
if (!ereg("^[A-Za-z0-9]+$", $un)) {
$error = $strings["alpha_only"];
} else {
//test if login already exists
$tmpquery = "WHERE mem.login = '$un' AND mem.login != '$unOld'";
$existsUser = new request();
$existsUser->openMembers($tmpquery);
$comptExistsUser = count($existsUser->mem_id);
if ($comptExistsUser != "0") {
$error = $strings["user_already_exists"];
} else {
//replace quotes by html code in name and address
$fn = convertData($fn);
$tit = convertData($tit);
$c = convertData($c);
$em = convertData($em);
$wp = convertData($wp);
$hp = convertData($hp);
$mp = convertData($mp);
$fax = convertData($fax);
$last_page = convertData($last_page);
$tmpquery = "UPDATE ".$tableCollab["members"]." SET login='$un',name='$fn',title='$tit',email_work='$em',phone_work='$wp',phone_home='$hp',mobile='$mp',fax='$fax',comments='$c',profil='$perm',last_page='$last_page' WHERE id = '$id'";
connectSql("$tmpquery");
if ($htaccessAuth == "true") {
if ($un != $unOld) {
$tmpquery = "WHERE tea.member = '$id'";
$listProjects = new request();
$listProjects->openTeams($tmpquery);
$comptListProjects = count($listProjects->tea_id);
if ($comptListProjects != "0") {
for ($i=0;$i<$comptListProjects;$i++) {
$Htpasswd->initialize("../files/".$listProjects->tea_pro_id[$i]."/.htpasswd");
$Htpasswd->renameUser($unOld,$un);
}
}
}
}
//test if new password set
if ($pw != "") {
//test if 2 passwords match
if ($pw != $pwa || $pwa == "") {
$error = $strings["new_password_error"];
} else {
$pw = get_password($pw);
if ($htaccessAuth == "true") {
if ($un == $unOld) {
$tmpquery = "WHERE tea.member = '$id'";
$listProjects = new request();
$listProjects->openTeams($tmpquery);
$comptListProjects = count($listProjects->tea_id);
}
if ($comptListProjects != "0") {
for ($i=0;$i<$comptListProjects;$i++) {
$Htpasswd->initialize("../files/".$listProjects->tea_pro_id[$i]."/.htpasswd");
$Htpasswd->changePass($un,$pw);
}
}
}
$tmpquery = "UPDATE ".$tableCollab["members"]." SET password='$pw' WHERE id = '$id'";
connectSql("$tmpquery");
//if mantis bug tracker enabled
if ($enableMantis == "true") {
// Call mantis function for user changes..!!!
$f_access_level = $team_user_level; // Developer
include ("../mantis/user_update.php");
}
headerFunction("../users/listusers.php?msg=update&".session_name()."=".session_id());
exit;
}
} else {
//if mantis bug tracker enabled
if ($enableMantis == "true") {
// Call mantis function for user changes..!!!
$f_access_level = $team_user_level; // Developer
include ("../mantis/user_update.php");
}
headerFunction("../users/listusers.php?msg=update&".session_name()."=".session_id());
exit;
}
}
}
}
$tmpquery = "WHERE mem.id = '$id'";
$detailUser = new request();
$detailUser->openMembers($tmpquery);
$comptDetailUser = count($detailUser->mem_id);
//test exists selected user, redirect to list if not
if ($comptDetailUser == "0") {
headerFunction("../users/listusers.php?msg=blankUser&".session_name()."=".session_id());
exit;
}
//set values in form
$un = $detailUser->mem_login[0];
$fn = $detailUser->mem_name[0];
$tit = $detailUser->mem_title[0];
$em = $detailUser->mem_email_work[0];
$wp = $detailUser->mem_phone_work[0];
$hp = $detailUser->mem_phone_home[0];
$mp = $detailUser->mem_mobile[0];
$fax = $detailUser->mem_fax[0];
$last_page = $detailUser->mem_last_page[0];
$c = $detailUser->mem_comments[0];
$perm = $detailUser->mem_profil[0];
$setTitle .= " : Edit User ($un)";
//set radio button with permissions value
if ($perm == "1") {
$checked1 = "checked";
}
if ($perm == "2") {
$checked2 = "checked";
}
if ($perm == "3") {
$checked3 = "checked";
}
if ($perm == "4") {
$checked4 = "checked";
}
if ($perm == "5") {
$checked5 = "checked";
}
}
//case add user
if ($id == "") {
$checked2 = "checked";
//case add user
if ($action == "add") {
if (!ereg("^[A-Za-z0-9]+$", $un)) {
$error = $strings["alpha_only"];
} else {
//test if login already exists
$tmpquery = "WHERE mem.login = '$un'";
$existsUser = new request();
$existsUser->openMembers($tmpquery);
$comptExistsUser = count($existsUser->mem_id);
if ($comptExistsUser != "0") {
$error = $strings["user_already_exists"];
} else {
//test if 2 passwords match
if ($pw != $pwa || $pw == "") {
$error = $strings["new_password_error"];
} else {
//replace quotes by html code in name and address
$fn = convertData($fn);
$tit = convertData($tit);
$c = convertData($c);
$pw = get_password($pw);
$tmpquery1 = "INSERT INTO ".$tableCollab["members"]."(login,name,title,email_work,phone_work,phone_home,mobile,fax,comments,password,profil,created,organization,timezone) VALUES('$un','$fn','$tit','$em','$wp','$hp','$mp','$fax','$c','$pw','$perm','$dateheure','1','0')";
connectSql("$tmpquery1");
$tmpquery = $tableCollab["members"];
last_id($tmpquery);
$num = $lastId[0];
unset($lastId);
$tmpquery2 = "INSERT INTO ".$tableCollab["sorting"]."(member) VALUES('$num')";
connectSql("$tmpquery2");
$tmpquery3 = "INSERT INTO ".$tableCollab["notifications"]."(member,taskAssignment,removeProjectTeam,addProjectTeam,newTopic,newPost,statusTaskChange,priorityTaskChange,duedateTaskChange,clientAddTask) VALUES ('$num','0','0','0','0','0','0','0','0','0')";
connectSql("$tmpquery3");
//if mantis bug tracker enabled
if ($enableMantis == "true") {
// Call mantis function for user changes..!!!
$f_access_level = $team_user_level; // Developer
include ("../mantis/create_new_user.php");
}
headerFunction("../users/listusers.php?msg=add&".session_name()."=".session_id());
exit;
}
}
}
}
}
$bodyCommand = "onLoad=\"document.user_editForm.un.focus();\"";
include('../themes/'.THEME.'/header.php');
$blockPage = new block();
$blockPage->openBreadcrumbs();
$blockPage->itemBreadcrumbs($blockPage->buildLink("../administration/admin.php?",$strings["administration"],in));
$blockPage->itemBreadcrumbs($blockPage->buildLink("../users/listusers.php?",$strings["user_management"],in));
if ($id == "") {
$blockPage->itemBreadcrumbs($strings["add_user"]);
}
if ($id != "") {
$blockPage->itemBreadcrumbs($blockPage->buildLink("../users/viewuser.php?id=$id",$detailUser->mem_login[0],in));
$blockPage->itemBreadcrumbs($strings["edit_user"]);
}
$blockPage->closeBreadcrumbs();
if ($msg != "") {
include('../includes/messages.php');
$blockPage->messagebox($msgLabel);
}
$block1 = new block();
if ($id == "") {
$block1->form = "user_edit";
$block1->openForm("../users/edituser.php?id=$id&action=add&".session_name()."=".session_id()."#".$block1->form."Anchor");
}
if ($id != "") {
$block1->form = "user_edit";
$block1->openForm("../users/edituser.php?id=$id&action=update&".session_name()."=".session_id()."#".$block1->form."Anchor");
}
if ($error != "") {
$block1->headingError($strings["errors"]);
$block1->contentError($error);
}
if ($id == "") {
$block1->heading($strings["add_user"]);
}
if ($id != "") {
$block1->heading($strings["edit_user"]." : ".$detailUser->mem_login[0]);
}
$block1->openContent();
if ($id == "") {
$block1->contentTitle($strings["enter_user_details"]);
}
if ($id != "") {
$block1->contentTitle($strings["edit_user_details"]);
}
$block1->contentRow($strings["user_name"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"16\" type=\"text\" name=\"un\" value=\"$un\"><input type=\"hidden\" name=\"unOld\" value=\"$un\">");
$block1->contentRow($strings["full_name"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"64\" type=\"text\" name=\"fn\" value=\"$fn\">");
$block1->contentRow($strings["title"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"128\" type=\"text\" name=\"tit\" value=\"$tit\">");
$block1->contentRow($strings["email"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"128\" type=\"text\" name=\"em\" value=\"$em\">");
$block1->contentRow($strings["work_phone"],"<input size=\"14\" style=\"width: 150px;\" maxlength=\"32\" type=\"text\" name=\"wp\" value=\"$wp\">");
$block1->contentRow($strings["home_phone"],"<input size=\"14\" style=\"width: 150px;\" maxlength=\"32\" type=\"text\" name=\"hp\" value=\"$hp\">");
$block1->contentRow($strings["mobile_phone"],"<input size=\"14\" style=\"width: 150px;\" maxlength=\"32\" type=\"text\" name=\"mp\" value=\"$mp\">");
$block1->contentRow($strings["fax"],"<input size=\"14\" style=\"width: 150px;\" maxlength=\"32\" type=\"text\" name=\"fax\" value=\"$fax\">");
if ($lastvisitedpage == true) {
$block1->contentRow($strings["last_page"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"255\" type=\"text\" name=\"last_page\" value=\"$last_page\">");
}
$block1->contentRow($strings["comments"],"<textarea style=\"width: 350px; height: 60px;\" name=\"c\" cols=\"45\" rows=\"5\">$c</textarea>");
if ($id == "") {
$block1->contentTitle($strings["enter_password"]);
}
if ($id != "") {
$block1->contentTitle($strings["change_password_user"]);
}
$block1->contentRow($strings["password"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"15\" type=\"password\" name=\"pw\" value=\"\">");
$block1->contentRow($strings["confirm_password"],"<input size=\"24\" style=\"width: 250px;\" maxlength=\"16\" type=\"password\" name=\"pwa\" value=\"\">");
// if the user isn't a client user then i give the opportunity to change the permission
if ($perm != '3') {
$block1->contentTitle($strings["select_permissions"]);
$block1->contentRow("<input type='radio' name='perm' value='1' $checked1 />","<b>".$strings["project_manager_permissions"]."</b>");
$block1->contentRow("<input type='radio' name='perm' value='2' $checked2 />","<b>".$strings["user_permissions"]."</b>");
$block1->contentRow("<input type='radio' name='perm' value='4' $checked4 />","<b>".$strings["disabled_permissions"]."</b>");
$block1->contentRow("<input type='radio' name='perm' value='5' $checked5 />","<b>".$strings["project_manager_administrator_permissions"]."</b>");
} else {
$block1->contentRow('',"<input type='hidden' name='perm' value='3' />");
}
$block1->contentRow("","<input type='submit' name='Save' value='".$strings["save"]."'>");
$block1->closeContent();
$block1->closeForm();
include('../themes/'.THEME.'/footer.php');
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.