phpBB

Code Changes

File: includes/functions_install.php

  Unmodified   Added   Modified   Removed
Line 55Line 55
			'AVAILABLE'		=> true,
'2.0.x' => false,
),

			'AVAILABLE'		=> true,
'2.0.x' => false,
),

 
		// Note: php 5.5 alpha 2 deprecated mysql.
// Keep mysqli before mysql in this list.

		'mysqli'	=> array(
'LABEL' => 'MySQL with MySQLi Extension',
'SCHEMA' => 'mysql_41',

		'mysqli'	=> array(
'LABEL' => 'MySQL with MySQLi Extension',
'SCHEMA' => 'mysql_41',

Line 307Line 309
	if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();

	if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();

		$error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);

		$error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);

	}
else
{

	}
else
{

Line 473Line 475
}

/**

}

/**

* remove_remarks will strip the sql comment lines out of an uploaded sql file



* Removes comments from schema files
*
* @deprecated Use phpbb_remove_comments() instead.

*/
function remove_remarks(&$sql)
{

*/
function remove_remarks(&$sql)
{

 
	// Remove # style comments

	$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));

	$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));

 

// Return by reference
}

/**
* Removes "/* style" as well as "# style" comments from $input.
*
* @param string $input Input string
*
* @return string Input string with comments removed
*/
function phpbb_remove_comments($input)
{
if (!function_exists('remove_comments'))
{
global $phpbb_root_path, $phpEx;
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}

// Remove /* */ comments
remove_comments($input);

// Remove # style comments
remove_remarks($input);

return $input;

}

/**

}

/**

Line 513Line 544

return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]);
}


return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]);
}

 
}

/**
* Creates the output to be stored in a phpBB config.php file
*
* @param array $data Array containing the database connection information
* @param string $dbms The name of the DBAL class to use
* @param array $load_extensions Array of additional extensions that should be loaded
* @param bool $debug If the debug constants should be enabled by default or not
* @param bool $debug_test If the DEBUG_TEST constant should be added
* NOTE: Only for use within the testing framework
*
* @return string The output to write to the file
*/
function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug = false, $debug_test = false)
{
$load_extensions = implode(',', $load_extensions);

$config_data = "<?php\n";
$config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";

$config_data_array = array(
'dbms' => $dbms,
'dbhost' => $data['dbhost'],
'dbport' => $data['dbport'],
'dbname' => $data['dbname'],
'dbuser' => $data['dbuser'],
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
'table_prefix' => $data['table_prefix'],
'acm_type' => 'file',
'load_extensions' => $load_extensions,
);

foreach ($config_data_array as $key => $value)
{
$config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
}

$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";

if ($debug)
{
$config_data .= "@define('DEBUG', true);\n";
$config_data .= "@define('DEBUG_EXTRA', true);\n";
}
else
{
$config_data .= "// @define('DEBUG', true);\n";
$config_data .= "// @define('DEBUG_EXTRA', true);\n";
}

if ($debug_test)
{
$config_data .= "@define('DEBUG_TEST', true);\n";
}

return $config_data;

}

?>

}

?>