From: Gianluca S. <gi...@gm...> - 2008-08-29 07:08:35
|
I notice the same kind code: $normalized_string = preg_replace('/\s+/', ' ', $original_string); used three times in this patch, maybe a candidate for a string_normalize_spaces() function? what about also adding a trim() in the mix? ---------- Forwarded message ---------- From: <thr...@us...> Date: Thu, Aug 28, 2008 at 4:03 AM Subject: [mantisbt-cvs] SF.net SVN: mantisbt:[5528] trunk/mantisbt To: man...@li... Revision: 5528 http://mantisbt.svn.sourceforge.net/mantisbt/?rev=5528&view=rev Author: thraxisp Date: 2008-08-28 02:03:19 +0000 (Thu, 28 Aug 2008) Log Message: ----------- fix for #5424: user_is_name_unique(): "Real Name" and "Real Name" (first name has one space, second name two) fix for #7880: Create new user with same name is allowed. Editting the user reports an error Modified Paths: -------------- trunk/mantisbt/account_update.php trunk/mantisbt/manage_user_create.php trunk/mantisbt/manage_user_update.php Modified: trunk/mantisbt/account_update.php =================================================================== --- trunk/mantisbt/account_update.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/account_update.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -64,18 +64,13 @@ $t_email_updated = true; } - if ( $f_realname != user_get_field( $t_user_id, 'realname' ) ) { + # strip extra spaces from real name + $t_realname = d + if ( $t_realname != user_get_field( $t_user_id, 'realname' ) ) { # checks for problems with realnames $t_username = user_get_field( $t_user_id, 'username' ); - switch ( user_is_realname_unique( $t_username, $f_realname ) ) { - case 1: - break; - case 0: - default: - trigger_error( ERROR_USER_REAL_MATCH_USER, ERROR ); - break; - } - user_set_realname( $t_user_id, $f_realname ); + user_ensure_realname_unique( $t_username, $t_realname ); + user_set_realname( $t_user_id, $t_realname ); $t_realname_updated = true; } Modified: trunk/mantisbt/manage_user_create.php =================================================================== --- trunk/mantisbt/manage_user_create.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/manage_user_create.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -48,8 +48,11 @@ # Check the name for validity here so we do it before promting to use a # blank password (don't want to prompt the user if the process will fail # anyway) + # strip extra space from real name + $t_realname = preg_replace('/\s+/', ' ', $f_realname); user_ensure_name_valid( $f_username ); - user_ensure_realname_valid( $f_realname ); + user_ensure_realname_valid( $t_realname ); + user_ensure_realname_unique( $f_username, $f_realname ); if ( $f_password != $f_password_verify ) { trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR ); @@ -75,7 +78,7 @@ form_security_validate( 'manage_user_create' ); - $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname ); + $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $t_realname ); if ( $t_cookie === false ) { $t_redirect_url = 'manage_user_page.php'; Modified: trunk/mantisbt/manage_user_update.php =================================================================== --- trunk/mantisbt/manage_user_update.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/manage_user_update.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -54,6 +54,9 @@ trigger_error( ERROR_USER_NAME_NOT_UNIQUE, ERROR ); } + # strip extra space from real name + $t_realname = preg_replace('/\s+/', ' ', $f_realname); + user_ensure_name_valid( $f_username ); user_ensure_realname_valid( $f_realname ); user_ensure_realname_unique( $f_username, $f_realname ); @@ -63,7 +66,7 @@ email_ensure_not_disposable( $f_email ); $c_email = $f_email; - $c_username = $f_username; + $c_username = $t_username; $c_realname = $f_realname; $c_protected = db_prepare_bool( $f_protected ); $c_enabled = db_prepare_bool( $f_enabled ); @@ -82,7 +85,7 @@ # Project specific access rights override global levels, hence, for users who are changed # to be administrators, we have to remove project specific rights. - if ( ( $c_access_level >= ADMINISTRATOR ) && ( !user_is_administrator( $c_user_id ) ) ) { + if ( ( $c_access_level >= ADMINISTRATOR ) && ( !user_is_administrator( $c_user_id ) ) ) { user_delete_project_specific_access_levels( $c_user_id ); } -- Gianluca Sforna http://morefedora.blogspot.com http://www.linkedin.com/in/gianlucasforna |
From: Richards, P. <pl...@la...> - 2008-08-29 12:14:51
|
Also, do we still allow two users with the same realname? Paul -----Original Message----- From: man...@li... [mailto:man...@li...] On Behalf Of Gianluca Sforna Sent: 29 August 2008 08:09 To: developer discussions Subject: [mantisbt-dev] Fwd: [mantisbt-cvs] SF.net SVN: mantisbt:[5528] trunk/mantisbt I notice the same kind code: $normalized_string = preg_replace('/\s+/', ' ', $original_string); used three times in this patch, maybe a candidate for a string_normalize_spaces() function? what about also adding a trim() in the mix? ---------- Forwarded message ---------- From: <thr...@us...> Date: Thu, Aug 28, 2008 at 4:03 AM Subject: [mantisbt-cvs] SF.net SVN: mantisbt:[5528] trunk/mantisbt To: man...@li... Revision: 5528 http://mantisbt.svn.sourceforge.net/mantisbt/?rev=5528&view=rev Author: thraxisp Date: 2008-08-28 02:03:19 +0000 (Thu, 28 Aug 2008) Log Message: ----------- fix for #5424: user_is_name_unique(): "Real Name" and "Real Name" (first name has one space, second name two) fix for #7880: Create new user with same name is allowed. Editting the user reports an error Modified Paths: -------------- trunk/mantisbt/account_update.php trunk/mantisbt/manage_user_create.php trunk/mantisbt/manage_user_update.php Modified: trunk/mantisbt/account_update.php =================================================================== --- trunk/mantisbt/account_update.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/account_update.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -64,18 +64,13 @@ $t_email_updated = true; } - if ( $f_realname != user_get_field( $t_user_id, 'realname' ) ) { + # strip extra spaces from real name + $t_realname = d + if ( $t_realname != user_get_field( $t_user_id, 'realname' ) ) { # checks for problems with realnames $t_username = user_get_field( $t_user_id, 'username' ); - switch ( user_is_realname_unique( $t_username, $f_realname ) ) { - case 1: - break; - case 0: - default: - trigger_error( ERROR_USER_REAL_MATCH_USER, ERROR ); - break; - } - user_set_realname( $t_user_id, $f_realname ); + user_ensure_realname_unique( $t_username, $t_realname ); + user_set_realname( $t_user_id, $t_realname ); $t_realname_updated = true; } Modified: trunk/mantisbt/manage_user_create.php =================================================================== --- trunk/mantisbt/manage_user_create.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/manage_user_create.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -48,8 +48,11 @@ # Check the name for validity here so we do it before promting to use a # blank password (don't want to prompt the user if the process will fail # anyway) + # strip extra space from real name + $t_realname = preg_replace('/\s+/', ' ', $f_realname); user_ensure_name_valid( $f_username ); - user_ensure_realname_valid( $f_realname ); + user_ensure_realname_valid( $t_realname ); + user_ensure_realname_unique( $f_username, $f_realname ); if ( $f_password != $f_password_verify ) { trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR ); @@ -75,7 +78,7 @@ form_security_validate( 'manage_user_create' ); - $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname ); + $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $t_realname ); if ( $t_cookie === false ) { $t_redirect_url = 'manage_user_page.php'; Modified: trunk/mantisbt/manage_user_update.php =================================================================== --- trunk/mantisbt/manage_user_update.php 2008-08-23 22:34:26 UTC (rev 5527) +++ trunk/mantisbt/manage_user_update.php 2008-08-28 02:03:19 UTC (rev 5528) @@ -54,6 +54,9 @@ trigger_error( ERROR_USER_NAME_NOT_UNIQUE, ERROR ); } + # strip extra space from real name + $t_realname = preg_replace('/\s+/', ' ', $f_realname); + user_ensure_name_valid( $f_username ); user_ensure_realname_valid( $f_realname ); user_ensure_realname_unique( $f_username, $f_realname ); @@ -63,7 +66,7 @@ email_ensure_not_disposable( $f_email ); $c_email = $f_email; - $c_username = $f_username; + $c_username = $t_username; $c_realname = $f_realname; $c_protected = db_prepare_bool( $f_protected ); $c_enabled = db_prepare_bool( $f_enabled ); @@ -82,7 +85,7 @@ # Project specific access rights override global levels, hence, for users who are changed # to be administrators, we have to remove project specific rights. - if ( ( $c_access_level >= ADMINISTRATOR ) && ( !user_is_administrator( $c_user_id ) ) ) { + if ( ( $c_access_level >= ADMINISTRATOR ) && ( !user_is_administrator( $c_user_id ) ) ) { user_delete_project_specific_access_levels( $c_user_id ); } -- Gianluca Sforna http://morefedora.blogspot.com http://www.linkedin.com/in/gianlucasforna ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ mantisbt-dev mailing list man...@li... https://lists.sourceforge.net/lists/listinfo/mantisbt-dev Email Disclaimer: The Latymer School cannot accept liability for statements made, which are clearly the sender's own and are not made on behalf of The Latymer School. This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. This communication represents the originator's personal views and opinions, which do not necessarily reflect those of The Latymer School. If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received email in error, delete and notify pos...@la.... Please consider the environment before printing this e-mail. |
From: Gianluca S. <gi...@gm...> - 2008-08-29 14:03:23
|
On Fri, Aug 29, 2008 at 2:14 PM, Richards, Paul <pl...@la...> wrote: > Also, do we still allow two users with the same realname? Why not? If another Paul Richards from Australia wants to register, he should be able to do so; of course he needs to provide a different login and email than yours. -- Gianluca Sforna http://morefedora.blogspot.com http://www.linkedin.com/in/gianlucasforna |
From: Glenn H. <thr...@lo...> - 2008-08-29 14:06:50
|
On 29-Aug-08, at 8:14 AM, Richards, Paul wrote: > Also, do we still allow two users with the same realname? Yes. There is a feature that can be enabled to show "Real Name (userid)" where there are duplicates. I think that it broke in 1.1 though. > > > Paul > > > -----Original Message----- > From: man...@li... [mailto:man...@li... > ] On Behalf Of Gianluca Sforna > Sent: 29 August 2008 08:09 > To: developer discussions > Subject: [mantisbt-dev] Fwd: [mantisbt-cvs] SF.net SVN: mantisbt: > [5528] trunk/mantisbt > > I notice the same kind code: > > $normalized_string = preg_replace('/\s+/', ' ', $original_string); > > used three times in this patch, maybe a candidate for a > string_normalize_spaces() function? > > what about also adding a trim() in the mix? I'll add this this evening. ... Glenn > > > > > ---------- Forwarded message ---------- > From: <thr...@us...> > Date: Thu, Aug 28, 2008 at 4:03 AM > Subject: [mantisbt-cvs] SF.net SVN: mantisbt:[5528] trunk/mantisbt > To: man...@li... > > > Revision: 5528 > http://mantisbt.svn.sourceforge.net/mantisbt/? > rev=5528&view=rev > Author: thraxisp > Date: 2008-08-28 02:03:19 +0000 (Thu, 28 Aug 2008) > > Log Message: > ----------- > fix for #5424: user_is_name_unique(): "Real Name" and "Real Name" > (first name has one space, second name two) > fix for #7880: Create new user with same name is allowed. Editting the > user reports an error > > Modified Paths: > -------------- > trunk/mantisbt/account_update.php > trunk/mantisbt/manage_user_create.php > trunk/mantisbt/manage_user_update.php > > Modified: trunk/mantisbt/account_update.php > =================================================================== > --- trunk/mantisbt/account_update.php 2008-08-23 22:34:26 UTC (rev > 5527) > +++ trunk/mantisbt/account_update.php 2008-08-28 02:03:19 UTC (rev > 5528) > @@ -64,18 +64,13 @@ > $t_email_updated = true; > } > > - if ( $f_realname != user_get_field( $t_user_id, > 'realname' ) ) { > + # strip extra spaces from real name > + $t_realname = d > + if ( $t_realname != user_get_field( $t_user_id, > 'realname' ) ) { > # checks for problems with realnames > $t_username = user_get_field( $t_user_id, 'username' ); > - switch ( user_is_realname_unique( $t_username, > $f_realname ) ) { > - case 1: > - break; > - case 0: > - default: > - trigger_error( > ERROR_USER_REAL_MATCH_USER, ERROR ); > - break; > - } > - user_set_realname( $t_user_id, $f_realname ); > + user_ensure_realname_unique( $t_username, > $t_realname ); > + user_set_realname( $t_user_id, $t_realname ); > $t_realname_updated = true; > } > > > Modified: trunk/mantisbt/manage_user_create.php > =================================================================== > --- trunk/mantisbt/manage_user_create.php 2008-08-23 22:34:26 > UTC (rev 5527) > +++ trunk/mantisbt/manage_user_create.php 2008-08-28 02:03:19 > UTC (rev 5528) > @@ -48,8 +48,11 @@ > # Check the name for validity here so we do it before promting > to use a > # blank password (don't want to prompt the user if the > process will fail > # anyway) > + # strip extra space from real name > + $t_realname = preg_replace('/\s+/', ' ', $f_realname); > user_ensure_name_valid( $f_username ); > - user_ensure_realname_valid( $f_realname ); > + user_ensure_realname_valid( $t_realname ); > + user_ensure_realname_unique( $f_username, $f_realname ); > > if ( $f_password != $f_password_verify ) { > trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, > ERROR ); > @@ -75,7 +78,7 @@ > > form_security_validate( 'manage_user_create' ); > > - $t_cookie = user_create( $f_username, $f_password, $f_email, > $f_access_level, $f_protected, $f_enabled, $f_realname ); > + $t_cookie = user_create( $f_username, $f_password, $f_email, > $f_access_level, $f_protected, $f_enabled, $t_realname ); > > if ( $t_cookie === false ) { > $t_redirect_url = 'manage_user_page.php'; > > Modified: trunk/mantisbt/manage_user_update.php > =================================================================== > --- trunk/mantisbt/manage_user_update.php 2008-08-23 22:34:26 > UTC (rev 5527) > +++ trunk/mantisbt/manage_user_update.php 2008-08-28 02:03:19 > UTC (rev 5528) > @@ -54,6 +54,9 @@ > trigger_error( ERROR_USER_NAME_NOT_UNIQUE, ERROR ); > } > > + # strip extra space from real name > + $t_realname = preg_replace('/\s+/', ' ', $f_realname); > + > user_ensure_name_valid( $f_username ); > user_ensure_realname_valid( $f_realname ); > user_ensure_realname_unique( $f_username, $f_realname ); > @@ -63,7 +66,7 @@ > email_ensure_not_disposable( $f_email ); > > $c_email = $f_email; > - $c_username = $f_username; > + $c_username = $t_username; > $c_realname = $f_realname; > $c_protected = db_prepare_bool( $f_protected ); > $c_enabled = db_prepare_bool( $f_enabled ); > @@ -82,7 +85,7 @@ > > # Project specific access rights override global levels, hence, > for users who are changed > # to be administrators, we have to remove project specific > rights. > - if ( ( $c_access_level >= ADMINISTRATOR ) && ( > !user_is_administrator( $c_user_id ) ) ) { > + if ( ( $c_access_level >= ADMINISTRATOR ) && ( > !user_is_administrator( $c_user_id ) ) ) { > > user_delete_project_specific_access_levels( $c_user_id ); > } > > > > > -- > Gianluca Sforna > > http://morefedora.blogspot.com > http://www.linkedin.com/in/gianlucasforna > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > mantisbt-dev mailing list > man...@li... > https://lists.sourceforge.net/lists/listinfo/mantisbt-dev > > Email Disclaimer: > > The Latymer School cannot accept liability for statements made, > which are clearly the sender's own and are not made on behalf of The > Latymer School. > > This email and any files transmitted with it are confidential and > are intended solely for the use of the individual or entity to whom > they are addressed. This communication represents the originator's > personal views and opinions, which do not necessarily reflect those > of The Latymer School. If you are not the original recipient or the > person responsible for delivering the email to the intended > recipient, be advised that you have received this email in error, > and that any use, dissemination, forwarding, printing, or copying of > this email is strictly prohibited. If you received email in error, > delete and notify pos...@la.... > > Please consider the environment before printing this e-mail. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > mantisbt-dev mailing list > man...@li... > https://lists.sourceforge.net/lists/listinfo/mantisbt-dev -- Glenn Henshaw Logical Outcome Ltd. t: (613) 853-6702 e: thr...@lo... f: (613) 832-2133 w: www.logicaloutcome.ca This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |