Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2010
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. class Application_Model_User
  2. {
  3.     const AUTHENTICATION_FIELD = 'name';
  4.     protected static $_authenticated;
  5.  
  6.     public static function getAuthenticated ()
  7.     {
  8.         if (self::$_authenticated === null) {
  9.             self::$_authenticated = new self;
  10.             $auth = Zend_Auth::getInstance();
  11.  
  12.             if ($auth->hasIdentity()) {
  13.                 self::$_authenticated = self::$_authenticated->getTable()->findOneBy(self::AUTHENTICATION_FIELD, $auth->getIdentity());
  14.             }
  15.         }
  16.        
  17.         return self::$_authenticated;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement