コード例 #1
0
ファイル: Abstract.php プロジェクト: hettema/Stages
 /** 
  * Get the session user or load the user bu the id passed the request query
  *
  * @return type 
  */
 public function getUser()
 {
     if ($this->_user) {
         return $this->_user;
     }
     if (App_Main::getRequest()->getParam('user') && App_Main::hasSingleton('stages/user')) {
         $user = App_Main::getSingleton('stages/user');
     } else {
         if (App_Main::hasSingleton('stages/user')) {
             $user = App_Main::getSingleton('stages/user');
         }
     }
     if (!empty($user)) {
         $this->_user = $user;
         return $this->_user;
     }
     //else load the user with the fbid or from the session
     if ($userId = App_Main::getRequest()->getParam('user')) {
         $user = App_Main::getSession()->getUser()->getId() == $userId ? App_Main::getSession()->getUser() : App_Main::getSingleton('stages/user')->load($userId);
     } else {
         if (App_Main::getSession()->getUser()) {
             $user = App_Main::getSession()->getUser();
         }
     }
     if ($user->getId()) {
         $this->_user = $user;
         return $this->_user;
     }
     return false;
 }