Exemplo n.º 1
0
 public function shopCore()
 {
     parent::kernel();
     $this->db = $this->database();
     global $switcher;
     if (isset($_GET['_test_rewrite'])) {
         echo "[*[" . md5($_GET['s']) . "]*]";
         exit;
     } else {
         if (defined("MODE_SWITCHER")) {
             $mode_switcher = MODE_SWITCHER;
             require_once PLUGIN_DIR . "/functions/" . $switcher . ".php";
             $switcher = new $mode_switcher();
             if (!$switcher->test()) {
                 header("Content-type: text/html;charset=utf-8", true, 503);
                 readfile(HOME_DIR . "/notice.html");
             }
         } else {
             if (file_exists(HOME_DIR . "/notice.html")) {
                 header("Content-type: text/html;charset=utf-8", true, 503);
                 readfile(HOME_DIR . "/notice.html");
                 exit;
             }
         }
     }
     //        if (file_exists(BASE_DIR . "/upgrade.php")) {
     //            header("HTTP/1.1 503 Service Unavailable", true, 503);
     //            require(CORE_DIR . "/func_ext.php");
     //            $smarty =& $this->loadModel("system/frontend");
     //            $smarty->display("shop:common/upgrade.html");
     //        } else
     if ($_POST['api_url'] == "time_auth") {
         require CORE_INCLUDE_DIR . "/shop/core.time_auth.php";
         core_time_auth($this);
     } else {
         $this->run();
     }
 }
Exemplo n.º 2
0
 function adminCore()
 {
     define('PHP_SELF', dirname($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']));
     parent::kernel();
     if (file_exists(BASE_DIR . '/upgrade.php')) {
         $upgrade = $this->loadModel('system/upgrade');
         $upgrade->exec($_GET['act']);
     } elseif ($_POST['api_url'] == 'time_auth') {
         header("Content-type:text/html;charset=utf-8");
         $this->shopex_auth = $this->loadModel('service/certificate');
         if ($this->shopex_auth->check_api()) {
             require CORE_INCLUDE_DIR . '/shop/core.time_auth.php';
             core_time_auth($this);
             exit;
         }
     } else {
         define('__ADMIN__', 'admin');
         require 'adminPage.php';
         $mod = $_GET['ctl'] ? $_GET['ctl'] : 'default';
         $act = $_GET['act'] ? $_GET['act'] : 'index';
         $this->request = array('action' => array('controller' => $mod, 'method' => $act));
         $this->request['action']['ident'] = strtolower('admin:' . $this->request['action']['controller'] . ':' . $this->request['action']['method']);
         $this->db =& $this->database();
         $this->__session_start();
         if ($_POST['_DTYPE_DATE']) {
             foreach ($_POST['_DTYPE_DATE'] as $k) {
                 $_POST[$k] = empty($_POST[$k]) ? $_POST[$k] : strtotime($_POST[$k]);
                 //php4和php5对strtotime('')的行为不一致,所以加判断
             }
             $_POST['_DTYPE_DATE'] = null;
             unset($_POST['_DTYPE_DATE']);
         }
         if ($_POST['_DTYPE_BOOL']) {
             foreach ($_POST['_DTYPE_BOOL'] as $k) {
                 $_POST[$k] = $_POST[$k] != 'false';
             }
             $_POST['_DTYPE_BOOL'] = null;
             unset($_POST['_DTYPE_BOOL']);
         }
         if ($_POST['_DTYPE_TIME']) {
             foreach ($_POST['_DTYPE_TIME'] as $k) {
                 if ($_POST[$k]) {
                     $_POST[$k] = empty($_POST[$k]) ? $_POST[$k] : strtotime($_POST[$k]);
                     //php4和php5对strtotime('')的行为不一致,所以加判断
                     if (isset($_POST['_DTIME_']['H'][$k])) {
                         $_POST[$k] += $_POST['_DTIME_']['H'][$k] * 3600 + $_POST['_DTIME_']['M'][$k] * 60;
                     }
                 }
                 unset($_POST['_DTIME_']['H'][$k], $_POST['_DTIME_']['M'][$k]);
             }
             $_POST['_DTYPE_TIME'] = null;
             unset($_POST['_DTYPE_TIME']);
         }
         /*            foreach($_POST['_DTIME_']['H'] as $t=>$h){
                         $_POST[$k] .= $h.':'.$_POST['_DTIME_']['M'][$t];
                     }*/
         unset($_POST['_DTIME_']);
         $controller =& $this->getController($mod);
         $this->ctl =& $controller;
         if (!is_object($controller)) {
             $this->responseCode(404);
             exit;
         }
         if (!$this->callAction($controller, $act, $_GET['p'])) {
             $this->responseCode(404);
             exit;
         }
     }
 }