Beispiel #1
0
 /**
  * Get all of the alert types in the system.
  *
  * Alert types are both stored in the private $alertTypes variable and are
  * also returned for usage.
  *
  * @param bool $forceDatabase Whether to force the reading of alert types
  *                            from the database.
  *
  * @return array All of the alert types currently in the system.
  */
 public function getAlertTypes($forceDatabase = false)
 {
     $forceDatabase = (bool) $forceDatabase;
     $this->alertTypes = array();
     if (!($cachedAlertTypes = $this->cache->read(self::CACHE_NAME)) || $forceDatabase) {
         $this->alertTypes = $this->loadAlertTypes();
         $this->cache->update(self::CACHE_NAME, $this->alertTypes);
     } else {
         $this->alertTypes = $cachedAlertTypes;
     }
     return $this->alertTypes;
 }
Beispiel #2
0
 if ($db->table_exists("upgrade_data")) {
     $db->drop_table("upgrade_data");
 }
 $db->write_query("CREATE TABLE " . TABLE_PREFIX . "upgrade_data (\n\t\t\ttitle varchar(30) NOT NULL,\n\t\t\tcontents text NOT NULL,\n\t\t\tUNIQUE (title)\n\t\t);");
 $dh = opendir(INSTALL_ROOT . "resources");
 while (($file = readdir($dh)) !== false) {
     if (preg_match("#upgrade([0-9]+).php\$#i", $file, $match)) {
         $upgradescripts[$match[1]] = $file;
         $key_order[] = $match[1];
     }
 }
 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)) {
     $next_update_version = 17;
     // 16+1
 } else {
     $next_update_version = intval(end($version_history) + 1);
 }
 foreach ($key_order as $k => $key) {
     $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);
     if (trim($verinfo[1])) {
         if ($keynum[1] == $next_update_version) {
             $vers .= "<option value=\"{$keynum['1']}\" selected=\"selected\">{$verinfo['1']}</option>\n";
Beispiel #3
0
            $setting['value'] = str_replace("\"", "\\\"", $setting['value']);
            $settings[$setting['name']] = $setting['value'];
        }
        $db->free_result($query);
    }
}
$settings['wolcutoff'] = $settings['wolcutoffmins'] * 60;
$settings['bbname_orig'] = $settings['bbname'];
$settings['bbname'] = strip_tags($settings['bbname']);
$settings['orig_bblanguage'] = $settings['bblanguage'];
// 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);
}
// Setup our internal settings and load our encryption key
$settings['internal'] = $cache->read("internal_settings");
if (!$settings['internal']['encryption_key']) {
    $cache->update("internal_settings", array('encryption_key' => random_str(32)));
    $settings['internal'] = $cache->read("internal_settings");
}
$mybb->settings =& $settings;
$mybb->parse_cookies();
$mybb->cache =& $cache;
$mybb->asset_url = $mybb->get_asset_url();
if ($mybb->use_shutdown == true) {
    register_shutdown_function('run_shutdown');
}
// Did we just upgrade to a new version and haven't run the upgrade scripts yet?
$version = $cache->read("version");
if (!defined("IN_INSTALL") && !defined("IN_UPGRADE") && $version['version_code'] < $mybb->version_code) {
    $version_history = $cache->read("version_history");
 public function fetch_calls(datacache $cache)
 {
     return $cache->read("cloudflare_calls");
 }
Beispiel #5
0
             } else {
                 $vers .= "<option value=\"{$keynum['1']}\">{$verinfo['1']}</option>\n";
             }
         }
     }
     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");
 } elseif ($mybb->input['action'] == "doupgrade") {
     add_upgrade_store("allow_anonymous_info", intval($mybb->input['allow_anonymous_info']));
     require_once INSTALL_ROOT . "resources/upgrade" . intval($mybb->input['from']) . ".php";
     if ($db->table_exists("datacache") && $upgrade_detail['requires_deactivated_plugins'] == 1 && $mybb->input['donewarning'] != "true") {
         require_once MYBB_ROOT . "inc/class_datacache.php";
         $cache = new datacache();
         $plugins = $cache->read('plugins', true);
         if (!empty($plugins['active'])) {
             $output->print_header();
             $lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"" . intval($mybb->input['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");
         } else {
             add_upgrade_store("startscript", $mybb->input['from']);
             $runfunction = next_function($mybb->input['from']);
         }
     } else {
         add_upgrade_store("startscript", $mybb->input['from']);
         $runfunction = next_function($mybb->input['from']);
     }
 }
 $currentscript = get_upgrade_store("currentscript");
Beispiel #6
0
if (!extension_loaded($db->engine)) {
    // Throw our super awesome db loading error
    $mybb->trigger_generic_error("sql_load_error");
}
if (function_exists('mb_internal_encoding')) {
    @mb_internal_encoding("UTF-8");
}
// Connect to the installed MyBB database
define("TABLE_PREFIX", $config['database']['table_prefix']);
$db->connect($config['database']);
$db->set_table_prefix(TABLE_PREFIX);
$db->type = $config['database']['type'];
// Start up our main timer so we can aggregate performance data
$start_timer = microtime(true);
// Get the import session cache if exists
$import_session = $cache->read("import_cache", 1);
// Setup our arrays if they don't exist yet
if (!$import_session['resume_module']) {
    $import_session['resume_module'] = array();
}
if (!$import_session['disabled']) {
    $import_session['disabled'] = array();
}
if (!$import_session['resume_module']) {
    $import_session['resume_module'] = array();
}
if ($mybb->version_code < 1600 || $mybb->version_code >= 1700) {
    $output->print_error("The MyBB Merge System requires MyBB 1.6  to run.");
}
// Are we done? Generate the report!
if (isset($mybb->input['reportgen']) && !empty($import_session['board'])) {
Beispiel #7
0
        while ($setting = $db->fetch_array($query)) {
            $setting['value'] = str_replace("\"", "\\\"", $setting['value']);
            $settings[$setting['name']] = $setting['value'];
        }
        $db->free_result($query);
    }
}
$settings['wolcutoff'] = $settings['wolcutoffmins'] * 60;
$settings['bbname_orig'] = $settings['bbname'];
$settings['bbname'] = strip_tags($settings['bbname']);
$settings['orig_bblanguage'] = $settings['bblanguage'];
// 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['internal'] = $cache->read("internal_settings");
if (!$settings['internal']['encryption_key']) {
    $cache->update("internal_settings", array('encryption_key' => random_str(32)));
    $settings['internal'] = $cache->read("internal_settings");
}
$mybb->settings =& $settings;
$mybb->parse_cookies();
$mybb->cache =& $cache;
if ($mybb->settings['useshutdownfunc'] != 0) {
    $mybb->use_shutdown = true;
    register_shutdown_function(array(&$mybb, "__destruct"));
}
// Load plugins
if (!defined("NO_PLUGINS")) {
    $plugins->load();
}