示例#1
0
 /**
  *  Give an overview over the used system
  */
 function action_systemoverview()
 {
     global $member, $nucleus, $CONF;
     $this->pagehead();
     echo '<h2>' . _ADMIN_SYSTEMOVERVIEW_HEADING . "</h2>\n";
     if ($member->isLoggedIn() && $member->isAdmin()) {
         // Information about the used PHP and MySQL installation
         echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL . "</h3>\n";
         // Version of PHP MySQL
         echo "<table>\n";
         echo "\t<tr>\n";
         echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_VERSIONS . "</th>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_PHPVERSION . "</td>\n";
         echo "\t\t" . '<td>' . phpversion() . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td>' . _ADMIN_SYSTEMOVERVIEW_MYSQLVERSION . "</td>\n";
         echo "\t\t" . '<td>' . sql_get_server_info() . ' (' . sql_get_client_info() . ')' . "</td>\n";
         echo "\t</tr>";
         echo "</table>\n";
         // Important PHP settings
         echo "<table>\n";
         echo "\t<tr>\n";
         echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_SETTINGS . "</th>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">magic_quotes_gpc' . "</td>\n";
         $mqg = get_magic_quotes_gpc() ? 'On' : 'Off';
         echo "\t\t" . '<td>' . $mqg . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td>magic_quotes_runtime' . "</td>\n";
         $mqr = get_magic_quotes_runtime() ? 'On' : 'Off';
         echo "\t\t" . '<td>' . $mqr . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td>register_globals' . "</td>\n";
         $rg = ini_get('register_globals') ? 'On' : 'Off';
         echo "\t\t" . '<td>' . $rg . "</td>\n";
         echo "\t</tr>";
         echo "</table>\n";
         // Information about GD library
         $gdinfo = gd_info();
         echo "<table>\n";
         echo "\t<tr>";
         echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_GDLIBRALY . "</th>\n";
         echo "\t</tr>\n";
         foreach ($gdinfo as $key => $value) {
             if (is_bool($value)) {
                 $value = $value ? _ADMIN_SYSTEMOVERVIEW_ENABLE : _ADMIN_SYSTEMOVERVIEW_DISABLE;
             } else {
                 $value = htmlspecialchars($value, ENT_QUOTES);
             }
             echo "\t<tr>";
             echo "\t\t" . '<td width="50%">' . $key . "</td>\n";
             echo "\t\t" . '<td>' . $value . "</td>\n";
             echo "\t</tr>\n";
         }
         echo "</table>\n";
         // Check if special modules are loaded
         ob_start();
         phpinfo(INFO_MODULES);
         $im = ob_get_contents();
         ob_clean();
         echo "<table>\n";
         echo "\t<tr>";
         echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_MODULES . "</th>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">mod_rewrite' . "</td>\n";
         $modrewrite = strstr($im, 'mod_rewrite') != '' ? _ADMIN_SYSTEMOVERVIEW_ENABLE : _ADMIN_SYSTEMOVERVIEW_DISABLE;
         echo "\t\t" . '<td>' . $modrewrite . "</td>\n";
         echo "\t</tr>\n";
         echo "</table>\n";
         // Information about the used Nucleus CMS
         echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM . "</h3>\n";
         global $nucleus;
         $nv = getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
         $np = getNucleusPatchLevel();
         echo "<table>\n";
         echo "\t<tr>";
         echo "\t\t" . '<th colspan="2">Nucleus CMS' . "</th>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION . "</td>\n";
         echo "\t\t" . '<td>' . $nv . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL . "</td>\n";
         echo "\t\t" . '<td>' . $np . "</td>\n";
         echo "\t</tr>\n";
         echo "</table>\n";
         // Important settings of the installation
         echo "<table>\n";
         echo "\t<tr>";
         echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS . "</th>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . '$CONF[' . "'Self']</td>\n";
         echo "\t\t" . '<td>' . $CONF['Self'] . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . '$CONF[' . "'ItemURL']</td>\n";
         echo "\t\t" . '<td>' . $CONF['ItemURL'] . "</td>\n";
         echo "\t</tr><tr>\n";
         echo "\t\t" . '<td width="50%">' . '$CONF[' . "'alertOnHeadersSent']</td>\n";
         $ohs = $CONF['alertOnHeadersSent'] ? _ADMIN_SYSTEMOVERVIEW_ENABLE : _ADMIN_SYSTEMOVERVIEW_DISABLE;
         echo "\t\t" . '<td>' . $ohs . "</td>\n";
         echo "\t</tr>\n";
         echo "</table>\n";
         // Link to the online version test at the Nucleus CMS website
         echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK . "</h3>\n";
         if ($nucleus['codename'] != '') {
             $codenamestring = ' &quot;' . $nucleus['codename'] . '&quot;';
         } else {
             $codenamestring = '';
         }
         echo _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT;
         $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
         echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">';
         echo 'Nucleus CMS ' . $nv . $codenamestring;
         echo '</a>';
         //echo '<br />';
     } else {
         echo _ADMIN_SYSTEMOVERVIEW_NOT_ADMIN;
     }
     $this->pagefoot();
 }
示例#2
0
 function sql_set_charset_jp($charset)
 {
     switch (strtolower($charset)) {
         case 'utf-8':
         case 'utf8':
             $charset = 'utf8';
             break;
         case 'euc-jp':
         case 'ujis':
             $charset = 'ujis';
             break;
         case 'gb2312':
             $charset = 'gb2312';
             break;
             /*
             case 'shift_jis':
             case 'sjis':
             	$charset = 'sjis';
             	break;
             */
         /*
         case 'shift_jis':
         case 'sjis':
         	$charset = 'sjis';
         	break;
         */
         default:
             $charset = 'latin1';
             break;
     }
     $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info())));
     if (version_compare($mySqlVer, '5.0.7', '>=') && function_exists('mysql_set_charset')) {
         $res = mysql_set_charset($charset);
     } elseif (version_compare($mySqlVer, '4.1.0', '>=')) {
         $res = sql_query("SET CHARACTER SET " . $charset);
     }
     return $res;
 }
示例#3
0
function doInstall()
{
    global $mysql_usePrefix, $mysql_prefix, $weblog_ping;
    // 0. put all POST-vars into vars
    $mysql_host = postVar('mySQL_host');
    $mysql_user = postVar('mySQL_user');
    $mysql_password = postVar('mySQL_password');
    $mysql_database = postVar('mySQL_database');
    $mysql_create = postVar('mySQL_create');
    $mysql_usePrefix = postVar('mySQL_usePrefix');
    $mysql_prefix = postVar('mySQL_tablePrefix');
    $config_indexurl = postVar('IndexURL');
    $config_adminurl = postVar('AdminURL');
    $config_adminpath = postVar('AdminPath');
    $config_mediaurl = postVar('MediaURL');
    $config_skinsurl = postVar('SkinsURL');
    $config_pluginurl = postVar('PluginURL');
    $config_actionurl = postVar('ActionURL');
    $config_mediapath = postVar('MediaPath');
    $config_skinspath = postVar('SkinsPath');
    $user_name = postVar('User_name');
    $user_realname = postVar('User_realname');
    $user_password = postVar('User_password');
    $user_password2 = postVar('User_password2');
    $user_email = postVar('User_email');
    $blog_name = postVar('Blog_name');
    $blog_shortname = postVar('Blog_shortname');
    $charset = postVar('charset');
    $config_adminemail = $user_email;
    $config_sitename = $blog_name;
    $weblog_ping = postVar('Weblog_ping');
    $_POST = array();
    $config_indexurl = replaceDoubleBackslash($config_indexurl);
    $config_adminurl = replaceDoubleBackslash($config_adminurl);
    $config_mediaurl = replaceDoubleBackslash($config_mediaurl);
    $config_skinsurl = replaceDoubleBackslash($config_skinsurl);
    $config_pluginurl = replaceDoubleBackslash($config_pluginurl);
    $config_actionurl = replaceDoubleBackslash($config_actionurl);
    $config_adminpath = replaceDoubleBackslash($config_adminpath);
    $config_skinspath = replaceDoubleBackslash($config_skinspath);
    $config_mediapath = replaceDoubleBackslash($config_mediapath);
    /**
     * Include and initialize multibyte functions as a replacement for mbstring extension
     *  if mbstring extension is not loaded.
     * Jan.28, 2011. Japanese Package Release Team
     */
    if (!function_exists('mb_convert_encoding')) {
        global $mbemu_internals;
        include_once $config_adminpath . 'libs/mb_emulator/mb-emulator.php';
    }
    if (function_exists('date_default_timezone_set')) {
        @date_default_timezone_set(function_exists('date_default_timezone_get') ? @date_default_timezone_get() : 'UTC');
    }
    if ($charset == 'ujis') {
        define('_CHARSET', 'EUC-JP');
        $config_sitename = mb_convert_encoding($config_sitename, _CHARSET, 'UTF-8');
        $user_realname = mb_convert_encoding($user_realname, _CHARSET, 'UTF-8');
        $blog_name = mb_convert_encoding($blog_name, _CHARSET, 'UTF-8');
    } else {
        define('_CHARSET', 'UTF-8');
    }
    // 1. check all the data
    $errors = array();
    if (!$mysql_database) {
        array_push($errors, _ERROR2);
    }
    if ($mysql_usePrefix == 1 && strlen($mysql_prefix) == 0) {
        array_push($errors, _ERROR3);
    }
    if ($mysql_usePrefix == 1 && !preg_match('#^[a-zA-Z0-9_]+$#', $mysql_prefix)) {
        array_push($errors, _ERROR4);
    }
    // TODO: add action.php check
    if (!endsWithSlash($config_indexurl) || !endsWithSlash($config_adminurl) || !endsWithSlash($config_mediaurl) || !endsWithSlash($config_pluginurl) || !endsWithSlash($config_skinsurl)) {
        array_push($errors, _ERROR5);
    }
    if (!endsWithSlash($config_adminpath)) {
        array_push($errors, _ERROR6);
    }
    if (!endsWithSlash($config_mediapath)) {
        array_push($errors, _ERROR7);
    }
    if (!endsWithSlash($config_skinspath)) {
        array_push($errors, _ERROR8);
    }
    if (!is_dir($config_adminpath)) {
        array_push($errors, _ERROR9);
    }
    if (!_isValidMailAddress($user_email)) {
        array_push($errors, _ERROR10);
    }
    if (!_isValidDisplayName($user_name)) {
        array_push($errors, _ERROR11);
    }
    if (!$user_password || !$user_password2) {
        array_push($errors, _ERROR12);
    }
    if ($user_password != $user_password2) {
        array_push($errors, _ERROR13);
    }
    if (!_isValidShortName($blog_shortname)) {
        array_push($errors, _ERROR14);
    }
    if (sizeof($errors) > 0) {
        showErrorMessages($errors);
    }
    // 2. try to log in to mySQL
    global $MYSQL_CONN;
    // this will need to be changed if we ever allow
    $MYSQL_CONN = @sql_connect_args($mysql_host, $mysql_user, $mysql_password);
    if ($MYSQL_CONN == false) {
        _doError(_ERROR15 . ': ' . sql_error());
    }
    // 3. try to create database (if needed)
    $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info())));
    $collation = $charset == 'utf8' ? 'utf8_general_ci' : 'ujis_japanese_ci';
    if ($mysql_create == 1) {
        $sql = 'CREATE DATABASE ' . $mysql_database;
        // <add for garble measure>
        if (version_compare($mySqlVer, '4.1.0', '>=')) {
            $sql .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;
        }
        // </add for garble measure>*/
        sql_query($sql, $MYSQL_CONN) or _doError(_ERROR16 . ': ' . sql_error($MYSQL_CONN));
    }
    // 4. try to select database
    sql_select_db($mysql_database, $MYSQL_CONN) or _doError(_ERROR17);
    /*
     * 4.5. set character set to this database in MySQL server
     * This processing is added by Nucleus CMS Japanese Package Release Team as of Mar.30, 2011
     */
    sql_set_charset_jp($charset);
    // 5. execute queries
    $filename = 'install.sql';
    $fd = fopen($filename, 'r');
    $queries = fread($fd, filesize($filename));
    fclose($fd);
    $queries = split("(;\n|;\r)", $queries);
    $aTableNames = 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');
    // these are unneeded (one of the replacements above takes care of them)
    //			'nucleus_plugin_event',
    //			'nucleus_plugin_option',
    //			'nucleus_plugin_option_desc',
    //			'nucleus_skin_desc',
    //			'nucleus_template_desc',
    $aTableNamesPrefixed = array($mysql_prefix . 'nucleus_actionlog', $mysql_prefix . 'nucleus_ban', $mysql_prefix . 'nucleus_blog', $mysql_prefix . 'nucleus_category', $mysql_prefix . 'nucleus_comment', $mysql_prefix . 'nucleus_config', $mysql_prefix . 'nucleus_item', $mysql_prefix . 'nucleus_karma', $mysql_prefix . 'nucleus_member', $mysql_prefix . 'nucleus_plugin', $mysql_prefix . 'nucleus_skin', $mysql_prefix . 'nucleus_template', $mysql_prefix . 'nucleus_team', $mysql_prefix . 'nucleus_activation', $mysql_prefix . 'nucleus_tickets');
    // these are unneeded (one of the replacements above takes care of them)
    //			$mysql_prefix . 'nucleus_plugin_event',
    //			$mysql_prefix . 'nucleus_plugin_option',
    //			$mysql_prefix . 'nucleus_plugin_option_desc',
    //			$mysql_prefix . 'nucleus_skin_desc',
    //			$mysql_prefix . 'nucleus_template_desc',
    $count = count($queries);
    for ($idx = 0; $idx < $count; $idx++) {
        $query = trim($queries[$idx]);
        // echo "QUERY = " . htmlspecialchars($query) . "<p>";
        if ($query) {
            if ($mysql_usePrefix == 1) {
                $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);
            }
            // <add for garble measure>
            if ($mysql_create != 1 && strpos($query, 'CREATE TABLE') === 0 && version_compare($mySqlVer, '4.1.0', '>=')) {
                $query .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;
            }
            // </add for garble measure>*/
            sql_query($query, $MYSQL_CONN) or _doError(_ERROR30 . ' (' . htmlspecialchars($query) . '): ' . sql_error($MYSQL_CONN));
        }
    }
    // 5a make first post
    if (strtoupper(_CHARSET) != 'UTF-8') {
        $itm_title = mb_convert_encoding(_1ST_POST_TITLE, _CHARSET, 'UTF-8');
        $itm_body = mb_convert_encoding(_1ST_POST, _CHARSET, 'UTF-8');
        $itm_more = mb_convert_encoding(_1ST_POST2, _CHARSET, 'UTF-8');
    } else {
        $itm_title = _1ST_POST_TITLE;
        $itm_body = _1ST_POST;
        $itm_more = _1ST_POST2;
    }
    $newpost = "INSERT INTO " . tableName('nucleus_item') . " VALUES (" . "1, " . "'" . $itm_title . "'," . " '" . $itm_body . "'," . " '" . $itm_more . "'," . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);";
    sql_query($newpost, $MYSQL_CONN) or _doError(_ERROR18 . ' (' . htmlspecialchars($newpost) . '): ' . sql_error($MYSQL_CONN));
    // 6. update global settings
    updateConfig('IndexURL', $config_indexurl);
    updateConfig('AdminURL', $config_adminurl);
    updateConfig('MediaURL', $config_mediaurl);
    updateConfig('SkinsURL', $config_skinsurl);
    updateConfig('PluginURL', $config_pluginurl);
    updateConfig('ActionURL', $config_actionurl);
    updateConfig('AdminEmail', $config_adminemail);
    updateConfig('SiteName', $config_sitename);
    if ($charset == 'ujis') {
        updateConfig('Language', 'japanese-euc');
    }
    // 7. update GOD member
    $query = 'UPDATE ' . tableName('nucleus_member') . " SET mname\t = '" . addslashes($user_name) . "'," . " mrealname\t = '" . addslashes($user_realname) . "'," . " mpassword\t = '" . md5(addslashes($user_password)) . "'," . " murl\t\t  = '" . addslashes($config_indexurl) . "'," . " memail\t\t= '" . addslashes($user_email) . "'," . " madmin\t\t= 1," . " mcanlogin\t = 1" . " WHERE" . " mnumber\t   = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR19 . ': ' . sql_error($MYSQL_CONN));
    // 8. update weblog settings
    $query = 'UPDATE ' . tableName('nucleus_blog') . " SET bname  = '" . addslashes($blog_name) . "'," . " bshortname = '" . addslashes($blog_shortname) . "'," . " burl\t   = '" . addslashes($config_indexurl) . "'" . " WHERE" . " bnumber\t= 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN));
    // 8-2. update category settings
    if (strtoupper(_CHARSET) != 'UTF-8') {
        $cat_name = mb_convert_encoding(_GENERALCAT_NAME, _CHARSET, 'UTF-8');
        $cat_desc = mb_convert_encoding(_GENERALCAT_DESC, _CHARSET, 'UTF-8');
    } else {
        $cat_name = _GENERALCAT_NAME;
        $cat_desc = _GENERALCAT_DESC;
    }
    $query = 'UPDATE ' . tableName('nucleus_category') . " SET cname  = '" . $cat_name . "'," . " cdesc\t  = '" . $cat_desc . "'" . " WHERE" . " catid\t  = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN));
    // 9. update item date
    $query = 'UPDATE ' . tableName('nucleus_item') . " SET   itime   = '" . date('Y-m-d H:i:s', time()) . "'" . " WHERE inumber = 1";
    sql_query($query, $MYSQL_CONN) or _doError(_ERROR21 . ': ' . sql_error($MYSQL_CONN));
    global $aConfPlugsToInstall, $aConfSkinsToImport;
    $aSkinErrors = array();
    $aPlugErrors = array();
    if (count($aConfPlugsToInstall) > 0 || count($aConfSkinsToImport) > 0) {
        // 10. set global variables
        global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX;
        $MYSQL_HOST = $mysql_host;
        $MYSQL_USER = $mysql_user;
        $MYSQL_PASSWORD = $mysql_password;
        $MYSQL_DATABASE = $mysql_database;
        $MYSQL_PREFIX = $mysql_usePrefix == 1 ? $mysql_prefix : '';
        global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;
        $DIR_NUCLEUS = $config_adminpath;
        $DIR_MEDIA = $config_mediapath;
        $DIR_SKINS = $config_skinspath;
        $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
        $DIR_LANG = $DIR_NUCLEUS . 'language/';
        $DIR_LIBS = $DIR_NUCLEUS . 'libs/';
        // close database connection (needs to be closed if we want to include globalfunctions.php)
        sql_close($MYSQL_CONN);
        $manager = '';
        include_once $DIR_LIBS . 'globalfunctions.php';
        // 11. install custom skins
        $aSkinErrors = installCustomSkins($manager);
        $defskinQue = 'SELECT `sdnumber` as result FROM ' . sql_table('skin_desc') . ' WHERE `sdname` = "default"';
        $defSkinID = quickQuery($defskinQue);
        $updateQuery = 'UPDATE ' . sql_table('blog') . ' SET `bdefskin` = ' . intval($defSkinID) . ' WHERE `bnumber` = 1';
        sql_query($updateQuery);
        $updateQuery = 'UPDATE ' . sql_table('config') . ' SET `value` = ' . intval($defSkinID) . ' WHERE `name` = "BaseSkin"';
        sql_query($updateQuery);
        // 12. install NP_Ping, if decided
        if ($weblog_ping == 1) {
            global $aConfPlugsToInstall;
            array_push($aConfPlugsToInstall, "NP_Ping");
        }
        // 13. install custom plugins
        $aPlugErrors = installCustomPlugs($manager);
    }
    // 14. Write config file ourselves (if possible)
    $bConfigWritten = 0;
    if (@file_exists('../config.php') && is_writable('../config.php') && ($fp = @fopen('../config.php', 'w'))) {
        $config_data = '<' . '?php' . "\n\n";
        //$config_data .= "\n"; (extraneous, just added extra \n to previous line
        $config_data .= "   // mySQL connection information\n";
        $config_data .= "   \$MYSQL_HOST\t = '" . $mysql_host . "';\n";
        $config_data .= "   \$MYSQL_USER\t = '" . $mysql_user . "';\n";
        $config_data .= "   \$MYSQL_PASSWORD = '******';\n";
        $config_data .= "   \$MYSQL_DATABASE = '" . $mysql_database . "';\n";
        $config_data .= "   \$MYSQL_PREFIX   = '" . ($mysql_usePrefix == 1 ? $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','');\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 = '" . $config_adminpath . "';\n";
        $config_data .= "\n";
        $config_data .= "   // path to media dir\n";
        $config_data .= "   \$DIR_MEDIA   = '" . $config_mediapath . "';\n";
        $config_data .= "\n";
        $config_data .= "   // extra skin files for imported skins\n";
        $config_data .= "   \$DIR_SKINS   = '" . $config_skinspath . "';\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_LANG\t= \$DIR_NUCLEUS . 'language/';\n";
        $config_data .= "   \$DIR_LIBS\t= \$DIR_NUCLEUS . 'libs/';\n";
        $config_data .= "\n";
        $config_data .= "   // include libs\n";
        $config_data .= "   include(\$DIR_LIBS . 'globalfunctions.php');\n";
        $config_data .= "?" . ">";
        $result = @fputs($fp, $config_data, strlen($config_data));
        fclose($fp);
        if ($result) {
            $bConfigWritten = 1;
        }
    }
    ?>
<!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>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><?php 
    echo _TITLE;
    ?>
</title>
	<style>@import url('../nucleus/styles/manual.css');</style>
</head>
<body>
	<div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php 
    echo _ALT_NUCLEUS_CMS_LOGO;
    ?>
" /></div> <!-- Nucleus logo -->

<?php 
    $aAllErrors = array_merge($aSkinErrors, $aPlugErrors);
    if (count($aAllErrors) > 0) {
        echo '<h1>' . _TITLE2 . '</h1>';
        echo '<ul><li>' . implode('</li><li>', $aAllErrors) . '</li></ul>';
    }
    if (!$bConfigWritten) {
        ?>
		<h1><?php 
        echo _TITLE3;
        ?>
</h1>

		<?php 
        echo _TEXT10;
        ?>

		<pre><code>&lt;?php
	// mySQL connection information
	$MYSQL_HOST	 = '<b><?php 
        echo $mysql_host;
        ?>
</b>';
	$MYSQL_USER	 = '******';
	$MYSQL_PASSWORD = '******';
	$MYSQL_DATABASE = '<b><?php 
        echo $mysql_database;
        ?>
</b>';
	$MYSQL_PREFIX   = '<b><?php 
        echo $mysql_usePrefix == 1 ? $mysql_prefix : '';
        ?>
</b>';

	// new in 3.50. first element is db handler, the second is the db driver used by the handler
	// default is $MYSQL_HANDLER = array('mysql','');
	$MYSQL_HANDLER = array('<?php 
        echo $MYSQL_HANDLER[0];
        ?>
','<?php 
        echo $MYSQL_HANDLER[1];
        ?>
');

	// main nucleus directory
	$DIR_NUCLEUS = '<b><?php 
        echo $config_adminpath;
        ?>
</b>';

	// path to media dir
	$DIR_MEDIA   = '<b><?php 
        echo $config_mediapath;
        ?>
</b>';

	// extra skin files for imported skins
	$DIR_SKINS   = '<b><?php 
        echo $config_skinspath;
        ?>
</b>';

	// these dirs are normally sub dirs of the nucleus dir, but
	// you can redefine them if you wish
	$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
	$DIR_LANG	= $DIR_NUCLEUS . 'language/';
	$DIR_LIBS	= $DIR_NUCLEUS . 'libs/';

	// include libs
	include($DIR_LIBS . 'globalfunctions.php');
?&gt;</code></pre>

	<?php 
        echo _TEXT11;
        ?>

	<div class="note">
	<?php 
        echo _TEXT12;
        ?>
	</div>

<?php 
    } else {
        ?>

	<h1><?php 
        echo _TITLE4;
        ?>
</h1>

	<?php 
        echo _TEXT13;
        ?>

<?php 
    }
    ?>

	<h1><?php 
    echo _TITLE5;
    ?>
</h1>
	
	<?php 
    echo _TEXT14;
    ?>

	<ul>
		<li><?php 
    echo _TEXT14_L1;
    ?>
</li>
		<li><?php 
    echo _TEXT14_L2;
    ?>
</li>
	</ul>

	<h1><?php 
    echo _HEADER10;
    ?>
</h1>

	<?php 
    echo _TEXT15;
    ?>

		<ul>
		<li><?php 
    echo _TEXT15_L1;
    ?>
</li>
		<li><?php 
    echo _TEXT15_L2;
    ?>
</li>
		<li><?php 
    echo _TEXT15_L3;
    ?>
</li>
		</ul>

	<?php 
    echo _TEXT16;
    ?>

	<h1><?php 
    echo _HEADER11;
    ?>
</h1>

	<p><?php 
    echo _TEXT16_H;
    ?>
		<ul>
			<li><a href="<?php 
    echo $config_adminurl;
    ?>
"><?php 
    echo _TEXT16_L1;
    ?>
</a></li>
			<li><a href="<?php 
    echo $config_indexurl;
    ?>
"><?php 
    echo _TEXT16_L2;
    ?>
</a></li>
		</ul>
	</p>

</body>
</html>

<?php 
}
示例#4
0
 function sql_set_charset_jp($charset)
 {
     global $MYSQL_HANDLER, $SQL_DBH;
     if (strpos($MYSQL_HANDLER[1], 'mysql') === 0) {
         switch (strtolower($charset)) {
             case 'utf-8':
             case 'utf8':
                 $charset = 'utf8';
                 break;
             case 'euc-jp':
             case 'ujis':
                 $charset = 'ujis';
                 break;
             case 'gb2312':
                 $charset = 'gb2312';
                 break;
                 /*
                 case 'shift_jis':
                 case 'sjis':
                 	$charset = 'sjis';
                 	break;
                 */
             /*
             case 'shift_jis':
             case 'sjis':
             	$charset = 'sjis';
             	break;
             */
             default:
                 $charset = 'latin1';
                 break;
         }
         $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info())));
         if (version_compare($mySqlVer, '4.1.0', '>=')) {
             $res = $SQL_DBH->exec("SET CHARACTER SET " . $charset);
         }
     }
     return $res;
 }