OSDN Git Service

removed grey skin files
[nucleus-jp/nucleus-jp-ancient.git] / euc / install.php
1 <?php\r
2         /**\r
3           * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
4           * Copyright (C) 2002-2005 The Nucleus Group\r
5           *\r
6           * This program is free software; you can redistribute it and/or\r
7           * modify it under the terms of the GNU General Public License\r
8           * as published by the Free Software Foundation; either version 2\r
9           * of the License, or (at your option) any later version.\r
10           * (see nucleus/documentation/index.html#license for more info)\r
11           * This script will install the Nucleus tables in your SQL-database, and initialize the data in\r
12           * those tables.\r
13           *\r
14           * Below is a friendly way of letting users on non-php systems know that Nucleus won't run there.\r
15           *\r
16           * ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>install.php</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php         */\r
17 \r
18         /*\r
19                 This part of the install.php code allows for customization of the install process.\r
20                 When distributing plugins or skins together with a Nucleus installation, the\r
21                 configuration below will instruct to install them\r
22 \r
23                 -- Start Of Configurable Part --\r
24         */\r
25 \r
26                 // array with names of plugins to install. Plugin files must be present in the nucleus/plugin/\r
27                 // directory.\r
28                 //\r
29                 // example:\r
30                 //     array('NP_TrackBack', 'NP_MemberGoodies')\r
31                 $aConfPlugsToInstall = array('NP_SkinFiles');\r
32 \r
33 \r
34                 // array with skins to install. skins must be present under the skins/ directory with\r
35                 // a subdirectory having the same name that contains a skinbackup.xml file\r
36                 //\r
37                 // example:\r
38                 //     array('base','rsd')\r
39                 $aConfSkinsToImport = array('default');\r
40 \r
41         /*\r
42                 -- End Of Configurable Part --\r
43         */\r
44 \r
45         // don't give warnings for uninitialized vars\r
46         error_reporting(E_ERROR | E_WARNING | E_PARSE);\r
47 \r
48         // make sure there's no unnecessary escaping:\r
49         set_magic_quotes_runtime(0);\r
50 \r
51   // if there are some plugins or skins to import, do not include vars\r
52   // in globalfunctions.php again... so set a flag\r
53         if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0)) {\r
54           global $CONF;\r
55           $CONF['installscript']=1;\r
56         }\r
57   if (phpversion() >= '4.1.0')\r
58           include_once('nucleus/libs/vars4.1.0.php');\r
59   else\r
60           include_once('nucleus/libs/vars4.0.6.php');\r
61 \r
62         // check if mysql support is installed\r
63         if (!function_exists('mysql_query'))\r
64                 _doError('Your PHP version does not have support for MySQL :(');\r
65 \r
66         if (postVar('action') == 'go')\r
67                 doInstall();\r
68         else\r
69                 showInstallForm();\r
70         exit;\r
71 \r
72         function showInstallForm() {\r
73 \r
74                 // 0. pre check if all necessary files exist\r
75                 doCheckFiles();\r
76 \r
77         ?>\r
78         <!DOCTYPE html\r
79         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
80         <html xmlns="http://www.w3.org/1999/xhtml">\r
81         <head>\r
82                 <meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />\r
83                 <title>Nucleus¤Î¥¤¥ó¥¹¥È¡¼¥ë</title>\r
84                 <style type="text/css"><!--\r
85                         @import url('nucleus/documentation/styles/manual.css');\r
86                 --></style>\r
87                 <script type="text/javascript"><!--\r
88                         // function to make sure the submit button only gets pressed once\r
89                         var submitcount=0;\r
90                         function checkSubmit() {\r
91                                 if (submitcount == 0) {\r
92                                         submitcount++;\r
93                                         return true;\r
94                                 } else {\r
95                                         return false;\r
96                                 }\r
97                         }\r
98                 --></script>\r
99         </head>\r
100         <body>\r
101 \r
102   <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
103 \r
104         <form method="post" action="install.php">\r
105 \r
106         <h1>Install Nucleus</h1>\r
107 \r
108         <p>\r
109         ¤³¤Î¥¹¥¯¥ê¥×¥È¤ÏNucleus¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ò¼ê½õ¤±¤·¤Þ¤¹¡£MySQL¥Æ¡¼¥Ö¥ë¤Î¥»¥Ã¥È¥¢¥Ã¥×¤È¡¢<i>config.php</i>¤ËÆþÎϤ¹¤ë¤¿¤á¤Î¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡Êconfig.php¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò0666¤Ë¤·¤Æ¤ª¤±¤Ð¡¢¸å¼Ô¤Îºî¶È¤Ï¼«Æ°Åª¤Ë¹Ô¤ï¤ì¤Þ¤¹¡Ë¡£¤³¤ì¤ò¤Ê¤¹°Ù¤Ë¡¢¤¤¤¯¤Ä¤«¤Î¾ðÊó¤òÆþÎϤ¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£\r
110         </p>\r
111 \r
112         <p>\r
113         ¤¹¤Ù¤Æ¤ÎÍó¤ÎÆþÎϤ¬É¬ÍפǤ¹¡£¥ª¥×¥·¥ç¥ó¾ðÊó¤Ï¥¤¥ó¥¹¥È¡¼¥ë¤¬´°Î»¤·¤¿¤é¡¢Nucleus¤Î´ÉÍýÎΰ褫¤éÀßÄê²Äǽ¤Ç¤¹¡£\r
114         </p>\r
115 \r
116         <h1>PHP &amp; MySQL Versions</h1>\r
117 \r
118         <p>\r
119                 °Ê²¼¤Ï¤¢¤Ê¤¿¤Î¥¦¥§¥Ö¥Û¥¹¥È¤Ë¤ª¤±¤ëPHP¥¤¥ó¥¿¡¼¥×¥ê¥¿¡¼¤ÈMySQL¥µ¡¼¥Ð¡¼¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤¹¡£Nucleus¤Î¥µ¥Ý¡¼¥È¥Õ¥©¡¼¥é¥à¤ËÌäÂê¤òÊó¹ð¤¹¤ë¤È¤­¤Ï¡¢¤³¤Î¾ðÊó¤ò½ñ¤­Åº¤¨¤Æ¤¯¤À¤µ¤¤¡£\r
120         </p>\r
121 \r
122         <ul>\r
123                 <li>PHP: <?php                  echo phpversion();\r
124                         $minVersion = '4.0.6';\r
125 \r
126                         if (phpversion() < $minVersion)\r
127                                 echo ' <span class="warning">Ãí°Õ: Nucleus¤ÎÆ°ºî¤Ë¤Ï¾¯¤Ê¤¯¤È¤â¥Ð¡¼¥¸¥ç¥ó ',$minVersion,' ¤¬É¬ÍפȤµ¤ì¤Þ¤¹</span>';\r
128                 ?></li>\r
129                 <li>MySQL: <?php\r
130                         // note: this piece of code is taken from phpMyAdmin\r
131 \r
132                         $result = @mysql_query('SELECT VERSION() AS version');\r
133                         if ($result != FALSE && @mysql_num_rows($result) > 0) {\r
134                                 $row   = mysql_fetch_array($result);\r
135                                 $match = explode('.', $row['version']);\r
136                         } else {\r
137                                 $result = @mysql_query('SHOW VARIABLES LIKE \'version\'');\r
138                                 if ($result != FALSE && @mysql_num_rows($result) > 0){\r
139                                         $row   = mysql_fetch_row($result);\r
140                                         $match = explode('.', $row[1]);\r
141                                 } else {\r
142                                         $match[0] = '?';\r
143                                         $match[1] = '?';\r
144                                         $match[2] = '?';\r
145                                 }\r
146                         }\r
147 \r
148                         if (!isset($match) || !isset($match[0])) {\r
149                                 $match[0] = 3;\r
150                         }\r
151                         if (!isset($match[1])) {\r
152                                 $match[1] = 21;\r
153                         }\r
154                         if (!isset($match[2])) {\r
155                                 $match[2] = 0;\r
156                         }\r
157 \r
158                         if ($match[0] != '?') {\r
159                                 $match[0] = intval($match[0]);\r
160                                 $match[1] = intval($match[1]);\r
161                         }\r
162 \r
163                         $mysqlVersion = implode($match, '.');\r
164                         $minVersion = '3.23';\r
165 \r
166                         echo $mysqlVersion;\r
167 \r
168                         if ($mysqlVersion < $minVersion)\r
169                                 echo ' <span class="warning">Ãí°Õ: Nucleus¤ÎÆ°ºî¤Ë¤Ï¾¯¤Ê¤¯¤È¤â¥Ð¡¼¥¸¥ç¥ó ',$minVersion,' ¤¬É¬ÍפȤµ¤ì¤Þ¤¹</span>';\r
170                 ?></li>\r
171         </ul>\r
172 \r
173 <?php\r
174         // tell people how they can have their config file filled out automatically\r
175         if (@file_exists('config.php') && @!is_writable('config.php')) {\r
176 ?>\r
177         <h1><i>config.php</i>¤Î¼«Æ°¥¢¥Ã¥×¥Ç¡¼¥È</h1>\r
178 \r
179         <p>\r
180         ¤â¤·<em>config.php</em>¤ò¼«Æ°Åª¤Ë¹¹¿·¤¹¤ë¤è¤¦¤Ë¤·¤¿¤¤¤Ê¤é¡¢½ñ¤­¹þ¤ß²Äǽ¤Ë¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£<em>config.php</em>¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò<strong>666</strong>¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£Nucleus¤Î¥¤¥ó¥¹¥È¡¼¥ëÀ®¸ù¸å¤Ë¡¢¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò<strong>444</strong>¤ËÌᤵ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡Ê<a href="nucleus/documentation/tips.html#filepermissions">¥Ñ¡¼¥ß¥Ã¥·¥ç¥óÊѹ¹¤Î´Ê°×¥¬¥¤¥É</a>¡Ë¡£\r
181         </p>\r
182 \r
183         <p>\r
184         ¤â¤·¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤Þ¤Ê¤¤¤È¤¤¤¦ÁªÂò¤ò¤·¤¿¡Ê¤¢¤ë¤¤¤Ï¹Ô¤¨¤Ê¤¤¡Ë¾ì¹ç¡§¤´¿´Çۤʤ¯¡£¥¤¥ó¥¹¥È¡¼¥ë¤Î²áÄø¤Ç<em>config.php</em>¤ÎÃæ¿È¤¬Ä󶡤µ¤ì¤Þ¤¹¡£¤Ç¤¹¤«¤é¡¢¤½¤ì¤ò¤´¼«¿È¤Ç¥¢¥Ã¥×¥í¡¼¥É¤·¤Æ¤¯¤À¤µ¤¤¡£\r
185         </p>\r
186 \r
187 <?php } ?>\r
188 \r
189         <h1>MySQL¤Î¥í¥°¥¤¥ó¥Ç¡¼¥¿</h1>\r
190 \r
191         <p>\r
192         MySQL¤Î¥Ç¡¼¥¿¤ò°Ê²¼¤ËÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£¤½¤ì¤é¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¡¦¥Æ¡¼¥Ö¥ë¤òºîÀ®¤·¾ðÊó¤òÆþÎϤ¹¤ë¤¿¤á¤ËɬÍפʤâ¤Î¤Ç¤¹¡£¸å¤Ç¡¢<i>config.php</i>¤Ë¤âµ­Æþ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡Ê¾åµ­¤Î¼«Æ°¥¢¥Ã¥×¥Ç¡¼¥È¤òÍøÍѤ¹¤ë¾ì¹ç¡¢¤½¤Î¼ê½ç¤Ï¾Êά¤µ¤ì¤Þ¤¹¡Ë¡£\r
193         </p>\r
194 \r
195         <p>\r
196         ¤â¤·¤³¤Î¾ðÊ󤬤狼¤é¤Ê¤±¤ì¤Ð¡¢¥·¥¹¥Æ¥à´ÉÍý¼Ô¤«¥Û¥¹¥Æ¥£¥ó¥°¸µ¤ËÏ¢Íí¤ò¤È¤Ã¤Æ¤¯¤À¤µ¤¤¡£¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢¥Û¥¹¥È̾¤Ï'localhost'¤Ç¤¹¡£¤â¤·Nucleus¤¬¤¢¤Ê¤¿¤Î¥µ¡¼¥Ð¤ÎPHPÀßÄ꤫¤é'default MySQL host'¤ò¸¡ÃΤ·¤¿¤Ê¤é¡¢'¥Û¥¹¥È̾'¤Ë´û¤Ëµ­Æþ¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¤Ç¤¹¡£¤â¤Ã¤È¤â¡¢¤³¤Î¾ðÊó¤¬Àµ³Î¤Ç¤¢¤ë¤È¤¤¤¦ÊݾڤϤ¢¤ê¤Þ¤»¤ó¡£\r
197         </p>\r
198 \r
199         <fieldset>\r
200                 <legend>´ðËܤΥǡ¼¥¿¥Ù¡¼¥¹ÀßÄê</legend>\r
201                 <table><tr>\r
202                         <td>¥Û¥¹¥È̾¡§</td>\r
203                         <td><input name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host'))?>" /></td>\r
204                 </tr><tr>\r
205                         <td>¥æ¡¼¥¶¡¼Ì¾¡§</td>\r
206                         <td><input name="mySQL_user" /></td>\r
207                 </tr><tr>\r
208                         <td>¥Ñ¥¹¥ï¡¼¥É¡§</td>\r
209                         <td><input name="mySQL_password" type="password" /></td>\r
210                 </tr><tr>\r
211                         <td>¥Ç¡¼¥¿¥Ù¡¼¥¹Ì¾¡§</td>\r
212                         <td><input name="mySQL_database" /> (<input name="mySQL_create" value="1" type="checkbox" id="mySQL_create"><label for="mySQL_create" />¥Ç¡¼¥¿¥Ù¡¼¥¹¤òºîÀ®¤¹¤ëɬÍפ¬¤¢¤ë</label>)</td>\r
213                 </tr></table>\r
214         </fieldset>\r
215 \r
216         <fieldset>\r
217                 <legend>¹âÅù¤Ê¥Ç¡¼¥¿¥Ù¡¼¥¹ÀßÄê</legend>\r
218                 <table><tr>\r
219                         <td><input name="mySQL_usePrefix" value="1" type="checkbox" id="mySQL_usePrefix"><label for="mySQL_usePrefix" />¥Æ¡¼¥Ö¥ë¡¦¥×¥ê¥Õ¥£¥Ã¥¯¥¹¤òÍøÍÑ</label></td>\r
220                         <td><input name="mySQL_tablePrefix" value="" /></td>\r
221                 </tr></table>\r
222                 <p>°ì¤Ä¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÊ£¿ô¤ÎNucleus¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤ê¡¢¼«Ê¬¤¬²¿¤ò¤ä¤Ã¤Æ¤¤¤ë¤Î¤«Íý²ò¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤ò½ü¤¤¤Æ¤Ï¡¢<strong>¤³¤ì¤òÊѹ¹¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó</strong>¡£</p>\r
223                 <p>Nucleus¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¥Æ¡¼¥Ö¥ë¤Ï¡¢¤³¤Î¥×¥ê¥Õ¥£¥Ã¥¯¥¹¤¬Æ¬¤Ë¤Ä¤­¤Þ¤¹¡£</p>\r
224         </fieldset>\r
225 \r
226         <h1>¥Ç¥£¥ì¥¯¥È¥ê¤ÈURL</h1>\r
227 \r
228         <p>\r
229         ¤³¤Î¥¤¥ó¥¹¥È¡¼¥ë¥¹¥¯¥ê¥×¥È¤ÏNucleus¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ÈURL¤ò¸«¤Ä¤±¤è¤¦¤È¤·¤Þ¤·¤¿¡£²¼¤ÎÃͤò¥Á¥§¥Ã¥¯¤·¤ÆɬÍפʤéÄûÀµ¤·¤Æ¤¯¤À¤µ¤¤¡£¥Õ¥¡¥¤¥ë¤Ø¤Î¥Ñ¥¹¤ÈURL¤Ï¥¹¥é¥Ã¥·¥å'/'¤Ç½ª¤ï¤é¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£\r
230         </p>\r
231 \r
232         <fieldset>\r
233                 <legend>URLs and directories</legend>\r
234                 <table><tr>\r
235                         <td>Site <strong>URL</strong>:</td>\r
236                         <td>\r
237                                         <input name="IndexURL" size="60" value="<?php                                   $url = "http://" . serverVar('HTTP_HOST') . serverVar('PHP_SELF');\r
238                                         $url = str_replace("install.php",'',$url);\r
239                                         $url = str_replace("\\","/",$url);\r
240                                         // add slash at end if necessary\r
241                                         if (!endsWithSlash($url)) $url .= '/';\r
242                                         echo $url;\r
243                                 ?>" />\r
244                         </td>\r
245                 </tr><tr>\r
246                         <td>Admin-area <strong>URL</strong>:</td>\r
247                         <td><input name="AdminURL" size="60" value="<?php                                       if ($url) echo $url . 'nucleus/';\r
248                                 ?>" />\r
249                         </td>\r
250                 </tr><tr>\r
251                         <td>Admin-area <strong>path</strong>:</td>\r
252                         <td><input name="AdminPath" size="60" value="<?php                                      $path = str_replace("install.php",'',serverVar('SCRIPT_FILENAME'));\r
253                                         $path = str_replace("\\","/",$path);\r
254                                         // add slash at end if necessary\r
255                                         if (!endsWithSlash($path)) $path .= '/';\r
256                                         if($path) echo  $path . 'nucleus/';\r
257                                 ?>" />\r
258                         </td>\r
259                 </tr><tr>\r
260                         <td>Media files <strong>URL</strong>:</td>\r
261                         <td><input name="MediaURL" size="60" value="<?php                                       if ($url) echo $url . 'media/';\r
262                                 ?>" />\r
263                         </td>\r
264                 </tr><tr>\r
265                         <td>Media directory <strong>path</strong>:</td>\r
266                         <td><input name="MediaPath" size="60" value="<?php                                      $path = str_replace("install.php",'',serverVar('SCRIPT_FILENAME'));\r
267                                         $path = str_replace("\\","/",$path);\r
268                                         // add slash at end if necessary\r
269                                         if (!endsWithSlash($path)) $path .= '/';\r
270                                         if ($path) echo $path . 'media/';\r
271                                 ?>" />\r
272                         </td>\r
273                 </tr><tr>\r
274                         <td>Extra skin files <strong>URL</strong>:</td>\r
275                         <td><input name="SkinsURL" size="60" value="<?php                                       if ($url) echo $url . 'skins/';\r
276                                 ?>" />\r
277                                 <br />(¥¤¥ó¥Ý¡¼¥È¤µ¤ì¤¿¥¹¥­¥ó¤¬»ÈÍÑ)\r
278                         </td>\r
279                 </tr><tr>\r
280                         <td>Extra skin files directory <strong>path</strong>:</td>\r
281                         <td><input name="SkinsPath" size="60" value="<?php                              $path = str_replace("install.php",'',serverVar('SCRIPT_FILENAME'));\r
282                                 $path = str_replace("\\","/",$path);\r
283                                 // add slash at end if necessary\r
284                                 if (!endsWithSlash($path)) $path .= '/';\r
285                                 if ($path) echo $path . 'skins/';\r
286                                 ?>" />\r
287                                 <br />(¥¤¥ó¥Ý¡¼¥È¤µ¤ì¤¿¥¹¥­¥ó¤Î¥Õ¥¡¥¤¥ëÎà¤òÃÖ¤¯¾ì½ê)\r
288                         </td>\r
289                 </tr><tr>\r
290                         <td>Plugin files <strong>URL</strong>:</td>\r
291                         <td><input name="PluginURL" size="60" value="<?php                                      if ($url) echo $url . 'nucleus/plugins/';\r
292                                 ?>" />\r
293                         </td>\r
294                 </tr><tr>\r
295                         <td>Action <strong>URL</strong>:</td>\r
296                         <td><input name="ActionURL" size="60" value="<?php                                      if ($url) echo $url . 'action.php';\r
297                                 ?>" />\r
298                                 <br />(<tt>action.php</tt>¤Ø¤Îhttp://¤«¤é»Ï¤Þ¤ëURL)\r
299                         </td>\r
300                 </tr></table>\r
301         </fieldset>\r
302 \r
303         <p class="note">\r
304         <strong>ÉÕµ­:</strong> ÁêÂХѥ¹¤Ç¤Ï¤Ê¤¯<strong>ÀäÂХѥ¹¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤</strong>¡£Ä̾ÀäÂХѥ¹¤Ï<tt>/home/username/public_html/</tt>¤Î¤è¤¦¤Ê·Á¤ò¤È¤ê¤Þ¤¹¡£Unix¥·¥¹¥Æ¥à¡Ê¤Û¤È¤ó¤É¤Î¥µ¡¼¥Ð¡¼¤¬¤½¤¦¤Ç¤¹¡Ë¤Ë¤ª¤¤¤Æ¡¢¥Ñ¥¹¤Ï¥¹¥é¥Ã¥·¥å¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£¤â¤·¤³¤ì¤é¤Î¾ðÊóÆþÎϤËÌäÂ꤬À¸¤¸¤¿¤é¡¢¤¢¤Ê¤¿¤Î¥µ¡¼¥Ð´ÉÍý¼Ô¤Ë¤¿¤º¤Í¤ë¤Ù¤­¤Ç¤¹¡£\r
305         </p>\r
306 \r
307         <h1>´ÉÍý¸¢¸Â¤ò¤â¤Ä¥æ¡¼¥¶¡¼</h1>\r
308 \r
309         <p>°Ê²¼¤Ë¡¢¥µ¥¤¥È¤ÎºÇ½é¤Î¥æ¡¼¥¶¡¼¤òºîÀ®¤¹¤ë¤¿¤á¤Î¤¤¤¯¤Ä¤«¤Î¾ðÊó¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£</p>\r
310 \r
311         <fieldset>\r
312                 <legend>´ÉÍý¸¢¸Â¤ò»ý¤Ä¥æ¡¼¥¶¡¼</legend>\r
313                 <table><tr>\r
314                         <td>ɽ¼¨¤µ¤ì¤ë̾Á°¡§</td>\r
315                         <td>\r
316                                 <input name="User_name" value="" />\r
317                                 <small>(µö²Ä¤µ¤ì¤ëʸ»ú¡§a-z ¤È 0-9¡¢ºÇ½é¤ÈºÇ¸å°Ê³°¤Î¥¹¥Ú¡¼¥¹)</small>\r
318                         </td>\r
319                 </tr><tr>\r
320                         <td>ËÜ̾¡Ê¥Ï¥ó¥É¥ë̾¡Ë¡§</td>\r
321                         <td><input name="User_realname" value="" /></td>\r
322                 </tr><tr>\r
323                         <td>¥Ñ¥¹¥ï¡¼¥É¡§</td>\r
324                         <td><input name="User_password" type="password" value="" /></td>\r
325                 </tr><tr>\r
326                         <td>¥Ñ¥¹¥ï¡¼¥É¤Î³Îǧ¡§</td>\r
327                         <td><input name="User_password2" type="password" value="" /></td>\r
328                 </tr><tr>\r
329                         <td>¥á¡¼¥ë¥¢¥É¥ì¥¹¡§</td>\r
330                         <td>\r
331                                 <input name="User_email" value="" />\r
332                                 <small>(ÍøÍѲÄǽ¤Ê¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÆþ¤ì¤Æ¤¯¤À¤µ¤¤)</small>\r
333                         </td>\r
334                 </tr></table>\r
335         </fieldset>\r
336 \r
337         <h1>¥¦¥§¥Ö¥í¥°¤Î¥Ç¡¼¥¿</h1>\r
338 \r
339         <p>°Ê²¼¤Ë¡¢¥Ç¥Õ¥©¥ë¥È¤Îweblog¤òºîÀ®¤¹¤ë¤¿¤á¤Ë¤¤¤¯¤Ä¤«¤Î¾ðÊó¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£¤³¤Îweblog¤Î̾Á°¤Ï¡¢¥µ¥¤¥È̾¤È¤·¤Æ¤âÍøÍѤµ¤ì¤Þ¤¹¡£</p>\r
340 \r
341         <fieldset>\r
342                 <legend>¥¦¥§¥Ö¥í¥°¤Î¥Ç¡¼¥¿</legend>\r
343                 <table><tr>\r
344                         <td>Blog̾¡§</td>\r
345                         <td><input name="Blog_name" size="60" value="My Nucleus CMS" /></td>\r
346                 </tr><tr>\r
347                         <td>Blog¤Îû½Ì̾¡§</td>\r
348                         <td>\r
349                                 <input name="Blog_shortname" value="mynucleuscms" />\r
350                                 <small>(µö²Ä¤µ¤ì¤ëʸ»ú¡§a-z ¤È 0-9¡¢¥¹¥Ú¡¼¥¹¤ÏÉÔ²Ä)</small>\r
351                         </td>\r
352                 </tr></table>\r
353         </fieldset>\r
354 \r
355         <h1>¥Ç¡¼¥¿¤ÎÁ÷¿®</h1>\r
356 \r
357         <p>\r
358         ¾å¤Ë½ñ¤¤¤Æ¤­¤¿¥Ç¡¼¥¿¤¬Àµ¤·¤¤¤«³Î¤«¤á¤Æ¤¯¤À¤µ¤¤¡£¤è¤±¤ì¤Ð¥Ç¡¼¥¿¥Ù¡¼¥¹¡¦¥Æ¡¼¥Ö¥ë¤ÈºÇ½é¤Î¥Ç¡¼¥¿¤òÀßÄꤹ¤ë¤¿¤á¤Ë²¼¤Î¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£¾¯¤·»þ´Ö¤¬¤«¤«¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¤¬¤´¿ÉÊú¤ò¡£<b>¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Î¤Ï°ì²ó¤À¤±¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£</b>\r
359         </p>\r
360 \r
361         <p>\r
362                 <input name="action" value="go" type="hidden" />\r
363                 <input type="submit" value="Nucleus CMS¤Î¥¤¥ó¥¹¥È¡¼¥ë" onclick="return checkSubmit();" />\r
364         </p>\r
365 \r
366         </form>\r
367 \r
368         </body>\r
369         </html>\r
370 \r
371 \r
372         <?php   }\r
373 \r
374         function tableName($unPrefixed)\r
375         {\r
376                 global $mysql_usePrefix, $mysql_prefix;\r
377                 if ($mysql_usePrefix == 1)\r
378                         return $mysql_prefix . $unPrefixed;\r
379                 else\r
380                         return $unPrefixed;\r
381         }\r
382 \r
383         function doInstall() {\r
384                 global $mysql_usePrefix, $mysql_prefix;\r
385 \r
386                 // 0. put all POST-vars into vars\r
387                 $mysql_host             = postVar('mySQL_host');\r
388                 $mysql_user             = postVar('mySQL_user');\r
389                 $mysql_password         = postVar('mySQL_password');\r
390                 $mysql_database         = postVar('mySQL_database');\r
391                 $mysql_create           = postVar('mySQL_create');\r
392                 $mysql_usePrefix        = postVar('mySQL_usePrefix');\r
393                 $mysql_prefix           = postVar('mySQL_tablePrefix');\r
394                 $config_indexurl        = postVar('IndexURL');\r
395                 $config_adminurl        = postVar('AdminURL');\r
396                 $config_adminpath       = postVar('AdminPath');\r
397                 $config_mediaurl        = postVar('MediaURL');\r
398                 $config_skinsurl        = postVar('SkinsURL');\r
399                 $config_pluginurl       = postVar('PluginURL');\r
400                 $config_actionurl       = postVar('ActionURL');\r
401                 $config_mediapath       = postVar('MediaPath');\r
402                 $config_skinspath       = postVar('SkinsPath');\r
403                 $user_name                      = postVar('User_name');\r
404                 $user_realname          = postVar('User_realname');\r
405                 $user_password          = postVar('User_password');\r
406                 $user_password2         = postVar('User_password2');\r
407                 $user_email             = postVar('User_email');\r
408                 $blog_name                      = postVar('Blog_name');\r
409                 $blog_shortname         = postVar('Blog_shortname');\r
410                 $config_adminemail      = $user_email;\r
411                 $config_sitename        = $blog_name;\r
412 \r
413 \r
414                 $config_indexurl        = str_replace("\\","/",$config_indexurl);\r
415                 $config_adminurl        = str_replace("\\","/",$config_adminurl);\r
416                 $config_mediaurl        = str_replace("\\","/",$config_mediaurl);\r
417                 $config_skinsurl        = str_replace("\\","/",$config_skinsurl);\r
418                 $config_pluginurl       = str_replace("\\","/",$config_pluginurl);\r
419                 $config_actionurl       = str_replace("\\","/",$config_actionurl);\r
420                 $config_adminpath       = str_replace("\\","/",$config_adminpath);\r
421                 $config_skinspath       = str_replace("\\","/",$config_skinspath);\r
422 \r
423                 // 1. check all the data\r
424                 $errors = array();\r
425 \r
426                 if (!$mysql_database)\r
427                         array_push($errors,"mySQL database name missing");\r
428                 if (($mysql_usePrefix == 1) && (strlen($mysql_prefix) == 0))\r
429                         array_push($errors,"mySQL prefix was selected, but prefix is empty");\r
430                 if (($mysql_usePrefix == 1) && (!eregi('^[a-zA-Z0-9_]+$', $mysql_prefix)))\r
431                         array_push($errors,"mySQL prefix should only contain characters from the ranges A-Z, a-z, 0-9 or underscores");\r
432                 if (!endsWithSlash($config_indexurl) || !endsWithSlash($config_adminurl)\r
433                                                      || !endsWithSlash($config_mediaurl)\r
434                                                      || !endsWithSlash($config_pluginurl)\r
435                                                      || !endsWithSlash($config_skinsurl)\r
436                                                                 // TODO: add action.php check\r
437                     )\r
438                         array_push($errors,"One of the URLs does not end with a slash, or action url does not end with 'action.php'");\r
439                 if (!endsWithSlash($config_adminpath))\r
440                         array_push($errors,"The path of the administration area does not end with a slash");\r
441                 if (!endsWithSlash($config_mediapath))\r
442                         array_push($errors,"The media path does not end with a slash");\r
443                 if (!endsWithSlash($config_skinspath))\r
444                         array_push($errors,"The skins path does not end with a slash");\r
445                 if (!is_dir($config_adminpath))\r
446                         array_push($errors,"The path of the administration area does not exist on your server");\r
447                 if (!_isValidMailAddress($user_email))\r
448                         array_push($errors,"Invalid e-mail address given for user");\r
449                 if (!_isValidDisplayName($user_name))\r
450                         array_push($errors,"User name is not a valid display name (allowed chars: a-zA-Z0-9 and spaces)");\r
451                 if (!$user_password || !$user_password2)\r
452                         array_push($errors, "User password is empty");\r
453                 if ($user_password != $user_password2)\r
454                         array_push($errors, "User password do not match");\r
455                 if (!_isValidShortName($blog_shortname))\r
456                         array_push($errors, "Invalid short name given for blog (allowed chars: a-z0-9, no spaces)");\r
457                 if (sizeof($errors) > 0)\r
458                         showErrorMessages($errors);\r
459 \r
460                 // 2. try to log in to mySQL\r
461                 $connection = @mysql_connect($mysql_host, $mysql_user, $mysql_password);\r
462                 if ($connection == false)\r
463                         _doError("Could not connect to mySQL server: " . mysql_error());\r
464 \r
465                 // 3. try to create database (if needed)\r
466                 if ($mysql_create == 1) {\r
467                         mysql_query("CREATE DATABASE " . $mysql_database) or _doError("Could not create database. Make sure you have the rights to do so. SQL error was: " . mysql_error());\r
468                 }\r
469 \r
470                 // 4. try to select database\r
471                 mysql_select_db($mysql_database) or _doError("Could not select database. Make sure it exists");\r
472 \r
473                 // 5. execute queries\r
474                 $filename = "install.sql";\r
475                 $fd = fopen ($filename, "r");\r
476                 $queries = fread ($fd, filesize ($filename));\r
477                 fclose ($fd);\r
478 \r
479                 $queries = split("(;\n|;\r)",$queries);\r
480 \r
481                 $aTableNames = array(\r
482                         'nucleus_actionlog',\r
483                         'nucleus_ban',\r
484                         'nucleus_blog',\r
485                         'nucleus_category',\r
486                         'nucleus_comment',\r
487                         'nucleus_config',\r
488                         'nucleus_item',\r
489                         'nucleus_karma',\r
490                         'nucleus_member',\r
491                         'nucleus_plugin',\r
492                         'nucleus_skin',\r
493                         'nucleus_template',\r
494                         'nucleus_team',\r
495                         'nucleus_activation',\r
496                         'nucleus_tickets'\r
497 // these are unneeded (one of the replacements above takes care of them)\r
498 //                      'nucleus_plugin_event',\r
499 //                      'nucleus_plugin_option',\r
500 //                      'nucleus_plugin_option_desc',\r
501 //                      'nucleus_skin_desc',\r
502 //                      'nucleus_template_desc',\r
503                 );\r
504                 $aTableNamesPrefixed = array(\r
505                         $mysql_prefix . 'nucleus_actionlog',\r
506                         $mysql_prefix . 'nucleus_ban',\r
507                         $mysql_prefix . 'nucleus_blog',\r
508                         $mysql_prefix . 'nucleus_category',\r
509                         $mysql_prefix . 'nucleus_comment',\r
510                         $mysql_prefix . 'nucleus_config',\r
511                         $mysql_prefix . 'nucleus_item',\r
512                         $mysql_prefix . 'nucleus_karma',\r
513                         $mysql_prefix . 'nucleus_member',\r
514                         $mysql_prefix . 'nucleus_plugin',\r
515                         $mysql_prefix . 'nucleus_skin',\r
516                         $mysql_prefix . 'nucleus_template',\r
517                         $mysql_prefix . 'nucleus_team',\r
518                         $mysql_prefix . 'nucleus_activation',\r
519                         $mysql_prefix . 'nucleus_tickets'\r
520 // these are unneeded (one of the replacements above takes care of them)\r
521 //                      $mysql_prefix . 'nucleus_plugin_event',\r
522 //                      $mysql_prefix . 'nucleus_plugin_option',\r
523 //                      $mysql_prefix . 'nucleus_plugin_option_desc',\r
524 //                      $mysql_prefix . 'nucleus_skin_desc',\r
525 //                      $mysql_prefix . 'nucleus_template_desc',\r
526                 );\r
527 \r
528                 for ($idx = 0;$idx<sizeof($queries);$idx++) {\r
529                         $query = trim($queries[$idx]);\r
530                         // echo "QUERY = <small>" . htmlspecialchars($query) . "</small><p>";\r
531                         if ($query) {\r
532                                 if ($mysql_usePrefix == 1)\r
533                                         $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);\r
534                                 mysql_query($query) or _doError("Error while executing query (<small>" . htmlspecialchars($query) . "</small>): " . mysql_error());\r
535                         }\r
536 \r
537                 }\r
538 \r
539                 // 6. update global settings\r
540                 updateConfig('IndexURL',        $config_indexurl);\r
541                 updateConfig('AdminURL',        $config_adminurl);\r
542                 updateConfig('MediaURL',        $config_mediaurl);\r
543                 updateConfig('SkinsURL',        $config_skinsurl);\r
544                 updateConfig('PluginURL',       $config_pluginurl);\r
545                 updateConfig('ActionURL',       $config_actionurl);\r
546                 updateConfig('AdminEmail',      $config_adminemail);\r
547                 updateConfig('SiteName',        $config_sitename);\r
548 \r
549 \r
550                 // 7. update GOD member\r
551                 $query =  'UPDATE ' . tableName('nucleus_member')\r
552                        . " SET mname='" . addslashes($user_name) . "',"\r
553                        . "     mrealname='". addslashes($user_realname) . "',"\r
554                        . "     mpassword='". md5(addslashes($user_password)) . "',"\r
555                        . "     murl='" . addslashes($config_indexurl) . "',"\r
556                        . "     memail='" . addslashes($user_email) . "',"\r
557                        . "     madmin=1,"\r
558                        . "     mcanlogin=1"\r
559                        . " WHERE mnumber=1";\r
560                 mysql_query($query) or _doError("Error while setting member settings: " . mysql_error());\r
561 \r
562                 // 8. update weblog settings\r
563                 $query =  'UPDATE ' . tableName('nucleus_blog')\r
564                        . " SET bname='" . addslashes($blog_name) . "',"\r
565                        . "     bshortname='". addslashes($blog_shortname) . "',"\r
566                        . "     burl='" . addslashes($config_indexurl) . "'"\r
567                        . " WHERE bnumber=1";\r
568                 mysql_query($query) or _doError("Error while setting weblog settings: " . mysql_error());\r
569 \r
570                 // 9. update item date\r
571                 $query =  'UPDATE ' . tableName('nucleus_item')\r
572                         . " SET itime='". date("Y-m-d H:i:s",time()) ."'"\r
573                         . " WHERE inumber=1";\r
574                 mysql_query($query) or _doError("Error with query: " . mysql_error());\r
575 \r
576                 global $aConfPlugsToInstall, $aConfSkinsToImport;\r
577                 $aSkinErrors = array();\r
578                 $aPlugErrors = array();\r
579                 if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0)) {\r
580                         // 10. set global variables\r
581                         global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX;\r
582                         $MYSQL_HOST = $mysql_host;\r
583                         $MYSQL_USER = $mysql_user;\r
584                         $MYSQL_PASSWORD = $mysql_password;\r
585                         $MYSQL_DATABASE = $mysql_database;\r
586                         $MYSQL_PREFIX = ($mysql_usePrefix == 1)?$mysql_prefix:'';\r
587                         global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;\r
588                         $DIR_NUCLEUS = $config_adminpath;\r
589                         $DIR_MEDIA = $config_mediapath;\r
590                         $DIR_SKINS = $config_skinspath;\r
591                         $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
592                         $DIR_LANG = $DIR_NUCLEUS . 'language/';\r
593                         $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
594 \r
595                         // close database connection (needs to be closed if we want to include globalfunctions.php)\r
596                         mysql_close();\r
597 \r
598                         $manager = '';\r
599                         include_once($DIR_LIBS . 'globalfunctions.php');\r
600 \r
601                         // 11. install custom skins\r
602                         $aSkinErrors = installCustomSkins($manager);\r
603 \r
604                         // 12. install custom plugins\r
605                         $aPlugErrors = installCustomPlugs($manager);\r
606 \r
607                 }\r
608 \r
609 \r
610                 // 12. Write config file ourselves (if possible)\r
611                 $bConfigWritten = 0;\r
612                 if (@file_exists('config.php') && is_writable('config.php') && $fp = @fopen('config.php', 'w')) {\r
613                         $config_data = "<" . "?php \n";\r
614                         $config_data .= "\n";\r
615                         $config_data .= "       // mySQL connection information\n";\r
616                         $config_data .= "       \$MYSQL_HOST = '" . $mysql_host . "';\n";\r
617                         $config_data .= "       \$MYSQL_USER = '" . $mysql_user . "';\n";\r
618                         $config_data .= "       \$MYSQL_PASSWORD = '" . $mysql_password . "';\n";\r
619                         $config_data .= "       \$MYSQL_DATABASE = '" . $mysql_database . "';\n";\r
620                         $config_data .= "       \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1)?$mysql_prefix:'') . "';\n";\r
621                         $config_data .= "\n";\r
622                         $config_data .= "       // main nucleus directory\n";\r
623                         $config_data .= "       \$DIR_NUCLEUS = '" . $config_adminpath . "';\n";\r
624                         $config_data .= "\n";\r
625                         $config_data .= "       // path to media dir\n";\r
626                         $config_data .= "       \$DIR_MEDIA = '" . $config_mediapath . "';\n";\r
627                         $config_data .= "\n";\r
628                         $config_data .= "       // extra skin files for imported skins\n";\r
629                         $config_data .= "       \$DIR_SKINS = '" . $config_skinspath . "';\n";\r
630                         $config_data .= "\n";\r
631                         $config_data .= "       // these dirs are normally sub dirs of the nucleus dir, but \n";\r
632                         $config_data .= "       // you can redefine them if you wish\n";\r
633                         $config_data .= "       \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";\r
634                         $config_data .= "       \$DIR_LANG = \$DIR_NUCLEUS . 'language/';\n";\r
635                         $config_data .= "       \$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";\r
636                         $config_data .= "\n";\r
637                         $config_data .= "       // include libs\n";\r
638                         $config_data .= "       include(\$DIR_LIBS.'globalfunctions.php');\n";\r
639                         $config_data .= "       if (!extension_loaded('mbstring')) {\n";\r
640                         $config_data .= "       include(\$DIR_LIBS.'mb_emulator/mb-emulator.php');\n";\r
641                         $config_data .= "       }\n";\r
642                         $config_data .= "?" . ">";\r
643 \r
644                         $result = @fputs($fp, $config_data, strlen($config_data));\r
645                         fclose($fp);\r
646 \r
647                         if ($result)\r
648                                 $bConfigWritten = 1;\r
649                 }\r
650 \r
651                 ?>\r
652 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
653                 <html xmlns="http://www.w3.org/1999/xhtml">\r
654                 <head>\r
655                         <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />\r
656                         <title>Nucleus¤Î¥¤¥ó¥¹¥È¡¼¥ë</title>\r
657                         <style>\r
658                                 @import url('nucleus/styles/manual.css');\r
659                         </style>\r
660                 </head>\r
661                 <body>\r
662                 <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
663 <?php\r
664         $aAllErrors = array_merge($aSkinErrors, $aPlugErrors);\r
665         if (count($aAllErrors) > 0) {\r
666                 echo '<h1>Skin/Plugin Install errors</h1>';\r
667                 echo '<ul><li>'.implode('</li><li>', $aAllErrors).'</li></ul>';\r
668         }\r
669 \r
670         if (!$bConfigWritten) { ?>\r
671                         <h1>¥¤¥ó¥¹¥È¡¼¥ë¤Ï¤Û¤Ü´°Î»¤·¤Þ¤·¤¿¡ª</h1>\r
672                         <p>\r
673                         ¥Ç¡¼¥¿¥Ù¡¼¥¹¥Æ¡¼¥Ö¥ë¤Î½é´üÃÍÆþÎϤ¬À®¸ù¤·¤Þ¤·¤¿¡£¸å¤Ï<i>config.php</i>¤ò½ñ¤­´¹¤¨¤ë¤À¤±¤Ç¤¹¡£°Ê²¼¤Ë½ñ¤­´¹¤¨¤ë¤Ù¤­ÆâÍƤòɽ¼¨¤·¤Þ¤¹¡Êmysql¤Î¥Ñ¥¹¥ï¡¼¥É¤Ï¥Þ¥¹¥¯¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Ï¼ÂºÝ¤Î¤â¤Î¤Ë½ñ¤­´¹¤¨¤Æ¤¯¤À¤µ¤¤¡Ë\r
674                         </p>\r
675 \r
676                         <pre>\r
677 &lt;?php\r
678         // mySQL connection information\r
679         $MYSQL_HOST = '<b><?php echo $mysql_host?></b>';\r
680         $MYSQL_USER = '<b><?php echo $mysql_user?></b>';\r
681         $MYSQL_PASSWORD = '<i><b>xxxxxxxxxxx</b></i>';\r
682         $MYSQL_DATABASE = '<b><?php echo $mysql_database?></b>';\r
683         $MYSQL_PREFIX = '<b><?php echo ($mysql_usePrefix == 1)?$mysql_prefix:''?></b>';\r
684 \r
685         // main nucleus directory\r
686         $DIR_NUCLEUS = '<b><?php echo $config_adminpath?></b>';\r
687 \r
688         // path to media dir\r
689         $DIR_MEDIA = '<b><?php echo $config_mediapath?></b>';\r
690 \r
691         // extra skin files for imported skins\r
692         $DIR_SKINS = '<b><?php echo $config_skinspath?></b>';\r
693 \r
694         // these dirs are normally sub dirs of the nucleus dir, but\r
695         // you can redefine them if you wish\r
696         $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
697         $DIR_LANG = $DIR_NUCLEUS . 'language/';\r
698         $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
699 \r
700         // include libs\r
701         include($DIR_LIBS.'globalfunctions.php');\r
702         if (!extension_loaded('mbstring')) {\r
703                 include($DIR_LIBS.'mb_emulator/mb-emulator.php');\r
704         }\r
705 ?&gt;\r
706                         </pre>\r
707 \r
708                         <p>¤¢¤Ê¤¿¤Î¥³¥ó¥Ô¥å¡¼¥¿¾å¤Î¥Õ¥¡¥¤¥ë¤ò½ñ¤­´¹¤¨¤¿¤é¡¢FTP¤ò»È¤Ã¤Æ¥¦¥§¥Ö¥µ¡¼¥Ð¤Ë¥¢¥Ã¥×¥í¡¼¥É¤·¤Æ¤¯¤À¤µ¤¤¡£ASCII¥â¡¼¥É¤ÇÁ÷¿®¤·¤Æ¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤·¤Þ¤¹¡£\r
709                         </p>\r
710 \r
711                         <div class="note">\r
712                         <b>ÉÕµ­:</b> <i>config.php</i>¤ÎºÇ½é¤ä½ª¤ï¤ê¤Ë¥¹¥Ú¡¼¥¹¤ò¶õ¤±¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦¡£¼Â¹Ô»þ¤Ë¥¨¥é¡¼¤ò°ú¤­µ¯¤³¤¹¸¶°ø¤È¤Ê¤ê¤Þ¤¹¡£\r
713                         <br />\r
714                         ¤·¤¿¤¬¤Ã¤Æ¡¢config.php¤ÎºÇ½é¤Îʸ»ú¤Ï "&lt;"¤ÇºÇ¸å¤Îʸ»ú¤Ï"&gt;"¤È¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£\r
715                         </div>\r
716 \r
717 <?php } else { ?>\r
718                         <h1>¥¤¥ó¥¹¥È¡¼¥ë¤Ï´°Î»¤·¤Þ¤·¤¿¡ª</h1>\r
719 \r
720                         <p>Nucleus¤Ï¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¡¢<code>config.php</code>¤Ï¥¢¥Ã¥×¥Ç¡¼¥È¤µ¤ì¤Þ¤·¤¿¡£</p>\r
721 \r
722                         <p>¥»¥­¥å¥ê¥Æ¥£¤Î¤¿¤á<code>config.php</code>¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò444¤ËÌ᤹¤³¤È¤ò˺¤ì¤Ê¤¤¤Ç¤¯¤À¤µ¤¤(<a href="nucleus/documentation/tips.html#filepermissions">¥Ñ¡¼¥ß¥Ã¥·¥ç¥óÊѹ¹¤Î´Ê°×¥¬¥¤¥É</a>)¡£</p>\r
723 <?php } ?>\r
724                         <h1>¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥¡¥¤¥ë¤Îºï½ü</h1>\r
725 \r
726                         <p>¥¦¥§¥Ö¥µ¡¼¥Ð¤«¤é¼¡¤Î¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡§</p>\r
727 \r
728                         <ul>\r
729                                 <li><b>install.sql</b>¡§¥Æ¡¼¥Ö¥ë¤Î¹½Â¤¤òÆâÊñ¤¹¤ë¥Õ¥¡¥¤¥ë</li>\r
730                                 <li><b>install.php</b>¡§¤³¤Î¥Õ¥¡¥¤¥ë</li>\r
731                         </ul>\r
732 \r
733                         <p>¤â¤·¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢´ÉÍýÎΰè¤ò³«¤¯¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£</p>\r
734 \r
735                         <h1>¥¦¥§¥Ö¥µ¥¤¥È¤Î³Îǧ</h1>\r
736                         <p>\r
737                         ¥¦¥§¥Ö¥µ¥¤¥È¤ò»È¤¦½àÈ÷¤¬À°¤¤¤Þ¤·¤¿¡£\r
738                         <ul>\r
739                                 <li><a href="<?php echo $config_adminurl?>">´ÉÍýÎΰè¤Ë¥í¥°¥¤¥ó¤·¤Æ¥µ¥¤¥È¤ÎÀßÄê¤ò¹Ô¤¦</a></li>\r
740                                 <li><a href="<?php echo $config_indexurl?>">¤¹¤°¤Ë¥µ¥¤¥È¤Ø¹Ô¤Ã¤Æ¤ß¤ë</a></li>\r
741                         </ul>\r
742                         </p>\r
743 \r
744                 </body>\r
745                 </html>\r
746                 <?php\r
747         }\r
748 \r
749 \r
750         function installCustomPlugs(&$manager) {\r
751                 global $aConfPlugsToInstall, $DIR_LIBS;\r
752 \r
753                 $aErrors = array();\r
754 \r
755                 if (count($aConfPlugsToInstall) == 0)\r
756                         return $aErrors;\r
757 \r
758                 $numCurrent = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));\r
759 \r
760                 foreach ($aConfPlugsToInstall as $plugName) {\r
761                         // do this before calling getPlugin (in case the plugin id is used there)\r
762                         $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.(++$numCurrent).',"'.addslashes($plugName).'")';\r
763                         sql_query($query);\r
764 \r
765                         // get and install the plugin\r
766                         $plugin =& $manager->getPlugin($plugName);\r
767                         if (!$plugin) {\r
768                                 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\''. addslashes($plugName).'\'');\r
769                                 $numCurrent--;\r
770                                 array_push($aErrors, 'Unable to install plugin ' . $plugName);\r
771                                 continue;\r
772                         }\r
773                         $plugin->install();\r
774                 }\r
775 \r
776                 // SYNC PLUGIN EVENT LIST\r
777                 sql_query('DELETE FROM '.sql_table('plugin_event'));\r
778                 // loop over all installed plugins\r
779                 $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));\r
780                 while($o = mysql_fetch_object($res)) {\r
781                         $pid = $o->pid;\r
782                         $plug =& $manager->getPlugin($o->pfile);\r
783                         if ($plug)\r
784                         {\r
785                                 $eventList = $plug->getEventList();\r
786                                 foreach ($eventList as $eventName) \r
787                                         sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.$eventName.'\')');\r
788                         }\r
789                 }\r
790 \r
791                 return $aErrors;\r
792         }\r
793 \r
794         function installCustomSkins(&$manager) {\r
795                 global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;\r
796 \r
797                 $aErrors = array();\r
798 \r
799                 if (count($aConfSkinsToImport) == 0)\r
800                         return $aErrors;\r
801 \r
802                 // load skinie class\r
803                 include_once($DIR_LIBS . 'skinie.php');\r
804 \r
805                 $importer = new SKINIMPORT();\r
806 \r
807                 foreach ($aConfSkinsToImport as $skinName) {\r
808                         $importer->reset();\r
809 \r
810                         $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';\r
811                         if (!@file_exists($skinFile)) {\r
812                                 array_push($aErrors, 'Unable to import ' . $skinFile . ' : file does not exist');\r
813                                 continue;\r
814                         }\r
815                         $error = $importer->readFile($skinFile);\r
816                         if ($error) {\r
817                                 array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error);\r
818                                 continue;\r
819                         }\r
820                         $error = $importer->writeToDatabase(1);\r
821                         if ($error) {\r
822                                 array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error);\r
823                                 continue;\r
824                         }\r
825                 }\r
826 \r
827                 return $aErrors;\r
828         }\r
829 \r
830         // give an error if one or more nucleus are not accessible\r
831         function doCheckFiles() {\r
832                 $missingfiles = array();\r
833 \r
834                 if (!is_readable('install.sql'))\r
835                         array_push($missingfiles, "File <b>install.sql</b> is missing or not readable");\r
836                 if (!is_readable('index.php'))\r
837                         array_push($missingfiles, "File <b>index.php</b> is missing or not readable");\r
838                 if (!is_readable('action.php'))\r
839                         array_push($missingfiles, "File <b>action.php</b> is missing or not readable");\r
840                 if (!is_readable('nucleus/index.php'))\r
841                         array_push($missingfiles, "File <b>nucleus/index.php</b> is missing or not readable");\r
842                 if (!is_readable('nucleus/libs/globalfunctions.php'))\r
843                         array_push($missingfiles, "File <b>nucleus/libs/globalfunctions.php</b> is missing or not readable");\r
844                 if (!is_readable('nucleus/libs/ADMIN.php'))\r
845                         array_push($missingfiles, "File <b>nucleus/libs/ADMIN.php</b> is missing or not readable");\r
846                 if (!is_readable('nucleus/libs/BLOG.php'))\r
847                         array_push($missingfiles, "File <b>nucleus/libs/BLOG.php</b> is missing or not readable");\r
848                 if (!is_readable('nucleus/libs/COMMENT.php'))\r
849                         array_push($missingfiles, "File <b>nucleus/libs/COMMENT.php</b> is missing or not readable");\r
850                 if (!is_readable('nucleus/libs/COMMENTS.php'))\r
851                         array_push($missingfiles, "File <b>nucleus/libs/COMMENTS.php</b> is missing or not readable");\r
852                 if (!is_readable('nucleus/libs/ITEM.php'))\r
853                         array_push($missingfiles, "File <b>nucleus/libs/ITEM.php</b> is missing or not readable");\r
854                 if (!is_readable('nucleus/libs/MEMBER.php'))\r
855                         array_push($missingfiles, "File <b>nucleus/libs/MEMBER.php</b> is missing or not readable");\r
856                 if (!is_readable('nucleus/libs/SKIN.php'))\r
857                         array_push($missingfiles, "File <b>nucleus/libs/SKIN.php</b> is missing or not readable");\r
858                 if (!is_readable('nucleus/libs/TEMPLATE.php'))\r
859                         array_push($missingfiles, "File <b>nucleus/libs/TEMPLATE.php</b> is missing or not readable");\r
860                 if (!is_readable('nucleus/libs/MEDIA.php'))\r
861                         array_push($missingfiles, "File <b>nucleus/libs/MEDIA.php</b> is missing or not readable");\r
862                 if (!is_readable('nucleus/libs/ACTIONLOG.php'))\r
863                         array_push($missingfiles, "File <b>nucleus/libs/ACTIONLOG.php</b> is missing or not readable");\r
864                 if (!is_readable('nucleus/media.php'))\r
865                         array_push($missingfiles, "File <b>nucleus/media.php</b> is missing or not readable");\r
866 \r
867 \r
868                 if (sizeof($missingfiles) > 0)\r
869                         showErrorMessages($missingfiles);\r
870 \r
871 \r
872         }\r
873 \r
874         function updateConfig($name, $val) {\r
875                 $name = addslashes($name);\r
876                 $val = trim(addslashes($val));\r
877 \r
878                 $query = 'UPDATE ' . tableName('nucleus_config')\r
879                        . " SET value='$val'"\r
880                        . " WHERE name='$name'";\r
881 \r
882                 mysql_query($query) or _doError("Query error while trying to update config: " . mysql_error());\r
883                 return mysql_insert_id();\r
884         }\r
885 \r
886         function endsWithSlash($s) {\r
887                 return (strrpos($s,'/') == strlen($s) - 1);\r
888         }\r
889 \r
890         /**\r
891           * Checks if email address is valid\r
892           */\r
893         function _isValidMailAddress($address) {\r
894                 if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address))\r
895                         return 1;\r
896                 else\r
897                         return 0;\r
898         }\r
899 \r
900         // returns true if the given string is a valid shortname\r
901         // (to check short blog names and nicknames)\r
902         // logic: starts and ends with a non space, can contain spaces in between\r
903         //        min 2 chars\r
904         function _isValidShortName($name) {\r
905                 if (eregi("^[a-z0-9]+$", $name))\r
906                         return 1;\r
907                 else\r
908                         return 0;\r
909         }\r
910 \r
911 \r
912 \r
913         // returns true if the given string is a valid display name\r
914         // (to check nicknames)\r
915         function _isValidDisplayName($name) {\r
916                 if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name))\r
917                         return 1;\r
918                 else\r
919                         return 0;\r
920         }\r
921 \r
922         function _doError($msg) {\r
923                 ?>\r
924 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
925                 <html xmlns="http://www.w3.org/1999/xhtml">\r
926                 <head>\r
927                         <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />\r
928                         <title>Nucleus Install</title>\r
929                         <style>\r
930                                 @import url('nucleus/styles/manual.css');\r
931                         </style>\r
932                 </head>\r
933                 <body>\r
934                   <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
935                         <h1>Error!</h1>\r
936                         <p>\r
937                         Error message was: "<?php echo $msg?>";\r
938                         </p>\r
939 \r
940                         <p>\r
941                         <a href="install.php" onclick="history.back();return false;">Go Back</a>\r
942                         </p>\r
943                 </body>\r
944                 </html>\r
945                 <?php           exit;\r
946         }\r
947 \r
948         function showErrorMessages($errors) {\r
949                 ?>\r
950 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
951                 <html xmlns="http://www.w3.org/1999/xhtml">\r
952                 <head>\r
953                         <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />\r
954                         <title>Nucleus Install</title>\r
955                         <style>\r
956                                 @import url('nucleus/styles/manual.css');\r
957                         </style>\r
958                 </head>\r
959                 <body>\r
960                   <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
961                         <h1>Errors!</h1>\r
962                         <p>\r
963                         Errors were found:\r
964                         </p>\r
965 \r
966                         <ul>\r
967                         <?php   while($msg = array_shift($errors))\r
968                                         echo "<li>$msg</li>";\r
969                         ?>\r
970                         </ul>\r
971 \r
972                         <p>\r
973                         <a href="install.php" onclick="history.back();return false;">Go Back</a>\r
974                         </p>\r
975                 </body>\r
976                 </html>\r
977                 <?php           exit;\r
978         }\r
979 \r
980 \r
981         /* for the non-php systems that decide to show the contents:\r
982            ?></div><?php        */\r
983 \r
984 ?>\r