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