123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- require_once './protected/common.php';
- header("Cache-control: private");
- header("Content-type: text/html; charset=" . DEFAULT_CHARSET);
- $helper = new RouterHelper();
- $className = $helper->getClassName();
- $funcName = $helper->getFunName();
- define('CONTROLLER_NAME', $className);
- define('ACTION_NAME', $funcName);
- $is_ajax = $_GET['_from'] == 'ajax';
- $actionName = "action{$funcName}";
- $helper->genDoc($className, $actionName);
- if (class_exists($className)) {
- $oClass = new $className();
- } else {
- $msg = "class {$className} is not exist.";
- if ($is_ajax) {
- $helper->error($actionName, $msg);
- } else {
- $objBaseController = new BaseController(true);
- $objBaseController->go404();
- }
- }
- if (method_exists($oClass, $actionName)) {
- $args = $_REQUEST;
- $data = $oClass->$actionName($args);
- Response::success($data, null, null, false, true);
- } else {
- $msg = "method {$actionName} is not exist.";
- if ($is_ajax) {
- $helper->error($actionName, $msg);
- } else {
- $objBaseController = new BaseController(true);
- $objBaseController->go404();
- }
- }
|