Example #1
0
// and I say, that would not let us know when the user is using a error control operator (@)
// to avoid showing any error.
error_reporting((E_ALL | E_STRICT) ^ (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING));
// Custom PHP error Handler
set_error_handler(array('Core', 'errorphp'));
// Custom shutdown handler (used to show those errors thar errorphp isn't supposed to handle)
register_shutdown_function(array('Core', 'shutdown'));
// set timezone
date_default_timezone_set(Core::config('time_zone'));
// start the session
Session::start();
// -------------------------------------------------------------  Launch Framework
// Process the Routing and show Output only if this isn't an EXTERNAL call
if (!_EX) {
    //  Include the corresponding class & method
    include Router::classpath();
    $class = Router::classname();
    $method = Router::methodname();
    $uri = Uri::string();
    // Check that no system functions or methods starting
    // with an underscore can be called via the URI.
    if (array_key_exists(strtolower($method), Core::libraries()) || substr($method, 0, 1) == '_') {
        Core::error404($uri);
    }
    // instantiate the controller (and run its constructor)
    $class = Core::controller($class);
    // Call the remapping function if it's present in the controller
    if (method_exists($class, '_remap')) {
        call_user_func(array($class, '_remap'));
    } else {
        if (!method_exists($class, $method)) {