/**
 * this function overrides the built in wordpress  variant
 * 
 * @param object $blog_title
 * @param object $user_name
 * @param object $user_email
 * @param object $public
 * @param object $deprecated [optional]
 * @return 
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '')
{
    global $wp_rewrite, $wpdb;
    //wp_check_mysql_version();
    wp_cache_flush();
    /**** changes start here ***/
    switch (DB_TYPE) {
        case 'sqlite':
            require PDODIR . '/driver_sqlite/schema.php';
            installdb();
            break;
        case 'mysql':
            make_db_current_silent();
            break;
    }
    /**** changes end ***/
    $wpdb->suppress_errors();
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    // If not a public blog, don't ping.
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    // Create default user.  If the user already exists, the user tables are
    // being shared among blogs.  Just set the role in that case.
    $user_id = username_exists($user_name);
    if (!$user_id) {
        $random_password = wp_generate_password();
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.<br><br>���' . $random_password);
        $user_id = wp_create_user($user_name, $random_password, $user_email);
        update_usermeta($user_id, 'default_password_nag', true);
    } else {
        $random_password = '';
        $message = __('User already exists.  Password inherited.');
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    $wp_rewrite->flush_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
    wp_cache_flush();
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message);
}
     if (!$result) {
         echo "Database: [{$db_name}] - Creation Table: sessions failed! <b>Error</b>: " . mysql_errno() . ": " . mysql_error() . "<br>";
     } else {
         echo "Database: [{$db_name}] - Creation Table: sessions <b>OK!</b><br>";
     }
     // Add/update DB #$Id$info
     $result = mysql_query("SELECT * FROM " . $prefix . "config WHERE type='version' AND name='db'");
     $db = mysql_fetch_array($result);
     if ($db['value']) {
         mysql_query("UPDATE " . $prefix . "config SET value='2.0.x' WHERE id='{$db['id']}'");
     } else {
         mysql_query("INSERT INTO " . $prefix . "config (type,name,value) VALUES ('version','db','2.0.x')");
     }
     echo "<br><b>Logix Classifieds Tables Updated, Ready ...</b>";
 } elseif ($_POST['action'] == "del") {
     installdb();
 } elseif ($_POST['action'] == "sal") {
     echo "<b>Logix ClassifiedsSales Table Update</b><p>";
     $v_table = $prefix . "adcat";
     $v_command = "ADD";
     $v_field = "sales";
     $v_type = "INT(1) NOT NULL DEFAULT '0'";
     altertables($v_table, $v_command, $v_field, $v_type);
     $v_table = $prefix . "adcat";
     $v_command = "ADD";
     $v_field = "salesbase";
     $v_type = "INT(1) DEFAULT '0' NOT NULL";
     altertables($v_table, $v_command, $v_field, $v_type);
     $result = mysql_query("CREATE TABLE " . $prefix . "sales (id int(11) DEFAULT '0' NOT NULL auto_increment,\n                            userid int(11) DEFAULT '0' NOT NULL,\n                            timestamp int(14) DEFAULT '0' NOT NULL,\n                        ip varchar(40) NOT NULL,\n                            type varchar(10) NOT NULL,\n                            count int(6) DEFAULT '0' NOT NULL,\n                            amount double(16,4) DEFAULT '0.0000' NOT NULL,\n                            ordernumber varchar(25) NOT NULL,\n                        PRIMARY KEY (id),\n                            UNIQUE id (id)\n                            ) ");
     if (!$result) {
         echo "Database: [{$db_name}] - Creation Table: " . $prefix . "sales failed! <b>Error</b>: " . mysql_errno() . ": " . mysql_error() . "<br>";
Пример #3
0
 }
 $configContent = getcontent(cfgFilePath . cfgDefaultConfig);
 $configContent = str_replace('DATABASE_SERVER', $_POST['databaseserver'], $configContent);
 $configContent = str_replace('DATABASE_USER', $_POST['databaseuser'], $configContent);
 $configContent = str_replace('DATABASE_PASS', $_POST['databasepassword'], $configContent);
 $configContent = str_replace('DATABASE_NAME', $_POST['database'], $configContent);
 $configContent = str_replace('DATABASE_PRE', $_POST['tablepre'], $configContent);
 $configContent = str_replace('GDFONT', $_POST['gdfont'], $configContent);
 $configContent = str_replace('ADMINNAME', $_POST['username'], $configContent);
 $configContent = str_replace('ADMINPASS', $_POST['password'], $configContent);
 if (!$error) {
     $fp = fopen(cfgIncludeDir . 'config.inc.php', 'w');
     fwrite($fp, trim($configContent));
     fclose($fp);
     $sqlData = getcontent(cfgFilePath . cfgSqlData);
     installdb($sqlData, $_POST['deldb']);
     if ($error) {
         $contents = '<center><br><BR>TITLE<BR></center>';
         $title = '<b>' . $errorInfo . '</b><br><br>';
         $contents = str_replace('TITLE', $title, $contents);
         $finish = 'style="display:none" >&nbsp;&nbsp;<input type="submit" class="button" value="&nbsp;关	闭&nbsp;" ';
         showform('index.php?step=finish', '安装过程发生错误', '请根据信息检查错误。', $contents, '', $finish);
         exit;
     }
     $fp = fopen('install.lock', 'w+');
     fclose($fp);
     $contents = '&nbsp;&nbsp;<b>安装完成</b><br><br>';
     $contents .= '&nbsp;&nbsp;<b><font color="red">请检查 install 目录是否存在.<br>';
     $contents .= '&nbsp;&nbsp;如果存在请立即删除,以防别人利用此程序获得您的相关资料.</font></b><br></p>';
     $finish = 'style="display:none" >&nbsp;&nbsp;<input type="submit" class="button" value="&nbsp;关	闭&nbsp;" ';
     showform('index.php?step=finish', '安装完成', '请检查相关信息', $contents, '', $finish);