Vergleich install/upgrade.php - 1.4.0 - 1.4.5

  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 4353 2009-04-19 00:25:42Z Tikitiki $

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


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


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

Zeile 47Zeile 48
$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 98
			$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 108
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 141
}
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 134Zeile 174
		$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 241
	}
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 357

{
$runfunction();


{
$runfunction();

	}

	}

}

function upgradethemes()

}

function upgradethemes()

Zeile 335Zeile 380
		  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 422
		{
$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 456
		}

// 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 528

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 620
	else
{
upgradethemes();

	else
{
upgradethemes();

	}
}

	}
}


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


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

Zeile 629Zeile 674
	$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 656Zeile 701
		  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)
) TYPE=MyISAM;");

$db->drop_table("settings");

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

		  PRIMARY KEY  (gid)
) TYPE=MyISAM;");

$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 718Zeile 773
		}

if(!$gid)

		}

if(!$gid)

		{

		{

			continue;
}


			continue;
}


Zeile 736Zeile 791
				"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);

 
		}
}


		}
}


Zeile 770Zeile 809
		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);