Exemplo n.º 1
0
/**
 * Get the forum database password.
 *
 * @return string			The forum database password
 */
function get_db_forums_password()
{
    global $SITE_INFO;
    if (!array_key_exists('db_forums_password', $SITE_INFO)) {
        return get_db_site_password();
    }
    return $SITE_INFO['db_forums_password'];
}
Exemplo n.º 2
0
/**
 * Upgrade shared installs.
 */
function upgrade_sharedinstall_sites()
{
    global $CURRENT_SHARE_USER, $SITE_INFO, $TABLE_LANG_FIELDS;
    // Find sites
    $sites = array();
    foreach (array_keys($SITE_INFO) as $key) {
        $matches = array();
        if (preg_match('#^custom_user_(.*)#', $key, $matches) != 0) {
            $sites[] = $matches[1];
        }
    }
    disable_php_memory_limit();
    foreach ($sites as $i => $site) {
        if (function_exists('set_time_limit')) {
            @set_time_limit(0);
        }
        // Change active site
        $CURRENT_SHARE_USER = $site;
        $TABLE_LANG_FIELDS = array();
        _general_db_init();
        // Reset DB
        $GLOBALS['SITE_DB'] = new database_driver(get_db_site(), get_db_site_host(), get_db_site_user(), get_db_site_password(), get_table_prefix());
        $GLOBALS['FORUM_DB'] = $GLOBALS['SITE_DB'];
        // NB: File path will be ok
        // NB: Other internal caching could need changing in the future, but works at time of writing
        // Go!
        automate_upgrade();
        echo 'Upgraded ' . htmlentities($site) . '<br />';
        flush();
    }
}
 // Via addon_registry hooks (bundled ones)
 $files = array();
 $files = array_merge($files, get_directory_contents($path, '', false, false));
 if (file_exists(str_replace('/sources/', '/sources_custom/', $path))) {
     $files = array_merge($files, get_directory_contents(str_replace('/sources/', '/sources_custom/', $path), '', false, false));
 }
 foreach ($files as $file) {
     if (substr($file, -4) == '.php') {
         $auto_probe[] = basename($file, '.php');
     }
 }
 // Via addons table (non-bundled ones)
 global $SITE_INFO;
 $backup = $SITE_INFO;
 require_once $probe_dir . '/info.php';
 $linked_db = new database_driver(get_db_site(), get_db_site_host(), get_db_site_user(), get_db_site_password(), get_table_prefix());
 $auto_probe += collapse_1d_complexity('addon_name', $linked_db->query_select('addons', array('addon_name')));
 $SITE_INFO = $backup;
 // Via filesystem (non-bundled ones)
 foreach ($addons['non_bundled'] as $addon => $files) {
     foreach ($files as $file) {
         if (file_exists($probe_dir . '/' . $file)) {
             $auto_probe[] = $addon;
         }
     }
 }
 $auto_probe = array_unique($auto_probe);
 // Find oldest modified file that has been modified since
 $cutoff_days = 0;
 $files = get_directory_contents($probe_dir);
 foreach ($files as $file) {