diff options
Diffstat (limited to 'phpBB/install/install_install.php')
| -rw-r--r-- | phpBB/install/install_install.php | 135 | 
1 files changed, 117 insertions, 18 deletions
| diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 1a7e1d1094..f9d5edc903 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -18,14 +18,9 @@ if (!defined('IN_INSTALL'))  if (!empty($setmodules))  {  	// If phpBB is already installed we do not include this module -	if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) +	if (phpbb_check_installation_exists($phpbb_root_path, $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock'))  	{ -		include_once($phpbb_root_path . 'config.' . $phpEx); - -		if (defined('PHPBB_INSTALLED')) -		{ -			return; -		} +		return;  	}  	$module[] = array( @@ -222,7 +217,6 @@ class install_install extends module  			'S_LEGEND'		=> false,  		)); -  		// Check for getimagesize  		if (@function_exists('getimagesize'))  		{ @@ -296,8 +290,8 @@ class install_install extends module  			$checks = array(  				array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING),  				array('encoding_translation', '!=', 0), -				array('http_input', '!=', 'pass'), -				array('http_output', '!=', 'pass') +				array('http_input', '!=', array('pass', '')), +				array('http_output', '!=', array('pass', ''))  			);  			foreach ($checks as $mb_checks) @@ -318,7 +312,8 @@ class install_install extends module  					break;  					case '!=': -						if ($ini_val != $mb_checks[2]) +						if (!is_array($mb_checks[2]) && $ini_val != $mb_checks[2] || +							is_array($mb_checks[2]) && !in_array($ini_val, $mb_checks[2]))  						{  							$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';  							$passed['mbstring'] = false; @@ -540,7 +535,6 @@ class install_install extends module  		$url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&sub=database&language=$language" : $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language	";  		$submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST']; -  		$template->assign_vars(array(  			'L_SUBMIT'	=> $submit,  			'S_HIDDEN'	=> $s_hidden_fields, @@ -1156,13 +1150,9 @@ class install_install extends module  		// How should we treat this schema?  		$delimiter = $available_dbms[$data['dbms']]['DELIM']; -  		$sql_query = @file_get_contents($dbms_schema); -  		$sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); -  		$sql_query = phpbb_remove_comments($sql_query); -  		$sql_query = split_sql_file($sql_query, $delimiter);  		foreach ($sql_query as $sql) @@ -1176,6 +1166,27 @@ class install_install extends module  		}  		unset($sql_query); +		// Ok we have the db info go ahead and work on building the table +		$db_table_schema = @file_get_contents('schemas/schema.json'); +		$db_table_schema = json_decode($db_table_schema, true); + +		if (!defined('CONFIG_TABLE')) +		{ +			// CONFIG_TABLE is required by sql_create_index() to check the +			// length of index names. However table_prefix is not defined +			// here yet, so we need to create the constant ourselves. +			define('CONFIG_TABLE', $data['table_prefix'] . 'config'); +		} + +		$db_tools = new \phpbb\db\tools($db); +		foreach ($db_table_schema as $table_name => $table_data) +		{ +			$db_tools->sql_create_table( +				$data['table_prefix'] . substr($table_name, 6), +				$table_data +			); +		} +  		// Ok tables have been built, let's fill in the basic information  		$sql_query = file_get_contents('schemas/schema_data.sql'); @@ -1637,6 +1648,45 @@ class install_install extends module  				$_module->move_module_by($row, 'move_up', 5);  			} +			if ($module_class == 'mcp') +			{ +				// Move pm report details module 3 down... +				$sql = 'SELECT * +					FROM ' . MODULES_TABLE . " +					WHERE module_basename = 'mcp_pm_reports' +						AND module_class = 'mcp' +						AND module_mode = 'pm_report_details'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				$_module->move_module_by($row, 'move_down', 3); + +				// Move closed pm reports module 3 down... +				$sql = 'SELECT * +					FROM ' . MODULES_TABLE . " +					WHERE module_basename = 'mcp_pm_reports' +						AND module_class = 'mcp' +						AND module_mode = 'pm_reports_closed'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				$_module->move_module_by($row, 'move_down', 3); + +				// Move open pm reports module 3 down... +				$sql = 'SELECT * +					FROM ' . MODULES_TABLE . " +					WHERE module_basename = 'mcp_pm_reports' +						AND module_class = 'mcp' +						AND module_mode = 'pm_reports'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				$_module->move_module_by($row, 'move_down', 3); +			} +  			if ($module_class == 'ucp')  			{  				// Move attachment module 4 down... @@ -1650,6 +1700,30 @@ class install_install extends module  				$db->sql_freeresult($result);  				$_module->move_module_by($row, 'move_down', 4); + +				// Move notification options module 4 down... +				$sql = 'SELECT * +					FROM ' . MODULES_TABLE . " +					WHERE module_basename = 'ucp_notifications' +						AND module_class = 'ucp' +						AND module_mode = 'notification_options'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				$_module->move_module_by($row, 'move_down', 4); + +				// Move OAuth module 5 down... +				$sql = 'SELECT * +					FROM ' . MODULES_TABLE . " +					WHERE module_basename = 'ucp_auth_link' +						AND module_class = 'ucp' +						AND module_mode = 'auth_link'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				$_module->move_module_by($row, 'move_down', 5);  			}  			// And now for the special ones @@ -1718,6 +1792,7 @@ class install_install extends module  			$this->error('Unable to access the language directory', __LINE__, __FILE__);  		} +		$installed_languages = array();  		while (($file = readdir($dir)) !== false)  		{  			$path = $phpbb_root_path . 'language/' . $file; @@ -1741,6 +1816,7 @@ class install_install extends module  				$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack)); +				$installed_languages[] = (int) $db->sql_nextid();  				if ($db->sql_error_triggered)  				{  					$error = $db->sql_error($db->sql_error_sql); @@ -1749,6 +1825,29 @@ class install_install extends module  			}  		}  		closedir($dir); + +		$sql = 'SELECT * +			FROM ' . PROFILE_FIELDS_TABLE; +		$result = $db->sql_query($sql); + +		$profile_fields = array(); +		$insert_buffer = new \phpbb\db\sql_insert_buffer($db, PROFILE_LANG_TABLE); +		while ($row = $db->sql_fetchrow($result)) +		{ +			foreach ($installed_languages as $lang_id) +			{ +				$insert_buffer->insert(array( +					'field_id'				=> $row['field_id'], +					'lang_id'				=> $lang_id, +					'lang_name'				=> strtoupper(substr($row['field_name'], 6)),// Remove phpbb_ from field name +					'lang_explain'			=> '', +					'lang_default_value'	=> '', +				)); +			} +		} +		$db->sql_freeresult($result); + +		$insert_buffer->flush();  	}  	/** @@ -1997,8 +2096,8 @@ class install_install extends module  		'smtp_delivery'			=> array('lang' => 'USE_SMTP',			'type' => 'radio:yes_no', 'explain' => true),  		'smtp_host'				=> array('lang' => 'SMTP_SERVER',		'type' => 'text:25:50', 'explain' => false),  		'smtp_auth'				=> array('lang' => 'SMTP_AUTH_METHOD',	'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true), -		'smtp_user'				=> array('lang' => 'SMTP_USERNAME',		'type' => 'text:25:255', 'explain' => true), -		'smtp_pass'				=> array('lang' => 'SMTP_PASSWORD',		'type' => 'password:25:255', 'explain' => true), +		'smtp_user'				=> array('lang' => 'SMTP_USERNAME',		'type' => 'text:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')), +		'smtp_pass'				=> array('lang' => 'SMTP_PASSWORD',		'type' => 'password:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')),  		'legend2'				=> 'SERVER_URL_SETTINGS',  		'cookie_secure'			=> array('lang' => 'COOKIE_SECURE',		'type' => 'radio:enabled_disabled', 'explain' => true), | 
