[2] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * @copyright 2005-2006 OpenPNE Project |
---|
| 4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | class setup_page_setup extends OpenPNE_Action |
---|
| 8 | { |
---|
| 9 | function execute($requests) |
---|
| 10 | { |
---|
| 11 | $this->_checkEnv(); |
---|
| 12 | return 'success'; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | /** |
---|
| 16 | * 動作環境チェック |
---|
| 17 | * @access private |
---|
| 18 | */ |
---|
| 19 | function _checkEnv() |
---|
| 20 | { |
---|
| 21 | $errors = array(); |
---|
| 22 | |
---|
| 23 | // ENCRYPT_KEY のチェック |
---|
| 24 | if (!(defined('ENCRYPT_KEY') && ENCRYPT_KEY) || |
---|
| 25 | strlen(ENCRYPT_KEY) > 56) |
---|
| 26 | { |
---|
| 27 | $errors[] = 'ENCRYPT_KEYが適切に設定されていません。config.phpの設定を確認してください。'; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | // ディレクトリの書き込み権限のチェック |
---|
| 31 | $dirs = array( |
---|
| 32 | OPENPNE_IMG_CACHE_DIR . '/jpg', |
---|
| 33 | OPENPNE_IMG_CACHE_DIR . '/gif', |
---|
| 34 | OPENPNE_IMG_CACHE_DIR . '/png', |
---|
[305] | 35 | OPENPNE_VAR_DIR . '/function_cache', |
---|
[2] | 36 | OPENPNE_VAR_DIR . '/log', |
---|
| 37 | OPENPNE_VAR_DIR . '/rss_cache', |
---|
| 38 | OPENPNE_VAR_DIR . '/templates_c', |
---|
| 39 | OPENPNE_VAR_DIR . '/tmp', |
---|
| 40 | ); |
---|
| 41 | foreach ($dirs as $dir) { |
---|
| 42 | if (!is_writable($dir)) { |
---|
| 43 | $errors[] = 'ディレクトリの書き込み権限がありません: ' . $dir; |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | if ($errors) { |
---|
| 48 | $this->_displayError($errors); |
---|
| 49 | exit; |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * Smartyを使わずにエラー表示 |
---|
| 55 | * @access private |
---|
| 56 | */ |
---|
| 57 | function _displayError($errors) |
---|
| 58 | { |
---|
| 59 | header('Content-Type: text/html; charset=UTF-8'); |
---|
| 60 | $OPENPNE_VERSION = OPENPNE_VERSION; |
---|
| 61 | |
---|
| 62 | echo <<<EOT |
---|
| 63 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
| 64 | "http://www.w3.org/TR/html4/loose.dtd"> |
---|
| 65 | <html lang="ja"> |
---|
| 66 | <head> |
---|
| 67 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
| 68 | <meta http-equiv="Content-Style-Type" content="text/css"> |
---|
| 69 | <title>OpenPNEセットアップ</title> |
---|
| 70 | <link rel="stylesheet" href="modules/setup/default.css" type="text/css"> |
---|
| 71 | </head> |
---|
| 72 | |
---|
| 73 | <body> |
---|
| 74 | <h1>OpenPNEセットアップ</h1> |
---|
| 75 | |
---|
| 76 | <div>動作環境チェック |
---|
| 77 | <ul class="caution"> |
---|
| 78 | |
---|
| 79 | EOT; |
---|
| 80 | |
---|
| 81 | foreach ((array)$errors as $error) { |
---|
| 82 | echo '<li>' . $error . '</li>' . "\n"; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | echo <<<EOT |
---|
| 86 | </ul> |
---|
| 87 | </div> |
---|
| 88 | |
---|
| 89 | <form action="./" method="get"> |
---|
| 90 | <input type="hidden" name="m" value="setup"> |
---|
| 91 | <input type="submit" class="submit" value=" 再試行 "> |
---|
| 92 | </form> |
---|
| 93 | |
---|
| 94 | <p style="font-size:10pt">Powered by OpenPNE v{$OPENPNE_VERSION}</p> |
---|
| 95 | |
---|
| 96 | </body> |
---|
| 97 | </html> |
---|
| 98 | EOT; |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | ?> |
---|