public function __construct() { parent::__construct(); //设置此页面的过期时间(用格林威治时间表示),只要是已经过去的日期即可。 header("Expires: Mon, 26 Jul 1970 05:00:00 GMT"); //设置此页面的最后更新日期(用格林威治时间表示)为当天,可以强制浏览器获取最新资料 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //告诉客户端浏览器不使用缓存,HTTP 1.1 协议 header("Cache-Control: no-cache, must-revalidate"); //告诉客户端浏览器不使用缓存,兼容HTTP 1.0 协议 header("Pragma: no-cache"); //验证后台登录权限 if (!$this->checkAdminAccess()) { $this->error("没有操作权限"); } }
$requestUri = substr($requestUri, 0, -1); } // detect and set baseUrl if not specified in configuration yet if ($configuration['baseUrl'] == NULL) { if (php_sapi_name() == 'cli') { $configuration['baseUrl'] = '/'; } else { $configuration['baseUrl'] = (isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'; if ($scriptInfo['dirname'] != DIRECTORY_SEPARATOR && !strpos($configuration['baseUrl'], $scriptInfo['dirname'])) { $configuration['baseUrl'] .= str_replace('\\', '/', $scriptInfo['dirname']) . '/'; } } } // define default action and controller $methodName = 'indexAction'; $controller = new AddonController(); // check for action requested via URL if (strlen($requestUri) && $requestUri != 'index.php') { $pathSegments = explode('/', $requestUri); $controller->setArguments(array_slice($pathSegments, 1)); $methodName = strtolower($pathSegments[0]) . 'Action'; #$page->addRootlineItem(array( 'url' => $pathSegments[0] . '/', 'name' => ucfirst($pathSegments[0]))); } // only proceed if action exists, else throw a 404 if (method_exists($controller, $methodName)) { $content = $controller->{$methodName}(); $content .= getDisclaimer(); } else { header('HTTP/1.0 404 Not Found'); $content = renderFlashMessage('Page not found', 'We\'re sorry, but the desired page could not be found.', 'error'); }