Project

General

Profile

« Previous | Next » 

Revision 803

Added by thorn over 16 years ago

some small fixes: group_id/groups_id-handling, safe_mode-query in install, better work-around for issue with phplib and code-module (removed {})

View differences:

add.php
33 33

  
34 34
// Get details entered
35 35
$groups_id = implode(",", $admin->add_slashes($_POST['groups'])); //should check permissions
36
$groups_id = trim($groups_id, ','); // there will be an additional ',' when "Please Choose" was selected, too
36 37
$active = $admin->add_slashes($_POST['active'][0]);
37 38
$username_fieldname = $admin->get_post_escaped('username_fieldname');
38 39
$username = strtolower($admin->get_post_escaped($username_fieldname));
......
44 45
$default_language = DEFAULT_LANGUAGE;
45 46

  
46 47
// Create a javascript back link
47
$js_back = "javascript: history.go(-1);";
48
$js_back = 'javascript: history.go(-1);';
48 49

  
49 50
// Check values
50
if($groups_id == "") {
51
if($groups_id == '') {
51 52
	$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
52 53
}
53 54
if(strlen($username) < 2) {
......
59 60
if($password != $password2) {
60 61
	$admin->print_error($MESSAGE['USERS']['PASSWORD_MISMATCH'], $js_back);
61 62
}
62
if($email != "") {
63
if($email != '') {
63 64
	if($admin->validate_email($email) == false) {
64 65
		$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
65 66
	}
66 67
}
67 68

  
69
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
70
$gid_tmp = explode(',', $groups_id);
71
if(in_array('1', $gid_tmp)) $group_id = '1'; // if user is in administrator-group, get this group
72
else $group_id = $gid_tmp[0]; // else just get the first one
73
unset($gid_tmp);
74

  
68 75
// Check if username already exists
69 76
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE username = '$username'");
70 77
if($results->numRows() > 0) {

Also available in: Unified diff