Show
Ignore:
Timestamp:
02/10/2008 12:22:20 PM (11 months ago)
Author:
Shadowhand
Message:

Fixing #389, thanks neovive.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/auth/libraries/Auth.php

    r1717 r2024  
    6464 
    6565        /** 
     66         * Check if there is an active session. Optionally allows checking for a 
     67         * specific role. 
     68         * 
     69         * @param   string   role name 
     70         * @return  boolean 
     71         */ 
     72        public function logged_in($role = NULL) 
     73        { 
     74                // Check if the user_id is present in the session 
     75                $status = ! empty($_SESSION['user_id']); 
     76 
     77                if ($status === TRUE AND ! empty($role)) 
     78                { 
     79                        // Check if the user has the given role 
     80                        $status = in_array($role, $_SESSION['roles']); 
     81                } 
     82 
     83                return $status; 
     84        } 
     85 
     86        /** 
    6687         * Attempt to log in a user by using an ORM object and plain-text password. 
    6788         *