function xtc_session_recreate() { $session_backup = $_SESSION; unset($_COOKIE[xtc_session_name()]); xtc_session_destroy(); if (STORE_SESSIONS == 'mysql') { session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc'); register_shutdown_function('session_write_close'); } xtc_session_start(); $_SESSION = $session_backup; unset($session_backup); }
function process_rope_request($request) { try { $this->_request = new SimpleXMLElement(urldecode($request), LIBXML_NOCDATA); if (!$this->_auth()) { throw new Exception('Authentication failed'); } $init_session = true; /** * Check type of request and call proper handler */ switch ($this->_request->getName()) { case 'tradoria_check_order': $this->_order_node = 'order'; $this->_process_function = '_check_order'; $response_tag = 'tradoria_check_order_response'; break; case 'tradoria_order_process': $this->_order_node = 'cart'; $this->_process_function = '_process_order'; $response_tag = 'tradoria_order_process_response'; break; case 'tradoria_order_status': $init_session = false; $this->_process_function = '_status_update'; $response_tag = 'tradoria_order_status_response'; break; default: /** * Unrecognised request error */ $response_tag = 'unknown_error'; return $this->prepare_response(false, $response_tag); } if ($init_session) { /** * Instantiate Session */ $session_name = (string) $this->_request->{$this->_order_node}->custom_1; $session_id = (string) $this->_request->{$this->_order_node}->custom_2; $customer_id = (string) $this->_request->{$this->_order_node}->custom_3; xtc_session_name($session_name); if (STORE_SESSIONS != 'mysql') { session_save_path(SESSION_WRITE_DIRECTORY); } xtc_session_id($session_id); xtc_session_start(); /** * Load the correct language file */ require_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/rakuten.php'; require_once DIR_WS_CLASSES . 'xtcPrice.php'; global $xtPrice; $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']); require_once DIR_WS_CLASSES . 'main.php'; global $main; $main = new main(); } $response = $this->{$this->_process_function}(); } catch (Exception $e) { return $this->prepare_response(false); } return $this->prepare_response($response, $response_tag); }