示例#1
0
 /**
  * loadMember
  *
  * @return bool
  */
 protected function loadMember()
 {
     // See if session has member
     if ($this->session->get('memberId') && $this->session->get('memberKey')) {
         // Try to load from Session
         $memberId = (int) $this->session->get('memberId');
         $memberKey = $this->session->get('memberKey');
         $member = Member::findOne($memberId);
         if ($member && $member->validateMemberKey($memberKey) && $member->isActive) {
             // OK
             $this->member = $member;
             return true;
         }
     }
     // See if we need to load from Cookie
     if (isset($_COOKIE['k'])) {
         $cookieKey = $_COOKIE['k'];
         $member = Member::loadFromCookieKey($cookieKey);
         if ($member && $member->isActive) {
             $this->member = $member;
             return true;
         }
     }
     return false;
 }