/** * startSession * @param string $params * @return boolean */ public function startSession($params) { //make sure the params contain the required entries if (!isset($params['app_key'])) { $params['app_key'] = $this->getAppKey(); } if (!isset($params['client_id'])) { $params['client_id'] = $this->getClientId(); } //create a new session $data = parent::startSession($params); //save session details $this->insertRow($this->getTableName('shareyourcart_tokens'), $data); //we can't rely on the fact that the row has been inserted, so check! if ($this->getSessionId($data['token']) === null) { throw new Exception(SyC::t('sdk', 'Token cannot be saved. Check your "{table_name}" table permissions.', array('{table_name}' => $this->getTableName('shareyourcart_tokens')))); } return true; }
/** * startSession * @param string $params * @return boolean */ public function startSession($params) { //make sure the params contain the required entries if (!isset($params['app_key'])) { $params['app_key'] = $this->getAppKey(); } if (!isset($params['client_id'])) { $params['client_id'] = $this->getClientId(); } //create a new session $data = parent::startSession($params); //reset the Location, as the following code might give an error //and the developer needs to be aware of it $headers = headers_list(); header('Location:'); //save session details $this->insertRow($this->getTableName('shareyourcart_tokens'), $data); //we can't rely on the fact that the row has been inserted, so check! if ($this->getSessionId($data['token']) === null) { throw new Exception(SyC::t('sdk', 'Token cannot be saved. Check your "{table_name}" table permissions.', array('{table_name}' => $this->getTableName('shareyourcart_tokens')))); } //since everything is ok, resume the Location header foreach ($headers as $header) { header($header); } return true; }