Vergleich install/upgrade.php - 1.4.0 - 1.4.3

  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 4172 2008-09-03 00:30:14Z Tikitiki $

 */
error_reporting(E_ALL & ~E_NOTICE);


 */
error_reporting(E_ALL & ~E_NOTICE);


Zeile 47Zeile 47
$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"))
{
require_once MYBB_ROOT."inc/settings.php";


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

}

}


if(!file_exists(MYBB_ROOT."inc/settings.php") || !$settings)
{


if(!file_exists(MYBB_ROOT."inc/settings.php") || !$settings)
{

Zeile 80Zeile 97
			$settings[$setting['name']] = $setting['value'];
}
}

			$settings[$setting['name']] = $setting['value'];
}
}

}


}


$settings['wolcutoff'] = $settings['wolcutoffmins']*60;
$settings['bbname_orig'] = $settings['bbname'];
$settings['bbname'] = strip_tags($settings['bbname']);

$settings['wolcutoff'] = $settings['wolcutoffmins']*60;
$settings['bbname_orig'] = $settings['bbname'];
$settings['bbname'] = strip_tags($settings['bbname']);

Zeile 90Zeile 107
if(substr($settings['bburl'], -1) == "/")
{
$settings['bburl'] = my_substr($settings['bburl'], 0, -1);

if(substr($settings['bburl'], -1) == "/")
{
$settings['bburl'] = my_substr($settings['bburl'], 0, -1);

}


}


$mybb->settings = &$settings;
$mybb->parse_cookies();


$mybb->settings = &$settings;
$mybb->parse_cookies();


Zeile 123Zeile 140
}
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";


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


Zeile 136Zeile 175
		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.");

		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.");

		}

		}

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

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

		

		

		$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 236
	}
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 312Zeile 352

{
$runfunction();


{
$runfunction();

	}
}

	}
}


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

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


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

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





	$charset = $db->build_create_table_collation();

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

	$charset = $db->build_create_table_collation();

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

	{

	{

		$db->drop_table("templates");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templates (
tid int unsigned NOT NULL auto_increment,

		$db->drop_table("templates");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templates (
tid int unsigned NOT NULL auto_increment,

Zeile 362Zeile 402
			cachefile varchar(100) NOT NULL default '',
lastmodified bigint(30) NOT NULL default '0',
PRIMARY KEY(sid)

			cachefile varchar(100) NOT NULL default '',
lastmodified bigint(30) NOT NULL default '0',
PRIMARY KEY(sid)

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

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

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

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

		else if(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))
{
require_once MYBB_ROOT."admin/inc/functions_themes.php";

		else if(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))
{
require_once MYBB_ROOT."admin/inc/functions_themes.php";

Zeile 400Zeile 440
		if(file_exists(MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php"))
{
require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions_themes.php";

		if(file_exists(MYBB_ROOT.$mybb->config['admin_dir']."/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";

		else if(file_exists(MYBB_ROOT."admin/inc/functions_themes.php"))
{
require_once MYBB_ROOT."admin/inc/functions_themes.php";

Zeile 483Zeile 523

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 575Zeile 615
	else
{
upgradethemes();

	else
{
upgradethemes();

	}
}

	}
}


function next_function($from, $func="dbchanges")
{


function next_function($from, $func="dbchanges")
{

Zeile 609Zeile 649
	
require_once INSTALL_ROOT."resources/".$module;
if($currentscript != $module)

	
require_once INSTALL_ROOT."resources/".$module;
if($currentscript != $module)

	{

	{

		foreach($upgrade_detail as $key => $val)
{
if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])

		foreach($upgrade_detail as $key => $val)
{
if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])

Zeile 629Zeile 669
	$query = $db->simple_select("upgrade_data", "*", "title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);
return unserialize($data['contents']);

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

}


}


function add_upgrade_store($title, $contents)
{
global $db;

function add_upgrade_store($title, $contents)
{
global $db;

Zeile 641Zeile 681
	);		
$db->replace_query("upgrade_data", $replace_array, "title");
}

	);		
$db->replace_query("upgrade_data", $replace_array, "title");
}





function sync_settings($redo=0)
{
global $db;

function sync_settings($redo=0)
{
global $db;

Zeile 663Zeile 703
		$db->drop_table("settings");

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

		$db->drop_table("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 694Zeile 744
	$tree = $parser->get_tree();
$settinggroupnames = array();
$settingnames = array();

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



	

	foreach($tree['settings'][0]['settinggroup'] as $settinggroup)
{
$settinggroupnames[] = $settinggroup['attributes']['name'];

	foreach($tree['settings'][0]['settinggroup'] as $settinggroup)
{
$settinggroupnames[] = $settinggroup['attributes']['name'];

Zeile 718Zeile 768
		}

if(!$gid)

		}

if(!$gid)

		{

		{

			continue;
}


			continue;
}


Zeile 736Zeile 786
				"isdefault" => 1
);
if(!$settings[$setting['attributes']['name']] || $redo == 2)

				"isdefault" => 1
);
if(!$settings[$setting['attributes']['name']] || $redo == 2)

			{

			{

				$settingdata['value'] = $db->escape_string($setting['settingvalue'][0]['value']);
$db->insert_query("settings", $settingdata);
$settingcount++;

				$settingdata['value'] = $db->escape_string($setting['settingvalue'][0]['value']);
$db->insert_query("settings", $settingdata);
$settingcount++;

			}

			}

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

			else
{
$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);

 
		}
}


		}
}