예제 #1
0
 /**
  * processMappedAction
  */
 public function processMappedAction($action_to_process)
 {
     /**
      * process action
      */
     $Onxshop_Router = new Onxshop_Router();
     $Onxshop = $Onxshop_Router->processAction($action_to_process);
     if (is_object($Onxshop)) {
         $page_data['content'] = $Onxshop->getContent();
     }
     if ($page_data['content'] == "") {
         $page_data['content'] = $this->content;
     }
     return $page_data;
 }
예제 #2
0
 /**
  * Process Action
  */
 function processAction($request)
 {
     $router = new Onxshop_Router();
     $this->Onxshop = $router->processAction($request);
     $this->headers = $this->getPublicHeaders();
     $this->output = $this->Onxshop->finalOutput();
 }
예제 #3
0
/**
 * onxshop aware http forward
 *
 * @param unknown_type $request
 * @param unknown_type $type
 * type = 0: local path
 * type = 1: router syntax
 * type = 2: external URL
 */
function onxshopGoTo($request, $type = 0)
{
    msg("calling onxshopGoTo({$request}, {$type})", 'ok', 2);
    session_write_close();
    if ($_SERVER['HTTPS']) {
        $protocol = 'https';
    } else {
        $protocol = 'http';
    }
    //protection against HTTP CRLF injection
    $request = preg_replace("/\r\n/", "", $request);
    if ($type == 0) {
        $request = ltrim($request, '/');
        if (preg_match('/^(page\\/[0-9]{1,})(.*)$/', $request, $matches)) {
            $request_path = translateURL($matches[1]);
            $request_params = $matches[2];
            header("Location: {$protocol}://{$_SERVER['HTTP_HOST']}{$request_path}{$request_params}");
        } else {
            header("Location: {$protocol}://{$_SERVER['HTTP_HOST']}/{$request}");
        }
    } else {
        if ($type == 1) {
            $router = new Onxshop_Router();
            $Onxshop = $router->processAction($request);
            $output = $Onxshop->finalOutput();
            echo $output;
        } else {
            if ($type == 2) {
                header("Location: {$request}");
            } else {
                header("Location: {$protocol}://{$_SERVER['HTTP_HOST']}/{$request}");
            }
        }
    }
    //exit application processing immediately
    exit;
}