Changeset 19705
- Timestamp:
- 2010/12/02 18:14:39 (13 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:19704
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/class/SC_Display.php 18986@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_Display.php
data/class/SC_Response.php 18986@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_Response.php
data/class/SC_SmartphoneUserAgent.php 19029@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_SmartphoneUserAgent.php
data/class/pages/LC_Page.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2FLC_Page.php
data/class/pages/admin/LC_Page_Admin.php 15280@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2FLC_Page_Admin.php- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20101202091436-vcp9ha97310kgcx0
- bzr:revno:
- 2434
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:timestamp:
- 2010-12-02 18:14:36.931999922 +0900
- bzr:user-agent:
- bzr2.2.1+bzr-svn1.0.4
- svn:original-date:
- 2010-12-02T09:14:36.932000Z
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_Display.php
r19683 r19705 1 1 <?php 2 // TODO GPLのあれ 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 /** 25 * Http コンテンツ出力を制御するクラス. 26 * 27 * @author Ryuichi Tokugami 28 * @version $Id$ 29 */ 3 30 class SC_Display{ 4 31 … … 9 36 var $autoSet; 10 37 11 /** 12 * 13 * @var SC_View 38 /** SC_View インスタンス */ 39 var $view; 40 41 var $deviceSeted = false; 42 43 /* 44 * TODO php4を捨てたときに ここのコメントアウトを外してね。 45 * const('MOBILE',1); 46 * const('SMARTPHONE',2); 47 * const('PC',4); 48 * const('ADMIN',8); 14 49 */ 15 var $view; 16 17 var $deviceSeted = false; 18 19 // TODO php4を捨てたときに ここのコメントアウトを外してね。 20 /* 21 * const('MOBILE',1); 22 * const('SMARTPHONE',2); 23 * const('PC',4); 24 * const('ADMIN',8); 25 */ 26 function SC_Display($setPrevURL=true,$autoGenerateHttpHeaders = true){ 27 require_once(CLASS_EX_PATH."/SC_Response_Ex.php"); 50 51 function SC_Display($hasPrevURL = true, $autoGenerateHttpHeaders = true) { 52 require_once(CLASS_EX_PATH . "SC_Response_Ex.php"); 28 53 $this->response = new SC_Response_Ex(); 29 54 $this->autoSet = $autoGenerateHttpHeaders; 30 if ($ setPrevURL) {55 if ($hasPrevURL) { 31 56 $this->setPrevURL(); 32 57 } 33 58 } 34 59 35 60 function setPrevURL(){ 61 // TODO SC_SiteSession で実装した方が良さげ 36 62 $objCartSess = new SC_CartSession(); 37 63 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 38 39 64 } 40 65 41 42 // TODO このメソッドは、レスポンスを返すためのメソッドです。名前を絶対に変えましょう。43 66 /** 44 * 45 * @param $page LC_Page 46 */ 47 function hoge($page, $is_admin = false){ 67 * LC_Page のパラメータを, テンプレートに設定し, 出力の準備を行う. 68 * 69 * @param LC_Page $page LC_Page インスタンス 70 * @param $is_admin boolean 管理画面を扱う場合 true 71 */ 72 function prepare($page, $is_admin = false){ 48 73 if(!$this->deviceSeted || !is_null($this->view)){ 49 74 $device = ($is_admin) ? 8 : $this->detectDevice(); … … 53 78 $this->response->setResposeBody($this->view->getResponse($page->getTemplate())); 54 79 } 55 80 81 /** 82 * リダイレクトを行う. 83 * 84 * SC_Response::sendRedirect() のラッパーです. 85 */ 56 86 function redirect($location){ 57 87 $this->response->sendRedirect($location); 58 88 } 59 89 90 /** 91 * リロードを行う. 92 * 93 * SC_Response::reload() のラッパーです. 94 */ 60 95 function reload($queryString = array(), $removeQueryString = false){ 61 96 $this->response->reload($queryString, $removeQueryString); 62 97 } 63 64 function noAction(){ 98 99 function noAction(){ 65 100 return; 66 101 } 67 102 103 /** 104 * ヘッダを追加する. 105 */ 68 106 function addHeader($name, $value){ 69 107 $this->response->addHeader($name, $value); … … 75 113 */ 76 114 function setDevice($device=4){ 77 115 78 116 switch ($device){ 79 117 case 1: … … 92 130 $this->deviceSeted = true; 93 131 } 94 132 133 /** 134 * SC_View インスタンスを設定する. 135 */ 95 136 function setView($view){ 96 97 137 $this->view = $view; 98 138 } … … 135 175 $this->view->assignarray($array); 136 176 } 137 138 139 177 } -
branches/version-2_5-dev/data/class/SC_Response.php
r19675 r19705 1 1 <?php 2 // TODO GPLのあれ 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 /** 25 * HttpResponse を扱うクラス. 26 * 27 * @author Ryuichi Tokugami 28 * @version $Id$ 29 */ 3 30 class SC_Response{ 4 31 5 32 /** 6 * 7 * @var HTTP_Response 8 */ 9 var $http; 10 /** 11 * コンテンツタイプ 33 * コンテンツタイプ 12 34 * Enter description here ... 13 35 * @var unknown_type … … 19 41 20 42 var $statusTexts = array( 21 '100' => 'Continue',22 '101' => 'Switching Protocols',23 '200' => 'OK',24 '201' => 'Created',25 '202' => 'Accepted',26 '203' => 'Non-Authoritative Information',27 '204' => 'No Content',28 '205' => 'Reset Content',29 '206' => 'Partial Content',30 '300' => 'Multiple Choices',31 '301' => 'Moved Permanently',32 '302' => 'Found',33 '303' => 'See Other',34 '304' => 'Not Modified',35 '305' => 'Use Proxy',36 '306' => '(Unused)',37 '307' => 'Temporary Redirect',38 '400' => 'Bad Request',39 '401' => 'Unauthorized',40 '402' => 'Payment Required',41 '403' => 'Forbidden',42 '404' => 'Not Found',43 '405' => 'Method Not Allowed',44 '406' => 'Not Acceptable',45 '407' => 'Proxy Authentication Required',46 '408' => 'Request Timeout',47 '409' => 'Conflict',48 '410' => 'Gone',49 '411' => 'Length Required',50 '412' => 'Precondition Failed',51 '413' => 'Request Entity Too Large',52 '414' => 'Request-URI Too Long',53 '415' => 'Unsupported Media Type',54 '416' => 'Requested Range Not Satisfiable',55 '417' => 'Expectation Failed',56 '500' => 'Internal Server Error',57 '501' => 'Not Implemented',58 '502' => 'Bad Gateway',59 '503' => 'Service Unavailable',60 '504' => 'Gateway Timeout',61 '505' => 'HTTP Version Not Supported',62 );43 '100' => 'Continue', 44 '101' => 'Switching Protocols', 45 '200' => 'OK', 46 '201' => 'Created', 47 '202' => 'Accepted', 48 '203' => 'Non-Authoritative Information', 49 '204' => 'No Content', 50 '205' => 'Reset Content', 51 '206' => 'Partial Content', 52 '300' => 'Multiple Choices', 53 '301' => 'Moved Permanently', 54 '302' => 'Found', 55 '303' => 'See Other', 56 '304' => 'Not Modified', 57 '305' => 'Use Proxy', 58 '306' => '(Unused)', 59 '307' => 'Temporary Redirect', 60 '400' => 'Bad Request', 61 '401' => 'Unauthorized', 62 '402' => 'Payment Required', 63 '403' => 'Forbidden', 64 '404' => 'Not Found', 65 '405' => 'Method Not Allowed', 66 '406' => 'Not Acceptable', 67 '407' => 'Proxy Authentication Required', 68 '408' => 'Request Timeout', 69 '409' => 'Conflict', 70 '410' => 'Gone', 71 '411' => 'Length Required', 72 '412' => 'Precondition Failed', 73 '413' => 'Request Entity Too Large', 74 '414' => 'Request-URI Too Long', 75 '415' => 'Unsupported Media Type', 76 '416' => 'Requested Range Not Satisfiable', 77 '417' => 'Expectation Failed', 78 '500' => 'Internal Server Error', 79 '501' => 'Not Implemented', 80 '502' => 'Bad Gateway', 81 '503' => 'Service Unavailable', 82 '504' => 'Gateway Timeout', 83 '505' => 'HTTP Version Not Supported', 84 ); 63 85 64 86 … … 69 91 var $encoding; 70 92 71 function SC_Response() {93 function SC_Response() { 72 94 } 73 95 74 function response(){ 96 /** 97 * レスポンス出力を書き込む. 98 */ 99 function write() { 75 100 $this->sendHeader(); 76 77 101 echo $this->body; 78 102 } 79 103 80 function sendHeader() {81 // HTTPのヘッ ダ104 function sendHeader() { 105 // HTTPのヘッダ 82 106 // header('HTTP/1.1 '.$this->statuscode.' '.$this->statusTexts[$this->statuscode]); 83 107 foreach ($this->header as $name => $head){ … … 87 111 88 112 89 function setContentType($contentType) {113 function setContentType($contentType) { 90 114 $this->header['Content-Type'] = $contentType; 91 115 } … … 95 119 } 96 120 97 /* function addDateHdeader($name, $date){ 98 * 99 * } 100 */ 101 102 function addHeader($name, $value){ 121 function addHeader($name, $value) { 103 122 $this->header[$name] = $value; 104 123 } 105 124 106 function containsHeader($name) {125 function containsHeader($name) { 107 126 return isset($this->header[$name]); 108 127 } 109 128 110 function sendError($errorcode) {129 function sendError($errorcode) { 111 130 header('HTTP/1.1 '.$errorcode.' '.$this->statusTexts[$errorcode]); 112 131 } 113 132 114 function sendRedirect($location) {133 function sendRedirect($location) { 115 134 if (preg_match("/(" . preg_quote(SITE_URL, '/') 116 135 . "|" . preg_quote(SSL_URL, '/') . ")/", $location)) { … … 152 171 } 153 172 154 function setHeader($headers) {173 function setHeader($headers) { 155 174 $this->header = $headers; 156 175 } 157 176 158 function setStatus($sc = 202) {177 function setStatus($sc = 202) { 159 178 $this->statuscode = $sc; 160 179 } -
branches/version-2_5-dev/data/class/SC_SmartphoneUserAgent.php
r19670 r19705 24 24 25 25 /** 26 * スマートフォンの情報を扱うクラス 26 * スマートフォンの情報を扱うクラス. 27 27 * 28 * @auther Yu Nobira 28 29 */ 29 30 class SC_SmartphoneUserAgent { … … 89 90 ; 90 91 92 // XXX サニタイズ必要? 91 93 $url .= (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) 92 94 ? $matches[1] -
branches/version-2_5-dev/data/class/pages/LC_Page.php
r19670 r19705 126 126 //$this->objPlugin->process($this); 127 127 128 $this->objDisplay-> hoge($this);129 $this->objDisplay->response-> response();128 $this->objDisplay->prepare($this); 129 $this->objDisplay->response->write(); 130 130 } 131 131 … … 136 136 */ 137 137 function sendResponseCSV($file_name, $data) { 138 $this->objDisplay-> hoge($this);138 $this->objDisplay->prepare($this); 139 139 $this->objDisplay->addHeader("Content-disposition", "attachment; filename=${file_name}"); 140 140 $this->objDisplay->addHeader("Content-type", "application/octet-stream; name=${file_name}"); … … 143 143 144 144 $this->objDisplay->response->body = $data; 145 $this->objDisplay->response-> response();145 $this->objDisplay->response->write(); 146 146 exit; 147 147 } -
branches/version-2_5-dev/data/class/pages/admin/LC_Page_Admin.php
r19670 r19705 49 49 50 50 // プラグインクラス生成 51 #$this->objPlagin = new SC_Helper_Plugin_Ex();52 #$this->objPlagin->preProcess($this);51 // $this->objPlagin = new SC_Helper_Plugin_Ex(); 52 // $this->objPlagin->preProcess($this); 53 53 } 54 54 … … 67 67 */ 68 68 function sendResponse() { 69 $this->objDisplay-> hoge($this, true);70 $this->objDisplay->response-> response();69 $this->objDisplay->prepare($this, true); 70 $this->objDisplay->response->write(); 71 71 } 72 73 72 74 73 /**
Note: See TracChangeset
for help on using the changeset viewer.