Ignore:
Timestamp:
2009/06/15 13:41:35 (15 years ago)
Author:
Seasoft
Message:

#448(DoCoMo? 実機にてカートインで 301 アラート)を改修。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/LC_Page.php

    r18018 r18103  
    243243    } 
    244244 
     245    /** 
     246     * EC-CUBE のWEBルート(/html/)を / としたパスを返す 
     247     * 
     248     * @param string $path 結果を取得するためのパス 
     249     * @return string EC-CUBE のWEBルート(/html/)を / としたパス 
     250     */ 
    245251    function getRootPath($path) { 
     252        // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 
     253        $path = str_replace('\\', '/', $path); 
     254        $htmlPath = str_replace('\\', '/', HTML_PATH); 
     255         
    246256        // $path が / で始まっている場合 
    247         if (substr($path, 0, 1) == "/") { 
    248             $realPath = realpath(HTML_PATH . substr_replace($path, "", 0, strlen(URL_DIR))); 
     257        if (substr($path, 0, 1) == '/') { 
     258            $realPath = realpath($htmlPath . substr_replace($path, '', 0, strlen(URL_DIR))); 
    249259        // 相対パスの場合 
    250260        } else { 
    251261            $realPath = realpath($path); 
    252262        } 
    253  
     263        $realPath = str_replace('\\', '/', $realPath); 
     264         
     265        // $path が / で終わっている場合、realpath によって削られた末尾の / を復元する。 
     266        if (substr($path, -1, 1) == '/' && substr($realPath, -1, 1) != '/') { 
     267            $realPath .= '/'; 
     268        } 
     269         
    254270        // HTML_PATH を削除した文字列を取得. 
    255         // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 
    256         $realPath = str_replace("\\", "/", $realPath); 
    257         $htmlPath = str_replace("\\", "/", HTML_PATH); 
    258  
    259         $htmlPath = rtrim($htmlPath, "/"); 
    260         $rootPath = str_replace($htmlPath, "", $realPath); 
    261         $rootPath = ltrim($rootPath, "/"); 
    262          
     271        $rootPath = str_replace($htmlPath, '', $realPath); 
     272        $rootPath = ltrim($rootPath, '/'); 
     273 
    263274        return $rootPath; 
    264275    } 
Note: See TracChangeset for help on using the changeset viewer.