123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/3/10
- * Time: 下午9:08
- */
- 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 . '/session.php');
- use DFAFilter;
- use area_helper;
- use Log;
- use session;
- use Base;
- use UnloginException;
- use Exception;
- use errcode;
- class MerchantServer extends BaseServer
- {
- static private $stInstance = NULL;
- static public function instance()
- {
- if(self::$stInstance == NULL) {
- self::$stInstance = new MerchantServer();
- }
- return self::$stInstance;
- }
- public function __construct()
- {
- parent::__construct();
- $this->setExFiles([]);
- }
- protected function preLooper()
- {
- parent::preLooper();
- DFAFilter::instance();
- area_helper::instance();
- }
- public function handle_request($file)
- {
- session::instance()->start();
- 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
- {
- Log::record("Can Not call file: {$file}",Log::DEBUG);
- echo "no such file.";
- }
- }
- catch (UnloginException $ex) {
- joutput_error(errcode::ErrUnLogin,errcode::msg(errcode::ErrUnLogin));
- }
- catch (Exception $ex) {
- joutput_error($ex->getCode(),$ex->getMessage());
- Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
- }
- session::instance()->end();
- }
- }
|