Changeset 18676 for branches/version-2_4-dev
- Timestamp:
- 2010/06/07 20:38:12 (13 years ago)
- bzr:base-revision:
- ohkouchi@loop-az.jp-20100607063506-7aygam8pu7925183
- 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-20100607113809-a2ooznl16n2ko77e
- bzr:revno:
- 1952
- bzr:revprop:branch-nick:
- branches/version-2_4-dev
- bzr:root:
- branches/version-2_4-dev
- bzr:timestamp:
- 2010-06-07 20:38:09.693000078 +0900
- bzr:user-agent:
- bzr2.1.1+bzr-svn1.0.2
- svn:original-date:
- 2010-06-07T11:38:09.693000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_4-dev/data/class/util/SC_Utils.php
r18674 r18676 81 81 // インストールが完了していない時 82 82 if( !defined('ECCUBE_INSTALL') ) { 83 if( !ereg('/install/', $_SERVER['PHP_SELF']) ) { 83 $phpself = $_SERVER['PHP_SELF']; 84 if( !ereg('/install/', $phpself) ) { 84 85 // インストールページに遷移させる 85 86 // ここから2つ上はdataディレクトリ 87 $eccube_data_dir = realpath(dirname(__FILE__) . '/../../'); 88 // dataディレクトリとDATA_DIR2HTMLからhtmlディレクトリを取得。 89 $eccube_html_dir = realpath($eccube_data_dir . '/' . DATA_DIR2HTML); 90 // htmlディレクトリとDOCUMENT_ROOTの相対パスがURL_DIR 91 $document_root = realpath($_SERVER['DOCUMENT_ROOT']); 92 $url_dir = str_replace($document_root, '', $eccube_html_dir); 93 94 // installページへのURLを生成。 95 // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 96 $url_dir = str_replace("\\", "/", $url_dir); 97 // 先頭が'/'でない場合は'/'を付与。(php4,5のrealpathの挙動の違いによる) 98 if (substr($url_dir, 0, 1) != '/') { 99 $url_dir = '/' . $url_dir; 100 } 101 // 最後が'/'でない場合は'/'を付与。 102 if (substr($url_dir, -1) != '/') { 103 $url_dir .= '/'; 104 } 105 $location = $url_dir . 'install/index.php'; 106 107 header('Location: ' . $location); 86 $path = substr($phpself, 0, strpos($phpself, basename($phpself))); 87 $install_url = SC_Utils::searchInstallerPath($path); 88 header('Location: ' . $install_url); 108 89 exit; 109 90 } … … 114 95 } 115 96 } 97 } 98 99 /** 100 * インストーラのパスを検索し, URL を返す. 101 * 102 * $path と同階層に install/index.php があるか検索する. 103 * 存在しない場合は上位階層を再帰的に検索する. 104 * インストーラのパスが見つかった場合は, その URL を返す. 105 * DocumentRoot まで検索しても見つからない場合は /install/index.php を返す. 106 * 107 * @param string $path 検索対象のパス 108 * @return string インストーラの URL 109 */ 110 function searchInstallerPath($path) { 111 $installer = 'install/index.php'; 112 if ($path == '/') { 113 return $path . $installer; 114 } 115 if (substr($path, -1, 1) != '/') { 116 $path .= $path . '/'; 117 } 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 if ($resources === false) { 126 $installer_url = SC_Utils::searchInstallerPath($path . '../'); 127 } 128 return $installer_url; 116 129 } 117 130
Note: See TracChangeset
for help on using the changeset viewer.