source: branches/feature-module-update/data/conf/conf.php @ 15708

Revision 15708, 2.3 KB checked in by nanasess, 17 years ago (diff)
  • php_ini.inc を conf.php に移植
  • conf.php にて, mtb_constants.php の再生成ができるように対応
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/**
3 *
4 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 */
9
10$CONF_PHP_PATH = realpath( dirname( __FILE__) );
11require_once($CONF_PHP_PATH ."/../install.php");
12require_once($CONF_PHP_PATH ."/core.php" );
13
14/**
15 * エラーレベル設定
16 *
17 * ・推奨値
18 *   開発時 - E_ALL
19 *   運用時 - E_ALL & ~E_NOTICE
20 */
21//error_reporting(E_ALL & ~E_NOTICE);
22error_reporting(E_ALL);
23
24// 定数を設定する
25defineConstants();
26
27/**
28 * マルチバイト文字列設定
29 *
30 * TODO SJIS-win や, eucJP-win への対応
31 */
32ini_set("mbstring.http_input", CHAR_CODE);
33ini_set("mbstring.http_output", CHAR_CODE);
34ini_set("auto_detect_line_endings", 1);
35ini_set("default_charset", CHAR_CODE);
36ini_set("mbstring.internal_encoding", CHAR_CODE);
37ini_set("mbstring.detect_order", "auto");
38ini_set("mbstring.substitute_character", "none");
39
40/**
41 * 定数を設定する.
42 *
43 * 注意: この関数を外部で使用することを推奨しません.
44 *
45 * mtb_constants.php を読み込んで定数を設定する.
46 * キャッシュディレクトリに存在しない場合は, インストーラからコピーする.
47 *
48 * @access private
49 * @return void
50 */
51function defineConstants() {
52    $CONF_PHP_PATH = realpath( dirname( __FILE__) );
53
54    $errorMessage = "data/conf/cache/mtb_constants.php が生成できません";
55    // 定数を設定
56    if (is_file($CONF_PHP_PATH . "/cache/mtb_constants.php")) {
57        require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
58
59    // キャッシュが無ければ, インストーラからコピー
60    } elseif (is_file($CONF_PHP_PATH
61                      . "/../" . DATA_DIR2HTML . "install/mtb_constants.php")) {
62
63        $mtb_constants = file_get_contents($CONF_PHP_PATH
64                                           . "/../" . DATA_DIR2HTML
65                                           . "install/mtb_constants.php");
66        $handle = fopen($CONF_PHP_PATH . "/cache/mtb_constants.php", "w");
67        if (!$handle) {
68            die($errorMessage);
69        }
70        if (fwrite($handle, $mtb_constants) === false) {
71            die($errorMessage);
72        }
73        fclose($handle);
74
75        require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
76    } else {
77        die("html/install/mtb_constants.php が存在しません.");
78    }
79}
80?>
Note: See TracBrowser for help on using the repository browser.