Changeset 18709 for branches/version-2_4-dev
- Timestamp:
- 2010/06/18 14:29:15 (14 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_4-dev:18708
- 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- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20100618052912-gztbuqqknhvrm350
- bzr:revno:
- 1974
- bzr:revprop:branch-nick:
- branches/version-2_4-dev
- bzr:root:
- branches/version-2_4-dev
- bzr:text-parents:
data/class/util/SC_Utils.php ohkouchi@loop-az.jp-20100614081324-0g78bhcmvqs3d6ts- bzr:timestamp:
- 2010-06-18 14:29:12.444000006 +0900
- bzr:user-agent:
- bzr2.1.1+bzr-svn1.0.2
- svn:original-date:
- 2010-06-18T05:29:12.444000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_4-dev/data/class/util/SC_Utils.php
r18699 r18709 110 110 function searchInstallerPath($path) { 111 111 $installer = 'install/index.php'; 112 113 if (SC_Utils::sfIsHTTPS()) { 114 $proto = "https://"; 115 } else { 116 $proto = "http://"; 117 } 118 $host = $proto . $_SERVER['SERVER_NAME']; 112 119 if ($path == '/') { 113 return $ path . $installer;120 return $host . $path . $installer; 114 121 } 115 122 if (substr($path, -1, 1) != '/') { 116 123 $path .= $path . '/'; 117 124 } 118 if (SC_Utils::sfIsHTTPS()) { 119 $proto = "https://"; 120 } else { 121 $proto = "http://"; 122 } 123 $installer_url = $proto . $_SERVER['SERVER_NAME'] . $path . $installer; 124 $resources = fopen($installer_url, 'r'); 125 $installer_url = $host . $path . $installer; 126 $resources = fopen(SC_Utils::getRealURL($installer_url), 'r'); 125 127 if ($resources === false) { 126 128 $installer_url = SC_Utils::searchInstallerPath($path . '../'); 127 129 } 128 130 return $installer_url; 131 } 132 133 /** 134 * 相対パスで記述された URL から絶対パスの URL を取得する. 135 * 136 * この関数は, http(s):// から始まる URL を解析し, 相対パスで記述されていた 137 * 場合, 絶対パスに変換して返す 138 * 139 * 例) 140 * http://www.example.jp/aaa/../index.php 141 * ↓ 142 * http://www.example.jp/index.php 143 * 144 * @param string $url http(s):// から始まる URL 145 * @return string $url を絶対パスに変換した URL 146 */ 147 function getRealURL($url) { 148 $parse = parse_url($url); 149 $tmp = split('/', $parse['path']); 150 $results = array(); 151 foreach ($tmp as $v) { 152 if ($v == '' || $v == '.') { 153 // queit. 154 } elseif ($v == '..') { 155 array_pop($results); 156 } else { 157 array_push($results, $v); 158 } 159 } 160 161 $path = join('/', $results); 162 return $parse['scheme'] . '://' . $parse['host'] . '/' . $path; 129 163 } 130 164
Note: See TracChangeset
for help on using the changeset viewer.