Changeset 19834 for branches/version-2_5-dev/data/class/SC_Response.php
- Timestamp:
- 2011/01/06 07:00:09 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_Response.php
r19832 r19834 132 132 133 133 /** 134 * @param string $location 「 アプリケーションルートからの相対パス」「現在のURLからの相対パス」「URL」のいずれか134 * @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか 135 135 * @return void 136 136 * @static … … 138 138 function sendRedirect($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null) { 139 139 140 // アプリケーションルートからの相対パス140 // url-path → URL 変換 141 141 if ($location[0] === '/') { 142 if (!is_bool($useSsl)) {143 $useSsl = SC_Utils_Ex::sfIsHTTPS();144 }145 $url = ($useSsl ? HTTPS_URL : HTTP_URL) . substr($location, 1);146 } 142 $netUrl = new Net_URL(); 143 $netUrl->path = $location; 144 $location = $netUrl->getUrl(); 145 } 146 147 147 // URL の場合 148 elseif (preg_match('/^https?:/', $location)) {148 if (preg_match('/^https?:/', $location)) { 149 149 $url = $location; 150 150 if (is_bool($useSsl)) { … … 161 161 } 162 162 } 163 // 現在のURLからの 相対パス163 // 現在のURLからのパス 164 164 else { 165 165 if (!is_bool($useSsl)) { … … 171 171 } 172 172 173 $netUrl = new Net_URL($url); 174 $arrQueryString = array_merge($netUrl->querystring, $arrQueryString); 175 176 if ($inheritQueryString) { 177 if (!empty($_SERVER['QUERY_STRING'])) { 178 $netUrl->addRawQueryString($_SERVER['QUERY_STRING']); 179 } 180 } 181 182 foreach ($arrQueryString as $key => $val) { 183 $netUrl->addQueryString($key, $val); 184 } 185 186 $url = $netUrl->getURL(); 187 173 // アプリケーション内での遷移時の処理 188 174 $pattern = '/^(' . preg_quote(HTTP_URL, '/') . '|' . preg_quote(HTTPS_URL, '/') . ')/'; 189 175 if (preg_match($pattern, $url)) { 176 $netUrl = new Net_URL($url); 177 $arrQueryString = array_merge($netUrl->querystring, $arrQueryString); 178 $netUrl->querystring = array(); 179 180 if ($inheritQueryString) { 181 if (!empty($_SERVER['QUERY_STRING'])) { 182 $netUrl->addRawQueryString($_SERVER['QUERY_STRING']); 183 } 184 } 185 186 foreach ($arrQueryString as $key => $val) { 187 $netUrl->addQueryString($key, $val); 188 } 189 190 $url = $netUrl->getURL(); 191 190 192 $session = SC_SessionFactory::getInstance(); 191 193 if (SC_MobileUserAgent::isMobile() || $session->useCookie() == false) { … … 202 204 203 205 /** 206 * HTML_PATH からのパスを指定してリダイレクトする 207 * 208 * @param string $location /html/ からの相対パス 209 * @return void 210 * @static 211 */ 212 function sendRedirectFromUrlPath($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null) { 213 $location = URL_PATH . $location; 214 SC_Response_Ex::sendRedirect($location, $arrQueryString, $inheritQueryString, $useSsl); 215 } 216 217 /** 204 218 * @static 205 219 */ … … 213 227 $netUrl->querystring = array(); 214 228 215 $this->sendRedirect($netUrl->getURL(), $arrQueryString);229 SC_Response_Ex::sendRedirect($netUrl->getURL(), $arrQueryString); 216 230 } 217 231
Note: See TracChangeset
for help on using the changeset viewer.
