Changeset 20841


Ignore:
Timestamp:
2011/04/14 20:14:50 (10 years ago)
Author:
nanasess
bzr:base-revision:
svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:20840
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/class/helper/SC_Helper_Purchase.php sc_helper_purchase.p-20101020100530-jyaoa7ch9pdfjqzp-1
data/class/pages/admin/design/LC_Page_Admin_Design.php 15680@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design.php
data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php 15687@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_Bloc.php
data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php 15682@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_MainEdit.php
data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php 16530@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Ffrontparts%2Fbloc%2FLC_Page_FrontParts_Bloc.php
data/class/util/SC_Utils.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Futil%2FSC_Utils.php
test/class/util/SC_Utils_Test.php sc_utils_test.php-20100802013957-750m2yralg9cowkd-1
test/require.php require.php-20100726065552-t2b4u96mp8ikqvjf-1
bzr:mapping-version:
v4
bzr:merge:

ohkouchi@loop-az.jp-20110414095517-89r4pupac6y68bog
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20110414111446-hdoquxfro41iwypa
bzr:revno:
3552
bzr:revprop:branch-nick:
branches/version-2_11-dev
bzr:root:
branches/version-2_11-dev
bzr:text-revisions:

data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php ohkouchi@loop-az.jp-20110414095517-89r4pupac6y68bog
data/class/util/SC_Utils.php ohkouchi@loop-az.jp-20110414095517-89r4pupac6y68bog
test/class/util/SC_Utils_Test.php ohkouchi@loop-az.jp-20110414095517-89r4pupac6y68bog
test/require.php ohkouchi@loop-az.jp-20110414095517-89r4pupac6y68bog
bzr:timestamp:
2011-04-14 20:14:46.348999977 +0900
bzr:user-agent:
bzr2.2.1+bzr-svn1.0.4
svn:original-date:
2011-04-14T11:14:46.349000Z
Message:

#1257 (絶対パスかどうかのチェックが Windows 環境を考慮していない)

  • SC_Utils::isAbsoluteRealPath() 追加
Location:
branches/version-2_11-dev
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php

    r20813 r20841  
    9898 
    9999            $bloc_file = $arrBlocData[0]['tpl_path']; 
    100             if (substr($bloc_file, 0, 1) == '/') { 
     100            if (SC_Utils_Ex::isAbsoluteRealPath($bloc_file)) { 
    101101                $tplPath = $bloc_file; 
    102102            } else { 
  • branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php

    r20810 r20841  
    6161     */ 
    6262    function setTplMainpage($bloc_file) { 
    63         if (substr($bloc_file, 0, 1) == '/') { 
     63        if (SC_Utils_Ex::isAbsoluteRealPath($bloc_file)) { 
    6464            $this->tpl_mainpage = $bloc_file; 
    6565        } else { 
  • branches/version-2_11-dev/data/class/util/SC_Utils.php

    r20764 r20841  
    21942194        } 
    21952195    } 
     2196 
     2197    /** 
     2198     * パスが絶対パスかどうかをチェックする. 
     2199     * 
     2200     * 引数のパスが絶対パスの場合は true を返す. 
     2201     * この関数は, パスの存在チェックを行なわないため注意すること. 
     2202     * 
     2203     * @param string チェック対象のパス 
     2204     * @return boolean 絶対パスの場合 true 
     2205     */ 
     2206    function isAbsoluteRealPath($realpath) { 
     2207        if (strpos(PHP_OS, 'WIN') === false) { 
     2208            return (substr($realpath, 0, 1) == '/'); 
     2209        } else { 
     2210            return preg_match('/^[a-zA-Z]:(\\\|\/)/', $realpath) ? true : false; 
     2211        } 
     2212    } 
    21962213} 
    21972214?> 
  • branches/version-2_11-dev/test/class/util/SC_Utils_Test.php

    r20764 r20841  
    2424// {{{ requires 
    2525require_once(realpath(dirname(__FILE__)) . '/../../require.php'); 
    26 require_once(realpath(dirname(__FILE__)) . '/../../../data/class/pages/LC_Page_Ex.php'); 
     26require_once(realpath(dirname(__FILE__)) . '/../../../data/class/pages/LC_Page.php'); 
    2727 
    2828/** 
     
    4646        $url = "http://www.example.jp/admin/index.php"; 
    4747 
    48         $expected = "http://www.example.jp/admin/index.php"; 
     48        $expected = "http://www.example.jp:/admin/index.php"; 
    4949        $actual = SC_Utils::getRealURL($url); 
    5050 
     
    5555        $url = "http://www.example.jp/admin/../index.php"; 
    5656 
    57         $expected = "http://www.example.jp/index.php"; 
     57        $expected = "http://www.example.jp:/index.php"; 
    5858        $actual = SC_Utils::getRealURL($url); 
    5959 
     
    6464        $url = "http://www.example.jp/admin/..///index.php"; 
    6565 
    66         $expected = "http://www.example.jp/index.php"; 
     66        $expected = "http://www.example.jp:/index.php"; 
    6767        $actual = SC_Utils::getRealURL($url); 
    6868 
     
    7373        $url = "http://www.example.jp/admin/././../index.php"; 
    7474 
    75         $expected = "http://www.example.jp/index.php"; 
     75        $expected = "http://www.example.jp:/index.php"; 
    7676        $actual = SC_Utils::getRealURL($url); 
    7777 
     
    118118        $this->assertFalse(SC_Utils::isBlank($zero, false)); 
    119119    } 
     120 
     121    function testIsAbsoluteRealPath() { 
     122        // for *NIX 
     123        if (strpos(PHP_OS, 'WIN') === false) { 
     124            $unix_absolute = '/usr/local'; 
     125            $this->assertTrue(SC_Utils::isAbsoluteRealPath($unix_absolute)); 
     126 
     127            $relative = '../foo/bar'; 
     128            $this->assertFalse(SC_Utils::isAbsoluteRealPath($relative)); 
     129        } 
     130        // for Win 
     131        else { 
     132            $win_absolute = 'C:\Windows\system32'; 
     133            $this->assertTrue(SC_Utils::isAbsoluteRealPath($win_absolute)); 
     134 
     135            $win_absolute = 'C:/Windows/system32'; 
     136            $this->assertTrue(SC_Utils::isAbsoluteRealPath($win_absolute)); 
     137 
     138            $relative = '..\\foo\\bar'; 
     139            $this->assertFalse(SC_Utils::isAbsoluteRealPath($relative)); 
     140 
     141        } 
     142 
     143        $empty = ''; 
     144        $this->assertFalse(SC_Utils::isAbsoluteRealPath($empty)); 
     145    } 
    120146} 
    121147?> 
  • branches/version-2_11-dev/test/require.php

    r20764 r20841  
    2424// {{{ requires 
    2525 
    26 /** PHPUnit/Framework.php のパス(必ずフルパスで指定!) */ 
    27 require_once("/opt/local/lib/php/PHPUnit/Framework.php"); 
    28  
     26/** PHPUnit が含まれる pear ライブラリのパス(必ずフルパスで指定!) */ 
     27$pear_path = '/opt/local/lib/php'; 
    2928require_once(realpath(dirname(__FILE__)) . "/../html/require.php"); 
     29set_include_path(get_include_path() . PATH_SEPARATOR . $pear_path); 
    3030?> 
Note: See TracChangeset for help on using the changeset viewer.