123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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 merchantControl;
- use errcode;
- use session;
- class RAccServer extends BaseServer
- {
- public function __construct($subPath)
- {
- parent::__construct($subPath);
- $exfiles = [
- ];
- $this->setExFiles($exfiles);
- }
- static private $stInstance = NULL;
- static public function instance()
- {
- if(self::$stInstance == NULL) {
- self::$stInstance = new RAccServer('racc');
- }
- return self::$stInstance;
- }
- protected function is_exclude($file)
- {
- $exister = function ($file,$subex)
- {
- $path = BASE_ROOT_PATH . "/" . $this->mSubPath . "/$subex";
- $basename = basename($file);
- $tmp = "$path/$basename";
- return file_exists($tmp);
- };
- $ret = parent::is_exclude($file);
- if ($ret) {
- return true;
- }
- global $config;
- $exclude_dirs = $config['racc_exclude_dirs'];
- foreach ($exclude_dirs as $dir)
- {
- if($exister($file,$dir)) {
- return true;
- }
- }
- return false;
- }
- function handle_req($file)
- {
- try
- {
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- if(file_exists($file))
- {
- if($this->is_exclude($file)) {
- include $file;
- } else {
- Base::mobile_control();
- }
- session::instance()->end(false);
- }
- else
- {
- echo "no such file.";
- }
- }
- catch (UnSignException $ex) {
- merchantControl::outerr(errcode::ErrUnLogin,errcode::msg(errcode::ErrUnLogin));
- }
- catch (Exception $ex) {
- merchantControl::outerr($ex->getCode(),$ex->getMessage());
- Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
- }
- }
- }
|