00001 <?php 00002 /* 00003 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 00004 * Copyright (C) 2002-2007 The Nucleus Group 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * (see nucleus/documentation/index.html#license for more info) 00011 * This script will install the Nucleus tables in your SQL-database, and initialize the data in 00012 * those tables. 00013 * 00014 * Below is a friendly way of letting users on non-php systems know that Nucleus won't run there. 00015 * ?><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 00016 */ 00017 00025 /* 00026 This part of the install.php code allows for customization of the install process. 00027 When distributing plugins or skins together with a Nucleus installation, the 00028 configuration below will instruct to install them 00029 00030 -- Start Of Configurable Part -- 00031 */ 00032 00033 // array with names of plugins to install. Plugin files must be present in the nucleus/plugin/ 00034 // directory. 00035 // 00036 // example: 00037 // array('NP_TrackBack', 'NP_MemberGoodies') 00038 $aConfPlugsToInstall = array('NP_SkinFiles'); 00039 00040 00041 // array with skins to install. skins must be present under the skins/ directory with 00042 // a subdirectory having the same name that contains a skinbackup.xml file 00043 // 00044 // example: 00045 // array('base','rsd') 00046 $aConfSkinsToImport = array('default'); 00047 00048 /* 00049 -- End Of Configurable Part -- 00050 */ 00051 00052 // don't give warnings for uninitialized vars 00053 error_reporting(E_ERROR | E_WARNING | E_PARSE); 00054 00055 // make sure there's no unnecessary escaping: 00056 set_magic_quotes_runtime(0); 00057 00058 // if there are some plugins or skins to import, do not include vars 00059 // in globalfunctions.php again... so set a flag 00060 if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) ) { 00061 global $CONF; 00062 $CONF['installscript'] = 1; 00063 } 00064 00065 if (phpversion() >= '4.1.0') { 00066 include_once('nucleus/libs/vars4.1.0.php'); 00067 } else { 00068 include_once('nucleus/libs/vars4.0.6.php'); 00069 } 00070 00071 include_once('nucleus/libs/mysql.php'); 00072 00073 // check if mysql support is installed 00074 if (!function_exists('mysql_query') ) { 00075 _doError('Your PHP version does not have support for MySQL :('); 00076 } 00077 00078 if (postVar('action') == 'go') { 00079 doInstall(); 00080 } else { 00081 showInstallForm(); 00082 } 00083 00084 exit; 00085 00086 function showInstallForm() { 00087 // 0. pre check if all necessary files exist 00088 doCheckFiles(); 00089 00090 ?> 00091 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 00092 <html xmlns="http://www.w3.org/1999/xhtml"> 00093 <head> 00094 <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> 00095 <title>Nucleusã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«</title> 00096 <style type="text/css"><!-- 00097 @import url('nucleus/documentation/styles/manual.css'); 00098 --></style> 00099 <script type="text/javascript"><!-- 00100 var submitcount = 0; 00101 00102 // function to make sure the submit button only gets pressed once 00103 function checkSubmit() { 00104 if (submitcount == 0) { 00105 submitcount++; 00106 return true; 00107 } else { 00108 return false; 00109 } 00110 } 00111 --></script> 00112 </head> 00113 <body> 00114 <div style="text-align:center"><img src="./nucleus/styles/logo.gif" /></div> <!-- Nucleus logo --> 00115 <form method="post" action="install.php"> 00116 00117 <h1>Install Nucleus</h1> 00118 00119 <p>ã“ã®ã‚¹ã‚¯ãƒªãƒ—トã¯Nucleusã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’手助ã‘ã—ã¾ã™ã€‚MySQLテーブルã®ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ—ã¨ã€<i>config.php</i>ã«å…¥åŠ›ã™ã‚‹ãŸã‚ã®æƒ…å ±ã‚’è¡¨ç¤ºã—ã¾ã™ï¼ˆconfig.phpã®ãƒ‘ーミッションを0666ã«ã—ã¦ãŠã‘ã°ã€å¾Œè€…ã®ä½œæ¥ã¯è‡ªå‹•çš„ã«è¡Œã‚ã‚Œã¾ã™ï¼‰ã€‚ã“れをãªã™ç‚ºã«ã€ã„ãã¤ã‹ã®æƒ…å ±ã‚’å…¥åŠ›ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚</p> 00120 00121 <p>ã™ã¹ã¦ã®æ¬„ã®å…¥åŠ›ãŒå¿…è¦ã§ã™ã€‚ã‚ªãƒ—ã‚·ãƒ§ãƒ³æƒ…å ±ã¯ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ãŒå®Œäº†ã—ãŸã‚‰ã€Nucleusã®ç®¡ç†é ˜åŸŸã‹ã‚‰è¨å®šå¯èƒ½ã§ã™ã€‚</p> 00122 00123 <h1>PHP & MySQL Versions</h1> 00124 00125 <p>以下ã¯ã‚ãªãŸã®ã‚¦ã‚§ãƒ–ホストã«ãŠã‘ã‚‹PHPインタープリターã¨MySQLサーãƒãƒ¼ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã™ã€‚Nucleusã®ã‚µãƒãƒ¼ãƒˆãƒ•ã‚©ãƒ¼ãƒ©ãƒ ã«å•é¡Œã‚’å ±å‘Šã™ã‚‹ã¨ãã¯ã€ã“ã®æƒ…å ±ã‚’æ›¸ãæ·»ãˆã¦ãã ã•ã„。</p> 00126 00127 <ul> 00128 <li>PHP: 00129 00130 <?php 00131 echo phpversion(); 00132 $minVersion = '4.0.6'; 00133 00134 if (phpversion() < $minVersion) { 00135 echo ' <span class="warning">注æ„: Nucleusã®å‹•ä½œã«ã¯å°‘ãªãã¨ã‚‚ãƒãƒ¼ã‚¸ãƒ§ãƒ³ ',$minVersion,' ãŒå¿…è¦ã¨ã•ã‚Œã¾ã™</span>'; 00136 } 00137 ?> 00138 00139 </li> 00140 <li>MySQL: 00141 00142 <?php 00143 // note: this piece of code is taken from phpMyAdmin 00144 $result = @mysql_query('SELECT VERSION() AS version'); 00145 00146 if ($result != FALSE && @mysql_num_rows($result) > 0) { 00147 $row = mysql_fetch_array($result); 00148 $match = explode('.', $row['version']); 00149 } else { 00150 $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); 00151 00152 if ($result != FALSE && @mysql_num_rows($result) > 0) { 00153 $row = mysql_fetch_row($result); 00154 $match = explode('.', $row[1]); 00155 } else { 00156 $match[0] = '?'; 00157 $match[1] = '?'; 00158 $match[2] = '?'; 00159 } 00160 } 00161 00162 if (!isset($match) || !isset($match[0]) ) { 00163 $match[0] = 3; 00164 } 00165 00166 if (!isset($match[1]) ) { 00167 $match[1] = 21; 00168 } 00169 00170 if (!isset($match[2]) ) { 00171 $match[2] = 0; 00172 } 00173 00174 if ($match[0] != '?') { 00175 $match[0] = intval($match[0]); 00176 $match[1] = intval($match[1]); 00177 } 00178 00179 $mysqlVersion = implode($match, '.'); 00180 $minVersion = '3.23'; 00181 00182 echo $mysqlVersion; 00183 00184 if ($mysqlVersion < $minVersion) { 00185 echo ' <span class="warning">注æ„: Nucleusã®å‹•ä½œã«ã¯å°‘ãªãã¨ã‚‚ãƒãƒ¼ã‚¸ãƒ§ãƒ³ ',$minVersion,' ãŒå¿…è¦ã¨ã•ã‚Œã¾ã™</span>'; 00186 } 00187 ?> 00188 00189 </li> 00190 </ul> 00191 00192 <?php 00193 // tell people how they can have their config file filled out automatically 00194 if (@file_exists('config.php') && @!is_writable('config.php') ) { 00195 ?> 00196 00197 <h1><i>config.php</i>ã®è‡ªå‹•ã‚¢ãƒƒãƒ—デート</h1> 00198 00199 <p>ã‚‚ã—<em>config.php</em>を自動的ã«æ›´æ–°ã™ã‚‹ã‚ˆã†ã«ã—ãŸã„ãªã‚‰ã€æ›¸ãè¾¼ã¿å¯èƒ½ã«ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚<em>config.php</em>ã®ãƒ‘ーミッションを<strong>666</strong>ã«ã—ã¦ãã ã•ã„。Nucleusã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«æˆåŠŸå¾Œã«ã€ãƒ‘ーミッションを<strong>444</strong>ã«æˆ»ã•ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“(<a href="nucleus/documentation/tips.html#filepermissions">パーミッション変更ã®ç°¡æ˜“ガイド</a>)。</p> 00200 00201 <p>ã‚‚ã—ファイルã«æ›¸ãè¾¼ã¾ãªã„ã¨ã„ã†é¸æŠžã‚’ã—ãŸï¼ˆã‚ã‚‹ã„ã¯è¡Œãˆãªã„ï¼‰å ´åˆï¼šã”心é…ãªã。インストールã®éŽç¨‹ã§<em>config.php</em>ã®ä¸èº«ãŒæä¾›ã•ã‚Œã¾ã™ã€‚ã§ã™ã‹ã‚‰ã€ãれをã”自身ã§ã‚¢ãƒƒãƒ—ãƒãƒ¼ãƒ‰ã—ã¦ãã ã•ã„。</p> 00202 00203 <?php } ?> 00204 00205 <h1>MySQLã®ãƒã‚°ã‚¤ãƒ³ãƒ‡ãƒ¼ã‚¿</h1> 00206 00207 <p>MySQLã®ãƒ‡ãƒ¼ã‚¿ã‚’以下ã«å…¥åŠ›ã—ã¦ãã ã•ã„。ãれらã¯ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒ»ãƒ†ãƒ¼ãƒ–ルを作æˆã—æƒ…å ±ã‚’å…¥åŠ›ã™ã‚‹ãŸã‚ã«å¿…è¦ãªã‚‚ã®ã§ã™ã€‚後ã§ã€<i>config.php</i>ã«ã‚‚記入ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ï¼ˆä¸Šè¨˜ã®è‡ªå‹•ã‚¢ãƒƒãƒ—デートを利用ã™ã‚‹å ´åˆã€ãã®æ‰‹é †ã¯çœç•¥ã•ã‚Œã¾ã™ï¼‰ã€‚</p> 00208 00209 <p>ã‚‚ã—ã“ã®æƒ…å ±ãŒã‚ã‹ã‚‰ãªã‘ã‚Œã°ã€ã‚·ã‚¹ãƒ†ãƒ 管ç†è€…ã‹ãƒ›ã‚¹ãƒ†ã‚£ãƒ³ã‚°å…ƒã«é€£çµ¡ã‚’ã¨ã£ã¦ãã ã•ã„。ã»ã¨ã‚“ã©ã®å ´åˆã€ãƒ›ã‚¹ãƒˆåã¯'localhost'ã§ã™ã€‚ã‚‚ã—NucleusãŒã‚ãªãŸã®ã‚µãƒ¼ãƒã®PHPè¨å®šã‹ã‚‰'default MySQL host'を検知ã—ãŸãªã‚‰ã€'ホストå'ã«æ—¢ã«è¨˜å…¥ã•ã‚Œã¦ã„ã‚‹ã¯ãšã§ã™ã€‚ã‚‚ã£ã¨ã‚‚ã€ã“ã®æƒ…å ±ãŒæ£ç¢ºã§ã‚ã‚‹ã¨ã„ã†ä¿è¨¼ã¯ã‚ã‚Šã¾ã›ã‚“。</p> 00210 00211 <fieldset> 00212 <legend>基本ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹è¨å®š</legend> 00213 <table> 00214 <tr> 00215 <td>ホストå:</td> 00216 <td><input name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host') )?>" /></td> 00217 </tr> 00218 <tr> 00219 <td>ユーザーå:</td> 00220 <td><input name="mySQL_user" /></td> 00221 </tr> 00222 <tr> 00223 <td>パスワード:</td> 00224 <td><input name="mySQL_password" type="password" /></td> 00225 </tr> 00226 <tr> 00227 <td>データベースå:</td> 00228 <td><input name="mySQL_database" /> (<input name="mySQL_create" value="1" type="checkbox" id="mySQL_create"><label for="mySQL_create" />データベースを作æˆã™ã‚‹å¿…è¦ãŒã‚ã‚‹</label>)</td> 00229 </tr> 00230 </table> 00231 </fieldset> 00232 00233 <fieldset> 00234 <legend>高ç‰ãªãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹è¨å®š</legend> 00235 <table> 00236 <tr> 00237 <td><input name="mySQL_usePrefix" value="1" type="checkbox" id="mySQL_usePrefix"><label for="mySQL_usePrefix" />テーブル・プリフィックスを利用</label></td> 00238 <td><input name="mySQL_tablePrefix" value="" /></td> 00239 </tr> 00240 </table> 00241 00242 <p>一ã¤ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«è¤‡æ•°ã®Nucleusをインストールã—ã¦ãŠã‚Šã€è‡ªåˆ†ãŒä½•ã‚’ã‚„ã£ã¦ã„ã‚‹ã®ã‹ç†è§£ã•ã‚Œã¦ã„ã‚‹å ´åˆã‚’除ã„ã¦ã¯ã€<strong>ã“れを変更ã™ã‚‹å¿…è¦ã¯ã‚ã‚Šã¾ã›ã‚“</strong>。</p> 00243 <p>Nucleusã«ã‚ˆã£ã¦ç”Ÿæˆã•ã‚ŒãŸã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒ†ãƒ¼ãƒ–ルã¯ã€ã“ã®ãƒ—リフィックスãŒé ã«ã¤ãã¾ã™ã€‚</p> 00244 </fieldset> 00245 00246 <h1>ディレクトリã¨URL</h1> 00247 00248 <p>ã“ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚¹ã‚¯ãƒªãƒ—トã¯NucleusãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¦ã„るディレクトリã¨URLを見ã¤ã‘よã†ã¨ã—ã¾ã—ãŸã€‚下ã®å€¤ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦å¿…è¦ãªã‚‰è¨‚æ£ã—ã¦ãã ã•ã„。ファイルã¸ã®ãƒ‘スã¨URLã¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥'/'ã§çµ‚ã‚らãªãã¦ã¯ãªã‚Šã¾ã›ã‚“。</p> 00249 00250 <?php 00251 00252 // no need to this all! dirname(__FILE__) is all we need -- moraes 00253 /* 00254 // discover full path 00255 $fullPath = serverVar('PATH_TRANSLATED'); 00256 00257 if ($fullPath == '') { 00258 $fullPath = serverVar('SCRIPT_FILENAME'); 00259 } 00260 00261 $basePath = str_replace('install.php', '', $fullPath); 00262 $basePath = replaceDoubleBackslash($basePath); 00263 $basePath = replaceDoubleBackslash($basePath); 00264 00265 // add slash at end if necessary 00266 if (!endsWithSlash($basePath) ) { 00267 $basePath .= '/'; 00268 } 00269 */ 00270 00271 $basePath = dirname(__FILE__) . '/'; 00272 ?> 00273 00274 <fieldset> 00275 <legend>URLs and directories</legend> 00276 <table> 00277 <tr> 00278 <td>Site <strong>URL</strong>:</td> 00279 <td><input name="IndexURL" size="60" value="<?php 00280 $url = 'http://' . serverVar('HTTP_HOST') . serverVar('PHP_SELF'); 00281 $url = str_replace('install.php', '', $url); 00282 $url = replaceDoubleBackslash($url); 00283 00284 // add slash at end if necessary 00285 if (!endsWithSlash($url) ) { 00286 $url .= '/'; 00287 } 00288 00289 echo $url; ?>" /></td> 00290 </tr> 00291 <tr> 00292 <td>Admin-area <strong>URL</strong>:</td> 00293 <td><input name="AdminURL" size="60" value="<?php 00294 if ($url) { 00295 echo $url, 'nucleus/'; 00296 } ?>" /></td> 00297 </tr> 00298 <tr> 00299 <td>Admin-area <strong>path</strong>:</td> 00300 <td><input name="AdminPath" size="60" value="<?php 00301 if($basePath) { 00302 echo $basePath, 'nucleus/'; 00303 } ?>" /></td> 00304 </tr> 00305 <tr> 00306 <td>Media files <strong>URL</strong>:</td> 00307 <td><input name="MediaURL" size="60" value="<?php 00308 if ($url) { 00309 echo $url, 'media/'; 00310 } ?>" /></td> 00311 </tr> 00312 <tr> 00313 <td>Media directory <strong>path</strong>:</td> 00314 <td><input name="MediaPath" size="60" value="<?php 00315 if ($basePath) { 00316 echo $basePath, 'media/'; 00317 } ?>" /></td> 00318 </tr> 00319 <tr> 00320 <td>Extra skin files <strong>URL</strong>:</td> 00321 <td><input name="SkinsURL" size="60" value="<?php 00322 if ($url) { 00323 echo $url, 'skins/'; 00324 } ?>" /> 00325 <br />(インãƒãƒ¼ãƒˆã•ã‚ŒãŸã‚¹ã‚ンãŒä½¿ç”¨) 00326 </td> 00327 </tr> 00328 <tr> 00329 <td>Extra skin files directory <strong>path</strong>:</td> 00330 <td><input name="SkinsPath" size="60" value="<?php 00331 if ($basePath) { 00332 echo $basePath, 'skins/'; 00333 } ?>" /> 00334 <br />(インãƒãƒ¼ãƒˆã•ã‚ŒãŸã‚¹ã‚ンã®ãƒ•ã‚¡ã‚¤ãƒ«é¡žã‚’ç½®ãå ´æ‰€) 00335 </td> 00336 </tr> 00337 <tr> 00338 <td>Plugin files <strong>URL</strong>:</td> 00339 <td><input name="PluginURL" size="60" value="<?php 00340 if ($url) { 00341 echo $url, 'nucleus/plugins/'; 00342 } ?>" /></td> 00343 </tr> 00344 <tr> 00345 <td>Action <strong>URL</strong>:</td> 00346 <td><input name="ActionURL" size="60" value="<?php 00347 if ($url) { 00348 echo $url, 'action.php'; 00349 } ?>" /> 00350 <br />(<tt>action.php</tt>ã¸ã®http://ã‹ã‚‰å§‹ã¾ã‚‹URL) 00351 </td> 00352 </tr> 00353 </table> 00354 </fieldset> 00355 00356 <p class="note"><strong>付記:</strong> 相対パスã§ã¯ãªã<strong>絶対パスを使ã£ã¦ãã ã•ã„</strong>。通常ã€çµ¶å¯¾ãƒ‘スã¯<tt>/home/username/public_html/</tt>ã®ã‚ˆã†ãªå½¢ã‚’ã¨ã‚Šã¾ã™ã€‚Unixシステム(ã»ã¨ã‚“ã©ã®ã‚µãƒ¼ãƒãƒ¼ãŒãã†ã§ã™ï¼‰ã«ãŠã„ã¦ã€ãƒ‘スã¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥ã‹ã‚‰å§‹ã¾ã‚Šã¾ã™ã€‚ã‚‚ã—ã“れらã®æƒ…å ±å…¥åŠ›ã«å•é¡ŒãŒç”Ÿã˜ãŸã‚‰ã€ã‚ãªãŸã®ã‚µãƒ¼ãƒç®¡ç†è€…ã«ãŸãšãã‚‹ã¹ãã§ã™ã€‚</p> 00357 00358 <h1>管ç†æ¨©é™ã‚’ã‚‚ã¤ãƒ¦ãƒ¼ã‚¶ãƒ¼</h1> 00359 00360 <p>以下ã«ã€ã‚µã‚¤ãƒˆã®æœ€åˆã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’作æˆã™ã‚‹ãŸã‚ã®ã„ãã¤ã‹ã®æƒ…å ±ã‚’å…¥åŠ›ã—ã¦ãã ã•ã„。</p> 00361 00362 <fieldset> 00363 <legend>管ç†æ¨©é™ã‚’æŒã¤ãƒ¦ãƒ¼ã‚¶ãƒ¼</legend> 00364 <table> 00365 <tr> 00366 <td>表示ã•ã‚Œã‚‹åå‰ï¼š</td> 00367 <td><input name="User_name" value="" /> <small>(許å¯ã•ã‚Œã‚‹æ–‡å—:a-z 㨠0-9ã€æœ€åˆã¨æœ€å¾Œä»¥å¤–ã®ã‚¹ãƒšãƒ¼ã‚¹)</small></td> 00368 </tr> 00369 <tr> 00370 <td>本å(ãƒãƒ³ãƒ‰ãƒ«å):</td> 00371 <td><input name="User_realname" value="" /></td> 00372 </tr> 00373 <tr> 00374 <td>パスワード:</td> 00375 <td><input name="User_password" type="password" value="" /></td> 00376 </tr> 00377 <tr> 00378 <td>パスワードã®ç¢ºèªï¼š</td> 00379 <td><input name="User_password2" type="password" value="" /></td> 00380 </tr> 00381 <tr> 00382 <td>メールアドレス:</td> 00383 <td><input name="User_email" value="" /> <small>(利用å¯èƒ½ãªãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’入れã¦ãã ã•ã„)</small></td> 00384 </tr> 00385 </table> 00386 </fieldset> 00387 00388 <h1>ウェブãƒã‚°ã®ãƒ‡ãƒ¼ã‚¿</h1> 00389 00390 <p>以下ã«ã€ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã®weblogを作æˆã™ã‚‹ãŸã‚ã«ã„ãã¤ã‹ã®æƒ…å ±ã‚’å…¥åŠ›ã—ã¦ãã ã•ã„。ã“ã®weblogã®åå‰ã¯ã€ã‚µã‚¤ãƒˆåã¨ã—ã¦ã‚‚利用ã•ã‚Œã¾ã™ã€‚</p> 00391 00392 <fieldset> 00393 <legend>ウェブãƒã‚°ã®ãƒ‡ãƒ¼ã‚¿</legend> 00394 <table> 00395 <tr> 00396 <td>Blogå:</td> 00397 <td><input name="Blog_name" size="60" value="My Nucleus CMS" /></td> 00398 </tr> 00399 <tr> 00400 <td>Blogã®çŸç¸®å:</td> 00401 <td><input name="Blog_shortname" value="mynucleuscms" /> <small>(許å¯ã•ã‚Œã‚‹æ–‡å—:a-z 㨠0-9ã€ã‚¹ãƒšãƒ¼ã‚¹ã¯ä¸å¯)</small></td> 00402 </tr> 00403 </table> 00404 </fieldset> 00405 00406 <h1>データã®é€ä¿¡</h1> 00407 00408 <p>上ã«æ›¸ã„ã¦ããŸãƒ‡ãƒ¼ã‚¿ãŒæ£ã—ã„ã‹ç¢ºã‹ã‚ã¦ãã ã•ã„。よã‘ã‚Œã°ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒ»ãƒ†ãƒ¼ãƒ–ルã¨æœ€åˆã®ãƒ‡ãƒ¼ã‚¿ã‚’è¨å®šã™ã‚‹ãŸã‚ã«ä¸‹ã®ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ãã ã•ã„。少ã—時間ãŒã‹ã‹ã‚‹ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“ãŒã”辛抱を。<b>ボタンをクリックã™ã‚‹ã®ã¯ä¸€å›žã ã‘ã«ã—ã¦ãã ã•ã„。</b></p> 00409 00410 <p><input name="action" value="go" type="hidden" /> <input type="submit" value="Nucleus CMSã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«" onclick="return checkSubmit();" /></p> 00411 00412 </form> 00413 </body> 00414 </html> 00415 00416 <?php } 00417 00418 function tableName($unPrefixed) { 00419 global $mysql_usePrefix, $mysql_prefix; 00420 00421 if ($mysql_usePrefix == 1) { 00422 return $mysql_prefix . $unPrefixed; 00423 } else { 00424 return $unPrefixed; 00425 } 00426 } 00427 00428 function doInstall() { 00429 global $mysql_usePrefix, $mysql_prefix; 00430 00431 // 0. put all POST-vars into vars 00432 $mysql_host = postVar('mySQL_host'); 00433 $mysql_user = postVar('mySQL_user'); 00434 $mysql_password = postVar('mySQL_password'); 00435 $mysql_database = postVar('mySQL_database'); 00436 $mysql_create = postVar('mySQL_create'); 00437 $mysql_usePrefix = postVar('mySQL_usePrefix'); 00438 $mysql_prefix = postVar('mySQL_tablePrefix'); 00439 $config_indexurl = postVar('IndexURL'); 00440 $config_adminurl = postVar('AdminURL'); 00441 $config_adminpath = postVar('AdminPath'); 00442 $config_mediaurl = postVar('MediaURL'); 00443 $config_skinsurl = postVar('SkinsURL'); 00444 $config_pluginurl = postVar('PluginURL'); 00445 $config_actionurl = postVar('ActionURL'); 00446 $config_mediapath = postVar('MediaPath'); 00447 $config_skinspath = postVar('SkinsPath'); 00448 $user_name = postVar('User_name'); 00449 $user_realname = postVar('User_realname'); 00450 $user_password = postVar('User_password'); 00451 $user_password2 = postVar('User_password2'); 00452 $user_email = postVar('User_email'); 00453 $blog_name = postVar('Blog_name'); 00454 $blog_shortname = postVar('Blog_shortname'); 00455 $config_adminemail = $user_email; 00456 $config_sitename = $blog_name; 00457 00458 $config_indexurl = replaceDoubleBackslash($config_indexurl); 00459 $config_adminurl = replaceDoubleBackslash($config_adminurl); 00460 $config_mediaurl = replaceDoubleBackslash($config_mediaurl); 00461 $config_skinsurl = replaceDoubleBackslash($config_skinsurl); 00462 $config_pluginurl = replaceDoubleBackslash($config_pluginurl); 00463 $config_actionurl = replaceDoubleBackslash($config_actionurl); 00464 $config_adminpath = replaceDoubleBackslash($config_adminpath); 00465 $config_skinspath = replaceDoubleBackslash($config_skinspath); 00466 $config_mediapath = replaceDoubleBackslash($config_mediapath); 00467 00468 // 1. check all the data 00469 $errors = array(); 00470 00471 if (!$mysql_database) { 00472 array_push($errors, 'mySQL database name missing'); 00473 } 00474 00475 if (($mysql_usePrefix == 1) && (strlen($mysql_prefix) == 0) ) { 00476 array_push($errors, 'mySQL prefix was selected, but prefix is empty'); 00477 } 00478 00479 if (($mysql_usePrefix == 1) && (!eregi('^[a-zA-Z0-9_]+$', $mysql_prefix) ) ) { 00480 array_push($errors, 'mySQL prefix should only contain characters from the ranges A-Z, a-z, 0-9 or underscores'); 00481 } 00482 00483 // TODO: add action.php check 00484 if (!endsWithSlash($config_indexurl) || !endsWithSlash($config_adminurl) || !endsWithSlash($config_mediaurl) || !endsWithSlash($config_pluginurl) || !endsWithSlash($config_skinsurl) ) { 00485 array_push($errors, 'One of the URLs does not end with a slash, or action url does not end with \'action.php\''); 00486 } 00487 00488 if (!endsWithSlash($config_adminpath) ) { 00489 array_push($errors, 'The path of the administration area does not end with a slash'); 00490 } 00491 00492 if (!endsWithSlash($config_mediapath) ) { 00493 array_push($errors, 'The media path does not end with a slash'); 00494 } 00495 00496 if (!endsWithSlash($config_skinspath) ) { 00497 array_push($errors, 'The skins path does not end with a slash'); 00498 } 00499 00500 if (!is_dir($config_adminpath) ) { 00501 array_push($errors, 'The path of the administration area does not exist on your server'); 00502 } 00503 00504 if (!_isValidMailAddress($user_email) ) { 00505 array_push($errors, 'Invalid e-mail address given for user'); 00506 } 00507 00508 if (!_isValidDisplayName($user_name) ) { 00509 array_push($errors, 'User name is not a valid display name (allowed chars: a-zA-Z0-9 and spaces)'); 00510 } 00511 00512 if (!$user_password || !$user_password2) { 00513 array_push($errors, 'User password is empty'); 00514 } 00515 00516 if ($user_password != $user_password2) { 00517 array_push($errors, 'User password do not match'); 00518 } 00519 00520 if (!_isValidShortName($blog_shortname) ) { 00521 array_push($errors, 'Invalid short name given for blog (allowed chars: a-z0-9, no spaces)'); 00522 } 00523 00524 if (sizeof($errors) > 0) { 00525 showErrorMessages($errors); 00526 } 00527 00528 // 2. try to log in to mySQL 00529 global $MYSQL_CONN; 00530 $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password); 00531 00532 if ($MYSQL_CONN == false) { 00533 _doError('Could not connect to mySQL server: ' . mysql_error() ); 00534 } 00535 00536 // 3. try to create database (if needed) 00537 if ($mysql_create == 1) { 00538 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() ); 00539 } 00540 00541 // 4. try to select database 00542 mysql_select_db($mysql_database) or _doError('Could not select database. Make sure it exists'); 00543 00544 // 5. execute queries 00545 $filename = 'install.sql'; 00546 $fd = fopen($filename, 'r'); 00547 $queries = fread($fd, filesize($filename) ); 00548 fclose($fd); 00549 00550 $queries = split("(;\n|;\r)", $queries); 00551 00552 $aTableNames = array( 00553 'nucleus_actionlog', 00554 'nucleus_ban', 00555 'nucleus_blog', 00556 'nucleus_category', 00557 'nucleus_comment', 00558 'nucleus_config', 00559 'nucleus_item', 00560 'nucleus_karma', 00561 'nucleus_member', 00562 'nucleus_plugin', 00563 'nucleus_skin', 00564 'nucleus_template', 00565 'nucleus_team', 00566 'nucleus_activation', 00567 'nucleus_tickets' 00568 ); 00569 // these are unneeded (one of the replacements above takes care of them) 00570 // 'nucleus_plugin_event', 00571 // 'nucleus_plugin_option', 00572 // 'nucleus_plugin_option_desc', 00573 // 'nucleus_skin_desc', 00574 // 'nucleus_template_desc', 00575 00576 $aTableNamesPrefixed = array( 00577 $mysql_prefix . 'nucleus_actionlog', 00578 $mysql_prefix . 'nucleus_ban', 00579 $mysql_prefix . 'nucleus_blog', 00580 $mysql_prefix . 'nucleus_category', 00581 $mysql_prefix . 'nucleus_comment', 00582 $mysql_prefix . 'nucleus_config', 00583 $mysql_prefix . 'nucleus_item', 00584 $mysql_prefix . 'nucleus_karma', 00585 $mysql_prefix . 'nucleus_member', 00586 $mysql_prefix . 'nucleus_plugin', 00587 $mysql_prefix . 'nucleus_skin', 00588 $mysql_prefix . 'nucleus_template', 00589 $mysql_prefix . 'nucleus_team', 00590 $mysql_prefix . 'nucleus_activation', 00591 $mysql_prefix . 'nucleus_tickets' 00592 ); 00593 // these are unneeded (one of the replacements above takes care of them) 00594 // $mysql_prefix . 'nucleus_plugin_event', 00595 // $mysql_prefix . 'nucleus_plugin_option', 00596 // $mysql_prefix . 'nucleus_plugin_option_desc', 00597 // $mysql_prefix . 'nucleus_skin_desc', 00598 // $mysql_prefix . 'nucleus_template_desc', 00599 00600 $count = count($queries); 00601 00602 for ($idx = 0; $idx < $count; $idx++) { 00603 $query = trim($queries[$idx]); 00604 // echo "QUERY = <small>" . htmlspecialchars($query) . "</small><p>"; 00605 00606 if ($query) { 00607 00608 if ($mysql_usePrefix == 1) { 00609 $query = str_replace($aTableNames, $aTableNamesPrefixed, $query); 00610 } 00611 00612 mysql_query($query) or _doError('Error while executing query (<small>' . htmlspecialchars($query) . '</small>): ' . mysql_error() ); 00613 } 00614 } 00615 00616 // 6. update global settings 00617 updateConfig('IndexURL', $config_indexurl); 00618 updateConfig('AdminURL', $config_adminurl); 00619 updateConfig('MediaURL', $config_mediaurl); 00620 updateConfig('SkinsURL', $config_skinsurl); 00621 updateConfig('PluginURL', $config_pluginurl); 00622 updateConfig('ActionURL', $config_actionurl); 00623 updateConfig('AdminEmail', $config_adminemail); 00624 updateConfig('SiteName', $config_sitename); 00625 00626 // 7. update GOD member 00627 $query = 'UPDATE ' . tableName('nucleus_member') 00628 . " SET mname='" . addslashes($user_name) . "'," 00629 . " mrealname='" . addslashes($user_realname) . "'," 00630 . " mpassword='" . md5(addslashes($user_password) ) . "'," 00631 . " murl='" . addslashes($config_indexurl) . "'," 00632 . " memail='" . addslashes($user_email) . "'," 00633 . " madmin=1, mcanlogin=1" 00634 . " WHERE mnumber=1"; 00635 00636 mysql_query($query) or _doError('Error while setting member settings: ' . mysql_error() ); 00637 00638 // 8. update weblog settings 00639 $query = 'UPDATE ' . tableName('nucleus_blog') 00640 . " SET bname='" . addslashes($blog_name) . "'," 00641 . " bshortname='" . addslashes($blog_shortname) . "'," 00642 . " burl='" . addslashes($config_indexurl) . "'" 00643 . " WHERE bnumber=1"; 00644 00645 mysql_query($query) or _doError('Error while setting weblog settings: ' . mysql_error() ); 00646 00647 // 9. update item date 00648 $query = 'UPDATE ' . tableName('nucleus_item') 00649 . " SET itime='" . date('Y-m-d H:i:s', time() ) ."'" 00650 . " WHERE inumber=1"; 00651 00652 mysql_query($query) or _doError('Error with query: ' . mysql_error() ); 00653 00654 global $aConfPlugsToInstall, $aConfSkinsToImport; 00655 $aSkinErrors = array(); 00656 $aPlugErrors = array(); 00657 00658 if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) ) { 00659 // 10. set global variables 00660 global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX; 00661 00662 $MYSQL_HOST = $mysql_host; 00663 $MYSQL_USER = $mysql_user; 00664 $MYSQL_PASSWORD = $mysql_password; 00665 $MYSQL_DATABASE = $mysql_database; 00666 $MYSQL_PREFIX = ($mysql_usePrefix == 1)?$mysql_prefix:''; 00667 00668 global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS; 00669 00670 $DIR_NUCLEUS = $config_adminpath; 00671 $DIR_MEDIA = $config_mediapath; 00672 $DIR_SKINS = $config_skinspath; 00673 $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/'; 00674 $DIR_LANG = $DIR_NUCLEUS . 'language/'; 00675 $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; 00676 00677 // close database connection (needs to be closed if we want to include globalfunctions.php) 00678 mysql_close(); 00679 00680 $manager = ''; 00681 include_once($DIR_LIBS . 'globalfunctions.php'); 00682 00683 // 11. install custom skins 00684 $aSkinErrors = installCustomSkins($manager); 00685 00686 // 12. install custom plugins 00687 $aPlugErrors = installCustomPlugs($manager); 00688 } 00689 00690 // 12. Write config file ourselves (if possible) 00691 $bConfigWritten = 0; 00692 00693 if (@file_exists('config.php') && is_writable('config.php') && $fp = @fopen('config.php', 'w') ) { 00694 $config_data = '<' . '?php' . "\n\n"; 00695 //$config_data .= "\n"; (extraneous, just added extra \n to previous line 00696 $config_data .= " // mySQL connection information\n"; 00697 $config_data .= " \$MYSQL_HOST = '" . $mysql_host . "';\n"; 00698 $config_data .= " \$MYSQL_USER = '" . $mysql_user . "';\n"; 00699 $config_data .= " \$MYSQL_PASSWORD = '" . $mysql_password . "';\n"; 00700 $config_data .= " \$MYSQL_DATABASE = '" . $mysql_database . "';\n"; 00701 $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1)?$mysql_prefix:'') . "';\n"; 00702 $config_data .= "\n"; 00703 $config_data .= " // main nucleus directory\n"; 00704 $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; 00705 $config_data .= "\n"; 00706 $config_data .= " // path to media dir\n"; 00707 $config_data .= " \$DIR_MEDIA = '" . $config_mediapath . "';\n"; 00708 $config_data .= "\n"; 00709 $config_data .= " // extra skin files for imported skins\n"; 00710 $config_data .= " \$DIR_SKINS = '" . $config_skinspath . "';\n"; 00711 $config_data .= "\n"; 00712 $config_data .= " // these dirs are normally sub dirs of the nucleus dir, but \n"; 00713 $config_data .= " // you can redefine them if you wish\n"; 00714 $config_data .= " \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n"; 00715 $config_data .= " \$DIR_LANG = \$DIR_NUCLEUS . 'language/';\n"; 00716 $config_data .= " \$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n"; 00717 $config_data .= "\n"; 00718 $config_data .= " // include libs\n"; 00719 $config_data .= " include(\$DIR_LIBS.'globalfunctions.php');\n"; 00720 $config_data .= " if (!extension_loaded('mbstring')) {\n"; 00721 $config_data .= " include(\$DIR_LIBS.'mb_emulator/mb-emulator.php');\n"; 00722 $config_data .= " }\n"; 00723 $config_data .= "?" . ">"; 00724 00725 $result = @fputs($fp, $config_data, strlen($config_data) ); 00726 fclose($fp); 00727 00728 if ($result) { 00729 $bConfigWritten = 1; 00730 } 00731 } 00732 00733 ?> 00734 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 00735 <html xmlns="http://www.w3.org/1999/xhtml"> 00736 <head> 00737 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 00738 <title>Nucleusã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«</title> 00739 <style>@import url('nucleus/styles/manual.css');</style> 00740 </head> 00741 <body> 00742 <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo --> 00743 00744 <?php 00745 $aAllErrors = array_merge($aSkinErrors, $aPlugErrors); 00746 00747 if (count($aAllErrors) > 0) { 00748 echo '<h1>Skin/Plugin Install errors</h1>'; 00749 echo '<ul><li>' . implode('</li><li>', $aAllErrors) . '</li></ul>'; 00750 } 00751 00752 if (!$bConfigWritten) { ?> 00753 <h1>インストールã¯ã»ã¼å®Œäº†ã—ã¾ã—ãŸï¼</h1> 00754 00755 <p>データベーステーブルã®åˆæœŸå€¤å…¥åŠ›ãŒæˆåŠŸã—ã¾ã—ãŸã€‚後ã¯<i>config.php</i>を書ãæ›ãˆã‚‹ã ã‘ã§ã™ã€‚以下ã«æ›¸ãæ›ãˆã‚‹ã¹ã内容を表示ã—ã¾ã™ï¼ˆmysqlã®ãƒ‘スワードã¯ãƒžã‚¹ã‚¯ã•ã‚Œã¦ã„ã¾ã™ã€‚ã“ã“ã¯å®Ÿéš›ã®ã‚‚ã®ã«æ›¸ãæ›ãˆã¦ãã ã•ã„)</p> 00756 00757 <pre><code><?php 00758 // mySQL connection information 00759 $MYSQL_HOST = '<b><?php echo $mysql_host?></b>'; 00760 $MYSQL_USER = '<b><?php echo $mysql_user?></b>'; 00761 $MYSQL_PASSWORD = '<i><b>xxxxxxxxxxx</b></i>'; 00762 $MYSQL_DATABASE = '<b><?php echo $mysql_database?></b>'; 00763 $MYSQL_PREFIX = '<b><?php echo ($mysql_usePrefix == 1)?$mysql_prefix:''?></b>'; 00764 00765 // main nucleus directory 00766 $DIR_NUCLEUS = '<b><?php echo $config_adminpath?></b>'; 00767 00768 // path to media dir 00769 $DIR_MEDIA = '<b><?php echo $config_mediapath?></b>'; 00770 00771 // extra skin files for imported skins 00772 $DIR_SKINS = '<b><?php echo $config_skinspath?></b>'; 00773 00774 // these dirs are normally sub dirs of the nucleus dir, but 00775 // you can redefine them if you wish 00776 $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/'; 00777 $DIR_LANG = $DIR_NUCLEUS . 'language/'; 00778 $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; 00779 00780 // include libs 00781 include($DIR_LIBS.'globalfunctions.php'); 00782 if (!extension_loaded('mbstring')) { 00783 include($DIR_LIBS.'mb_emulator/mb-emulator.php'); 00784 } 00785 ?></code></pre> 00786 00787 <p>ã‚ãªãŸã®ã‚³ãƒ³ãƒ”ュータ上ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’書ãæ›ãˆãŸã‚‰ã€FTPを使ã£ã¦ã‚¦ã‚§ãƒ–サーãƒã«ã‚¢ãƒƒãƒ—ãƒãƒ¼ãƒ‰ã—ã¦ãã ã•ã„。ASCIIモードã§é€ä¿¡ã—ã¦ãƒ•ã‚¡ã‚¤ãƒ«ã‚’上書ãã—ã¾ã™ã€‚</p> 00788 00789 <div class="note"> 00790 <b>付記:</b> <i>config.php</i>ã®æœ€åˆã‚„終ã‚ã‚Šã«ã‚¹ãƒšãƒ¼ã‚¹ã‚’空ã‘ãªã„よã†ã«ã—ã¾ã—ょã†ã€‚実行時ã«ã‚¨ãƒ©ãƒ¼ã‚’引ãèµ·ã“ã™åŽŸå› ã¨ãªã‚Šã¾ã™ã€‚<br /> 00791 ã—ãŸãŒã£ã¦ã€config.phpã®æœ€åˆã®æ–‡å—㯠"<"ã§æœ€å¾Œã®æ–‡å—ã¯">"ã¨ã—ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 00792 </div> 00793 00794 <?php } else { ?> 00795 00796 <h1>インストールã¯å®Œäº†ã—ã¾ã—ãŸï¼</h1> 00797 00798 <p>Nucleusã¯ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã€<code>config.php</code>ã¯ã‚¢ãƒƒãƒ—デートã•ã‚Œã¾ã—ãŸã€‚</p> 00799 00800 <p>ã‚»ã‚ュリティã®ãŸã‚<code>config.php</code>ã®ãƒ‘ーミッションを444ã«æˆ»ã™ã“ã¨ã‚’忘れãªã„ã§ãã ã•ã„(<a href="nucleus/documentation/tips.html#filepermissions">パーミッション変更ã®ç°¡æ˜“ガイド</a>)。</p> 00801 00802 <?php } ?> 00803 00804 <h1>インストールファイルã®å‰Šé™¤</h1> 00805 00806 <p>ウェブサーãƒã‹ã‚‰æ¬¡ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’削除ã—ã¦ãã ã•ã„:</p> 00807 00808 <ul> 00809 <li><b>install.sql</b>:テーブルã®æ§‹é€ を内包ã™ã‚‹ãƒ•ã‚¡ã‚¤ãƒ«</li> 00810 <li><b>install.php</b>:ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«</li> 00811 </ul> 00812 00813 <p>ã‚‚ã—ã“れらã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’削除ã—ã¦ã„ãªã‘ã‚Œã°ã€ç®¡ç†é ˜åŸŸã‚’é–‹ãã“ã¨ãŒå‡ºæ¥ã¾ã›ã‚“。</p> 00814 00815 <h1>ウェブサイトã®ç¢ºèª</h1> 00816 00817 <p>ウェブサイトを使ã†æº–å‚™ãŒæ•´ã„ã¾ã—ãŸã€‚ 00818 <ul> 00819 <li><a href="<?php echo $config_adminurl?>">管ç†é ˜åŸŸã«ãƒã‚°ã‚¤ãƒ³ã—ã¦ã‚µã‚¤ãƒˆã®è¨å®šã‚’è¡Œã†</a></li> 00820 <li><a href="<?php echo $config_indexurl?>">ã™ãã«ã‚µã‚¤ãƒˆã¸è¡Œã£ã¦ã¿ã‚‹</a></li> 00821 </ul> 00822 </p> 00823 00824 </body> 00825 </html> 00826 00827 <?php 00828 } 00829 00830 function installCustomPlugs(&$manager) { 00831 global $aConfPlugsToInstall, $DIR_LIBS; 00832 00833 $aErrors = array(); 00834 00835 if (count($aConfPlugsToInstall) == 0) { 00836 return $aErrors; 00837 } 00838 00839 $res = sql_query('SELECT * FROM ' . sql_table('plugin') ); 00840 $numCurrent = mysql_num_rows($res); 00841 00842 foreach ($aConfPlugsToInstall as $plugName) { 00843 // do this before calling getPlugin (in case the plugin id is used there) 00844 $query = 'INSERT INTO ' . sql_table('plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ', "' . addslashes($plugName) . '")'; 00845 sql_query($query); 00846 00847 // get and install the plugin 00848 $plugin =& $manager->getPlugin($plugName); 00849 00850 if (!$plugin) { 00851 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\'' . addslashes($plugName) . '\''); 00852 $numCurrent--; 00853 array_push($aErrors, 'Unable to install plugin ' . $plugName); 00854 continue; 00855 } 00856 00857 $plugin->install(); 00858 } 00859 00860 // SYNC PLUGIN EVENT LIST 00861 sql_query('DELETE FROM ' . sql_table('plugin_event') ); 00862 00863 // loop over all installed plugins 00864 $res = sql_query('SELECT pid, pfile FROM ' . sql_table('plugin') ); 00865 00866 while($o = mysql_fetch_object($res) ) { 00867 $pid = $o->pid; 00868 $plug =& $manager->getPlugin($o->pfile); 00869 00870 if ($plug) { 00871 $eventList = $plug->getEventList(); 00872 00873 foreach ($eventList as $eventName) { 00874 sql_query('INSERT INTO ' . sql_table('plugin_event') . ' (pid, event) VALUES (' . $pid . ', \'' . $eventName . '\')'); 00875 } 00876 } 00877 } 00878 00879 return $aErrors; 00880 } 00881 00882 function installCustomSkins(&$manager) { 00883 global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS; 00884 00885 $aErrors = array(); 00886 00887 if (count($aConfSkinsToImport) == 0) { 00888 return $aErrors; 00889 } 00890 00891 // load skinie class 00892 include_once($DIR_LIBS . 'skinie.php'); 00893 00894 $importer = new SKINIMPORT(); 00895 00896 foreach ($aConfSkinsToImport as $skinName) { 00897 $importer->reset(); 00898 $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml'; 00899 00900 if (!@file_exists($skinFile) ) { 00901 array_push($aErrors, 'Unable to import ' . $skinFile . ' : file does not exist'); 00902 continue; 00903 } 00904 00905 $error = $importer->readFile($skinFile); 00906 00907 if ($error) { 00908 array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); 00909 continue; 00910 } 00911 00912 $error = $importer->writeToDatabase(1); 00913 00914 if ($error) { 00915 array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); 00916 continue; 00917 } 00918 } 00919 00920 return $aErrors; 00921 } 00922 00923 // give an error if one or more nucleus are not accessible 00924 function doCheckFiles() { 00925 $missingfiles = array(); 00926 $files = array( 00927 'install.sql', 00928 'index.php', 00929 'action.php', 00930 'nucleus/index.php', 00931 'nucleus/libs/globalfunctions.php', 00932 'nucleus/libs/ADMIN.php', 00933 'nucleus/libs/BLOG.php', 00934 'nucleus/libs/COMMENT.php', 00935 'nucleus/libs/COMMENTS.php', 00936 'nucleus/libs/ITEM.php', 00937 'nucleus/libs/MEMBER.php', 00938 'nucleus/libs/SKIN.php', 00939 'nucleus/libs/TEMPLATE.php', 00940 'nucleus/libs/MEDIA.php', 00941 'nucleus/libs/ACTIONLOG.php', 00942 'nucleus/media.php' 00943 ); 00944 00945 $count = count($files); 00946 00947 for ($i = 0; $i < $count; $i++) { 00948 if (!is_readable($files[$i]) ) { 00949 array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.'); 00950 } 00951 } 00952 00953 // The above code replaces several if statements of the form: 00954 00955 // if (!is_readable('install.sql') ) { 00956 // array_push($missingfiles, 'File <b>install.sql</b> is missing or not readable'); 00957 // } 00958 00959 if (count($missingfiles) > 0) { 00960 showErrorMessages($missingfiles); 00961 } 00962 } 00963 00964 function updateConfig($name, $val) { 00965 $name = addslashes($name); 00966 $val = trim(addslashes($val) ); 00967 00968 $query = 'UPDATE ' . tableName('nucleus_config') 00969 . " SET value='$val'" 00970 . " WHERE name='$name'"; 00971 00972 mysql_query($query) or _doError('Query error while trying to update config: ' . mysql_error() ); 00973 return mysql_insert_id(); 00974 } 00975 00976 function replaceDoubleBackslash($input) { 00977 return str_replace('\\', '/', $input); 00978 } 00979 00980 function endsWithSlash($s) { 00981 return (strrpos($s, '/') == strlen($s) - 1); 00982 } 00983 00987 function _isValidMailAddress($address) { 00988 if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address) ) { 00989 return 1; 00990 } else { 00991 return 0; 00992 } 00993 } 00994 00995 // returns true if the given string is a valid shortname 00996 // (to check short blog names and nicknames) 00997 // logic: starts and ends with a non space, can contain spaces in between 00998 // min 2 chars 00999 function _isValidShortName($name) { 01000 if (eregi("^[a-z0-9]+$", $name) ) { 01001 return 1; 01002 } else { 01003 return 0; 01004 } 01005 } 01006 01007 01008 01009 // returns true if the given string is a valid display name 01010 // (to check nicknames) 01011 function _isValidDisplayName($name) { 01012 if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name) ) { 01013 return 1; 01014 } else { 01015 return 0; 01016 } 01017 } 01018 01019 function _doError($msg) { 01020 ?> 01021 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 01022 <html xmlns="http://www.w3.org/1999/xhtml"> 01023 <head> 01024 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 01025 <title>Nucleus Install</title> 01026 <style>@import url('nucleus/styles/manual.css');</style> 01027 </head> 01028 <body> 01029 <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo --> 01030 <h1>Error!</h1> 01031 01032 <p>Error message was: "<?php echo $msg?>";</p> 01033 01034 <p><a href="install.php" onclick="history.back();return false;">Go Back</a></p> 01035 </body> 01036 </html> 01037 01038 <?php 01039 exit; 01040 } 01041 01042 function showErrorMessages($errors) { 01043 ?> 01044 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 01045 <html xmlns="http://www.w3.org/1999/xhtml"> 01046 <head> 01047 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 01048 <title>Nucleus Install</title> 01049 <style>@import url('nucleus/styles/manual.css');</style> 01050 </head> 01051 <body> 01052 <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo --> 01053 <h1>Errors!</h1> 01054 01055 <p>Errors were found:</p> 01056 01057 <ul> 01058 01059 <?php 01060 while($msg = array_shift($errors) ) { 01061 echo '<li>', $msg, '</li>'; 01062 } 01063 ?> 01064 01065 </ul> 01066 01067 <p><a href="install.php" onclick="history.back();return false;">Go Back</a></p> 01068 </body> 01069 </html> 01070 01071 <?php 01072 exit; 01073 } 01074 01075 /* for the non-php systems that decide to show the contents: 01076 ?></div><?php */ 01077 01078 ?>