Vergleich install/index.php - 1.8.5 - 1.8.34

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 52Zeile 52
	}
}


	}
}


require_once MYBB_ROOT.'inc/class_xml.php';

 
require_once MYBB_ROOT.'inc/functions_user.php';
require_once MYBB_ROOT.'inc/class_language.php';
$lang = new MyLanguage();

require_once MYBB_ROOT.'inc/functions_user.php';
require_once MYBB_ROOT.'inc/class_language.php';
$lang = new MyLanguage();

$lang->set_path(MYBB_ROOT.'install/resources');

$lang->set_path(INSTALL_ROOT.'resources');

$lang->load('language');

// Load DB interface
require_once MYBB_ROOT."inc/db_base.php";

$lang->load('language');

// Load DB interface
require_once MYBB_ROOT."inc/db_base.php";

 
require_once MYBB_ROOT."inc/AbstractPdoDbDriver.php";


// Prevent any shut down functions from running
$done_shutdown = 1;



// Prevent any shut down functions from running
$done_shutdown = 1;


// Include the necessary contants for installation

// Include the necessary constants for installation

$grouppermignore = array('gid', 'type', 'title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image');

$grouppermignore = array('gid', 'type', 'title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image');

$groupzerogreater = array('pmquota', 'maxpmrecipients', 'maxreputationsday', 'attachquota', 'maxemails', 'maxwarningsday', 'maxposts', 'edittimelimit', 'canusesigxposts', 'maxreputationsperthread');

$groupzerogreater = array('pmquota', 'maxpmrecipients', 'maxreputationsday', 'attachquota', 'maxemails', 'maxwarningsday', 'maxposts', 'edittimelimit', 'canusesigxposts', 'maxreputationsperuser', 'maxreputationsperthread', 'emailfloodtime');

$displaygroupfields = array('title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image');
$fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');


$displaygroupfields = array('title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image');
$fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');


Zeile 106Zeile 106
		'title' => 'PostgreSQL',
'short_title' => 'PostgreSQL',
'structure_file' => 'pgsql_db_tables.php',

		'title' => 'PostgreSQL',
'short_title' => 'PostgreSQL',
'structure_file' => 'pgsql_db_tables.php',

		'population_file' => 'mysql_db_inserts.php'

		'population_file' => 'pgsql_db_inserts.php'

	);
}


	);
}


Zeile 120Zeile 120
			'title' => 'SQLite 3',
'short_title' => 'SQLite',
'structure_file' => 'sqlite_db_tables.php',

			'title' => 'SQLite 3',
'short_title' => 'SQLite',
'structure_file' => 'sqlite_db_tables.php',

 
			'population_file' => 'pgsql_db_inserts.php'
);
}

if (in_array('pgsql', $supported_dbs)) {
$dboptions['pgsql_pdo'] = array(
'class' => 'PostgresPdoDbDriver',
'title' => 'PostgreSQL (PDO)',
'short_title' => 'PostgreSQL (PDO)',
'structure_file' => 'pgsql_db_tables.php',
'population_file' => 'pgsql_db_inserts.php'
);
}

if (in_array('mysql', $supported_dbs)) {
$dboptions['mysql_pdo'] = array(
'class' => 'MysqlPdoDbDriver',
'title' => 'MySQL (PDO)',
'short_title' => 'MySQL (PDO)',
'structure_file' => 'mysql_db_tables.php',

			'population_file' => 'mysql_db_inserts.php'
);
}

			'population_file' => 'mysql_db_inserts.php'
);
}

Zeile 128Zeile 148
if(file_exists('lock') && $mybb->dev_mode != true)
{
$output->print_error($lang->locked);

if(file_exists('lock') && $mybb->dev_mode != true)
{
$output->print_error($lang->locked);

}

}

else if($installed == true && empty($mybb->input['action']))
{
$output->print_header($lang->already_installed, "errormsg", 0);

else if($installed == true && empty($mybb->input['action']))
{
$output->print_header($lang->already_installed, "errormsg", 0);

Zeile 151Zeile 171
	);

switch($mybb->get_input('action'))

	);

switch($mybb->get_input('action'))

	{

	{

		case 'license':
license_agreement();

		case 'license':
license_agreement();

			break;

			break;

		case 'requirements_check':
requirements_check();

		case 'requirements_check':
requirements_check();

			break;

			break;

		case 'database_info':
database_info();
break;
case 'create_tables':
create_tables();

		case 'database_info':
database_info();
break;
case 'create_tables':
create_tables();

			break;

			break;

		case 'populate_tables':
populate_tables();
break;

		case 'populate_tables':
populate_tables();
break;

Zeile 186Zeile 206
	}
}


	}
}


 
/**
* Welcome page
*/

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


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


	$output->print_header($lang->welcome, 'welcome');

	$output->print_header();

	if(strpos(strtolower(get_current_location('', '', true)), '/upload/') !== false)
{
echo $lang->sprintf($lang->mybb_incorrect_folder);

	if(strpos(strtolower(get_current_location('', '', true)), '/upload/') !== false)
{
echo $lang->sprintf($lang->mybb_incorrect_folder);

Zeile 199Zeile 222
	$output->print_footer('license');
}


	$output->print_footer('license');
}


 
/**
* Show the license agreement
*/

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

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

Zeile 954Zeile 980
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.





  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the

Zeile 1013Zeile 1039
	$output->print_footer('requirements_check');
}


	$output->print_footer('requirements_check');
}


 
/**
* Check our requirements
*/

function requirements_check()
{
global $output, $mybb, $dboptions, $lang;

function requirements_check()
{
global $output, $mybb, $dboptions, $lang;

Zeile 1091Zeile 1120
	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_xmlsupport);
$xmlstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_installed);

	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_xmlsupport);
$xmlstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_installed);

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

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

	}

// Check config file is writable

	}

// Check config file is writable

Zeile 1104Zeile 1133
	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_configfile);
$configstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);

	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_configfile);
$configstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);

		$showerror = 1;

		$showerror = 1;

	}
else
{
$configstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);

	}
else
{
$configstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);

	}
@fclose($configwritable);

		@fclose($configwritable);
}


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


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

Zeile 1119Zeile 1148
		$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_settingsfile);
$settingsstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;

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

	}

	}

	else
{
$settingsstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);

	else
{
$settingsstatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);

 
		@fclose($settingswritable);

	}

	}

	@fclose($settingswritable);

 

// Check cache directory is writable
$cachewritable = @fopen(MYBB_ROOT.'cache/test.write', 'w');


// Check cache directory is writable
$cachewritable = @fopen(MYBB_ROOT.'cache/test.write', 'w');

Zeile 1132Zeile 1161
	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_cachedir);
$cachestatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);

	{
$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_cachedir);
$cachestatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);

		$showerror = 1;
@fclose($cachewritable);

		$showerror = 1;


	}
else

	}
else

	{

	{

		$cachestatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);
@fclose($cachewritable);
@my_chmod(MYBB_ROOT.'cache', '0777');

		$cachestatus = $lang->sprintf($lang->req_step_span_pass, $lang->writable);
@fclose($cachewritable);
@my_chmod(MYBB_ROOT.'cache', '0777');

Zeile 1151Zeile 1179
		$errors[] = $lang->sprintf($lang->req_step_error_box, $lang->req_step_error_uploaddir);
$uploadsstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;

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

		@fclose($uploadswritable);

 
	}
else
{

	}
else
{

Zeile 1169Zeile 1196
		$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
{

	}
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 1190Zeile 1216
		echo "\n			<input type=\"hidden\" name=\"action\" value=\"{$mybb->input['action']}\" />";
echo "\n <div id=\"next_button\"><input type=\"submit\" class=\"submit_button\" value=\"{$lang->recheck} &raquo;\" /></div><br style=\"clear: both;\" />\n";
$output->print_footer();

		echo "\n			<input type=\"hidden\" name=\"action\" value=\"{$mybb->input['action']}\" />";
echo "\n <div id=\"next_button\"><input type=\"submit\" class=\"submit_button\" value=\"{$lang->recheck} &raquo;\" /></div><br style=\"clear: both;\" />\n";
$output->print_footer();

	}

	}

	else
{
echo $lang->req_step_reqcomplete;

	else
{
echo $lang->req_step_reqcomplete;

Zeile 1198Zeile 1224
	}
}


	}
}


 
/**
* Which database do we use?
*/

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

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

Zeile 1238Zeile 1267
	else
{
echo $lang->db_step_config_db;

	else
{
echo $lang->db_step_config_db;

	}

	}


$dbengines = '';



$dbengines = '';


Zeile 1307Zeile 1336

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


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

		{
$db_info[$dbfile] .= "

		{
$db_info[$dbfile] .= "

				<tr class=\"alt_row\">
<td class=\"first\"><label for=\"config_{$dbfile}_dbname\">{$lang->database_path}</label></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"config[{$dbfile}][dbname]\" id=\"config_{$dbfile}_dbname\" value=\"".htmlspecialchars_uni($mybb->input['config'][$dbfile]['dbname'])."\" /></td>

				<tr class=\"alt_row\">
<td class=\"first\"><label for=\"config_{$dbfile}_dbname\">{$lang->database_path}</label></td>
<td class=\"last alt_col\"><input type=\"text\" class=\"text_input\" name=\"config[{$dbfile}][dbname]\" id=\"config_{$dbfile}_dbname\" value=\"".htmlspecialchars_uni($mybb->input['config'][$dbfile]['dbname'])."\" /></td>

Zeile 1376Zeile 1405
	$output->print_footer('create_tables');
}


	$output->print_footer('create_tables');
}


 
/**
* Create our tables
*/

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

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

Zeile 1408Zeile 1440
			break;
case "pgsql":
$db = new DB_PgSQL;

			break;
case "pgsql":
$db = new DB_PgSQL;

 
			break;
case "pgsql_pdo":
$db = new PostgresPdoDbDriver();

			break;
case "mysqli":
$db = new DB_MySQLi;

			break;
case "mysqli":
$db = new DB_MySQLi;

 
			break;
case "mysql_pdo":
$db = new MysqlPdoDbDriver();

			break;
default:
$db = new DB_MySQL;
}
$db->error_reporting = 0;

			break;
default:
$db = new DB_MySQL;
}
$db->error_reporting = 0;

 

if(!isset($config['encoding']))
{
$config['encoding'] = null;
}


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


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

Zeile 1424Zeile 1467
		"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)
{

		$errors[] = $lang->sprintf($lang->db_step_error_noconnect, $config['dbhost']);
}
// 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_noconnect, htmlspecialchars_uni($config['dbhost']));
}
// 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, htmlspecialchars_uni($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'] != '')

	}

// 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;
}


		$errors[] = $lang->db_step_error_invalid_tableprefix;
}


Zeile 1447Zeile 1490
	if(strlen($config['tableprefix']) > 40)
{
$errors[] = $lang->db_step_error_tableprefix_too_long;

	if(strlen($config['tableprefix']) > 40)
{
$errors[] = $lang->db_step_error_tableprefix_too_long;

	}

if(($db->engine == 'mysql' || $db->engine == 'mysqli') && $config['encoding'] == 'utf8mb4' && version_compare($db->get_version(), '5.5.3', '<'))
{

	}

if($connection !== false && ($db->engine == 'mysql' || $db->engine == 'mysqli') && $config['encoding'] == 'utf8mb4' && version_compare($db->get_version(), '5.5.3', '<'))
{

		$errors[] = $lang->db_step_error_utf8mb4_error;
}

if(is_array($errors))

		$errors[] = $lang->db_step_error_utf8mb4_error;
}

if(is_array($errors))

	{

	{

		database_info();
}

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

		database_info();
}

// 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'] = '".addcslashes($config['encoding'], "'")."';";

	}
else
{

	}
else
{

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

		$db_encoding = "// \$config['database']['encoding'] = '".addcslashes($config['encoding'], "'")."';";

	}

	}


$config['dbpass'] = addslashes($config['dbpass']);

 

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


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

Zeile 1478Zeile 1519
 *
* Please see the MyBB Docs for advanced
* database configuration for larger installations

 *
* Please see the MyBB Docs for advanced
* database configuration for larger installations

 * http://docs.mybb.com/

 * https://docs.mybb.com/

 */


 */


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

\$config['database']['type'] = '".addcslashes($mybb->input['dbengine'], "'")."';
\$config['database']['database'] = '".addcslashes($config['dbname'], "'")."';
\$config['database']['table_prefix'] = '".addcslashes($config['tableprefix'], "'")."';





\$config['database']['hostname'] = '{$config['dbhost']}';
\$config['database']['username'] = '{$config['dbuser']}';
\$config['database']['password'] = '{$config['dbpass']}';

\$config['database']['hostname'] = '".addcslashes($config['dbhost'], "'")."';
\$config['database']['username'] = '".addcslashes($config['dbuser'], "'")."';
\$config['database']['password'] = '".addcslashes($config['dbpass'], "'")."';


/**
* Admin CP directory


/**
* Admin CP directory

Zeile 1495Zeile 1536
 *  rename your Admin CP directory. You then need
* to adjust the value below to point to the
* new directory.

 *  rename your Admin CP directory. You then need
* to adjust the value below to point to the
* new directory.

 */

 */


\$config['admin_dir'] = 'admin';



\$config['admin_dir'] = 'admin';


Zeile 1505Zeile 1546
 *  on the front end of the board after
* renaming your Admin CP directory, set this
* to 1.

 *  on the front end of the board after
* renaming your Admin CP directory, set this
* to 1.

 */

\$config['hide_admin_links'] = 0;


 */

\$config['hide_admin_links'] = 0;


/**
* Data-cache configuration
* The data cache is a temporary cache
* of the most commonly accessed data in MyBB.
* By default, the database is used to store this data.

/**
* Data-cache configuration
* The data cache is a temporary cache
* of the most commonly accessed data in MyBB.
* By default, the database is used to store this data.

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

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

 *
* If you wish to use the file system (cache/ directory), MemCache (or MemCached), xcache, APC, APCu, eAccelerator or Redis
* you can change the value below to 'files', 'memcache', 'memcached', 'xcache', 'apc', 'apcu', 'eaccelerator' or 'redis' from 'db'.
*/

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


/**
* Memcache configuration


/**
* Memcache configuration

Zeile 1532Zeile 1573

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


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

 

/**
* Redis configuration
* If you are using Redis as your data-cache
* you need to configure the hostname and port
* of your redis server below. If you want
* to connect via unix sockets, use the full
* path to the unix socket as host and leave
* the port setting unconfigured or false.
*/

\$config['redis']['host'] = 'localhost';
\$config['redis']['port'] = 6379;


/**
* Super Administrators


/**
* Super Administrators

Zeile 1569Zeile 1623
	'mail_logs' => 180, // Mail error logs
'user_mail_logs' => 180, // User mail logs
'promotion_logs' => 180 // Promotion logs

	'mail_logs' => 180, // Mail error logs
'user_mail_logs' => 180, // User mail logs
'promotion_logs' => 180 // Promotion logs

 
);

/**
* Disallowed Remote Hosts
* List of hosts the fetch_remote_file() function will not
* perform requests to.
* It is recommended that you enter hosts resolving to the
* forum server here to prevent Server Side Request
* Forgery attacks.
*/

\$config['disallowed_remote_hosts'] = array(
'localhost',
);

/**
* Disallowed Remote Addresses
* List of IPv4 addresses the fetch_remote_file() function
* will not perform requests to.
* It is recommended that you enter addresses resolving to
* the forum server here to prevent Server Side Request
* Forgery attacks.
* Removing all values disables resolving hosts in that
* function.
*/

\$config['disallowed_remote_addresses'] = array(
'127.0.0.1',
'10.0.0.0/8',
'172.16.0.0/12',
'192.168.0.0/16',

);

";

);

";

Zeile 1576Zeile 1661
	$file = fopen(MYBB_ROOT.'inc/config.php', 'w');
fwrite($file, $configdata);
fclose($file);

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

 

if(function_exists('opcache_invalidate'))
{
opcache_invalidate(MYBB_ROOT."inc/config.php");
}


// Error reporting back on
$db->error_reporting = 1;


// Error reporting back on
$db->error_reporting = 1;

Zeile 1584Zeile 1674
	echo $lang->sprintf($lang->tablecreate_step_connected, $dboptions[$mybb->input['dbengine']]['short_title'], $db->get_version());

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

	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'];
}
else

		$structure_file = $dboptions[$mybb->input['dbengine']]['structure_file'];
}
else

	{

	{

		$structure_file = 'mysql_db_tables.php';
}


		$structure_file = 'mysql_db_tables.php';
}


Zeile 1598Zeile 1688
		$val = preg_replace('#mybb_(\S+?)([\s\.,\(]|$)#', $config['tableprefix'].'\\1\\2', $val);
$val = preg_replace('#;$#', $db->build_create_table_collation().";", $val);
preg_match('#CREATE TABLE (\S+)(\s?|\(?)\(#i', $val, $match);

		$val = preg_replace('#mybb_(\S+?)([\s\.,\(]|$)#', $config['tableprefix'].'\\1\\2', $val);
$val = preg_replace('#;$#', $db->build_create_table_collation().";", $val);
preg_match('#CREATE TABLE (\S+)(\s?|\(?)\(#i', $val, $match);

		if($match[1])
{

		if(!empty($match[1]))
{

			$db->drop_table($match[1], false, false);
echo $lang->sprintf($lang->tablecreate_step_created, $match[1]);

			$db->drop_table($match[1], false, false);
echo $lang->sprintf($lang->tablecreate_step_created, $match[1]);

		}

		}

		$db->query($val);

		$db->query($val);

		if($match[1])

		if(!empty($match[1]))

		{
echo $lang->done . "<br />\n";
}

		{
echo $lang->done . "<br />\n";
}

Zeile 1613Zeile 1703
	$output->print_footer('populate_tables');
}


	$output->print_footer('populate_tables');
}


 
/**
* Insert our default data
*/

function populate_tables()
{

function populate_tables()
{

	global $output, $lang;

	global $output, $lang, $dboptions;


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


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

Zeile 1657Zeile 1750
	$output->print_footer('templates');
}


	$output->print_footer('templates');
}


 
/**
* Install our theme
*/

function insert_templates()
{
global $mybb, $output, $cache, $db, $lang;

function insert_templates()
{
global $mybb, $output, $cache, $db, $lang;

Zeile 1712Zeile 1808
	// 1.8: Stylesheet Colors
$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme_colors.xml');


	// 1.8: Stylesheet Colors
$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme_colors.xml');


	require_once MYBB_ROOT."inc/class_xml.php";
$parser = new XMLParser($contents);

	$parser = create_xml_parser($contents);


	$tree = $parser->get_tree();

	$tree = $parser->get_tree();





	if(is_array($tree) && is_array($tree['colors']))
{
if(is_array($tree['colors']['scheme']))

	if(is_array($tree) && is_array($tree['colors']))
{
if(is_array($tree['colors']['scheme']))

Zeile 1767Zeile 1862
	$output->print_footer('configuration');
}


	$output->print_footer('configuration');
}


 
/**
* Default configuration
*/

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

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

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

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

	



	echo <<<EOF

	echo <<<EOF

		<script type="text/javascript">	

		<script type="text/javascript">

		function warnUser(inp, warn)
{
var parenttr = $('#'+inp.id).closest('tr');

		function warnUser(inp, warn)
{
var parenttr = $('#'+inp.id).closest('tr');

Zeile 1784Zeile 1882
				{
var revertlink = ' <a href="javascript:revertSetting(\''+inp.defaultValue+'\', \'#'+inp.id+'\');">{$lang->config_step_revert}</a>';
parenttr.removeClass('last').after('<tr class="setting_peeker"><td colspan="2">'+warn+revertlink+'</td></tr>');

				{
var revertlink = ' <a href="javascript:revertSetting(\''+inp.defaultValue+'\', \'#'+inp.id+'\');">{$lang->config_step_revert}</a>';
parenttr.removeClass('last').after('<tr class="setting_peeker"><td colspan="2">'+warn+revertlink+'</td></tr>');

				}

				}

			} else {
parenttr.next('.setting_peeker').remove();
if(parenttr.is(':last-child'))
{
parenttr.addClass('last');
}

			} else {
parenttr.next('.setting_peeker').remove();
if(parenttr.is(':last-child'))
{
parenttr.addClass('last');
}

			}

			}

		}

		}

			



		function revertSetting(defval, inpid)
{

		function revertSetting(defval, inpid)
{

			$(inpid).val(defval);			

			$(inpid).val(defval);

			var parenttr = $(inpid).closest('tr');
parenttr.next('.setting_peeker').remove();
if(parenttr.is(':last-child'))
{
parenttr.addClass('last');

			var parenttr = $(inpid).closest('tr');
parenttr.next('.setting_peeker').remove();
if(parenttr.is(':last-child'))
{
parenttr.addClass('last');

			}			

			}

		}
</script>

		}
</script>

		



EOF;

// If board configuration errors

EOF;

// If board configuration errors

Zeile 1835Zeile 1933
		}

// Attempt auto-detection

		}

// Attempt auto-detection

		if($_SERVER['HTTP_HOST'])

		if(!empty($_SERVER['HTTP_HOST']))

		{
$hostname = $protocol.$_SERVER['HTTP_HOST'];
$cookiedomain = $_SERVER['HTTP_HOST'];
}

		{
$hostname = $protocol.$_SERVER['HTTP_HOST'];
$cookiedomain = $_SERVER['HTTP_HOST'];
}

		elseif($_SERVER['SERVER_NAME'])

		elseif(!empty($_SERVER['SERVER_NAME']))

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

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

Zeile 1861Zeile 1959
			$cookiedomain = ".{$cookiedomain}";
}


			$cookiedomain = ".{$cookiedomain}";
}


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

		if(!empty($_SERVER['SERVER_PORT']))

		{

		{

			$hostname .= ':'.$_SERVER['SERVER_PORT'];












			$port = ":{$_SERVER['SERVER_PORT']}";
$pos = strrpos($cookiedomain, $port);

if($pos !== false)
{
$cookiedomain = substr($cookiedomain, 0, $pos);
}

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

		}

		}

		



		$currentlocation = get_current_location('', '', true);
$noinstall = substr($currentlocation, 0, strrpos($currentlocation, '/install/'));

		$currentlocation = get_current_location('', '', true);
$noinstall = substr($currentlocation, 0, strrpos($currentlocation, '/install/'));

		



		$cookiepath = $noinstall.'/';
$bburl = $hostname.$noinstall;
$websiteurl = $hostname.'/';

		$cookiepath = $noinstall.'/';
$bburl = $hostname.$noinstall;
$websiteurl = $hostname.'/';

		$contactemail = $_SERVER['SERVER_ADMIN'];
}










if(isset($_SERVER['SERVER_ADMIN']) && filter_var($_SERVER['SERVER_ADMIN'], FILTER_VALIDATE_EMAIL))
{
$contactemail = $_SERVER['SERVER_ADMIN'];
}
else
{
$contactemail = null;
}
}


echo $lang->sprintf($lang->config_step_table, $bbname, $bburl, $websitename, $websiteurl, $cookiedomain, $cookiepath, $contactemail);
$output->print_footer('adminuser');
}


echo $lang->sprintf($lang->config_step_table, $bbname, $bburl, $websitename, $websiteurl, $cookiedomain, $cookiepath, $contactemail);
$output->print_footer('adminuser');
}







/**
* How do we want to name the admin user?
*/

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

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

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

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

		{

		{

			configure();
}
}
$output->print_header($lang->create_admin, 'admin');

			configure();
}
}
$output->print_header($lang->create_admin, 'admin');

	



	echo <<<EOF

	echo <<<EOF

		<script type="text/javascript">	

		<script type="text/javascript">

		function comparePass()
{
var parenttr = $('#adminpass2').closest('tr');

		function comparePass()
{
var parenttr = $('#adminpass2').closest('tr');

Zeile 1919Zeile 2039
			}
}
</script>

			}
}
</script>

		



EOF;

if(is_array($errors))

EOF;

if(is_array($errors))

Zeile 1938Zeile 2058
		$adminuser = $adminemail = '';

$settings = file_get_contents(INSTALL_ROOT.'resources/settings.xml');

		$adminuser = $adminemail = '';

$settings = file_get_contents(INSTALL_ROOT.'resources/settings.xml');

		$parser = new XMLParser($settings);

		$parser = create_xml_parser($settings);

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

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

Zeile 2009Zeile 2129

include_once MYBB_ROOT."inc/functions_task.php";
$tasks = file_get_contents(INSTALL_ROOT.'resources/tasks.xml');


include_once MYBB_ROOT."inc/functions_task.php";
$tasks = file_get_contents(INSTALL_ROOT.'resources/tasks.xml');

		$parser = new XMLParser($tasks);

		$parser = create_xml_parser($tasks);

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

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

Zeile 2047Zeile 2167
		echo $lang->sprintf($lang->admin_step_insertedtasks, $taskcount);

$views = file_get_contents(INSTALL_ROOT.'resources/adminviews.xml');

		echo $lang->sprintf($lang->admin_step_insertedtasks, $taskcount);

$views = file_get_contents(INSTALL_ROOT.'resources/adminviews.xml');

		$parser = new XMLParser($views);

		$parser = create_xml_parser($views);

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

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

Zeile 2110Zeile 2230
	$output->print_footer('final');
}


	$output->print_footer('final');
}


 
/**
* Installation is finished
*/

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

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

Zeile 2148Zeile 2271

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


// 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 = create_xml_parser($usergroup_settings);

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


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


Zeile 2203Zeile 2326
		'lastvisit' => $now,
'website' => '',
'icq' => '',

		'lastvisit' => $now,
'website' => '',
'icq' => '',

		'aim' => '',
'yahoo' => '',

 
		'skype' =>'',
'google' =>'',
'birthday' => '',

		'skype' =>'',
'google' =>'',
'birthday' => '',

Zeile 2236Zeile 2357
		'referrer' => 0,
'buddylist' => '',
'ignorelist' => '',

		'referrer' => 0,
'buddylist' => '',
'ignorelist' => '',

		'pmfolders' => '',

		'pmfolders' => "0**$%%$1**$%%$2**$%%$3**$%%$4**",

		'notepad' => '',
'showredirect' => 1,
'usernotes' => ''

		'notepad' => '',
'showredirect' => 1,
'usernotes' => ''

Zeile 2246Zeile 2367

echo $lang->done_step_adminoptions;
$adminoptions = file_get_contents(INSTALL_ROOT.'resources/adminoptions.xml');


echo $lang->done_step_adminoptions;
$adminoptions = file_get_contents(INSTALL_ROOT.'resources/adminoptions.xml');

	$parser = new XMLParser($adminoptions);

	$parser = create_xml_parser($adminoptions);

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

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

Zeile 2289Zeile 2410
	// Automatic Login
my_unsetcookie("sid");
my_unsetcookie("mybbuser");

	// Automatic Login
my_unsetcookie("sid");
my_unsetcookie("mybbuser");

	my_setcookie('mybbuser', $uid.'_'.$loginkey, null, true);

	my_setcookie('mybbuser', $uid.'_'.$loginkey, null, true, "lax");

	ob_end_flush();

// Make fulltext columns if supported

	ob_end_flush();

// Make fulltext columns if supported

Zeile 2323Zeile 2444
	$cache->update_posticons();
$cache->update_spiders();
$cache->update_bannedips();

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

	$cache->update_banned();

 
	$cache->update_bannedemails();
$cache->update_birthdays();
$cache->update_groupleaders();
$cache->update_threadprefixes();
$cache->update_forumsdisplay();
$cache->update("plugins", array());

	$cache->update_bannedemails();
$cache->update_birthdays();
$cache->update_groupleaders();
$cache->update_threadprefixes();
$cache->update_forumsdisplay();
$cache->update("plugins", array());

 
	$cache->update("mostonline", array(
'numusers' => 0,
'time' => 0,
));

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

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

 
	$cache->update_reportreasons(true);


$version_history = array();
$dh = opendir(INSTALL_ROOT."resources");


$version_history = array();
$dh = opendir(INSTALL_ROOT."resources");

Zeile 2375Zeile 2500
	$output->print_footer('');
}


	$output->print_footer('');
}


 
/**
* @param array $config
*
* @return DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite|PostgresPdoDbDriver|MysqlPdoDbDriver
*/

function db_connection($config)
{
require_once MYBB_ROOT."inc/db_{$config['database']['type']}.php";
switch($config['database']['type'])

function db_connection($config)
{
require_once MYBB_ROOT."inc/db_{$config['database']['type']}.php";
switch($config['database']['type'])

	{

	{

		case "sqlite":
$db = new DB_SQLite;
break;
case "pgsql":
$db = new DB_PgSQL;

		case "sqlite":
$db = new DB_SQLite;
break;
case "pgsql":
$db = new DB_PgSQL;

 
			break;
case "pgsql_pdo":
$db = new PostgresPdoDbDriver();

			break;
case "mysqli":
$db = new DB_MySQLi;

			break;
case "mysqli":
$db = new DB_MySQLi;

 
			break;
case "mysql_pdo":
$db = new MysqlPdoDbDriver();

			break;
default:
$db = new DB_MySQL;

			break;
default:
$db = new DB_MySQL;

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

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





	return $db;
}


	return $db;
}


 
/**
* @param array $array
*
* @return string
*/

function error_list($array)
{
$string = "<ul>\n";

function error_list($array)
{
$string = "<ul>\n";

Zeile 2414Zeile 2555
	return $string;
}


	return $string;
}


 
/**
* Write our settings to the settings file
*/

function write_settings()
{
global $db;

function write_settings()
{
global $db;

Zeile 2422Zeile 2566
	$query = $db->simple_select('settings', '*', '', array('order_by' => 'title'));
while($setting = $db->fetch_array($query))
{

	$query = $db->simple_select('settings', '*', '', array('order_by' => 'title'));
while($setting = $db->fetch_array($query))
{

		$setting['value'] = str_replace("\"", "\\\"", $setting['value']);


		$setting['name'] = addcslashes($setting['name'], "\\'");
$setting['value'] = addcslashes($setting['value'], '\\"$');

		$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}
if(!empty($settings))

		$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}
if(!empty($settings))