/** * Initialize objects except BitWiki class */ static function init() { // set internal encodings. mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); // set SCRIPTURL if ($_SERVER['SERVER_PORT'] == 443) { $protocol = 'https'; $port = ''; } else { $protocol = 'http'; $port = $_SERVER['SERVER_PORT'] != 80 ? ":{$_SERVER['SERVER_PORT']}" : ''; } define('SCRIPTDIR', $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . mb_substr($_SERVER['SCRIPT_NAME'], 0, mb_strrpos($_SERVER['SCRIPT_NAME'], '/') + 1)); define('SCRIPTURL', $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME']); // check if table is already prepared and create when not exists. $isinstalled = self::installcheck(); // insntaciate classes Vars::init(); AutoLink::init(); BackLink::init(); FuzzyLink::init(); Mail::init(); // install initialize page when table is not prepared. if (!$isinstalled) { self::installpage(); } }
/** * KinoWikiクラスのインスタンスとは関係のないものの初期化。 */ static function init() { //内部エンコードの設定 mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); //SCRIPTURLの設定 if ($_SERVER['SERVER_PORT'] == 443) { $protocol = 'https'; $port = ''; } else { $protocol = 'http'; $port = $_SERVER['SERVER_PORT'] != 80 ? ":{$_SERVER['SERVER_PORT']}" : ''; } define('SCRIPTDIR', $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . mb_substr($_SERVER['SCRIPT_NAME'], 0, mb_strrpos($_SERVER['SCRIPT_NAME'], '/') + 1)); define('SCRIPTURL', $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME']); //テーブルが用意されているかチェックし、用意されていなければ用意する。 $isinstalled = self::installcheck(); //各クラスの初期化 Vars::init(); AutoLink::init(); BackLink::init(); FuzzyLink::init(); Mail::init(); //テーブルが用意されていなかった場合、初期ページを書き込む if (!$isinstalled) { self::installpage(); } }