OSDN Git Service

インストールスクリプトのブログの短縮名に英大文字を使用できるように修正
authorreine <reine49@gmail.com>
Thu, 22 Mar 2012 16:16:13 +0000 (01:16 +0900)
committerreine <reine49@gmail.com>
Thu, 22 Mar 2012 16:16:13 +0000 (01:16 +0900)
CHANGE:config.phpが編集出来なかった場合のテキストをtextareaで表示し、クリックで全文選択できるように変更
CHANGE:install/index.phpでブログの短縮名に英字大文字を使用できるように変更
CHANGE:localeファイルの「ブログ設定」画面でブログの短縮名に英小文字のみ許可する旨の説明を修正(en,jaのみ)

install/index.php
install/locales/en_Latn_US.UTF-8.php
install/locales/ja_Jpan_JP.UTF-8.php
install/styles/inst.css
nucleus/locales/en_Latn_US.ISO-8859-1.php
nucleus/locales/en_Latn_US.UTF-8.php
nucleus/locales/ja_Jpan_JP.EUC-JP.php
nucleus/locales/ja_Jpan_JP.UTF-8.php

index c34edf8..0eea109 100644 (file)
-<?php
-/*
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- * This script will install the Nucleus tables in your SQL-database,
- * and initialize the data in those tables.
- */
-
-/**
- * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id$
- */
-
-/* global values initialize */
-$CONF = array();
-
-/* reporting all errors for support */
-error_reporting(E_ALL);
-
-$minimum_php_version   = '5.0.6';
-$minimum_mysql_version = '3.23';
-
-$page_footer_copyright = '&copy; 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';
-
-// begin if: server's PHP version is below the minimum; halt installation
-if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )
-{
-       exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version '. $minimum_php_version .'</div>');
-}
-
-// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);
-if ( version_compare(PHP_VERSION, '5.3.0', '<') )
-{
-       ini_set('magic_quotes_runtime', '0');
-}
-
-/* default installed plugins and skins */
-$aConfPlugsToInstall   = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Text');
-$aConfSkinsToImport            = array('atom', 'rss2.0', 'rsd', 'default');
-
-// Check if some important files
-do_check_files();
-
-/* i18n class is needed for internationalization */
-include_once('../nucleus/libs/i18n.php');
-if ( !i18n::init('UTF-8', './locales') )
-{
-       exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');
-}
-
-// check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x
-if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )
-{
-       exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');
-}
-
-// include core classes that are needed for login & plugin handling
-include_once('../nucleus/libs/mysql.php');
-
-// added for 3.5 sql_* wrapper
-global $MYSQL_HANDLER;
-
-if ( !isset($MYSQL_HANDLER) )
-{
-       $MYSQL_HANDLER = array('mysql', '');
-}
-include_once('../nucleus/libs/sql/' . $MYSQL_HANDLER[0] . '.php');
-
-session_start();
-if ( count($_GET) == 0 && count($_POST) == 0 )
-{
-       unset($_SESSION['param_manager']);
-}
-
-// restore the $param from the session
-if ( array_key_exists('param_manager', $_SESSION) )
-{
-       $param = $_SESSION['param_manager'];
-}
-else
-{
-       $param = new PARAM_MANAGER();
-}
-
-// include translation file
-if ( array_key_exists('locale', $_POST) ) $param->set_locale();
-i18n::set_current_locale($param->locale);
-$translation_file = './locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php';
-if ( !file_exists($translation_file) )
-{
-       $translation_file = './locales/en_Latn_US.UTF-8.php';
-}
-include($translation_file);
-
-do_action();
-
-// $param is saved to the session
-if ( isset($param) )
-{
-       $_SESSION['param_manager'] = $param;
-}
-else
-{
-       unset($_SESSION['param_manager']);
-}
-exit;
-
-
-/**
- * installer action
- */
-function do_action()
-{
-       global $param;
-
-       if ( array_key_exists('action', $_POST) )
-       {
-               $isPostback = true;
-       }
-       else
-       {
-               $isPostback = false;
-       }
-
-       // mode change
-       if ( array_key_exists('mode', $_REQUEST) )
-       {
-               if ( $_REQUEST['mode'] == 'detail' )
-               {
-                       $param->set_state('detail');
-               }
-               elseif ( $_REQUEST['mode'] == 'simple' )
-               {
-                       $param->set_state('mysql');
-               }
-       }
-
-       // input parameter check
-       if ( $isPostback )
-       {
-               switch ( $param->state )
-               {
-                       case 'locale':
-                               $param->set_locale();
-                               $param->set_state('mysql');
-                               $isPostback = false;
-                               break;
-                       case 'mysql':
-                               if ( count($param->check_mysql_parameters()) == 0 )
-                               {
-                                       $param->set_state('weblog');
-                                       $isPostback = false;
-                               }
-                               break;
-                       case 'weblog':
-                               if ( count($param->check_user_parameters()) == 0
-                                       && count($param->check_weblog_parameters()) == 0 )
-                               {
-                                       $param->set_state('install');
-                                       $isPostback = false;
-                               }
-                               break;
-                       case 'detail':
-                               if ( $param->check_all_parameters() )
-                               {
-                                       $param->set_state('install');
-                                       $isPostback = false;
-                               }
-                               break;
-               }
-       }
-
-       // page render
-       show_header();
-       switch ( $param->state )
-       {
-               case 'locale':
-                       show_select_locale_form();
-                       break;
-               case 'mysql':
-                       show_database_setting_form($isPostback);
-                       break;
-               case 'weblog':
-                       show_blog_setting_form($isPostback);
-                       break;
-               case 'detail':
-                       show_detail_setting_form($isPostback);
-                       break;
-               case 'install':
-                       show_install_complete_form();
-                       break;
-       }
-       show_footer();
-}
-
-/**
- * header tag of the installation screens
- **/
-function show_header()
-{
-       global $param;
-
-       /* HTTP 1.1 application for no caching */
-       header("Cache-Control: no-cache, must-revalidate");
-       header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
-       header('Content-Type: text/html; charset=' . i18n::get_current_charset());
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-       <head>
-               <title><?php echo _TITLE; ?></title>
-               <link rel="stylesheet" type="text/css" href="./styles/inst.css" />
-               <style type="text/css">
-               <!--
-               <?php echo _BODYFONTSTYLE; ?>
-               -->
-               </style>
-       </head>
-       <body>
-               <div id="header">
-                       <div id="navigation">
-                               <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>
-                               <ul>
-                                       <?php
-                                       if ( in_array($param->state, array('mysql', 'weblog', 'install')) )
-                                       {
-                                               echo '<li>', _STEP1, '</li><li';
-                                               if ( $param->state == 'mysql' )
-                                               {
-                                                       echo ' class="gry"';
-                                               }
-                                               echo '>&nbsp; &gt; &nbsp;', _STEP2, '</li><li';
-                                               if ( in_array($param->state, array('mysql', 'weblog')) )
-                                               {
-                                                       echo ' class="gry"';
-                                               }
-                                               echo '>&nbsp; &gt; &nbsp;', _STEP3, "</li>\n";
-                                       }
-                                       if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )
-                                       {
-                                               echo '<li class="rightbox">';
-                                               if ( in_array($param->state, array('mysql', 'weblog')) )
-                                               {
-                                                       echo '<a href="./?mode=detail">', _MODE2, '</a>';
-                                               }
-                                               else
-                                               {
-                                                       echo '<a href="./?mode=simple">', _MODE1, '</a>';
-                                               }
-                                               echo '</li>';
-                                       }
-                                       ?>
-                               </ul>
-                       </div>
-               </div>
-<?php
-}
-
-/**
- * footer tag of the installation screens
- **/
-function show_footer()
-{
-       global $page_footer_copyright;
-?>
-               <div id="footer">
-                       <?php echo $page_footer_copyright; ?>
-               </div>
-       </body>
-</html>
-<?php
-}
-
-/**
- * Display the form for language select
- */
-function show_select_locale_form()
-{
-       // Get the browser language that can be displayed
-       // TODO: default locale select simple implementation
-       $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
-       foreach ($languages as $language)
-       {
-               $language = preg_replace('#([\w]+).*#', '$1', $language);
-               break;
-       }
-
-       $locales = array(
-               array('en_Latn_US', 'English - United States'),
-               array('ja_Jpan_JP', 'Japanese - Japan')
-       );
-?>
-               <div id="container">
-                       <p style="font-size:152%;font-weight:bold;">
-                               Select your locale:
-                       </p>
-                       <form method="post" action="./index.php">
-
-                               <div class="prt">
-                                       <select name="locale">
-<?php
-       foreach ( $locales as $locale )
-       {
-               echo "<option value=\"$locale[0]\"";
-               if ( i18n::strpos($locale[0], $language) === 0 )
-               {
-                       echo ' selected';
-               }
-               echo ">$locale[1]</option>\n";
-       }
-?>
-                                       </select>
-                                       <p class="sbt">
-                                               <button type="submit" name="action" value="locale" class="sbt_arw">START</button>
-                                       </p>
-                               </div>
-                       </form>
-               </div>
-<?php
-}
-
-/**
- * Display the form to set up a database
- * @param bool $isPostback
- */
-function show_database_setting_form($isPostback)
-{
-       global $param, $minimum_mysql_version;
-
-       $config_writable = canConfigFileWritable();
-       $mysql_version = getMySqlVersion();
-       ?>
-               <div id="container">
-                       <p class="msg">
-<?php
-       echo _SIMPLE_NAVI1;
-       if ( $config_writable != '' )
-       {
-               echo '<span class="err">', $config_writable, '</span>';
-       }
-       if ( $mysql_version == '0.0.0' )
-       {
-               echo '<span class="err">', _ERROR21, '</span>';
-       }
-       elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )
-       {
-               echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';
-       }
-?>
-                       </p>
-                       <form method="post" action="./index.php">
-                               <div class="prt">
-                                       <h2><?php echo _DB_HEADER; ?></h2>
-                                       <p class="msg">
-<?php
-       if ( $isPostback )
-       {
-               $errors = $param->check_mysql_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
-                                               </tr>
-                                       </table>
-                                       <p class="sbt">
-                                               <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>
-                                               <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>
-                                       </p>
-                                       <p class="msg">
-                                               <?php echo _DB_TEXT1; ?>
-                                       </p>
-                               </div>
-                       </form>
-               </div>
-<?php
-}
-
-/**
- * Displays a form to the blog settings
- * @param bool $isPostback
- */
-function show_blog_setting_form($isPostback)
-{
-       global $param;
-
-?>
-               <div id="container">
-                       <p class="msg">
-                               <?php echo _SIMPLE_NAVI2; ?>
-                       </p>
-                       <form method="post" action="./index.php">
-                               <div class="prt">
-                                       <h2><?php echo _BLOG_HEADER; ?></h2>
-                                       <p class="msg">
-<?php
-       if ( $isPostback )
-       {
-               $errors = $param->check_weblog_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
-                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
-                                               </tr>
-                                       </table>
-                               </div>
-
-                               <div class="prt">
-                                       <h2><?php echo _ADMIN_HEADER; ?></h2>
-                                       <p class="msg">
-<?php
-       if ( $isPostback )
-       {
-               $errors = $param->check_user_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
-                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>
-                                                               <td><input type="password" name="user_password" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>
-                                                               <td><input type="password" name="user_password2" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
-                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
-                                               </tr>
-                                       </table>
-                                       <p class="sbt">
-                                               <button type="submit" name="action" value="weblog" class="sbt_arw"><?php echo _INSTALL; ?></button>
-                                       </p>
-                               </div>
-                       </form>
-               </div>
-<?php
-}
-
-/**
- * Displays a form to the detail settings
- * @param bool $isPostback
- */
-function show_detail_setting_form($isPostback)
-{
-       global $param, $minimum_mysql_version;
-
-       $mysql_version = getMySqlVersion();
-?>
-               <div id="container_detailed">
-                       <p class="msg">
-                               <?php echo _DETAIL_NAVI1; ?>
-<?php
-       if ( $isPostback && !$param->check_all_parameters() )
-       {
-               echo '<span class="err">', _ERROR26, "</span>\n";
-       }
-?>
-                       </p>
-                       <ul class="msg">
-                               <li>PHP: <?php echo phpversion(); ?></li>
-                               <li>MySQL:
-<?php
-       echo ($mysql_version == '0.0.0') ? _ERROR21 : $mysql_version;
-       if ( version_compare($mysql_version, $minimum_mysql_version, '<') )
-       {
-               echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';
-       }
-?></li>
-                       </ul>
-                       <form method="post" action="">
-
-                               <div class="prt">
-                                       <h2><?php echo _DETAIL_HEADER1; ?></h2>
-                                       <p class="msg">
-<?php
-       if ( $isPostback )
-       {
-               $errors = $param->check_mysql_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>
-                                                               <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>
-                                               </tr>
-                                       </table>
-
-                                       <h2><?php echo _DETAIL_HEADER2; ?></h2>
-                                       <p class="msg">
-<?php
-       if ( $isPostback )
-       {
-               $errors = $param->check_uri_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-               $errors = $param->check_path_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>
-                                                               <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>
-                                                               <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>
-                                                               <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>
-                                                               <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>
-                                                               <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>
-                                                               <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>
-                                                               <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>
-                                                               <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>
-                                                               <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>
-                                               </tr>
-                                       </table>
-                                       <p class="msg">
-                                               <?php echo _DETAIL_TEXT3; ?>
-                                       </p>
-
-                                       <h2><?php echo _DETAIL_HEADER3; ?></h2>
-                                       <p class="msg">
-<?php
-       echo _DETAIL_TEXT4;
-       if ( $isPostback )
-       {
-               $errors = $param->check_user_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
-                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>
-                                                               <td><input type="password" name="user_password" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>
-                                                               <td><input type="password" name="user_password2" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
-                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
-                                               </tr>
-                                       </table>
-
-                                       <h2><?php echo _DETAIL_HEADER4; ?></h2>
-                                       <p class="msg">
-<?php
-       echo _DETAIL_TEXT5;
-       if ( $isPostback )
-       {
-               $errors = $param->check_weblog_parameters();
-               if ( is_array($errors) )
-               {
-                       foreach ( $errors as $error )
-                       {
-                               echo '<span class="err">', $error, "</span>\n";
-                       }
-               }
-       }
-?>
-                                       </p>
-                                       <table>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
-                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
-                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
-                                               </tr>
-                                       </table>
-
-                                       <p class="msg">
-                                               <?php echo _DETAIL_TEXT6; ?>
-                                       </p>
-
-                                       <p class="sbt">
-                                               <button type="submit" name="action" value="detail" class="sbt_arw"><?php echo _INSTALL; ?></button>
-                                       </p>
-                               </div>
-                       </form>
-               </div>
-<?php
-}
-
-/**
- * Displays a screen to signal the completion of the installation
- */
-function show_install_complete_form()
-{
-       global $MYSQL_HANDLER, $param;
-       $errors = do_install();
-?>
-               <div id="container">
-                       <p class="msg">
-<?php
-       if ( is_array($errors) && count($errors) > 0 )
-       {
-               echo _ERROR27;
-               foreach ( $errors as $error )
-               {
-                       echo '<span class="err">', $error, "</span>\n";
-               }
-       }
-       else
-       {
-               echo _INST_TEXT;
-               if ( array_key_exists('config_data', $_SESSION) )
-               {
-                       echo '<span class="err">', _INST_TEXT4, '</span>';
-                       // FIXME: textareaにしてJavascriptでコピーできたらいい?
-?>
-<pre><code><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset() ) ?></code></pre>
-<?php
-               }
-               else
-               {
-                       echo '<span class="err">', _INST_TEXT5, '</span>';
-               }
-?>
-                       </p>
-                       <form method="post" action="./index.php">
-                               <div class="prt">
-                                       <h2><?php echo _INST_HEADER1; ?></h2>
-                                       <p class="msg">
-                                               <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>
-                                       </p>
-                                       <p class="sbt">
-                                               <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>
-                                       </p>
-                               </div>
-
-                               <div class="prt">
-                                       <h2><?php echo _INST_HEADER2; ?></h2>
-                                       <p class="msg">
-                                               <?php echo _INST_TEXT2; ?>
-                                       </p>
-                                       <p class="sbt">
-                                               <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>
-                                       </p>
-                               </div>
-
-                               <div class="prt">
-                                       <h2><?php echo _INST_HEADER3; ?></h2>
-                                       <p class="msg">
-                                               <?php echo _INST_TEXT3; ?>
-                                       </p>
-                                       <p class="sbt">
-                                               <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>
-                                       </p>
-                               </div>
-                       </form>
-<?php
-       }
-?>
-               </div>
-<?php
-       unset($param);
-}
-
-/**
- * The installation process itself
- * @return array error messages
- */
-function do_install()
-{
-       global $param;
-       global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;
-       global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;
-       $errors = array();
-
-       /*
-        * 1. put all param-vars into vars
-        */
-       $MYSQL_HOST = $param->mysql_host;
-       $MYSQL_USER = $param->mysql_user;
-       $MYSQL_PASSWORD = $param->mysql_password;
-       $MYSQL_DATABASE = $param->mysql_database;
-       $MYSQL_PREFIX = $param->mysql_tablePrefix;
-
-       $DIR_NUCLEUS = $param->AdminPath;
-       $DIR_MEDIA = $param->MediaPath;
-       $DIR_SKINS = $param->SkinsPath;
-       $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
-       $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';
-       $DIR_LIBS = $DIR_NUCLEUS . 'libs/';
-
-       /*
-        * 2.open mySQL connection
-        */
-       $MYSQL_CONN = @sql_connect_args($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
-       if ( $MYSQL_CONN == false )
-       {
-               $errors[] = _ERROR3;
-               return $errors;
-       }
-
-       /*
-        * 3. try to create database if needed
-        */
-       if ( !sql_query('CREATE DATABASE IF NOT EXISTS `' . $MYSQL_DATABASE . '`') )
-       {
-               $errors[] = _ERROR12 . ': ' . sql_error();
-       }
-
-       /*
-        * 4. try to select database
-        */
-       if ( !sql_select_db($MYSQL_DATABASE) )
-       {
-               $errors[] = _ERROR13;
-       }
-       sql_set_charset('utf8');
-
-       if ( count($errors) > 0 )
-       {
-               return $errors;
-       }
-
-       /*
-        * 5. execute queries
-        */
-       $table_names = array(
-               'nucleus_actionlog',
-               'nucleus_ban',
-               'nucleus_blog',
-               'nucleus_category',
-               'nucleus_comment',
-               'nucleus_config',
-               'nucleus_item',
-               'nucleus_karma',
-               'nucleus_member',
-               'nucleus_plugin',
-               'nucleus_skin',
-               'nucleus_template',
-               'nucleus_team',
-               'nucleus_activation',
-               'nucleus_tickets'
-       );
-
-       $prefixed_table_names = array();
-       foreach ( $table_names as $table_name )
-       {
-               $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;
-       }
-
-       // table exists check
-       $result = sql_query('SHOW TABLES');
-       while ($row = mysql_fetch_array($result, MYSQL_NUM))
-       {
-               if ( in_array($row[0], $prefixed_table_names) )
-               {
-                       $errors[] = _ERROR14;
-                       break;
-               }
-       }
-       if ( count($errors) > 0 )
-       {
-               return $errors;
-       }
-
-       $filename = 'install.sql';
-       $fd = fopen($filename, 'r');
-       $queries = fread($fd, filesize($filename) );
-       fclose($fd);
-
-       $queries = preg_split('#(;\n|;\r)#', $queries);
-
-       foreach ( $queries as $query )
-       {
-               if ( preg_match('/\w+/', $query) )
-               {
-                       if ( $MYSQL_PREFIX )
-                       {
-                               $query = str_replace($table_names, $prefixed_table_names, $query);
-                       }
-
-                       if ( !sql_query($query) )
-                       {
-                               $errors[] = _ERROR15 . ' (<small>' . $query . '</small>): ' . sql_error();
-                       }
-               }
-       }
-
-       /*
-        * 6. put needed records
-        */
-       /* push first post */
-       $query = "INSERT INTO %s VALUES (1, '%s', '%s', '%s', 1, 1, '%s', 0, 0, 0, 1, 0, 1)";
-       $query = sprintf($query, tableName('nucleus_item'), _1ST_POST_TITLE, _1ST_POST, _1ST_POST2, i18n::formatted_datetime('mysql', time()));
-       if ( !sql_query($query) )
-       {
-               $errors[] = _ERROR15 . ' (<small>' . $newpost . '</small>): ' . sql_error();
-       }
-
-       /* push configurations */
-       array_merge($errors, updateConfig('IndexURL', $param->IndexURL));
-       array_merge($errors, updateConfig('AdminURL', $param->AdminURL));
-       array_merge($errors, updateConfig('MediaURL', $param->MediaURL));
-       array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));
-       array_merge($errors, updateConfig('PluginURL', $param->PluginURL));
-       array_merge($errors, updateConfig('ActionURL', $param->ActionURL));
-       array_merge($errors, updateConfig('AdminEmail', $param->user_email));
-       array_merge($errors, updateConfig('SiteName', $param->blog_name));
-       array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));
-
-       /* escape strings for SQL */
-       $user_name                      = sql_real_escape_string($param->user_name);
-       $user_realname          = sql_real_escape_string($param->user_realname);
-       $user_password          = sql_real_escape_string(md5($param->user_password));
-       $user_email                     = sql_real_escape_string($param->user_email);
-       $blog_name                      = sql_real_escape_string($param->blog_name);
-       $blog_shortname         = sql_real_escape_string($param->blog_shortname);
-       $config_indexurl        = sql_real_escape_string($param->IndexURL);
-
-       /* push super admin */
-       $query = "UPDATE %s SET mname = '%s', mrealname = '%s', mpassword = '%s', memail = '%s', murl = '%s', madmin = 1, mcanlogin = 1 WHERE mnumber = 1";
-       $query = sprintf($query, tableName('nucleus_member'), $user_name, $user_realname, $user_password, $user_email, $config_indexurl);
-       if ( !sql_query($query) )
-       {
-               $errors[] = _ERROR16 . ': ' . sql_error();
-       }
-
-       /* push new weblog */
-       $query = "UPDATE %s SET bname = '%s', bshortname = '%s', burl = '%s' WHERE bnumber = 1";
-       $query = sprintf($query, tableName('nucleus_blog'), $blog_name, $blog_shortname, $config_indexurl);
-       if ( !sql_query($query) )
-       {
-               $errors[] = _ERROR17 . ': ' . sql_error();
-       }
-
-       /* push default category */
-       $query = "UPDATE %s SET cname = '%s', cdesc = '%s' WHERE catid = 1";
-       $query = sprintf($query, tableName('nucleus_category'), _GENERALCAT_NAME, _GENERALCAT_DESC);
-       if ( !sql_query($query) )
-       {
-               $errors[] = _ERROR17 . ': ' . sql_error();
-       }
-
-       sql_close();
-
-       /*
-        * 7. install default plugins and skins
-        */
-       global $aConfPlugsToInstall, $aConfSkinsToImport;
-       $aSkinErrors = array();
-       $aPlugErrors = array();
-
-       if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )
-       {
-               include_once($DIR_LIBS . 'globalfunctions.php');
-               global $manager;
-               if ( !isset($manager) )
-               {
-                       $manager = new MANAGER;
-               }
-
-               $aSkinErrors = installCustomSkins();
-               if ( count($aSkinErrors) > 0 )
-               {
-                       array_merge($errors, $aSkinErrors);
-               }
-
-               $query  = "SELECT sdnumber FROM %s WHERE sdname='default'";
-               $query = sprintf($query, tableName('nucleus_skin_desc'));
-               $res = sql_query($query);
-               $obj = sql_fetch_assoc($res);
-               $defSkinID = (integer) $obj['sdnumber'];
-
-               $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";
-               $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);
-               sql_query($query);
-               $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";
-               $query = sprintf($query, tableName('nucleus_config'), $defSkinID);
-               sql_query($query);
-
-               $aPlugErrors = installCustomPlugs($manager);
-               if ( count($aPlugErrors) > 0 )
-               {
-                       array_merge($errors, $aPlugErrors);
-               }
-       }
-
-       /*
-        * 8. Write config file ourselves (if possible)
-        */
-       $config_data = '<' . '?php' . "\n";
-       $config_data .= "// mySQL connection information\n";
-       $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";
-       $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";
-       $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";
-       $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";
-       $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";
-       $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";
-       $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";
-       $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";
-       $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";
-       $config_data .= "\$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n";
-       $config_data .= "\n";
-       $config_data .= "// main nucleus directory\n";
-       $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";
-       $config_data .= "\n";
-       $config_data .= "// path to media dir\n";
-       $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";
-       $config_data .= "\n";
-       $config_data .= "// extra skin files for imported skins\n";
-       $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";
-       $config_data .= "\n";
-       $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";
-       $config_data .= "// you can redefine them if you wish\n";
-       $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";
-       $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";
-       $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";
-       $config_data .= "\n";
-       $config_data .= "// include libs\n";
-       $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";
-       $config_data .= "?" . ">";
-
-       $result = false;
-       if ( @!file_exists('../config.php') || is_writable('../config.php') )
-       {
-               if ( $fp = @fopen('../config.php', 'w') )
-               {
-                       $result = @fwrite($fp, $config_data, i18n::strlen($config_data) );
-                       fclose($fp);
-               }
-       }
-
-       if ( $result )
-       {
-               // try to change the read-only permission.
-               if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
-               {
-                       @chmod('../config.php', 0444);
-               }
-       }
-       else
-       {
-               $_SESSION['config_data'] = $config_data;
-       }
-
-       return $errors;
-}
-
-/**
- * Confirm that you can write to the configuration file
- * @return string error message
- */
-function canConfigFileWritable()
-{
-       if ( @file_exists('../config.php') && @!is_writable('../config.php') )
-       {
-               // try to change the read-write permission.
-               if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
-               {
-                       @chmod('../config.php', 0666);
-               }
-
-               if ( @!is_writable('../config.php') )
-               {
-                       return _ERROR19;
-               }
-       }
-       return '';
-}
-
-/**
- * To obtain the version of MySQL
- * @return string
- */
-function getMySqlVersion()
-{
-       global $minimum_mysql_version, $errors;
-       // Turn on output buffer
-       // Needed to repress the output of the sql function that are
-       // not part of php (in this case the @ operator doesn't work)
-       ob_start();
-
-       // note: this piece of code is taken from phpMyAdmin
-       $conn = sql_connect_args('localhost', '', '');
-       $result = @sql_query('SELECT VERSION() AS version', $conn);
-
-       if ( $result != FALSE && sql_num_rows($result) > 0 )
-       {
-               $row = sql_fetch_array($result);
-               $match = i18n::explode('.', $row['version']);
-       }
-       else
-       {
-               $result = @sql_query('SHOW VARIABLES LIKE \'version\'', $conn);
-
-               if ( $result != FALSE && @sql_num_rows($result) > 0 )
-               {
-                       $row = sql_fetch_row($result);
-                       $match = i18n::explode('.', $row[1]);
-               }
-               else
-               {
-                       //$output = shell_exec('mysql -V');
-                       $output = ( function_exists('shell_exec') ) ? @shell_exec('mysql -V') : '0.0.0';
-                       preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
-                       $match = i18n::explode('.', $version[0]);
-
-                       if ( $match[0] == '' )
-                       {
-                               $match = array('0', '0', '0');
-                       }
-               }
-       }
-
-       @sql_disconnect($conn);
-
-       //End and clean output buffer
-       ob_end_clean();
-
-       return implode($match, '.');
-}
-
-/**
- * Add a table prefix if it is used
- *
- * @param string $input table name with prefix
- * @return string
- */
-function tableName($input)
-{
-       global $MYSQL_PREFIX;
-       if ( $MYSQL_PREFIX )
-       {
-               return $MYSQL_PREFIX . $input;
-       }
-       else
-       {
-               return $input;
-       }
-}
-
-/**
- * Install custom plugins
- *
- * @param object $manager MANAGER class instance
- */
-function installCustomPlugs($manager)
-{
-       global $aConfPlugsToInstall, $DIR_LIBS;
-
-       $aErrors = array();
-       if ( count($aConfPlugsToInstall) == 0 )
-       {
-               return $aErrors;
-       }
-
-       $res = sql_query('SELECT * FROM ' . tableName('nucleus_plugin') );
-       $numCurrent = sql_num_rows($res);
-
-       foreach ( $aConfPlugsToInstall as $plugName )
-       {
-               $query = 'INSERT INTO ' . tableName('nucleus_plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ", '" . sql_real_escape_string($plugName) . "')";
-               sql_query($query);
-
-               $manager->clearCachedInfo('installedPlugins');
-               $plugin =& $manager->getPlugin($plugName);
-               $plugin->setID($numCurrent);
-
-               if ( !$plugin )
-               {
-                       sql_query('DELETE FROM ' . tableName('nucleus_plugin') . " WHERE pfile = '" . sql_real_escape_string($plugName) . "'");
-                       $numCurrent--;
-                       array_push($aErrors, sprintf(_ERROR22 ,$plugName));
-                       continue;
-               }
-               $plugin->install();
-       }
-
-       sql_query('DELETE FROM ' . tableName('nucleus_plugin_event') );
-       $res = sql_query('SELECT pid, pfile FROM ' . tableName('nucleus_plugin') );
-
-       while ( $o = sql_fetch_object($res) )
-       {
-               $pid = $o->pid;
-               $plug =& $manager->getPlugin($o->pfile);
-
-               if ( $plug )
-               {
-                       $eventList = $plug->getEventList();
-                       foreach ( $eventList as $eventName )
-                       {
-                               sql_query('INSERT INTO ' . tableName('nucleus_plugin_event') . ' (pid, event) VALUES (' . $pid . ", '" . $eventName . "')");
-                       }
-               }
-       }
-       return $aErrors;
-}
-
-/**
- * Install custom skins
- * Prepares the installation of custom skins
- */
-function installCustomSkins()
-{
-       global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;
-
-       $aErrors = array();
-       if ( count($aConfSkinsToImport) == 0 )
-       {
-               return $aErrors;
-       }
-
-       include_once($DIR_LIBS . 'skinie.php');
-       $importer = new SKINIMPORT();
-
-       foreach ( $aConfSkinsToImport as $skinName )
-       {
-               $importer->reset();
-               $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';
-
-               if ( !@file_exists($skinFile) )
-               {
-                       array_push($aErrors, sprintf(_ERROR23, $skinFile));
-                       continue;
-               }
-
-               $error = $importer->readFile($skinFile);
-
-               if ( $error )
-               {
-                       array_push($aErrors, sprintf(_ERROR24, $skinName) . ' : ' . $error);
-                       continue;
-               }
-
-               $error = $importer->writeToDatabase(1);
-
-               if ( $error )
-               {
-                       array_push($aErrors, sprintf(_ERROR25, $skinName) . ' : ' . $error);
-                       continue;
-               }
-       }
-       return $aErrors;
-}
-
-
-/**
- * Check if some important files of the Nucleus CMS installation are available
- * Give an error if one or more files are not accessible
- */
-function do_check_files()
-{
-       $missingfiles = array();
-       $files = array(
-               './install.sql',
-               '../index.php',
-               '../action.php',
-               '../nucleus/index.php',
-               '../nucleus/media.php',
-               '../nucleus/libs/ACTION.php',
-               '../nucleus/libs/ACTIONLOG.php',
-               '../nucleus/libs/ACTIONS.php',
-               '../nucleus/libs/ADMIN.php',
-               '../nucleus/libs/BaseActions.php',
-               '../nucleus/libs/BLOG.php',
-               '../nucleus/libs/BODYACTIONS.php',
-               '../nucleus/libs/COMMENT.php',
-               '../nucleus/libs/COMMENTACTIONS.php',
-               '../nucleus/libs/COMMENTS.php',
-               '../nucleus/libs/ENCAPSULATE.php',
-               '../nucleus/libs/ENTITY.php',
-               '../nucleus/libs/globalfunctions.php',
-               '../nucleus/libs/i18n.php',
-               '../nucleus/libs/ITEM.php',
-               '../nucleus/libs/ITEMACTIONS.php',
-               '../nucleus/libs/LINK.php',
-               '../nucleus/libs/MANAGER.php',
-               '../nucleus/libs/MEDIA.php',
-               '../nucleus/libs/MEMBER.php',
-               '../nucleus/libs/mysql.php',
-               '../nucleus/libs/NOTIFICATION.php',
-               '../nucleus/libs/PAGEFACTORY.php',
-               '../nucleus/libs/PARSER.php',
-               '../nucleus/libs/PLUGIN.php',
-               '../nucleus/libs/PLUGINADMIN.php',
-               '../nucleus/libs/SEARCH.php',
-               '../nucleus/libs/showlist.php',
-               '../nucleus/libs/SKIN.php',
-               '../nucleus/libs/TEMPLATE.php',
-               '../nucleus/libs/vars4.1.0.php',
-               '../nucleus/libs/xmlrpc.inc.php',
-               '../nucleus/libs/xmlrpcs.inc.php',
-               '../nucleus/libs/sql/mysql.php'
-       );
-
-       $count = count($files);
-       for ( $i = 0; $i < $count; $i++ )
-       {
-               if ( !is_readable($files[$i]) )
-               {
-                       array_push( $missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');
-               }
-       }
-
-       if ( count($missingfiles) > 0 )
-       {
-               exit(implode( "\n", $missingfiles));
-       }
-}
-
-
-/**
- * Updates the configuration in the database
- *
- * @param string $name name of the config var
- * @param string $value new value of the config var
- * @return array
- */
-function updateConfig($name, $value)
-{
-       $errors = array();
-       $name = sql_real_escape_string($name);
-       $value = trim(sql_real_escape_string($value) );
-
-       $query = "UPDATE %s SET value = '%s' WHERE name = '%s'";
-       $query = sprintf($query, tableName('nucleus_config'), $value, $name);
-
-       if ( !sql_query($query) )
-       {
-               $errors[] = _ERROR15 . ': ' . sql_error();
-       }
-       return $errors;
-}
-
-
-class PARAM_MANAGER
-{
-       /* process parameter */
-       public $state;
-       public $locale;
-
-       /* mysql connection parameters */
-       public $mysql_host;
-       public $mysql_user;
-       public $mysql_password;
-       public $mysql_database;
-       public $mysql_tablePrefix;
-
-       /* weblog configuration parameters */
-       public $blog_name;
-       public $blog_shortname;
-
-       /* member configuration parameters */
-       public $user_name;
-       public $user_realname;
-       public $user_password;
-       private $user_password2;
-       public $user_email;
-
-       /* URI parameters  */
-       private $root_url;
-       public $IndexURL;
-       public $AdminURL;
-       public $MediaURL;
-       public $SkinsURL;
-       public $PluginURL;
-       public $ActionURL;
-
-       /* path parameters */
-       private $root_path;
-       public $AdminPath;
-       public $MediaPath;
-       public $SkinsPath;
-
-       /**
-        * constructor
-        */
-       public function __construct()
-       {
-               $this->init();
-       }
-
-       public function init()
-       {
-               // set default values
-               $this->state = 'locale';
-               $this->install_mode = 'simple';
-               $this->locale = 'en_Latn_US';
-               $this->mysql_host = @ini_get('mysql.default_host');
-               $this->blog_name = 'My Nucleus CMS';
-               $this->blog_shortname = 'mynucleuscms';
-
-               /* root path */
-               $this->root_path = realpath(dirname(__FILE__) . '/..');
-               if ( substr($this->root_path, -1, 1) !== '/' )
-               {
-                       $this->root_path .= '/';
-               }
-               $base_path_pcre = preg_quote($this->root_path, '#');
-
-               /* current directry name */
-               $directory_name = preg_replace("#$base_path_pcre#", '', dirname(__FILE__));
-               $directory_name_pcre = preg_quote($directory_name, '#');
-
-               /* root uri */
-               $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
-               $this->root_url = preg_replace("#$directory_name_pcre(.*)$#", '', $root_url);
-
-               $this->AdminPath = $this->root_path . 'nucleus' . DIRECTORY_SEPARATOR;
-               $this->MediaPath = $this->root_path . 'media' . DIRECTORY_SEPARATOR;
-               $this->SkinsPath = $this->root_path . 'skins' . DIRECTORY_SEPARATOR;
-
-               $this->IndexURL  = $this->root_url;
-               $this->AdminURL  = $this->root_url . 'nucleus/';
-               $this->MediaURL  = $this->root_url . 'media/';
-               $this->SkinsURL  = $this->root_url . 'skins/';
-               $this->PluginURL = $this->root_url . 'nucleus/plugins/';
-               $this->ActionURL = $this->root_url . 'action.php';
-       }
-
-       private function read_parameter($parameter)
-       {
-               foreach ( $parameter as $element )
-               {
-                       if ( array_key_exists($element, $_POST) )
-                       {
-                               $this->$element = $_POST[$element];
-                       }
-               }
-       }
-
-       public function set_state($state)
-       {
-               $states = array('locale', 'mysql', 'weblog', 'detail', 'install');
-               if ( in_array($state, $states) )
-               {
-                       $this->state = $state;
-               }
-       }
-
-       public function set_locale()
-       {
-               $this->read_parameter(array('locale'));
-
-               if ( !in_array($this->locale, i18n::get_available_locale_list()) )
-               {
-                       $this->locale = 'en_Latn_US';
-               }
-       }
-
-       public function check_mysql_parameters()
-       {
-               $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');
-               $this->read_parameter($parameters);
-
-               $errors = array();
-               if ( $this->mysql_host == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _DB_FIELD1);
-               }
-
-               if ( $this->mysql_user == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _DB_FIELD2);
-               }
-               
-               if ( $this->mysql_user != ''
-                       && !preg_match('/^[[:alnum:]_-]+$/i', $this->mysql_user) )
-               {
-                       $errors[] = sprintf(_ERROR2, _DB_FIELD2);
-               }
-               
-               if ( $this->mysql_password == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _DB_FIELD3);
-               }
-
-               if ( $this->mysql_database == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _DB_FIELD4);
-               }
-
-               if ( $this->mysql_database != ''
-                       && !preg_match('/^[[:alnum:]_-]+$/i', $this->mysql_database) )
-               {
-                       $errors[] = sprintf(_ERROR2, _DB_FIELD4);
-               }
-
-               if ( $this->mysql_tablePrefix != ''
-                       && !preg_match('/^[[:alnum:]_-]+$/i', $this->mysql_tablePrefix) )
-               {
-                       $errors[] = sprintf(_ERROR2, _DB_FIELD5);
-               }
-               
-               if ( count($errors) == 0 )
-               {
-                       $mysql_conn = @sql_connect_args($this->mysql_host, $this->mysql_user, $this->mysql_password);
-                       if ( $mysql_conn == false )
-                       {
-                               $errors[] = _ERROR3;
-                       }
-                       else
-                       {
-                               @sql_close($mysql_conn);
-                       }
-               }
-
-               return $errors;
-       }
-
-       public function check_user_parameters()
-       {
-               $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');
-               $this->read_parameter($parameters);
-
-               $errors = array();
-               if ( $this->user_name == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD2);
-               }
-               elseif ( !preg_match("/^[[:alnum:]]+([ [:alnum:]]*[[:alnum:]]+)?$/i", $this->user_name) )
-               {
-                       $errors[] = _ERROR5;
-               }
-
-               if ( $this->user_realname == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD1);
-               }
-
-               if ( $this->user_password == '' || $this->user_password2 == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD3);
-                       $this->user_password = '';
-               }
-               elseif ( $this->user_password != $this->user_password2 )
-               {
-                       $errors[] = _ERROR6;
-                       $this->user_password = '';
-               }
-
-               if ( !preg_match("/^[\w\.-]+@[\w\.-]+\.[[:alpha:]]{2,6}$/", $this->user_email) )
-               {
-                       $errors[] = _ERROR7;
-               }
-
-               return $errors;
-       }
-
-       public function check_weblog_parameters()
-       {
-               $parameters = array('blog_name', 'blog_shortname');
-               $this->read_parameter($parameters);
-
-               $errors = array();
-               if ( $this->blog_name == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _BLOG_FIELD1);
-               }
-
-               if ( $this->blog_shortname == '' )
-               {
-                       $errors[] = sprintf(_ERROR1, _BLOG_FIELD2);
-               }
-
-               if ( !preg_match("/^[a-z0-9]+$/", $this->blog_shortname) )
-               {
-                       $errors[] = _ERROR4;
-               }
-
-               return $errors;
-       }
-
-       public function check_uri_parameters()
-       {
-               $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');
-               $this->read_parameter($parameters);
-
-               $errors = array();
-               if ( substr($this->IndexURL, -1, 1) !== '/' )
-               {
-                       $errors[] = sprintf(_ERROR8, _PATH_FIELD1);
-               }
-
-               if ( substr($this->AdminURL, -1, 1) !== '/' )
-               {
-                       $errors[] = sprintf(_ERROR8, _PATH_FIELD2);
-               }
-
-               if ( substr($this->MediaURL, -1, 1) !== '/' )
-               {
-                       $errors[] = sprintf(_ERROR8, _PATH_FIELD4);
-               }
-
-               if ( substr($this->SkinsURL, -1, 1) !== '/' )
-               {
-                       $errors[] = sprintf(_ERROR8, _PATH_FIELD6);
-               }
-
-               if ( substr($this->PluginURL, -1, 1) !== '/' )
-               {
-                       $errors[] = sprintf(_ERROR8, _PATH_FIELD8);
-               }
-
-               if ( strrchr($this->ActionURL, '/') != '/action.php' )
-               {
-                       $errors[] = sprintf(_ERROR9, _PATH_FIELD9);
-               }
-
-               return $errors;
-       }
-
-       public function check_path_parameters()
-       {
-               $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');
-               $this->read_parameter($parameters);
-
-               $separators = array('/', DIRECTORY_SEPARATOR);
-               $errors = array();
-               if ( !in_array(substr($this->AdminPath, -1, 1), $separators) || !file_exists($this->AdminPath) )
-               {
-                       $errors[] = sprintf(_ERROR10, _PATH_FIELD3);
-               }
-
-               if ( !in_array(substr($this->MediaPath, -1, 1), $separators) || !file_exists($this->MediaPath) )
-               {
-                       $errors[] = sprintf(_ERROR10, _PATH_FIELD5);
-               }
-
-               if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) || !file_exists($this->SkinsPath) )
-               {
-                       $errors[] = sprintf(_ERROR10, _PATH_FIELD7);
-               }
-
-               return $errors;
-       }
-
-       /**
-        * check all parameters
-        * @return bool
-        */
-       public function check_all_parameters()
-       {
-               $this->set_locale();
-
-               $isValid = true;
-               $isValid &= (count($this->check_mysql_parameters()) == 0);
-               $isValid &= (count($this->check_user_parameters()) == 0);
-               $isValid &= (count($this->check_weblog_parameters()) == 0);
-               $isValid &= (count($this->check_uri_parameters()) == 0);
-               $isValid &= (count($this->check_path_parameters()) == 0);
-
-               return $isValid;
-       }
-}
+<?php\r
+/*\r
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
+ * Copyright (C) 2002-2012 The Nucleus Group\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * (see nucleus/documentation/index.html#license for more info)\r
+ *\r
+ * This script will install the Nucleus tables in your SQL-database,\r
+ * and initialize the data in those tables.\r
+ */\r
+\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
+ * @version $Id$\r
+ */\r
+\r
+/* global values initialize */\r
+$CONF = array();\r
+\r
+/* reporting all errors for support */\r
+error_reporting(E_ALL);\r
+\r
+$minimum_php_version   = '5.0.6';\r
+$minimum_mysql_version = '3.23';\r
+\r
+$page_footer_copyright = '&copy; 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';\r
+\r
+// begin if: server's PHP version is below the minimum; halt installation\r
+if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )\r
+{\r
+       exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version '. $minimum_php_version .'</div>');\r
+}\r
+\r
+// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);\r
+if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
+{\r
+       ini_set('magic_quotes_runtime', '0');\r
+}\r
+\r
+/* default installed plugins and skins */\r
+$aConfPlugsToInstall   = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Text');\r
+$aConfSkinsToImport            = array('atom', 'rss2.0', 'rsd', 'default');\r
+\r
+// Check if some important files\r
+do_check_files();\r
+\r
+/* i18n class is needed for internationalization */\r
+include_once('../nucleus/libs/i18n.php');\r
+if ( !i18n::init('UTF-8', './locales') )\r
+{\r
+       exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');\r
+}\r
+\r
+// check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x\r
+if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )\r
+{\r
+       exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');\r
+}\r
+\r
+// include core classes that are needed for login & plugin handling\r
+include_once('../nucleus/libs/mysql.php');\r
+\r
+// added for 3.5 sql_* wrapper\r
+global $MYSQL_HANDLER;\r
+\r
+if ( !isset($MYSQL_HANDLER) )\r
+{\r
+       $MYSQL_HANDLER = array('mysql', '');\r
+}\r
+include_once('../nucleus/libs/sql/' . $MYSQL_HANDLER[0] . '.php');\r
+\r
+session_start();\r
+if ( count($_GET) == 0 && count($_POST) == 0 )\r
+{\r
+       unset($_SESSION['param_manager']);\r
+}\r
+\r
+// restore the $param from the session\r
+if ( array_key_exists('param_manager', $_SESSION) )\r
+{\r
+       $param = $_SESSION['param_manager'];\r
+}\r
+else\r
+{\r
+       $param = new PARAM_MANAGER();\r
+}\r
+\r
+// include translation file\r
+if ( array_key_exists('locale', $_POST) ) $param->set_locale();\r
+i18n::set_current_locale($param->locale);\r
+$translation_file = './locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php';\r
+if ( !file_exists($translation_file) )\r
+{\r
+       $translation_file = './locales/en_Latn_US.UTF-8.php';\r
+}\r
+include($translation_file);\r
+\r
+do_action();\r
+\r
+// $param is saved to the session\r
+if ( isset($param) )\r
+{\r
+       $_SESSION['param_manager'] = $param;\r
+}\r
+else\r
+{\r
+       unset($_SESSION['param_manager']);\r
+}\r
+exit;\r
+\r
+\r
+/**\r
+ * installer action\r
+ */\r
+function do_action()\r
+{\r
+       global $param;\r
+\r
+       if ( array_key_exists('action', $_POST) )\r
+       {\r
+               $isPostback = true;\r
+       }\r
+       else\r
+       {\r
+               $isPostback = false;\r
+       }\r
+\r
+       // mode change\r
+       if ( array_key_exists('mode', $_REQUEST) )\r
+       {\r
+               if ( $_REQUEST['mode'] == 'detail' )\r
+               {\r
+                       $param->set_state('detail');\r
+               }\r
+               elseif ( $_REQUEST['mode'] == 'simple' )\r
+               {\r
+                       $param->set_state('mysql');\r
+               }\r
+       }\r
+\r
+       // input parameter check\r
+       if ( $isPostback )\r
+       {\r
+               switch ( $param->state )\r
+               {\r
+                       case 'locale':\r
+                               $param->set_locale();\r
+                               $param->set_state('mysql');\r
+                               $isPostback = false;\r
+                               break;\r
+                       case 'mysql':\r
+                               if ( count($param->check_mysql_parameters()) == 0 )\r
+                               {\r
+                                       $param->set_state('weblog');\r
+                                       $isPostback = false;\r
+                               }\r
+                               break;\r
+                       case 'weblog':\r
+                               if ( count($param->check_user_parameters()) == 0\r
+                                       && count($param->check_weblog_parameters()) == 0 )\r
+                               {\r
+                                       $param->set_state('install');\r
+                                       $isPostback = false;\r
+                               }\r
+                               break;\r
+                       case 'detail':\r
+                               if ( $param->check_all_parameters() )\r
+                               {\r
+                                       $param->set_state('install');\r
+                                       $isPostback = false;\r
+                               }\r
+                               break;\r
+               }\r
+       }\r
+\r
+       // page render\r
+       show_header();\r
+       switch ( $param->state )\r
+       {\r
+               case 'locale':\r
+                       show_select_locale_form();\r
+                       break;\r
+               case 'mysql':\r
+                       show_database_setting_form($isPostback);\r
+                       break;\r
+               case 'weblog':\r
+                       show_blog_setting_form($isPostback);\r
+                       break;\r
+               case 'detail':\r
+                       show_detail_setting_form($isPostback);\r
+                       break;\r
+               case 'install':\r
+                       show_install_complete_form();\r
+                       break;\r
+       }\r
+       show_footer();\r
+}\r
+\r
+/**\r
+ * header tag of the installation screens\r
+ **/\r
+function show_header()\r
+{\r
+       global $param;\r
+\r
+       /* HTTP 1.1 application for no caching */\r
+       header("Cache-Control: no-cache, must-revalidate");\r
+       header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");\r
+       header('Content-Type: text/html; charset=' . i18n::get_current_charset());\r
+\r
+?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+       <head>\r
+               <title><?php echo _TITLE; ?></title>\r
+               <link rel="stylesheet" type="text/css" href="./styles/inst.css" />\r
+               <style type="text/css">\r
+               <!--\r
+               <?php echo _BODYFONTSTYLE; ?>\r
+               -->\r
+               </style>\r
+       </head>\r
+       <body>\r
+               <div id="header">\r
+                       <div id="navigation">\r
+                               <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>\r
+                               <ul>\r
+                                       <?php\r
+                                       if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
+                                       {\r
+                                               echo '<li>', _STEP1, '</li><li';\r
+                                               if ( $param->state == 'mysql' )\r
+                                               {\r
+                                                       echo ' class="gry"';\r
+                                               }\r
+                                               echo '>&nbsp; &gt; &nbsp;', _STEP2, '</li><li';\r
+                                               if ( in_array($param->state, array('mysql', 'weblog')) )\r
+                                               {\r
+                                                       echo ' class="gry"';\r
+                                               }\r
+                                               echo '>&nbsp; &gt; &nbsp;', _STEP3, "</li>\n";\r
+                                       }\r
+                                       if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
+                                       {\r
+                                               echo '<li class="rightbox">';\r
+                                               if ( in_array($param->state, array('mysql', 'weblog')) )\r
+                                               {\r
+                                                       echo '<a href="./?mode=detail">', _MODE2, '</a>';\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       echo '<a href="./?mode=simple">', _MODE1, '</a>';\r
+                                               }\r
+                                               echo '</li>';\r
+                                       }\r
+                                       ?>\r
+                               </ul>\r
+                       </div>\r
+               </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * footer tag of the installation screens\r
+ **/\r
+function show_footer()\r
+{\r
+       global $page_footer_copyright;\r
+?>\r
+               <div id="footer">\r
+                       <?php echo $page_footer_copyright; ?>\r
+               </div>\r
+       </body>\r
+</html>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Display the form for language select\r
+ */\r
+function show_select_locale_form()\r
+{\r
+       // Get the browser language that can be displayed\r
+       // TODO: default locale select simple implementation\r
+       $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
+       foreach ($languages as $language)\r
+       {\r
+               $language = preg_replace('#([\w]+).*#', '$1', $language);\r
+               break;\r
+       }\r
+\r
+       $locales = array(\r
+               array('en_Latn_US', 'English - United States'),\r
+               array('ja_Jpan_JP', 'Japanese - Japan')\r
+       );\r
+?>\r
+               <div id="container">\r
+                       <p style="font-size:152%;font-weight:bold;">\r
+                               Select your locale:\r
+                       </p>\r
+                       <form method="post" action="./index.php">\r
+\r
+                               <div class="prt">\r
+                                       <select name="locale">\r
+<?php\r
+       foreach ( $locales as $locale )\r
+       {\r
+               echo "<option value=\"$locale[0]\"";\r
+               if ( i18n::strpos($locale[0], $language) === 0 )\r
+               {\r
+                       echo ' selected';\r
+               }\r
+               echo ">$locale[1]</option>\n";\r
+       }\r
+?>\r
+                                       </select>\r
+                                       <p class="sbt">\r
+                                               <button type="submit" name="action" value="locale" class="sbt_arw">START</button>\r
+                                       </p>\r
+                               </div>\r
+                       </form>\r
+               </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Display the form to set up a database\r
+ * @param bool $isPostback\r
+ */\r
+function show_database_setting_form($isPostback)\r
+{\r
+       global $param, $minimum_mysql_version;\r
+\r
+       $config_writable = canConfigFileWritable();\r
+       $mysql_version = getMySqlVersion();\r
+       ?>\r
+               <div id="container">\r
+                       <p class="msg">\r
+<?php\r
+       echo _SIMPLE_NAVI1;\r
+       if ( $config_writable != '' )\r
+       {\r
+               echo '<span class="err">', $config_writable, '</span>';\r
+       }\r
+       if ( $mysql_version == '0.0.0' )\r
+       {\r
+               echo '<span class="err">', _ERROR21, '</span>';\r
+       }\r
+       elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
+       {\r
+               echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';\r
+       }\r
+?>\r
+                       </p>\r
+                       <form method="post" action="./index.php">\r
+                               <div class="prt">\r
+                                       <h2><?php echo _DB_HEADER; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_mysql_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                                       <p class="sbt">\r
+                                               <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>\r
+                                               <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>\r
+                                       </p>\r
+                                       <p class="msg">\r
+                                               <?php echo _DB_TEXT1; ?>\r
+                                       </p>\r
+                               </div>\r
+                       </form>\r
+               </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Displays a form to the blog settings\r
+ * @param bool $isPostback\r
+ */\r
+function show_blog_setting_form($isPostback)\r
+{\r
+       global $param;\r
+\r
+?>\r
+               <div id="container">\r
+                       <p class="msg">\r
+                               <?php echo _SIMPLE_NAVI2; ?>\r
+                       </p>\r
+                       <form method="post" action="./index.php">\r
+                               <div class="prt">\r
+                                       <h2><?php echo _BLOG_HEADER; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_weblog_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
+                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </div>\r
+\r
+                               <div class="prt">\r
+                                       <h2><?php echo _ADMIN_HEADER; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_user_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
+                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>\r
+                                                               <td><input type="password" name="user_password" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>\r
+                                                               <td><input type="password" name="user_password2" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
+                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                                       <p class="sbt">\r
+                                               <button type="submit" name="action" value="weblog" class="sbt_arw"><?php echo _INSTALL; ?></button>\r
+                                       </p>\r
+                               </div>\r
+                       </form>\r
+               </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Displays a form to the detail settings\r
+ * @param bool $isPostback\r
+ */\r
+function show_detail_setting_form($isPostback)\r
+{\r
+       global $param, $minimum_mysql_version;\r
+\r
+       $mysql_version = getMySqlVersion();\r
+?>\r
+               <div id="container_detailed">\r
+                       <p class="msg">\r
+                               <?php echo _DETAIL_NAVI1; ?>\r
+<?php\r
+       if ( $isPostback && !$param->check_all_parameters() )\r
+       {\r
+               echo '<span class="err">', _ERROR26, "</span>\n";\r
+       }\r
+?>\r
+                       </p>\r
+                       <ul class="msg">\r
+                               <li>PHP: <?php echo phpversion(); ?></li>\r
+                               <li>MySQL:\r
+<?php\r
+       echo ($mysql_version == '0.0.0') ? _ERROR21 : $mysql_version;\r
+       if ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
+       {\r
+               echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';\r
+       }\r
+?></li>\r
+                       </ul>\r
+                       <form method="post" action="">\r
+\r
+                               <div class="prt">\r
+                                       <h2><?php echo _DETAIL_HEADER1; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_mysql_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <h2><?php echo _DETAIL_HEADER2; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_uri_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+               $errors = $param->check_path_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>\r
+                                                               <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>\r
+                                                               <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>\r
+                                                               <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>\r
+                                                               <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>\r
+                                                               <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>\r
+                                                               <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>\r
+                                                               <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>\r
+                                                               <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>\r
+                                                               <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                                       <p class="msg">\r
+                                               <?php echo _DETAIL_TEXT3; ?>\r
+                                       </p>\r
+\r
+                                       <h2><?php echo _DETAIL_HEADER3; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       echo _DETAIL_TEXT4;\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_user_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
+                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>\r
+                                                               <td><input type="password" name="user_password" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>\r
+                                                               <td><input type="password" name="user_password2" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
+                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <h2><?php echo _DETAIL_HEADER4; ?></h2>\r
+                                       <p class="msg">\r
+<?php\r
+       echo _DETAIL_TEXT5;\r
+       if ( $isPostback )\r
+       {\r
+               $errors = $param->check_weblog_parameters();\r
+               if ( is_array($errors) )\r
+               {\r
+                       foreach ( $errors as $error )\r
+                       {\r
+                               echo '<span class="err">', $error, "</span>\n";\r
+                       }\r
+               }\r
+       }\r
+?>\r
+                                       </p>\r
+                                       <table>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
+                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
+                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <p class="msg">\r
+                                               <?php echo _DETAIL_TEXT6; ?>\r
+                                       </p>\r
+\r
+                                       <p class="sbt">\r
+                                               <button type="submit" name="action" value="detail" class="sbt_arw"><?php echo _INSTALL; ?></button>\r
+                                       </p>\r
+                               </div>\r
+                       </form>\r
+               </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Displays a screen to signal the completion of the installation\r
+ */\r
+function show_install_complete_form()\r
+{\r
+       global $MYSQL_HANDLER, $param;\r
+       $errors = do_install();\r
+?>\r
+               <div id="container">\r
+                       <p class="msg">\r
+<?php\r
+       if ( is_array($errors) && count($errors) > 0 )\r
+       {\r
+               echo _ERROR27;\r
+               foreach ( $errors as $error )\r
+               {\r
+                       echo '<span class="err">', $error, "</span>\n";\r
+               }\r
+       }\r
+       else\r
+       {\r
+               echo _INST_TEXT;\r
+               if ( array_key_exists('config_data', $_SESSION) )\r
+               {\r
+                       echo '<span class="err">', _INST_TEXT4, '</span>';\r
+?>\r
+<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset() ) ?></textarea>\r
+<script type="text/javascript">\r
+  function SelectText( element ) {window.setTimeout( function() { element.select(); }, 0 );}\r
+</script>\r
+<?php\r
+               }\r
+               else\r
+               {\r
+                       echo '<span class="err">', _INST_TEXT5, '</span>';\r
+               }\r
+?>\r
+                       </p>\r
+                       <form method="post" action="./index.php">\r
+                               <div class="prt">\r
+                                       <h2><?php echo _INST_HEADER1; ?></h2>\r
+                                       <p class="msg">\r
+                                               <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>\r
+                                       </p>\r
+                                       <p class="sbt">\r
+                                               <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>\r
+                                       </p>\r
+                               </div>\r
+\r
+                               <div class="prt">\r
+                                       <h2><?php echo _INST_HEADER2; ?></h2>\r
+                                       <p class="msg">\r
+                                               <?php echo _INST_TEXT2; ?>\r
+                                       </p>\r
+                                       <p class="sbt">\r
+                                               <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>\r
+                                       </p>\r
+                               </div>\r
+\r
+                               <div class="prt">\r
+                                       <h2><?php echo _INST_HEADER3; ?></h2>\r
+                                       <p class="msg">\r
+                                               <?php echo _INST_TEXT3; ?>\r
+                                       </p>\r
+                                       <p class="sbt">\r
+                                               <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>\r
+                                       </p>\r
+                               </div>\r
+                       </form>\r
+<?php\r
+       }\r
+?>\r
+               </div>\r
+<?php\r
+       unset($param);\r
+}\r
+\r
+/**\r
+ * The installation process itself\r
+ * @return array error messages\r
+ */\r
+function do_install()\r
+{\r
+       global $param;\r
+       global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;\r
+       global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;\r
+       $errors = array();\r
+\r
+       /*\r
+        * 1. put all param-vars into vars\r
+        */\r
+       $MYSQL_HOST = $param->mysql_host;\r
+       $MYSQL_USER = $param->mysql_user;\r
+       $MYSQL_PASSWORD = $param->mysql_password;\r
+       $MYSQL_DATABASE = $param->mysql_database;\r
+       $MYSQL_PREFIX = $param->mysql_tablePrefix;\r
+\r
+       $DIR_NUCLEUS = $param->AdminPath;\r
+       $DIR_MEDIA = $param->MediaPath;\r
+       $DIR_SKINS = $param->SkinsPath;\r
+       $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
+       $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
+       $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
+\r
+       /*\r
+        * 2.open mySQL connection\r
+        */\r
+       $MYSQL_CONN = @sql_connect_args($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);\r
+       if ( $MYSQL_CONN == false )\r
+       {\r
+               $errors[] = _ERROR3;\r
+               return $errors;\r
+       }\r
+\r
+       /*\r
+        * 3. try to create database if needed\r
+        */\r
+       if ( !sql_query('CREATE DATABASE IF NOT EXISTS `' . $MYSQL_DATABASE . '`') )\r
+       {\r
+               $errors[] = _ERROR12 . ': ' . sql_error();\r
+       }\r
+\r
+       /*\r
+        * 4. try to select database\r
+        */\r
+       if ( !sql_select_db($MYSQL_DATABASE) )\r
+       {\r
+               $errors[] = _ERROR13;\r
+       }\r
+       sql_set_charset('utf8');\r
+\r
+       if ( count($errors) > 0 )\r
+       {\r
+               return $errors;\r
+       }\r
+\r
+       /*\r
+        * 5. execute queries\r
+        */\r
+       $table_names = array(\r
+               'nucleus_actionlog',\r
+               'nucleus_ban',\r
+               'nucleus_blog',\r
+               'nucleus_category',\r
+               'nucleus_comment',\r
+               'nucleus_config',\r
+               'nucleus_item',\r
+               'nucleus_karma',\r
+               'nucleus_member',\r
+               'nucleus_plugin',\r
+               'nucleus_skin',\r
+               'nucleus_template',\r
+               'nucleus_team',\r
+               'nucleus_activation',\r
+               'nucleus_tickets'\r
+       );\r
+\r
+       $prefixed_table_names = array();\r
+       foreach ( $table_names as $table_name )\r
+       {\r
+               $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;\r
+       }\r
+\r
+       // table exists check\r
+       $result = sql_query('SHOW TABLES');\r
+       while ($row = mysql_fetch_array($result, MYSQL_NUM))\r
+       {\r
+               if ( in_array($row[0], $prefixed_table_names) )\r
+               {\r
+                       $errors[] = _ERROR14;\r
+                       break;\r
+               }\r
+       }\r
+       if ( count($errors) > 0 )\r
+       {\r
+               return $errors;\r
+       }\r
+\r
+       $filename = 'install.sql';\r
+       $fd = fopen($filename, 'r');\r
+       $queries = fread($fd, filesize($filename) );\r
+       fclose($fd);\r
+\r
+       $queries = preg_split('#(;\n|;\r)#', $queries);\r
+\r
+       foreach ( $queries as $query )\r
+       {\r
+               if ( preg_match('/\w+/', $query) )\r
+               {\r
+                       if ( $MYSQL_PREFIX )\r
+                       {\r
+                               $query = str_replace($table_names, $prefixed_table_names, $query);\r
+                       }\r
+\r
+                       if ( !sql_query($query) )\r
+                       {\r
+                               $errors[] = _ERROR15 . ' (<small>' . $query . '</small>): ' . sql_error();\r
+                       }\r
+               }\r
+       }\r
+\r
+       /*\r
+        * 6. put needed records\r
+        */\r
+       /* push first post */\r
+       $query = "INSERT INTO %s VALUES (1, '%s', '%s', '%s', 1, 1, '%s', 0, 0, 0, 1, 0, 1)";\r
+       $query = sprintf($query, tableName('nucleus_item'), _1ST_POST_TITLE, _1ST_POST, _1ST_POST2, i18n::formatted_datetime('mysql', time()));\r
+       if ( !sql_query($query) )\r
+       {\r
+               $errors[] = _ERROR15 . ' (<small>' . $newpost . '</small>): ' . sql_error();\r
+       }\r
+\r
+       /* push configurations */\r
+       array_merge($errors, updateConfig('IndexURL', $param->IndexURL));\r
+       array_merge($errors, updateConfig('AdminURL', $param->AdminURL));\r
+       array_merge($errors, updateConfig('MediaURL', $param->MediaURL));\r
+       array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));\r
+       array_merge($errors, updateConfig('PluginURL', $param->PluginURL));\r
+       array_merge($errors, updateConfig('ActionURL', $param->ActionURL));\r
+       array_merge($errors, updateConfig('AdminEmail', $param->user_email));\r
+       array_merge($errors, updateConfig('SiteName', $param->blog_name));\r
+       array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));\r
+\r
+       /* escape strings for SQL */\r
+       $user_name                      = sql_real_escape_string($param->user_name);\r
+       $user_realname          = sql_real_escape_string($param->user_realname);\r
+       $user_password          = sql_real_escape_string(md5($param->user_password));\r
+       $user_email                     = sql_real_escape_string($param->user_email);\r
+       $blog_name                      = sql_real_escape_string($param->blog_name);\r
+       $blog_shortname         = sql_real_escape_string($param->blog_shortname);\r
+       $config_indexurl        = sql_real_escape_string($param->IndexURL);\r
+\r
+       /* push super admin */\r
+       $query = "UPDATE %s SET mname = '%s', mrealname = '%s', mpassword = '%s', memail = '%s', murl = '%s', madmin = 1, mcanlogin = 1 WHERE mnumber = 1";\r
+       $query = sprintf($query, tableName('nucleus_member'), $user_name, $user_realname, $user_password, $user_email, $config_indexurl);\r
+       if ( !sql_query($query) )\r
+       {\r
+               $errors[] = _ERROR16 . ': ' . sql_error();\r
+       }\r
+\r
+       /* push new weblog */\r
+       $query = "UPDATE %s SET bname = '%s', bshortname = '%s', burl = '%s' WHERE bnumber = 1";\r
+       $query = sprintf($query, tableName('nucleus_blog'), $blog_name, $blog_shortname, $config_indexurl);\r
+       if ( !sql_query($query) )\r
+       {\r
+               $errors[] = _ERROR17 . ': ' . sql_error();\r
+       }\r
+\r
+       /* push default category */\r
+       $query = "UPDATE %s SET cname = '%s', cdesc = '%s' WHERE catid = 1";\r
+       $query = sprintf($query, tableName('nucleus_category'), _GENERALCAT_NAME, _GENERALCAT_DESC);\r
+       if ( !sql_query($query) )\r
+       {\r
+               $errors[] = _ERROR17 . ': ' . sql_error();\r
+       }\r
+\r
+       sql_close();\r
+\r
+       /*\r
+        * 7. install default plugins and skins\r
+        */\r
+       global $aConfPlugsToInstall, $aConfSkinsToImport;\r
+       $aSkinErrors = array();\r
+       $aPlugErrors = array();\r
+\r
+       if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )\r
+       {\r
+               include_once($DIR_LIBS . 'globalfunctions.php');\r
+               global $manager;\r
+               if ( !isset($manager) )\r
+               {\r
+                       $manager = new MANAGER;\r
+               }\r
+\r
+               $aSkinErrors = installCustomSkins();\r
+               if ( count($aSkinErrors) > 0 )\r
+               {\r
+                       array_merge($errors, $aSkinErrors);\r
+               }\r
+\r
+               $query  = "SELECT sdnumber FROM %s WHERE sdname='default'";\r
+               $query = sprintf($query, tableName('nucleus_skin_desc'));\r
+               $res = sql_query($query);\r
+               $obj = sql_fetch_assoc($res);\r
+               $defSkinID = (integer) $obj['sdnumber'];\r
+\r
+               $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";\r
+               $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);\r
+               sql_query($query);\r
+               $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";\r
+               $query = sprintf($query, tableName('nucleus_config'), $defSkinID);\r
+               sql_query($query);\r
+\r
+               $aPlugErrors = installCustomPlugs($manager);\r
+               if ( count($aPlugErrors) > 0 )\r
+               {\r
+                       array_merge($errors, $aPlugErrors);\r
+               }\r
+       }\r
+\r
+       /*\r
+        * 8. Write config file ourselves (if possible)\r
+        */\r
+       $config_data = '<' . '?php' . "\n";\r
+       $config_data .= "// mySQL connection information\n";\r
+       $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";\r
+       $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";\r
+       $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";\r
+       $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";\r
+       $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";\r
+       $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";\r
+       $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";\r
+       $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";\r
+       $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";\r
+       $config_data .= "\$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n";\r
+       $config_data .= "\n";\r
+       $config_data .= "// main nucleus directory\n";\r
+       $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";\r
+       $config_data .= "\n";\r
+       $config_data .= "// path to media dir\n";\r
+       $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";\r
+       $config_data .= "\n";\r
+       $config_data .= "// extra skin files for imported skins\n";\r
+       $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";\r
+       $config_data .= "\n";\r
+       $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";\r
+       $config_data .= "// you can redefine them if you wish\n";\r
+       $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";\r
+       $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";\r
+       $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";\r
+       $config_data .= "\n";\r
+       $config_data .= "// include libs\n";\r
+       $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";\r
+       $config_data .= "?" . ">";\r
+\r
+       $result = false;\r
+       if ( @!file_exists('../config.php') || is_writable('../config.php') )\r
+       {\r
+               if ( $fp = @fopen('../config.php', 'w') )\r
+               {\r
+                       $result = @fwrite($fp, $config_data, i18n::strlen($config_data) );\r
+                       fclose($fp);\r
+               }\r
+       }\r
+\r
+       if ( $result )\r
+       {\r
+               // try to change the read-only permission.\r
+               if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
+               {\r
+                       @chmod('../config.php', 0444);\r
+               }\r
+       }\r
+       else\r
+       {\r
+               $_SESSION['config_data'] = $config_data;\r
+       }\r
+\r
+       return $errors;\r
+}\r
+\r
+/**\r
+ * Confirm that you can write to the configuration file\r
+ * @return string error message\r
+ */\r
+function canConfigFileWritable()\r
+{\r
+       if ( @file_exists('../config.php') && @!is_writable('../config.php') )\r
+       {\r
+               // try to change the read-write permission.\r
+               if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
+               {\r
+                       @chmod('../config.php', 0666);\r
+               }\r
+\r
+               if ( @!is_writable('../config.php') )\r
+               {\r
+                       return _ERROR19;\r
+               }\r
+       }\r
+       return '';\r
+}\r
+\r
+/**\r
+ * To obtain the version of MySQL\r
+ * @return string\r
+ */\r
+function getMySqlVersion()\r
+{\r
+       global $minimum_mysql_version, $errors;\r
+       // Turn on output buffer\r
+       // Needed to repress the output of the sql function that are\r
+       // not part of php (in this case the @ operator doesn't work)\r
+       ob_start();\r
+\r
+       // note: this piece of code is taken from phpMyAdmin\r
+       $conn = sql_connect_args('localhost', '', '');\r
+       $result = @sql_query('SELECT VERSION() AS version', $conn);\r
+\r
+       if ( $result != FALSE && sql_num_rows($result) > 0 )\r
+       {\r
+               $row = sql_fetch_array($result);\r
+               $match = i18n::explode('.', $row['version']);\r
+       }\r
+       else\r
+       {\r
+               $result = @sql_query('SHOW VARIABLES LIKE \'version\'', $conn);\r
+\r
+               if ( $result != FALSE && @sql_num_rows($result) > 0 )\r
+               {\r
+                       $row = sql_fetch_row($result);\r
+                       $match = i18n::explode('.', $row[1]);\r
+               }\r
+               else\r
+               {\r
+                       //$output = shell_exec('mysql -V');\r
+                       $output = ( function_exists('shell_exec') ) ? @shell_exec('mysql -V') : '0.0.0';\r
+                       preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);\r
+                       $match = i18n::explode('.', $version[0]);\r
+\r
+                       if ( $match[0] == '' )\r
+                       {\r
+                               $match = array('0', '0', '0');\r
+                       }\r
+               }\r
+       }\r
+\r
+       @sql_disconnect($conn);\r
+\r
+       //End and clean output buffer\r
+       ob_end_clean();\r
+\r
+       return implode($match, '.');\r
+}\r
+\r
+/**\r
+ * Add a table prefix if it is used\r
+ *\r
+ * @param string $input table name with prefix\r
+ * @return string\r
+ */\r
+function tableName($input)\r
+{\r
+       global $MYSQL_PREFIX;\r
+       if ( $MYSQL_PREFIX )\r
+       {\r
+               return $MYSQL_PREFIX . $input;\r
+       }\r
+       else\r
+       {\r
+               return $input;\r
+       }\r
+}\r
+\r
+/**\r
+ * Install custom plugins\r
+ *\r
+ * @param object $manager MANAGER class instance\r
+ */\r
+function installCustomPlugs($manager)\r
+{\r
+       global $aConfPlugsToInstall, $DIR_LIBS;\r
+\r
+       $aErrors = array();\r
+       if ( count($aConfPlugsToInstall) == 0 )\r
+       {\r
+               return $aErrors;\r
+       }\r
+\r
+       $res = sql_query('SELECT * FROM ' . tableName('nucleus_plugin') );\r
+       $numCurrent = sql_num_rows($res);\r
+\r
+       foreach ( $aConfPlugsToInstall as $plugName )\r
+       {\r
+               $query = 'INSERT INTO ' . tableName('nucleus_plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ", '" . sql_real_escape_string($plugName) . "')";\r
+               sql_query($query);\r
+\r
+               $manager->clearCachedInfo('installedPlugins');\r
+               $plugin =& $manager->getPlugin($plugName);\r
+               $plugin->setID($numCurrent);\r
+\r
+               if ( !$plugin )\r
+               {\r
+                       sql_query('DELETE FROM ' . tableName('nucleus_plugin') . " WHERE pfile = '" . sql_real_escape_string($plugName) . "'");\r
+                       $numCurrent--;\r
+                       array_push($aErrors, sprintf(_ERROR22 ,$plugName));\r
+                       continue;\r
+               }\r
+               $plugin->install();\r
+       }\r
+\r
+       sql_query('DELETE FROM ' . tableName('nucleus_plugin_event') );\r
+       $res = sql_query('SELECT pid, pfile FROM ' . tableName('nucleus_plugin') );\r
+\r
+       while ( $o = sql_fetch_object($res) )\r
+       {\r
+               $pid = $o->pid;\r
+               $plug =& $manager->getPlugin($o->pfile);\r
+\r
+               if ( $plug )\r
+               {\r
+                       $eventList = $plug->getEventList();\r
+                       foreach ( $eventList as $eventName )\r
+                       {\r
+                               sql_query('INSERT INTO ' . tableName('nucleus_plugin_event') . ' (pid, event) VALUES (' . $pid . ", '" . $eventName . "')");\r
+                       }\r
+               }\r
+       }\r
+       return $aErrors;\r
+}\r
+\r
+/**\r
+ * Install custom skins\r
+ * Prepares the installation of custom skins\r
+ */\r
+function installCustomSkins()\r
+{\r
+       global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;\r
+\r
+       $aErrors = array();\r
+       if ( count($aConfSkinsToImport) == 0 )\r
+       {\r
+               return $aErrors;\r
+       }\r
+\r
+       include_once($DIR_LIBS . 'skinie.php');\r
+       $importer = new SKINIMPORT();\r
+\r
+       foreach ( $aConfSkinsToImport as $skinName )\r
+       {\r
+               $importer->reset();\r
+               $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';\r
+\r
+               if ( !@file_exists($skinFile) )\r
+               {\r
+                       array_push($aErrors, sprintf(_ERROR23, $skinFile));\r
+                       continue;\r
+               }\r
+\r
+               $error = $importer->readFile($skinFile);\r
+\r
+               if ( $error )\r
+               {\r
+                       array_push($aErrors, sprintf(_ERROR24, $skinName) . ' : ' . $error);\r
+                       continue;\r
+               }\r
+\r
+               $error = $importer->writeToDatabase(1);\r
+\r
+               if ( $error )\r
+               {\r
+                       array_push($aErrors, sprintf(_ERROR25, $skinName) . ' : ' . $error);\r
+                       continue;\r
+               }\r
+       }\r
+       return $aErrors;\r
+}\r
+\r
+\r
+/**\r
+ * Check if some important files of the Nucleus CMS installation are available\r
+ * Give an error if one or more files are not accessible\r
+ */\r
+function do_check_files()\r
+{\r
+       $missingfiles = array();\r
+       $files = array(\r
+               './install.sql',\r
+               '../index.php',\r
+               '../action.php',\r
+               '../nucleus/index.php',\r
+               '../nucleus/media.php',\r
+               '../nucleus/libs/ACTION.php',\r
+               '../nucleus/libs/ACTIONLOG.php',\r
+               '../nucleus/libs/ACTIONS.php',\r
+               '../nucleus/libs/ADMIN.php',\r
+               '../nucleus/libs/BaseActions.php',\r
+               '../nucleus/libs/BLOG.php',\r
+               '../nucleus/libs/BODYACTIONS.php',\r
+               '../nucleus/libs/COMMENT.php',\r
+               '../nucleus/libs/COMMENTACTIONS.php',\r
+               '../nucleus/libs/COMMENTS.php',\r
+               '../nucleus/libs/ENCAPSULATE.php',\r
+               '../nucleus/libs/ENTITY.php',\r
+               '../nucleus/libs/globalfunctions.php',\r
+               '../nucleus/libs/i18n.php',\r
+               '../nucleus/libs/ITEM.php',\r
+               '../nucleus/libs/ITEMACTIONS.php',\r
+               '../nucleus/libs/LINK.php',\r
+               '../nucleus/libs/MANAGER.php',\r
+               '../nucleus/libs/MEDIA.php',\r
+               '../nucleus/libs/MEMBER.php',\r
+               '../nucleus/libs/mysql.php',\r
+               '../nucleus/libs/NOTIFICATION.php',\r
+               '../nucleus/libs/PAGEFACTORY.php',\r
+               '../nucleus/libs/PARSER.php',\r
+               '../nucleus/libs/PLUGIN.php',\r
+               '../nucleus/libs/PLUGINADMIN.php',\r
+               '../nucleus/libs/SEARCH.php',\r
+               '../nucleus/libs/showlist.php',\r
+               '../nucleus/libs/SKIN.php',\r
+               '../nucleus/libs/TEMPLATE.php',\r
+               '../nucleus/libs/vars4.1.0.php',\r
+               '../nucleus/libs/xmlrpc.inc.php',\r
+               '../nucleus/libs/xmlrpcs.inc.php',\r
+               '../nucleus/libs/sql/mysql.php'\r
+       );\r
+\r
+       $count = count($files);\r
+       for ( $i = 0; $i < $count; $i++ )\r
+       {\r
+               if ( !is_readable($files[$i]) )\r
+               {\r
+                       array_push( $missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');\r
+               }\r
+       }\r
+\r
+       if ( count($missingfiles) > 0 )\r
+       {\r
+               exit(implode( "\n", $missingfiles));\r
+       }\r
+}\r
+\r
+\r
+/**\r
+ * Updates the configuration in the database\r
+ *\r
+ * @param string $name name of the config var\r
+ * @param string $value new value of the config var\r
+ * @return array\r
+ */\r
+function updateConfig($name, $value)\r
+{\r
+       $errors = array();\r
+       $name = sql_real_escape_string($name);\r
+       $value = trim(sql_real_escape_string($value) );\r
+\r
+       $query = "UPDATE %s SET value = '%s' WHERE name = '%s'";\r
+       $query = sprintf($query, tableName('nucleus_config'), $value, $name);\r
+\r
+       if ( !sql_query($query) )\r
+       {\r
+               $errors[] = _ERROR15 . ': ' . sql_error();\r
+       }\r
+       return $errors;\r
+}\r
+\r
+\r
+class PARAM_MANAGER\r
+{\r
+       /* process parameter */\r
+       public $state;\r
+       public $locale;\r
+\r
+       /* mysql connection parameters */\r
+       public $mysql_host;\r
+       public $mysql_user;\r
+       public $mysql_password;\r
+       public $mysql_database;\r
+       public $mysql_tablePrefix;\r
+\r
+       /* weblog configuration parameters */\r
+       public $blog_name;\r
+       public $blog_shortname;\r
+\r
+       /* member configuration parameters */\r
+       public $user_name;\r
+       public $user_realname;\r
+       public $user_password;\r
+       private $user_password2;\r
+       public $user_email;\r
+\r
+       /* URI parameters  */\r
+       private $root_url;\r
+       public $IndexURL;\r
+       public $AdminURL;\r
+       public $MediaURL;\r
+       public $SkinsURL;\r
+       public $PluginURL;\r
+       public $ActionURL;\r
+\r
+       /* path parameters */\r
+       private $root_path;\r
+       public $AdminPath;\r
+       public $MediaPath;\r
+       public $SkinsPath;\r
+\r
+       /**\r
+        * constructor\r
+        */\r
+       public function __construct()\r
+       {\r
+               $this->init();\r
+       }\r
+\r
+       public function init()\r
+       {\r
+               // set default values\r
+               $this->state = 'locale';\r
+               $this->install_mode = 'simple';\r
+               $this->locale = 'en_Latn_US';\r
+               $this->mysql_host = @ini_get('mysql.default_host');\r
+               $this->blog_name = 'My Nucleus CMS';\r
+               $this->blog_shortname = 'mynucleuscms';\r
+\r
+               /* root path */\r
+               $this->root_path = realpath(dirname(__FILE__) . '/..');\r
+               if ( substr($this->root_path, -1, 1) !== '/' )\r
+               {\r
+                       $this->root_path .= '/';\r
+               }\r
+               $base_path_pcre = preg_quote($this->root_path, '#');\r
+\r
+               /* current directry name */\r
+               $directory_name = preg_replace("#$base_path_pcre#", '', dirname(__FILE__));\r
+               $directory_name_pcre = preg_quote($directory_name, '#');\r
+\r
+               /* root uri */\r
+               $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];\r
+               $this->root_url = preg_replace("#$directory_name_pcre(.*)$#", '', $root_url);\r
+\r
+               $this->AdminPath = $this->root_path . 'nucleus' . DIRECTORY_SEPARATOR;\r
+               $this->MediaPath = $this->root_path . 'media' . DIRECTORY_SEPARATOR;\r
+               $this->SkinsPath = $this->root_path . 'skins' . DIRECTORY_SEPARATOR;\r
+\r
+               $this->IndexURL  = $this->root_url;\r
+               $this->AdminURL  = $this->root_url . 'nucleus/';\r
+               $this->MediaURL  = $this->root_url . 'media/';\r
+               $this->SkinsURL  = $this->root_url . 'skins/';\r
+               $this->PluginURL = $this->root_url . 'nucleus/plugins/';\r
+               $this->ActionURL = $this->root_url . 'action.php';\r
+       }\r
+\r
+       private function read_parameter($parameter)\r
+       {\r
+               foreach ( $parameter as $element )\r
+               {\r
+                       if ( array_key_exists($element, $_POST) )\r
+                       {\r
+                               $this->$element = $_POST[$element];\r
+                       }\r
+               }\r
+       }\r
+\r
+       public function set_state($state)\r
+       {\r
+               $states = array('locale', 'mysql', 'weblog', 'detail', 'install');\r
+               if ( in_array($state, $states) )\r
+               {\r
+                       $this->state = $state;\r
+               }\r
+       }\r
+\r
+       public function set_locale()\r
+       {\r
+               $this->read_parameter(array('locale'));\r
+\r
+               if ( !in_array($this->locale, i18n::get_available_locale_list()) )\r
+               {\r
+                       $this->locale = 'en_Latn_US';\r
+               }\r
+       }\r
+\r
+       public function check_mysql_parameters()\r
+       {\r
+               $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');\r
+               $this->read_parameter($parameters);\r
+\r
+               $errors = array();\r
+               if ( $this->mysql_host == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _DB_FIELD1);\r
+               }\r
+\r
+               if ( $this->mysql_user == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _DB_FIELD2);\r
+               }\r
+               \r
+               if ( $this->mysql_user != ''\r
+                       && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR2, _DB_FIELD2);\r
+               }\r
+               \r
+               if ( $this->mysql_password == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _DB_FIELD3);\r
+               }\r
+\r
+               if ( $this->mysql_database == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _DB_FIELD4);\r
+               }\r
+\r
+               if ( $this->mysql_database != ''\r
+                       && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR2, _DB_FIELD4);\r
+               }\r
+\r
+               if ( $this->mysql_tablePrefix != ''\r
+                       && !preg_match('/^[a-z0-9_-]+$/i', $this->mysql_tablePrefix) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR2, _DB_FIELD5);\r
+               }\r
+               \r
+               if ( count($errors) == 0 )\r
+               {\r
+                       $mysql_conn = @sql_connect_args($this->mysql_host, $this->mysql_user, $this->mysql_password);\r
+                       if ( $mysql_conn == false )\r
+                       {\r
+                               $errors[] = _ERROR3;\r
+                       }\r
+                       else\r
+                       {\r
+                               @sql_close($mysql_conn);\r
+                       }\r
+               }\r
+\r
+               return $errors;\r
+       }\r
+\r
+       public function check_user_parameters()\r
+       {\r
+               $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');\r
+               $this->read_parameter($parameters);\r
+\r
+               $errors = array();\r
+               if ( $this->user_name == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD2);\r
+               }\r
+               elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )\r
+               {\r
+                       $errors[] = _ERROR5;\r
+               }\r
+\r
+               if ( $this->user_realname == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD1);\r
+               }\r
+\r
+               if ( $this->user_password == '' || $this->user_password2 == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _ADMIN_FIELD3);\r
+                       $this->user_password = '';\r
+               }\r
+               elseif ( $this->user_password != $this->user_password2 )\r
+               {\r
+                       $errors[] = _ERROR6;\r
+                       $this->user_password = '';\r
+               }\r
+\r
+               if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )\r
+               {\r
+                       $errors[] = _ERROR7;\r
+               }\r
+\r
+               return $errors;\r
+       }\r
+\r
+       public function check_weblog_parameters()\r
+       {\r
+               $parameters = array('blog_name', 'blog_shortname');\r
+               $this->read_parameter($parameters);\r
+\r
+               $errors = array();\r
+               if ( $this->blog_name == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _BLOG_FIELD1);\r
+               }\r
+\r
+               if ( $this->blog_shortname == '' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR1, _BLOG_FIELD2);\r
+               }\r
+\r
+               if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )\r
+               {\r
+                       $errors[] = _ERROR4;\r
+               }\r
+\r
+               return $errors;\r
+       }\r
+\r
+       public function check_uri_parameters()\r
+       {\r
+               $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');\r
+               $this->read_parameter($parameters);\r
+\r
+               $errors = array();\r
+               if ( substr($this->IndexURL, -1, 1) !== '/' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR8, _PATH_FIELD1);\r
+               }\r
+\r
+               if ( substr($this->AdminURL, -1, 1) !== '/' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR8, _PATH_FIELD2);\r
+               }\r
+\r
+               if ( substr($this->MediaURL, -1, 1) !== '/' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR8, _PATH_FIELD4);\r
+               }\r
+\r
+               if ( substr($this->SkinsURL, -1, 1) !== '/' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR8, _PATH_FIELD6);\r
+               }\r
+\r
+               if ( substr($this->PluginURL, -1, 1) !== '/' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR8, _PATH_FIELD8);\r
+               }\r
+\r
+               if ( strrchr($this->ActionURL, '/') != '/action.php' )\r
+               {\r
+                       $errors[] = sprintf(_ERROR9, _PATH_FIELD9);\r
+               }\r
+\r
+               return $errors;\r
+       }\r
+\r
+       public function check_path_parameters()\r
+       {\r
+               $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');\r
+               $this->read_parameter($parameters);\r
+\r
+               $separators = array('/', DIRECTORY_SEPARATOR);\r
+               $errors = array();\r
+               if ( !in_array(substr($this->AdminPath, -1, 1), $separators) || !file_exists($this->AdminPath) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR10, _PATH_FIELD3);\r
+               }\r
+\r
+               if ( !in_array(substr($this->MediaPath, -1, 1), $separators) || !file_exists($this->MediaPath) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR10, _PATH_FIELD5);\r
+               }\r
+\r
+               if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) || !file_exists($this->SkinsPath) )\r
+               {\r
+                       $errors[] = sprintf(_ERROR10, _PATH_FIELD7);\r
+               }\r
+\r
+               return $errors;\r
+       }\r
+\r
+       /**\r
+        * check all parameters\r
+        * @return bool\r
+        */\r
+       public function check_all_parameters()\r
+       {\r
+               $this->set_locale();\r
+\r
+               $isValid = true;\r
+               $isValid &= (count($this->check_mysql_parameters()) == 0);\r
+               $isValid &= (count($this->check_user_parameters()) == 0);\r
+               $isValid &= (count($this->check_weblog_parameters()) == 0);\r
+               $isValid &= (count($this->check_uri_parameters()) == 0);\r
+               $isValid &= (count($this->check_path_parameters()) == 0);\r
+\r
+               return $isValid;\r
+       }\r
+}\r
index 0e456ce..f8e3fc8 100644 (file)
@@ -104,7 +104,7 @@ define('_INST_TEXT5',                       'Please make sure the <i>config.php</i> permissions if i
 define('_ERROR1',                              '"%s" has not been entered.');\r
 define('_ERROR2',                              '"%s" character that can be used are A-Z, a-z ,0-9, _ and -.');\r
 define('_ERROR3',                              'Could not connect to MySQL Server.');\r
-define('_ERROR4',                              'It contains characters that can not be used to "Blog Short Name". (Characters that can be used: a-z and 0-9, blank can not be used)');\r
+define('_ERROR4',                              'It contains characters that can not be used to "Blog Short Name". (Characters that can be used: A-Z, a-z and 0-9, blank can not be used)');\r
 define('_ERROR5',                              'Contains characters that can not be used in "Login ID". (A-Z, a-z, 0-9 and the first and last non-blank characters that can be used)');\r
 define('_ERROR6',                              'Passwords entered do not match.');\r
 define('_ERROR7',                              '"E-mail address" is incorrect.');\r
index c276e36..64359a5 100644 (file)
@@ -61,7 +61,7 @@ define('_SIMPLE_NAVI2',                       'データベースの接続が確認できました
 define('_BLOG_HEADER',                 'ブログ設定');\r
 define('_BLOG_FIELD1',                 'ブログ名');\r
 define('_BLOG_FIELD2',                 'ブログ短縮名');\r
-define('_BLOG_FIELD2_DESC',            '(半角英数小文字 , _ , - )');\r
+define('_BLOG_FIELD2_DESC',            '(半角英数 , _ , - )');\r
 \r
 // admin settings\r
 define('_ADMIN_HEADER',                        '管理者の情報');\r
@@ -116,7 +116,7 @@ define('_INST_TEXT5',                       '<i>config.php</i>のパーミッションが"<span styl
 define('_ERROR1',                              '"%s" が入力されていません。');\r
 define('_ERROR2',                              '"%s" に使用できる文字は半角の A-Z、a-z、0-9、_(アンダーライン)、-(ハイフン) のみです。');\r
 define('_ERROR3',                              'MySQL Serverに接続できませんでした。');\r
-define('_ERROR4',                              '"ブログの短縮名(略称)" に使用できる文字は a-z(半角英字小文字)と 0-9 のみです。');\r
+define('_ERROR4',                              '"ブログの短縮名(略称)" に使用できる文字は  A-Z、a-z、0-9(半角英数)のみです。');\r
 define('_ERROR5',                              '"ログインID" に使用できる文字は A-Z、a-z、0-9(半角英数)のみです。ただし、最初と最後以外では半角スペースも使用できます。');\r
 define('_ERROR6',                              '入力された二つのパスワードが一致しません。');\r
 define('_ERROR7',                              '"メールアドレス" が不正です。');\r
index 2aeff68..5e868eb 100644 (file)
@@ -203,6 +203,13 @@ pre{
        background:url("nuc_but_bk_03.png") right top no-repeat #292929;\r
 }\r
 \r
+/* Text */\r
+#config_text{\r
+       width:100%;\r
+       height:50px;\r
+       border:1px solid gray;\r
+}\r
+\r
 /* Footer */\r
 #footer{\r
        border-top:1px solid #999;\r
index 3a08ff8..4595b52 100644 (file)
@@ -975,7 +975,7 @@ define('_EBLOG_TEAM_TEXT',                  'Click here to edit your team...');
 define('_EBLOG_SETTINGS_TITLE',                'Blog settings');
 define('_EBLOG_NAME',                          'Blog Name');
 define('_EBLOG_SHORTNAME',                     'Short Blog Name');
-define('_EBLOG_SHORTNAME_EXTRA',       '<br />(should only contain a-z and no spaces)');
+define('_EBLOG_SHORTNAME_EXTRA',       '<br />(A-Z, a-z and 0-9 allowed, no spaces)');
 define('_EBLOG_DESC',                          'Blog Description');
 define('_EBLOG_URL',                           'URL');
 define('_EBLOG_DEFSKIN',                       'Default Skin');
index c0af087..31f59d0 100644 (file)
@@ -975,7 +975,7 @@ define('_EBLOG_TEAM_TEXT',                  'Click here to edit your team...');
 define('_EBLOG_SETTINGS_TITLE',                'Blog settings');
 define('_EBLOG_NAME',                          'Blog Name');
 define('_EBLOG_SHORTNAME',                     'Short Blog Name');
-define('_EBLOG_SHORTNAME_EXTRA',       '<br />(should only contain a-z and no spaces)');
+define('_EBLOG_SHORTNAME_EXTRA',       '<br />(A-Z, a-z and 0-9 allowed, no spaces)');
 define('_EBLOG_DESC',                          'Blog Description');
 define('_EBLOG_URL',                           'URL');
 define('_EBLOG_DEFSKIN',                       'Default Skin');
index 96cb719..2794380 100644 (file)
@@ -995,7 +995,7 @@ define('_EBLOG_TEAM_TEXT',                                  '
 define('_EBLOG_SETTINGS_TITLE',                                'BlogÀßÄê');
 define('_EBLOG_NAME',                                          'Blog¤Î̾Á°');
 define('_EBLOG_SHORTNAME',                                     'Blog¤Îû½Ì̾(ά¾Î)');
-define('_EBLOG_SHORTNAME_EXTRA',                       '<br />(a-z¤Î±Ñ¾®Ê¸»ú¤Î¤ß¤¬»ÈÍѤǤ­¤Þ¤¹¡£¶õÇò¤Ï»ÈÍѤǤ­¤Þ¤»¤ó)');
+define('_EBLOG_SHORTNAME_EXTRA',                       '<br />(±Ñ¿ô»ú¤¬»ÈÍѤǤ­¤Þ¤¹¡£¶õÇò¤Ï»ÈÍѤǤ­¤Þ¤»¤ó)');
 define('_EBLOG_DESC',                                          'Blog¤ÎÀâÌÀ');
 define('_EBLOG_URL',                                           'Blog¤ÎURL');
 define('_EBLOG_DEFSKIN',                                       'Blog¤Îɸ½à¤Î¥¹¥­¥ó');
index cc49639..a25d8de 100644 (file)
@@ -995,7 +995,7 @@ define('_EBLOG_TEAM_TEXT',                                  'チームの管理...');
 define('_EBLOG_SETTINGS_TITLE',                                'Blog設定');
 define('_EBLOG_NAME',                                          'Blogの名前');
 define('_EBLOG_SHORTNAME',                                     'Blogの短縮名(略称)');
-define('_EBLOG_SHORTNAME_EXTRA',                       '<br />(a-zの英小文字のみが使用できます。空白は使用できません)');
+define('_EBLOG_SHORTNAME_EXTRA',                       '<br />(英数字が使用できます。空白は使用できません)');
 define('_EBLOG_DESC',                                          'Blogの説明');
 define('_EBLOG_URL',                                           'BlogのURL');
 define('_EBLOG_DEFSKIN',                                       'Blogの標準のスキン');