Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes for admin only #2279

web-media opened this issue Aug 21, 2018 · 0 comments


Copy link

commented Aug 21, 2018

we can separate routes into admin routes and front end routes only for faster match

if( OC_ADMIN ) {
    // init admin menu
    $functions_path = AdminThemes::newInstance()->getCurrentThemePath() . 'functions.php';
    if( file_exists($functions_path) ) {
        require_once $functions_path;
} else {

 class Rewrite
        private static $instance;
        private $rules;
        private $routes;
        private $aRoutes .(admin routes )... ...

public function init()
            if(Params::existServerParam('REQUEST_URI')) {
                if(preg_match('|[\?&]{1}http_referer=(.*)$|', urldecode(Params::getServerParam('REQUEST_URI', false, false)), $ref_match)) {
                    $this->http_referer = $ref_match[1];
                    $_SERVER['REQUEST_URI'] = preg_replace('|[\?&]{1}http_referer=(.*)$|', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
                $request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", Params::getServerParam('REQUEST_URI', false, false));
                $this->raw_request_uri = $request_uri;
                $route_used = false;
                foreach($this->routes as $id => $route) {
  if(preg_match('#^'.$route['regexp'].'#', $request_uri, $m)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.