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

Revision 16304, 3.2 KB checked in by nanasess, 17 years ago (diff)

エラーメッセージ修正

  • 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 */
21error_reporting(E_ALL & ~E_NOTICE);
22//error_reporting(E_ALL);
23
24// 定数を設定する
25defineConstants();
26
27// Smarty コンパイルディレクトリを生成する.
28if (defined("HTML_PATH")) {
29    createCacheDir();
30}
31
32/**
33 * マルチバイト文字列設定
34 *
35 * TODO SJIS-win や, eucJP-win への対応
36 */
37ini_set("mbstring.http_input", CHAR_CODE);
38ini_set("mbstring.http_output", CHAR_CODE);
39ini_set("auto_detect_line_endings", 1);
40ini_set("default_charset", CHAR_CODE);
41ini_set("mbstring.internal_encoding", CHAR_CODE);
42ini_set("mbstring.detect_order", "auto");
43ini_set("mbstring.substitute_character", "none");
44
45/** EC-CUBEのバージョン */
46define('ECCUBE_VERSION', "2.0");
47
48/**
49 * 定数を設定する.
50 *
51 * 注意: この関数を外部で使用することは推奨しません.
52 *
53 * mtb_constants.php を読み込んで定数を設定する.
54 * キャッシュディレクトリに存在しない場合は, 初期データからコピーする.
55 *
56 * @access private
57 * @return void
58 */
59function defineConstants() {
60    $CONF_PHP_PATH = realpath( dirname( __FILE__) );
61    $errorMessage = "<div style='color: #F00; font-weight: bold; "
62        . "background-color: #FEB; text-align: center'>"
63        . $CONF_PHP_PATH
64        . "/cacheにユーザ書込み権限(777等)を付与して下さい。</div>";
65
66    // 定数を設定
67    if (is_file($CONF_PHP_PATH . "/cache/mtb_constants.php")) {
68        require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
69
70    // キャッシュが無ければ, 初期データからコピー
71    } elseif (is_file($CONF_PHP_PATH
72                      . "/mtb_constants_init.php")) {
73
74        $mtb_constants = file_get_contents($CONF_PHP_PATH . "/mtb_constants_init.php");
75        if (is_writable($CONF_PHP_PATH . "/cache/")) {
76            $handle = fopen($CONF_PHP_PATH . "/cache/mtb_constants.php", "w");
77            if (!$handle) {
78                die($errorMessage);
79            }
80            if (fwrite($handle, $mtb_constants) === false) {
81                die($errorMessage);
82            }
83            fclose($handle);
84
85            require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
86        } else {
87            die($errorMessage);
88        }
89    } else {
90        die($CONF_PHP_PATH . "/mtb_constants_init.php");
91    }
92}
93
94/**
95 * 各種キャッシュディレクトリを生成する.
96 *
97 * 注意: この関数を外部で使用することは推奨しません.
98 *
99 * Smarty キャッシュディレクトリを生成する.
100 *
101 * @access private
102 * @return void
103 */
104function createCacheDir() {
105
106    if (!file_exists(COMPILE_DIR)) {
107        mkdir(COMPILE_DIR);
108    }
109
110    if (!file_exists(MOBILE_COMPILE_DIR)) {
111        mkdir(MOBILE_COMPILE_DIR);
112    }
113
114    if (!file_exists(COMPILE_ADMIN_DIR)) {
115        mkdir(COMPILE_ADMIN_DIR);
116    }
117
118    if (!file_exists(COMPILE_FTP_DIR)) {
119        mkdir(COMPILE_FTP_DIR);
120    }
121}
122?>
Note: See TracBrowser for help on using the repository browser.