Vergleich install/index.php - 1.6.0 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: index.php 5092 2010-07-17 11:09:40Z Huji $

 * $Id$

 */

if(function_exists("unicode_decode"))

 */

if(function_exists("unicode_decode"))

Zeile 162Zeile 162
		'adminuser' => $lang->admin_user,
'final' => $lang->finish_setup,
);

		'adminuser' => $lang->admin_user,
'final' => $lang->finish_setup,
);

	



	if(!isset($mybb->input['action']))
{
$mybb->input['action'] = 'intro';
}

	if(!isset($mybb->input['action']))
{
$mybb->input['action'] = 'intro';
}

	



	switch($mybb->input['action'])
{
case 'license':

	switch($mybb->input['action'])
{
case 'license':

Zeile 178Zeile 178
			break;
case 'database_info':
database_info();

			break;
case 'database_info':
database_info();

			break;

			break;

		case 'create_tables':
create_tables();
break;

		case 'create_tables':
create_tables();
break;

Zeile 193Zeile 193
			break;
case 'adminuser';
create_admin_user();

			break;
case 'adminuser';
create_admin_user();

			break;

			break;

		case 'final':
install_done();

		case 'final':
install_done();

			break;

			break;

		default:
intro();
break;

		default:
intro();
break;

	}
}


	}
}


function intro()
{
global $output, $mybb, $lang;

function intro()
{
global $output, $mybb, $lang;

	



	$output->print_header($lang->welcome, 'welcome');
if(strpos(strtolower($_SERVER['PHP_SELF']), "upload/") !== false)

	$output->print_header($lang->welcome, 'welcome');
if(strpos(strtolower($_SERVER['PHP_SELF']), "upload/") !== false)

	{

	{

		echo $lang->sprintf($lang->mybb_incorrect_folder);
}
echo $lang->sprintf($lang->welcome_step, $mybb->version);

		echo $lang->sprintf($lang->mybb_incorrect_folder);
}
echo $lang->sprintf($lang->welcome_step, $mybb->version);

Zeile 219Zeile 219
function license_agreement()
{
global $output, $lang, $mybb;

function license_agreement()
{
global $output, $lang, $mybb;

	



	ob_start();
$output->print_header($lang->license_agreement, 'license');

	ob_start();
$output->print_header($lang->license_agreement, 'license');

	



	if($mybb->input['allow_anonymous_info'] == 1)
{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(1, '', $mybb->version_code, $mybb->config['database']['encoding']);

	if($mybb->input['allow_anonymous_info'] == 1)
{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(1, '', $mybb->version_code, $mybb->config['database']['encoding']);

		



		if($build_server_stats['info_sent_success'] == false)
{
echo $build_server_stats['info_image'];

		if($build_server_stats['info_sent_success'] == false)
{
echo $build_server_stats['info_image'];

Zeile 1039Zeile 1039
	echo $lang->req_step_top;
$errors = array();
$showerror = 0;

	echo $lang->req_step_top;
$errors = array();
$showerror = 0;

	



	if(!file_exists(MYBB_ROOT."/inc/config.php"))
{
if(!@rename(MYBB_ROOT."/inc/config.default.php", MYBB_ROOT."/inc/config.php"))

	if(!file_exists(MYBB_ROOT."/inc/config.php"))
{
if(!@rename(MYBB_ROOT."/inc/config.default.php", MYBB_ROOT."/inc/config.php"))

Zeile 1064Zeile 1064
	{
$phpversion = $lang->sprintf($lang->req_step_span_pass, PHP_VERSION);
}

	{
$phpversion = $lang->sprintf($lang->req_step_span_pass, PHP_VERSION);
}

	



	if(function_exists('mb_detect_encoding'))

	if(function_exists('mb_detect_encoding'))

	{

	{

		$mboptions[] = $lang->multi_byte;
}

		$mboptions[] = $lang->multi_byte;
}

	



	if(function_exists('iconv'))
{
$mboptions[] = 'iconv';
}

	if(function_exists('iconv'))
{
$mboptions[] = 'iconv';
}

	



	// Check Multibyte extensions
if(count($mboptions) < 1)

	// Check Multibyte extensions
if(count($mboptions) < 1)

	{

	{

		$mbstatus = $lang->sprintf($lang->req_step_span_fail, $lang->none);
}
else

		$mbstatus = $lang->sprintf($lang->req_step_span_fail, $lang->none);
}
else

Zeile 1111Zeile 1111
	else
{
$xmlstatus = $lang->sprintf($lang->req_step_span_pass, $lang->installed);

	else
{
$xmlstatus = $lang->sprintf($lang->req_step_span_pass, $lang->installed);

	}

	}


// Check config file is writable
$configwritable = @fopen(MYBB_ROOT.'inc/config.php', 'w');


// Check config file is writable
$configwritable = @fopen(MYBB_ROOT.'inc/config.php', 'w');

Zeile 1180Zeile 1180
	// Check avatar directory is writable
$avatarswritable = @fopen(MYBB_ROOT.'uploads/avatars/test.write', 'w');
if(!$avatarswritable)

	// Check avatar directory is writable
$avatarswritable = @fopen(MYBB_ROOT.'uploads/avatars/test.write', 'w');
if(!$avatarswritable)

	{

	{

		$errors[] =  $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_avatardir);
$avatarsstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;

		$errors[] =  $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_avatardir);
$avatarsstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;

		@fclose($avatarswritable);
}
else
{

		@fclose($avatarswritable);
}
else
{

		$avatarsstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);
@fclose($avatarswritable);
@my_chmod(MYBB_ROOT.'uploads/avatars', '0777');
@my_chmod(MYBB_ROOT.'uploads/avatars/test.write', '0777');
@unlink(MYBB_ROOT.'uploads/avatars/test.write');
}

		$avatarsstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);
@fclose($avatarswritable);
@my_chmod(MYBB_ROOT.'uploads/avatars', '0777');
@my_chmod(MYBB_ROOT.'uploads/avatars/test.write', '0777');
@unlink(MYBB_ROOT.'uploads/avatars/test.write');
}





	// Output requirements page
echo $lang->sprintf($lang->req_step_reqtable, $phpversion, $dbsupportlist, $mbstatus, $xmlstatus, $configstatus, $settingsstatus, $cachestatus, $uploadsstatus, $avatarsstatus);


	// Output requirements page
echo $lang->sprintf($lang->req_step_reqtable, $phpversion, $dbsupportlist, $mbstatus, $xmlstatus, $configstatus, $settingsstatus, $cachestatus, $uploadsstatus, $avatarsstatus);


Zeile 1210Zeile 1210
	{
echo $lang->req_step_reqcomplete;
$output->print_footer('database_info');

	{
echo $lang->req_step_reqcomplete;
$output->print_footer('database_info');

	}
}


	}
}


function database_info()
{
global $output, $dbinfo, $errors, $mybb, $dboptions, $lang;

function database_info()
{
global $output, $dbinfo, $errors, $mybb, $dboptions, $lang;

	



	$mybb->input['action'] = 'database_info';
$output->print_header($lang->db_config, 'dbconfig');


	$mybb->input['action'] = 'database_info';
$output->print_header($lang->db_config, 'dbconfig');


Zeile 1245Zeile 1245
	{
$error_list = error_list($errors);
echo $lang->sprintf($lang->db_step_error_config, $error_list);

	{
$error_list = error_list($errors);
echo $lang->sprintf($lang->db_step_error_config, $error_list);

	}

	}

	else
{
echo $lang->db_step_config_db;

	else
{
echo $lang->db_step_config_db;

	}


	}


	// Loop through database engines
foreach($dboptions as $dbfile => $dbtype)
{

	// Loop through database engines
foreach($dboptions as $dbfile => $dbtype)
{

Zeile 1277Zeile 1277
		if(!$mybb->input['config'][$dbfile]['tableprefix'])
{
$mybb->input['config'][$dbfile]['tableprefix'] = "mybb_";

		if(!$mybb->input['config'][$dbfile]['tableprefix'])
{
$mybb->input['config'][$dbfile]['tableprefix'] = "mybb_";

		}

		}

		if(!$mybb->input['config'][$dbfile]['encoding'])
{
$mybb->input['config'][$dbfile]['encoding'] = "utf8";

		if(!$mybb->input['config'][$dbfile]['encoding'])
{
$mybb->input['config'][$dbfile]['encoding'] = "utf8";

Zeile 1285Zeile 1285

$class = '';
if(!$first && !$mybb->input['dbengine'])


$class = '';
if(!$first && !$mybb->input['dbengine'])

		{

		{

			$mybb->input['dbengine'] = $dbfile;
$first = true;

			$mybb->input['dbengine'] = $dbfile;
$first = true;

		}

		}

		if($dbfile == $mybb->input['dbengine'])
{
$class = "_selected";
}

		if($dbfile == $mybb->input['dbengine'])
{
$class = "_selected";
}





		$db_info[$dbfile] = "
<tbody id=\"{$dbfile}_settings\" class=\"db_settings db_type{$class}\">
<tr>
<th colspan=\"2\" class=\"first last\">{$dbtype['title']} {$lang->database_settings}</th>
</tr>";

		$db_info[$dbfile] = "
<tbody id=\"{$dbfile}_settings\" class=\"db_settings db_type{$class}\">
<tr>
<th colspan=\"2\" class=\"first last\">{$dbtype['title']} {$lang->database_settings}</th>
</tr>";

			



		// SQLite gets some special settings
if($dbfile == 'sqlite')
{

		// SQLite gets some special settings
if($dbfile == 'sqlite')
{

Zeile 1341Zeile 1341
				<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"config[{$dbfile}][tableprefix]\" id=\"config_{$dbfile}_tableprefix\" value=\"".htmlspecialchars_uni($mybb->input['config'][$dbfile]['tableprefix'])."\" /></td>
</tr>
";

				<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"config[{$dbfile}][tableprefix]\" id=\"config_{$dbfile}_tableprefix\" value=\"".htmlspecialchars_uni($mybb->input['config'][$dbfile]['tableprefix'])."\" /></td>
</tr>
";

		



		// Encoding selection only if supported
if(is_array($encodings))
{

		// Encoding selection only if supported
if(is_array($encodings))
{

Zeile 1374Zeile 1374
function create_tables()
{
global $output, $dbinfo, $errors, $mybb, $dboptions, $lang;

function create_tables()
{
global $output, $dbinfo, $errors, $mybb, $dboptions, $lang;

	



	if(!file_exists(MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php"))
{
$errors[] = $lang->db_step_error_invalidengine;

	if(!file_exists(MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php"))
{
$errors[] = $lang->db_step_error_invalidengine;

Zeile 1382Zeile 1382
	}

$config = $mybb->input['config'][$mybb->input['dbengine']];

	}

$config = $mybb->input['config'][$mybb->input['dbengine']];

	



	if(strstr($mybb->input['dbengine'], "sqlite") !== false)
{

	if(strstr($mybb->input['dbengine'], "sqlite") !== false)
{

		if(strstr($config['dbname'], "./") !== false || strstr($config['dbname'], "../") !== false)

		if(strstr($config['dbname'], "./") !== false || strstr($config['dbname'], "../") !== false || empty($config['dbname']))

		{
$errors[] = $lang->db_step_error_sqlite_invalid_dbname;
database_info();
}

		{
$errors[] = $lang->db_step_error_sqlite_invalid_dbname;
database_info();
}

	}

	}


// Attempt to connect to the db
require_once MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php";


// Attempt to connect to the db
require_once MYBB_ROOT."inc/db_{$mybb->input['dbengine']}.php";

Zeile 1409Zeile 1409
			$db = new DB_MySQL;
}
$db->error_reporting = 0;

			$db = new DB_MySQL;
}
$db->error_reporting = 0;





	$connect_array = array(
"hostname" => $config['dbhost'],
"username" => $config['dbuser'],

	$connect_array = array(
"hostname" => $config['dbhost'],
"username" => $config['dbuser'],

Zeile 1417Zeile 1417
		"database" => $config['dbname'],
"encoding" => $config['encoding']
);

		"database" => $config['dbname'],
"encoding" => $config['encoding']
);





	$connection = $db->connect($connect_array);
if($connection === false)
{

	$connection = $db->connect($connect_array);
if($connection === false)
{

Zeile 1425Zeile 1425
	}
// double check if the DB exists for MySQL
elseif(method_exists($db, 'select_db') && !$db->select_db($config['dbname']))

	}
// double check if the DB exists for MySQL
elseif(method_exists($db, 'select_db') && !$db->select_db($config['dbname']))

	{

	{

		$errors[] = $lang->sprintf($lang->db_step_error_nodbname, $config['dbname']);
}

		$errors[] = $lang->sprintf($lang->db_step_error_nodbname, $config['dbname']);
}

	



	// Most DB engines only allow certain characters in the table name. Oracle requires an alphabetic character first.
if((!preg_match("#^[A-Za-z][A-Za-z0-9_]*$#", $config['tableprefix'])) && $config['tableprefix'] != '')
{
$errors[] = $lang->db_step_error_invalid_tableprefix;
}

	// Most DB engines only allow certain characters in the table name. Oracle requires an alphabetic character first.
if((!preg_match("#^[A-Za-z][A-Za-z0-9_]*$#", $config['tableprefix'])) && $config['tableprefix'] != '')
{
$errors[] = $lang->db_step_error_invalid_tableprefix;
}

	



	// Needs to be smaller then 64 characters total (MySQL Limit).
// This allows 24 characters for the actual table name, which should be sufficient.
if(strlen($config['tableprefix']) > 40)
{
$errors[] = $lang->db_step_error_tableprefix_too_long;

	// Needs to be smaller then 64 characters total (MySQL Limit).
// This allows 24 characters for the actual table name, which should be sufficient.
if(strlen($config['tableprefix']) > 40)
{
$errors[] = $lang->db_step_error_tableprefix_too_long;

	}

if(is_array($errors))

	}

if(is_array($errors))

	{
database_info();

	{
database_info();

	}


	}


	// Decide if we can use a database encoding or not
if($db->fetch_db_charsets() != false)

	// Decide if we can use a database encoding or not
if($db->fetch_db_charsets() != false)

	{

	{

		$db_encoding = "\$config['database']['encoding'] = '{$config['encoding']}';";

		$db_encoding = "\$config['database']['encoding'] = '{$config['encoding']}';";

	}

	}

	else
{
$db_encoding = "// \$config['database']['encoding'] = '{$config['encoding']}';";
}

	else
{
$db_encoding = "// \$config['database']['encoding'] = '{$config['encoding']}';";
}

	



	// Write the configuration file
$configdata = "<?php
/**
* Database configuration
*

	// Write the configuration file
$configdata = "<?php
/**
* Database configuration
*

 * Please see the MyBB Wiki for advanced

 * Please see the MyBB Docs for advanced

 * database configuration for larger installations

 * database configuration for larger installations

 * http://wiki.mybboard.net/

 * http://docs.mybb.com/

 */

\$config['database']['type'] = '{$mybb->input['dbengine']}';

 */

\$config['database']['type'] = '{$mybb->input['dbengine']}';

Zeile 1503Zeile 1503
 *
* If you wish to use the file system (cache/ directory), MemCache, xcache, or eAccelerator
* you can change the value below to 'files', 'memcache', 'xcache' or 'eaccelerator' from 'db'.

 *
* If you wish to use the file system (cache/ directory), MemCache, xcache, or eAccelerator
* you can change the value below to 'files', 'memcache', 'xcache' or 'eaccelerator' from 'db'.

 */

\$config['cache_store'] = 'db';


 */

\$config['cache_store'] = 'db';


/**
* Memcache configuration
* If you are using memcache as your data-cache,

/**
* Memcache configuration
* If you are using memcache as your data-cache,

Zeile 1514Zeile 1514
 *  of your memcache server below.
*
* If not using memcache, ignore this section.

 *  of your memcache server below.
*
* If not using memcache, ignore this section.

 */

 */


\$config['memcache']['host'] = 'localhost';
\$config['memcache']['port'] = 11211;


\$config['memcache']['host'] = 'localhost';
\$config['memcache']['port'] = 11211;

Zeile 1531Zeile 1531

/**
* Database Encoding


/**
* Database Encoding

 *  If you wish to set an encoding for MyBB uncomment 

 *  If you wish to set an encoding for MyBB uncomment

 *  the line below (if it isn't already) and change
* the current value to the mysql charset:
* http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html

 *  the line below (if it isn't already) and change
* the current value to the mysql charset:
* http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html

 */


 */


{$db_encoding}

/**

{$db_encoding}

/**

Zeile 1556Zeile 1556
	'user_mail_logs' => 180, // User mail logs
'promotion_logs' => 180 // Promotion logs
);

	'user_mail_logs' => 180, // User mail logs
'promotion_logs' => 180 // Promotion logs
);

 



?>";

$file = fopen(MYBB_ROOT.'inc/config.php', 'w');

?>";

$file = fopen(MYBB_ROOT.'inc/config.php', 'w');

Zeile 1568Zeile 1568

$output->print_header($lang->table_creation, 'createtables');
echo $lang->sprintf($lang->tablecreate_step_connected, $dboptions[$mybb->input['dbengine']]['short_title'], $db->get_version());


$output->print_header($lang->table_creation, 'createtables');
echo $lang->sprintf($lang->tablecreate_step_connected, $dboptions[$mybb->input['dbengine']]['short_title'], $db->get_version());

	



	if($dboptions[$mybb->input['dbengine']]['structure_file'])
{
$structure_file = $dboptions[$mybb->input['dbengine']]['structure_file'];

	if($dboptions[$mybb->input['dbengine']]['structure_file'])
{
$structure_file = $dboptions[$mybb->input['dbengine']]['structure_file'];

Zeile 1597Zeile 1597
	}
echo $lang->tablecreate_step_done;
$output->print_footer('populate_tables');

	}
echo $lang->tablecreate_step_done;
$output->print_footer('populate_tables');

}


}


function populate_tables()
{
global $output, $lang;

function populate_tables()
{
global $output, $lang;





	require MYBB_ROOT.'inc/config.php';
$db = db_connection($config);


	require MYBB_ROOT.'inc/config.php';
$db = db_connection($config);


Zeile 1616Zeile 1616
	else
{
$population_file = 'mysql_db_inserts.php';

	else
{
$population_file = 'mysql_db_inserts.php';

	}


	}


	require_once INSTALL_ROOT."resources/{$population_file}";
foreach($inserts as $val)
{

	require_once INSTALL_ROOT."resources/{$population_file}";
foreach($inserts as $val)
{

Zeile 1625Zeile 1625
		$db->query($val);
}


		$db->query($val);
}


	// Update the fid sequence for PgSQL

	// Update the sequences for PgSQL

	if($config['database']['type'] == "pgsql")

	if($config['database']['type'] == "pgsql")

	{
$db->query("ALTER SEQUENCE ".$config['database']['table_prefix']."forums_fid_seq RESTART WITH 3");
}









	{
$db->query("SELECT setval('{$config['database']['table_prefix']}attachtypes_atid_seq', (SELECT max(atid) FROM {$config['database']['table_prefix']}attachtypes));");
$db->query("SELECT setval('{$config['database']['table_prefix']}forums_fid_seq', (SELECT max(fid) FROM {$config['database']['table_prefix']}forums));");
$db->query("SELECT setval('{$config['database']['table_prefix']}helpdocs_hid_seq', (SELECT max(hid) FROM {$config['database']['table_prefix']}helpdocs));");
$db->query("SELECT setval('{$config['database']['table_prefix']}helpsections_sid_seq', (SELECT max(sid) FROM {$config['database']['table_prefix']}helpsections));");
$db->query("SELECT setval('{$config['database']['table_prefix']}icons_iid_seq', (SELECT max(iid) FROM {$config['database']['table_prefix']}icons));");
$db->query("SELECT setval('{$config['database']['table_prefix']}profilefields_fid_seq', (SELECT max(fid) FROM {$config['database']['table_prefix']}profilefields));");
$db->query("SELECT setval('{$config['database']['table_prefix']}smilies_sid_seq', (SELECT max(sid) FROM {$config['database']['table_prefix']}smilies));");
$db->query("SELECT setval('{$config['database']['table_prefix']}spiders_sid_seq', (SELECT max(sid) FROM {$config['database']['table_prefix']}spiders));");
$db->query("SELECT setval('{$config['database']['table_prefix']}templategroups_gid_seq', (SELECT max(gid) FROM {$config['database']['table_prefix']}templategroups));");
}


echo $lang->populate_step_inserted;
$output->print_footer('templates');


echo $lang->populate_step_inserted;
$output->print_footer('templates');

Zeile 1662Zeile 1670
	$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme.xml');
if(file_exists(MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php"))
{

	$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme.xml');
if(file_exists(MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php"))
{

 
		require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions.php";

		require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php";
}
elseif(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))
{

		require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php";
}
elseif(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))
{

 
		require_once MYBB_ROOT."admin/inc/functions.php";

		require_once MYBB_ROOT."admin/inc/functions_themes.php";
}
else

		require_once MYBB_ROOT."admin/inc/functions_themes.php";
}
else

Zeile 1674Zeile 1684
	}
$theme_id = import_theme_xml($contents, array("templateset" => -2, "version_compat" => 1));
$tid = build_new_theme("Default", null, $theme_id);

	}
$theme_id = import_theme_xml($contents, array("templateset" => -2, "version_compat" => 1));
$tid = build_new_theme("Default", null, $theme_id);

	



	// Update our properties template set to the correct one
$query = $db->simple_select("themes", "properties", "tid='{$tid}'", array('limit' => 1));
$properties = unserialize($db->fetch_field($query, "properties"));
$properties['templateset'] = $templateset;
unset($properties['inherited']['templateset']);


	// Update our properties template set to the correct one
$query = $db->simple_select("themes", "properties", "tid='{$tid}'", array('limit' => 1));
$properties = unserialize($db->fetch_field($query, "properties"));
$properties['templateset'] = $templateset;
unset($properties['inherited']['templateset']);


	$db->update_query("themes", array("def" => 1, "properties" => $db->escape_string(serialize($properties))), "tid='{$tid}'");


	$db->update_query("themes", array("def" => 1, "properties" => $db->escape_string(serialize($properties))), "tid='{$tid}'");


	echo $lang->theme_step_imported;
$output->print_footer('configuration');
}

	echo $lang->theme_step_imported;
$output->print_footer('configuration');
}





function configure()
{
global $output, $mybb, $errors, $lang;

function configure()
{
global $output, $mybb, $errors, $lang;

	



	$output->print_header($lang->board_config, 'config');

// If board configuration errors

	$output->print_header($lang->board_config, 'config');

// If board configuration errors

Zeile 1699Zeile 1709
		$error_list = error_list($errors);
echo $lang->sprintf($lang->config_step_error_config, $error_list);


		$error_list = error_list($errors);
echo $lang->sprintf($lang->config_step_error_config, $error_list);


		$bbname = htmlspecialchars($mybb->input['bbname']);
$bburl = htmlspecialchars($mybb->input['bburl']);
$websitename = htmlspecialchars($mybb->input['websitename']);
$websiteurl = htmlspecialchars($mybb->input['websiteurl']);
$cookiedomain = htmlspecialchars($mybb->input['cookiedomain']);
$cookiepath = htmlspecialchars($mybb->input['cookiepath']);
$contactemail = htmlspecialchars($mybb->input['contactemail']);

		$bbname = htmlspecialchars_uni($mybb->input['bbname']);
$bburl = htmlspecialchars_uni($mybb->input['bburl']);
$websitename = htmlspecialchars_uni($mybb->input['websitename']);
$websiteurl = htmlspecialchars_uni($mybb->input['websiteurl']);
$cookiedomain = htmlspecialchars_uni($mybb->input['cookiedomain']);
$cookiepath = htmlspecialchars_uni($mybb->input['cookiepath']);
$contactemail = htmlspecialchars_uni($mybb->input['contactemail']);

	}
else
{

	}
else
{

Zeile 1715Zeile 1725
		$websiteurl = $hostname.'/';
$websitename = 'Your Website';
$contactemail = '';

		$websiteurl = $hostname.'/';
$websitename = 'Your Website';
$contactemail = '';

 

$protocol = "http://";
if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") || substr($bburl, 0, 5) == "https")
{
$protocol = "https://";
}


		// Attempt auto-detection
if($_SERVER['HTTP_HOST'])
{

		// Attempt auto-detection
if($_SERVER['HTTP_HOST'])
{

			$hostname = 'http://'.$_SERVER['HTTP_HOST'];

			$hostname = $protocol.$_SERVER['HTTP_HOST'];

			$cookiedomain = '.'.$_SERVER['HTTP_HOST'];
}
elseif($_SERVER['SERVER_NAME'])
{

			$cookiedomain = '.'.$_SERVER['HTTP_HOST'];
}
elseif($_SERVER['SERVER_NAME'])
{

			$hostname = 'http://'.$_SERVER['SERVER_NAME'];

			$hostname = $protocol.$_SERVER['SERVER_NAME'];

			$cookiedomain = '.'.$_SERVER['SERVER_NAME'];
}

			$cookiedomain = '.'.$_SERVER['SERVER_NAME'];
}

		



		if(substr($cookiedomain, 0, 5) == ".www.")
{
$cookiedomain = my_substr($cookiedomain, 4);
}

		if(substr($cookiedomain, 0, 5) == ".www.")
{
$cookiedomain = my_substr($cookiedomain, 4);
}

		
if($_SERVER['HTTP_HOST'] == 'localhost' || $_SERVER['SERVER_NAME'] == 'localhost')


if($_SERVER['HTTP_HOST'] == 'localhost' || $_SERVER['SERVER_NAME'] == 'localhost' || ip2long($_SERVER['SERVER_NAME']) != false)

		{
$cookiedomain = '';

		{
$cookiedomain = '';

		}


		}


		if($_SERVER['SERVER_PORT'] && $_SERVER['SERVER_PORT'] != 80 && !preg_match("#:[0-9]#i", $hostname))
{
$hostname .= ':'.$_SERVER['SERVER_PORT'];
}

		if($_SERVER['SERVER_PORT'] && $_SERVER['SERVER_PORT'] != 80 && !preg_match("#:[0-9]#i", $hostname))
{
$hostname .= ':'.$_SERVER['SERVER_PORT'];
}

		



		$currentlocation = get_current_location();
if($currentlocation)
{

		$currentlocation = get_current_location();
if($currentlocation)
{

Zeile 1752Zeile 1769
				$cookiepath = "/";
}
else

				$cookiepath = "/";
}
else

			{

			{

				$cookiepath = my_substr($currentlocation, 0, $pos).'/';
}
}

				$cookiepath = my_substr($currentlocation, 0, $pos).'/';
}
}

		



		$currentscript = $hostname.get_current_location();

		$currentscript = $hostname.get_current_location();

		



		if($currentscript)
{
$bburl = my_substr($currentscript, 0, my_strpos($currentscript, '/install/'));

		if($currentscript)
{
$bburl = my_substr($currentscript, 0, my_strpos($currentscript, '/install/'));

		}


		}


		if($_SERVER['SERVER_ADMIN'])
{
$contactemail = $_SERVER['SERVER_ADMIN'];

		if($_SERVER['SERVER_ADMIN'])
{
$contactemail = $_SERVER['SERVER_ADMIN'];

		}

		}

	}

echo $lang->sprintf($lang->config_step_table, $bbname, $bburl, $websitename, $websiteurl, $cookiedomain, $cookiepath, $contactemail);

	}

echo $lang->sprintf($lang->config_step_table, $bbname, $bburl, $websitename, $websiteurl, $cookiedomain, $cookiepath, $contactemail);

Zeile 1777Zeile 1794
function create_admin_user()
{
global $output, $mybb, $errors, $db, $lang;

function create_admin_user()
{
global $output, $mybb, $errors, $db, $lang;

	



	$mybb->input['action'] = "adminuser";
// If no errors then check for errors from last step
if(!is_array($errors))

	$mybb->input['action'] = "adminuser";
// If no errors then check for errors from last step
if(!is_array($errors))

Zeile 1787Zeile 1804
			$errors[] = $lang->config_step_error_url;
}
if(empty($mybb->input['bbname']))

			$errors[] = $lang->config_step_error_url;
}
if(empty($mybb->input['bbname']))

		{

		{

			$errors[] = $lang->config_step_error_name;
}
if(is_array($errors))

			$errors[] = $lang->config_step_error_name;
}
if(is_array($errors))

Zeile 1837Zeile 1854
					'optionscode' => $db->escape_string($setting['optionscode'][0]['value']),
'value' => $db->escape_string($setting['settingvalue'][0]['value']),
'disporder' => intval($setting['disporder'][0]['value']),

					'optionscode' => $db->escape_string($setting['optionscode'][0]['value']),
'value' => $db->escape_string($setting['settingvalue'][0]['value']),
'disporder' => intval($setting['disporder'][0]['value']),

					'gid' => $gid


					'gid' => $gid,
'isdefault' => 1

				);

$db->insert_query('settings', $settingdata);

				);

$db->insert_query('settings', $settingdata);

Zeile 1848Zeile 1866
		if(my_substr($mybb->input['bburl'], -1, 1) == '/')
{
$mybb->input['bburl'] = my_substr($mybb->input['bburl'], 0, -1);

		if(my_substr($mybb->input['bburl'], -1, 1) == '/')
{
$mybb->input['bburl'] = my_substr($mybb->input['bburl'], 0, -1);

		}


		}


		$db->update_query("settings", array('value' => $db->escape_string($mybb->input['bbname'])), "name='bbname'");
$db->update_query("settings", array('value' => $db->escape_string($mybb->input['bburl'])), "name='bburl'");
$db->update_query("settings", array('value' => $db->escape_string($mybb->input['websitename'])), "name='homename'");

		$db->update_query("settings", array('value' => $db->escape_string($mybb->input['bbname'])), "name='bbname'");
$db->update_query("settings", array('value' => $db->escape_string($mybb->input['bburl'])), "name='bburl'");
$db->update_query("settings", array('value' => $db->escape_string($mybb->input['websitename'])), "name='homename'");

Zeile 1906Zeile 1924
			{
$fields[] = $field['attributes']['name'];
}

			{
$fields[] = $field['attributes']['name'];
}

 


			$conditions = array();

			$conditions = array();

			

 
			if(is_array($view['conditions'][0]['condition']))
{
foreach($view['conditions'][0]['condition'] as $condition)

			if(is_array($view['conditions'][0]['condition']))
{
foreach($view['conditions'][0]['condition'] as $condition)

				{

				{

					if(!$condition['value']) continue;
if($condition['attributes']['is_serialized'] == 1)
{
$condition['value'] = unserialize($condition['value']);
}
$conditions[$condition['attributes']['name']] = $condition['value'];

					if(!$condition['value']) continue;
if($condition['attributes']['is_serialized'] == 1)
{
$condition['value'] = unserialize($condition['value']);
}
$conditions[$condition['attributes']['name']] = $condition['value'];

 
				}
}

$custom_profile_fields = array();
if(is_array($view['custom_profile_fields'][0]['field']))
{
foreach($view['custom_profile_fields'][0]['field'] as $field)
{
$custom_profile_fields[] = $field['attributes']['name'];

				}
}


				}
}


Zeile 1928Zeile 1955
				"title" => $db->escape_string($view['title'][0]['value']),
"fields" => $db->escape_string(serialize($fields)),
"conditions" => $db->escape_string(serialize($conditions)),

				"title" => $db->escape_string($view['title'][0]['value']),
"fields" => $db->escape_string(serialize($fields)),
"conditions" => $db->escape_string(serialize($conditions)),

 
				"custom_profile_fields" => $db->escape_string(serialize($custom_profile_fields)),

				"sortby" => $db->escape_string($view['sortby'][0]['value']),
"sortorder" => $db->escape_string($view['sortorder'][0]['value']),
"perpage" => intval($view['perpage'][0]['value']),

				"sortby" => $db->escape_string($view['sortby'][0]['value']),
"sortorder" => $db->escape_string($view['sortorder'][0]['value']),
"perpage" => intval($view['perpage'][0]['value']),

Zeile 1973Zeile 2001

require MYBB_ROOT.'inc/config.php';
$db = db_connection($config);


require MYBB_ROOT.'inc/config.php';
$db = db_connection($config);

	



	require MYBB_ROOT.'inc/settings.php';
$mybb->settings = &$settings;

ob_start();
$output->print_header($lang->finish_setup, 'finish');

	require MYBB_ROOT.'inc/settings.php';
$mybb->settings = &$settings;

ob_start();
$output->print_header($lang->finish_setup, 'finish');

	



	echo $lang->done_step_usergroupsinserted;

	echo $lang->done_step_usergroupsinserted;

	
// Insert all of our user groups from the XML file
$settings = file_get_contents(INSTALL_ROOT.'resources/usergroups.xml');
$parser = new XMLParser($settings);


// Insert all of our user groups from the XML file
$usergroup_settings = file_get_contents(INSTALL_ROOT.'resources/usergroups.xml');
$parser = new XMLParser($usergroup_settings);

	$parser->collapse_dups = 0;
$tree = $parser->get_tree();

	$parser->collapse_dups = 0;
$tree = $parser->get_tree();





	$admin_gid = '';
$group_count = 0;
foreach($tree['usergroups'][0]['usergroup'] as $usergroup)

	$admin_gid = '';
$group_count = 0;
foreach($tree['usergroups'][0]['usergroup'] as $usergroup)

Zeile 2000Zeile 2028
			{
continue;
}

			{
continue;
}

			



			$new_group[$key] = $db->escape_string($value[0]['value']);
}
$db->insert_query("usergroups", $new_group, false);

			$new_group[$key] = $db->escape_string($value[0]['value']);
}
$db->insert_query("usergroups", $new_group, false);

		



		// If this group can access the admin CP and we haven't established the admin group - set it (just in case we ever change IDs)
if($new_group['cancp'] == 1 && !$admin_gid)
{

		// If this group can access the admin CP and we haven't established the admin group - set it (just in case we ever change IDs)
if($new_group['cancp'] == 1 && !$admin_gid)
{

Zeile 2012Zeile 2040
		}
$group_count++;
}

		}
$group_count++;
}

 

// Restart usergroup sequence with correct # of groups
if($config['database']['type'] == "pgsql")
{
$db->query("SELECT setval('{$config['database']['table_prefix']}usergroups_gid_seq', (SELECT max(gid) FROM {$config['database']['table_prefix']}usergroups));");
}


	echo $lang->done . '</p>';

	echo $lang->done . '</p>';

	



	echo $lang->done_step_admincreated;
$now = TIME_NOW;
$salt = random_str();

	echo $lang->done_step_admincreated;
$now = TIME_NOW;
$salt = random_str();

Zeile 2075Zeile 2110
	$parser->collapse_dups = 0;
$tree = $parser->get_tree();
$insertmodule = array();

	$parser->collapse_dups = 0;
$tree = $parser->get_tree();
$insertmodule = array();

	



	$db->delete_query("adminoptions");

	$db->delete_query("adminoptions");

	



	// Insert all the admin permissions
foreach($tree['adminoptions'][0]['user'] as $users)

	// Insert all the admin permissions
foreach($tree['adminoptions'][0]['user'] as $users)

	{			

	{

		$uid = $users['attributes']['uid'];

		$uid = $users['attributes']['uid'];

		



		foreach($users['permissions'][0]['module'] as $module)
{
foreach($module['permission'] as $permission)

		foreach($users['permissions'][0]['module'] as $module)
{
foreach($module['permission'] as $permission)

Zeile 2096Zeile 2131
		{
$defaultviews[$view['attributes']['type']] = $view['value'];
}

		{
$defaultviews[$view['attributes']['type']] = $view['value'];
}

		



		$adminoptiondata = array(
'uid' => intval($uid),
'cpstyle' => '',

		$adminoptiondata = array(
'uid' => intval($uid),
'cpstyle' => '',

Zeile 2126Zeile 2161
	{
$db->create_fulltext_index('posts', 'message');
}

	{
$db->create_fulltext_index('posts', 'message');
}


// Register a shutdown function which actually tests if this functionality is working
add_shutdown('test_shutdown_function');

 

echo $lang->done_step_cachebuilding;
require_once MYBB_ROOT.'inc/class_datacache.php';


echo $lang->done_step_cachebuilding;
require_once MYBB_ROOT.'inc/class_datacache.php';

Zeile 2151Zeile 2183
	$cache->update_spiders();
$cache->update_bannedips();
$cache->update_banned();

	$cache->update_spiders();
$cache->update_bannedips();
$cache->update_banned();

 
	$cache->update_bannedemails();

	$cache->update_birthdays();
$cache->update_groupleaders();

	$cache->update_birthdays();
$cache->update_groupleaders();

 
	$cache->update_threadprefixes();
$cache->update_forumsdisplay();

	$cache->update("plugins", array());
$cache->update("internal_settings", array('encryption_key' => random_str(32)));

	$cache->update("plugins", array());
$cache->update("internal_settings", array('encryption_key' => random_str(32)));

	



	$version_history = array();
$dh = opendir(INSTALL_ROOT."resources");
while(($file = readdir($dh)) !== false)

	$version_history = array();
$dh = opendir(INSTALL_ROOT."resources");
while(($file = readdir($dh)) !== false)

	{

	{

		if(preg_match("#upgrade([0-9]+).php$#i", $file, $match))
{
$version_history[$match[1]] = $match[1];

		if(preg_match("#upgrade([0-9]+).php$#i", $file, $match))
{
$version_history[$match[1]] = $match[1];

Zeile 2167Zeile 2202
	}
sort($version_history, SORT_NUMERIC);
$cache->update("version_history", $version_history);

	}
sort($version_history, SORT_NUMERIC);
$cache->update("version_history", $version_history);

	



	echo $lang->done . '</p>';

echo $lang->done_step_success;

	echo $lang->done . '</p>';

echo $lang->done_step_success;

Zeile 2184Zeile 2219
		}
}
if(!$written)

		}
}
if(!$written)

	{

	{

		echo $lang->done_step_dirdelete;
}
echo $lang->done_subscribe_mailing;

		echo $lang->done_step_dirdelete;
}
echo $lang->done_subscribe_mailing;

Zeile 2208Zeile 2243
		default:
$db = new DB_MySQL;
}

		default:
$db = new DB_MySQL;
}

	



	// Connect to Database
define('TABLE_PREFIX', $config['database']['table_prefix']);

$db->connect($config['database']);
$db->set_table_prefix(TABLE_PREFIX);
$db->type = $config['database']['type'];

	// Connect to Database
define('TABLE_PREFIX', $config['database']['table_prefix']);

$db->connect($config['database']);
$db->set_table_prefix(TABLE_PREFIX);
$db->type = $config['database']['type'];

	



	return $db;

	return $db;

}


}


function error_list($array)

function error_list($array)

{

{

	$string = "<ul>\n";
foreach($array as $error)
{

	$string = "<ul>\n";
foreach($array as $error)
{

Zeile 2228Zeile 2263
	}
$string .= "</ul>\n";
return $string;

	}
$string .= "</ul>\n";
return $string;

}





}

function write_settings()
{
global $db;





function write_settings()
{
global $db;


 
	$query = $db->simple_select('settings', '*', '', array('order_by' => 'title'));
while($setting = $db->fetch_array($query))
{
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";

	$query = $db->simple_select('settings', '*', '', array('order_by' => 'title'));
while($setting = $db->fetch_array($query))
{
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";

	}

	}

	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

Zeile 2247Zeile 2282
		fwrite($file, $settings);
fclose($file);
}

		fwrite($file, $settings);
fclose($file);
}

}

function test_shutdown_function()
{
global $db;

$db->update_query("settings", array('value' => 1), "name='useshutdownfunc'");
write_settings();

 
}
?>

}
?>