예제 #1
0
파일: Rewrite.php 프로젝트: AllenLyu/ko
 public static function AGet($sUrl = '')
 {
     if (!isset(self::$s_aResults[$sUrl])) {
         if ('' === $sUrl) {
             $host = Ko_Web_Request::SHttpHost();
             $uri = Ko_Web_Request::SRequestUri();
         } else {
             $info = parse_url($sUrl);
             $host = isset($info['port']) ? $info['host'] . ':' . $info['port'] : $info['host'];
             $uri = isset($info['query']) ? $info['path'] . '?' . $info['query'] : $info['path'];
         }
         self::$s_aResults[$sUrl] = self::_AGet($host, $uri);
     }
     return self::$s_aResults[$sUrl];
 }
예제 #2
0
파일: Config.php 프로젝트: AllenLyu/ko
 /**
  * @return self
  */
 private static function _OGetConfig($host, &$uri)
 {
     if (is_null($host)) {
         $host = Ko_Web_Request::SHttpHost();
     }
     if (is_null($uri)) {
         $uri = Ko_Web_Request::SRequestUri();
     }
     if (false === strpos($uri, '?')) {
         $path = $uri;
         $query = '';
     } else {
         list($path, $query) = explode('?', $uri, 2);
         $query = '?' . $query;
     }
     $key = $host . $path;
     if (!isset(self::$s_aConfigCache[$key])) {
         $path = rtrim($key, '/');
         $succ = false;
         while (false !== ($pos = strrpos($path, '/'))) {
             if ($succ = self::_BLoadConfig($key, $path, false)) {
                 break;
             }
             $path = rtrim(substr($path, 0, $pos), '/');
         }
         if (!$succ) {
             self::_BLoadConfig($key, $path, true);
         }
         $rewriteuri = substr($key, strlen($path));
         if (0 === strlen($rewriteuri)) {
             $rewriteuri = '/';
         }
         self::$s_aConfigCache[$key]->_sRewriteUri = $rewriteuri . $query;
     }
     $uri = self::$s_aConfigCache[$key]->_sRewriteUri;
     return self::$s_aConfigCache[$key];
 }
예제 #3
0
파일: entry.php 프로젝트: firaga/operation
            $loginuid = $loginApi->iGetLoginUid();
            if (empty($loginuid)) {
                Ko_Web_Response::VSetRedirect('http://' . PASSPORT_DOMAIN . '/user/login');
                Ko_Web_Response::VSend();
                exit;
            }
        }
    }
    $hooks = COMMON_CLASS_PATH . 'hooks/' . $appname . '.php';
    if (is_file($hooks)) {
        require_once $hooks;
    }
});
Ko_Web_Event::On('ko.error', '500', function ($errno, $errstr, $errfile, $errline, $errcontext) {
    Ko_Web_Error::V500($errno, $errstr, $errfile, $errline, $errcontext);
    exit;
});
Ko_Web_Event::On('ko.dispatch', 'before', function () {
    Ko_Tool_Adapter::VOn('user_baseinfo', array('KUser_baseinfoApi', 'AAdapter'));
    Ko_Tool_Adapter::VOn('image_baseinfo', array('KStorage_Api', 'AAdapter'));
    $uri = Ko_Web_Request::SRequestUri();
    $appname = Ko_Web_Config::SGetAppName();
    if ('zc' === $appname) {
        $_GET['uid'] = 20;
    }
});
Ko_Web_Event::On('ko.dispatch', '404', function () {
    Ko_Web_Route::V404();
    exit;
});
require_once KO_DIR . 'web/Bootstrap.php';