| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of EC-CUBE |
|---|
| 4 | * |
|---|
| 5 | * Copyright(c) 2000-2014 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 | * Web Page を制御する基底クラス |
|---|
| 26 | * |
|---|
| 27 | * Web Page を制御する Page クラスは必ずこのクラスを継承する. |
|---|
| 28 | * PHP4 ではこのような抽象クラスを作っても継承先で何でもできてしまうため、 |
|---|
| 29 | * あまり意味がないが、アーキテクトを統一するために作っておく. |
|---|
| 30 | * |
|---|
| 31 | * @package Page |
|---|
| 32 | * @author LOCKON CO.,LTD. |
|---|
| 33 | * @version $Id:LC_Page.php 15532 2007-08-31 14:39:46Z nanasess $ |
|---|
| 34 | */ |
|---|
| 35 | class LC_Page |
|---|
| 36 | { |
|---|
| 37 | /** メインテンプレート */ |
|---|
| 38 | public $tpl_mainpage; |
|---|
| 39 | |
|---|
| 40 | /** テンプレートのカラム数 */ |
|---|
| 41 | public $tpl_column_num; |
|---|
| 42 | |
|---|
| 43 | /** メインナンバー */ |
|---|
| 44 | public $tpl_mainno; |
|---|
| 45 | |
|---|
| 46 | /** CSS のパス */ |
|---|
| 47 | public $tpl_css; |
|---|
| 48 | |
|---|
| 49 | /** JavaScript */ |
|---|
| 50 | public $tpl_javascript; |
|---|
| 51 | |
|---|
| 52 | /** タイトル */ |
|---|
| 53 | public $tpl_title; |
|---|
| 54 | |
|---|
| 55 | /** ログインメールアドレス */ |
|---|
| 56 | public $tpl_login_email; |
|---|
| 57 | |
|---|
| 58 | /** HTML ロード後に実行する JavaScript コード */ |
|---|
| 59 | public $tpl_onload; |
|---|
| 60 | |
|---|
| 61 | /** トランザクションID */ |
|---|
| 62 | public $transactionid; |
|---|
| 63 | |
|---|
| 64 | /** メインテンプレート名 */ |
|---|
| 65 | public $template = SITE_FRAME; |
|---|
| 66 | |
|---|
| 67 | /** 店舗基本情報 */ |
|---|
| 68 | public $arrSiteInfo; |
|---|
| 69 | |
|---|
| 70 | /** プラグインを実行フラグ */ |
|---|
| 71 | public $plugin_activate_flg = PLUGIN_ACTIVATE_FLAG; |
|---|
| 72 | |
|---|
| 73 | /** POST に限定する mode */ |
|---|
| 74 | public $arrLimitPostMode = array(); |
|---|
| 75 | |
|---|
| 76 | /** ページレイアウトを読み込むか */ |
|---|
| 77 | public $skip_load_page_layout = false; |
|---|
| 78 | |
|---|
| 79 | /** 2.12.x 以前のJavaScript関数を読み込むかどうか */ |
|---|
| 80 | public $load_legacy_js = false; |
|---|
| 81 | |
|---|
| 82 | public $arrForm; |
|---|
| 83 | public $arrErr; |
|---|
| 84 | |
|---|
| 85 | /** |
|---|
| 86 | * Page を初期化する. |
|---|
| 87 | * |
|---|
| 88 | * @return void |
|---|
| 89 | */ |
|---|
| 90 | public function init() |
|---|
| 91 | { |
|---|
| 92 | // 開始時刻を設定する。 |
|---|
| 93 | $this->timeStart = microtime(true); |
|---|
| 94 | |
|---|
| 95 | $this->tpl_authority = $_SESSION['authority']; |
|---|
| 96 | |
|---|
| 97 | // ディスプレイクラス生成 |
|---|
| 98 | $this->objDisplay = new SC_Display_Ex(); |
|---|
| 99 | |
|---|
| 100 | if (!$this->skip_load_page_layout) { |
|---|
| 101 | $layout = new SC_Helper_PageLayout_Ex(); |
|---|
| 102 | $layout->sfGetPageLayout($this, false, $_SERVER['SCRIPT_NAME'], |
|---|
| 103 | $this->objDisplay->detectDevice()); |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | // スーパーフックポイントを実行. |
|---|
| 107 | $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); |
|---|
| 108 | $objPlugin->doAction('LC_Page_preProcess', array($this)); |
|---|
| 109 | |
|---|
| 110 | // 店舗基本情報取得 |
|---|
| 111 | $this->arrSiteInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
|---|
| 112 | |
|---|
| 113 | // トランザクショントークンの検証と生成 |
|---|
| 114 | $this->doValidToken(); |
|---|
| 115 | $this->setTokenTo(); |
|---|
| 116 | |
|---|
| 117 | // ローカルフックポイントを実行. |
|---|
| 118 | $this->doLocalHookpointBefore($objPlugin); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | /** |
|---|
| 122 | * Page のプロセス. |
|---|
| 123 | * |
|---|
| 124 | * @return void |
|---|
| 125 | */ |
|---|
| 126 | public function process() |
|---|
| 127 | { |
|---|
| 128 | // POST に限定された mode か検証する。 |
|---|
| 129 | $this->checkLimitPostMode(); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | /** |
|---|
| 133 | * Page のレスポンス送信. |
|---|
| 134 | * |
|---|
| 135 | * @return void |
|---|
| 136 | */ |
|---|
| 137 | public function sendResponse() |
|---|
| 138 | { |
|---|
| 139 | $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); |
|---|
| 140 | // ローカルフックポイントを実行. |
|---|
| 141 | $this->doLocalHookpointAfter($objPlugin); |
|---|
| 142 | |
|---|
| 143 | // HeadNaviにpluginテンプレートを追加する. |
|---|
| 144 | $objPlugin->setHeadNaviBlocs($this->arrPageLayout['HeadNavi']); |
|---|
| 145 | |
|---|
| 146 | // スーパーフックポイントを実行. |
|---|
| 147 | $objPlugin->doAction('LC_Page_process', array($this)); |
|---|
| 148 | |
|---|
| 149 | // ページクラス名をテンプレートに渡す |
|---|
| 150 | $arrBacktrace = debug_backtrace(); |
|---|
| 151 | if (strlen($this->tpl_page_class_name) === 0) { |
|---|
| 152 | $this->tpl_page_class_name = preg_replace('/_Ex$/', '', $arrBacktrace[1]['class']); |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | $this->objDisplay->prepare($this); |
|---|
| 156 | $this->objDisplay->addHeader('Vary', 'User-Agent'); |
|---|
| 157 | $this->objDisplay->response->write(); |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | /** |
|---|
| 161 | * Page のレスポンス送信(ダウンロード). |
|---|
| 162 | * |
|---|
| 163 | * @param string $file_name |
|---|
| 164 | * @param string $data |
|---|
| 165 | * @return void |
|---|
| 166 | */ |
|---|
| 167 | public function sendResponseCSV($file_name, $data) |
|---|
| 168 | { |
|---|
| 169 | $this->objDisplay->prepare($this); |
|---|
| 170 | $this->objDisplay->addHeader('Content-disposition', "attachment; filename=${file_name}"); |
|---|
| 171 | $this->objDisplay->addHeader('Content-type', "application/octet-stream; name=${file_name}"); |
|---|
| 172 | $this->objDisplay->addHeader('Cache-Control', ''); |
|---|
| 173 | $this->objDisplay->addHeader('Pragma', ''); |
|---|
| 174 | |
|---|
| 175 | $this->objDisplay->response->body = $data; |
|---|
| 176 | $this->objDisplay->response->write(); |
|---|
| 177 | SC_Response_Ex::actionExit(); |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | /** |
|---|
| 181 | * デストラクタ |
|---|
| 182 | * |
|---|
| 183 | * ・ブロックの基底クラス (LC_Page_FrontParts_Bloc) では、継承していない。 |
|---|
| 184 | * @return void |
|---|
| 185 | */ |
|---|
| 186 | public function __destruct() |
|---|
| 187 | { |
|---|
| 188 | // 一定時間以上かかったページの場合、ログ出力する。 |
|---|
| 189 | // エラー画面の表示では $this->timeStart が出力されない |
|---|
| 190 | if (defined('PAGE_DISPLAY_TIME_LOG_MODE') && PAGE_DISPLAY_TIME_LOG_MODE == true && isset($this->timeStart)) { |
|---|
| 191 | $timeEnd = microtime(true); |
|---|
| 192 | $timeExecTime = $timeEnd - $this->timeStart; |
|---|
| 193 | if (defined('PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME') && $timeExecTime >= (float) PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME) { |
|---|
| 194 | $logMsg = sprintf('PAGE_DISPLAY_TIME_LOG [%.2fsec]', $timeExecTime); |
|---|
| 195 | GC_Utils_Ex::gfPrintLog($logMsg); |
|---|
| 196 | } |
|---|
| 197 | } |
|---|
| 198 | } |
|---|
| 199 | |
|---|
| 200 | /** |
|---|
| 201 | * ローカルフックポイントを生成し、実行します. |
|---|
| 202 | * |
|---|
| 203 | * @param SC_Helper_Plugin_Ex $objPlugin |
|---|
| 204 | * @return void |
|---|
| 205 | */ |
|---|
| 206 | public function doLocalHookpointBefore(SC_Helper_Plugin_Ex $objPlugin) |
|---|
| 207 | { |
|---|
| 208 | // ローカルフックポイントを実行 |
|---|
| 209 | $parent_class_name = get_parent_class($this); |
|---|
| 210 | if ($parent_class_name != 'LC_Page') { |
|---|
| 211 | $objPlugin->doAction($parent_class_name . '_action_before', array($this)); |
|---|
| 212 | } |
|---|
| 213 | $class_name = get_class($this); |
|---|
| 214 | if ($parent_class_name != 'LC_Page' && $class_name != $parent_class_name) { |
|---|
| 215 | $objPlugin->doAction($class_name . '_action_before', array($this)); |
|---|
| 216 | } |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | /** |
|---|
| 220 | * ローカルフックポイントを生成し、実行します. |
|---|
| 221 | * |
|---|
| 222 | * @param SC_Helper_Plugin_Ex $objPlugin |
|---|
| 223 | * @return void |
|---|
| 224 | */ |
|---|
| 225 | public function doLocalHookpointAfter(SC_Helper_Plugin_Ex $objPlugin) |
|---|
| 226 | { |
|---|
| 227 | // ローカルフックポイントを実行 |
|---|
| 228 | $parent_class_name = get_parent_class($this); |
|---|
| 229 | if ($parent_class_name != 'LC_Page') { |
|---|
| 230 | $objPlugin->doAction($parent_class_name . '_action_after', array($this)); |
|---|
| 231 | } |
|---|
| 232 | $class_name = get_class($this); |
|---|
| 233 | if ($parent_class_name != 'LC_Page' && $class_name != $parent_class_name) { |
|---|
| 234 | $objPlugin->doAction($class_name . '_action_after', array($this)); |
|---|
| 235 | } |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | /** |
|---|
| 239 | * テンプレート取得 |
|---|
| 240 | * |
|---|
| 241 | */ |
|---|
| 242 | public function getTemplate() |
|---|
| 243 | { |
|---|
| 244 | return $this->template; |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | /** |
|---|
| 248 | * テンプレート設定(ポップアップなどの場合) |
|---|
| 249 | * |
|---|
| 250 | */ |
|---|
| 251 | public function setTemplate($template) |
|---|
| 252 | { |
|---|
| 253 | $this->template = $template; |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | /** |
|---|
| 257 | * $path から URL を取得する. |
|---|
| 258 | * |
|---|
| 259 | * 以下の順序で 引数 $path から URL を取得する. |
|---|
| 260 | * 1. realpath($path) で $path の 絶対パスを取得 |
|---|
| 261 | * 2. $_SERVER['DOCUMENT_ROOT'] と一致する文字列を削除 |
|---|
| 262 | * 3. $useSSL の値に応じて, HTTP_URL 又は, HTTPS_URL を付与する. |
|---|
| 263 | * |
|---|
| 264 | * 返り値に, QUERY_STRING を含めたい場合は, key => value 形式 |
|---|
| 265 | * の配列を $param へ渡す. |
|---|
| 266 | * |
|---|
| 267 | * @access protected |
|---|
| 268 | * @param string $path 結果を取得するためのパス |
|---|
| 269 | * @param array $param URL に付与するパラメーターの配列 |
|---|
| 270 | * @param mixed $useSSL 結果に HTTPS_URL を使用する場合 true, |
|---|
| 271 | * HTTP_URL を使用する場合 false, |
|---|
| 272 | * デフォルト 'escape' 現在のスキーマを使用 |
|---|
| 273 | * @return string $path の存在する http(s):// から始まる絶対パス |
|---|
| 274 | * @see Net_URL |
|---|
| 275 | */ |
|---|
| 276 | public function getLocation($path, $param = array(), $useSSL = 'escape') |
|---|
| 277 | { |
|---|
| 278 | $rootPath = $this->getRootPath($path); |
|---|
| 279 | |
|---|
| 280 | // スキーマを定義 |
|---|
| 281 | if ($useSSL === true) { |
|---|
| 282 | $url = HTTPS_URL . $rootPath; |
|---|
| 283 | } elseif ($useSSL === false) { |
|---|
| 284 | $url = HTTP_URL . $rootPath; |
|---|
| 285 | } elseif ($useSSL == 'escape') { |
|---|
| 286 | if (SC_Utils_Ex::sfIsHTTPS()) { |
|---|
| 287 | $url = HTTPS_URL . $rootPath; |
|---|
| 288 | } else { |
|---|
| 289 | $url = HTTP_URL . $rootPath; |
|---|
| 290 | } |
|---|
| 291 | } else { |
|---|
| 292 | die("[BUG] Illegal Parametor of \$useSSL "); |
|---|
| 293 | } |
|---|
| 294 | |
|---|
| 295 | $netURL = new Net_URL($url); |
|---|
| 296 | // QUERY_STRING 生成 |
|---|
| 297 | foreach ($param as $key => $val) { |
|---|
| 298 | $netURL->addQueryString($key, $val); |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | return $netURL->getURL(); |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | /** |
|---|
| 305 | * EC-CUBE のWEBルート(/html/)を / としたパスを返す |
|---|
| 306 | * |
|---|
| 307 | * @param string $path 結果を取得するためのパス |
|---|
| 308 | * @return string EC-CUBE のWEBルート(/html/)からのパス。 |
|---|
| 309 | */ |
|---|
| 310 | public function getRootPath($path) |
|---|
| 311 | { |
|---|
| 312 | // realpath 関数は、QUERY_STRING を扱えないため、退避する。 |
|---|
| 313 | $query_string = ''; |
|---|
| 314 | if (preg_match('/^(.+)\\?(.+)$/', $path, $arrMatch)) { |
|---|
| 315 | $path = $arrMatch[1]; |
|---|
| 316 | $query_string = $arrMatch[2]; |
|---|
| 317 | } |
|---|
| 318 | |
|---|
| 319 | // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する |
|---|
| 320 | $path = str_replace('\\', '/', $path); |
|---|
| 321 | $htmlPath = str_replace('\\', '/', HTML_REALDIR); |
|---|
| 322 | |
|---|
| 323 | // PHP 5.1 対策 ( http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=4277&forum=9) |
|---|
| 324 | if (strlen($path) == 0) { |
|---|
| 325 | $path = '.'; |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | // $path が / で始まっている場合 |
|---|
| 329 | if (substr($path, 0, 1) == '/') { |
|---|
| 330 | $realPath = realpath($htmlPath . substr_replace($path, '', 0, strlen(ROOT_URLPATH))); |
|---|
| 331 | // 相対パスの場合 |
|---|
| 332 | } else { |
|---|
| 333 | $realPath = realpath($path); |
|---|
| 334 | } |
|---|
| 335 | if ($realPath === false) { |
|---|
| 336 | trigger_error('realpath でエラー発生。', E_USER_ERROR); |
|---|
| 337 | } |
|---|
| 338 | $realPath = str_replace('\\', '/', $realPath); |
|---|
| 339 | |
|---|
| 340 | // $path が / で終わっている場合、realpath によって削られた末尾の / を復元する。 |
|---|
| 341 | if (substr($path, -1, 1) == '/' && substr($realPath, -1, 1) != '/') { |
|---|
| 342 | $realPath .= '/'; |
|---|
| 343 | } |
|---|
| 344 | |
|---|
| 345 | // HTML_REALDIR を削除した文字列を取得. |
|---|
| 346 | if (substr($realPath, 0, strlen($htmlPath)) !== $htmlPath) { |
|---|
| 347 | trigger_error('不整合', E_USER_ERROR); |
|---|
| 348 | } |
|---|
| 349 | $rootPath = substr($realPath, strlen($htmlPath)); |
|---|
| 350 | |
|---|
| 351 | // QUERY_STRING を復元する。 |
|---|
| 352 | if (strlen($query_string) >= 1) { |
|---|
| 353 | $rootPath .= '?' . $query_string; |
|---|
| 354 | } |
|---|
| 355 | |
|---|
| 356 | return $rootPath; |
|---|
| 357 | } |
|---|
| 358 | |
|---|
| 359 | /** |
|---|
| 360 | * 互換性確保用メソッド |
|---|
| 361 | * |
|---|
| 362 | * @access protected |
|---|
| 363 | * @return void |
|---|
| 364 | * @deprecated 決済モジュール互換のため |
|---|
| 365 | */ |
|---|
| 366 | public function allowClientCache() |
|---|
| 367 | { |
|---|
| 368 | $this->httpCacheControl('private'); |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | /** |
|---|
| 372 | * クライアント・プロキシのキャッシュを制御する. |
|---|
| 373 | * |
|---|
| 374 | * @access protected |
|---|
| 375 | * @param string $mode (nocache/private) |
|---|
| 376 | * @return void |
|---|
| 377 | */ |
|---|
| 378 | public function httpCacheControl($mode = '') |
|---|
| 379 | { |
|---|
| 380 | switch ($mode) { |
|---|
| 381 | case 'nocache': |
|---|
| 382 | header('Pragma: no-cache'); |
|---|
| 383 | header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); |
|---|
| 384 | header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
|---|
| 385 | header('Last-Modified:'); |
|---|
| 386 | break; |
|---|
| 387 | |
|---|
| 388 | case 'private': |
|---|
| 389 | $cache_expire = session_cache_expire() * 60; |
|---|
| 390 | header('Pragma: no-cache'); // anti-proxy |
|---|
| 391 | header('Expires:'); // anti-mozilla |
|---|
| 392 | header("Cache-Control: private, max-age={$cache_expire}, pre-check={$cache_expire}"); // HTTP/1.1 client |
|---|
| 393 | header('Last-Modified:'); |
|---|
| 394 | break; |
|---|
| 395 | |
|---|
| 396 | default: |
|---|
| 397 | break; |
|---|
| 398 | } |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | /** |
|---|
| 402 | * リクエストパラメーター 'mode' を取得する. |
|---|
| 403 | * |
|---|
| 404 | * 1. $_REQUEST['mode'] の値を取得する. |
|---|
| 405 | * 2. 存在しない場合は null を返す. |
|---|
| 406 | * |
|---|
| 407 | * mode に, 半角英数字とアンダーバー(_) 以外の文字列が検出された場合は null を |
|---|
| 408 | * 返す. |
|---|
| 409 | * |
|---|
| 410 | * @access protected |
|---|
| 411 | * @return string|null $_REQUEST['mode'] の文字列 |
|---|
| 412 | */ |
|---|
| 413 | public function getMode() |
|---|
| 414 | { |
|---|
| 415 | $pattern = '/^[a-zA-Z0-9_]+$/'; |
|---|
| 416 | $mode = null; |
|---|
| 417 | if (isset($_REQUEST['mode']) && preg_match($pattern, $_REQUEST['mode'])) { |
|---|
| 418 | $mode = $_REQUEST['mode']; |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | return $mode; |
|---|
| 422 | } |
|---|
| 423 | |
|---|
| 424 | /** |
|---|
| 425 | * POST アクセスの妥当性を検証する. |
|---|
| 426 | * |
|---|
| 427 | * 生成されたトランザクショントークンの妥当性を検証し, |
|---|
| 428 | * 不正な場合はエラー画面へ遷移する. |
|---|
| 429 | * |
|---|
| 430 | * この関数は, 基本的に init() 関数で呼び出され, POST アクセスの場合は自動的に |
|---|
| 431 | * トランザクショントークンを検証する. |
|---|
| 432 | * ページによって検証タイミングなどを制御する必要がある場合は, この関数を |
|---|
| 433 | * オーバーライドし, 個別に設定を行うこと. |
|---|
| 434 | * |
|---|
| 435 | * @access protected |
|---|
| 436 | * @param boolean $is_admin 管理画面でエラー表示をする場合 true |
|---|
| 437 | * @return void |
|---|
| 438 | */ |
|---|
| 439 | public function doValidToken($is_admin = false) |
|---|
| 440 | { |
|---|
| 441 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|---|
| 442 | if (!SC_Helper_Session_Ex::isValidToken(false)) { |
|---|
| 443 | if ($is_admin) { |
|---|
| 444 | SC_Utils_Ex::sfDispError(INVALID_MOVE_ERRORR); |
|---|
| 445 | } else { |
|---|
| 446 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); |
|---|
| 447 | } |
|---|
| 448 | SC_Response_Ex::actionExit(); |
|---|
| 449 | } |
|---|
| 450 | } |
|---|
| 451 | } |
|---|
| 452 | |
|---|
| 453 | /** |
|---|
| 454 | * トランザクショントークンを取得し, 設定する. |
|---|
| 455 | * |
|---|
| 456 | * @access protected |
|---|
| 457 | * @return void |
|---|
| 458 | */ |
|---|
| 459 | public function setTokenTo() |
|---|
| 460 | { |
|---|
| 461 | $this->transactionid = SC_Helper_Session_Ex::getToken(); |
|---|
| 462 | } |
|---|
| 463 | |
|---|
| 464 | /** |
|---|
| 465 | * 前方互換用 |
|---|
| 466 | * |
|---|
| 467 | * @deprecated 2.12.0 GC_Utils_Ex::gfPrintLog を使用すること |
|---|
| 468 | */ |
|---|
| 469 | public function log($mess, $log_level) |
|---|
| 470 | { |
|---|
| 471 | trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); |
|---|
| 472 | // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する |
|---|
| 473 | if ($log_level === 'Debug' && DEBUG_MODE === false) { |
|---|
| 474 | return; |
|---|
| 475 | } |
|---|
| 476 | |
|---|
| 477 | // ログ出力 |
|---|
| 478 | GC_Utils_Ex::gfPrintLog($mess, '', true); |
|---|
| 479 | } |
|---|
| 480 | |
|---|
| 481 | /** |
|---|
| 482 | * デバック出力を行う. |
|---|
| 483 | * |
|---|
| 484 | * デバック用途のみに使用すること. |
|---|
| 485 | * |
|---|
| 486 | * @access protected |
|---|
| 487 | * @param mixed $val デバックする要素 |
|---|
| 488 | * @return void |
|---|
| 489 | */ |
|---|
| 490 | public function p($val) |
|---|
| 491 | { |
|---|
| 492 | SC_Utils_Ex::sfPrintR($val); |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | /** |
|---|
| 496 | * POST に限定された mode か検証する。 |
|---|
| 497 | * |
|---|
| 498 | * POST 以外で、POST に限定された mode を実行しようとした場合、落とす。 |
|---|
| 499 | * @return void |
|---|
| 500 | */ |
|---|
| 501 | public function checkLimitPostMode() |
|---|
| 502 | { |
|---|
| 503 | if ($_SERVER['REQUEST_METHOD'] !== 'POST' && in_array($mode = $this->getMode(), $this->arrLimitPostMode)) { |
|---|
| 504 | $msg = "REQUEST_METHOD=[{$_SERVER['REQUEST_METHOD']}]では実行不能な mode=[$mode] が指定されました。"; |
|---|
| 505 | trigger_error($msg, E_USER_ERROR); |
|---|
| 506 | } |
|---|
| 507 | } |
|---|
| 508 | } |
|---|