function execute(&$response, &$session) { $response->set_max_size(isset($this->meta['maxmsgsize']) ? min($this->meta['maxmsgsize'], SYNCML_MAXMSGSIZE) : SYNCML_MAXMSGSIZE); $response->set_header($this->verdtd, $this->verproto, $this->sessionid, $this->msgid, isset($this->respuri) ? $this->respuri : $this->source['locuri'], '', $this->target['locuri'], ''); switch ($this->verproto) { case 'SyncML/1.0': case 'SyncML/1.1': break; default: syncml_logger::get_instance()->log("bad verproto: " . $this->verproto); $this->handle_failure(SYNCML_STATUS_PROTOCOLVERSIONNOTSUPPORTED, $response, $session); return; } switch ($this->verdtd) { case '1.0': case '1.1': $response->set_syncml_namespace_version($this->verdtd); break; default: syncml_logger::get_instance()->log("bad verdtd: " . $this->verdtd); $this->handle_failure(SYNCML_STATUS_DTDCOLVERSIONNOTSUPPORTED, $response, $session); return; } $sosession = new syncml_sosession(); $id = array($this->target['locuri'], $this->source['locuri'], $this->sessionid); list($phpgw_session_id, $next_nonce) = $sosession->get_session_mapping($id); $session->next_nonce = $next_nonce; $session->id = $id; if ($GLOBALS['phpgw']->session->verify($phpgw_session_id)) { $this->handle_success($response, $session); } else { syncml_logger::get_instance()->log("failed to verify session"); $tmp = $this->process_cred($session); // tmp is session string on success and // int error code or failure. if (is_string($tmp)) { syncml_logger::get_instance()->log("credentials was OK"); $sosession->set_session_mapping($id, $tmp); $this->handle_success($response, $session); } else { syncml_logger::get_instance()->log("bad credentials"); $this->handle_failure($tmp, $response, $session); } } $session->msgid = $this->msgid; $session->set_var('device_uri', $this->source['locuri']); }
/** * Save changes on session data back to storage. * * @access public */ function commit() { syncml_logger::get_instance()->log_data("saved session data", $this->session_data); $GLOBALS['phpgw']->session->appsession('session_data', 'syncml', $this->session_data); $sosession = new syncml_sosession(); $sosession->set_next_nonce($this->id, $this->next_nonce); }