Changeset 23018
- Timestamp:
- 2013/08/01 01:16:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/pages/LC_Page.php
r22931 r23018 292 292 * 293 293 * @param string $path 結果を取得するためのパス 294 * @return string EC-CUBE のWEBルート(/html/) を / としたパス294 * @return string EC-CUBE のWEBルート(/html/)からのパス。 295 295 */ 296 296 function getRootPath($path) 297 297 { 298 // realpath 関数は、QUERY_STRING を扱えないため、退避する。 299 $query_string = ''; 300 if (preg_match('/^(.+)\\?(.+)$/', $path, $arrMatch)) { 301 $path = $arrMatch[1]; 302 $query_string = $arrMatch[2]; 303 } 304 298 305 // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 299 306 $path = str_replace('\\', '/', $path); … … 312 319 $realPath = realpath($path); 313 320 } 321 if ($realPath === false) { 322 trigger_error('realpath でエラー発生。', E_USER_ERROR); 323 } 314 324 $realPath = str_replace('\\', '/', $realPath); 315 325 … … 320 330 321 331 // HTML_REALDIR を削除した文字列を取得. 322 $rootPath = str_replace($htmlPath, '', $realPath); 323 $rootPath = ltrim($rootPath, '/'); 332 if (substr($realPath, 0, strlen($htmlPath)) !== $htmlPath) { 333 trigger_error('不整合', E_USER_ERROR); 334 } 335 $rootPath = substr($realPath, strlen($htmlPath)); 336 337 // QUERY_STRING を復元する。 338 if (strlen($query_string) >= 1) { 339 $rootPath .= '?' . $query_string; 340 } 324 341 325 342 return $rootPath;
Note: See TracChangeset
for help on using the changeset viewer.