Beispiel #1
0
 public static function run($argv)
 {
     error_reporting(E_ALL ^ E_NOTICE);
     $console = $argv[1] ? $argv[1] : '';
     unset($argv[0]);
     unset($argv[1]);
     $param = array_values($argv);
     config::set('console', $console);
     config::set('param', $param);
     $route = new System\Route();
     return $route->make($console, $param);
 }
function ErrorHandler($errNo, $errStr, $errFile, $errLine)
{
    if (!(error_reporting() & $errNo)) {
        return;
    }
    System\Route::showError($errNo, $errStr, $errFile, $errLine);
    return true;
}
Beispiel #3
0
});
/**
 * Frontend Routes
 * Namespaces indicate folder structure
 */
$router->group(['namespace' => 'Frontend'], function () use($router) {
    require __DIR__ . '/Routes/Frontend/Frontend.php';
    require __DIR__ . '/Routes/Frontend/Access.php';
});
/**
 * Backend Routes
 * Namespaces indicate folder structure
 */
$router->group(['namespace' => 'Backend'], function () use($router) {
    $router->group(['prefix' => 'admin', 'middleware' => 'auth'], function () use($router) {
        /**
         * These routes need view-backend permission (good if you want to allow more than one group in the backend, then limit the backend features by different roles or permissions)
         *
         * Note: Administrator has all permissions so you do not have to specify the administrator role everywhere.
         */
        $router->group(['middleware' => 'access.routeNeedsPermission:view-backend'], function () use($router) {
            require __DIR__ . '/Routes/Backend/Dashboard.php';
            require __DIR__ . '/Routes/Backend/Access.php';
            require __DIR__ . '/Routes/Backend/LogViewer.php';
            require __DIR__ . '/Routes/Backend/Organization.php';
        });
    });
});
$router->group(['middleware' => 'auth'], function () use($router) {
    System\Route::make()->define();
});
Beispiel #4
0
<?php

/*
|---------------------------------------------
| Autoload php files
|----------------------------------------------
*/
require_once "Vendor/autoload.php";
/*
|---------------------------------------------
| Menjalankan controller berdasrkan URL
|---------------------------------------------
*/
$autoLoad = new System\Autoload();
System\Route::execute();
Beispiel #5
0
<?php

/*
 * Home page
 */
System\Route::get(array('/', 'home'), function () {
    $words = array('Welcome', 'Bienvenue', 'Willkommen', 'Bienvenido');
    $vars['welcome'] = System\Arr::create($words)->shuffle()->first();
    return System\View::home($vars);
});
Beispiel #6
0
 function redirectToRoute($routeName, $param = array())
 {
     $url = baseUrl();
     $routes = System\Route::getAllRoute();
     foreach ($routes as $route) {
         if ($routeName == $route['Name']) {
             $urlPattern = $route['Url'];
             foreach ($param as $key => $value) {
                 $urlPattern = str_replace("{" . $key . "}", $value, $urlPattern);
             }
             echo $urlPattern;
             header("location: " . baseUrl() . $urlPattern);
         }
     }
 }
Beispiel #7
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
define('START_TIME', time());
define('BASE_PATH', __DIR__);
define('APP_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'app');
define('SYSTEM_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'system');
include SYSTEM_PATH . DIRECTORY_SEPARATOR . 'helpers.php';
spl_autoload_register(function ($class) {
    $filePath = __DIR__ . DIRECTORY_SEPARATOR . str_replace('\\', '/', $class) . '.php';
    $filePath = str_replace(['System', 'App'], ['system', 'app'], $filePath);
    if (file_exists($filePath)) {
        include $filePath;
    }
});
System\ErrorHandler::setHandlers();
System\Route::init();