Vergleich install/index.php - 1.8.2 - 1.8.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 56Zeile 56
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');

$lang->load('language');

 

// Load DB interface
require_once MYBB_ROOT."inc/db_base.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');

$displaygroupfields = array('title', 'description', 'namestyle', 'usertitle', 'stars', 'starimage', 'image');

$fpermfields = array('canview', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch');

$fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');


// Include the installation resources
require_once INSTALL_ROOT.'resources/output.php';


// Include the installation resources
require_once INSTALL_ROOT.'resources/output.php';

Zeile 92Zeile 95
		'title' => 'MySQL',
'short_title' => 'MySQL',
'structure_file' => 'mysql_db_tables.php',

		'title' => 'MySQL',
'short_title' => 'MySQL',
'structure_file' => 'mysql_db_tables.php',

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

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


if(function_exists('pg_connect'))


if(function_exists('pg_connect'))

{

{

	$dboptions['pgsql'] = array(
'class' => 'DB_PgSQL',
'title' => 'PostgreSQL',

	$dboptions['pgsql'] = array(
'class' => 'DB_PgSQL',
'title' => 'PostgreSQL',

Zeile 111Zeile 114
{
$supported_dbs = PDO::getAvailableDrivers();
if(in_array('sqlite', $supported_dbs))

{
$supported_dbs = PDO::getAvailableDrivers();
if(in_array('sqlite', $supported_dbs))

	{

	{

		$dboptions['sqlite'] = array(
'class' => 'DB_SQLite',
'title' => 'SQLite 3',

		$dboptions['sqlite'] = array(
'class' => 'DB_SQLite',
'title' => 'SQLite 3',

Zeile 127Zeile 130
	$output->print_error($lang->locked);
}
else if($installed == true && empty($mybb->input['action']))

	$output->print_error($lang->locked);
}
else if($installed == true && empty($mybb->input['action']))

{

{

	$output->print_header($lang->already_installed, "errormsg", 0);
echo $lang->sprintf($lang->mybb_already_installed, $mybb->version);
$output->print_footer();

	$output->print_header($lang->already_installed, "errormsg", 0);
echo $lang->sprintf($lang->mybb_already_installed, $mybb->version);
$output->print_footer();

Zeile 160Zeile 163
			break;
case 'create_tables':
create_tables();

			break;
case 'create_tables':
create_tables();

			break;

			break;

		case 'populate_tables':
populate_tables();
break;

		case 'populate_tables':
populate_tables();
break;

Zeile 183Zeile 186
	}
}


	}
}


 
/**
* Welcome page
*/

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();
if(strpos(strtolower(get_current_location('', '', true)), '/upload/') !== false)

	{
echo $lang->sprintf($lang->mybb_incorrect_folder);
}

	{
echo $lang->sprintf($lang->mybb_incorrect_folder);
}

Zeile 196Zeile 202
	$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 203Zeile 212
	ob_start();
$output->print_header($lang->license_agreement, 'license');


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


	if($mybb->get_input('allow_anonymous_info', 1) == 1)

	if($mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT) == 1)

	{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(1, '', $mybb->version_code);

	{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(1, '', $mybb->version_code);

Zeile 933Zeile 942
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.





  13. Use with the GNU Affero General Public License.

Notwithstanding any other provision of this License, you have

  13. Use with the GNU Affero General Public License.

Notwithstanding any other provision of this License, you have

Zeile 1010Zeile 1019
	$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 1030Zeile 1042
				$configstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;
}

				$configstatus = $lang->sprintf($lang->req_step_span_fail, $lang->not_writable);
$showerror = 1;
}

		}
}

		}
}


// Check PHP Version
if(version_compare(PHP_VERSION, '5.2.0', "<"))


// Check PHP Version
if(version_compare(PHP_VERSION, '5.2.0', "<"))

Zeile 1129Zeile 1141
	{
$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;

		$showerror = 1;

		@fclose($cachewritable);
}
else

		@fclose($cachewritable);
}
else

Zeile 1162Zeile 1174
	// 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);

		@fclose($avatarswritable);

	}
else
{

	}
else
{

Zeile 1195Zeile 1207
	}
}


	}
}


 
/**
* 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 1259Zeile 1274
		$db = new $dbtype['class'];
$encodings = $db->fetch_db_charsets();
$encoding_select = '';

		$db = new $dbtype['class'];
$encodings = $db->fetch_db_charsets();
$encoding_select = '';

		$mybb->input['config'] = $mybb->get_input('config', 2);

		$mybb->input['config'] = $mybb->get_input('config', MyBB::INPUT_ARRAY);

		if(empty($mybb->input['config'][$dbfile]['dbhost']))
{
$mybb->input['config'][$dbfile]['dbhost'] = "localhost";

		if(empty($mybb->input['config'][$dbfile]['dbhost']))
{
$mybb->input['config'][$dbfile]['dbhost'] = "localhost";

Zeile 1373Zeile 1388
	$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 1381Zeile 1399
	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;

		database_info();
}

$mybb->input['config'] = $mybb->get_input('config', 2);

		database_info();
}

$mybb->input['config'] = $mybb->get_input('config', MyBB::INPUT_ARRAY);

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

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

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

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

Zeile 1394Zeile 1412
			$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";
switch($mybb->input['dbengine'])

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

Zeile 1425Zeile 1443
	$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']);

		$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']))

	}
// 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, htmlspecialchars_uni($config['dbname']));

	}

// Most DB engines only allow certain characters in the table name. Oracle requires an alphabetic character first.

	}

// Most DB engines only allow certain characters in the table name. Oracle requires an alphabetic character first.

Zeile 1452Zeile 1470
	}

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'] = '".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 1475Zeile 1491
 *
* 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 1566Zeile 1582
	'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 1573Zeile 1620
	$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 1595Zeile 1647
		$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($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]);
}

Zeile 1610Zeile 1662
	$output->print_footer('populate_tables');
}


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


 
/**
* Insert our default data
*/

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

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

Zeile 1623Zeile 1678
	if(!empty($dboptions[$db->type]['population_file']))
{
$population_file = $dboptions[$db->type]['population_file'];

	if(!empty($dboptions[$db->type]['population_file']))
{
$population_file = $dboptions[$db->type]['population_file'];

	}
else

	}
else

	{
$population_file = 'mysql_db_inserts.php';

	{
$population_file = 'mysql_db_inserts.php';

	}


	}


	require_once INSTALL_ROOT."resources/{$population_file}";
foreach($inserts as $val)
{
$val = preg_replace('#mybb_(\S+?)([\s\.,]|$)#', $config['database']['table_prefix'].'\\1\\2', $val);
$db->query($val);

	require_once INSTALL_ROOT."resources/{$population_file}";
foreach($inserts as $val)
{
$val = preg_replace('#mybb_(\S+?)([\s\.,]|$)#', $config['database']['table_prefix'].'\\1\\2', $val);
$db->query($val);

	}


	}


	// Update the sequences for PgSQL
if($config['database']['type'] == "pgsql")
{

	// Update the sequences for PgSQL
if($config['database']['type'] == "pgsql")
{

Zeile 1652Zeile 1707

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


echo $lang->populate_step_inserted;
$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 1738Zeile 1796
					"lastmodified" => TIME_NOW,
"cachefile" => $db->escape_string($stylesheet['attributes']['name'])
);

					"lastmodified" => TIME_NOW,
"cachefile" => $db->escape_string($stylesheet['attributes']['name'])
);





				$sid = $db->insert_query("themestylesheets", $new_stylesheet);
$css_url = "css.php?stylesheet={$sid}";

				$sid = $db->insert_query("themestylesheets", $new_stylesheet);
$css_url = "css.php?stylesheet={$sid}";





				$cached = cache_stylesheet($tid, $stylesheet['attributes']['name'], $stylesheet['value']);

if($cached)

				$cached = cache_stylesheet($tid, $stylesheet['attributes']['name'], $stylesheet['value']);

if($cached)

Zeile 1758Zeile 1816
		}
}


		}
}


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

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


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



echo $lang->theme_step_imported;
$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 1781Zeile 1842
				{
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 1823Zeile 1884
	{
$bbname = 'Forums';
$cookiedomain = '';

	{
$bbname = 'Forums';
$cookiedomain = '';

		$cookiepath = '/';

 
		$websitename = 'Your Website';

		$websitename = 'Your Website';

		$contactemail = '';

 

$protocol = "http://";
if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off"))


$protocol = "http://";
if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off"))

Zeile 1834Zeile 1893
		}

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


		if(substr($cookiedomain, 0, 4) == "www.")

		if(my_substr($cookiedomain, 0, 4) == "www.")

		{

		{

			$cookiedomain = my_substr($cookiedomain, 4);

			$cookiedomain = substr($cookiedomain, 4);

		}

// IP addresses and hostnames are not valid

		}

// IP addresses and hostnames are not valid

Zeile 1860Zeile 1919
			$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'];
}
$websiteurl = $hostname.'/';

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






		$currentlocation = get_current_location();
if($currentlocation)
{
// TODO: Change this to find the last position of /install/
$pos = my_strpos($currentlocation, '/install/');
if($pos === 0)
{
$cookiepath = "/";
}
else

			if($pos !== false)










			{

			{

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

				$cookiedomain = substr($cookiedomain, 0, $pos);

			}

			}

		}

$currentscript = $hostname.get_current_location();

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

if($_SERVER['SERVER_ADMIN'])







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/'));

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

if(isset($_SERVER['SERVER_ADMIN']) && filter_var($_SERVER['SERVER_ADMIN'], FILTER_VALIDATE_EMAIL))

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

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

Zeile 1897Zeile 1951
	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 1905Zeile 1962
	$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))

	{

	{

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

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

		}

		}

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

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

		}

		}

		if(is_array($errors))
{
configure();

		if(is_array($errors))
{
configure();

		}

		}

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

	}
$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 1938Zeile 1995
			}
}
</script>

			}
}
</script>

		



EOF;

if(is_array($errors))

EOF;

if(is_array($errors))

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

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





		// Insert scheduled tasks
foreach($tree['tasks'][0]['task'] as $task)
{

		// Insert scheduled tasks
foreach($tree['tasks'][0]['task'] as $task)
{

Zeile 2108Zeile 2165
				"type" => $db->escape_string($view['attributes']['type']),
"visibility" => (int)$view['attributes']['visibility'],
"title" => $db->escape_string($view['title'][0]['value']),

				"type" => $db->escape_string($view['attributes']['type']),
"visibility" => (int)$view['attributes']['visibility'],
"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)),

				"fields" => $db->escape_string(my_serialize($fields)),
"conditions" => $db->escape_string(my_serialize($conditions)),
"custom_profile_fields" => $db->escape_string(my_serialize($custom_profile_fields)),

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

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

Zeile 2129Zeile 2186
	$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 2234Zeile 2294
		'receivepms' => 1,
'pmnotice' => 1,
'pmnotify' => 1,

		'receivepms' => 1,
'pmnotice' => 1,
'pmnotify' => 1,

 
		'buddyrequestspm' => 1,
'buddyrequestsauto' => 0,

		'showimages' => 1,
'showvideos' => 1,
'showsigs' => 1,

		'showimages' => 1,
'showvideos' => 1,
'showsigs' => 1,

Zeile 2293Zeile 2355
			'uid' => (int)$uid,
'cpstyle' => '',
'notes' => '',

			'uid' => (int)$uid,
'cpstyle' => '',
'notes' => '',

			'permissions' => $db->escape_string(serialize($insertmodule)),
'defaultviews' => $db->escape_string(serialize($defaultviews))

			'permissions' => $db->escape_string(my_serialize($insertmodule)),
'defaultviews' => $db->escape_string(my_serialize($defaultviews))

		);

$insertmodule = array();

		);

$insertmodule = array();

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

	$cache->update("plugins", array());
$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 2392Zeile 2455
	$output->print_footer('');
}


	$output->print_footer('');
}


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

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 "sqlite":
$db = new DB_SQLite;
break;

Zeile 2416Zeile 2484
	$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 2431Zeile 2504
	return $string;
}


	return $string;
}


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

function write_settings()
{
global $db;

function write_settings()
{
global $db;

Zeile 2450Zeile 2526
		fclose($file);
}
}

		fclose($file);
}
}

?>