Routes for admin only
Opened this issue · 0 comments
maddrid commented
we can separate routes into admin routes and front end routes only for faster match
if( OC_ADMIN ) {
// init admin menu
AdminMenu::newInstance()->init();
$functions_path = AdminThemes::newInstance()->getCurrentThemePath() . 'functions.php';
if( file_exists($functions_path) ) {
require_once $functions_path;
}
} else {
Rewrite::newInstance()->init();
}
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)) {
.....