Vergleich install/upgrade.php - 1.4.0 - 1.4.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: upgrade.php 4052 2008-07-29 15:45:49Z Tikitiki $

 * $Id: upgrade.php 5379 2011-02-21 11:06:42Z Tomm $

 */
error_reporting(E_ALL & ~E_NOTICE);


 */
error_reporting(E_ALL & ~E_NOTICE);


Zeile 14Zeile 14
define("INSTALL_ROOT", dirname(__FILE__)."/");
define("TIME_NOW", time());
define('IN_MYBB', 1);

define("INSTALL_ROOT", dirname(__FILE__)."/");
define("TIME_NOW", time());
define('IN_MYBB', 1);

 
define("IN_UPGRADE", 1);

if(function_exists('date_default_timezone_set') && !ini_get('date.timezone'))
{
date_default_timezone_set('GMT');
}


require_once MYBB_ROOT."inc/class_core.php";
$mybb = new MyBB;


require_once MYBB_ROOT."inc/class_core.php";
$mybb = new MyBB;

Zeile 47Zeile 53
$lang->load('language');

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

$lang->load('language');

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

$db = new databaseEngine;

















switch($config['database']['type'])
{
case "sqlite3":
$db = new DB_SQLite3;
break;
case "sqlite2":
$db = new DB_SQLite2;
break;
case "pgsql":
$db = new DB_PgSQL;
break;
case "mysqli":
$db = new DB_MySQLi;
break;
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);

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


// Load Settings
if(file_exists(MYBB_ROOT."inc/settings.php"))


// Load Settings
if(file_exists(MYBB_ROOT."inc/settings.php"))

Zeile 123Zeile 146
}
else
{

}
else
{

	if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")























	if($mybb->input['action'] == "logout" && $mybb->user['uid'])
{
// Check session ID if we have one
if($mybb->input['logoutkey'] != $mybb->user['logoutkey'])
{
$output->print_error("Your user ID could not be verified to log you out. This may have been because a malicious Javascript was attempting to log you out automatically. If you intended to log out, please click the Log Out button at the top menu.");
}

my_unsetcookie("mybbuser");
my_unsetcookie("sid");
if($mybb->user['uid'])
{
$time = TIME_NOW;
$lastvisit = array(
"lastactive" => $time-900,
"lastvisit" => $time,
);
$db->update_query("users", $lastvisit, "uid='".$mybb->user['uid']."'");
$db->delete_query("sessions", "sid='".$session->sid."'");
}
header("Location: upgrade.php");
}
else if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")

	{	
require_once MYBB_ROOT."inc/functions_user.php";

if(!username_exists($mybb->input['username']))

	{	
require_once MYBB_ROOT."inc/functions_user.php";

if(!username_exists($mybb->input['username']))

		{
$output->print_error("The username you have entered appears to be invalid.");

		{
$output->print_error("The username you have entered appears to be invalid.");

		}
$query = $db->simple_select("users", "uid,username,password,salt,loginkey", "username='".$db->escape_string($mybb->input['username'])."'", array('limit' => 1));
$user = $db->fetch_array($query);
if(!$user['uid'])

		}
$query = $db->simple_select("users", "uid,username,password,salt,loginkey", "username='".$db->escape_string($mybb->input['username'])."'", array('limit' => 1));
$user = $db->fetch_array($query);
if(!$user['uid'])

		{
$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 username you have entered appears to be invalid.");

		}
else
{
$user = validate_password_from_uid($user['uid'], $mybb->input['password'], $user);

		}
else
{
$user = validate_password_from_uid($user['uid'], $mybb->input['password'], $user);

 
			if(!$user['uid'])
{
$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.");
}

		}

$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");

		}

$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");

 
		

		$newsession = array(

		$newsession = array(

			"uid" => $user['uid'],
"loginattempts" => 1,

			"uid" => $user['uid']


		);

		);

 
		

		$db->update_query("sessions", $newsession, "sid='".$session->sid."'");

// Temporarily set the cookie remember option for the login cookies

		$db->update_query("sessions", $newsession, "sid='".$session->sid."'");

// Temporarily set the cookie remember option for the login cookies

Zeile 196Zeile 246
	}
else if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['cancp'] != 'yes')
{

	}
else if($mybb->usergroup['cancp'] != 1 && $mybb->usergroup['cancp'] != 'yes')
{

		$output->print_error("You do not have permissions to run this process.");

		$output->print_error("You do not have permissions to run this process. You need administrator permissions to be able to run the upgrade procedure.<br /><br />If you need to logout, please click <a href=\"upgrade.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}\">here</a>. From there you will be able to log in again under your administrator account.");

	}

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

	}

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

Zeile 247Zeile 297
		unset($upgradescripts);
unset($upgradescript);


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


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

		$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")
{

		$output->print_footer("doupgrade");
}
elseif($mybb->input['action'] == "doupgrade")
{

 
		add_upgrade_store("allow_anonymous_info", intval($mybb->input['allow_anonymous_info']));

		require_once INSTALL_ROOT."resources/upgrade".intval($mybb->input['from']).".php";
if($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->input['donewarning'] != "true")
{

		require_once INSTALL_ROOT."resources/upgrade".intval($mybb->input['from']).".php";
if($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->input['donewarning'] != "true")
{

Zeile 293Zeile 344
		$runfunction = "buildcaches";
}
elseif($mybb->input['action'] == "finished")

		$runfunction = "buildcaches";
}
elseif($mybb->input['action'] == "finished")

	{

	{

		$runfunction = "upgradedone";
}
else // Busy running modules, come back later

		$runfunction = "upgradedone";
}
else // Busy running modules, come back later

Zeile 309Zeile 360
	// Fetch current script we're in

if(function_exists($runfunction))

	// Fetch current script we're in

if(function_exists($runfunction))





	{
$runfunction();
}
}

	{
$runfunction();
}
}





function upgradethemes()
{
global $output, $db, $system_upgrade_detail, $lang, $mybb;

function upgradethemes()
{
global $output, $db, $system_upgrade_detail, $lang, $mybb;

Zeile 335Zeile 386
		  status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',
PRIMARY KEY (tid)

		  status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',
PRIMARY KEY (tid)

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

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

	}

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

	}

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

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

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

		import_theme_xml($contents, array("templateset" => -2, "no_templates" => 1));

		import_theme_xml($contents, array("templateset" => -2, "no_templates" => 1, "version_compat" => 1));

		$tid = build_new_theme("Default", null, 1);

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

		$tid = build_new_theme("Default", null, 1);

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

Zeile 411Zeile 462
		}

// Import master theme

		}

// Import master theme

		import_theme_xml($contents, array("tid" => 1, "no_templates" => 1));

		import_theme_xml($contents, array("tid" => 1, "no_templates" => 1, "version_compat" => 1));

	}

$sid = -2;

	}

$sid = -2;

Zeile 483Zeile 534

function buildcaches()
{


function buildcaches()
{

	global $db, $output, $cache, $lang;

	global $db, $output, $cache, $lang, $mybb;


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



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


Zeile 521Zeile 572
function upgradedone()
{
global $db, $output, $mybb, $lang, $config;

function upgradedone()
{
global $db, $output, $mybb, $lang, $config;

 
	
ob_start();


$output->print_header("Upgrade Complete");


$output->print_header("Upgrade Complete");

 
	
$allow_anonymous_info = get_upgrade_store("allow_anonymous_info");
if($allow_anonymous_info == 1)
{
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'];
}
}
ob_end_flush();


	if(is_writable("./"))
{
$lock = @fopen("./lock", "w");

	if(is_writable("./"))
{
$lock = @fopen("./lock", "w");

Zeile 656Zeile 723
		  title varchar(220) NOT NULL default '',
description text NOT NULL,
disporder smallint unsigned NOT NULL default '0',

		  title varchar(220) NOT NULL default '',
description text NOT NULL,
disporder smallint unsigned NOT NULL default '0',

		  isdefault int(1) NOT NULL default '',

		  isdefault int(1) NOT NULL default '0',

		  PRIMARY KEY  (gid)

		  PRIMARY KEY  (gid)

		) TYPE=MyISAM;");

$db->drop_table("settings");

		) TYPE=MyISAM;");

$db->drop_table("settings");


$db->write_query("CREATE TABLE ".TABLE_PREFIX."settings (


$db->write_query("CREATE TABLE ".TABLE_PREFIX."settings (

		  sid smallint(6) NOT NULL auto_increment,

		  sid smallint unsigned NOT NULL auto_increment,

		  name varchar(120) NOT NULL default '',
title varchar(120) NOT NULL default '',
description text NOT NULL,
optionscode text NOT NULL,
value text NOT NULL,

		  name varchar(120) NOT NULL default '',
title varchar(120) NOT NULL default '',
description text NOT NULL,
optionscode text NOT NULL,
value text NOT NULL,

		  disporder smallint(6) NOT NULL default '0',
gid smallint(6) NOT NULL default '0',
PRIMARY KEY (sid)


		  disporder smallint unsigned NOT NULL default '0',
gid smallint unsigned NOT NULL default '0',
isdefault int(1) NOT NULL default '0',
PRIMARY KEY (sid)

		) TYPE=MyISAM;");
}
else
{

		) TYPE=MyISAM;");
}
else
{

		$query = $db->simple_select("settings", "name,sid", "isdefault='1' OR isdefault='yes'");










		if($db->type == "mysql" || $db->type == "mysqli")
{
$wheresettings = "isdefault='1' OR isdefault='yes'";
}
else
{
$wheresettings = "isdefault='1'";
}

$query = $db->simple_select("settings", "name,sid", $wheresettings);

		while($setting = $db->fetch_array($query))
{
$settings[$setting['name']] = $setting['sid'];

		while($setting = $db->fetch_array($query))
{
$settings[$setting['name']] = $setting['sid'];

		}

$query = $db->simple_select("settinggroups", "name,title,gid", "isdefault='1' OR isdefault='yes'");

		}

$query = $db->simple_select("settinggroups", "name,title,gid", $wheresettings);

		while($group = $db->fetch_array($query))
{
$settinggroups[$group['name']] = $group['gid'];

		while($group = $db->fetch_array($query))
{
$settinggroups[$group['name']] = $group['gid'];

Zeile 746Zeile 823
				$name = $db->escape_string($setting['attributes']['name']);
$db->update_query("settings", $settingdata, "name='{$name}'");
}

				$name = $db->escape_string($setting['attributes']['name']);
$db->update_query("settings", $settingdata, "name='{$name}'");
}

		}
}

foreach($settinggroups as $groupname)
{
if(!in_array($groupname, $settinggroupnames))
{
$db->delete_query("settinggroups", "gid='".$settinggroups[$groupname]."'", 1);
}
}

foreach($settings as $settingname)
{
if(!in_array($settingname, $settingnames))
{
$db->delete_query("settings", "sid='".$settings[$settingname]."'", 1);

 
		}
}


		}
}


Zeile 770Zeile 831
		require MYBB_ROOT."inc/settings.php";
foreach($settings as $key => $val)
{

		require MYBB_ROOT."inc/settings.php";
foreach($settings as $key => $val)
{

			$db->update_query("settings", array('value' => $db->escape_string($val)), "name='$key'");

			$db->update_query("settings", array('value' => $db->escape_string($val)), "name='".$db->escape_string($key)."'");

		}
}
unset($settings);

		}
}
unset($settings);