Changeset 7016

Show
Ignore:
Timestamp:
11/18/08 18:04:00 (7 weeks ago)
Author:
inureyes
Message:

refs #777

  • 경로 판단 루틴을 정상적으로 동작하도록 수정
  • 아직 정상적은 아닌듯?
Location:
trunk/library
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/library/context.php

    r7011 r7016  
    3131            $_SERVER['REQUEST_URI'] = urldecode($_SERVER['HTTP_X_REWRITE_URL']); 
    3232        } 
     33        /* Retrieve Access Parameter Information. */ 
    3334        $accessInfo = array( 
    3435            'host'      => $_SERVER['HTTP_HOST'], 
    3536            'fullpath' => str_replace('index.php', '', $_SERVER["REQUEST_URI"]), // SUGGEST: change the name 'fullpath' to 'fullQuery' 
    3637            'position'  => $_SERVER["SCRIPT_NAME"], 
    37             'root'      => rtrim(str_replace('rewrite.php', '', $_SERVER["SCRIPT_NAME"]), 'index.php') 
     38            'root'      => rtrim(str_replace('dispatcher.php', '', $_SERVER["SCRIPT_NAME"]), 'index.php') 
    3839            ); 
     40        if (strpos($accessInfo['fullpath'],$accessInfo['root']) !== 0) 
     41            $accessInfo['fullpath'] = $accessInfo['root'].substr($accessInfo['fullpath'], strlen($accessInfo['root']) - 1); 
    3942        // Workaround for compartibility with fastCGI / Other environment 
    4043        $accessInfo['input'] = ltrim(substr($accessInfo['fullpath'], 
    4144            strlen($accessInfo['root']) + (defined('__TEXTCUBE_NO_FANCY_URL__') ? 1 : 0)),'/'); 
    4245        // DEPRECATE?: Support for Tattertools 0.9x legacy address 
    43          
    44         $accessInfo['URLfragment'] = explode('/',strtok($accessInfo['input'],'?')); 
    45         if (defined('__TEXTCUBE_NO_FANCY_URL__')) 
     46    $part = strtok($accessInfo['input'], '/'); 
     47    if (in_array($part, array('resources','plugins','cache','skin','attach','thumbnail'))) { 
     48        $part = ltrim(rtrim($part == 'thumbnail' ? 
     49              preg_replace('/thumbnail/', 'cache/thumbnail', $accessInfo['input'], 1) : 
     50              $accessInfo['input']), '/'); 
     51        $part = (($qpos = strpos($part, '?')) !== false) ? substr($part, 0, $qpos) : $part; 
     52        if(file_exists($part)) { 
     53            require_once ROOT.'/library/function/file.php'; 
     54            dumpWithEtag($part); 
     55            exit; 
     56        } else { 
     57            header("HTTP/1.0 404 Not Found");exit; 
     58        } 
     59    } 
     60    if (strtok($part, '?') == 'setup.php') {require 'setup.php'; exit;} 
     61    $accessInfo['URLfragment'] = explode('/',strtok($accessInfo['input'],'?')); 
     62    unset($part); 
     63 
     64        /* Determine that which interface should be loaded. */ 
     65        if (defined('__TEXTCUBE_NO_FANCY_URL__'))  
    4666            $config->service['type'] = 'single'; 
    4767        switch ($config->service['type']) { 
     
    6282        } 
    6383        $pathPart = strtok($pathPart,'&'); 
     84        /* Load interface. */ 
    6485        $interfacePath = null; 
    6586        if (in_array($pathPart, array('favicon.ico','index.gif'))) { 
     
    88109            $accessInfo['interfacePath'] = $interfacePath; 
    89110        } 
    90  
    91111        // TODO: Add these to debug-mode output 
    92112        //echo "<b>\$accessInfo : </b>"; 
     
    97117 
    98118        // TODO: Parse $_GET, $_POST, and etc./ 
    99         if(isset($accessInfo['URLfragment'][0]) && $accessInfo['URLfragment'][0] == 'owner') $this->mode = 'owner'; 
    100         else $this->mode = 'blog'; 
    101119        $this->accessInfo = $accessInfo; 
    102120    } 
  • trunk/library/loader.php

    r7015 r7016  
    6161        if (in_array($name,array('DBQuery'))) { 
    6262            require_once(ROOT . "/library/data/".$config->backend_name."/Adapter.php"); 
     63            require_once(ROOT . "/library/data/Database.php"); 
    6364        } else if(self::$relation[$name] == 'session' && isset($service['memcached']) && $service['memcached'] == true) { 
    6465            require_once(ROOT . "/library/session/Session_Memcached.php"); 
  • trunk/library/suri.php

    r7013 r7016  
    33/// All rights reserved. Licensed under the GPL. 
    44/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT) 
    5  
    65if(isset($context)) {$url = $context->accessInfo['fullpath'];}  
    76else { $url = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['SCRIPT_NAME'];}