Ejemplo n.º 1
0
        $upload_dir = $attach_config['upload_dir'];
    } else {
        // Begin PNphpBB2 Module
        //		$upload_dir = '../' . $attach_config['upload_dir'];
        $upload_dir = $phpbb_root_path . $attach_config['upload_dir'];
        // End PNphpBB2 Module
    }
} else {
    $upload_dir = $attach_config['download_path'];
}
include $phpbb_root_path . 'attach_mod/includes/functions_selects.' . $phpEx;
include $phpbb_root_path . 'attach_mod/includes/functions_admin.' . $phpEx;
// Check if the language got included
if (!isset($lang['Test_settings_successful'])) {
    // include_once is used within the function
    include_attach_lang();
}
// Init Variables
$start = get_var('start', 0);
$sort_order = get_var('order', 'ASC');
$sort_order = $sort_order == 'ASC' ? 'ASC' : 'DESC';
$mode = get_var('mode', '');
$view = get_var('view', '');
$uid = isset($_POST['u_id']) ? get_var('u_id', 0) : get_var('uid', 0);
$view = isset($_POST['search']) && $_POST['search'] ? 'attachments' : $view;
// process modes based on view
if ($view == 'username') {
    $mode_types_text = array($lang['Sort_Username'], $lang['Sort_Attachments'], $lang['Sort_Size']);
    $mode_types = array('username', 'attachments', 'filesize');
    if (!$mode) {
        $mode = 'attachments';
Ejemplo n.º 2
0
function init_userprefs($userdata)
{
    global $board_config, $theme, $images;
    global $template, $lang, $phpEx, $phpbb_root_path, $db;
    global $nav_links;
    if ($userdata['user_id'] != ANONYMOUS) {
        if (!empty($userdata['user_lang'])) {
            $default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'");
        }
        if (!empty($userdata['user_dateformat'])) {
            $board_config['default_dateformat'] = $userdata['user_dateformat'];
        }
        if (isset($userdata['user_timezone'])) {
            $board_config['board_timezone'] = $userdata['user_timezone'];
        }
    } else {
        $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
    }
    if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
        if ($userdata['user_id'] != ANONYMOUS) {
            // For logged in users, try the board default language next
            $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
        } else {
            // For guests it means the default language is not present, try english
            // This is a long shot since it means serious errors in the setup to reach here,
            // but english is part of a new install so it's worth us trying
            $default_lang = 'english';
        }
        if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
            message_die(CRITICAL_ERROR, 'Could not locate valid language pack');
        }
    }
    // If we've had to change the value in any way then let's write it back to the database
    // before we go any further since it means there is something wrong with it
    if ($userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang) {
        $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\tSET user_lang = '" . $default_lang . "'\n\t\t\tWHERE user_lang = '" . $userdata['user_lang'] . "'";
        if (!($result = $db->sql_query($sql))) {
            message_die(CRITICAL_ERROR, 'Could not update user language info');
        }
        $userdata['user_lang'] = $default_lang;
    } elseif ($userdata['user_id'] === ANONYMOUS && $board_config['default_lang'] !== $default_lang) {
        $sql = 'UPDATE ' . CONFIG_TABLE . "\n\t\t\tSET config_value = '" . $default_lang . "'\n\t\t\tWHERE config_name = 'default_lang'";
        if (!($result = $db->sql_query($sql))) {
            message_die(CRITICAL_ERROR, 'Could not update user language info');
        }
    }
    $board_config['default_lang'] = $default_lang;
    include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
    if (defined('IN_ADMIN')) {
        if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx))) {
            $board_config['default_lang'] = 'english';
        }
        include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx;
    }
    include_attach_lang();
    include $phpbb_root_path . './includes/lang_extend_mac.' . $phpEx;
    //
    // Set up style
    //
    if (!$board_config['override_user_style']) {
        if ($userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0) {
            if ($theme = setup_style($userdata['user_style'])) {
                return;
            }
        }
    }
    $theme = setup_style($board_config['default_style']);
    //
    // Mozilla navigation bar
    // Default items that should be valid on all pages.
    // Defined here to correctly assign the Language Variables
    // and be able to change the variables within code.
    //
    $nav_links['top'] = array('url' => append_sid($phpbb_root_path . 'index.' . $phpEx), 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']));
    $nav_links['search'] = array('url' => append_sid($phpbb_root_path . 'search.' . $phpEx), 'title' => $lang['Search']);
    $nav_links['help'] = array('url' => append_sid($phpbb_root_path . 'faq.' . $phpEx), 'title' => $lang['FAQ']);
    $nav_links['author'] = array('url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx), 'title' => $lang['Memberlist']);
    return;
}
Ejemplo n.º 3
0
function init_userprefs($userdata)
{
    global $db, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
    global $board_config, $theme, $images;
    global $template, $lang, $phpEx, $phpbb_root_path, $db;
    global $nav_links;
    if ($userdata['user_id'] != ANONYMOUS) {
        if (!empty($userdata['user_lang'])) {
            $default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'");
        }
        if (!empty($userdata['user_dateformat'])) {
            $board_config['default_dateformat'] = $userdata['user_dateformat'];
        }
        if (isset($userdata['user_timezone'])) {
            $board_config['board_timezone'] = $userdata['user_timezone'];
        }
        if (isset($userdata['user_use_rel_date'])) {
            $board_config['ty_use_rel_date'] = $userdata['user_use_rel_date'];
        }
        if (isset($userdata['user_use_rel_time'])) {
            $board_config['ty_use_rel_time'] = $userdata['user_use_rel_time'];
        }
    } else {
        $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
    }
    if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
        if ($userdata['user_id'] != ANONYMOUS) {
            // For logged in users, try the board default language next
            $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
        } else {
            // For guests it means the default language is not present, try english
            // This is a long shot since it means serious errors in the setup to reach here,
            // but english is part of a new install so it's worth us trying
            $default_lang = 'french';
        }
        if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
            message_die(CRITICAL_ERROR, 'Could not locate valid language pack');
        }
    }
    // If we've had to change the value in any way then let's write it back to the database
    // before we go any further since it means there is something wrong with it
    if ($userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang) {
        $sql = 'UPDATE ' . USERS_TABLE . "\r\n\t\t\tSET user_lang = '" . $default_lang . "'\r\n\t\t\tWHERE user_lang = '" . $userdata['user_lang'] . "'";
        if (!($result = $db->sql_query($sql))) {
            message_die(CRITICAL_ERROR, 'Could not update user language info');
        }
        $board_config['default_lang'] = $default_lang;
        $userdata['user_lang'] = $default_lang;
    } elseif ($board_config['default_lang'] !== $default_lang) {
        $sql = 'UPDATE ' . CONFIG_TABLE . "\r\n\t\t\tSET config_value = '" . $default_lang . "'\r\n\t\t\tWHERE config_name = 'default_lang'";
        if (!($result = $db->sql_query($sql))) {
            message_die(CRITICAL_ERROR, 'Could not update user language info');
        }
        $board_config['default_lang'] = $default_lang;
    }
    include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
    include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_common_main.' . $phpEx;
    include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_TownMap_main.' . $phpEx;
    if (defined('IN_ADMIN')) {
        if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx))) {
            $board_config['default_lang'] = 'french';
        }
        include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx;
        include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_common_admin.' . $phpEx;
    }
    //MOD Keep_unread_2
    read_cookies($userdata);
    //-- mod : language settings ---------------------------------------------------
    //-- add
    include $phpbb_root_path . 'includes/lang_extend_mac.' . $phpEx;
    //-- fin mod : language settings -----------------------------------------------
    // Disable board if needed
    board_disable();
    if (!defined('NO_ATTACH_MOD')) {
        include_attach_lang();
    }
    //
    // Set up style
    //
    if (!$board_config['override_user_style']) {
        if (isset($HTTP_GET_VARS[STYLE_URL])) {
            $style = urldecode($HTTP_GET_VARS[STYLE_URL]);
            if ($theme = setup_style($style)) {
                if ($theme['themes_id'] == $userdata['user_style']) {
                    return;
                }
                if ($userdata['user_id'] != ANONYMOUS) {
                    // user logged in --> save new style ID in user profile
                    $sql = "UPDATE " . USERS_TABLE . " \r\n\t\t\t\t\t\tSET user_style = " . $theme['themes_id'] . "\r\n\t\t\t\t\t\tWHERE user_id = " . $userdata['user_id'];
                    if (!$db->sql_query($sql)) {
                        message_die(CRITICAL_ERROR, 'Error updating user style', '', __LINE__, __FILE__, $sql);
                    }
                    $userdata['user_style'] = $theme['themes_id'];
                } else {
                    // user not logged in --> save new style ID in cookie
                    setcookie($board_config['cookie_name'] . '_style', $style, time() + 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
                }
                return;
            }
        }
        if ($userdata['user_id'] == ANONYMOUS && isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_style'])) {
            $style = $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_style'];
            if ($theme = setup_style($style)) {
                return;
            }
        }
        if ($userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0) {
            if ($theme = setup_style($userdata['user_style'])) {
                return;
            }
        }
    }
    $theme = setup_style($board_config['default_style']);
    //
    // Mozilla navigation bar
    // Default items that should be valid on all pages.
    // Defined here to correctly assign the Language Variables
    // and be able to change the variables within code.
    //
    $nav_links['top'] = array('url' => append_sid($phpbb_root_path . 'index.' . $phpEx), 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']));
    $nav_links['search'] = array('url' => append_sid($phpbb_root_path . 'search.' . $phpEx), 'title' => $lang['Search']);
    $nav_links['help'] = array('url' => append_sid($phpbb_root_path . 'faq.' . $phpEx), 'title' => $lang['FAQ']);
    $nav_links['author'] = array('url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx), 'title' => $lang['Memberlist']);
    return;
}
Ejemplo n.º 4
0
 /**
  *  Initialise user settings
  */
 function init_userprefs()
 {
     global $ft_cfg, $theme, $lang;
     if (defined('LANG_DIR')) {
         return;
     }
     // prevent multiple calling
     define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . 'lang_' . $ft_cfg['default_lang'] . '/');
     define('ENGLISH_LANG_DIR', LANG_ROOT_DIR . 'lang_english/');
     if ($this->data['user_id'] != GUEST_UID) {
         if ($this->data['user_lang'] && $this->data['user_lang'] != $ft_cfg['default_lang']) {
             $ft_cfg['default_lang'] = basename($this->data['user_lang']);
             define('LANG_DIR', LANG_ROOT_DIR . 'lang_' . $ft_cfg['default_lang'] . '/');
         }
         if (isset($this->data['user_timezone'])) {
             $ft_cfg['board_timezone'] = $this->data['user_timezone'];
         }
     }
     $this->data['user_lang'] = $ft_cfg['default_lang'];
     $this->data['user_timezone'] = $ft_cfg['board_timezone'];
     if (!defined('LANG_DIR')) {
         define('LANG_DIR', DEFAULT_LANG_DIR);
     }
     require LANG_DIR . 'lang_main.php';
     setlocale(LC_ALL, 'ru_RU.UTF-8');
     // Временная функция [BEGIN]
     if (defined('IN_ADMIN')) {
         require FT_ROOT . 'language/lang_' . $ft_cfg['default_lang'] . '/lang_admin.php';
     }
     // Временная функция [END]
     include_attach_lang();
     $theme = setup_style();
     // Handle marking posts read
     if (!IS_GUEST && !empty($_COOKIE[COOKIE_MARK])) {
         $this->mark_read($_COOKIE[COOKIE_MARK]);
     }
     $this->load_opt_js();
 }
Ejemplo n.º 5
0
function init_userprefs($userdata)
{
    global $board_config, $theme, $images;
    global $template, $lang, $phpEx, $phpbb_root_path;
    global $nav_links;
    if ($userdata['user_id'] != ANONYMOUS) {
        if (!empty($userdata['user_lang'])) {
            $board_config['default_lang'] = $userdata['user_lang'];
        }
        if (!empty($userdata['user_dateformat'])) {
            $board_config['default_dateformat'] = $userdata['user_dateformat'];
        }
        if (isset($userdata['user_timezone'])) {
            $board_config['board_timezone'] = $userdata['user_timezone'];
        }
    }
    if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx))) {
        $board_config['default_lang'] = 'english';
    }
    include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
    if (defined('IN_ADMIN')) {
        if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx))) {
            $board_config['default_lang'] = 'english';
        }
        include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx;
    }
    include_attach_lang();
    //
    // Set up style
    //
    if (!$board_config['override_user_style']) {
        if ($userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0) {
            if ($theme = setup_style($userdata['user_style'])) {
                return;
            }
        }
    }
    $theme = setup_style($board_config['default_style']);
    //
    // Mozilla navigation bar
    // Default items that should be valid on all pages.
    // Defined here to correctly assign the Language Variables
    // and be able to change the variables within code.
    //
    $nav_links['top'] = array('url' => append_sid($phpbb_root_path . 'index.' . $phpEx), 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']));
    $nav_links['search'] = array('url' => append_sid($phpbb_root_path . 'search.' . $phpEx), 'title' => $lang['Search']);
    $nav_links['help'] = array('url' => append_sid($phpbb_root_path . 'faq.' . $phpEx), 'title' => $lang['FAQ']);
    $nav_links['author'] = array('url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx), 'title' => $lang['Memberlist']);
    return;
}