Zeile 6 | Zeile 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 4120 2008-08-16 02:40:05Z Tikitiki $
| * $Id: upgrade.php 4271 2008-11-16 06:20:15Z Tikitiki $
|
*/ error_reporting(E_ALL & ~E_NOTICE);
| */ error_reporting(E_ALL & ~E_NOTICE);
|
Zeile 14 | Zeile 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 69 | Zeile 70 |
---|
define('TABLE_PREFIX', $config['database']['table_prefix']); $db->connect($config['database']); $db->set_table_prefix(TABLE_PREFIX);
|
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 173 | Zeile 175 |
---|
$user = $db->fetch_array($query); if(!$user['uid']) {
|
$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 201 | Zeile 208 |
---|
if($mybb->user['uid'] == 0) { $output->print_header("Please Login", "errormsg", 0, 1);
|
if($mybb->user['uid'] == 0) { $output->print_header("Please Login", "errormsg", 0, 1);
|
|
|
$output->print_contents('<p>Please enter your username and password to begin the upgrade process. You must be a valid forum administrator to perform the upgrade.</p> <form action="upgrade.php" method="post"> <div class="border_wrapper">
| $output->print_contents('<p>Please enter your username and password to begin the upgrade process. You must be a valid forum administrator to perform the upgrade.</p> <form action="upgrade.php" method="post"> <div class="border_wrapper">
|
Zeile 244 | Zeile 251 |
---|
if($db->table_exists("upgrade_data")) { $db->drop_table("upgrade_data");
|
if($db->table_exists("upgrade_data")) { $db->drop_table("upgrade_data");
|
}
| }
|
$db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data ( title varchar(30) NOT NULL, contents text NOT NULL,
| $db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data ( title varchar(30) NOT NULL, contents text NOT NULL,
|
Zeile 253 | Zeile 260 |
---|
$dh = opendir(INSTALL_ROOT."resources"); while(($file = readdir($dh)) !== false)
|
$dh = opendir(INSTALL_ROOT."resources"); while(($file = readdir($dh)) !== false)
|
{
| {
|
if(preg_match("#upgrade([0-9]+).php$#i", $file, $match)) { $upgradescripts[$match[1]] = $file;
| if(preg_match("#upgrade([0-9]+).php$#i", $file, $match)) { $upgradescripts[$match[1]] = $file;
|
Zeile 313 | Zeile 320 |
---|
{ add_upgrade_store("startscript", $mybb->input['from']); $runfunction = next_function($mybb->input['from']);
|
{ add_upgrade_store("startscript", $mybb->input['from']); $runfunction = next_function($mybb->input['from']);
|
}
| }
|
} $currentscript = get_upgrade_store("currentscript"); $system_upgrade_detail = get_upgrade_store("upgradedetail");
| } $currentscript = get_upgrade_store("currentscript"); $system_upgrade_detail = get_upgrade_store("upgradedetail");
|
Zeile 450 | Zeile 457 |
---|
// Import master theme import_theme_xml($contents, array("tid" => 1, "no_templates" => 1));
|
// Import master theme import_theme_xml($contents, array("tid" => 1, "no_templates" => 1));
|
}
$sid = -2;
| }
$sid = -2;
|
// 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');
|
Zeile 460 | Zeile 467 |
---|
$tree = $parser->get_tree();
$theme = $tree['theme'];
|
$tree = $parser->get_tree();
$theme = $tree['theme'];
|
|
|
if(is_array($theme['templates'])) { $templates = $theme['templates']['template'];
| if(is_array($theme['templates'])) { $templates = $theme['templates']['template'];
|
Zeile 475 | Zeile 482 |
---|
if($oldtemp['tid']) { $update_array = array(
|
if($oldtemp['tid']) { $update_array = array(
|
'template' => $templatevalue, 'version' => $templateversion, 'dateline' => $time
| 'template' => $templatevalue, 'version' => $templateversion, 'dateline' => $time
|
); $db->update_query("templates", $update_array, "title='".$db->escape_string($templatename)."' AND sid='-2'"); }
| ); $db->update_query("templates", $update_array, "title='".$db->escape_string($templatename)."' AND sid='-2'"); }
|
Zeile 495 | Zeile 502 |
---|
++$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 520 | Zeile 527 |
---|
}
function buildcaches()
|
}
function buildcaches()
|
{
| {
|
global $db, $output, $cache, $lang, $mybb;
$output->print_header($lang->upgrade_datacache_building);
| global $db, $output, $cache, $lang, $mybb;
$output->print_header($lang->upgrade_datacache_building);
|
Zeile 555 | Zeile 562 |
---|
$output->print_contents("$contents<p>".$lang->upgrade_continue."</p>"); $output->print_footer("finished"); }
|
$output->print_contents("$contents<p>".$lang->upgrade_continue."</p>"); $output->print_footer("finished"); }
|
|
|
function upgradedone() { global $db, $output, $mybb, $lang, $config;
| function upgradedone() { global $db, $output, $mybb, $lang, $config;
|
Zeile 572 | Zeile 579 |
---|
} } if(!$written)
|
} } if(!$written)
|
{
| {
|
$lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>"; }
| $lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>"; }
|
Zeile 589 | Zeile 596 |
---|
); $query = $db->simple_select("settings", "value, name", "", $options);
|
); $query = $db->simple_select("settings", "value, name", "", $options);
|
while($setting = $db->fetch_array($query))
| while($setting = $db->fetch_array($query))
|
{ $setting['value'] = str_replace("\"", "\\\"", $setting['value']); $settings[$setting['name']] = $setting['value'];
| { $setting['value'] = str_replace("\"", "\\\"", $setting['value']); $settings[$setting['name']] = $setting['value'];
|
Zeile 605 | Zeile 612 |
---|
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)
|
{
| {
|
$output->print_header($lang->upgrade_template_reversion); $output->print_contents($lang->upgrade_template_reversion_success); $output->print_footer("templates");
|
$output->print_header($lang->upgrade_template_reversion); $output->print_contents($lang->upgrade_template_reversion_success); $output->print_footer("templates");
|
}
| }
|
else { upgradethemes();
|
else { upgradethemes();
|
} }
| } }
|
function next_function($from, $func="dbchanges") { global $oldvers, $system_upgrade_detail, $currentscript;
load_module("upgrade".$from.".php"); if(function_exists("upgrade".$from."_".$func))
|
function next_function($from, $func="dbchanges") { global $oldvers, $system_upgrade_detail, $currentscript;
load_module("upgrade".$from.".php"); if(function_exists("upgrade".$from."_".$func))
|
{
| {
|
$function = "upgrade".$from."_".$func; } else
| $function = "upgrade".$from."_".$func; } else
|
Zeile 631 | Zeile 638 |
---|
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) { $function = "whatsnext"; } return $function;
|
if(!$function) { $function = "whatsnext"; } return $function;
|
}
| }
|
function load_module($module) {
| function load_module($module) {
|
Zeile 657 | Zeile 664 |
---|
} add_upgrade_store("upgradedetail", $system_upgrade_detail); add_upgrade_store("currentscript", $module);
|
} add_upgrade_store("upgradedetail", $system_upgrade_detail); add_upgrade_store("currentscript", $module);
|
} }
| } }
|
function get_upgrade_store($title) {
| function get_upgrade_store($title) {
|
Zeile 667 | Zeile 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) {
| function add_upgrade_store($title, $contents) {
|
Zeile 692 | Zeile 699 |
---|
gid smallint unsigned NOT NULL auto_increment, name varchar(100) NOT NULL default '', title varchar(220) NOT NULL default '',
|
gid smallint unsigned NOT NULL auto_increment, name varchar(100) NOT NULL default '', title varchar(220) NOT NULL default '',
|
description text NOT NULL, disporder smallint unsigned NOT NULL default '0',
| description text NOT NULL, disporder smallint unsigned NOT NULL default '0',
|
isdefault int(1) NOT NULL default '', PRIMARY KEY (gid) ) TYPE=MyISAM;");
|
isdefault int(1) NOT NULL default '', PRIMARY KEY (gid) ) TYPE=MyISAM;");
|
|
|
$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 732 | Zeile 749 |
---|
$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'];
|