예제 #1
0
파일: Auth.php 프로젝트: kirkbauer2/kirkxc
 /**
  * Get profile registered in session
  *
  * @param integer $profileId Profile Id OPTIONAL
  *
  * @return \XLite\Model\Profile
  */
 public function getProfile($profileId = null)
 {
     if (isset($profileId)) {
         $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->find($profileId);
         $result = $this->checkProfile($profile) ? $profile : null;
     } else {
         if (!$this->profile['isInitialized']) {
             $this->resetProfileCache();
             $this->profile['isInitialized'] = true;
             $profileId = $this->isOperatingAsUserMode() && !\XLite::isAdminScript() ? $this->getOperatingAs() : $this->getStoredProfileId();
             if (isset($profileId)) {
                 $this->profile['object'] = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->find($profileId);
             }
         }
         $result = $this->profile['object'];
     }
     return $result;
 }