6.X/traits/routing.php
/**
     * Main URL parser
     *
     * Parses the current URL to determine if it should be routed to a module or a virtual page.
     */
Main URL parser
Parses the current URL to determine if it should be routed to a module or a virtual page.
Main URL parser Parses the current URL to determine if it should be routed to a module or a virtual page .
private function parse_path()
    {
        $uri = $_SERVER["REQUEST_URI"];
        $this->handle_redirect($uri);
        if (function_exists("emps_uri_filter")) {
            $uri = emps_uri_filter($uri);
        }
        $s = explode("?", $uri, 2);
        $uri = $s[0];
        $uri = str_replace(EMPS_SCRIPT_URL_FOLDER, '', $uri);    
        $this->PLURI = $uri;
        $this->menu_URI = $uri;
        if ($uri{0} == '/') {
            $uri = substr($uri, 1);
        }
        $ouri = $uri;
        $this->PURI = $ouri;
        $this->savevars();
        $uri = $this->PURI;
        if ($uri{strlen($uri) - 1} == '/') {
            $uri = substr($uri, 0, strlen($uri) - 1);
        }
        $this->URI = $uri;
        $sp = $this->get_setting("startpage");
        if (!$this->URI) {
            if (!$_SERVER['QUERY_STRING']) {
                $this->URI = $sp;
            }
            $GLOBALS['pp'] = $sp;
            $this->page_property('front', 1);
        }
        if ($vp = $this->page_exists_external($this->PLURI)) {
            $this->virtual_path = $vp;
        } elseif ($vp = $this->page_exists($this->PLURI . '/')) {
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: " . $this->PLURI . '/');
            exit;
        } else {
            $xx = explode(",", EMPS_URL_VARS);
            $x = explode("/", $ouri);
            foreach ($x as $n => $v) {
                if ($v == "") {
                    continue;
                }
                if ($v != '-') {
                    $GLOBALS[$xx[$n]] = urldecode($v);
                }
            }
        }
        $this->post_parse();
    }
private function parse_path ( ) { $ uri = $ _SERVER [ " REQUEST_URI " ] ; $ this -> handle_redirect ( $ uri ) ; if ( function_exists ( " emps_uri_filter " ) ) { $ uri = emps_uri_filter ( $ uri ) ; } $ s = explode ( " ? " , $ uri , 2 ) ; $ uri = $ s [ 0 ] ; $ uri = str_replace ( EMPS_SCRIPT_URL_FOLDER , '' , $ uri ) ; $ this -> PLURI = $ uri ; $ this -> menu_URI = $ uri ; if ( $ uri { 0 } == '/' ) { $ uri = substr ( $ uri , 1 ) ; } $ ouri = $ uri ; $ this -> PURI = $ ouri ; $ this -> savevars ( ) ; $ uri = $ this -> PURI ; if ( $ uri { strlen ( $ uri ) - 1 } == '/' ) { $ uri = substr ( $ uri , 0 , strlen ( $ uri ) - 1 ) ; } $ this -> URI = $ uri ; $ sp = $ this -> get_setting ( " startpage " ) ; if ( ! $ this -> URI ) { if ( ! $ _SERVER [ 'QUERY_STRING' ] ) { $ this -> URI = $ sp ; } $ GLOBALS [ 'pp' ] = $ sp ; $ this -> page_property ( 'front' , 1 ) ; } if ( $ vp = $ this -> page_exists_external ( $ this -> PLURI ) ) { $ this -> virtual_path = $ vp ; } elseif ( $ vp = $ this -> page_exists ( $ this -> PLURI . '/' ) ) { header ( " HTTP/1.1 301 Moved Permanently " ) ; header ( " Location:  " . $ this -> PLURI . '/' ) ; exit ; } else { $ xx = explode ( " , " , EMPS_URL_VARS ) ; $ x = explode ( " / " , $ ouri ) ; foreach ( $ x as $ n => $ v ) { if ( $ v == " " ) { continue ; } if ( $ v != '-' ) { $ GLOBALS [ $ xx [ $ n ] ] = urldecode ( $ v ) ; } } } $ this -> post_parse ( ) ; }
Main URL parser
 Parses the current URL to determine if it should be routed to a module or a virtual page.
Main URL parser Parses the current URL to determine if it should be routed to a module or a virtual page .
// remove initial path from the URI // virtual object (CMS database item) // parse parts of the $ouri as variables from the $RVLIST, make them global