当前位置: 首页>>代码示例>>PHP>>正文


PHP phpbb_timezone_select函数代码示例

本文整理汇总了PHP中phpbb_timezone_select函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_timezone_select函数的具体用法?PHP phpbb_timezone_select怎么用?PHP phpbb_timezone_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phpbb_timezone_select函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main


//.........这里部分代码省略.........
                if (!isset($user->lang['dateformats'][$data['dateformat']])) {
                    $dateformat_options .= ' selected="selected"';
                    $s_custom = true;
                }
                $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
                $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
                // Topic ordering options
                $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
                $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
                // Post ordering options
                $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
                $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
                $_options = array('topic', 'post');
                foreach ($_options as $sort_option) {
                    ${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
                    foreach (${'limit_' . $sort_option . '_days'} as $day => $text) {
                        $selected = $data[$sort_option . '_st'] == $day ? ' selected="selected"' : '';
                        ${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
                    }
                    ${'s_limit_' . $sort_option . '_days'} .= '</select>';
                    ${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
                    foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text) {
                        $selected = $data[$sort_option . '_sk'] == $key ? ' selected="selected"' : '';
                        ${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
                    }
                    ${'s_sort_' . $sort_option . '_key'} .= '</select>';
                    ${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
                    foreach ($sort_dir_text as $key => $value) {
                        $selected = $data[$sort_option . '_sd'] == $key ? ' selected="selected"' : '';
                        ${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
                    }
                    ${'s_sort_' . $sort_option . '_dir'} .= '</select>';
                }
                phpbb_timezone_select($template, $user, $data['tz'], true);
                $user_prefs_data = array('S_PREFS' => true, 'S_JABBER_DISABLED' => $config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml') ? false : true, 'VIEW_EMAIL' => $data['viewemail'], 'MASS_EMAIL' => $data['massemail'], 'ALLOW_PM' => $data['allowpm'], 'HIDE_ONLINE' => $data['hideonline'], 'NOTIFY_EMAIL' => $data['notifymethod'] == NOTIFY_EMAIL ? true : false, 'NOTIFY_IM' => $data['notifymethod'] == NOTIFY_IM ? true : false, 'NOTIFY_BOTH' => $data['notifymethod'] == NOTIFY_BOTH ? true : false, 'NOTIFY_PM' => $data['notifypm'], 'BBCODE' => $data['bbcode'], 'SMILIES' => $data['smilies'], 'ATTACH_SIG' => $data['sig'], 'NOTIFY' => $data['notify'], 'VIEW_IMAGES' => $data['view_images'], 'VIEW_FLASH' => $data['view_flash'], 'VIEW_SMILIES' => $data['view_smilies'], 'VIEW_SIGS' => $data['view_sigs'], 'VIEW_AVATARS' => $data['view_avatars'], 'VIEW_WORDCENSOR' => $data['view_wordcensor'], 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir, 'S_POST_SORT_DAYS' => $s_limit_post_days, 'S_POST_SORT_KEY' => $s_sort_post_key, 'S_POST_SORT_DIR' => $s_sort_post_dir, 'DATE_FORMAT' => $data['dateformat'], 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']));
                /**
                 * Modify users preferences data before assigning it to the template
                 *
                 * @event core.acp_users_prefs_modify_template_data
                 * @var	array	data				Array with users preferences data
                 * @var	array	user_row			Array with user data
                 * @var	array	user_prefs_data		Array with users preferences data to be assigned to the template
                 * @since 3.1.0-b3
                 */
                $vars = array('data', 'user_row', 'user_prefs_data');
                extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars)));
                $template->assign_vars($user_prefs_data);
                break;
            case 'avatar':
                $avatars_enabled = false;
                /** @var \phpbb\avatar\manager $phpbb_avatar_manager */
                $phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
                if ($config['allow_avatar']) {
                    $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
                    // This is normalised data, without the user_ prefix
                    $avatar_data = \phpbb\avatar\manager::clean_row($user_row, 'user');
                    if ($submit) {
                        if (check_form_key($form_name)) {
                            $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
                            if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) {
                                $driver = $phpbb_avatar_manager->get_driver($driver_name);
                                $result = $driver->process_form($request, $template, $user, $avatar_data, $error);
                                if ($result && empty($error)) {
                                    // Success! Lets save the result in the database
                                    $result = array('user_avatar_type' => $driver_name, 'user_avatar' => $result['avatar'], 'user_avatar_width' => $result['avatar_width'], 'user_avatar_height' => $result['avatar_height']);
                                    $sql = 'UPDATE ' . USERS_TABLE . '
开发者ID:bantu,项目名称:phpbb,代码行数:67,代码来源:acp_users.php

示例2: timezone_select

 /**
  * Select guest timezone
  */
 function timezone_select($value, $key)
 {
     global $template, $user;
     $timezone_select = phpbb_timezone_select($template, $user, $value, true);
     return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>';
 }
开发者ID:hgchen,项目名称:phpbb,代码行数:9,代码来源:acp_board.php

示例3: main


//.........这里部分代码省略.........
                }
                // Instantiate passwords manager
                $passwords_manager = $phpbb_container->get('passwords.manager');
                $user_row = array('username' => $data['username'], 'user_password' => $passwords_manager->hash($data['new_password']), 'user_email' => $data['email'], 'group_id' => (int) $group_id, 'user_timezone' => $data['tz'], 'user_lang' => $data['lang'], 'user_type' => $user_type, 'user_actkey' => $user_actkey, 'user_ip' => $this->user->ip, 'user_regdate' => time(), 'user_inactive_reason' => $user_inactive_reason, 'user_inactive_time' => $user_inactive_time);
                if ($this->config['allow_birthdays']) {
                    $user_row['user_birthday'] = $data['user_birthday'];
                }
                // Register user...
                $user_id = user_add($user_row, $cp_data);
                if (!empty($data['group'])) {
                    if (!empty($group_default)) {
                        group_user_add($data['group'], array($user_id), false, false, true);
                    } else {
                        group_user_add($data['group'], array($user_id));
                    }
                }
                $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USER_ADDED', time(), array($data['username']));
                // This should not happen, because the required variables are listed above...
                if ($user_id === false) {
                    trigger_error($this->user->lang['NO_USER'], E_USER_ERROR);
                }
                // send a message to the user...if needed
                $message = array();
                if ($this->config['require_activation'] == USER_ACTIVATION_SELF && $this->config['email_enable']) {
                    $message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE'];
                    $email_template = '@phpbbmodders_adduser/user_added_inactive';
                } else {
                    if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && $this->config['email_enable'] && !$admin_activate) {
                        $message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE_ADMIN'];
                        $email_template = '@phpbbmodders_adduser/user_added_admin_welcome_inactive';
                    } else {
                        $message[] = $this->user->lang['ACP_ACCOUNT_ADDED'];
                        $email_template = '@phpbbmodders_adduser/user_added_welcome';
                    }
                }
                if ($config['email_enable']) {
                    if (!class_exists('messenger')) {
                        include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
                    }
                    $messenger = new \messenger(false);
                    $messenger->template($email_template, $data['lang']);
                    $messenger->to($data['email'], $data['username']);
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $this->user->data['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $this->user->data['username']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . $this->user->ip);
                    $messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($this->user->lang['WELCOME_SUBJECT'], $this->config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
                    $messenger->send(NOTIFY_EMAIL);
                }
                if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && !$admin_activate) {
                    $phpbb_notifications = $phpbb_container->get('notification_manager');
                    $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array('user_id' => $user_id, 'user_actkey' => $user_row['user_actkey'], 'user_regdate' => $user_row['user_regdate']));
                }
                $message[] = sprintf($user->lang['CONTINUE_EDIT_USER'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&amp;mode=overview&amp;u=' . $user_id) . '">', $data['username'], '</a>');
                $message[] = sprintf($user->lang['EDIT_USER_GROUPS'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&amp;mode=groups&amp;u=' . $user_id) . '">', '</a>');
                $message[] = adm_back_link($this->u_action);
                trigger_error(implode('<br />', $message));
            }
        }
        $l_reg_cond = '';
        switch ($this->config['require_activation']) {
            case USER_ACTIVATION_SELF:
                $l_reg_cond = $this->user->lang['ACP_EMAIL_ACTIVATE'];
                break;
            case USER_ACTIVATION_ADMIN:
                $l_reg_cond = $this->user->lang['ACP_ADMIN_ACTIVATE'];
                break;
            default:
                $l_reg_cond = $this->user->lang['ACP_INSTANT_ACTIVATE'];
                break;
        }
        if ($this->config['allow_birthdays']) {
            $s_birthday_day_options = '<option value="0"' . (!$data['bday_day'] ? ' selected="selected"' : '') . '>--</option>';
            for ($i = 1; $i < 32; $i++) {
                $selected = $i == $data['bday_day'] ? ' selected="selected"' : '';
                $s_birthday_day_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
            }
            $s_birthday_month_options = '<option value="0"' . (!$data['bday_month'] ? ' selected="selected"' : '') . '>--</option>';
            for ($i = 1; $i < 13; $i++) {
                $selected = $i == $data['bday_month'] ? ' selected="selected"' : '';
                $s_birthday_month_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
            }
            $s_birthday_year_options = '';
            $now = getdate();
            $s_birthday_year_options = '<option value="0"' . (!$data['bday_year'] ? ' selected="selected"' : '') . '>--</option>';
            for ($i = $now['year'] - 100; $i <= $now['year']; $i++) {
                $selected = $i == $data['bday_year'] ? ' selected="selected"' : '';
                $s_birthday_year_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
            }
            unset($now);
            $this->template->assign_vars(array('S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, 'S_BIRTHDAYS_ENABLED' => true));
        }
        // Get the groups, so that the user can be added to them
        $s_group_options = $this->get_groups($group_selected);
        $timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true);
        $this->template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'NEW_USERNAME' => $data['username'], 'EMAIL' => $data['email'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'L_PASSWORD_EXPLAIN' => $this->user->lang($config['pass_complex'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_pass_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_pass_chars'])) . ' ' . $this->user->lang['PASSWORD_EXPLAIN'], 'L_USERNAME_EXPLAIN' => $this->user->lang($config['allow_name_chars'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_name_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_name_chars'])), 'L_ADD_USER_EXPLAIN' => sprintf($this->user->lang['ADD_USER_EXPLAIN'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=acp_board&amp;mode=registration') . '">', '</a>'), 'L_REG_COND' => $l_reg_cond, 'L_MOD_VERSION' => sprintf($this->user->lang['MOD_VERSION'], $this->config['adduser_version']), 'S_USER_ADD' => true, 'S_GROUP_OPTIONS' => $s_group_options, 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_ADMIN_ACTIVATE' => $this->config['require_activation'] == USER_ACTIVATION_ADMIN ? true : false, 'U_ADMIN_ACTIVATE' => $admin_activate ? 'checked="checked"' : '', 'U_GROUP_DEFAULT' => $group_default ? 'checked="checked"' : ''));
        $this->user->profile_fields = array();
        // Generate profile fields -> Template Block Variable profile_fields
        $cp->generate_profile_fields('register', $user->get_iso_lang_id());
    }
开发者ID:Wieniec,项目名称:phpbb-3.1-ext-adduser,代码行数:101,代码来源:adduser_module.php

示例4: main


//.........这里部分代码省略.........
                 * user_add allows adding more data into the users table
                 *
                 * @event core.ucp_register_user_row_after
                 * @var	bool	submit		Do we display the form only
                 *							or did the user press submit
                 * @var	array	cp_data		Array with custom profile fields data
                 * @var	array	user_row	Array with current ucp registration data
                 * @since 3.1.4-RC1
                 */
                $vars = array('submit', 'cp_data', 'user_row');
                extract($phpbb_dispatcher->trigger_event('core.ucp_register_user_row_after', compact($vars)));
                // Register user...
                $user_id = user_add($user_row, $cp_data);
                // This should not happen, because the required variables are listed above...
                if ($user_id === false) {
                    trigger_error('NO_USER', E_USER_ERROR);
                }
                // Okay, captcha, your job is done.
                if ($config['enable_confirm'] && isset($captcha)) {
                    $captcha->reset();
                }
                if ($coppa && $config['email_enable']) {
                    $message = $user->lang['ACCOUNT_COPPA'];
                    $email_template = 'coppa_welcome_inactive';
                } else {
                    if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) {
                        $message = $user->lang['ACCOUNT_INACTIVE'];
                        $email_template = 'user_welcome_inactive';
                    } else {
                        if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) {
                            $message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
                            $email_template = 'admin_welcome_inactive';
                        } else {
                            $message = $user->lang['ACCOUNT_ADDED'];
                            $email_template = 'user_welcome';
                        }
                    }
                }
                if ($config['email_enable']) {
                    include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                    $messenger = new messenger(false);
                    $messenger->template($email_template, $data['lang']);
                    $messenger->to($data['email'], $data['username']);
                    $messenger->anti_abuse_headers($config, $user);
                    $messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
                    if ($coppa) {
                        $messenger->assign_vars(array('FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $data['email']));
                    }
                    $messenger->send(NOTIFY_EMAIL);
                }
                if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                    /* @var $phpbb_notifications \phpbb\notification\manager */
                    $phpbb_notifications = $phpbb_container->get('notification_manager');
                    $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array('user_id' => $user_id, 'user_actkey' => $user_row['user_actkey'], 'user_regdate' => $user_row['user_regdate']));
                }
                // Perform account linking if necessary
                if (!empty($login_link_data)) {
                    $login_link_data['user_id'] = $user_id;
                    $result = $auth_provider->link_account($login_link_data);
                    if ($result) {
                        $message = $message . '<br /><br />' . $user->lang[$result];
                    }
                }
                $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
                trigger_error($message);
            }
        }
        $s_hidden_fields = array_merge($s_hidden_fields, array('agreed' => 'true', 'change_lang' => 0));
        if ($config['coppa_enable']) {
            $s_hidden_fields['coppa'] = $coppa;
        }
        if ($config['enable_confirm']) {
            $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields());
        }
        $s_hidden_fields = build_hidden_fields($s_hidden_fields);
        $confirm_image = '';
        // Visual Confirmation - Show images
        if ($config['enable_confirm']) {
            $template->assign_vars(array('CAPTCHA_TEMPLATE' => $captcha->get_template()));
        }
        //
        $l_reg_cond = '';
        switch ($config['require_activation']) {
            case USER_ACTIVATION_SELF:
                $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
                break;
            case USER_ACTIVATION_ADMIN:
                $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
                break;
        }
        $timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true);
        $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'EMAIL' => $data['email'], 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_PRESELECT' => !$submit, 'S_CONFIRM_REFRESH' => $config['enable_confirm'] && $config['confirm_refresh'] ? true : false, 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register'), 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path']));
        //
        $user->profile_fields = array();
        // Generate profile fields -> Template Block Variable profile_fields
        $cp->generate_profile_fields('register', $user->get_iso_lang_id());
        //
        $this->tpl_name = 'ucp_register';
        $this->page_title = 'UCP_REGISTRATION';
    }
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:101,代码来源:ucp_register.php

示例5: tz_select

/**
* Pick a timezone
*
* @param	string		$default			A timezone to select
* @param	boolean		$truncate			Shall we truncate the options text
*
* @return		string		Returns the options for timezone selector only
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
*/
function tz_select($default = '', $truncate = false)
{
    global $template, $user;
    return phpbb_timezone_select($template, $user, $default, $truncate);
}
开发者ID:phpbb,项目名称:phpbb,代码行数:15,代码来源:functions_compatibility.php

示例6: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
        $submit = isset($_POST['submit']) ? true : false;
        $error = $data = array();
        $s_hidden_fields = '';
        switch ($mode) {
            case 'personal':
                add_form_key('ucp_prefs_personal');
                $data = array('notifymethod' => request_var('notifymethod', $user->data['user_notify_type']), 'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true), 'lang' => basename(request_var('lang', $user->data['user_lang'])), 'user_style' => request_var('user_style', (int) $user->data['user_style']), 'tz' => request_var('tz', $user->data['user_timezone']), 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']), 'hideonline' => request_var('hideonline', (bool) (!$user->data['user_allow_viewonline'])), 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']));
                if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) {
                    // Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
                    $data['notifymethod'] = NOTIFY_BOTH;
                }
                /**
                 * Add UCP edit global settings data before they are assigned to the template or submitted
                 *
                 * To assign data to the template, use $template->assign_vars()
                 *
                 * @event core.ucp_prefs_personal_data
                 * @var	bool	submit		Do we display the form only
                 *							or did the user press submit
                 * @var	array	data		Array with current ucp options data
                 * @var	array	error		Array with list of errors
                 * @since 3.1.0-a1
                 * @changed 3.1.4-rc1 Added error variable to the event
                 */
                $vars = array('submit', 'data', 'error');
                extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
                if ($submit) {
                    if ($config['override_user_style']) {
                        $data['user_style'] = (int) $config['default_style'];
                    } else {
                        if (!phpbb_style_is_active($data['user_style'])) {
                            $data['user_style'] = (int) $user->data['user_style'];
                        }
                    }
                    $error = array_merge(validate_data($data, array('dateformat' => array('string', false, 1, 30), 'lang' => array('language_iso_name'), 'tz' => array('timezone'))), $error);
                    if (!check_form_key('ucp_prefs_personal')) {
                        $error[] = 'FORM_INVALID';
                    }
                    if (!sizeof($error)) {
                        $sql_ary = array('user_allow_pm' => $data['allowpm'], 'user_allow_viewemail' => $data['viewemail'], 'user_allow_massemail' => $data['massemail'], 'user_allow_viewonline' => $auth->acl_get('u_hideonline') ? !$data['hideonline'] : $user->data['user_allow_viewonline'], 'user_notify_type' => $data['notifymethod'], 'user_options' => $user->data['user_options'], 'user_dateformat' => $data['dateformat'], 'user_lang' => $data['lang'], 'user_timezone' => $data['tz'], 'user_style' => $data['user_style']);
                        /**
                         * Update UCP edit global settings data on form submit
                         *
                         * @event core.ucp_prefs_personal_update_data
                         * @var	array	data		Submitted display options data
                         * @var	array	sql_ary		Display options data we update
                         * @since 3.1.0-a1
                         */
                        $vars = array('data', 'sql_ary');
                        extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_update_data', compact($vars)));
                        $sql = 'UPDATE ' . USERS_TABLE . '
							SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
							WHERE user_id = ' . $user->data['user_id'];
                        $db->sql_query($sql);
                        meta_refresh(3, $this->u_action);
                        $message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = array_map(array($user, 'lang'), $error);
                }
                $dateformat_options = '';
                foreach ($user->lang['dateformats'] as $format => $null) {
                    $dateformat_options .= '<option value="' . $format . '"' . ($format == $data['dateformat'] ? ' selected="selected"' : '') . '>';
                    $dateformat_options .= $user->format_date(time(), $format, false) . (strpos($format, '|') !== false ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
                    $dateformat_options .= '</option>';
                }
                $s_custom = false;
                $dateformat_options .= '<option value="custom"';
                if (!isset($user->lang['dateformats'][$data['dateformat']])) {
                    $dateformat_options .= ' selected="selected"';
                    $s_custom = true;
                }
                $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
                phpbb_timezone_select($template, $user, $data['tz'], true);
                // check if there are any user-selectable languages
                $sql = 'SELECT COUNT(lang_id) as languages_count
								FROM ' . LANG_TABLE;
                $result = $db->sql_query($sql);
                if ($db->sql_fetchfield('languages_count') > 1) {
                    $s_more_languages = true;
                } else {
                    $s_more_languages = false;
                }
                $db->sql_freeresult($result);
                // check if there are any user-selectable styles
                $sql = 'SELECT COUNT(style_id) as styles_count
								FROM ' . STYLES_TABLE . '
								WHERE style_active = 1';
                $result = $db->sql_query($sql);
                if ($db->sql_fetchfield('styles_count') > 1) {
                    $s_more_styles = true;
                } else {
                    $s_more_styles = false;
                }
                $db->sql_freeresult($result);
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_NOTIFY_EMAIL' => $data['notifymethod'] == NOTIFY_EMAIL ? true : false, 'S_NOTIFY_IM' => $data['notifymethod'] == NOTIFY_IM ? true : false, 'S_NOTIFY_BOTH' => $data['notifymethod'] == NOTIFY_BOTH ? true : false, 'S_VIEW_EMAIL' => $data['viewemail'], 'S_MASS_EMAIL' => $data['massemail'], 'S_ALLOW_PM' => $data['allowpm'], 'S_HIDE_ONLINE' => $data['hideonline'], 'DATE_FORMAT' => $data['dateformat'], 'A_DATE_FORMAT' => addslashes($data['dateformat']), 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), 'S_MORE_LANGUAGES' => $s_more_languages, 'S_MORE_STYLES' => $s_more_styles, 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => $config['override_user_style'] ? '' : style_select($data['user_style']), 'S_CAN_HIDE_ONLINE' => $auth->acl_get('u_hideonline') ? true : false, 'S_SELECT_NOTIFY' => $config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml') ? true : false));
//.........这里部分代码省略.........
开发者ID:Voxel37,项目名称:phpbb,代码行数:101,代码来源:ucp_prefs.php


注:本文中的phpbb_timezone_select函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。