Changeset 18767
- Timestamp:
- 2010/08/02 10:43:51 (14 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:18766
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/class/util/SC_Utils.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Futil%2FSC_Utils.php
test/TestSuite.php 15114@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Ftest%2FTestSuite.php
test/class/util util-20100802013951-87mspb4qllp7hwwu-1
test/class/util/SC_Utils_Test.php sc_utils_test.php-20100802013957-750m2yralg9cowkd-1
test/class/util/Util_AllTests.php util_alltests.php-20100802013957-750m2yralg9cowkd-2- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20100802014347-0nmgk10iml8gzru5
- bzr:revno:
- 2250
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:text-parents:
data/class/util/SC_Utils.php ohkouchi@loop-az.jp-20100623032937-dhwktuevjyk0jv13
test/TestSuite.php ohkouchi@loop-az.jp-20100726081655-tqxqwy02bxqhswcu- bzr:timestamp:
- 2010-08-02 10:43:47.825999975 +0900
- bzr:user-agent:
- bzr2.1.2+bzr-svn1.0.2
- svn:original-date:
- 2010-08-02T01:43:47.826000Z
- Location:
- branches/version-2_5-dev
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/util/SC_Utils.php
r18743 r18767 105 105 function searchInstallerPath($path) { 106 106 $installer = 'install/index.php'; 107 108 if (SC_Utils::sfIsHTTPS()) { 109 $proto = "https://"; 110 } else { 111 $proto = "http://"; 112 } 113 $host = $proto . $_SERVER['SERVER_NAME']; 107 114 if ($path == '/') { 108 return $ path . $installer;115 return $host . $path . $installer; 109 116 } 110 117 if (substr($path, -1, 1) != '/') { 111 118 $path .= $path . '/'; 112 119 } 113 if (SC_Utils::sfIsHTTPS()) { 114 $proto = "https://"; 115 } else { 116 $proto = "http://"; 117 } 118 $installer_url = $proto . $_SERVER['SERVER_NAME'] . $path . $installer; 119 $resources = fopen($installer_url, 'r'); 120 $installer_url = $host . $path . $installer; 121 $resources = fopen(SC_Utils::getRealURL($installer_url), 'r'); 120 122 if ($resources === false) { 121 123 $installer_url = SC_Utils::searchInstallerPath($path . '../'); 122 124 } 123 125 return $installer_url; 126 } 127 128 /** 129 * 相対パスで記述された URL から絶対パスの URL を取得する. 130 * 131 * この関数は, http(s):// から始まる URL を解析し, 相対パスで記述されていた 132 * 場合, 絶対パスに変換して返す 133 * 134 * 例) 135 * http://www.example.jp/aaa/../index.php 136 * ↓ 137 * http://www.example.jp/index.php 138 * 139 * @param string $url http(s):// から始まる URL 140 * @return string $url を絶対パスに変換した URL 141 */ 142 function getRealURL($url) { 143 $parse = parse_url($url); 144 $tmp = split('/', $parse['path']); 145 $results = array(); 146 foreach ($tmp as $v) { 147 if ($v == '' || $v == '.') { 148 // queit. 149 } elseif ($v == '..') { 150 array_pop($results); 151 } else { 152 array_push($results, $v); 153 } 154 } 155 156 $path = join('/', $results); 157 return $parse['scheme'] . '://' . $parse['host'] . '/' . $path; 124 158 } 125 159 -
branches/version-2_5-dev/test/TestSuite.php
r18763 r18767 27 27 require_once(realpath(dirname(__FILE__)) . "/class/db/DB_AllTests.php"); 28 28 require_once(realpath(dirname(__FILE__)) . "/class/helper/Helper_AllTests.php"); 29 require_once(realpath(dirname(__FILE__)) . "/class/util/Util_AllTests.php"); 29 30 30 31 /** … … 41 42 $suite->addTest(DB_AllTests::suite()); 42 43 $suite->addTest(Helper_AllTests::suite()); 44 $suite->addTest(Util_AllTests::suite()); 43 45 return $suite; 44 46 }
Note: See TracChangeset
for help on using the changeset viewer.