pchan:1191505221 wrote
if(is_null($groups)) $groups = array(); //NEW LINE ADDED HERE
nightwolf:1193411516 wrote
// if(is_null($groups)) $groups = $USERINFO['grps']; left this like a coment line
we had two options for if(is_null($groups)) ,so we delete the wrong one.
and thats all
Not sure I follow here.
The original line queried an array for a list of groups that the current user (assuming there is one) belongs to. Then 'pchan' added a secondary check on the '$groups' var to make sure it was not NULL but an empty array.
Then 'nightwolf' says he can't add a reply with this "fix"... my version (DLed 3 days ago) worked with it.
Looks like 'nightwolfs' version ignores the $USERINFO array alltogether. I don't know the big picture here, but that doesn't seem kosher to me.
I modified 'pchans' solution like this...
if(is_null($groups))
$groups = ( isset($USERINFO['grps']{0}) ) ? $USERINFO['grps'] : array();
If nothing is given, check the $USERINFO array, use the data there, if that's empty, create an empty array.
And while we're in this file... I don't get this, why do this in 2 steps?
if(is_null($user)) $user = $_SERVER['REMOTE_USER'];
$user = auth_nameencode($user);
This seems to be more succinct to me. Or is this a matter of style?
if(is_null($user))
$user = auth_nameencode($_SERVER['REMOTE_USER']);
Now this segment doesn't read like a patch of patches...
if(is_null($user))
$user = auth_nameencode($_SERVER['REMOTE_USER']);
// ** Don't do this! (above)
// ** Do this (below), as it was [walter]
if(is_null($user))
$user = $_SERVER['REMOTE_USER'];
$user = auth_nameencode($user);
if(is_null($groups))
$groups = ( isset($USERINFO['grps']{0}) ) ? $USERINFO['grps'] : array();
Just my 2 cents to this issue.
Thanks for all the great work, ideas, etc.
I'm just lovin' this wiki!
Walter