Revision 2065
Added by Dietmar almost 11 years ago
- /admin/users bugfixes user deactivating and deleting
add.php | ||
---|---|---|
25 | 25 |
|
26 | 26 |
function add_user($admin, &$aActionRequest) |
27 | 27 |
{ |
28 |
global $MESSAGE,$TEXT, $HEADING; |
|
29 | 28 |
$database = WbDatabase::getInstance(); |
29 |
$mLang = Translate::getInstance(); |
|
30 | 30 |
$bRetVal = false; |
31 | 31 |
$iMinPassLength = 6; |
32 | 32 |
|
33 | 33 |
if( !$admin->checkFTAN() ) |
34 | 34 |
{ |
35 | 35 |
// $admin->print_header(); |
36 |
msgQueue::add($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
36 |
msgQueue::add($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
|
|
37 | 37 |
return $bRetVal; |
38 | 38 |
} |
39 | 39 |
|
... | ... | |
63 | 63 |
// Check values |
64 | 64 |
// Check values |
65 | 65 |
if($groups_id == "") { |
66 |
msgQueue::add($MESSAGE['USERS_NO_GROUP']);
|
|
66 |
msgQueue::add($mLang->MESSAGE_USERS_NO_GROUP);
|
|
67 | 67 |
} else { |
68 | 68 |
$aGroups_id = explode(',', $groups_id); |
69 | 69 |
//if user is in administrator-group, get this group else just get the first one |
... | ... | |
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
if(!preg_match('/^[a-z]{1}[a-z0-9_-]{2,}$/i', $username)) { |
74 |
msgQueue::add( $MESSAGE['USERS_NAME_INVALID_CHARS']);
|
|
74 |
msgQueue::add( $mLang->MESSAGE_USERS_NAME_INVALID_CHARS);
|
|
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '. |
... | ... | |
79 | 79 |
// Check if username already exists |
80 | 80 |
if( ($iFoundUser = $database->get_one($sql)) != null ) { |
81 | 81 |
if($iFoundUser) { |
82 |
msgQueue::add($MESSAGE['USERS_USERNAME_TAKEN']);
|
|
82 |
msgQueue::add($mLang->MESSAGE_USERS_USERNAME_TAKEN);
|
|
83 | 83 |
} |
84 | 84 |
} |
85 | 85 |
|
86 | 86 |
if(strlen($password) < $iMinPassLength ) { |
87 |
msgQueue::add($MESSAGE['USERS_PASSWORD_TOO_SHORT']);
|
|
87 |
msgQueue::add($mLang->MESSAGE_USERS_PASSWORD_TOO_SHORT);
|
|
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
$pattern = '/[^'.$admin->password_chars.']/'; |
91 | 91 |
if (preg_match($pattern, $password)) { |
92 |
msgQueue::add($MESSAGE['PREFERENCES_INVALID_CHARS']);
|
|
92 |
msgQueue::add($mLang->MESSAGE_PREFERENCES_INVALID_CHARS);
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
if(($password != $password2) ) { |
96 |
msgQueue::add($MESSAGE['USERS_PASSWORD_MISMATCH']);
|
|
96 |
msgQueue::add($mLang->MESSAGE__USERS_PASSWORD_MISMATCH);
|
|
97 | 97 |
} |
98 | 98 |
|
99 | 99 |
// |
... | ... | |
101 | 101 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
102 | 102 |
$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"'; |
103 | 103 |
if( ($iFoundUser = intval($database->get_one($sql))) > 0 ){ |
104 |
msgQueue::add($MESSAGE['USERS_USERNAME_TAKEN'].' ('.$TEXT['DISPLAY_NAME'].')');
|
|
104 |
msgQueue::add($mLang->MESSAGE_USERS_USERNAME_TAKEN.' ('.$mLang->TEXT_DISPLAY_NAME.')');
|
|
105 | 105 |
} else { |
106 | 106 |
if($display_name == '') { |
107 |
msgQueue::add($MESSAGE['GENERIC_FILL_IN_ALL'].' ('.$TEXT['DISPLAY_NAME'].')');
|
|
107 |
msgQueue::add($mLang->MESSAGE_GENERIC_FILL_IN_ALL.' ('.$mLang->TEXT_DISPLAY_NAME.')');
|
|
108 | 108 |
} |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
if(findStringInFileList($display_name, dirname(__FILE__).'/disallowedNames')) { |
112 |
msgQueue::add( $TEXT['ERROR'].' '.$TEXT['DISPLAY_NAME'].' ('.$display_name.')' );
|
|
112 |
msgQueue::add( $mLang->TEXT_ERROR.' '.$mLang->TEXT_DISPLAY_NAME.' ('.$display_name.')' );
|
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
if($email != "") |
116 | 116 |
{ |
117 | 117 |
if($admin->validate_email($email) == false) |
118 | 118 |
{ |
119 |
msgQueue::add($MESSAGE['USERS_INVALID_EMAIL'].' ('.$email.')');
|
|
119 |
msgQueue::add($mLang->MESSAGE_USERS_INVALID_EMAIL.' ('.$email.')');
|
|
120 | 120 |
} |
121 | 121 |
} else { // e-mail must be present |
122 |
msgQueue::add($MESSAGE['SIGNUP_NO_EMAIL']);
|
|
122 |
msgQueue::add($mLang->MESSAGE_SIGNUP_NO_EMAIL);
|
|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '. |
... | ... | |
128 | 128 |
// Check if the email already exists |
129 | 129 |
if( ($iFoundUser = $database->get_one($sql)) != null ) { |
130 | 130 |
if($iFoundUser) { |
131 |
if(isset($MESSAGE['USERS_EMAIL_TAKEN']))
|
|
131 |
if(isset($mLang->MESSAGE_USERS_EMAIL_TAKEN))
|
|
132 | 132 |
{ |
133 |
msgQueue::add($MESSAGE['USERS_EMAIL_TAKEN'].' ('.$email.')');
|
|
133 |
msgQueue::add($mLang->MESSAGE_USERS_EMAIL_TAKEN.' ('.$email.')');
|
|
134 | 134 |
} else { |
135 |
msgQueue::add($MESSAGE['USERS_INVALID_EMAIL'].' ('.$email.')');
|
|
135 |
msgQueue::add($mLang->MESSAGE_USERS_INVALID_EMAIL.' ('.$email.')');
|
|
136 | 136 |
} |
137 | 137 |
} |
138 | 138 |
} |
... | ... | |
150 | 150 |
$sHomeFolder = WB_PATH.MEDIA_DIRECTORY.'/home/'.( media_filename($username) ); |
151 | 151 |
if ( sizeof(createFolderProtectFile( $sHomeFolder )) ) |
152 | 152 |
{ |
153 |
msgQueue::add($MESSAGE['MEDIA_DIR_NOT_MADE'].' ('.basename($sHomeFolder).') ' );
|
|
153 |
msgQueue::add($mLang->MESSAGE_MEDIA_DIR_NOT_MADE.' ('.basename($sHomeFolder).') ' );
|
|
154 | 154 |
} |
155 | 155 |
} |
156 | 156 |
// Inser the user into the database |
... | ... | |
175 | 175 |
'`login_ip` = \''.$database->escapeString($login_ip).'\' '. |
176 | 176 |
''; |
177 | 177 |
if($database->query($sql)) { |
178 |
msgQueue::add($MESSAGE['USERS_ADDED'], true);
|
|
178 |
msgQueue::add($mLang->MESSAGE_USERS_ADDED, true);
|
|
179 | 179 |
$bRetVal = true; |
180 | 180 |
} |
181 | 181 |
if($database->is_error()) { |
182 | 182 |
msgQueue::add( implode('<br />',explode(';',$database->get_error())) ); |
183 | 183 |
} |
184 | 184 |
} else { |
185 |
msgQueue::add($HEADING['ADD_USER'].' '.$MESSAGE['GENERIC_NOT_COMPARE']);
|
|
185 |
msgQueue::add($mLang->HEADING_ADD_USER.' '.$mLang->MESSAGE_GENERIC_NOT_COMPARE);
|
|
186 | 186 |
|
187 | 187 |
} |
188 | 188 |
return $bRetVal; |
Also available in: Unified diff