[geeklog-cvs] geeklog: Treat uid 0 as 1 in COM_getDisplayName. Came across som...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Nov 29 16:03:35 EST 2009
changeset 7502:8b5c2cc2aa79
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8b5c2cc2aa79
user: Dirk Haun <dirk at haun-online.de>
date: Sun Nov 29 21:00:53 2009 +0100
description:
Treat uid 0 as 1 in COM_getDisplayName. Came across some _really_ old entries in the geeklog.net database that don't have the uid set ...
diffstat:
public_html/lib-common.php | 45 +++++++++++++++++++--------------------------
1 files changed, 19 insertions(+), 26 deletions(-)
diffs (68 lines):
diff -r 4623d59f78b3 -r 8b5c2cc2aa79 public_html/lib-common.php
--- a/public_html/lib-common.php Sun Nov 29 20:53:58 2009 +0100
+++ b/public_html/lib-common.php Sun Nov 29 21:00:53 2009 +0100
@@ -4003,45 +4003,38 @@
* @return string Username, fullname or username at Service
*
*/
-function COM_getDisplayName( $uid = '', $username='', $fullname='', $remoteusername='', $remoteservice='' )
+function COM_getDisplayName($uid = '', $username = '', $fullname = '', $remoteusername = '', $remoteservice = '')
{
global $_CONF, $_TABLES, $_USER;
- if ($uid == '')
- {
- if( COM_isAnonUser() )
- {
+ if ($uid == '') {
+ if (COM_isAnonUser()) {
$uid = 1;
- }
- else
- {
+ } else {
$uid = $_USER['uid'];
}
}
- if( empty( $username ))
- {
- $query = DB_query( "SELECT username, fullname, remoteusername, remoteservice FROM {$_TABLES['users']} WHERE uid='$uid'" );
- list( $username, $fullname, $remoteusername, $remoteservice ) = DB_fetchArray( $query );
- }
-
- if( !empty( $fullname ) && ($_CONF['show_fullname'] == 1 ))
- {
+ // "this shouldn't happen"
+ if ($uid == 0) {
+ $uid = 1;
+ }
+
+ if (empty($username)) {
+ $query = DB_query("SELECT username, fullname, remoteusername, remoteservice FROM {$_TABLES['users']} WHERE uid='$uid'");
+ list($username, $fullname, $remoteusername, $remoteservice) = DB_fetchArray($query);
+ }
+
+ if (!empty($fullname) && ($_CONF['show_fullname'] == 1)) {
return $fullname;
- }
- else if(( $_CONF['user_login_method']['3rdparty'] || $_CONF['user_login_method']['openid'] ) && !empty( $remoteusername ))
- {
- if( !empty( $username ))
- {
+ } elseif (($_CONF['user_login_method']['3rdparty'] || $_CONF['user_login_method']['openid']) && !empty($remoteusername)) {
+ if (! empty($username)) {
$remoteusername = $username;
}
- if( $_CONF['show_servicename'] )
- {
+ if ($_CONF['show_servicename']) {
return "$remoteusername@$remoteservice";
- }
- else
- {
+ } else {
return $remoteusername;
}
}
More information about the geeklog-cvs
mailing list