12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace fcgisrv;
- require_once(BASE_ROOT_PATH . '/helper/area_helper.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
- require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
- require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
- require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
- require_once(BASE_HELPER_PATH . '/refill/util.php');
- require_once(BASE_HELPER_PATH . '/session.php');
- use Log;
- use Base;
- use UnSignException;
- use Exception;
- use errcode;
- class RAccServer extends BaseServer
- {
- public function __construct()
- {
- parent::__construct();
- $exfiles = [];
- $this->setExFiles($exfiles);
- }
- static private $stInstance = NULL;
- static public function instance()
- {
- if(self::$stInstance == NULL) {
- self::$stInstance = new RAccServer();
- }
- return self::$stInstance;
- }
- protected function is_exclude($file)
- {
- $exister = function ($file, $subex)
- {
- $path = BASE_PATH . $subex;
- $dir = dirname($file);
- return ($path == $dir);
- };
- $ret = parent::is_exclude($file);
- if ($ret) {
- return true;
- }
- global $config;
- $exclude_dirs = $config['access_include_dirs'];
- foreach ($exclude_dirs as $dir)
- {
- if($exister($file,$dir)) {
- return true;
- }
- }
- return false;
- }
- function handle_request($file)
- {
- try
- {
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- if(file_exists($file))
- {
- if ($this->isIndex($file)) {
- Base::mobile_control();
- } elseif ($this->is_exclude($file)) {
- include $file;
- } else {
- echo "You cannot access this file.";
- }
- }
- else
- {
- echo "no such file.";
- }
- }
- catch (UnSignException $ex) {
- joutput_error(errcode::ErrSignParamter,errcode::msg(errcode::ErrSignParamter));
- }
- catch (Exception $ex) {
- joutput_error($ex->getCode(),'异常错误');
- Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}", Log::ERR);
- }
- }
- }
|