Zeile 21 | Zeile 21 |
---|
require_once MYBB_ROOT.'inc/class_error.php'; $error_handler = new errorHandler();
|
require_once MYBB_ROOT.'inc/class_error.php'; $error_handler = new errorHandler();
|
| require_once MYBB_ROOT."inc/functions.php";
|
require_once MYBB_ROOT."inc/class_core.php"; $mybb = new MyBB;
| require_once MYBB_ROOT."inc/class_core.php"; $mybb = new MyBB;
|
Zeile 42 | Zeile 44 |
---|
); } $mybb->config = &$config;
|
); } $mybb->config = &$config;
|
|
|
// Include the files necessary for installation require_once MYBB_ROOT."inc/class_timers.php";
|
// Include the files necessary for installation require_once MYBB_ROOT."inc/class_timers.php";
|
require_once MYBB_ROOT."inc/functions.php"; require_once MYBB_ROOT."inc/class_xml.php";
| |
require_once MYBB_ROOT.'inc/class_language.php';
|
require_once MYBB_ROOT.'inc/class_language.php';
|
|
|
$lang = new MyLanguage();
|
$lang = new MyLanguage();
|
$lang->set_path(MYBB_ROOT.'install/resources/');
| $lang->set_path(INSTALL_ROOT.'resources/');
|
$lang->load('language');
// If we're upgrading from an SQLite installation, make sure we still work. if($config['database']['type'] == 'sqlite3' || $config['database']['type'] == 'sqlite2')
|
$lang->load('language');
// If we're upgrading from an SQLite installation, make sure we still work. if($config['database']['type'] == 'sqlite3' || $config['database']['type'] == 'sqlite2')
|
{
| {
|
$config['database']['type'] = 'sqlite'; }
|
$config['database']['type'] = 'sqlite'; }
|
| // Load DB interface require_once MYBB_ROOT."inc/db_base.php"; require_once MYBB_ROOT . 'inc/AbstractPdoDbDriver.php';
|
require_once MYBB_ROOT."inc/db_{$config['database']['type']}.php"; switch($config['database']['type'])
| require_once MYBB_ROOT."inc/db_{$config['database']['type']}.php"; switch($config['database']['type'])
|
Zeile 67 | Zeile 71 |
---|
break; case "pgsql": $db = new DB_PgSQL;
|
break; case "pgsql": $db = new DB_PgSQL;
|
| break; case "pgsql_pdo": $db = new PostgresPdoDbDriver();
|
break; case "mysqli": $db = new DB_MySQLi;
|
break; case "mysqli": $db = new DB_MySQLi;
|
| break; case "mysql_pdo": $db = new MysqlPdoDbDriver();
|
break; default: $db = new DB_MySQL;
| break; default: $db = new DB_MySQL;
|
Zeile 86 | Zeile 96 |
---|
{ require_once MYBB_ROOT."inc/settings.php"; }
|
{ require_once MYBB_ROOT."inc/settings.php"; }
|
|
|
if(!file_exists(MYBB_ROOT."inc/settings.php") || !$settings) { if(function_exists('rebuild_settings'))
| if(!file_exists(MYBB_ROOT."inc/settings.php") || !$settings) { if(function_exists('rebuild_settings'))
|
Zeile 103 | Zeile 113 |
---|
$query = $db->simple_select("settings", "value, name", "", $options);
$settings = array();
|
$query = $db->simple_select("settings", "value, name", "", $options);
$settings = array();
|
while($setting = $db->fetch_array($query)) { $setting['value'] = str_replace("\"", "\\\"", $setting['value']); $settings[$setting['name']] = $setting['value'];
| while($setting = $db->fetch_array($query)) { $setting['value'] = str_replace("\"", "\\\"", $setting['value']); $settings[$setting['name']] = $setting['value'];
|
} } }
| } } }
|
Zeile 117 | Zeile 127 |
---|
// Fix for people who for some specify a trailing slash on the board URL if(substr($settings['bburl'], -1) == "/")
|
// Fix for people who for some specify a trailing slash on the board URL if(substr($settings['bburl'], -1) == "/")
|
{
| {
|
$settings['bburl'] = my_substr($settings['bburl'], 0, -1); }
| $settings['bburl'] = my_substr($settings['bburl'], 0, -1); }
|
Zeile 139 | Zeile 149 |
---|
// Include the necessary contants for installation $grouppermignore = array("gid", "type", "title", "description", "namestyle", "usertitle", "stars", "starimage", "image");
|
// Include the necessary contants for installation $grouppermignore = array("gid", "type", "title", "description", "namestyle", "usertitle", "stars", "starimage", "image");
|
$groupzerogreater = array("pmquota", "maxpmrecipients", "maxreputationsday", "attachquota", "maxemails", "maxwarningsday", "maxposts", "edittimelimit", "canusesigxposts", "maxreputationsperthread");
| $groupzerogreater = array("pmquota", "maxpmrecipients", "maxreputationsday", "attachquota", "maxemails", "maxwarningsday", "maxposts", "edittimelimit", "canusesigxposts", "maxreputationsperuser", "maxreputationsperthread", "emailfloodtime");
|
$displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image");
|
$displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image");
|
$fpermfields = array("canview", "candlattachments", "canpostthreads", "canpostreplys", "canpostattachments", "canratethreads", "caneditposts", "candeleteposts", "candeletethreads", "caneditattachments", "canpostpolls", "canvotepolls", "cansearch");
| $fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');
|
// Include the installation resources require_once INSTALL_ROOT."resources/output.php";
| // Include the installation resources require_once INSTALL_ROOT."resources/output.php";
|
Zeile 150 | Zeile 160 |
---|
$output->title = "MyBB Upgrade Wizard";
if(file_exists("lock"))
|
$output->title = "MyBB Upgrade Wizard";
if(file_exists("lock"))
|
{
| {
|
$output->print_error($lang->locked); } else
| $output->print_error($lang->locked); } else
|
Zeile 159 | Zeile 169 |
---|
if($mybb->input['action'] == "logout" && $mybb->user['uid']) { // Check session ID if we have one
|
if($mybb->input['action'] == "logout" && $mybb->user['uid']) { // Check session ID if we have one
|
if($mybb->get_input('logoutkey') != $mybb->user['logoutkey'])
| if($mybb->get_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");
|
{ $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;
| if($mybb->user['uid']) { $time = TIME_NOW;
|
Zeile 174 | Zeile 184 |
---|
"lastvisit" => $time, ); $db->update_query("users", $lastvisit, "uid='".$mybb->user['uid']."'");
|
"lastvisit" => $time, ); $db->update_query("users", $lastvisit, "uid='".$mybb->user['uid']."'");
|
$db->delete_query("sessions", "sid='".$session->sid."'");
| |
} header("Location: upgrade.php"); }
| } header("Location: upgrade.php"); }
|
Zeile 183 | Zeile 192 |
---|
require_once MYBB_ROOT."inc/functions_user.php";
if(!username_exists($mybb->get_input('username')))
|
require_once MYBB_ROOT."inc/functions_user.php";
if(!username_exists($mybb->get_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.");
|
} $options = array( 'fields' => array('username', 'password', 'salt', 'loginkey') ); $user = get_user_by_username($mybb->get_input('username'), $options);
|
} $options = array( 'fields' => array('username', 'password', 'salt', 'loginkey') ); $user = get_user_by_username($mybb->get_input('username'), $options);
|
if(!$user['uid'])
| if(!$user)
|
{ $output->print_error("The username you have entered appears to be invalid.");
|
{ $output->print_error("The username you have entered appears to be invalid.");
|
} else
| } else
|
{ $user = validate_password_from_uid($user['uid'], $mybb->get_input('password'), $user);
|
{ $user = validate_password_from_uid($user['uid'], $mybb->get_input('password'), $user);
|
if(!$user['uid'])
| if(!$user)
|
{ $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 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."'");
$newsession = array( "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'];
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, "lax");
|
header("Location: ./upgrade.php");
|
header("Location: ./upgrade.php");
|
}
| }
|
$output->steps = array($lang->upgrade);
if($mybb->user['uid'] == 0)
| $output->steps = array($lang->upgrade);
if($mybb->user['uid'] == 0)
|
Zeile 270 | Zeile 267 |
---|
{ $db->drop_table("upgrade_data"); }
|
{ $db->drop_table("upgrade_data"); }
|
| $collation = $db->build_create_table_collation(); $engine = ''; if($db->type == "mysql" || $db->type == "mysqli") { $engine = 'ENGINE=MyISAM'; }
|
$db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data ( title varchar(30) NOT NULL, contents text NOT NULL, UNIQUE (title)
|
$db->write_query("CREATE TABLE ".TABLE_PREFIX."upgrade_data ( title varchar(30) NOT NULL, contents text NOT NULL, UNIQUE (title)
|
);");
| ) {$engine}{$collation};");
|
$dh = opendir(INSTALL_ROOT."resources");
$upgradescripts = array(); while(($file = readdir($dh)) !== false) {
|
$dh = opendir(INSTALL_ROOT."resources");
$upgradescripts = array(); while(($file = readdir($dh)) !== false) {
|
if(preg_match("#upgrade([0-9]+).php$#i", $file, $match))
| if(preg_match("#upgrade(\d+(p\d+)*).php$#i", $file, $match))
|
{ $upgradescripts[$match[1]] = $file; $key_order[] = $match[1];
| { $upgradescripts[$match[1]] = $file; $key_order[] = $match[1];
|
Zeile 297 | Zeile 303 |
---|
// If array is empty then we must be upgrading to 1.6 since that's when this feature was added if(empty($version_history)) {
|
// If array is empty then we must be upgrading to 1.6 since that's when this feature was added if(empty($version_history)) {
|
$next_update_version = 17; // 16+1 }
| $candidates = array( 17, // 16+1 ); }
|
else {
|
else {
|
$next_update_version = (int)(end($version_history)+1);
| $latest_installed = end($version_history);
// Check for standard migrations and old branch patches (1 < 1p1 < 1p2 < 2) $parts = explode('p', $latest_installed);
$candidates = array( (string)((int)$parts[0] + 1), );
if(isset($parts[1])) { $candidates[] = $parts[0].'p'.((int)$parts[1] + 1); } else { $candidates[] = $parts[0].'p1'; }
|
}
|
}
|
|
|
$vers = ''; foreach($key_order as $k => $key)
| $vers = ''; foreach($key_order as $k => $key)
|
Zeile 310 | Zeile 335 |
---|
$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);
|
preg_match("#upgrade([0-9]+).php$#i", $file, $keynum);
| preg_match("#upgrade(\d+(p\d+)*).php$#i", $file, $keynum);
|
if(trim($verinfo[1])) {
|
if(trim($verinfo[1])) {
|
if($keynum[1] == $next_update_version)
| if(in_array($keynum[1], $candidates))
|
{ $vers .= "<option value=\"$keynum[1]\" selected=\"selected\">$verinfo[1]</option>\n";
|
{ $vers .= "<option value=\"$keynum[1]\" selected=\"selected\">$verinfo[1]</option>\n";
|
| $candidates = array();
|
} else {
| } else {
|
Zeile 326 | Zeile 353 |
---|
unset($upgradescripts); unset($upgradescript);
|
unset($upgradescripts); unset($upgradescript);
|
$output->print_contents($lang->sprintf($lang->upgrade_welcome, $mybb->version)."<p><select name=\"from\">$vers</select>".$lang->upgrade_send_stats); $output->print_footer("doupgrade");
| if(end($version_history) == reset($key_order) && empty($mybb->input['force'])) { $output->print_contents($lang->upgrade_not_needed); $output->print_footer("finished"); } else { $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")
|
} elseif($mybb->input['action'] == "doupgrade")
|
{ add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', 1)); require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', 1).".php"; if($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->get_input('donewarning') != "true") {
| { if(ctype_alnum($mybb->get_input('from'))) { $from = $mybb->get_input('from'); } else{ $from = 0; }
add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT)); require_once INSTALL_ROOT."resources/upgrade".$from.".php"; if($db->table_exists("datacache") && !empty($upgrade_detail['requires_deactivated_plugins']) && $mybb->get_input('donewarning') != "true") {
|
$plugins = $cache->read('plugins', true); if(!empty($plugins['active'])) { $output->print_header();
|
$plugins = $cache->read('plugins', true); if(!empty($plugins['active'])) { $output->print_header();
|
$lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$mybb->get_input('from', 1)."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<div class=\"error\"><strong><span style=\"color: red\">Warning:</span></strong> <p>There are still ".count($plugins['active'])." plugin(s) active. Active plugins can sometimes cause problems during an upgrade procedure or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";
| $lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$from."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<div class=\"error\"><strong><span style=\"color: red\">Warning:</span></strong> <p>There are still ".count($plugins['active'])." plugin(s) active. Active plugins can sometimes cause problems during an upgrade procedure or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";
|
$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version)); $output->print_footer("doupgrade"); }
|
$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version)); $output->print_footer("doupgrade"); }
|
else { add_upgrade_store("startscript", $mybb->get_input('from', 1)); $runfunction = next_function($mybb->get_input('from', 1)); }
| else { add_upgrade_store("startscript", $from); $runfunction = next_function($from); }
|
} else {
|
} else {
|
add_upgrade_store("startscript", $mybb->get_input('from', 1)); $runfunction = next_function($mybb->get_input('from', 1));
| add_upgrade_store("startscript", $from); $runfunction = next_function($from);
|
} } $currentscript = get_upgrade_store("currentscript");
| } } $currentscript = get_upgrade_store("currentscript");
|
Zeile 367 | Zeile 410 |
---|
$runfunction = "buildsettings"; } elseif($mybb->input['action'] == "buildcaches")
|
$runfunction = "buildsettings"; } elseif($mybb->input['action'] == "buildcaches")
|
{
| {
|
$runfunction = "buildcaches"; } elseif($mybb->input['action'] == "finished")
| $runfunction = "buildcaches"; } elseif($mybb->input['action'] == "finished")
|
Zeile 377 | Zeile 420 |
---|
else // Busy running modules, come back later { $bits = explode("_", $mybb->input['action'], 2);
|
else // Busy running modules, come back later { $bits = explode("_", $mybb->input['action'], 2);
|
if($bits[1]) // We're still running a module
| if(!empty($bits[1])) // We're still running a module
|
{
|
{
|
$from = $bits[0]; $runfunction = next_function($bits[0], $bits[1]);
| if(ctype_alnum($bits[0])) { $from = $bits[0]; } else { $from = 0; }
$runfunction = next_function($from, $bits[1]);
|
} }
| } }
|
Zeile 389 | Zeile 440 |
---|
if(function_exists($runfunction)) { $runfunction();
|
if(function_exists($runfunction)) { $runfunction();
|
}
| }
|
}
|
}
|
| /** * Do the upgrade changes */
|
function upgradethemes() { global $output, $db, $system_upgrade_detail, $lang, $mybb;
| function upgradethemes() { global $output, $db, $system_upgrade_detail, $lang, $mybb;
|
Zeile 486 | Zeile 540 |
---|
} else {
|
} else {
|
$output->print_error();
| $output->print_error($lang->no_theme_functions_file);
|
}
// Import master theme
| }
// Import master theme
|
Zeile 497 | Zeile 551 |
---|
// 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');
|
$parser = new XMLParser($contents);
| $parser = create_xml_parser($contents);
|
$tree = $parser->get_tree();
$theme = $tree['theme'];
| $tree = $parser->get_tree();
$theme = $tree['theme'];
|
Zeile 513 | Zeile 567 |
---|
$time = TIME_NOW; $query = $db->simple_select("templates", "tid", "sid='-2' AND title='".$db->escape_string($templatename)."'"); $oldtemp = $db->fetch_array($query);
|
$time = TIME_NOW; $query = $db->simple_select("templates", "tid", "sid='-2' AND title='".$db->escape_string($templatename)."'"); $oldtemp = $db->fetch_array($query);
|
if($oldtemp['tid'])
| if($oldtemp)
|
{ $update_array = array( 'template' => $templatevalue,
| { $update_array = array( 'template' => $templatevalue,
|
Zeile 542 | Zeile 596 |
---|
$output->print_footer("rebuildsettings"); }
|
$output->print_footer("rebuildsettings"); }
|
| /** * Update the settings */
|
function buildsettings() { global $db, $output, $system_upgrade_detail, $lang;
| function buildsettings() { global $db, $output, $system_upgrade_detail, $lang;
|
Zeile 558 | Zeile 615 |
---|
$output->print_header($lang->upgrade_settings_sync); $output->print_contents($lang->sprintf($lang->upgrade_settings_sync_success, $synccount[1], $synccount[0])); $output->print_footer("buildcaches");
|
$output->print_header($lang->upgrade_settings_sync); $output->print_contents($lang->sprintf($lang->upgrade_settings_sync_success, $synccount[1], $synccount[0])); $output->print_footer("buildcaches");
|
}
| }
/** * Rebuild caches */
|
function buildcaches() { global $db, $output, $cache, $lang, $mybb;
|
function buildcaches() { global $db, $output, $cache, $lang, $mybb;
|
|
|
$output->print_header($lang->upgrade_datacache_building);
|
$output->print_header($lang->upgrade_datacache_building);
|
$contents .= $lang->upgrade_building_datacache; require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache;
| $contents = $lang->upgrade_building_datacache;
|
$cache->update_version(); $cache->update_attachtypes(); $cache->update_smilies();
| $cache->update_version(); $cache->update_attachtypes(); $cache->update_smilies();
|
Zeile 589 | Zeile 648 |
---|
$cache->update_tasks(); $cache->update_spiders(); $cache->update_bannedips();
|
$cache->update_tasks(); $cache->update_spiders(); $cache->update_bannedips();
|
$cache->update_banned();
| |
$cache->update_birthdays(); $cache->update_most_replied_threads(); $cache->update_most_viewed_threads(); $cache->update_groupleaders(); $cache->update_threadprefixes(); $cache->update_forumsdisplay();
|
$cache->update_birthdays(); $cache->update_most_replied_threads(); $cache->update_most_viewed_threads(); $cache->update_groupleaders(); $cache->update_threadprefixes(); $cache->update_forumsdisplay();
|
| $cache->update_reportreasons(true);
|
$contents .= $lang->done."</p>";
| $contents .= $lang->done."</p>";
|
Zeile 603 | Zeile 662 |
---|
$output->print_footer("finished"); }
|
$output->print_footer("finished"); }
|
| /** * Called as latest function. Send statistics, create lock file etc */
|
function upgradedone() {
|
function upgradedone() {
|
global $db, $output, $mybb, $lang, $config;
| global $db, $output, $mybb, $lang, $config, $plugins;
|
ob_start();
|
ob_start();
|
$output->print_header("Upgrade Complete");
| $output->print_header($lang->upgrade_complete);
|
$allow_anonymous_info = get_upgrade_store("allow_anonymous_info"); if($allow_anonymous_info == 1) {
| $allow_anonymous_info = get_upgrade_store("allow_anonymous_info"); if($allow_anonymous_info == 1) {
|
Zeile 625 | Zeile 687 |
---|
// Attempt to run an update check require_once MYBB_ROOT.'inc/functions_task.php';
|
// Attempt to run an update check require_once MYBB_ROOT.'inc/functions_task.php';
|
run_task(12);
| $query = $db->simple_select('tasks', 'tid', "file='versioncheck'"); $update_check = $db->fetch_array($query); if($update_check) { // Load plugin system for update check require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem;
run_task($update_check['tid']); }
|
if(is_writable("./")) {
| if(is_writable("./")) {
|
Zeile 637 | Zeile 708 |
---|
$lock_note = $lang->sprintf($lang->upgrade_locked, $config['admin_dir']); } }
|
$lock_note = $lang->sprintf($lang->upgrade_locked, $config['admin_dir']); } }
|
if(!$written)
| if(empty($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 666 | Zeile 737 |
---|
$output->print_footer(); }
|
$output->print_footer(); }
|
| /** * Show the finish page */
|
function whatsnext() { global $output, $db, $system_upgrade_detail, $lang;
| function whatsnext() { global $output, $db, $system_upgrade_detail, $lang;
|
Zeile 682 | Zeile 756 |
---|
} }
|
} }
|
| /** * Determine the next function we need to call * * @param string $from * @param string $func * * @return string */
|
function next_function($from, $func="dbchanges") { global $oldvers, $system_upgrade_detail, $currentscript, $cache;
|
function next_function($from, $func="dbchanges") { global $oldvers, $system_upgrade_detail, $currentscript, $cache;
|
| if(!ctype_alnum($from)) { $from = 0; }
|
load_module("upgrade".$from.".php"); if(function_exists("upgrade".$from."_".$func))
| load_module("upgrade".$from.".php"); if(function_exists("upgrade".$from."_".$func))
|
Zeile 694 | Zeile 781 |
---|
else { // We're done with our last upgrade script, so add it to the upgrade scripts we've already completed.
|
else { // We're done with our last upgrade script, so add it to the upgrade scripts we've already completed.
|
| if (ctype_digit($from)) { $from = (int)$from; }
|
$version_history = $cache->read("version_history"); $version_history[$from] = $from; $cache->update("version_history", $version_history);
|
$version_history = $cache->read("version_history"); $version_history[$from] = $from; $cache->update("version_history", $version_history);
|
$from = $from+1; if(file_exists(INSTALL_ROOT."resources/upgrade".$from.".php"))
| // Check for standard migrations and old branch patches (1 < 1p1 < 1p2 < 2) $parts = explode('p', $from);
$candidates = array( (string)((int)$parts[0] + 1), );
if(isset($parts[1])) { $candidates[] = $parts[0].'p'.((int)$parts[1] + 1); } else { $candidates[] = $parts[0].'p1'; }
foreach($candidates as $candidate)
|
{
|
{
|
$function = next_function($from);
| if(file_exists(INSTALL_ROOT."resources/upgrade".$candidate.".php")) { $function = next_function($candidate); break; }
|
} }
|
} }
|
if(!$function)
| if(empty($function))
|
{ $function = "whatsnext"; } return $function; }
|
{ $function = "whatsnext"; } return $function; }
|
| /** * @param string $module */
|
function load_module($module) { global $system_upgrade_detail, $currentscript, $upgrade_detail;
require_once INSTALL_ROOT."resources/".$module; if($currentscript != $module)
|
function load_module($module) { global $system_upgrade_detail, $currentscript, $upgrade_detail;
require_once INSTALL_ROOT."resources/".$module; if($currentscript != $module)
|
{
| {
|
foreach($upgrade_detail as $key => $val) {
|
foreach($upgrade_detail as $key => $val) {
|
if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])
| if(empty($system_upgrade_detail[$key]) || $val > $system_upgrade_detail[$key])
|
{ $system_upgrade_detail[$key] = $val; }
| { $system_upgrade_detail[$key] = $val; }
|
Zeile 731 | Zeile 844 |
---|
} }
|
} }
|
| /** * Get a value from our upgrade data cache * * @param string $title * * @return mixed */
|
function get_upgrade_store($title) { global $db;
$query = $db->simple_select("upgrade_data", "*", "title='".$db->escape_string($title)."'"); $data = $db->fetch_array($query);
|
function get_upgrade_store($title) { global $db;
$query = $db->simple_select("upgrade_data", "*", "title='".$db->escape_string($title)."'"); $data = $db->fetch_array($query);
|
| if(!isset($data['contents'])) { return null; }
|
return my_unserialize($data['contents']); }
|
return my_unserialize($data['contents']); }
|
| /** * @param string $title * @param mixed $contents */
|
function add_upgrade_store($title, $contents) { global $db;
$replace_array = array( "title" => $db->escape_string($title),
|
function add_upgrade_store($title, $contents) { global $db;
$replace_array = array( "title" => $db->escape_string($title),
|
"contents" => $db->escape_string(serialize($contents))
| "contents" => $db->escape_string(my_serialize($contents))
|
); $db->replace_query("upgrade_data", $replace_array, "title"); }
|
); $db->replace_query("upgrade_data", $replace_array, "title"); }
|
| /** * @param int $redo 2 means that all setting tables will be dropped and recreated * * @return array */
|
function sync_settings($redo=0) { global $db;
| function sync_settings($redo=0) { global $db;
|
Zeile 869 | Zeile 1004 |
---|
} } $settings_xml = file_get_contents(INSTALL_ROOT."resources/settings.xml");
|
} } $settings_xml = file_get_contents(INSTALL_ROOT."resources/settings.xml");
|
$parser = new XMLParser($settings_xml);
| $parser = create_xml_parser($settings_xml);
|
$parser->collapse_dups = 0; $tree = $parser->get_tree(); $settinggroupnames = array();
| $parser->collapse_dups = 0; $tree = $parser->get_tree(); $settinggroupnames = array();
|
Zeile 938 | Zeile 1073 |
---|
} } unset($settings);
|
} } unset($settings);
|
| $settings = '';
|
$query = $db->simple_select("settings", "*", "", array('order_by' => 'title')); while($setting = $db->fetch_array($query)) {
|
$query = $db->simple_select("settings", "*", "", array('order_by' => 'title')); while($setting = $db->fetch_array($query)) {
|
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
| $setting['name'] = addcslashes($setting['name'], "\\'"); $setting['value'] = addcslashes($setting['value'], '\\"$');
|
$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n"; } $settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";
| $settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n"; } $settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";
|
Zeile 951 | Zeile 1088 |
---|
return array($groupcount, $settingcount); }
|
return array($groupcount, $settingcount); }
|
| /** * @param int $redo 2 means that the tasks table will be dropped and recreated * * @return int */
|
function sync_tasks($redo=0) { global $db;
| function sync_tasks($redo=0) { global $db;
|
Zeile 1031 | Zeile 1173 |
---|
require_once MYBB_ROOT."inc/functions_task.php"; $task_file = file_get_contents(INSTALL_ROOT.'resources/tasks.xml');
|
require_once MYBB_ROOT."inc/functions_task.php"; $task_file = file_get_contents(INSTALL_ROOT.'resources/tasks.xml');
|
$parser = new XMLParser($task_file);
| $parser = create_xml_parser($task_file);
|
$parser->collapse_dups = 0; $tree = $parser->get_tree();
| $parser->collapse_dups = 0; $tree = $parser->get_tree();
|
Zeile 1073 | Zeile 1215 |
---|
return $taskcount; }
|
return $taskcount; }
|
| /** * Write our settings to the settings file */
|
function write_settings() { global $db; $query = $db->simple_select("settings", "*", "", array('order_by' => 'title')); while($setting = $db->fetch_array($query)) {
|
function write_settings() { global $db; $query = $db->simple_select("settings", "*", "", array('order_by' => 'title')); while($setting = $db->fetch_array($query)) {
|
$setting['value'] = $db->escape_string($setting['value']);
| $setting['name'] = addcslashes($setting['name'], "\\'"); $setting['value'] = addcslashes($setting['value'], '\\"$');
|
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n"; } if(!empty($settings))
| $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n"; } if(!empty($settings))
|
Zeile 1090 | Zeile 1236 |
---|
fclose($file); } }
|
fclose($file); } }
|
?>
| |