public static function getKSObject($encoded_str)
 {
     if (empty($encoded_str)) {
         return null;
     }
     $ks = new kSessionBase();
     if (!$ks->parseKS($encoded_str)) {
         return null;
     }
     return $ks;
 }
Пример #2
0
 protected function addKSData($ks)
 {
     $this->_ks = $ks;
     // determine the KS status
     if (empty($ks)) {
         $this->_ksStatus = kSessionBase::OK;
     } else {
         $ksObj = new kSessionBase();
         $parseResult = $ksObj->parseKS($ks);
         if ($parseResult) {
             $this->_ksStatus = $ksObj->tryToValidateKS();
             if ($this->_ksStatus == kSessionBase::OK) {
                 $this->_ksObj = $ksObj;
                 $this->_ksPartnerId = $ksObj->partner_id;
             }
         } else {
             if ($parseResult === false) {
                 $this->_ksStatus = kSessionBase::INVALID_STR;
             } else {
                 $this->_ksStatus = kSessionBase::UNKNOWN;
             }
         }
     }
     $this->_params["___cache___partnerId"] = $this->_ksPartnerId;
     $this->_params["___cache___ksStatus"] = $this->_ksStatus;
     $this->_params["___cache___ksType"] = $this->_ksObj ? $this->_ksObj->type : null;
     $this->_params["___cache___userId"] = $this->_ksObj ? $this->_ksObj->user : null;
     $this->_params["___cache___privileges"] = $this->_ksObj ? $this->_ksObj->privileges : null;
 }