[16506] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[20764] | 5 | * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved. |
---|
[16506] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 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. |
---|
[16506] | 22 | */ |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * アプリケーションの初期設定クラス. |
---|
| 26 | * |
---|
| 27 | * @author LOCKON CO.,LTD. |
---|
| 28 | * @version $Id$ |
---|
| 29 | */ |
---|
| 30 | class SC_Initial { |
---|
| 31 | |
---|
| 32 | // {{{ cunstructor |
---|
| 33 | |
---|
| 34 | /** |
---|
| 35 | * コンストラクタ. |
---|
| 36 | */ |
---|
[21767] | 37 | function __construct() { |
---|
[16506] | 38 | |
---|
| 39 | /** EC-CUBEのバージョン */ |
---|
[21796] | 40 | define('ECCUBE_VERSION', '2.12.0-beta2'); |
---|
[16506] | 41 | } |
---|
| 42 | |
---|
| 43 | // }}} |
---|
| 44 | // {{{ functions |
---|
| 45 | |
---|
| 46 | /** |
---|
| 47 | * 初期設定を行う. |
---|
| 48 | * |
---|
| 49 | * @access protected |
---|
| 50 | * @return void |
---|
| 51 | */ |
---|
| 52 | function init() { |
---|
| 53 | $this->requireInitialConfig(); |
---|
[21310] | 54 | $this->defineDSN(); // requireInitialConfig メソッドより後で実行 |
---|
[17605] | 55 | $this->defineDirectoryIndex(); |
---|
[21460] | 56 | $this->defineConstants(); |
---|
| 57 | $this->defineParameter(); // defineDirectoryIndex メソッドより後で実行 |
---|
| 58 | $this->complementParameter(); // defineConstants メソッドより後で実行 |
---|
[21310] | 59 | $this->phpconfigInit(); // defineConstants メソッドより後で実行 |
---|
| 60 | $this->createCacheDir(); // defineConstants メソッドより後で実行 |
---|
[19760] | 61 | $this->stripslashesDeepGpc(); |
---|
[21310] | 62 | $this->resetSuperglobalsRequest(); // stripslashesDeepGpc メソッドより後で実行 |
---|
[21658] | 63 | $this->setTimezone(); // 本当はエラーハンドラーより先に読みたい気も |
---|
[16506] | 64 | } |
---|
| 65 | |
---|
| 66 | /** |
---|
[19713] | 67 | * 初期設定ファイルを読み込み, パスの設定を行う. |
---|
[16506] | 68 | * |
---|
| 69 | * @access protected |
---|
| 70 | * @return void |
---|
| 71 | */ |
---|
| 72 | function requireInitialConfig() { |
---|
| 73 | |
---|
[19937] | 74 | define('CONFIG_REALFILE', realpath(dirname(__FILE__)) . '/../config/config.php'); |
---|
| 75 | if (file_exists(CONFIG_REALFILE)) { |
---|
[20534] | 76 | require_once CONFIG_REALFILE; |
---|
[19937] | 77 | } |
---|
[16506] | 78 | } |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * DSN を定義する. |
---|
| 82 | * |
---|
| 83 | * @access protected |
---|
| 84 | * @return void |
---|
| 85 | */ |
---|
| 86 | function defineDSN() { |
---|
[21527] | 87 | if (defined('DB_TYPE') && defined('DB_USER') && defined('DB_PASSWORD') |
---|
| 88 | && defined('DB_SERVER') && defined('DB_PORT') && defined('DB_NAME') |
---|
| 89 | ) { |
---|
| 90 | $dsn = DB_TYPE . '://' . DB_USER . ':' . DB_PASSWORD . '@' . DB_SERVER . ':' . DB_PORT . '/' . DB_NAME; |
---|
[16506] | 91 | /** サイト用DB */ |
---|
[21527] | 92 | define('DEFAULT_DSN', $dsn); |
---|
[16506] | 93 | } |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | /** |
---|
[21310] | 97 | * @deprecated |
---|
[21258] | 98 | */ |
---|
| 99 | function setErrorReporting() { |
---|
| 100 | error_reporting(E_ALL & ~E_NOTICE); |
---|
| 101 | // PHP 5.3.0対応 |
---|
| 102 | if (error_reporting() > 6143) { |
---|
| 103 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | /** |
---|
[16506] | 108 | * マルチバイト文字列設定を行う. |
---|
| 109 | * |
---|
| 110 | * TODO SJIS-win や, eucJP-win への対応 |
---|
| 111 | * |
---|
| 112 | * @access protected |
---|
| 113 | * @return void |
---|
| 114 | */ |
---|
[19850] | 115 | function phpconfigInit() { |
---|
[21264] | 116 | ini_set('html_errors', '1'); |
---|
[19937] | 117 | ini_set('mbstring.http_input', CHAR_CODE); |
---|
| 118 | ini_set('mbstring.http_output', CHAR_CODE); |
---|
| 119 | ini_set('auto_detect_line_endings', 1); |
---|
| 120 | ini_set('default_charset', CHAR_CODE); |
---|
| 121 | ini_set('mbstring.detect_order', 'auto'); |
---|
| 122 | ini_set('mbstring.substitute_character', 'none'); |
---|
[18795] | 123 | |
---|
[17347] | 124 | mb_language('ja'); // mb_internal_encoding() より前に |
---|
| 125 | // TODO 他に mb_language() している箇所の削除を検討 |
---|
| 126 | // TODO .htaccess の mbstring.language を削除できないか検討 |
---|
[18795] | 127 | |
---|
[17347] | 128 | mb_internal_encoding(CHAR_CODE); // mb_language() より後で |
---|
[18795] | 129 | |
---|
[19937] | 130 | ini_set('arg_separator.output', '&'); |
---|
[20540] | 131 | |
---|
[17067] | 132 | //ロケールを明示的に設定 |
---|
[20811] | 133 | $res = setlocale(LC_ALL, LOCALE); |
---|
[21441] | 134 | if ($res === FALSE) { |
---|
[20811] | 135 | // TODO: Windows上のロケール設定が正常に働かない場合があることに暫定的に対応 |
---|
| 136 | // ''を指定するとApache実行環境の環境変数が使われる |
---|
| 137 | // See also: http://php.net/manual/ja/function.setlocale.php |
---|
| 138 | setlocale(LC_ALL, ''); |
---|
| 139 | } |
---|
[16506] | 140 | } |
---|
| 141 | |
---|
| 142 | /** |
---|
[19998] | 143 | * 定数 DIR_INDEX_PATH を設定する. |
---|
[17605] | 144 | * |
---|
| 145 | * @access protected |
---|
| 146 | * @return void |
---|
| 147 | */ |
---|
| 148 | function defineDirectoryIndex() { |
---|
[18795] | 149 | |
---|
[17605] | 150 | // DirectoryIndex の実ファイル名 |
---|
| 151 | if (!defined('DIR_INDEX_FILE')) { |
---|
| 152 | define('DIR_INDEX_FILE', 'index.php'); |
---|
| 153 | } |
---|
[18795] | 154 | |
---|
[19998] | 155 | $useFilenameDirIndex = is_bool(USE_FILENAME_DIR_INDEX) |
---|
| 156 | ? USE_FILENAME_DIR_INDEX |
---|
[20047] | 157 | : (isset($_SERVER['SERVER_SOFTWARE']) ? substr($_SERVER['SERVER_SOFTWARE'], 0, 13) == 'Microsoft-IIS' : false) |
---|
[19998] | 158 | ; |
---|
| 159 | |
---|
[17605] | 160 | // DIR_INDEX_FILE にアクセスする時の URL のファイル名部を定義する |
---|
[19998] | 161 | if ($useFilenameDirIndex === true) { |
---|
[17605] | 162 | // ファイル名を使用する |
---|
[19998] | 163 | define('DIR_INDEX_PATH', DIR_INDEX_FILE); |
---|
[17605] | 164 | } else { |
---|
| 165 | // ファイル名を使用しない |
---|
[19998] | 166 | define('DIR_INDEX_PATH', ''); |
---|
[17605] | 167 | } |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | /** |
---|
[21460] | 171 | * パラメータを設定する. |
---|
[16506] | 172 | * |
---|
[21460] | 173 | * mtb_constants.php を読み込んで定数として定義する. |
---|
[16506] | 174 | * キャッシュディレクトリに存在しない場合は, 初期データからコピーする. |
---|
| 175 | * |
---|
| 176 | * @access protected |
---|
| 177 | * @return void |
---|
| 178 | */ |
---|
[21460] | 179 | function defineParameter() { |
---|
[16506] | 180 | |
---|
[20538] | 181 | $errorMessage |
---|
| 182 | = '<div style="color: #F00; font-weight: bold; background-color: #FEB; text-align: center">' |
---|
[19805] | 183 | . CACHE_REALDIR |
---|
[20538] | 184 | . ' にユーザ書込み権限(777等)を付与して下さい。</div>'; |
---|
[16506] | 185 | |
---|
| 186 | // 定数を設定 |
---|
[21514] | 187 | if (is_file(CACHE_REALDIR . 'mtb_constants.php')) { |
---|
[20534] | 188 | require_once CACHE_REALDIR . 'mtb_constants.php'; |
---|
[16506] | 189 | |
---|
| 190 | // キャッシュが無ければ, 初期データからコピー |
---|
[21514] | 191 | } elseif (is_file(CACHE_REALDIR . '../mtb_constants_init.php')) { |
---|
[16506] | 192 | |
---|
[21514] | 193 | $mtb_constants = file_get_contents(CACHE_REALDIR . '../mtb_constants_init.php'); |
---|
[19805] | 194 | if (is_writable(CACHE_REALDIR)) { |
---|
[21514] | 195 | $handle = fopen(CACHE_REALDIR . 'mtb_constants.php', 'w'); |
---|
[16506] | 196 | if (!$handle) { |
---|
| 197 | die($errorMessage); |
---|
| 198 | } |
---|
| 199 | if (fwrite($handle, $mtb_constants) === false) { |
---|
| 200 | die($errorMessage); |
---|
| 201 | } |
---|
| 202 | fclose($handle); |
---|
| 203 | |
---|
[20534] | 204 | require_once CACHE_REALDIR . 'mtb_constants.php'; |
---|
[16506] | 205 | } else { |
---|
| 206 | die($errorMessage); |
---|
| 207 | } |
---|
| 208 | } else { |
---|
[21514] | 209 | die(CACHE_REALDIR . '../mtb_constants_init.php が存在しません'); |
---|
[16506] | 210 | } |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | /** |
---|
[20970] | 214 | * パラメーターの補完 |
---|
[20947] | 215 | * |
---|
| 216 | * ソースのみ差し替えたバージョンアップを考慮したもの。 |
---|
[21460] | 217 | * $this->defineIfNotDefined() で定義することを想定 |
---|
[20947] | 218 | * |
---|
| 219 | * @access protected |
---|
| 220 | * @return void |
---|
| 221 | */ |
---|
[21460] | 222 | function complementParameter() { |
---|
[20947] | 223 | } |
---|
| 224 | |
---|
| 225 | /** |
---|
[16506] | 226 | * 各種キャッシュディレクトリを生成する. |
---|
| 227 | * |
---|
| 228 | * Smarty キャッシュディレクトリを生成する. |
---|
| 229 | * |
---|
| 230 | * @access protected |
---|
| 231 | * @return void |
---|
| 232 | */ |
---|
| 233 | function createCacheDir() { |
---|
[21480] | 234 | if (defined('HTML_REALDIR')) { |
---|
[17672] | 235 | umask(0); |
---|
[19987] | 236 | if (!file_exists(COMPILE_REALDIR)) { |
---|
| 237 | mkdir(COMPILE_REALDIR); |
---|
[16506] | 238 | } |
---|
| 239 | |
---|
[19805] | 240 | if (!file_exists(MOBILE_COMPILE_REALDIR)) { |
---|
| 241 | mkdir(MOBILE_COMPILE_REALDIR); |
---|
[16506] | 242 | } |
---|
| 243 | |
---|
[19805] | 244 | if (!file_exists(SMARTPHONE_COMPILE_REALDIR)) { |
---|
| 245 | mkdir(SMARTPHONE_COMPILE_REALDIR); |
---|
[19713] | 246 | } |
---|
| 247 | |
---|
[19805] | 248 | if (!file_exists(COMPILE_ADMIN_REALDIR)) { |
---|
| 249 | mkdir(COMPILE_ADMIN_REALDIR); |
---|
[16506] | 250 | } |
---|
| 251 | } |
---|
| 252 | } |
---|
[18287] | 253 | |
---|
| 254 | /** |
---|
[21460] | 255 | * 定数定義 |
---|
[18287] | 256 | * |
---|
| 257 | * @access protected |
---|
| 258 | * @return void |
---|
| 259 | */ |
---|
[21460] | 260 | function defineConstants() { |
---|
[18287] | 261 | // LC_Page_Error用 |
---|
| 262 | /** 指定商品ページがない */ |
---|
| 263 | define('PRODUCT_NOT_FOUND', 1); |
---|
| 264 | /** カート内が空 */ |
---|
| 265 | define('CART_EMPTY', 2); |
---|
| 266 | /** ページ推移エラー */ |
---|
| 267 | define('PAGE_ERROR', 3); |
---|
| 268 | /** 購入処理中のカート商品追加エラー */ |
---|
| 269 | define('CART_ADD_ERROR', 4); |
---|
| 270 | /** 他にも購入手続きが行われた場合 */ |
---|
| 271 | define('CANCEL_PURCHASE', 5); |
---|
| 272 | /** 指定カテゴリページがない */ |
---|
| 273 | define('CATEGORY_NOT_FOUND', 6); |
---|
| 274 | /** ログインに失敗 */ |
---|
| 275 | define('SITE_LOGIN_ERROR', 7); |
---|
| 276 | /** 会員専用ページへのアクセスエラー */ |
---|
| 277 | define('CUSTOMER_ERROR', 8); |
---|
| 278 | /** 購入時の売り切れエラー */ |
---|
| 279 | define('SOLD_OUT', 9); |
---|
| 280 | /** カート内商品の読込エラー */ |
---|
| 281 | define('CART_NOT_FOUND', 10); |
---|
| 282 | /** ポイントの不足 */ |
---|
| 283 | define('LACK_POINT', 11); |
---|
| 284 | /** 仮登録者がログインに失敗 */ |
---|
| 285 | define('TEMP_LOGIN_ERROR', 12); |
---|
| 286 | /** URLエラー */ |
---|
| 287 | define('URL_ERROR', 13); |
---|
| 288 | /** ファイル解凍エラー */ |
---|
| 289 | define('EXTRACT_ERROR', 14); |
---|
| 290 | /** FTPダウンロードエラー */ |
---|
| 291 | define('FTP_DOWNLOAD_ERROR', 15); |
---|
| 292 | /** FTPログインエラー */ |
---|
| 293 | define('FTP_LOGIN_ERROR', 16); |
---|
| 294 | /** FTP接続エラー */ |
---|
| 295 | define('FTP_CONNECT_ERROR', 17); |
---|
| 296 | /** DB作成エラー */ |
---|
| 297 | define('CREATE_DB_ERROR', 18); |
---|
| 298 | /** DBインポートエラー */ |
---|
| 299 | define('DB_IMPORT_ERROR', 19); |
---|
| 300 | /** 設定ファイル存在エラー */ |
---|
| 301 | define('FILE_NOT_FOUND', 20); |
---|
| 302 | /** 書き込みエラー */ |
---|
| 303 | define('WRITE_FILE_ERROR', 21); |
---|
| 304 | /** DB接続エラー */ |
---|
| 305 | define('DB_CONNECT_ERROR', 22); |
---|
[21460] | 306 | /** ダウンロードファイル存在エラー */ |
---|
| 307 | define('DOWNFILE_NOT_FOUND', 22); |
---|
[18287] | 308 | /** フリーメッセージ */ |
---|
| 309 | define('FREE_ERROR_MSG', 999); |
---|
| 310 | |
---|
| 311 | // LC_Page_Error_DispError用 |
---|
| 312 | /** ログイン失敗 */ |
---|
| 313 | define('LOGIN_ERROR', 1); |
---|
| 314 | /** アクセス失敗(タイムアウト等) */ |
---|
| 315 | define('ACCESS_ERROR', 2); |
---|
| 316 | /** アクセス権限違反 */ |
---|
| 317 | define('AUTH_ERROR', 3); |
---|
| 318 | /** 不正な遷移エラー */ |
---|
| 319 | define('INVALID_MOVE_ERRORR', 4); |
---|
[21460] | 320 | |
---|
| 321 | // オーナーズストア通信関連 |
---|
| 322 | /** オーナーズストア通信ステータス */ |
---|
[21480] | 323 | define('OSTORE_STATUS_ERROR', 'ERROR'); |
---|
[21460] | 324 | /** オーナーズストア通信ステータス */ |
---|
[21480] | 325 | define('OSTORE_STATUS_SUCCESS', 'SUCCESS'); |
---|
[21460] | 326 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 327 | define('OSTORE_E_UNKNOWN', '1000'); |
---|
[21460] | 328 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 329 | define('OSTORE_E_INVALID_PARAM', '1001'); |
---|
[21460] | 330 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 331 | define('OSTORE_E_NO_CUSTOMER', '1002'); |
---|
[21460] | 332 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 333 | define('OSTORE_E_WRONG_URL_PASS', '1003'); |
---|
[21460] | 334 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 335 | define('OSTORE_E_NO_PRODUCTS', '1004'); |
---|
[21460] | 336 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 337 | define('OSTORE_E_NO_DL_DATA', '1005'); |
---|
[21460] | 338 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 339 | define('OSTORE_E_DL_DATA_OPEN', '1006'); |
---|
[21460] | 340 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 341 | define('OSTORE_E_DLLOG_AUTH', '1007'); |
---|
[21460] | 342 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 343 | define('OSTORE_E_C_ADMIN_AUTH', '2001'); |
---|
[21460] | 344 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 345 | define('OSTORE_E_C_HTTP_REQ', '2002'); |
---|
[21460] | 346 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 347 | define('OSTORE_E_C_HTTP_RESP', '2003'); |
---|
[21460] | 348 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 349 | define('OSTORE_E_C_FAILED_JSON_PARSE', '2004'); |
---|
[21460] | 350 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 351 | define('OSTORE_E_C_NO_KEY', '2005'); |
---|
[21460] | 352 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 353 | define('OSTORE_E_C_INVALID_ACCESS', '2006'); |
---|
[21460] | 354 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 355 | define('OSTORE_E_C_INVALID_PARAM', '2007'); |
---|
[21460] | 356 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 357 | define('OSTORE_E_C_AUTOUP_DISABLE', '2008'); |
---|
[21460] | 358 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 359 | define('OSTORE_E_C_PERMISSION', '2009'); |
---|
[21460] | 360 | /** オーナーズストア通信エラーコード */ |
---|
[21481] | 361 | define('OSTORE_E_C_BATCH_ERR', '2010'); |
---|
[21460] | 362 | |
---|
| 363 | // プラグイン関連 |
---|
| 364 | /** プラグインの状態:アップロード済み */ |
---|
[21481] | 365 | define('PLUGIN_STATUS_UPLOADED', '1'); |
---|
[21460] | 366 | /** プラグインの状態:インストール済み */ |
---|
[21481] | 367 | define('PLUGIN_STATUS_INSTALLED', '2'); |
---|
[21460] | 368 | /** プラグイン有効/無効:有効 */ |
---|
[21481] | 369 | define('PLUGIN_ENABLE_TRUE', '1'); |
---|
[21460] | 370 | /** プラグイン有効/無効:無効 */ |
---|
[21481] | 371 | define('PLUGIN_ENABLE_FALSE', '2'); |
---|
[21460] | 372 | |
---|
| 373 | // CSV入出力関連 |
---|
| 374 | /** CSV入出力列設定有効無効フラグ: 有効 */ |
---|
| 375 | define('CSV_COLUMN_STATUS_FLG_ENABLE', 1); |
---|
| 376 | /** CSV入出力列設定有効無効フラグ: 無効 */ |
---|
| 377 | define('CSV_COLUMN_STATUS_FLG_DISABLE', 2); |
---|
| 378 | /** CSV入出力列設定読み書きフラグ: 読み書き可能 */ |
---|
| 379 | define('CSV_COLUMN_RW_FLG_READ_WRITE', 1); |
---|
| 380 | /** CSV入出力列設定読み書きフラグ: 読み込みのみ可能 */ |
---|
| 381 | define('CSV_COLUMN_RW_FLG_READ_ONLY', 2); |
---|
| 382 | /** CSV入出力列設定読み書きフラグ: キー列 */ |
---|
| 383 | define('CSV_COLUMN_RW_FLG_KEY_FIELD', 3); |
---|
| 384 | |
---|
| 385 | // 配置ID |
---|
| 386 | /** 配置ID: 未使用 */ |
---|
| 387 | define('TARGET_ID_UNUSED', 0); |
---|
| 388 | /** 配置ID: LeftNavi */ |
---|
| 389 | define('TARGET_ID_LEFT', 1); |
---|
| 390 | /** 配置ID: MainHead */ |
---|
| 391 | define('TARGET_ID_MAIN_HEAD', 2); |
---|
| 392 | /** 配置ID: RightNavi */ |
---|
| 393 | define('TARGET_ID_RIGHT', 3); |
---|
| 394 | /** 配置ID: MainFoot */ |
---|
| 395 | define('TARGET_ID_MAIN_FOOT', 4); |
---|
| 396 | /** 配置ID: TopNavi */ |
---|
| 397 | define('TARGET_ID_TOP', 5); |
---|
| 398 | /** 配置ID: BottomNavi */ |
---|
| 399 | define('TARGET_ID_BOTTOM', 6); |
---|
| 400 | /** 配置ID: HeadNavi */ |
---|
| 401 | define('TARGET_ID_HEAD', 7); |
---|
| 402 | /** 配置ID: HeadTopNavi */ |
---|
| 403 | define('TARGET_ID_HEAD_TOP', 8); |
---|
| 404 | /** 配置ID: FooterBottomNavi */ |
---|
| 405 | define('TARGET_ID_FOOTER_BOTTOM', 9); |
---|
| 406 | /** 配置ID: HeaderInternalNavi */ |
---|
| 407 | define('TARGET_ID_HEADER_INTERNAL', 10); |
---|
| 408 | |
---|
| 409 | // 他 |
---|
| 410 | /** アクセス成功 */ |
---|
| 411 | define('SUCCESS', 0); |
---|
| 412 | /** 無制限フラグ: 無制限 */ |
---|
[21481] | 413 | define('UNLIMITED_FLG_UNLIMITED', '1'); |
---|
[21460] | 414 | /** 無制限フラグ: 制限有り */ |
---|
[21481] | 415 | define('UNLIMITED_FLG_LIMITED', '0'); |
---|
[18287] | 416 | } |
---|
[18361] | 417 | |
---|
| 418 | /** |
---|
[20452] | 419 | * クォートされた文字列のクォート部分を再帰的に取り除く. |
---|
[19760] | 420 | * |
---|
| 421 | * {@link http://jp2.php.net/manual/ja/function.get-magic-quotes-gpc.php PHP Manual} の記事を参考に実装。 |
---|
| 422 | * $_REQUEST は後続の処理で再構成されるため、本処理では外している。 |
---|
[20452] | 423 | * この関数は, PHP5以上を対象とし, PHP4 の場合は何もしない. |
---|
| 424 | * |
---|
[19760] | 425 | * @return void |
---|
| 426 | */ |
---|
| 427 | function stripslashesDeepGpc() { |
---|
| 428 | // Strip magic quotes from request data. |
---|
[20452] | 429 | if (get_magic_quotes_gpc() |
---|
| 430 | && version_compare(PHP_VERSION, '5.0.0', '>=')) { |
---|
[19760] | 431 | // Create lamba style unescaping function (for portability) |
---|
| 432 | $quotes_sybase = strtolower(ini_get('magic_quotes_sybase')); |
---|
| 433 | $unescape_function = (empty($quotes_sybase) || $quotes_sybase === 'off') ? 'stripslashes($value)' : 'str_replace("\'\'","\'",$value)'; |
---|
| 434 | $stripslashes_deep = create_function('&$value, $fn', ' |
---|
| 435 | if (is_string($value)) { |
---|
| 436 | $value = ' . $unescape_function . '; |
---|
| 437 | } else if (is_array($value)) { |
---|
| 438 | foreach ($value as &$v) $fn($v, $fn); |
---|
| 439 | } |
---|
| 440 | '); |
---|
| 441 | |
---|
| 442 | // Unescape data |
---|
| 443 | $stripslashes_deep($_POST, $stripslashes_deep); |
---|
| 444 | $stripslashes_deep($_GET, $stripslashes_deep); |
---|
| 445 | $stripslashes_deep($_COOKIE, $stripslashes_deep); |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | |
---|
| 449 | /** |
---|
[18361] | 450 | * スーパーグローバル変数「$_REQUEST」を再セット |
---|
| 451 | * |
---|
| 452 | * variables_order ディレクティブによる差を吸収する。 |
---|
| 453 | * |
---|
| 454 | * @access protected |
---|
| 455 | * @return void |
---|
| 456 | */ |
---|
| 457 | function resetSuperglobalsRequest() { |
---|
| 458 | $_REQUEST = array_merge($_GET, $_POST); |
---|
| 459 | } |
---|
[20947] | 460 | |
---|
| 461 | /** |
---|
| 462 | * 指定された名前の定数が存在しない場合、指定された値で定義 |
---|
| 463 | * |
---|
| 464 | * @param string $name 定数の名前。 |
---|
| 465 | * @param mixed $value 定数の値。 |
---|
[20948] | 466 | * @return void |
---|
[20947] | 467 | */ |
---|
| 468 | function defineIfNotDefined($name, $value = null) { |
---|
| 469 | if (!defined($name)) { |
---|
| 470 | define($name, $value); |
---|
| 471 | } |
---|
| 472 | } |
---|
[21658] | 473 | |
---|
| 474 | /** |
---|
| 475 | * タイムゾーンを設定 |
---|
| 476 | * |
---|
| 477 | * @return void |
---|
| 478 | */ |
---|
| 479 | function setTimezone() { |
---|
| 480 | date_default_timezone_set('Asia/Tokyo'); |
---|
| 481 | } |
---|
[16506] | 482 | } |
---|