Zeile 47 | Zeile 47 |
---|
// 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/class_xml.php";
| |
require_once MYBB_ROOT.'inc/class_language.php';
$lang = new MyLanguage();
|
require_once MYBB_ROOT.'inc/class_language.php';
$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.
| $lang->load('language');
// If we're upgrading from an SQLite installation, make sure we still work.
|
Zeile 62 | Zeile 61 |
---|
// Load DB interface require_once MYBB_ROOT."inc/db_base.php";
|
// 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 71 | 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 94 | Zeile 100 |
---|
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'))
|
{
| {
|
rebuild_settings(); } else
| rebuild_settings(); } else
|
Zeile 130 | Zeile 136 |
---|
require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache;
|
require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache;
|
|
|
// Load cache $cache->cache();
| // Load cache $cache->cache();
|
Zeile 143 | 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"); $fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');
| $displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image"); $fpermfields = array('canview', 'canviewthreads', 'candlattachments', 'canpostthreads', 'canpostreplys', 'canpostattachments', 'canratethreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canpostpolls', 'canvotepolls', 'cansearch', 'modposts', 'modthreads', 'modattachments', 'mod_edit_posts');
|
Zeile 163 | 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."); }
| { $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."); }
|
Zeile 194 | Zeile 200 |
---|
); $user = get_user_by_username($mybb->get_input('username'), $options);
|
); $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."); } else { $user = validate_password_from_uid($user['uid'], $mybb->get_input('password'), $user);
|
{ $output->print_error("The username you have entered appears to be invalid."); } else { $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."); } }
|
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true);
| my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true, "lax");
|
header("Location: ./upgrade.php"); }
| header("Location: ./upgrade.php"); }
|
Zeile 261 | 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");
|
$dh = opendir(INSTALL_ROOT."resources");
|
|
|
$upgradescripts = array(); while(($file = readdir($dh)) !== false) {
| $upgradescripts = array(); while(($file = readdir($dh)) !== false) {
|
Zeile 281 | Zeile 296 |
---|
closedir($dh); natsort($key_order); $key_order = array_reverse($key_order);
|
closedir($dh); natsort($key_order); $key_order = array_reverse($key_order);
|
|
|
// Figure out which version we last updated from (as of 1.6) $version_history = $cache->read("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))
|
// Figure out which version we last updated from (as of 1.6) $version_history = $cache->read("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 } else
| $next_update_version = 17; // 16+1 } else
|
Zeile 307 | Zeile 322 |
---|
if($keynum[1] == $next_update_version) { $vers .= "<option value=\"$keynum[1]\" selected=\"selected\">$verinfo[1]</option>\n";
|
if($keynum[1] == $next_update_version) { $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"; }
|
} }
| } }
|
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") { add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT)); require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', MyBB::INPUT_INT).".php";
|
} elseif($mybb->input['action'] == "doupgrade") { add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT)); require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', MyBB::INPUT_INT).".php";
|
if($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->get_input('donewarning') != "true")
| 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']))
| { $plugins = $cache->read('plugins', true); if(!empty($plugins['active']))
|
Zeile 368 | Zeile 391 |
---|
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]);
| { $from = $bits[0]; $runfunction = next_function($bits[0], $bits[1]);
|
Zeile 383 | Zeile 406 |
---|
} }
|
} }
|
| /** * 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 430 | Zeile 456 |
---|
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)
|
) ENGINE=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";
| ) ENGINE=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")) {
| } else if(file_exists(MYBB_ROOT."admin/inc/functions_themes.php")) {
|
Zeile 477 | Zeile 503 |
---|
} else {
|
} else {
|
$output->print_error();
| $output->print_error($lang->no_theme_functions_file);
|
}
// Import master theme
| }
// Import master theme
|
Zeile 488 | Zeile 514 |
---|
// 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 504 | Zeile 530 |
---|
$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 533 | Zeile 559 |
---|
$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 551 | Zeile 580 |
---|
$output->print_footer("buildcaches"); }
|
$output->print_footer("buildcaches"); }
|
| /** * Rebuild caches */
|
function buildcaches() { global $db, $output, $cache, $lang, $mybb;
$output->print_header($lang->upgrade_datacache_building);
|
function buildcaches() { global $db, $output, $cache, $lang, $mybb;
$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 580 | Zeile 611 |
---|
$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 594 | Zeile 625 |
---|
$output->print_footer("finished"); }
|
$output->print_footer("finished"); }
|
| /** * Called as latest function. Send statistics, create lock file etc */
|
function upgradedone() { global $db, $output, $mybb, $lang, $config, $plugins;
ob_start();
|
function upgradedone() { global $db, $output, $mybb, $lang, $config, $plugins;
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 666 | Zeile 700 |
---|
$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 719 |
---|
} }
|
} }
|
| /** * Determine the next function we need to call * * @param int $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;
|
Zeile 705 | Zeile 750 |
---|
} }
|
} }
|
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;
| function load_module($module) { global $system_upgrade_detail, $currentscript, $upgrade_detail;
|
Zeile 721 | Zeile 769 |
---|
{ 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 779 |
---|
} }
|
} }
|
| /** * Get a value from our upgrade data cache * * @param string $title * * @return mixed */
|
function get_upgrade_store($title) { global $db;
| function get_upgrade_store($title) { global $db;
|
Zeile 740 | Zeile 795 |
---|
return my_unserialize($data['contents']); }
|
return my_unserialize($data['contents']); }
|
| /** * @param string $title * @param mixed $contents */
|
function add_upgrade_store($title, $contents) { global $db;
| function add_upgrade_store($title, $contents) { global $db;
|
Zeile 751 | Zeile 810 |
---|
$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 933 |
---|
} } $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 1002 |
---|
} } 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 1017 |
---|
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 1102 |
---|
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 1144 |
---|
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))
|