本文整理汇总了PHP中style_select函数的典型用法代码示例。如果您正苦于以下问题:PHP style_select函数的具体用法?PHP style_select怎么用?PHP style_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了style_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Show admin bar
*/
public function show($route_info)
{
$this->user->add_lang_ext('blitze/sitemaker', 'block_manager');
$this->phpbb_container->get('blitze.sitemaker.auto_lang')->add('blocks_admin');
$route = $route_info['route'];
$style_id = $route_info['style'];
$this->get_available_blocks();
$this->get_startpage_options();
$this->set_javascript_data($route, $style_id);
$this->set_assets();
$this->template->assign_vars(array('S_EDIT_MODE' => true, 'S_ROUTE_OPS' => $this->get_route_options($route), 'S_HIDE_BLOCKS' => $route_info['hide_blocks'], 'S_POSITION_OPS' => $this->get_excluded_position_options($route_info['ex_positions']), 'S_EX_POSITIONS' => join(', ', $route_info['ex_positions']), 'S_STYLE_OPTIONS' => style_select($style_id, true), 'ICON_PICKER' => $this->icons->picker()));
}
示例2: select_style
/**
*/
function select_style()
{
global $config, $template, $user, $phpbb_root_path, $phpEx;
if (PRIME_QUICK_STYLE_ENABLED && (PRIME_QUICK_STYLE_GUEST || $user->data['is_registered']) && !$config['override_user_style']) {
$current_style = $user->data['is_registered'] ? $user->data['user_style'] : $this->request_cookie('style', $user->data['user_style']);
$style_options = style_select(request_var('style', (int) $current_style));
if (substr_count($style_options, '<option') > 1) {
//$user->add_lang('mods/prime_quick_style');
$redirect = $user->page['page_dir'] ? '' : '&redirect=' . urlencode(str_replace('&', '&', build_url(array('_f_', 'style'))));
$template->assign_var('S_QUICK_STYLE_ACTION', append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=prefs&mode=personal' . $redirect));
$template->assign_var('S_QUICK_STYLE_OPTIONS', $config['override_user_style'] ? '' : $style_options);
}
}
}
示例3: get_template_side
public function get_template_side($module_id)
{
global $config, $template, $db, $phpEx, $phpbb_root_path, $user;
$style_count = 0;
$style_select = '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY LOWER(style_name) ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$style = request_var('style', 0);
if($style)
{
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], append_sid("{$phpbb_root_path}portal.$phpEx"));
}
else
{
$url = append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']);
}
++$style_count;
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $user->theme['style_id'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($row['style_name']) . '</option>';
}
$db->sql_freeresult($result);
if(strlen($style_select))
{
$template->assign_var('STYLE_SELECT', $style_select);
}
// Assign specific vars
$template->assign_vars(array(
'S_STYLE_OPTIONS' => ($config['override_user_style'] || $style_count < 2) ? '' : style_select($user->data['user_style']),
));
return 'stylechanger_side.html';
}
示例4: language_select
'POPUP_PM_NO' => ( !$popuppm ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
'AVATAR' => $avatar_img,
'AVATAR_SIZE' => $board_config['avatar_filesize'],
'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
'STYLE_SELECT' => style_select($user_style, 'style'),
'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
'DATE_FORMAT' => $user_dateformat,
'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.php?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status,
'L_CURRENT_PASSWORD' => $lang['Current_password'],
'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'L_ICQ_NUMBER' => $lang['ICQ'],
示例5: main
//.........这里部分代码省略.........
if (!$update) {
$forum_data = array('parent_id' => BUGS_FORUM_ID, 'forum_type' => FORUM_POST, 'forum_status' => ITEM_UNLOCKED, 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'project_idname' => '', 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => '', 'forum_rules' => '', 'forum_rules_link' => '', 'forum_image' => '', 'forum_style' => 0, 'display_on_index' => false, 'forum_topics_per_page' => 0, 'enable_indexing' => true, 'enable_icons' => false, 'enable_prune' => false, 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, 'forum_flags' => FORUM_FLAG_POST_REVIEW, 'forum_password' => '', 'forum_password_confirm' => '');
}
}
$forum_rules_data = array('text' => $forum_data['forum_rules'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
$forum_desc_data = array('text' => $forum_data['forum_desc'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
$forum_rules_preview = '';
// Parse rules if specified
if ($forum_data['forum_rules']) {
if (!isset($forum_data['forum_rules_uid'])) {
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_rules_uid'] = '';
$forum_data['forum_rules_bitfield'] = '';
$forum_data['forum_rules_options'] = 0;
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false));
}
// Generate preview content
$forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
// decode...
$forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']);
}
// Parse desciption if specified
if ($forum_data['forum_desc']) {
if (!isset($forum_data['forum_desc_uid'])) {
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_desc_uid'] = '';
$forum_data['forum_desc_bitfield'] = '';
$forum_data['forum_desc_options'] = 0;
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false));
}
// decode...
$forum_desc_data = generate_text_for_edit($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_options']);
}
$styles_list = style_select($forum_data['forum_style'], true);
$statuslist = '<option value="' . ITEM_UNLOCKED . '"' . ($forum_data['forum_status'] == ITEM_UNLOCKED ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . ($forum_data['forum_status'] == ITEM_LOCKED ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . "\n\t\t\t\t\t\t\tAND forum_id <> {$forum_id}";
$result = $db->sql_query($sql);
if ($db->sql_fetchrow($result)) {
$template->assign_vars(array('S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)));
}
$db->sql_freeresult($result);
// Subforum move options
if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT) {
$subforums_id = array();
$subforums = get_forum_branch($forum_id, 'children');
foreach ($subforums as $row) {
$subforums_id[] = $row['forum_id'];
}
$forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . "\n\t\t\t\t\t\t\t\tAND forum_id <> {$forum_id}";
$result = $db->sql_query($sql);
if ($db->sql_fetchrow($result)) {
$template->assign_vars(array('S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)));
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_HAS_SUBFORUMS' => $forum_data['right_id'] - $forum_data['left_id'] > 1 ? true : false, 'S_FORUMS_LIST' => $forums_list));
}
$s_show_display_on_index = false;
if ($forum_data['parent_id'] > 0) {
// if this forum is a subforum put the "display on index" checkbox
if ($parent_info = $this->parent->get_forum_info($forum_data['parent_id'])) {
if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT) {
示例6: style_select
$db->sql_freeresult($result);
?>
<tr>
<td>
<table border="0" cellspacing="2" cellpadding="0">
<?php
if ($themes_count != 0) {
?>
<tr>
<td><input type="radio" name="method" value="select_theme" checked="checked" /></td>
<td><?php
echo $lang['select_theme'];
?>
</td>
<td><?php
echo style_select('new_style');
?>
</td>
</tr>
<?php
}
?>
<tr>
<td><input type="radio" name="method" value="recreate_theme"<?php
echo $themes_count == 0 ? ' checked="checked"' : '';
?>
/></td>
<td colspan="2"><?php
echo $lang['reset_thmeme'];
?>
</td>
示例7: message_die
message_die(GENERAL_ERROR, 'Could not select forum data', '', __LINE__, __FILE__, $sql);
}
$forums = array();
if ($db->sql_numrows($result) != 0) {
$template->assign_block_vars('forums_exist', array());
$last_cat_id = -1;
$forums_list = '';
while ($row = $db->sql_fetchrow($result)) {
if ($row['cat_id'] != $last_cat_id) {
$forums_list .= '<optgroup label="' . $row['cat_title'] . '">';
$last_cat_id = $row['cat_id'];
}
$forums_list .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>';
}
}
$styles_list = style_select('', 'style_type');
$lastvisited = array(1, 7, 14, 30, 60, 120, 365, 500, 730, 1000);
$lastvisited_list = '';
foreach ($lastvisited as $days) {
$lastvisited_list .= '<option value="' . $days . '">' . $days . ' ' . ($days > 1 ? $lang['Days'] : $lang['Day']) . '</option>';
}
$template->set_filenames(array("body" => "admin/admin_user_search_form.tpl"));
$template->assign_vars(array('L_USER_SEARCH' => $lang['Search_users_advanced'], 'L_SEARCH_EXPLAIN' => $lang['Search_users_explain'], 'L_SEARCH' => $lang['Search'], 'L_USERNAME' => $lang['Username'], 'L_USERNAME_EXPLAIN' => $lang['Search_username_explain'], 'L_EMAIL' => $lang['Email_address'], 'L_EMAIL_EXPLAIN' => $lang['Search_email_explain'], 'L_IP' => $lang['IP_Address'], 'L_IP_EXPLAIN' => $lang['Search_ip_explain'], 'L_USERS_JOINED' => $lang['Search_users_joined'], 'L_BEFORE' => $lang['Before'], 'L_AFTER' => $lang['After'], 'L_REGEX' => $lang['Regular_expression'], 'L_JOIN_DATE_EXPLAIN' => $lang['Search_users_joined_explain'], 'L_GROUP_MEMBERS' => $lang['Group_Members'], 'L_GROUP_EXPLAIN' => $lang['Search_users_groups_explain'], 'L_ADMINS' => $lang['Administrators'], 'L_MODS' => $lang['Moderators'], 'L_BANNED_USERS' => $lang['Banned_users'], 'L_DISABLED_USERS' => $lang['Disabled_users'], 'L_USERS_DISABLED_PMS' => $lang['Users_disabled_pms'], 'L_POSTCOUNT' => $lang['Postcount'], 'L_POSTCOUNT_EXPLAIN' => $lang['Search_users_postcount_explain'], 'L_EQUALS' => $lang['Equals'], 'L_GREATERTHAN' => $lang['Greater_than'], 'L_LESSERTHAN' => $lang['Less_than'], 'L_USERFIELD' => $lang['Userfield'], 'L_USERFIELD_EXPLAIN' => $lang['Search_users_userfield_explain'], 'L_ICQ' => $lang['ICQ'], 'L_AIM' => $lang['AIM'], 'L_YAHOO' => $lang['YIM'], 'L_MSN' => $lang['MSNM'], 'L_WEBSITE' => $lang['Website'], 'L_LOCATION' => $lang['Location'], 'L_INTERESTS' => $lang['Interests'], 'L_OCCUPATION' => $lang['Occupation'], 'L_LASTVISITED' => $lang['Search_users_lastvisited'], 'L_IN_THE_LAST' => $lang['in_the_last'], 'L_AFTER_THE_LAST' => $lang['after_the_last'], 'L_LASTVISITED_EXPLAIN' => $lang['Search_users_lastvisited_explain'], 'L_LANGUAGE' => $lang['Board_lang'], 'L_LANGUAGE_EXPLAIN' => $lang['Search_users_language_explain'], 'L_TIMEZONE' => $lang['Timezone'], 'L_TIMEZONE_EXPLAIN' => $lang['Search_users_timezone_explain'], 'L_STYLE' => $lang['Board_style'], 'L_STYLE_EXPLAIN' => $lang['Search_users_style_explain'], 'L_MODERATORS_OF' => $lang['Moderators_of'], 'L_MODERATORS_OF_EXPLAIN' => $lang['Search_users_moderators_explain'], 'L_MISC_EXPLAIN' => $lang['Search_users_misc_explain'], 'YEAR' => date("Y"), 'MONTH' => date("m"), 'DAY' => date("d"), 'GROUP_LIST' => $group_list, 'LANGUAGE_LIST' => $language_list, 'TIMEZONE_LIST' => $timezone_list, 'FORUMS_LIST' => $forums_list, 'STYLE_LIST' => $styles_list, 'LASTVISITED_LIST' => $lastvisited_list, 'S_SEARCH_ACTION' => append_sid("admin_user_search.{$phpEx}")));
} else {
$mode = '';
// validate mode
if (isset($HTTP_POST_VARS['search_username']) || isset($HTTP_GET_VARS['search_username'])) {
$mode = 'search_username';
} else {
if (isset($HTTP_POST_VARS['search_email']) || isset($HTTP_GET_VARS['search_email'])) {
$mode = 'search_email';
示例8: main
//.........这里部分代码省略.........
if (!$bot_row) {
$error[] = $user->lang['NO_BOT'];
} else {
$bot_name = $row['username_clean'];
}
}
if (!$this->validate_botname($bot_row['bot_name'], $bot_name)) {
$error[] = $user->lang['BOT_NAME_TAKEN'];
}
if (!sizeof($error)) {
// New bot? Create a new user and group entry
if ($action == 'add') {
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE group_name = 'BOTS'\n\t\t\t\t\t\t\t\t\tAND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$group_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$group_row) {
trigger_error($user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&id={$bot_id}&action={$action}"), E_USER_WARNING);
}
$user_id = user_add(array('user_type' => (int) USER_IGNORE, 'group_id' => (int) $group_row['group_id'], 'username' => (string) $bot_row['bot_name'], 'user_regdate' => time(), 'user_password' => '', 'user_colour' => (string) $group_row['group_colour'], 'user_email' => '', 'user_lang' => (string) $bot_row['bot_lang'], 'user_style' => (int) $bot_row['bot_style'], 'user_allow_massemail' => 0));
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array('user_id' => (int) $user_id, 'bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']));
$db->sql_query($sql);
$log = 'ADDED';
} else {
if ($bot_id) {
$sql = 'SELECT user_id, bot_name
FROM ' . BOTS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE bot_id = {$bot_id}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$row) {
trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id={$bot_id}&action={$action}"), E_USER_WARNING);
}
$sql_ary = array('user_style' => (int) $bot_row['bot_style'], 'user_lang' => (string) $bot_row['bot_lang']);
if ($bot_row['bot_name'] !== $row['bot_name']) {
$sql_ary['username'] = (string) $bot_row['bot_name'];
$sql_ary['username_clean'] = (string) utf8_clean_string($bot_row['bot_name']);
}
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$row['user_id']}";
$db->sql_query($sql);
$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array('bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip'])) . " WHERE bot_id = {$bot_id}";
$db->sql_query($sql);
// Updated username?
if ($bot_row['bot_name'] !== $row['bot_name']) {
user_update_name($row['bot_name'], $bot_row['bot_name']);
}
$log = 'UPDATED';
}
}
$cache->destroy('_bots');
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));
}
} else {
if ($bot_id) {
$sql = 'SELECT b.*, u.user_lang, u.user_style
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u\n\t\t\t\t\t\tWHERE b.bot_id = {$bot_id}\n\t\t\t\t\t\t\tAND u.user_id = b.user_id";
$result = $db->sql_query($sql);
$bot_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$bot_row) {
trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id={$bot_id}&action={$action}"), E_USER_WARNING);
}
$bot_row['bot_lang'] = $bot_row['user_lang'];
$bot_row['bot_style'] = $bot_row['user_style'];
unset($bot_row['user_lang'], $bot_row['user_style']);
}
}
$s_active_options = '';
$_options = array('0' => 'NO', '1' => 'YES');
foreach ($_options as $value => $lang) {
$selected = $bot_row['bot_active'] == $value ? ' selected="selected"' : '';
$s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
}
$style_select = style_select($bot_row['bot_style'], true);
$lang_select = language_select($bot_row['bot_lang']);
$l_title = $action == 'edit' ? 'EDIT' : 'ADD';
$template->assign_vars(array('L_TITLE' => $user->lang['BOT_' . $l_title], 'U_ACTION' => $this->u_action . "&id={$bot_id}&action={$action}", 'U_BACK' => $this->u_action, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'BOT_NAME' => $bot_row['bot_name'], 'BOT_IP' => $bot_row['bot_ip'], 'BOT_AGENT' => $bot_row['bot_agent'], 'S_EDIT_BOT' => true, 'S_ACTIVE_OPTIONS' => $s_active_options, 'S_STYLE_OPTIONS' => $style_select, 'S_LANG_OPTIONS' => $lang_select, 'S_ERROR' => sizeof($error) ? true : false));
return;
break;
}
$s_options = '';
$_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');
foreach ($_options as $value => $lang) {
$s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>';
}
$template->assign_vars(array('U_ACTION' => $this->u_action, 'S_BOT_OPTIONS' => $s_options));
$sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u
WHERE u.user_id = b.user_id
ORDER BY u.user_lastvisit DESC, b.bot_name ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$active_lang = !$row['bot_active'] ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE';
$active_value = !$row['bot_active'] ? 'activate' : 'deactivate';
$template->assign_block_vars('bots', array('BOT_NAME' => $row['bot_name'], 'BOT_ID' => $row['bot_id'], 'LAST_VISIT' => $row['user_lastvisit'] ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER'], 'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&id={$row['bot_id']}&action={$active_value}", 'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang], 'U_EDIT' => $this->u_action . "&id={$row['bot_id']}&action=edit", 'U_DELETE' => $this->u_action . "&id={$row['bot_id']}&action=delete"));
}
$db->sql_freeresult($result);
}
示例9: generic_select
if ($error) {
$template->set_filenames(array('reg_header' => 'error_body.tpl'));
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
$template->set_filenames(array('body' => 'prillian/prefs_body.tpl'));
$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" /><input type="hidden" name="mode" value="editprofile" /><input type="hidden" name="cm1" value="' . $client_mode . '" /><input type="hidden" name="cm2" value="' . $client_mode2 . '" />';
$checked = 'checked="checked"';
if ($prill_config['refresh_drop']) {
$refresh_rate = generic_select($refresh_rate, 'refresh_rate', 'Refresh_times');
$rate_explain = $lang['Refresh_rate_explain2'];
} else {
$refresh_rate = '<input type="text" size="5" maxlength="5" name="refresh_rate" value="' . $refresh_rate . '" />';
$rate_explain = $lang['Refresh_rate_explain1'];
}
if ($prill_config['themes_allow']) {
include_once $phpbb_root_path . 'includes/functions_selects.' . $phpEx;
$template->assign_block_vars('switch_style', array('L_IM_STYLE' => $lang['IM_style'], 'STYLE_SELECT' => style_select($im_userdata['themes_id'], 'themes_id')));
}
if ($prill_config['allow_network']) {
$template->assign_block_vars('switch_network', array('L_ALLOW_NETWORK' => $lang['User_allow_network'], 'ALLOW_NETWORK_YES' => $user_allow_network ? $checked : '', 'ALLOW_NETWORK_NO' => !$user_allow_network ? $checked : ''));
if ($im_userdata['user_allow_network'] && $im_userdata['admin_allow_network']) {
$network_user_list = generic_select($network_user_list, 'network_user_list', 'network_lists');
$template->assign_block_vars('switch_networkusers', array('L_NETWORK_USER_SELECT' => $lang['Network_user_list'], 'NETWORK_USER_SELECT' => $network_user_list));
}
}
$show_controls = generic_select($show_controls, 'show_controls', 'Controls_select');
$list_all_online = generic_select($list_all_online, 'list_all_online', 'Online_Lists');
$default_mode = MAIN_MODE;
print_controls('?mode=' . $client_mode . '&mode2' . $client_mode2, $client_mode, $client_mode2);
$template->assign_vars(array('IMG_LOGO' => $images['prill_logo'], 'L_PRILLIAN' => $lang['Prillian'], 'S_PREFS_ACTION' => append_sid(PRILL_URL), 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_PREFS' => $lang['Preferences'], 'L_ALLOW_IMS' => $lang['User_allow_ims'], 'L_ALLOW_SHOUT' => $lang['User_allow_shout'], 'L_ALLOW_CHAT' => $lang['User_allow_chat'], 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 'L_ALWAYS_ADD_SIGNATURE_EXPLAIN' => $lang['Always_add_sig_explain'], 'L_REFRESH_RATE' => $lang['Refresh_rate'], 'L_REFRESH_RATE_EXPLAIN' => $rate_explain, 'L_REFRESH_METHOD' => $lang['Refresh_method'], 'L_REFRESH_METHOD_EXPLAIN' => $lang['Refresh_method_explain'], 'L_JAVASCRIPT' => $lang['JavaScript'], 'L_META' => $lang['META_tag'], 'L_BOTH' => $lang['Use_both_methods'], 'L_AUTO_LAUNCH' => $lang['IM_auto_launch_pref'], 'L_POPUP_IMS' => $lang['IM_auto_popup'], 'L_LIST_IMS' => $lang['IM_list_new'], 'L_PLAY_SOUND' => $lang['IM_play_sound'], 'L_SUCCESS_CLOSE' => $lang['Success_close'], 'L_SHOW_CONTROLS' => $lang['Show_controls'], 'L_WHO_TO_LIST' => $lang['Who_to_list'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_SOUND_NAME' => $lang['IM_sound_name'], 'L_DEFAULT_SOUND' => $lang['Default_sound'], 'L_CURRENT_SOUND' => $lang['Current_sound'], 'L_WIDTH' => $lang['Width'], 'L_HEIGHT' => $lang['Height'], 'L_SET_WINDOW_SIZES' => $lang['Set_window_sizes'], 'L_SET_WINDOW_SIZES_EXPLAIN' => $lang['Set_window_sizes_explain'], 'L_MAIN_WINDOW' => $lang['Main_Window'], 'L_SEND_WINDOW' => $lang['Send_Message'], 'L_READ_WINDOW' => $lang['Read_Message'], 'L_AUTO_DELETE' => $lang['Auto_delete_ims'], 'L_USE_FRAMES' => $lang['Use_frames'], 'L_USE_FRAMES_EXPLAIN' => $lang['Use_frames_explain'], 'L_DEFAULT_MODE' => $lang['Default_mode'], 'USE_FRAMES_YES' => $use_frames ? $checked : '', 'USE_FRAMES_NO' => !$use_frames ? $checked : '', 'AUTO_DELETE_YES' => $auto_delete ? $checked : '', 'AUTO_DELETE_NO' => !$auto_delete ? $checked : '', 'ALLOW_IMS_YES' => $user_allow_ims ? $checked : '', 'ALLOW_IMS_NO' => !$user_allow_ims ? $checked : '', 'ALLOW_SHOUT_YES' => $user_allow_shout ? $checked : '', 'ALLOW_SHOUT_NO' => !$user_allow_shout ? $checked : '', 'ALLOW_CHAT_YES' => $user_allow_chat ? $checked : '', 'ALLOW_CHAT_NO' => !$user_allow_chat ? $checked : '', 'ALWAYS_ADD_SIGNATURE_YES' => $attach_sig ? $checked : '', 'ALWAYS_ADD_SIGNATURE_NO' => !$attach_sig ? $checked : '', 'REFRESH_RATE' => $refresh_rate, 'REFRESH_METHOD_YES' => $refresh_method == 1 ? $checked : '', 'REFRESH_METHOD_NO' => !$refresh_method ? $checked : '', 'REFRESH_METHOD_BOTH' => $refresh_method == 2 ? $checked : '', 'AUTO_LAUNCH_YES' => $auto_launch ? $checked : '', 'AUTO_LAUNCH_NO' => !$auto_launch ? $checked : '', 'POPUP_IMS_YES' => $popup_ims ? $checked : '', 'POPUP_IMS_NO' => !$popup_ims ? $checked : '', 'LIST_IMS_YES' => $list_ims ? $checked : '', 'LIST_IMS_NO' => !$list_ims ? $checked : '', 'PLAY_SOUND_YES' => $play_sound ? $checked : '', 'PLAY_SOUND_NO' => !$play_sound ? $checked : '', 'DEFAULT_SOUND_YES' => $default_sound ? $checked : '', 'DEFAULT_SOUND_NO' => !$default_sound ? $checked : '', 'SUCCESS_CLOSE_YES' => $success_close ? $checked : '', 'SUCCESS_CLOSE_NO' => !$success_close ? $checked : '', 'DEFAULT_MODE_SELECT' => $default_mode, 'SHOW_CONTROLS' => $show_controls, 'LIST_ALL_ONLINE' => $list_all_online, 'NORMAL_HEIGHT' => $mode1_height, 'NORMAL_WIDTH' => $mode1_width, 'PREFS_HEIGHT' => $prefs_height, 'PREFS_WIDTH' => $prefs_width, 'READ_HEIGHT' => $read_height, 'READ_WIDTH' => $read_width, 'SEND_HEIGHT' => $send_height, 'SEND_WIDTH' => $send_width, 'SOUND_NAME' => !empty($sound_name) ? $sound_name : $lang['None']));
示例10: message_die
if (!$db->sql_query($val)) {
message_die(GENERAL_ERROR, 'Failed to update general configuration', '', __LINE__, __FILE__, $val);
}
}
$message = $lang['Config_updated'] . '<br /><br />' . sprintf($lang['Click_return_config'], '<a href="' . append_sid("admin_im_config.{$phpEx}") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.{$phpEx}?pane=right") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
$template->set_filenames(array('body' => 'imclient_admin_config.tpl'));
$checked = 'checked="checked"';
//$skip = array('show_controls', 'list_all_online', 'refresh_method', 'network_user_list', 'themes_id', 'refresh_rate', 'session_length', 'flood_interval', 'box_limit', 'mode1_height', 'mode1_width', 'mode2_height', 'mode2_width', 'mode3_height', 'mode3_width', 'read_height', 'read_width', 'send_height', 'send_width', 'sound_name', 'prefs_height', 'prefs_width', 'default_mode', 'network_profile');
$skip = array('show_controls', 'list_all_online', 'refresh_method', 'network_user_list', 'themes_id', 'refresh_rate', 'session_length', 'flood_interval', 'box_limit', 'mode1_height', 'mode1_width', 'read_height', 'read_width', 'send_height', 'send_width', 'sound_name', 'prefs_height', 'prefs_width', 'default_mode', 'network_profile');
$default_mode = MAIN_MODE;
$show_controls = generic_select($new['show_controls'], 'show_controls', 'Controls_select');
$list_all_online = generic_select($new['list_all_online'], 'list_all_online', 'Online_Lists');
$network_user_list = generic_select($new['network_user_list'], 'network_user_list', 'network_lists');
$style_select = style_select($new['themes_id'], 'themes_id');
$refresh_method_both = $new['refresh_method'] == 2 ? $checked : '';
$refresh_method_yes = $new['refresh_method'] == 1 ? $checked : '';
$refresh_method_no = !$new['refresh_method'] ? $checked : '';
$vars = array();
foreach ($new as $key => $val) {
if (!in_array($key, $skip)) {
$vars[strtoupper($key) . '_YES'] = $val ? $checked : '';
$vars[strtoupper($key) . '_NO'] = !$val ? $checked : '';
}
}
$skip = array_slice($skip, 5);
foreach ($skip as $val) {
$vars[strtoupper($val)] = $new[$val];
}
$template->assign_vars($vars);
示例11: main
//.........这里部分代码省略.........
'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'],
'POPUP_PM' => $data['popuppm'],
'DST' => $data['dst'],
'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']),
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
)
);
break;
case 'avatar':
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
if ($submit)
{
if (!check_form_key($form_name))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if (avatar_process_user($error, $user_row))
{
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id']));
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
// Generate users avatar
$avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
示例12: main
//.........这里部分代码省略.........
$post_sk = isset($data['post_sk']) ? $data['post_sk'] : ($user_row['user_post_sortby_type'] ? $user_row['user_post_sortby_type'] : 't');
$topic_sd = isset($data['topic_sd']) ? $data['topic_sd'] : ($user_row['user_topic_sortby_dir'] ? $user_row['user_topic_sortby_dir'] : 'd');
$post_sd = isset($data['post_sd']) ? $data['post_sd'] : ($user_row['user_post_sortby_dir'] ? $user_row['user_post_sortby_dir'] : 'd');
$topic_st = isset($data['topic_st']) ? $data['topic_st'] : ($user_row['user_topic_show_days'] ? $user_row['user_topic_show_days'] : 0);
$post_st = isset($data['post_st']) ? $data['post_st'] : ($user_row['user_post_show_days'] ? $user_row['user_post_show_days'] : 0);
$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 = ${$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 = ${$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 = ${$sort_option . '_sd'} == $key ? ' selected="selected"' : '';
${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
}
$template->assign_vars(array('S_PREFS' => true, 'S_JABBER_DISABLED' => $config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml') ? false : true, 'VIEW_EMAIL' => isset($data['viewemail']) ? $data['viewemail'] : $user_row['user_allow_viewemail'], 'MASS_EMAIL' => isset($data['massemail']) ? $data['massemail'] : $user_row['user_allow_massemail'], 'ALLOW_PM' => isset($data['allowpm']) ? $data['allowpm'] : $user_row['user_allow_pm'], 'HIDE_ONLINE' => isset($data['hideonline']) ? $data['hideonline'] : !$user_row['user_allow_viewonline'], 'NOTIFY_EMAIL' => $notify_method == NOTIFY_EMAIL ? true : false, 'NOTIFY_IM' => $notify_method == NOTIFY_IM ? true : false, 'NOTIFY_BOTH' => $notify_method == NOTIFY_BOTH ? true : false, 'NOTIFY_PM' => isset($data['notifypm']) ? $data['notifypm'] : $user_row['user_notify_pm'], 'POPUP_PM' => isset($data['popuppm']) ? $data['popuppm'] : $this->optionget($user_row, 'popuppm'), 'DST' => isset($data['dst']) ? $data['dst'] : $user_row['user_dst'], 'BBCODE' => isset($data['bbcode']) ? $data['bbcode'] : $this->optionget($user_row, 'bbcode'), 'SMILIES' => isset($data['smilies']) ? $data['smilies'] : $this->optionget($user_row, 'smilies'), 'ATTACH_SIG' => isset($data['sig']) ? $data['sig'] : $this->optionget($user_row, 'attachsig'), 'NOTIFY' => isset($data['notify']) ? $data['notify'] : $user_row['user_notify'], 'VIEW_IMAGES' => isset($data['view_images']) ? $data['view_images'] : $this->optionget($user_row, 'viewimg'), 'VIEW_FLASH' => isset($data['view_flash']) ? $data['view_flash'] : $this->optionget($user_row, 'viewflash'), 'VIEW_SMILIES' => isset($data['view_smilies']) ? $data['view_smilies'] : $this->optionget($user_row, 'viewsmilies'), 'VIEW_SIGS' => isset($data['view_sigs']) ? $data['view_sigs'] : $this->optionget($user_row, 'viewsigs'), 'VIEW_AVATARS' => isset($data['view_avatars']) ? $data['view_avatars'] : $this->optionget($user_row, 'viewavatars'), 'VIEW_WORDCENSOR' => isset($data['view_wordcensor']) ? $data['view_wordcensor'] : $this->optionget($user_row, 'viewcensors'), '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' => $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($lang), 'S_STYLE_OPTIONS' => style_select($style), 'S_TZ_OPTIONS' => tz_select($tz)));
break;
case 'avatar':
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
$can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
$data = array();
if ($submit) {
$delete = request_var('delete', '');
$var_ary = array('uploadurl' => (string) '', 'remotelink' => (string) '', 'width' => (string) '', 'height' => (string) '');
foreach ($var_ary as $var => $default) {
$data[$var] = request_var($var, $default);
}
$var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
$error = validate_data($data, $var_ary);
if (!sizeof($error)) {
$data['user_id'] = $user_id;
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload && $config['allow_avatar_upload']) {
list($type, $filename, $width, $height) = avatar_upload($data, $error);
} else {
if ($data['remotelink'] && $config['allow_avatar_remote']) {
list($type, $filename, $width, $height) = avatar_remote($data, $error);
} else {
if ($avatar_select && $config['allow_avatar_local']) {
$type = AVATAR_GALLERY;
$filename = $avatar_select;
// check avatar gallery
if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
$type = $width = $height = 0;
$filename = '';
} else {
list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
$filename = $category . '/' . $filename;
示例13: 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));
//.........这里部分代码省略.........
示例14: display
/**
* {@inheritdoc}
*/
public function display(array $settings, $edit_mode = false)
{
$this->ptemplate->assign_vars(array('CURRENT_PAGE' => build_url(array('style')), 'S_STYLE_OPTIONS' => style_select($this->blocks_display->get_style_id(), true)));
return array('title' => 'STYLE_SWITCHER', 'content' => $this->ptemplate->render_view('blitze/sitemaker', 'blocks/style_switcher.html', 'style_switcher_block'));
}
示例15: test_style_select
/**
* @dataProvider style_select_data
*/
public function test_style_select($default, $all, $expected)
{
global $db;
$db = $this->new_dbal();
$this->assertEquals($expected, style_select($default, $all));
}