[geeklog-devel] COM_isAnonUser

Joe Mucchiello joe at ThrowingDice.com
Sat Dec 29 03:35:59 EST 2007


The 'if' at the end of this function is insufficient. It should also 
make sure the $uid is positive. Likewise, the if !empty redundant if 
the comparison is made $uid <= 1.
I've also updated the rest of the function to follow the coding guidelines.

/**
   * Checks to see if a specified user, or the current user if non-specified
   * is the anonymous user.
   *
   * @param  int $uid    ID of the user to check, or none for the current user.
   * @return boolean     true if the user is the anonymous user.
   */
function COM_isAnonUser($uid = '')
{
     global $_USER;

     /* If no user was specified, fail over to the current user if 
there is one */
     if (empty($uid) && isset( $_USER['uid'])) {
         $uid = $_USER['uid'];
     }

     return $uid <= 1;
}

----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list