Changeset 18609 for tmp/version-2_5-test/data/class/pages/LC_Page.php
- Timestamp:
- 2010/03/11 10:35:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/data/class/pages/LC_Page.php
r18432 r18609 81 81 * @return void 82 82 */ 83 function init() {} 83 function init() { 84 $this->tpl_authority = $_SESSION['authority']; 85 // XXX すべてのページで宣言するべき 86 $layout = new SC_Helper_PageLayout_Ex(); 87 $layout->sfGetPageLayout($this, false); 88 } 84 89 85 90 /** … … 241 246 } 242 247 248 /** 249 * EC-CUBE のWEBルート(/html/)を / としたパスを返す 250 * 251 * @param string $path 結果を取得するためのパス 252 * @return string EC-CUBE のWEBルート(/html/)を / としたパス 253 */ 243 254 function getRootPath($path) { 255 // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 256 $path = str_replace('\\', '/', $path); 257 $htmlPath = str_replace('\\', '/', HTML_PATH); 258 259 // PHP 5.1 対策 ( http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=4277&forum=9 ) 260 if (strlen($path) == 0) { 261 $path = '.'; 262 } 263 244 264 // $path が / で始まっている場合 245 if (substr($path, 0, 1) == "/") {246 $realPath = realpath( HTML_PATH . substr_replace($path, "", 0, strlen(URL_DIR)));265 if (substr($path, 0, 1) == '/') { 266 $realPath = realpath($htmlPath . substr_replace($path, '', 0, strlen(URL_DIR))); 247 267 // 相対パスの場合 248 268 } else { 249 269 $realPath = realpath($path); 250 270 } 251 271 $realPath = str_replace('\\', '/', $realPath); 272 273 // $path が / で終わっている場合、realpath によって削られた末尾の / を復元する。 274 if (substr($path, -1, 1) == '/' && substr($realPath, -1, 1) != '/') { 275 $realPath .= '/'; 276 } 277 252 278 // HTML_PATH を削除した文字列を取得. 253 // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する 254 $realPath = str_replace("\\", "/", $realPath); 255 $htmlPath = str_replace("\\", "/", HTML_PATH); 256 257 $htmlPath = rtrim($htmlPath, "/"); 258 $rootPath = str_replace($htmlPath, "", $realPath); 259 $rootPath = ltrim($rootPath, "/"); 279 $rootPath = str_replace($htmlPath, '', $realPath); 280 $rootPath = ltrim($rootPath, '/'); 260 281 261 282 return $rootPath; … … 277 298 278 299 // 現在の URL を取得 279 $netURL = new Net_URL( );300 $netURL = new Net_URL($_SERVER['REQUEST_URI']); 280 301 281 302 if ($removeQueryString) { 282 303 $netURL->querystring = array(); 283 $_SERVER['QUERY_STRING'] = ''; 304 $_SERVER['QUERY_STRING'] = ''; // sendRedirect() での処理用らしい 284 305 } 285 306 … … 295 316 296 317 /** 297 * クライアントのキャッシュを許可する. 298 * 299 * session_start時のno-cacheヘッダーを抑制することで 300 * 「戻る」ボタン使用時の有効期限切れ表示を抑制する. 301 * 302 * @access protected 303 * @return void 318 * 互換性確保用メソッド 319 * 320 * @access protected 321 * @return void 322 * @deprecated 決済モジュール互換のため 304 323 */ 305 324 function allowClientCache() { 306 session_cache_limiter('private-no-expire'); 325 LC_Page::httpCacheControl('private'); 326 } 327 328 /** 329 * クライアント・プロキシのキャッシュを制御する. 330 * 331 * @access protected 332 * @param string $mode (nocache/private) 333 * @return void 334 */ 335 function httpCacheControl($mode = '') { 336 switch ($mode) { 337 case 'nocache': 338 header('Pragma: no-cache'); 339 header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); 340 header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); 341 header('Last-Modified:'); 342 break; 343 344 case 'private': 345 $cache_expire = session_cache_expire() * 60; 346 header('Pragma: no-cache'); // anti-proxy 347 header('Expires:'); // anti-mozilla 348 header("Cache-Control: private, max-age={$cache_expire}, pre-check={$cache_expire}"); // HTTP/1.1 client 349 header('Last-Modified:'); 350 break; 351 352 default: 353 break; 354 } 307 355 } 308 356 … … 332 380 return sha1(uniqid(rand(), true)); 333 381 } 382 383 /** 384 * HTTPステータスコードを送出する。 385 * 386 * @param integer $code HTTPステータスコード 387 * @return void 388 * @author Seasoft (新規作成) 389 * @see Moony_Action::status() (オリジナル) 390 * @link http://moony.googlecode.com/ (オリジナル) 391 * @author YAMAOKA Hiroyuki (オリジナル) 392 * @copyright 2005-2008 YAMAOKA Hiroyuki (オリジナル) 393 * @license http://opensource.org/licenses/bsd-license.php New BSD License (オリジナル) 394 * @link http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳) 395 * @license http://www.gnu.org/licenses/fdl.html GFDL (邦訳) 396 */ 397 function sendHttpStatus($code) { 398 $protocol = $_SERVER['SERVER_PROTOCOL']; 399 $httpVersion = (strpos($protocol, '1.1') !== false) ? '1.1' : '1.0'; 400 $messages = array( 401 // Informational 1xx // 【情報】 402 100 => 'Continue', // 継続 403 101 => 'Switching Protocols', // プロトコル切替え 404 // Success 2xx // 【成功】 405 200 => 'OK', // OK 406 201 => 'Created', // 作成 407 202 => 'Accepted', // 受理 408 203 => 'Non-Authoritative Information', // 信頼できない情報 409 204 => 'No Content', // 内容なし 410 205 => 'Reset Content', // 内容のリセット 411 206 => 'Partial Content', // 部分的内容 412 // Redirection 3xx // 【リダイレクション】 413 300 => 'Multiple Choices', // 複数の選択 414 301 => 'Moved Permanently', // 恒久的に移動した 415 302 => 'Found', // 1.1 // 発見した (リクエストしたリソースは一時的に移動されているときに返される) 416 303 => 'See Other', // 他を参照せよ 417 304 => 'Not Modified', // 未更新 418 305 => 'Use Proxy', // プロキシを使用せよ 419 // 306 is no longer used but still reserved // 将来のために予約されている 420 307 => 'Temporary Redirect', // 一時的リダイレクト 421 // Client Error 4xx // 【クライアントエラー】 422 400 => 'Bad Request', // リクエストが不正である 423 401 => 'Unauthorized', // 認証が必要である 424 402 => 'Payment Required', // 支払いが必要である 425 403 => 'Forbidden', // 禁止されている 426 404 => 'Not Found', // 未検出 427 405 => 'Method Not Allowed', // 許可されていないメソッド 428 406 => 'Not Acceptable', // 受理できない 429 407 => 'Proxy Authentication Required', // プロキシ認証が必要である 430 408 => 'Request Timeout', // リクエストタイムアウト 431 409 => 'Conflict', // 矛盾 432 410 => 'Gone', // 消滅した 433 411 => 'Length Required', // 長さが必要 434 412 => 'Precondition Failed', // 前提条件で失敗した 435 413 => 'Request Entity Too Large', // リクエストエンティティが大きすぎる 436 414 => 'Request-URI Too Long', // リクエストURIが大きすぎる 437 415 => 'Unsupported Media Type', // サポートしていないメディアタイプ 438 416 => 'Requested Range Not Satisfiable', // リクエストしたレンジは範囲外にある 439 417 => 'Expectation Failed', // 期待するヘッダに失敗 440 // Server Error 5xx // 【サーバエラー】 441 500 => 'Internal Server Error', // サーバ内部エラー 442 501 => 'Not Implemented', // 実装されていない 443 502 => 'Bad Gateway', // 不正なゲートウェイ 444 503 => 'Service Unavailable', // サービス利用不可 445 504 => 'Gateway Timeout', // ゲートウェイタイムアウト 446 505 => 'HTTP Version Not Supported', // サポートしていないHTTPバージョン 447 509 => 'Bandwidth Limit Exceeded' // 帯域幅制限超過 448 ); 449 if (isset($messages[$code])) { 450 if ($httpVersion !== '1.1') { 451 // HTTP/1.0 452 $messages[302] = 'Moved Temporarily'; 453 } 454 header("HTTP/{$httpVersion} {$code} {$messages[$code]}"); 455 header("Status: {$code} {$messages[$code]}", true, $code); 456 } 457 } 334 458 } 335 459 ?>
Note: See TracChangeset
for help on using the changeset viewer.