|
From: Jon O. <jon...@us...> - 2008-02-10 20:58:51
|
Update of /cvsroot/mxbb/core/install In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30903 Modified Files: mx_install.php Log Message: Updated. Upgrad etc http://www.mx-system.com/forum/viewtopic.php?t=10571 Index: mx_install.php =================================================================== RCS file: /cvsroot/mxbb/core/install/mx_install.php,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** mx_install.php 9 Feb 2008 19:46:04 -0000 1.89 --- mx_install.php 10 Feb 2008 20:58:47 -0000 1.90 *************** *** 40,44 **** // This is shown in the top right corner of the installation panels. // ! define('INSTALLER_VERSION', '2.2.0'); define('INSTALLER_NAME', 'MX-Publisher-IWizard'); --- 40,44 ---- // This is shown in the top right corner of the installation panels. // ! define('INSTALLER_VERSION', '2.2.1'); define('INSTALLER_NAME', 'MX-Publisher-IWizard'); *************** *** 124,128 **** if (isset($not_unset[$varname])) { ! // Hacking attempt. No point in continuing unless it's a COOKIE //removed for mx_install: $varname !== 'GLOBALS' || if (isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) { --- 124,128 ---- if (isset($not_unset[$varname])) { ! // Hacking attempt. No point in continuing unless it's a COOKIE //removed for mx_install: $varname !== 'GLOBALS' || if (isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) { *************** *** 150,154 **** unset($input); ! } // If we are on PHP >= 6.0.0 we do not need some code if (phpversion() >= '6.0.0-dev') --- 150,154 ---- unset($input); ! } // If we are on PHP >= 6.0.0 we do not need some code if (phpversion() >= '6.0.0-dev') *************** *** 179,184 **** if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off')) { ! $HTTP_POST_VARS = $_POST; ! $HTTP_GET_VARS = $_GET; $HTTP_SERVER_VARS = $_SERVER; $HTTP_COOKIE_VARS = $_COOKIE; --- 179,184 ---- if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off')) { ! $_POST = $_POST; ! $_GET = $_GET; $HTTP_SERVER_VARS = $_SERVER; $HTTP_COOKIE_VARS = $_COOKIE; *************** *** 195,199 **** // Protect against GLOBALS tricks ! if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($_COOKIE['GLOBALS'])) { die("Hacking attempt"); --- 195,199 ---- // Protect against GLOBALS tricks ! if (isset($_POST['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS'])) { die("Hacking attempt"); *************** *** 224,229 **** // Note! Since array_merge() destroys numerical keys - if the array is numerically indexed, the keys get reindexed in a continuous way - we use the + operator instead // ! $input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES); ! //$input = $HTTP_GET_VARS + $HTTP_POST_VARS + $HTTP_COOKIE_VARS + $HTTP_SERVER_VARS + $HTTP_SESSION_VARS + $HTTP_ENV_VARS + $HTTP_POST_FILES; unset($input['input']); --- 224,229 ---- // Note! Since array_merge() destroys numerical keys - if the array is numerically indexed, the keys get reindexed in a continuous way - we use the + operator instead // ! $input = array_merge($_GET, $_POST, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES); ! //$input = $_GET + $_POST + $HTTP_COOKIE_VARS + $HTTP_SERVER_VARS + $HTTP_SESSION_VARS + $HTTP_ENV_VARS + $HTTP_POST_FILES; unset($input['input']); *************** *** 248,289 **** if( !get_magic_quotes_gpc() ) { ! if( is_array($HTTP_GET_VARS) ) { ! while( list($k, $v) = each($HTTP_GET_VARS) ) { ! if( is_array($HTTP_GET_VARS[$k]) ) { ! while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { ! $HTTP_GET_VARS[$k][$k2] = addslashes($v2); } ! @reset($HTTP_GET_VARS[$k]); } else { ! $HTTP_GET_VARS[$k] = addslashes($v); } } ! @reset($HTTP_GET_VARS); } ! if( is_array($HTTP_POST_VARS) ) { ! while( list($k, $v) = each($HTTP_POST_VARS) ) { ! if( is_array($HTTP_POST_VARS[$k]) ) { ! while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { ! $HTTP_POST_VARS[$k][$k2] = addslashes($v2); } ! @reset($HTTP_POST_VARS[$k]); } else { ! $HTTP_POST_VARS[$k] = addslashes($v); } } ! @reset($HTTP_POST_VARS); } --- 248,289 ---- if( !get_magic_quotes_gpc() ) { ! if( is_array($_GET) ) { ! while( list($k, $v) = each($_GET) ) { ! if( is_array($_GET[$k]) ) { ! while( list($k2, $v2) = each($_GET[$k]) ) { ! $_GET[$k][$k2] = addslashes($v2); } ! @reset($_GET[$k]); } else { ! $_GET[$k] = addslashes($v); } } ! @reset($_GET); } ! if( is_array($_POST) ) { ! while( list($k, $v) = each($_POST) ) { ! if( is_array($_POST[$k]) ) { ! while( list($k2, $v2) = each($_POST[$k]) ) { ! $_POST[$k][$k2] = addslashes($v2); } ! @reset($_POST[$k]); } else { ! $_POST[$k] = addslashes($v); } } ! @reset($_POST); } *************** *** 384,387 **** --- 384,388 ---- // HERE BEGINS THE PARTY... // ================================================================================ + $phpEx = substr(strrchr(__FILE__, '.'), 1); include($mx_root_path . "install/includes/functions_install.$phpEx"); *************** *** 503,507 **** } ! if (!$mx_request_vars->is_empty_post('server_port')) { $server_port = $mx_request_vars->post('server_port', MX_TYPE_NO_TAGS); --- 504,508 ---- } ! if (!$mx_request_vars->is_post('server_port')) { $server_port = $mx_request_vars->post('server_port', MX_TYPE_NO_TAGS); *************** *** 537,541 **** if ($mx_request_vars->is_post('mxbb')) { ! $portal_url = $mx_request_vars->post('portal_url', MX_TYPE_NO_TAGS); $phpbb_path = $mx_request_vars->post('phpbb_path', MX_TYPE_NO_TAGS); //$phpbb_url = $mx_request_vars->post('phpbb_url', MX_TYPE_NO_TAGS); --- 538,542 ---- if ($mx_request_vars->is_post('mxbb')) { ! $portal_url = $mx_request_vars->post('portal_url', MX_TYPE_NO_TAGS, ''); $phpbb_path = $mx_request_vars->post('phpbb_path', MX_TYPE_NO_TAGS); //$phpbb_url = $mx_request_vars->post('phpbb_url', MX_TYPE_NO_TAGS); *************** *** 545,551 **** $dbuser = $mx_request_vars->post('dbuser_mxbb', MX_TYPE_NO_TAGS); $dbpasswd = $mx_request_vars->post('dbpasswd_mxbb', MX_TYPE_NO_TAGS); - //$table_prefix = $mx_request_vars->post('prefix', MX_TYPE_NO_TAGS); $mx_table_prefix = $mx_request_vars->post('mx_prefix', MX_TYPE_NO_TAGS); ! //$acm_type = $mx_request_vars->post('acm_type', MX_TYPE_NO_TAGS); $portal_backend = 'internal'; --- 546,554 ---- $dbuser = $mx_request_vars->post('dbuser_mxbb', MX_TYPE_NO_TAGS); $dbpasswd = $mx_request_vars->post('dbpasswd_mxbb', MX_TYPE_NO_TAGS); $mx_table_prefix = $mx_request_vars->post('mx_prefix', MX_TYPE_NO_TAGS); ! ! $admin_name = $mx_request_vars->post('admin_name_mxbb', MX_TYPE_NO_TAGS, 'admin'); ! $admin_pass1 = $mx_request_vars->post('admin_pass1_mxbb', MX_TYPE_NO_TAGS, 'admin'); ! $admin_pass2 = $mx_request_vars->post('admin_pass2_mxbb', MX_TYPE_NO_TAGS, 'admin'); $portal_backend = 'internal'; *************** *** 555,559 **** $portal_url = $mx_request_vars->post('portal_url', MX_TYPE_NO_TAGS); $phpbb_path = $mx_request_vars->post('phpbb_path', MX_TYPE_NO_TAGS); - //$phpbb_url = $mx_request_vars->post('phpbb_url', MX_TYPE_NO_TAGS); $dbms = $mx_request_vars->post('dbms', MX_TYPE_NO_TAGS); $dbhost = $mx_request_vars->post('dbhost', MX_TYPE_NO_TAGS); --- 558,561 ---- *************** *** 563,567 **** $table_prefix = $mx_request_vars->post('prefix', MX_TYPE_NO_TAGS); $mx_table_prefix = $mx_request_vars->post('mx_prefix', MX_TYPE_NO_TAGS); ! //$acm_type = $mx_request_vars->post('acm_type', MX_TYPE_NO_TAGS); $portal_backend = file_exists($mx_root_path . $phpbb_path . "modcp.$phpEx") ? 'phpbb2' : 'phpbb3'; --- 565,572 ---- $table_prefix = $mx_request_vars->post('prefix', MX_TYPE_NO_TAGS); $mx_table_prefix = $mx_request_vars->post('mx_prefix', MX_TYPE_NO_TAGS); ! ! $admin_name = $mx_request_vars->post('admin_name', MX_TYPE_NO_TAGS, 'admin'); ! $admin_pass1 = $mx_request_vars->post('admin_pass1', MX_TYPE_NO_TAGS, 'admin'); ! $admin_pass2 = $mx_request_vars->post('admin_pass2', MX_TYPE_NO_TAGS, 'admin'); $portal_backend = file_exists($mx_root_path . $phpbb_path . "modcp.$phpEx") ? 'phpbb2' : 'phpbb3'; *************** *** 575,578 **** --- 580,589 ---- } + if( $admin_pass1 != $admin_pass2 ) + { + install_die(sprintf($lang['PasswordMissmatch'], '<a href="javascript:history.go(-1);">', '</a>')); + break; + } + // // If they entered the information manually, we need to verify they did it correctly ;-) *************** *** 616,623 **** include($mx_root_path . "config.$phpEx"); } if( !defined('MX_INSTALLED') ) { - //$mx_acm_type = ( !empty($acm_type) ? $acm_type : 'file' ); - $process_msgs[] = $lang['Writing_config'] . ' ...<br />'; --- 627,636 ---- include($mx_root_path . "config.$phpEx"); } + + // + // Create fresh config.php + // if( !defined('MX_INSTALLED') ) { $process_msgs[] = $lang['Writing_config'] . ' ...<br />'; *************** *** 631,639 **** $config_data .= '$'."dbpasswd = '$dbpasswd';\n\n"; $config_data .= '$'."mx_table_prefix = '$mx_table_prefix';\n\n"; - //$config_data .= '$'."table_prefix = '$table_prefix';\n\n"; - //$config_data .= '$'."acm_type = '$mx_acm_type';\n\n"; - //$config_data .= '$phpbb_root_path = $mx_root_path . ' . "'$phpbb_path';\n\n"; $config_data .= "define('MX_INSTALLED', true);\n\n"; - //$config_data .= "define('PHPBB_INSTALLED', true);\n\n"; $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! --- 644,648 ---- *************** *** 672,679 **** case 'upgrade': // ! // We will be correctly filling the $schemas array in a moment, ! // as soon as we open the DB connection. ;-) // $schemas[] = 'upgrade'; break; --- 681,741 ---- case 'upgrade': + + if( @file_exists($mx_root_path . "config.$phpEx") ) + { + include($mx_root_path . "config.$phpEx"); + } + // ! // Update config.php (if upgrading from 2.8.x) // + if( defined('MX_INSTALLED') && defined('PHPBB_INSTALLED')) + { + $upgrade_mode = 'from28x'; + + $process_msgs[] = $lang['Writing_config'] . ' ...<br />'; + + $config_data = "<"."?php\n\n"; + $config_data .= "// $mx_portal_name auto-generated config file\n// Do not change anything in this file!\n\n"; + $config_data .= "// This file must be put into the $mx_portal_name directory, not into the phpBB directory.\n\n"; + $config_data .= '$'."dbms = '$dbms';\n\n"; + $config_data .= '$'."dbhost = '$dbhost';\n"; + $config_data .= '$'."dbname = '$dbname';\n"; + $config_data .= '$'."dbuser = '$dbuser';\n"; + $config_data .= '$'."dbpasswd = '$dbpasswd';\n\n"; + $config_data .= '$'."mx_table_prefix = '$mx_table_prefix';\n\n"; + $config_data .= "define('MX_INSTALLED', true);\n\n"; + $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + + @umask(0111); + @chmod($mx_root_path . "config.$phpEx", 0644); + + if ( !($fp = @fopen($mx_root_path.'config.php', 'w')) ) + { + $arg_mxbb_url = '<span style="color:blue;">' . $portal_url . '</span>'; + $arg_inst_url = '<a href="javascript:history.go(0);">'; + $instruction_text = sprintf($lang['Unwriteable_config'], $arg_mxbb_url, $arg_inst_url, '</a>'); + + $s_hidden_fields = '<input type="hidden" name="send_file" value="1" />'. + '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />'; + + include_once($mx_root_path . "install/includes/template.$phpEx"); + $template = new Template($mx_root_path . 'install/templates'); + page_header_install($lang['Welcome_install'], $instruction_text); + $template->set_filenames(array('button' => 'mx_install_button.tpl')); + $template->assign_vars(array( + 'S_FORM_ACTION' => "mx_install.$phpEx", + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'L_SUBMIT' => $lang['Send_file'], + )); + $template->pparse('button'); + page_footer_install(); + } + $result = @fputs($fp, $config_data, strlen($config_data)); + @fclose($fp); + + $process_msgs[] = '<span style="color:green;">'.str_replace("\n", "<br />\n", htmlspecialchars($config_data)).'</span>'; + } + $schemas[] = 'upgrade'; break; *************** *** 704,737 **** // include($mx_root_path . "includes/sessions/internal/constants.$phpEx"); ! ! switch($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; ! case 'mssql': ! include($mx_root_path . 'install/db/mssql.'.$phpEx); ! break; ! case 'oracle': ! include($mx_root_path . 'install/db/oracle.'.$phpEx); ! break; ! case 'msaccess': ! include($mx_root_path . 'install/db/msaccess.'.$phpEx); ! break; ! case 'mssql-odbc': ! include($mx_root_path . 'install/db/mssql-odbc.'.$phpEx); ! break; ! } ! ! $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); if ( !$db->db_connect_id ) --- 766,770 ---- // include($mx_root_path . "includes/sessions/internal/constants.$phpEx"); ! include($mx_root_path . 'includes/db/' . $dbms . '.' . $phpEx); // Load dbal and initiate class if ( !$db->db_connect_id ) *************** *** 770,837 **** $process_msgs[] = '<hr />'; $process_msgs[] = $install_title . '...<br />'; ! ! //exec_post_process($install_mode); ! ! if( $install_mode == 'install' ) ! { ! $portal_table = array( ! 'portal_id' => 1, ! '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 ($mx_request_vars->is_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 = ($confirm && $userdata['user_level'] == ADMIN) ? $admin_pass1 : md5($admin_pass1); ! ! $sql = "UPDATE " . USERS_TABLE . " ! SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "', user_lang = '" . str_replace("\'", "''", $language) . "', user_email='" . str_replace("\'", "''", $board_email) . "' ! WHERE username = 'Admin'"; ! ! if (!$db->sql_query($sql)) ! { ! $process_errors++; ! $process_msgs[] = "Could not update admin info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; ! } ! */ ! ! $sql = "UPDATE " . USERS_TABLE . " ! SET user_regdate = " . time(); ! ! if (!$db->sql_query($sql)) ! { ! $process_errors++; ! $process_msgs[] = "Could not update user_regdate :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; ! } ! } ! else ! { ! $sql = "UPDATE ".PORTAL_TABLE." ! SET portal_name='$mx_portal_name', ! portal_version='$mx_portal_version' ! WHERE portal_id = 1"; ! ! parse_cmd_sql($sql); ! } ! // --- 803,807 ---- $process_msgs[] = '<hr />'; $process_msgs[] = $install_title . '...<br />'; ! exec_post_process($install_mode, $upgrade_mode); // *************** *** 907,911 **** $template = new Template($mx_root_path . 'install/templates'); - // // Check if the Portal is already installed --- 877,880 ---- *************** *** 922,925 **** --- 891,895 ---- // $install_mode = 'upgrade'; + $upgrade_mode = defined('PHPBB_INSTALLED') ? 'from28x' : ''; page_header_install($lang['Welcome_install'], $lang['Upgrade_Instruction']); $template->set_filenames(array('button' => 'mx_install_button.tpl')); *************** *** 1084,1088 **** 'PHPBB_URL' => '', 'DBMS' => '', ! 'DB_HOST' => '', 'DB_NAME' => '', 'DB_USER' => '', --- 1054,1058 ---- 'PHPBB_URL' => '', 'DBMS' => '', ! 'DB_HOST' => 'localhost', 'DB_NAME' => '', 'DB_USER' => '', *************** *** 1148,1157 **** } // ! // Get the phpBB URL (and close DB connection) // $phpbb_url = get_phpbb_url($phpbb_info['table_prefix']); $db->sql_close(); $db = false; if( empty($phpbb_url) ) { --- 1118,1131 ---- } // ! // Get the phpBB URL // $phpbb_url = get_phpbb_url($phpbb_info['table_prefix']); + // + // Close our DB connection. + // $db->sql_close(); $db = false; + if( empty($phpbb_url) ) { *************** *** 1170,1174 **** 'PHPBB_URL' => $phpbb_url, 'DBMS' => $phpbb_info['dbms'], ! 'DB_HOST' => $phpbb_info['dbhost'], 'DB_NAME' => $phpbb_info['dbname'], 'DB_USER' => $phpbb_info['dbuser'], --- 1144,1148 ---- 'PHPBB_URL' => $phpbb_url, 'DBMS' => $phpbb_info['dbms'], ! 'DB_HOST' => !empty($phpbb_info['dbhost']) ? $phpbb_info['dbhost'] : 'localhost', 'DB_NAME' => $phpbb_info['dbname'], 'DB_USER' => $phpbb_info['dbuser'], *************** *** 1204,1222 **** // -------------------- - /* - if( defined('INSTALL_READONLY') && !$phpbb_found ) - { - if( $files_cnt <= 0 ) - { - install_die($lang['Install_phpbb_not_found'], $debuginfo); - } - if( $phpbb_failed ) - { - install_die($lang['Install_phpbb_db_failed'], $debuginfo); - } - install_die($lang['Install_phpbb_unsupported'], $debuginfo); - } - */ - $s_hidden_fields = '<input type="hidden" name="install_mode" value="' . $install_mode . '" />'. '<input type="hidden" name="confirm" value="1" />'. --- 1178,1181 ---- *************** *** 1242,1248 **** --- 1201,1211 ---- 'L_DB_USER' => $lang['DB_Username'], 'L_DB_PASSWORD' => $lang['DB_Password'], + 'L_MXP_ADMINNAME' => $lang['MXP_Adminname'], + 'L_MXP_PASSWORD' => $lang['MXP_Password'], + 'L_MXP_PASSWORD2' => $lang['MXP_Password2'], 'L_DB_PREFIX' => $lang['Table_Prefix'], 'L_ACM_TYPE' => ( !empty($lang['acm_type']) ? $lang['acm_type'] : 'Acm Type' ), 'L_MX_DB_PREFIX' => $lang['MX_Table_Prefix'], + 'L_MXP_ADMIN' => $lang['Install_Instruction_MXP_Admin'], 'L_SUBMIT' => $lang['Start_Install'], |