Project

General

Profile

« Previous | Next » 

Revision 1815

Added by Dietmar about 12 years ago

! Complex code refactoring users management

View differences:

save.php
17 17

  
18 18
function save_preferences( &$admin, &$database)
19 19
{
20
	global $MESSAGE;
20
	global $MESSAGE,$TEXT;
21 21
	$err_msg = array();
22 22
	$iMinPassLength = 6;
23 23
	$bPassRequest = false;
......
33 33
// check that display_name is unique in whoole system (prevents from User-faking)
34 34
    	$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` ';
35 35
    	$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"';
36
    	if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS_USERNAME_TAKEN']; }
36
    	if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS_USERNAME_TAKEN'].' ('.$TEXT['DISPLAY_NAME'].')'; }
37 37
// language must be 2 upercase letters only
38 38
    	$language         = strtoupper($admin->get_post('language'));
39 39
    	$language         = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);

Also available in: Unified diff