44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
require '../config/config.php';
|
|
require '../config/routes.php';
|
|
require 'bootstrap/init.php';
|
|
|
|
if (empty($_REQUEST['c']) || empty($_REQUEST['a'])) {
|
|
die();
|
|
return;
|
|
}
|
|
|
|
function autoload_controller__($classname)
|
|
{
|
|
require_once "controller/$classname.class.php";
|
|
spl_autoload_unregister('autoload_controller__');
|
|
}
|
|
spl_autoload_register('autoload_controller__');
|
|
|
|
try{
|
|
$c = $_REQUEST['c'];
|
|
$a = $_REQUEST['a'];
|
|
if (!empty($gOnlyRoutes) && !getXVal($gOnlyRoutes, $c, null)) {
|
|
die();
|
|
return;
|
|
}
|
|
if (!empty($gExcludeRoutes) && getXVal($gExcludeRoutes, $c, null)) {
|
|
die();
|
|
return;
|
|
}
|
|
$classname = $c .'Controller';
|
|
$beginTick = phpcommon\getTickCount();
|
|
$obj = eval('return new $classname();');
|
|
$method = new ReflectionMethod($classname, $a);
|
|
if ($method && $method->isPublic() &&
|
|
$a[0] != '_' &&
|
|
(!$method->isConstructor() && !$method->isDestructor())) {
|
|
$obj->_handlePre();
|
|
$method->invoke($obj);
|
|
$obj->_handlePost();
|
|
}
|
|
} catch (Exception $e){
|
|
error_log($e);
|
|
}
|