Changeset 22922
- Timestamp:
- 2013/06/29 17:38:04 (11 years ago)
- Location:
- branches/version-2_13-dev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/SC_Initial.php
r22856 r22922 58 58 $this->resetSuperglobalsRequest(); // stripslashesDeepGpc メソッドより後で実行 59 59 $this->setTimezone(); // 本当はエラーハンドラーより先に読みたい気も 60 $this->normalizeHostname(); // defineConstants メソッドより後で実行 60 61 } 61 62 … … 489 490 date_default_timezone_set('Asia/Tokyo'); 490 491 } 492 493 /** 494 * ホスト名を正規化する 495 * 496 * @return void 497 */ 498 function normalizeHostname() 499 { 500 if ( 501 // パラメーター 502 !USE_NORMALIZE_HOSTNAME 503 // コマンドライン実行の場合 504 || !isset($_SERVER['REQUEST_URI']) 505 // POSTの場合 506 || $_SERVER['REQUEST_METHOD'] === 'POST' 507 ) { 508 // 処理せず戻る 509 return; 510 } 511 512 $netUrlRequest = new Net_URL($_SERVER['REQUEST_URI']); 513 // 要求を受けたホスト名 514 $request_hostname = $netUrlRequest->host; 515 516 $netUrlCorrect = new Net_URL(SC_Utils_Ex::sfIsHTTPS() ? HTTPS_URL : HTTP_URL); 517 // 設定上のホスト名 518 $correct_hostname = $netUrlCorrect->host; 519 520 // ホスト名が不一致の場合 521 if ($request_hostname !== $correct_hostname) { 522 // ホスト名を書き換え 523 $netUrlRequest->host = $correct_hostname; 524 // 正しい URL 525 $correct_url = $netUrlRequest->getUrl(); 526 // 警告 527 $msg = 'ホスト名不一致を検出。リダイレクト実行。'; 528 $msg .= '要求値=' . var_export($request_hostname, true) . ' '; 529 $msg .= '設定値=' . var_export($correct_hostname, true) . ' '; 530 $msg .= 'リダイレクト先=' . var_export($correct_url, true) . ' '; 531 trigger_error($msg, E_USER_WARNING); 532 // リダイレクト(恒久的) 533 SC_Response_Ex::sendHttpStatus(301); 534 SC_Response_Ex::sendRedirect($correct_url); 535 } 536 } 491 537 } -
branches/version-2_13-dev/html/install/sql/insert_data.sql
r22856 r22922 1256 1256 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('MYPAGE_ORDER_STATUS_DISP_FLAG', 'true', 1412, 'MYページ:ご注文状況表示フラグ'); 1257 1257 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('DEFAULT_COUNTRY_ID', 392, 1413, 'デフォルト国コード ISO_3166-1に準拠'); 1258 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('USE_NORMALIZE_HOSTNAME', true, 1414, 'ホスト名を正規化するか (true:する false:しない)'); 1258 1259 1259 1260
Note: See TracChangeset
for help on using the changeset viewer.