Vergleich install/upgrade.php - 1.8.15 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 47Zeile 47

// Include the files necessary for installation
require_once MYBB_ROOT."inc/class_timers.php";


// Include the files necessary for installation
require_once MYBB_ROOT."inc/class_timers.php";

require_once MYBB_ROOT."inc/class_xml.php";

 
require_once MYBB_ROOT.'inc/class_language.php';

$lang = new MyLanguage();

require_once MYBB_ROOT.'inc/class_language.php';

$lang = new MyLanguage();

Zeile 62Zeile 61

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


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

 
require_once MYBB_ROOT . 'inc/AbstractPdoDbDriver.php';


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


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

Zeile 71Zeile 71
		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;

		break;
default:
$db = new DB_MySQL;

Zeile 194Zeile 200
		);
$user = get_user_by_username($mybb->get_input('username'), $options);


		);
$user = get_user_by_username($mybb->get_input('username'), $options);


		if(!$user['uid'])

		if(!$user)

		{
$output->print_error("The username you have entered appears to be invalid.");
}
else
{
$user = validate_password_from_uid($user['uid'], $mybb->get_input('password'), $user);

		{
$output->print_error("The username you have entered appears to be invalid.");
}
else
{
$user = validate_password_from_uid($user['uid'], $mybb->get_input('password'), $user);

			if(!$user['uid'])

			if(!$user)

			{
$output->print_error("The password you entered is incorrect. If you have forgotten your password, click <a href=\"../member.php?action=lostpw\">here</a>. Otherwise, go back and try again.");
}
}


			{
$output->print_error("The password you entered is incorrect. If you have forgotten your password, click <a href=\"../member.php?action=lostpw\">here</a>. Otherwise, go back and try again.");
}
}


		my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true);

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


header("Location: ./upgrade.php");
}


header("Location: ./upgrade.php");
}

Zeile 245Zeile 251
	</div>
</form>');
$output->print_footer("");

	</div>
</form>');
$output->print_footer("");





		exit;

		exit;

	}

	}

	else if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['cancp'] != 'yes')
{
$output->print_error($lang->sprintf($lang->no_permision, $mybb->user['logoutkey']));

	else if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['cancp'] != 'yes')
{
$output->print_error($lang->sprintf($lang->no_permision, $mybb->user['logoutkey']));

Zeile 256Zeile 262
	if(!$mybb->input['action'] || $mybb->input['action'] == "intro")
{
$output->print_header();

	if(!$mybb->input['action'] || $mybb->input['action'] == "intro")
{
$output->print_header();





		if($db->table_exists("upgrade_data"))

		if($db->table_exists("upgrade_data"))

		{

		{

			$db->drop_table("upgrade_data");
}

			$db->drop_table("upgrade_data");
}

 

$collation = $db->build_create_table_collation();

$engine = '';
if($db->type == "mysql" || $db->type == "mysqli")
{
$engine = 'ENGINE=MyISAM';
}


		$db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data (
title varchar(30) NOT NULL,
contents text NOT NULL,
UNIQUE (title)

		$db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data (
title varchar(30) NOT NULL,
contents text NOT NULL,
UNIQUE (title)

		);");

		) {$engine}{$collation};");


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


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





		$upgradescripts = array();
while(($file = readdir($dh)) !== false)
{

		$upgradescripts = array();
while(($file = readdir($dh)) !== false)
{

Zeile 289Zeile 304
		if(empty($version_history))
{
$next_update_version = 17; // 16+1

		if(empty($version_history))
{
$next_update_version = 17; // 16+1

		}

		}

		else
{
$next_update_version = (int)(end($version_history)+1);

		else
{
$next_update_version = (int)(end($version_history)+1);

Zeile 317Zeile 332
		unset($upgradescripts);
unset($upgradescript);


		unset($upgradescripts);
unset($upgradescript);


		$output->print_contents($lang->sprintf($lang->upgrade_welcome, $mybb->version)."<p><select name=\"from\">$vers</select>".$lang->upgrade_send_stats);
$output->print_footer("doupgrade");









		if(end($version_history) == reset($key_order) && empty($mybb->input['force']))
{
$output->print_contents($lang->upgrade_not_needed);
$output->print_footer("finished");
}
else
{
$output->print_contents($lang->sprintf($lang->upgrade_welcome, $mybb->version)."<p><select name=\"from\">$vers</select>".$lang->upgrade_send_stats);
$output->print_footer("doupgrade");
}

	}
elseif($mybb->input['action'] == "doupgrade")
{
add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT));
require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', MyBB::INPUT_INT).".php";

	}
elseif($mybb->input['action'] == "doupgrade")
{
add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT));
require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', MyBB::INPUT_INT).".php";

		if($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->get_input('donewarning') != "true")

		if($db->table_exists("datacache") && !empty($upgrade_detail['requires_deactivated_plugins']) && $mybb->get_input('donewarning') != "true")

		{
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

		{
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

Zeile 333Zeile 356
				$lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$mybb->get_input('from', MyBB::INPUT_INT)."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<div class=\"error\"><strong><span style=\"color: red\">Warning:</span></strong> <p>There are still ".count($plugins['active'])." plugin(s) active. Active plugins can sometimes cause problems during an upgrade procedure or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";
$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version));
$output->print_footer("doupgrade");

				$lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$mybb->get_input('from', MyBB::INPUT_INT)."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<div class=\"error\"><strong><span style=\"color: red\">Warning:</span></strong> <p>There are still ".count($plugins['active'])." plugin(s) active. Active plugins can sometimes cause problems during an upgrade procedure or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";
$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version));
$output->print_footer("doupgrade");

			}
else
{

			}
else
{

				add_upgrade_store("startscript", $mybb->get_input('from', MyBB::INPUT_INT));
$runfunction = next_function($mybb->get_input('from', MyBB::INPUT_INT));
}

				add_upgrade_store("startscript", $mybb->get_input('from', MyBB::INPUT_INT));
$runfunction = next_function($mybb->get_input('from', MyBB::INPUT_INT));
}

Zeile 368Zeile 391
	else // Busy running modules, come back later
{
$bits = explode("_", $mybb->input['action'], 2);

	else // Busy running modules, come back later
{
$bits = explode("_", $mybb->input['action'], 2);

		if($bits[1]) // We're still running a module

		if(!empty($bits[1])) // We're still running a module

		{
$from = $bits[0];
$runfunction = next_function($bits[0], $bits[1]);

		{
$from = $bits[0];
$runfunction = next_function($bits[0], $bits[1]);

Zeile 421Zeile 444
		 stylesheets text NOT NULL,
allowedgroups text NOT NULL,
PRIMARY KEY (tid)

		 stylesheets text NOT NULL,
allowedgroups text NOT NULL,
PRIMARY KEY (tid)

		) ENGINE=MyISAM{$charset};");

		) ENGINE=MyISAM{$charset};");


$db->drop_table("themestylesheets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."themestylesheets(


$db->drop_table("themestylesheets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."themestylesheets(

Zeile 441Zeile 464
			require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php";
}
else if(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))

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

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

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

		else
{
$output->print_error("Please make sure your admin directory is uploaded correctly.");

		else
{
$output->print_error("Please make sure your admin directory is uploaded correctly.");

Zeile 453Zeile 476

$db->update_query("themes", array("def" => 1), "tid='{$tid}'");
$db->update_query("users", array('style' => $tid));


$db->update_query("themes", array("def" => 1), "tid='{$tid}'");
$db->update_query("users", array('style' => $tid));

		$db->update_query("forums", array('style' => 0));

		$db->update_query("forums", array('style' => 0));


$db->drop_table("templatesets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templatesets (


$db->drop_table("templatesets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templatesets (

Zeile 491Zeile 514

// Now deal with the master templates
$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme.xml');


// Now deal with the master templates
$contents = @file_get_contents(INSTALL_ROOT.'resources/mybb_theme.xml');

	$parser = new XMLParser($contents);

	$parser = create_xml_parser($contents);

	$tree = $parser->get_tree();

$theme = $tree['theme'];

	$tree = $parser->get_tree();

$theme = $tree['theme'];

Zeile 507Zeile 530
			$time = TIME_NOW;
$query = $db->simple_select("templates", "tid", "sid='-2' AND title='".$db->escape_string($templatename)."'");
$oldtemp = $db->fetch_array($query);

			$time = TIME_NOW;
$query = $db->simple_select("templates", "tid", "sid='-2' AND title='".$db->escape_string($templatename)."'");
$oldtemp = $db->fetch_array($query);

			if($oldtemp['tid'])
{

			if($oldtemp)
{

				$update_array = array(
'template' => $templatevalue,
'version' => $templateversion,

				$update_array = array(
'template' => $templatevalue,
'version' => $templateversion,

Zeile 530Zeile 553
				++$newcount;
}
}

				++$newcount;
}
}

	}

	}


$output->print_contents($lang->upgrade_templates_reverted_success);
$output->print_footer("rebuildsettings");


$output->print_contents($lang->upgrade_templates_reverted_success);
$output->print_footer("rebuildsettings");

Zeile 551Zeile 574
		exit;
}
$synccount = sync_settings($system_upgrade_detail['revert_all_settings']);

		exit;
}
$synccount = sync_settings($system_upgrade_detail['revert_all_settings']);





	$output->print_header($lang->upgrade_settings_sync);
$output->print_contents($lang->sprintf($lang->upgrade_settings_sync_success, $synccount[1], $synccount[0]));
$output->print_footer("buildcaches");

	$output->print_header($lang->upgrade_settings_sync);
$output->print_contents($lang->sprintf($lang->upgrade_settings_sync_success, $synccount[1], $synccount[0]));
$output->print_footer("buildcaches");

Zeile 566Zeile 589

$output->print_header($lang->upgrade_datacache_building);



$output->print_header($lang->upgrade_datacache_building);


	$contents .= $lang->upgrade_building_datacache;

	$contents = $lang->upgrade_building_datacache;


$cache->update_version();
$cache->update_attachtypes();


$cache->update_version();
$cache->update_attachtypes();

Zeile 588Zeile 611
	$cache->update_tasks();
$cache->update_spiders();
$cache->update_bannedips();

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

	$cache->update_banned();

 
	$cache->update_birthdays();
$cache->update_most_replied_threads();
$cache->update_most_viewed_threads();

	$cache->update_birthdays();
$cache->update_most_replied_threads();
$cache->update_most_viewed_threads();

Zeile 596Zeile 618
	$cache->update_threadprefixes();
$cache->update_forumsdisplay();
$cache->update_reportreasons(true);

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





	$contents .= $lang->done."</p>";

$output->print_contents("$contents<p>".$lang->upgrade_continue."</p>");

	$contents .= $lang->done."</p>";

$output->print_contents("$contents<p>".$lang->upgrade_continue."</p>");

Zeile 618Zeile 640
	{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(0, '', $mybb->version_code, $mybb->config['database']['encoding']);

	{
require_once MYBB_ROOT."inc/functions_serverstats.php";
$build_server_stats = build_server_stats(0, '', $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 647Zeile 669
		if($written)
{
$lock_note = $lang->sprintf($lang->upgrade_locked, $config['admin_dir']);

		if($written)
{
$lock_note = $lang->sprintf($lang->upgrade_locked, $config['admin_dir']);

		}
}
if(!$written)
{
$lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>";

		}
}
if(empty($written))
{
$lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>";

	}

// Rebuild inc/settings.php at the end of the upgrade

	}

// Rebuild inc/settings.php at the end of the upgrade

Zeile 682Zeile 704
 * Show the finish page
*/
function whatsnext()

 * Show the finish page
*/
function whatsnext()

{

{

	global $output, $db, $system_upgrade_detail, $lang;

if($system_upgrade_detail['revert_all_templates'] > 0)

	global $output, $db, $system_upgrade_detail, $lang;

if($system_upgrade_detail['revert_all_templates'] > 0)

Zeile 704Zeile 726
 * @param string $func
*
* @return string

 * @param string $func
*
* @return string

 */

 */

function next_function($from, $func="dbchanges")
{
global $oldvers, $system_upgrade_detail, $currentscript, $cache;

function next_function($from, $func="dbchanges")
{
global $oldvers, $system_upgrade_detail, $currentscript, $cache;

Zeile 725Zeile 747
		if(file_exists(INSTALL_ROOT."resources/upgrade".$from.".php"))
{
$function = next_function($from);

		if(file_exists(INSTALL_ROOT."resources/upgrade".$from.".php"))
{
$function = next_function($from);

		}
}

if(!$function)

		}
}

if(empty($function))

	{
$function = "whatsnext";
}

	{
$function = "whatsnext";
}

Zeile 737Zeile 759

/**
* @param string $module


/**
* @param string $module

 */

 */

function load_module($module)
{
global $system_upgrade_detail, $currentscript, $upgrade_detail;

function load_module($module)
{
global $system_upgrade_detail, $currentscript, $upgrade_detail;

Zeile 747Zeile 769
	{
foreach($upgrade_detail as $key => $val)
{

	{
foreach($upgrade_detail as $key => $val)
{

			if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])

			if(empty($system_upgrade_detail[$key]) || $val > $system_upgrade_detail[$key])

			{
$system_upgrade_detail[$key] = $val;
}

			{
$system_upgrade_detail[$key] = $val;
}

Zeile 759Zeile 781

/**
* Get a value from our upgrade data cache


/**
* Get a value from our upgrade data cache

 *

 *

 * @param string $title
*
* @return mixed

 * @param string $title
*
* @return mixed

Zeile 767Zeile 789
function get_upgrade_store($title)
{
global $db;

function get_upgrade_store($title)
{
global $db;





	$query = $db->simple_select("upgrade_data", "*", "title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);

	$query = $db->simple_select("upgrade_data", "*", "title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);

 

if(!isset($data['contents']))
{
return null;
}


	return my_unserialize($data['contents']);
}


	return my_unserialize($data['contents']);
}


Zeile 911Zeile 939
		}
}
$settings_xml = file_get_contents(INSTALL_ROOT."resources/settings.xml");

		}
}
$settings_xml = file_get_contents(INSTALL_ROOT."resources/settings.xml");

	$parser = new XMLParser($settings_xml);

	$parser = create_xml_parser($settings_xml);

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

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

Zeile 980Zeile 1008
		}
}
unset($settings);

		}
}
unset($settings);

 
	$settings = '';

	$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";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";

		$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";

Zeile 1078Zeile 1108

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


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

	$parser = new XMLParser($task_file);

	$parser = create_xml_parser($task_file);

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


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


Zeile 1129Zeile 1159
	$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'] = $db->escape_string($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))