Changeset 17252


Ignore:
Timestamp:
2008/04/10 20:29:16 (16 years ago)
Author:
satou
Message:

getLocationの修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/eccube-2.1.2/data/class/pages/LC_Page.php

    r17118 r17252  
    213213     * @see Net_URL 
    214214     */ 
    215     function getLocation($path, $param = array(), $useSSL = "escape") { 
    216  
    217         // $path が / で始まっている場合 
    218         if (substr($path, 0, 1) == "/") { 
    219             $realPath = realpath(HTML_PATH . substr_replace($path, "", 0, strlen(URL_DIR))); 
    220         // 相対パスの場合 
    221         } else { 
    222             $realPath = realpath($path); 
    223         } 
    224  
    225         // FIXME OS依存の処理は別クラスに分ける? 
    226         // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 
    227         if (substr(PHP_OS, 0, 3) == 'WIN') { 
    228             $realPath = str_replace("\\", "/", $realPath); 
    229             $htmlPath = str_replace("\\", "/", HTML_PATH); 
    230             $rootPath = str_replace($htmlPath, "", $realPath); 
    231         } else { 
    232             // HTML_PATH を削除した文字列を取得. 
    233             $rootPath = str_replace(HTML_PATH, "", $realPath); 
    234         } 
    235  
     215function getLocation($path, $param = array(), $useSSL = "escape") { 
     216        $rootPath = $this->getRootPath($path); 
    236217 
    237218        // スキーマを定義 
     
    259240    } 
    260241 
     242    function getRootPath($path) { 
     243        // $path が / で始まっている場合 
     244        if (substr($path, 0, 1) == "/") { 
     245            $realPath = realpath(HTML_PATH . substr_replace($path, "", 0, strlen(URL_DIR))); 
     246        // 相対パスの場合 
     247        } else { 
     248            $realPath = realpath($path); 
     249        } 
     250 
     251        // HTML_PATH を削除した文字列を取得. 
     252        // FIXME OS依存の処理は別クラスに分ける? 
     253        // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 
     254        if (substr(PHP_OS, 0, 3) == 'WIN') { 
     255            $realPath = str_replace("\\", "/", $realPath); 
     256            $htmlPath = str_replace("\\", "/", HTML_PATH); 
     257            $rootPath = str_replace($htmlPath, "", $realPath); 
     258        } else { 
     259            $htmlPath = rtrim(HTML_PATH, "/"); 
     260            $rootPath = str_replace($htmlPath, "", $realPath); 
     261            $rootPath = substr_replace($rootPath, "", 0, strlen(URL_DIR)); 
     262        } 
     263         
     264        return $rootPath; 
     265    } 
     266 
    261267    /** 
    262268     * ページをリロードする. 
Note: See TracChangeset for help on using the changeset viewer.