function __construct()
 {
     if (defined('ADMIN_URL') && constant('ADMIN_URL') != false && is_string(ADMIN_URL) && preg_match('|^/' . APP_DIR . '/|', $_SERVER['REQUEST_URI'])) {
         if (!preg_match('|http[s]?://' . $_SERVER['SERVER_NAME'] . '|', ADMIN_URL)) {
             $loc = preg_replace('|/$|', '', ADMIN_URL) . $_SERVER['REQUEST_URI'];
             // if you don't want a 404 and want to redirect instead, comment out this line
             die(NDispatcher::error404());
             header('Location:' . $loc);
             exit;
         }
     }
     if (is_null($this->name)) {
         $this->name = 'nterchange';
     }
     if (is_null($this->base_view_dir)) {
         $this->base_view_dir = BASE_DIR;
     }
     if (!defined('IN_NTERCHANGE')) {
         define('IN_NTERCHANGE', preg_match('|^/' . APP_DIR . '|', NServer::env('REQUEST_URI')) ? true : false);
     }
     parent::__construct();
 }
Exemple #2
0
<?php

// if (file_exists($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'])) return false;
if (preg_match('/\\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) {
    return false;
}
require_once dirname(__FILE__) . '/../vendor/autoload.php';
$dispatcher = new NDispatcher(NServer::setUri());
$dispatcher->dispatch();
unset($dispatcher);