本文整理汇总了PHP中phpbb\request\request::is_set_post方法的典型用法代码示例。如果您正苦于以下问题:PHP request::is_set_post方法的具体用法?PHP request::is_set_post怎么用?PHP request::is_set_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\request\request
的用法示例。
在下文中一共展示了request::is_set_post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage_list
/**
* @param string $list_name whitelist or blacklist
* @param string $u_action phpbb acp-u_action
*/
private function manage_list($u_action, $list_name)
{
$list_name_upper = strtoupper($list_name);
// Define the name of the form for use as a form key
$form_name = 'topictags';
add_form_key($form_name);
$errors = array();
if ($this->request->is_set_post('submit')) {
if (!check_form_key($form_name)) {
trigger_error('FORM_INVALID');
}
$this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
$list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
if (!empty($list)) {
$list = json_decode($list, true);
$tags = array();
for ($i = 0, $size = sizeof($list); $i < $size; $i++) {
$tags[] = $list[$i]['text'];
}
$list = json_encode($tags);
}
// store the list
$this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
}
// display
$list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
$list = base64_encode(rawurlencode($list));
$this->template->assign_vars(array('TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']), 'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'], 'TOPICTAGS_' . $list_name_upper => $list, 'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true, 'S_RH_TOPICTAGS_INCLUDE_CSS' => true, 'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false', 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'U_ACTION' => $u_action));
}
示例2: main
public function main($id, $mode)
{
global $config, $request, $template, $user;
$this->config = $config;
$this->request = $request;
$this->template = $template;
$this->user = $user;
// Add the common lang file
$this->user->add_lang(array('acp/common'));
// Add the board snowstormlights ACP lang file
$this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
// Load a template from adm/style for our ACP page
$this->tpl_name = 'snowstorm_lights';
// Set the page title for our ACP page
$this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
// Define the name of the form for use as a form key
$form_key = 'acp_snowstorm_lights';
add_form_key($form_key);
// If form is submitted or previewed
if ($this->request->is_set_post('submit')) {
// Test if form key is valid
if (!check_form_key($form_key)) {
trigger_error('FORM_INVALID');
}
// Store the config enable/disable state
$scl_enabled = $this->request->variable('scl_enabled', 0);
$this->config->set('scl_enabled', $scl_enabled);
$snow_enabled = $request->variable('snow_enabled', 0);
$this->config->set('snow_enabled', $snow_enabled);
// Output message to user for the update
trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
}
// Output data to the template
$this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
}
示例3: main
public function main($id, $mode)
{
global $config, $request, $template, $user;
$this->config = $config;
$this->request = $request;
$this->template = $template;
$this->user = $user;
$this->user->add_lang('acp/common');
$this->user->add_lang_ext('phpbbmodders/holidayflare', 'holidayflare_acp');
$this->tpl_name = 'acp_holidayflare';
$this->page_title = $this->user->lang('ACP_HOLIDAYFLARE');
$form_key = 'acp_holidayflare';
add_form_key($form_key);
if ($this->request->is_set_post('submit')) {
if (!check_form_key($form_key)) {
trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
/* XMAS Start */
$enable_xmas = $this->request->variable('enable_xmas', 0);
$this->config->set('enable_xmas', $enable_xmas);
/* XMAS Stop */
/* Valentine Start */
$enable_valentine = $this->request->variable('enable_valentine', 0);
$this->config->set('enable_valentine', $enable_valentine);
/* Valentine Stop */
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('S_ENABLE_XMAS' => isset($this->config['enable_xmas']) ? $this->config['enable_xmas'] : '', 'S_ENABLE_VALENTINE' => isset($this->config['enable_valentine']) ? $this->config['enable_valentine'] : '', 'U_ACTION' => $this->u_action));
}
示例4: set_personal_settings
protected function set_personal_settings()
{
if ($this->request->is_set_post('submit')) {
$gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false));
$additional_settings = array();
/**
* Event set personal settings
*
* @event phpbbgallery.core.ucp.set_settings_submit
* @var array additional_settings array of additional settings
* @since 1.2.0
*/
$vars = array('additional_settings');
extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars)));
$gallery_settings = array_merge($gallery_settings, $additional_settings);
if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) {
unset($gallery_settings['user_allow_comments']);
}
$this->gallery_user->set_user_id($this->user->data['user_id']);
$this->gallery_user->update_data($gallery_settings);
meta_refresh(3, $this->u_action);
trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
}
/**
* Event no submit personal settings
*
* @event phpbbgallery.core.ucp.set_settings_nosubmit
* @since 1.2.0
*/
$this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit');
$this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control']));
}
示例5: display_options
/**
* Display the options a user can configure for this extension
*
* @return null
* @access public
*/
public function display_options()
{
// Create a form key for preventing CSRF attacks
$form_key = 'sitelogo';
add_form_key($form_key);
// Is the form being submitted
if ($this->request->is_set_post('submit')) {
// Is the submitted form is valid
if (!check_form_key($form_key)) {
trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
// If no errors, process the form data
// Set the options the user configured
$this->set_options();
// Add option settings change action to the admin log
$phpbb_log = $this->container->get('log');
$phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'SITE_LOGO_LOG');
// Option settings have been updated and logged
// Confirm this to the user and provide link back to previous page
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
// Set output vars for display in the template
// Positions
$positions = array();
$positions[] = $this->user->lang('LOGO_LEFT');
$positions[] = $this->user->lang('LOGO_CENTRE');
$positions[] = $this->user->lang('LOGO_RIGHT');
foreach ($positions as $value => $label) {
$this->template->assign_block_vars('positions', array('S_CHECKED' => $this->config['site_logo_position'] == $value ? true : false, 'LABEL' => $label, 'VALUE' => $value));
}
$this->template->assign_vars(array('SITE_LOGO_HEIGHT' => isset($this->config['site_logo_height']) ? $this->config['site_logo_height'] : '', 'SITE_LOGO_IMAGE' => isset($this->config['site_logo_image']) ? $this->config['site_logo_image'] : '', 'SITE_LOGO_LEFT' => isset($this->config['site_logo_left']) ? $this->config['site_logo_left'] : '', 'SITE_LOGO_PIXELS' => isset($this->config['site_logo_pixels']) ? $this->config['site_logo_pixels'] : '', 'SITE_LOGO_REMOVE' => isset($this->config['site_logo_remove']) ? $this->config['site_logo_remove'] : '', 'SITE_LOGO_RIGHT' => isset($this->config['site_logo_right']) ? $this->config['site_logo_right'] : '', 'SITE_LOGO_WIDTH' => isset($this->config['site_logo_width']) ? $this->config['site_logo_width'] : '', 'SITE_NAME_SUPRESS' => isset($this->config['site_name_supress']) ? $this->config['site_name_supress'] : '', 'SITE_SEARCH_REMOVE' => isset($this->config['site_search_remove']) ? $this->config['site_search_remove'] : '', 'U_ACTION' => $this->u_action));
}
示例6: main
/**
* Main ACP module
*
* @param int $id
* @param string $mode
* @access public
*/
public function main($id, $mode)
{
$this->tpl_name = 'acp_topic_preview';
$this->page_title = $this->user->lang('TOPIC_PREVIEW');
$form_key = 'acp_topic_preview';
add_form_key($form_key);
if ($this->request->is_set_post('submit')) {
if (!check_form_key($form_key)) {
trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
$this->config->set('topic_preview_limit', abs($this->request->variable('topic_preview_limit', 0)));
// abs() no negative values
$this->config->set('topic_preview_width', abs($this->request->variable('topic_preview_width', 0)));
// abs() no negative values
$this->config->set('topic_preview_delay', abs($this->request->variable('topic_preview_delay', 0)));
// abs() no negative values
$this->config->set('topic_preview_drift', $this->request->variable('topic_preview_drift', 0));
$this->config->set('topic_preview_avatars', $this->request->variable('topic_preview_avatars', 0));
$this->config->set('topic_preview_last_post', $this->request->variable('topic_preview_last_post', 0));
$this->config->set('topic_preview_strip_bbcodes', $this->request->variable('topic_preview_strip_bbcodes', ''));
$styles = $this->get_styles();
foreach ($styles as $row) {
$this->set_style_theme($row['style_id'], $this->request->variable('style_' . $row['style_id'], ''));
}
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$styles = $this->get_styles();
foreach ($styles as $row) {
$this->template->assign_block_vars('styles', array('STYLE_ID' => $row['style_id'], 'STYLE_THEME' => $this->user->lang('TOPIC_PREVIEW_THEME', $row['style_name']), 'STYLE_THEME_EXPLAIN' => $this->user->lang('TOPIC_PREVIEW_THEME_EXPLAIN', $row['style_name']), 'THEME_OPTIONS' => $this->theme_options($row['topic_preview_theme'])));
}
$this->template->assign_vars(array('TOPIC_PREVIEW_LIMIT' => $this->config['topic_preview_limit'], 'TOPIC_PREVIEW_WIDTH' => $this->config['topic_preview_width'], 'TOPIC_PREVIEW_DELAY' => $this->config['topic_preview_delay'], 'TOPIC_PREVIEW_DRIFT' => $this->config['topic_preview_drift'], 'S_TOPIC_PREVIEW_AVATARS' => $this->config['topic_preview_avatars'], 'S_TOPIC_PREVIEW_LAST_POST' => $this->config['topic_preview_last_post'], 'TOPIC_PREVIEW_STRIP' => $this->config['topic_preview_strip_bbcodes'], 'U_ACTION' => $this->u_action));
}
示例7: display_options
/**
* Display the options a user can configure for this extension
*
* @return null
* @access public
*/
public function display_options()
{
// Create a form key for preventing CSRF attacks
$form_key = 'login_redirect';
add_form_key($form_key);
// Is the form being submitted
if ($this->request->is_set_post('submit')) {
// Is the submitted form is valid
if (!check_form_key($form_key)) {
trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
// Check that the entered topics are valid
$this->topic_valid($this->request->variable('redirect_announce_topic_id', ''), $this->user->lang('INVALID_ANNOUNCEMENT_TOPIC'));
$this->topic_valid($this->request->variable('redirect_welcome_topic_id', ''), $this->user->lang('INVALID_WELCOME_TOPIC'));
$this->topic_valid($this->request->variable('redirect_group_topic_id', ''), $this->user->lang('INVALID_GROUP_TOPIC'));
// If no errors, process the form data
// Set the options the user configured
$this->set_options();
// Add option settings change action to the admin log
$phpbb_log = $this->container->get('log');
$phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_LOGIN_REDIRECT');
// Option settings have been updated and logged
// Confirm this to the user and provide link back to previous page
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
// Set output vars for display in the template
$this->template->assign_vars(array('REDIRECT_ANNOUNCE' => isset($this->config['redirect_announce']) ? $this->config['redirect_announce'] : '', 'REDIRECT_ANNOUNCE_PRIORITY' => isset($this->config['redirect_announce_priority']) ? $this->config['redirect_announce_priority'] : '', 'REDIRECT_ANNOUNCE_REFRESH' => isset($this->config['redirect_announce_refresh']) ? $this->config['redirect_announce_refresh'] : '', 'REDIRECT_ANNOUNCE_TOPIC_ID' => isset($this->config['redirect_announce_topic_id']) ? $this->config['redirect_announce_topic_id'] : '', 'REDIRECT_ANY_ANNOUNCE' => isset($this->config['redirect_any_announce']) ? $this->config['redirect_any_announce'] : '', 'REDIRECT_ENABLED' => isset($this->config['redirect_enabled']) ? $this->config['redirect_enabled'] : '', 'REDIRECT_GROUP' => isset($this->config['redirect_group']) ? $this->config['redirect_group'] : '', 'REDIRECT_GROUP_ALL' => isset($this->config['redirect_group_all']) ? $this->config['redirect_group_all'] : '', 'REDIRECT_GROUP_REFRESH' => isset($this->config['redirect_group_refresh']) ? $this->config['redirect_group_refresh'] : '', 'REDIRECT_GROUP_TOPIC_ID' => isset($this->config['redirect_group_topic_id']) ? $this->config['redirect_group_topic_id'] : '', 'REDIRECT_WELCOME' => isset($this->config['redirect_welcome']) ? $this->config['redirect_welcome'] : '', 'REDIRECT_WELCOME_REFRESH' => isset($this->config['redirect_welcome_refresh']) ? $this->config['redirect_welcome_refresh'] : '', 'REDIRECT_WELCOME_TOPIC_ID' => isset($this->config['redirect_welcome_topic_id']) ? $this->config['redirect_welcome_topic_id'] : '', 'S_REDIRECT_GROUP_OPTIONS' => group_select_options($this->config['redirect_group_id'], false, false), 'U_ACTION' => $this->u_action));
}
示例8: main
function main($id, $mode)
{
global $phpbb_container, $user, $template, $config, $request;
$this->phpbb_container = $phpbb_container;
$this->user = $user;
$this->template = $template;
$this->config = $config;
$this->request = $request;
$this->log = $this->phpbb_container->get('log');
$this->tpl_name = 'acp_codebox_plus';
$this->page_title = $this->user->lang('CODEBOX_PLUS_TITLE');
add_form_key('o0johntam0o/acp_codebox_plus');
if ($this->request->is_set_post('submit')) {
if (!check_form_key('o0johntam0o/acp_codebox_plus')) {
trigger_error('FORM_INVALID');
}
$this->config->set('codebox_plus_syntax_highlighting', $request->variable('codebox_plus_syntax_highlighting', 0));
$this->config->set('codebox_plus_expanded', $request->variable('codebox_plus_expanded', 0));
$this->config->set('codebox_plus_download', $request->variable('codebox_plus_download', 0));
$this->config->set('codebox_plus_login_required', $request->variable('codebox_plus_login_required', 0));
$this->config->set('codebox_plus_prevent_bots', $request->variable('codebox_plus_prevent_bots', 0));
$this->config->set('codebox_plus_captcha', $request->variable('codebox_plus_captcha', 0));
$this->config->set('codebox_plus_max_attempt', $request->variable('codebox_plus_max_attempt', 0));
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'CODEBOX_PLUS_LOG_MSG');
trigger_error($this->user->lang('CODEBOX_PLUS_SAVED') . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_CODEBOX_PLUS_VERSION' => isset($this->config['codebox_plus_version']) ? $this->config['codebox_plus_version'] : 0, 'S_CODEBOX_PLUS_SYNTAX_HIGHLIGHTING' => isset($this->config['codebox_plus_syntax_highlighting']) ? $this->config['codebox_plus_syntax_highlighting'] : 0, 'S_CODEBOX_PLUS_EXPANDED' => isset($this->config['codebox_plus_expanded']) ? $this->config['codebox_plus_expanded'] : 0, 'S_CODEBOX_PLUS_DOWNLOAD' => isset($this->config['codebox_plus_download']) ? $this->config['codebox_plus_download'] : 0, 'S_CODEBOX_PLUS_LOGIN_REQUIRED' => isset($this->config['codebox_plus_login_required']) ? $this->config['codebox_plus_login_required'] : 0, 'S_CODEBOX_PLUS_PREVENT_BOTS' => isset($this->config['codebox_plus_prevent_bots']) ? $this->config['codebox_plus_prevent_bots'] : 0, 'S_CODEBOX_PLUS_CAPTCHA' => isset($this->config['codebox_plus_captcha']) ? $this->config['codebox_plus_captcha'] : 0, 'S_CODEBOX_PLUS_MAX_ATTEMPT' => isset($this->config['codebox_plus_max_attempt']) ? $this->config['codebox_plus_max_attempt'] : 0));
}
示例9: main
public function main($id, $mode)
{
global $phpbb_container, $table_prefix;
if (!defined('CHAT_TABLE')) {
$chat_table = $table_prefix . 'ajax_chat';
define('CHAT_TABLE', $chat_table);
}
$this->id = $id;
$this->mode = $mode;
// Initialization
$this->auth = $phpbb_container->get('auth');
$this->config = $phpbb_container->get('config');
$this->db = $phpbb_container->get('dbal.conn');
$this->user = $phpbb_container->get('user');
$this->template = $phpbb_container->get('template');
$this->request = $phpbb_container->get('request');
$this->u_action = $this->request->variable('action', '', true);
$submit = $this->request->is_set_post('submit') ? true : false;
$this->form_key = 'acp_ajax_chat';
add_form_key($this->form_key);
$display_vars = ['title' => 'ACP_AJAX_CHAT_TITLE', 'vars' => ['legend1' => 'AJAX_CHAT_SETTINGS', 'display_ajax_chat' => ['lang' => 'DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'index_display_ajax_chat' => ['lang' => 'INDEX_DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'whois_chatting' => ['lang' => 'WHOIS_CHATTING', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'rule_ajax_chat' => ['lang' => 'RULE_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true], 'ajax_chat_archive_amount' => ['lang' => 'ARCHIVE_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:500', 'explain' => true], 'ajax_chat_popup_amount' => ['lang' => 'POPUP_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_index_amount' => ['lang' => 'INDEX_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_chat_amount' => ['lang' => 'CHAT_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_time_setting' => ['lang' => 'TIME_SETTING_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:10:20', 'explain' => true], 'refresh_online_chat' => ['lang' => 'REFRESH_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_idle_chat' => ['lang' => 'REFRESH_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_offline_chat' => ['lang' => 'REFRESH_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_online_chat' => ['lang' => 'STATUS_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_idle_chat' => ['lang' => 'STATUS_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_offline_chat' => ['lang' => 'STATUS_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'legend2' => 'AJAX_CHAT_LOCATION', 'location_ajax_chat_override' => ['lang' => 'LOCATION_AJAX_CHAT_OVERRIDE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'location_ajax_chat' => ['lang' => 'LOCATION_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], 'legend3' => 'AJAX_CHAT_POSTS', 'ajax_chat_forum_posts' => ['lang' => 'FORUM_POSTS_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_topic' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_reply' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_REPLY', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_edit' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_EDIT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_quote' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_QUOTE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'legend4' => 'AJAX_CHAT_PRUNE', 'prune_ajax_chat' => ['lang' => 'PRUNE_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'prune_keep_ajax_chat' => ['lang' => 'PRUNE_KEEP_AJAX_CHAT', 'validate' => 'int', 'type' => 'number', 'explain' => false], 'prune_now' => ['lang' => 'PRUNE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'prune_chat'], 'truncate_now' => ['lang' => 'TRUNCATE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'truncate_chat'], 'ajax_chat_counter' => ['lang' => 'CHAT_COUNTER', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'chat_counter'], 'legend5' => 'ACP_SUBMIT_CHANGES']];
#region Submit
if ($submit) {
$submit = $this->do_submit_stuff($display_vars);
// If the submit was valid, so still submitted
if ($submit) {
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
}
}
#endregion
$this->generate_stuff_for_cfg_template($display_vars);
// Output page template file
$this->tpl_name = 'ajax_chat';
$this->page_title = $this->user->lang($display_vars['title']);
}
示例10: display_options
/**
* Display the options a user can configure for this extension
*
* @return null
* @access public
*/
public function display_options()
{
add_form_key('acp_donation');
// Is the form being submitted to us?
if ($this->request->is_set_post('submit')) {
if (!check_form_key('acp_donation')) {
$error[] = 'FORM_INVALID';
}
$donation_row = array('donation_body' => $this->request->variable('donation_body', '', true), 'donation_cancel' => $this->request->variable('donation_cancel', '', true), 'donation_success' => $this->request->variable('donation_success', '', true));
foreach ($donation_row as $this->config_name => $this->config_value) {
$sql = 'UPDATE ' . $this->donation_table . "\n\t\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->config_value) . "'\n\t\t\t\t\tWHERE config_name = '" . $this->db->sql_escape($this->config_name) . "'";
$this->db->sql_query($sql);
}
// Set the options the user configured
$this->set_options();
// Add option settings change action to the admin log
$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DONATION_SAVED');
trigger_error($this->user->lang['DONATION_SAVED'] . adm_back_link($this->u_action));
}
// let's get it on
$sql = 'SELECT *
FROM ' . $this->donation_table;
$result = $this->db->sql_query($sql);
$donation = array();
while ($row = $this->db->sql_fetchrow($result)) {
$donation[$row['config_name']] = $row['config_value'];
}
$this->db->sql_freeresult($result);
$donation_body = isset($donation['donation_body']) ? $donation['donation_body'] : '';
$donation_cancel = isset($donation['donation_cancel']) ? $donation['donation_cancel'] : '';
$donation_success = isset($donation['donation_success']) ? $donation['donation_success'] : '';
$donation_version = isset($this->config['donation_version']) ? $this->config['donation_version'] : '';
$this->template->assign_vars(array('DONATION_VERSION' => $donation_version, 'DONATION_ENABLE' => $this->config['donation_enable'], 'DONATION_INDEX_ENABLE' => $this->config['donation_index_enable'], 'DONATION_INDEX_TOP' => $this->config['donation_index_top'], 'DONATION_INDEX_BOTTOM' => $this->config['donation_index_bottom'], 'DONATION_EMAIL' => $this->config['donation_email'], 'DONATION_ACHIEVEMENT_ENABLE' => $this->config['donation_achievement_enable'], 'DONATION_ACHIEVEMENT' => $this->config['donation_achievement'], 'DONATION_GOAL_ENABLE' => $this->config['donation_goal_enable'], 'DONATION_GOAL' => $this->config['donation_goal'], 'DONATION_GOAL_CURRENCY_ENABLE' => $this->config['donation_goal_currency_enable'], 'DONATION_GOAL_CURRENCY' => $this->config['donation_goal_currency'], 'DONATION_BODY' => $donation_body, 'DONATION_CANCEL' => $donation_cancel, 'DONATION_SUCCESS' => $donation_success, 'U_ACTION' => $this->u_action));
}
示例11: process
/**
* Validate config vars and update config table if needed
*
* @return null
*/
public function process()
{
$submit = $this->request->is_set_post('submit') ? true : false;
$this->new_config = $this->config;
$cfg_array = $this->request->is_set('config') ? $this->request->variable('config', array('' => ''), true) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($this->display_vars['vars'], $cfg_array, $error);
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($this->display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$this->config->set($config_name, $config_value);
}
}
if ($submit) {
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DIR_CONFIG_SETTINGS');
trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('L_TITLE' => $this->user->lang[$this->display_vars['title']], 'L_TITLE_EXPLAIN' => $this->user->lang[$this->display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
}
示例12: main
public function main($id, $mode)
{
global $phpbb_container;
// Initialization
$this->config = $phpbb_container->get('config');
$this->db = $phpbb_container->get('dbal.conn');
$this->user = $phpbb_container->get('user');
$this->template = $phpbb_container->get('template');
$this->request = $phpbb_container->get('request');
$action = $this->request->variable('action', '', true);
$submit = $this->request->is_set_post('submit') ? true : false;
$this->form_key = 'acp_advancedpolls';
add_form_key($this->form_key);
$display_vars = array('title' => 'AP_TITLE_ACP', 'vars' => array('legend1' => 'AP_GLOBAL_SETTINGS', 'wolfsblvt.advancedpolls.activate_incremental_votes' => array('lang' => 'AP_ACT_INCREMENTAL_VOTES', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_closed_voting' => array('lang' => 'AP_ACT_CLOSED_VOTING', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_no_vote' => array('lang' => 'AP_ACT_POLL_NO_VOTE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_poll_end' => array('lang' => 'AP_ACT_POLL_END', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_notifications' => array('lang' => 'AP_ACT_POLL_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'AP_PER_POLL_SETTINGS', 'wolfsblvt.advancedpolls.activate_poll_scoring' => array('lang' => 'AP_ACT_POLL_SCORING', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_votes_change' => array('lang' => 'AP_DEFAULT_VOTES_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_votes_hide' => array('lang' => 'AP_ACT_VOTES_HIDE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_votes_hide' => array('lang' => 'AP_DEFAULT_VOTES_HIDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_voters_show' => array('lang' => 'AP_ACT_VOTERS_SHOW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_voters_show' => array('lang' => 'AP_DEFAULT_VOTERS_SHOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_voters_limit' => array('lang' => 'AP_ACT_VOTERS_LIMIT', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_voters_limit' => array('lang' => 'AP_DEFAULT_VOTERS_LIMIT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_show_ordered' => array('lang' => 'AP_ACT_SHOW_ORDERED', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_show_ordered' => array('lang' => 'AP_DEFAULT_SHOW_ORDERED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
#region Submit
if ($submit) {
$submit = $this->do_submit_stuff($display_vars);
// If the submit was valid, so still submitted
if ($submit) {
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
}
}
#endregion
$this->generate_stuff_for_cfg_template($display_vars);
// Output page template file
$this->tpl_name = 'acp_advancedpolls';
$this->page_title = $this->user->lang($display_vars['title']);
}
示例13: acp_board_settings
/**
* Set ACP board settings
*
* @param object $event The event object
* @return null
* @access public
*/
public function acp_board_settings($event)
{
if ($event['mode'] == 'features') {
$this->helper->modify_acp_display_vars($event);
$this->user->add_lang_ext('marc/quickedit', 'quickedit_acp');
if ($this->request->is_set_post('allow_quick_edit_enable')) {
$this->helper->enable_quick_edit($event);
}
}
}
示例14: main
public function main($id, $mode)
{
global $config, $db, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
$this->config = $config;
$this->db = $db;
$this->log = $phpbb_container->get('log');
$this->request = $request;
$this->template = $template;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
// Load a template from adm/style for our ACP page
$this->tpl_name = 'acp_usermerge';
// Set the page title for our ACP page
$this->page_title = 'ACP_USER_MERGE';
// Quick var-checking and var setup.
$action = $this->request->variable('action', '');
$merge = $action == 'merge' ? true : false;
$errors = array();
$old_username = $this->request->variable('old_username', '', true);
$new_username = $this->request->variable('new_username', '', true);
$form_key = 'acp_user_merge';
add_form_key($form_key);
// Hath we an invalid form key?
if ($this->request->is_set_post('submit') && !check_form_key($form_key)) {
$errors[] = $user->lang['FORM_INVALID'];
}
if ($this->request->is_set_post('submit') || $merge) {
$old_user_id = $this->check_user($old_username, $errors, true);
$new_user_id = $this->check_user($new_username, $errors, false);
}
// Make sure we have submitted the form, and that we do not have errors
if (($this->request->is_set_post('submit') || $merge) && !sizeof($errors)) {
if ($old_user_id == $new_user_id) {
$warning = sprintf($this->user->lang['CANNOT_MERGE_SAME'], $old_username);
trigger_error($warning . adm_back_link($this->u_action), E_USER_WARNING);
}
// Have we confirmed this change?
if (confirm_box(true)) {
// Let's roll!
$this->user_merge($old_user_id, $new_user_id);
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USERS_MERGED', time(), array($old_username . ' » ' . $new_username));
trigger_error($this->user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
} else {
$hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
// Be annoying. Are you suuuuuuuuuuuure? No, really, are you sure?
$merge_users_confirm = sprintf($this->user->lang['MERGE_USERS_CONFIRM'], $old_username);
confirm_box(false, $merge_users_confirm, build_hidden_fields($hidden_fields));
}
}
$user_merge_version = !empty($this->config['usermerge_version']) ? $this->config['usermerge_version'] : '';
// Assign template stuffs now.
$this->page_title = $this->user->lang['ACP_USER_MERGE_TITLE'];
$template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&form=user_merge&field=old_username&select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&form=user_merge&field=new_username&select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $this->user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $this->user->lang['ACP_USER_MERGE_EXPLAIN'], 'USERMERGE_VERSION' => $user_merge_version, 'U_ACTION' => $this->u_action));
}
示例15: display_settings
/**
* GeoModerate settings
*
*/
public function display_settings()
{
add_form_key(self::FORM_KEY);
if ($this->request->is_set_post('submit')) {
if (!check_form_key(self::FORM_KEY)) {
trigger_error('FORM_INVALID');
}
$this->save_settings();
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'AKISMET_LOG_SETTING_CHANGED');
trigger_error($this->user->lang('ACP_AKISMET_SETTING_SAVED') . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('U_ACTION' => $this->u_action, 'GOTHICK_AKISMET_API_KEY' => $this->config['gothick_akismet_api_key']));
}