Changeset 15213 for branches


Ignore:
Timestamp:
2007/08/06 14:34:07 (17 years ago)
Author:
nanasess
Message:

LC_Page::getLocation() の $path が絶対パスの場合に対応

Location:
branches/feature-module-update
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/pages/LC_Page.php

    r15210 r15213  
    194194            } 
    195195        } 
     196 
     197        // $path が / で始まっている場合 
     198        if (substr($path, 0, 1) == "/") { 
     199            $realPath = realpath(HTML_PATH . substr_replace($path, "", 0, 1)); 
     200        } else { 
     201            // 相対パスの場合 
     202            $realPath = realpath($path); 
     203        } 
     204 
    196205        // DocumentRoot を削除した文字列を取得. 
    197         $root = str_replace($documentRoot, "", realpath($path)); 
     206        $root = str_replace($documentRoot, "", $realPath); 
    198207        // 先頭の / を削除 
    199208        $root = substr_replace($root, "", 0, 1); 
    200  
    201209        if ($useSSL) { 
    202210            $url = SSL_URL . $root; 
  • branches/feature-module-update/test/class/page/LC_Page_Test.php

    r15118 r15213  
    126126     * LC_Page::getLocation() のテストケース. 
    127127     * 
     128     * 絶対パス 
     129     */ 
     130    function testGetLocationWithFullPath() { 
     131        $objPage = new LC_Page(); 
     132        $_SERVER['DOCUMENT_ROOT'] = realpath("../html"); 
     133        $url = $objPage->getLocation("/abouts/index.php"); 
     134 
     135        $this->assertEquals(SITE_URL . "abouts/index.php", $url); 
     136        unset($_SERVER['DOCUMENT_ROOT']); 
     137    } 
     138 
     139    /** 
     140     * LC_Page::getLocation() のテストケース. 
     141     * 
    128142     * QueryString 付与 
    129143     */ 
Note: See TracChangeset for help on using the changeset viewer.