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 4052 2008-07-29 15:45:49Z 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 47 | Zeile 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 80 | Zeile 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 90 | Zeile 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 123 | Zeile 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 135 | 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."); } else {
| $output->print_error("The username you have entered appears to be invalid."); } else {
|
$user = validate_password_from_uid($user['uid'], $mybb->input['password'], $user);
|
$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 $mybb->user['remember'] = $user['remember'];
|
$db->update_query("sessions", $newsession, "sid='".$session->sid."'"); // Temporarily set the cookie remember option for the login cookies $mybb->user['remember'] = $user['remember'];
|
|
|
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true); my_setcookie("sid", $session->sid, -1, true);
| my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true); my_setcookie("sid", $session->sid, -1, true);
|
Zeile 196 | Zeile 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&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 206 | 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 227 | Zeile 272 |
---|
$key_order = array_reverse($key_order);
foreach($key_order as $k => $key)
|
$key_order = array_reverse($key_order);
foreach($key_order as $k => $key)
|
{
| {
|
$file = $upgradescripts[$key]; $upgradescript = file_get_contents(INSTALL_ROOT."resources/$file"); preg_match("#Upgrade Script:(.*)#i", $upgradescript, $verinfo);
| $file = $upgradescripts[$key]; $upgradescript = file_get_contents(INSTALL_ROOT."resources/$file"); preg_match("#Upgrade Script:(.*)#i", $upgradescript, $verinfo);
|
Zeile 237 | Zeile 282 |
---|
if($k == 0) { $vers .= "<option value=\"$keynum[1]\" selected=\"selected\">$verinfo[1]</option>\n";
|
if($k == 0) { $vers .= "<option value=\"$keynum[1]\" selected=\"selected\">$verinfo[1]</option>\n";
|
}
| }
|
else { $vers .= "<option value=\"$keynum[1]\">$verinfo[1]</option>\n";
| else { $vers .= "<option value=\"$keynum[1]\">$verinfo[1]</option>\n";
|
Zeile 312 | Zeile 357 |
---|
{ $runfunction();
|
{ $runfunction();
|
} }
| } }
|
function upgradethemes() { global $output, $db, $system_upgrade_detail, $lang, $mybb;
| function upgradethemes() { global $output, $db, $system_upgrade_detail, $lang, $mybb;
|
Zeile 483 | Zeile 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 575 | Zeile 620 |
---|
else { upgradethemes();
|
else { upgradethemes();
|
} }
| } }
|
function next_function($from, $func="dbchanges") {
| function next_function($from, $func="dbchanges") {
|
Zeile 609 | Zeile 654 |
---|
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 629 | 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) { global $db;
| function add_upgrade_store($title, $contents) { global $db;
|
Zeile 641 | Zeile 686 |
---|
); $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 663 | Zeile 708 |
---|
$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 718 | Zeile 773 |
---|
} if(!$gid)
|
} if(!$gid)
|
{
| {
|
continue; }
| continue; }
|
Zeile 736 | Zeile 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);
| |
} }
| } }
|