示例#1
0
/**
 * Parts common to any modular installation step.
 */
function big_installation_common()
{
    if (function_exists('set_time_limit')) {
        @set_time_limit(180);
    }
    if (count($_POST) == 0) {
        exit(do_lang('INST_POST_ERROR'));
    }
    $info_file = (file_exists('use_comp_name') ? array_key_exists('COMPUTERNAME', $_ENV) ? $_ENV['COMPUTERNAME'] : $_SERVER['SERVER_NAME'] : 'info') . '.php';
    require_once get_file_base() . '/' . $info_file;
    require_code('database');
    $forum_type = get_forum_type();
    require_code('forum/' . $forum_type);
    $GLOBALS['FORUM_DRIVER'] = object_factory('forum_driver_' . filter_naughty_harsh($forum_type));
    if ($forum_type != 'none') {
        $GLOBALS['FORUM_DRIVER']->connection = new database_driver(get_db_forums(), get_db_forums_host(), get_db_forums_user(), get_db_forums_password(), $GLOBALS['FORUM_DRIVER']->get_drivered_table_prefix());
    }
    $GLOBALS['FORUM_DRIVER']->MEMBER_ROWS_CACHED = array();
    $GLOBALS['FORUM_DB'] =& $GLOBALS['FORUM_DRIVER']->connection;
    if (method_exists($GLOBALS['FORUM_DRIVER'], 'check_db')) {
        if (!$GLOBALS['FORUM_DRIVER']->check_db()) {
            warn_exit(do_lang_tempcode('INVALID_FORUM_DATABASE'));
        }
    }
    require_code('database_action');
    require_code('menus2');
    require_code('config');
    require_code('zones2');
}
示例#2
0
/**
 * Standard code module initialisation function.
 */
function init__users()
{
    global $MEMBERS_BLOCKED, $MEMBERS_BLOCKING_US;
    $MEMBERS_BLOCKED = NULL;
    $MEMBERS_BLOCKING_US = NULL;
    global $SESSION_CACHE, $MEMBER_CACHED, $ADMIN_GROUP_CACHE, $MODERATOR_GROUP_CACHE, $USERGROUP_LIST_CACHE;
    global $USER_NAME_CACHE, $MEMBER_EMAIL_CACHE, $USERS_GROUPS_CACHE;
    global $SESSION_CONFIRMED, $GETTING_MEMBER, $EMOTICON_CACHE, $CACHED_THEME, $EMOTICON_LEVELS, $EMOTICON_SET_DIR;
    $EMOTICON_LEVELS = NULL;
    $USER_NAME_CACHE = array();
    $MEMBER_EMAIL_CACHE = array();
    $USERGROUP_LIST_CACHE = NULL;
    $USERS_GROUPS_CACHE = array();
    $ADMIN_GROUP_CACHE = NULL;
    $MODERATOR_GROUP_CACHE = NULL;
    $MEMBER_CACHED = NULL;
    $SESSION_CONFIRMED = 0;
    $GETTING_MEMBER = false;
    $EMOTICON_CACHE = NULL;
    $CACHED_THEME = NULL;
    $EMOTICON_SET_DIR = NULL;
    global $IS_ACTUALLY_ADMIN;
    $IS_ACTUALLY_ADMIN = false;
    global $IS_A_COOKIE_LOGIN;
    $IS_A_COOKIE_LOGIN = false;
    // Load all sessions into memory, if possible
    if (get_value('session_prudence') !== '1') {
        $SESSION_CACHE = persistant_cache_get('SESSION_CACHE');
    } else {
        $SESSION_CACHE = NULL;
    }
    global $IN_MINIKERNEL_VERSION;
    if (!is_array($SESSION_CACHE) && $IN_MINIKERNEL_VERSION == 0) {
        if (get_value('session_prudence') !== '1') {
            $where = '';
        } else {
            $where = ' WHERE the_session=' . strval(get_session_id()) . ' OR ' . db_string_equal_to('ip', get_ip_address());
        }
        $SESSION_CACHE = array();
        if (get_forum_type() == 'ocf' && get_db_site() == get_db_forums() && get_db_site_host() == get_db_forums_host()) {
            $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
            $_s = $GLOBALS['SITE_DB']->query('SELECT s.*,m.m_primary_group FROM ' . get_table_prefix() . 'sessions s LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members m ON m.id=s.the_user' . $where);
            $SESSION_CACHE = list_to_map('the_session', $_s);
            $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
        } else {
            $SESSION_CACHE = list_to_map('the_session', $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'sessions' . $where));
        }
        if (get_value('session_prudence') !== '1') {
            persistant_cache_set('SESSION_CACHE', $SESSION_CACHE);
        }
    }
    // Canonicalise various disparities in how HTTP auth environment variables are set
    if (array_key_exists('REDIRECT_REMOTE_USER', $_SERVER)) {
        $_SERVER['PHP_AUTH_USER'] = preg_replace('#@.*$#', '', $_SERVER['REDIRECT_REMOTE_USER']);
    }
    if (array_key_exists('PHP_AUTH_USER', $_SERVER)) {
        $_SERVER['PHP_AUTH_USER'] = preg_replace('#@.*$#', '', $_SERVER['PHP_AUTH_USER']);
    }
    if (array_key_exists('REMOTE_USER', $_SERVER)) {
        $_SERVER['PHP_AUTH_USER'] = preg_replace('#@.*$#', '', $_SERVER['REMOTE_USER']);
    }
}
示例#3
0
 /**
  * See if the importing site is on the same M.S.N. as the site being imported.
  *
  * @param  PATH			The path to the imported site
  * @return boolean		Answer
  */
 function on_same_msn($file_base)
 {
     if (get_param_integer('keep_on_same_msn', NULL) === 0) {
         return false;
     }
     if (get_param_integer('keep_on_same_msn', NULL) === 1) {
         return true;
     }
     //return false;
     global $SITE_INFO;
     $backup_site_info = $SITE_INFO;
     $SITE_INFO = mixed();
     @(include $file_base . '/info.php');
     $sites_site_info = $SITE_INFO;
     $SITE_INFO = $backup_site_info;
     $answer = $sites_site_info['db_forums'] == get_db_forums() && $sites_site_info['db_forums_host'] == get_db_forums_host() && @$sites_site_info['ocf_table_prefix'] === @$SITE_INFO['ocf_table_prefix'];
     return $answer;
 }
示例#4
0
/**
 * Load stuff that allows user code to work.
 */
function load_user_stuff()
{
    if (!array_key_exists('FORUM_DRIVER', $GLOBALS) || $GLOBALS['FORUM_DRIVER'] === NULL) {
        global $SITE_INFO;
        require_code('forum_stub');
        if (!array_key_exists('forum_type', $SITE_INFO)) {
            $SITE_INFO['forum_type'] = 'ocf';
        }
        require_code('forum/' . $SITE_INFO['forum_type']);
        // So we can at least get user details
        $GLOBALS['FORUM_DRIVER'] = object_factory('forum_driver_' . filter_naughty_harsh($SITE_INFO['forum_type']));
        if ($SITE_INFO['forum_type'] == 'ocf' && get_db_forums() == get_db_site() && $GLOBALS['FORUM_DRIVER']->get_drivered_table_prefix() == get_table_prefix() && !$GLOBALS['DEBUG_MODE']) {
            $GLOBALS['FORUM_DRIVER']->connection = $GLOBALS['SITE_DB'];
        } elseif ($SITE_INFO['forum_type'] != 'none') {
            $GLOBALS['FORUM_DRIVER']->connection = new database_driver(get_db_forums(), get_db_forums_host(), get_db_forums_user(), get_db_forums_password(), $GLOBALS['FORUM_DRIVER']->get_drivered_table_prefix());
        }
        $GLOBALS['FORUM_DRIVER']->MEMBER_ROWS_CACHED = array();
        $GLOBALS['FORUM_DB'] =& $GLOBALS['FORUM_DRIVER']->connection;
    }
}