|
From: Jon O. <jon...@us...> - 2008-02-10 20:58:52
|
Update of /cvsroot/mxbb/core/install/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30903/includes Modified Files: functions_install.php Log Message: Updated. Upgrad etc http://www.mx-system.com/forum/viewtopic.php?t=10571 Index: functions_install.php =================================================================== RCS file: /cvsroot/mxbb/core/install/includes/functions_install.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_install.php 9 Feb 2008 19:46:04 -0000 1.6 --- functions_install.php 10 Feb 2008 20:58:47 -0000 1.7 *************** *** 85,98 **** // '2.0.x' => false, // ), ! // 'mysqli' => array( ! // 'LABEL' => 'MySQL with MySQLi Extension', ! // 'SCHEMA' => 'mysql_41', ! // 'MODULE' => 'mysqli', ! // 'DELIM' => ';', ! // 'COMMENTS' => 'remove_remarks', ! // 'DRIVER' => 'mysqli', ! // 'AVAILABLE' => true, ! // '2.0.x' => true, ! // ), 'mysql' => array( 'LABEL' => 'MySQL', --- 85,98 ---- // '2.0.x' => false, // ), ! 'mysqli' => array( ! 'LABEL' => 'MySQL with MySQLi Extension', ! 'SCHEMA' => 'mysql_41', ! 'MODULE' => 'mysqli', ! 'DELIM' => ';', ! 'COMMENTS' => 'remove_remarks', ! 'DRIVER' => 'mysqli', ! 'AVAILABLE' => true, ! '2.0.x' => true, ! ), 'mysql' => array( 'LABEL' => 'MySQL', *************** *** 893,915 **** } ! switch ( $phpbb_info['dbms'] ) ! { ! case 'mysql': ! include($mx_root_path . "install/db/mysql.$phpEx"); ! break; ! case 'mysql4': ! include($mx_root_path . "install/db/mysql4.$phpEx"); ! break; ! case 'mysqli': ! include($mx_root_path . "install/db/mysqli.$phpEx"); ! break; ! case 'postgres': ! include($mx_root_path . "install/db/postgres7.$phpEx"); ! break; ! default: ! return false; ! } ! $db = new sql_db($phpbb_info['dbhost'], $phpbb_info['dbuser'], $phpbb_info['dbpasswd'], $phpbb_info['dbname'], false); return $db->db_connect_id; --- 893,904 ---- } ! $dbhost = $phpbb_info['dbhost']; ! $dbuser = $phpbb_info['dbuser']; ! $dbpasswd = $phpbb_info['dbpasswd']; ! $dbname = $phpbb_info['dbname']; ! $dbms = $phpbb_info['dbms']; ! ! include($mx_root_path . 'includes/db/' . $dbms . '.' . $phpEx); // Load dbal and initiate class return $db->db_connect_id; *************** *** 1101,1105 **** // - //echo($command . '<br>'); $parse_command(convert_setvars($command, true)); } --- 1090,1093 ---- *************** *** 1252,1260 **** * Post Process populates the basic portal settings into database */ ! function exec_post_process($mode) { ! global $mx_portal_name, $mx_portal_version, $phpbb_url, $portal_url, $tplEx; } --- 1240,1402 ---- * Post Process populates the basic portal settings into database */ ! function exec_post_process($mode, $upgrade_mode) { ! global $mx_portal_name, $mx_portal_version, $tplEx, $db, $table_prefix; ! global $language, $board_email, $script_path, $server_port, $server_name, $portal_backend, $phpbb_path; ! global $mx_root_path, $phpbb_root_path; ! global $admin_name, $admin_pass1; ! global $portal_backend; ! ! if( $mode == 'install' ) ! { ! $portal_table = array( ! 'portal_id' => 1, ! 'portal_name' => "'$mx_portal_name'", ! 'portal_version' => "'$mx_portal_version'", ! 'portal_startdate' => "'".time()."'", ! 'default_lang' => "'$language'", ! 'board_email' => "'$board_email'", ! 'script_path' => "'$script_path'", ! 'server_port' => "'$server_port'", ! 'server_name' => "'$server_name'", ! 'portal_backend' => "'$portal_backend'", ! 'portal_backend_path' => "'$phpbb_path'", ! ); ! ! if ($_POST['mxbb']) // Internal install ! { ! $portal_table['default_style'] = "'1'"; ! } ! ! $sql = "INSERT INTO ".PORTAL_TABLE." (". ! implode(', ', array_keys($portal_table)). ! ") VALUES (". ! implode(', ', array_values($portal_table)). ! ")"; ! ! parse_cmd_sql($sql); ! ! $admin_pass_md5 = md5($admin_pass1); ! ! $sql = "UPDATE " . USERS_TABLE . " ! SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "' ! WHERE username = 'Admin'"; ! ! parse_cmd_sql($sql); ! ! $sql = "UPDATE " . USERS_TABLE . " ! SET user_regdate = " . time(); ! ! parse_cmd_sql($sql); ! ! if (!$_POST['mxbb'] && $portal_backend = 'phpbb2') // phpBB2 install ! { ! $sql_phpbb = "SELECT * FROM ".$table_prefix."users WHERE user_level = 1"; ! ! if( !($result = $db->sql_query($sql_phpbb)) ) ! { ! return false; ! } ! $user_id = 2; // Add ontop admin user... ! while( $row = $db->sql_fetchrow($result) ) ! { ! $user_id++; ! $sql = "INSERT INTO " . USERS_TABLE . " ! (user_id, username, user_password, user_email, user_level, user_regdate, user_active) ! VALUES ('" . $user_id . "', '" . $row['username'] . "', '" . $row['user_password'] . "', '" . $row['user_email'] . "', '" . $row['user_level'] . "', '" . time() . "', '1')"; ! ! parse_cmd_sql($sql); ! } ! } ! } ! else ! { ! $sql = "UPDATE ".PORTAL_TABLE." ! SET portal_name='$mx_portal_name', ! portal_version='$mx_portal_version'"; ! ! if ($upgrade_mode = 'from28x') ! { ! // ! // Get data from phpBB2 -> CORE ! // ! $sql_phpbb = "SELECT * FROM ".$table_prefix."config"; ! if( !($result = $db->sql_query($sql_phpbb)) ) ! { ! return false; ! } ! while( $row = $db->sql_fetchrow($result) ) ! { ! $board_config[$row['config_name']] = $row['config_value']; ! } ! ! $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; // Fix for Olympus ! ! $phpbb_backend_path = str_replace($mx_root_path, '', $phpbb_root_path); // Read from old config.php ! ! $sql .= ", portal_startdate = '".$board_config['board_startdate']."', ! ! default_style = '".$board_config['default_style']."', ! override_user_style = '".$board_config['override_user_style']."', ! default_lang = '".$board_config['default_lang']."', ! ! allow_html = '".$board_config['allow_html']."', ! allow_html_tags = '".$board_config['allow_html_tags']."', ! allow_bbcode = '".$board_config['allow_bbcode']."', ! allow_smilies = '".$board_config['allow_smilies']."', ! smilies_path = '".$board_config['smilies_path']."', + board_email = '".$board_config['board_email']."', + board_email_sig = '".$board_config['board_email_sig']."', + smtp_delivery = '".$board_config['smtp_delivery']."', + smtp_host = '".$board_config['smtp_host']."', + smtp_username = '".$board_config['smtp_username']."', + smtp_password = '".$board_config['smtp_password']."', + smtp_auth_method = '".$board_config['smtp_auth_method']."', + + default_dateformat = '".$board_config['default_dateformat']."', + board_timezone = '".$board_config['board_timezone']."', + gzip_compress = '".$board_config['gzip_compress']."', + + script_path = '".$script_path."', + server_port = '".$board_config['server_port']."', + script_protocol = '".$server_protocol."', + server_name = '".$board_config['server_name']."', + portal_backend = 'phpbb2', + portal_backend_path = '$phpbb_backend_path'"; + } + $sql .= " WHERE portal_id = 1"; + + parse_cmd_sql($sql); + + if ($upgrade_mode = 'from28x') + { + // + // Get admins from phpBB2 -> CORE + // + $sql = "DELETE FROM " . USERS_TABLE . " + WHERE username = 'Admin'"; + + parse_cmd_sql($sql); + + $sql_phpbb = "SELECT * FROM ".$table_prefix."users WHERE user_level = 1"; + + if( !($result = $db->sql_query($sql_phpbb)) ) + { + return false; + } + $user_id = 2; // Add ontop admin user... + while( $row = $db->sql_fetchrow($result) ) + { + $user_id++; + $sql = "INSERT INTO " . USERS_TABLE . " + (user_id, username, user_password, user_email, user_level, user_regdate, user_active) + VALUES ('" . $user_id . "', '" . $row['username'] . "', '" . $row['user_password'] . "', '" . $row['user_email'] . "', '" . $row['user_level'] . "', '" . time() . "', '1')"; + + parse_cmd_sql($sql); + } + } + } } |