/** * Controller for /help/{mode} routes * * @param string $mode * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @throws http_exception when the $mode is not known by any extension */ public function handle($mode) { switch ($mode) { case 'faq': case 'bbcode': $page_title = $mode === 'faq' ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE']; $this->user->add_lang($mode, false, true); break; default: $page_title = $this->user->lang['FAQ_EXPLAIN']; $ext_name = $lang_file = ''; /** * You can use this event display a custom help page * * @event core.faq_mode_validation * @var string page_title Title of the page * @var string mode FAQ that is going to be displayed * @var string lang_file Language file containing the help data * @var string ext_name Vendor and extension name where the help * language file can be loaded from * @since 3.1.4-RC1 */ $vars = array('page_title', 'mode', 'lang_file', 'ext_name'); extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars))); if ($ext_name === '' || $lang_file === '') { throw new http_exception(404, 'Not Found'); } $this->user->add_lang($lang_file, false, true, $ext_name); break; } $this->template->assign_vars(array('L_FAQ_TITLE' => $page_title, 'S_IN_FAQ' => true)); $this->assign_to_template($this->user->help); make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}")); return $this->helper->render('faq_body.html', $page_title); }
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)); }
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)); }
public function main($id, $mode) { global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config; $this->db = $db; $this->user = $user; $this->template = $template; $this->request = $request; $this->cache = $cache; $this->auth = $auth; $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; $this->default_style = $config['default_style']; $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/'; $this->u_base_action = append_sid("{$phpbb_admin_path}index.{$this->php_ext}", "i={$id}"); $this->s_hidden_fields = array('mode' => $mode); $this->user->add_lang('acp/styles'); $this->tpl_name = 'acp_styles'; $this->page_title = 'ACP_CAT_STYLES'; $this->mode = $mode; $action = $this->request->variable('action', ''); $post_actions = array('install', 'activate', 'deactivate', 'uninstall'); foreach ($post_actions as $key) { if ($this->request->is_set_post($key)) { $action = $key; } } // The uninstall action uses confirm_box() to verify the validity of the request, // so there is no need to check for a valid token here. if (in_array($action, $post_actions) && $action != 'uninstall') { $is_valid_request = check_link_hash($request->variable('hash', ''), $action) || check_form_key('styles_management'); if (!$is_valid_request) { trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } } if ($action != '') { $this->s_hidden_fields['action'] = $action; } $this->template->assign_vars(array('U_ACTION' => $this->u_base_action, 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields))); // Execute actions switch ($action) { case 'install': $this->action_install(); return; case 'uninstall': $this->action_uninstall(); return; case 'activate': $this->action_activate(); return; case 'deactivate': $this->action_deactivate(); return; case 'details': $this->action_details(); return; default: $this->frontend(); } }
/** * Constructor. * * @param \phpbb\user $user * @param $container * @param \phpbb\titania\config\config $ext_config * @param string $php_ext */ public function __construct(\phpbb\user $user, $container, $ext_config, $php_ext) { $this->user = $user; $this->ext_config = $ext_config; $this->php_ext = $php_ext; $this->container = $container; $this->user->add_lang('acp/styles'); }
/** * Constructor * * @param \phpbb\config\config $config Config object * @param \phpbb\user $user User object * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->config = $config; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; include $this->phpbb_root_path . 'includes/functions_user.' . $php_ext; $this->user->add_lang('ucp'); }
/** * Constructor * * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\user $user * @param \phpbb\request\request_interface $request * @param \phpbb\titania\controller\helper $helper * @param \phpbb\titania\config\config $ext_config * @param \phpbb\titania\attachment\operator $attachments */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\request\request_interface $request, \phpbb\titania\controller\helper $helper, \phpbb\titania\config\config $ext_config, \phpbb\titania\attachment\operator $attachments) { $this->db = $db; $this->user = $user; $this->request = $request; $this->helper = $helper; $this->ext_config = $ext_config; $this->attachments = $attachments; $this->user->add_lang('viewtopic'); }
/** * Constructor * * @param \phpbb\user $user * @param \phpbb\template\template $template * @param \phpbb\request\request_interface $request * @param \phpbb\titania\controller\helper $helper * @param \phpbb\titania\config\config $ext_config * @param \phpbb\titania\attachment\operator $attachments */ public function __construct(\phpbb\user $user, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\titania\controller\helper $helper, \phpbb\titania\config\config $ext_config, \phpbb\titania\attachment\operator $attachments) { $this->user = $user; $this->template = $template; $this->request = $request; $this->helper = $helper; $this->ext_config = $ext_config; $this->attachments = $attachments; $this->user->add_lang_ext('phpbb/titania', array('contributions', 'manage')); $this->user->add_lang('viewtopic'); }
/** * Constructor * * @param \phpbb\auth\auth $auth * @param \phpbb\config\config $config Config object * @param \phpbb\db\driver\driver_interface $db * @param \\phpbb\event\dispatcher_interface $phpbb_dispatcher * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->auth = $auth; $this->config = $config; $this->db = $db; $this->phpbb_dispatcher = $phpbb_dispatcher; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->user->add_lang('memberlist'); }
public function __construct() { global $config, $db, $phpbb_log, $request, $template, $user; $this->config = $config; $this->db = $db; $this->log = $phpbb_log; $this->request = $request; $this->template = $template; $this->user = $user; $this->user->add_lang('acp/common'); $this->user->add_lang_ext('phpbb/teamsecurity', 'acp_teamsecurity'); }
/** * Constructor * * @param \phpbb\config\config $config Config object * @param \phpbb\request\request $request Request object * @param \phpbb\user $user User object * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\config\config $config, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->config = $config; $this->request = $request; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $this->user->add_lang('ucp'); $this->user->add_lang_ext('tas2580/regcheck', 'common'); }
/** * Constructor * * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\config\config $config * @param \phpbb\user $user * @param \phpbb\titania\config\config $ext_config * @param \phpbb\titania\controller\helper $controller_helper * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\user $user, \phpbb\titania\config\config $ext_config, \phpbb\titania\controller\helper $controller_helper, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; $this->user = $user; $this->ext_config = $ext_config; $this->controller_helper = $controller_helper; $this->attachments_table = $this->sql_table; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->user->add_lang('posting'); $this->configure_properties(); }
/** * Constructor * * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\cache\driver\driver_interface $cache Cache driver interface * @param \phpbb\config\config $config Config object * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension */ public function __construct(\phpbb\auth\auth $auth, \phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->auth = $auth; $this->cache = $cache; $this->config = $config; $this->db = $db; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; if (!class_exists('acp_forums')) { include $this->phpbb_root_path . 'includes/acp/acp_forums.' . $this->php_ext; } $this->user->add_lang('acp/forums'); }
public function build(array $topic_data, \phpbb\template\twig\twig &$template) { $this->user->add_lang('viewtopic'); $forum_id = (int) $topic_data['forum_id']; $topic_id = (int) $topic_data['topic_id']; $cur_voted_id = $this->_get_users_votes($topic_id); $s_can_vote = $this->_user_can_vote($forum_id, $topic_data, $cur_voted_id); $viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&t={$topic_id}"); $poll_total = $poll_most = 0; $poll_info = $this->_get_poll_info($topic_data, $poll_total, $poll_most); $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; $this->_build_poll_options($cur_voted_id, $poll_info, $poll_total, $poll_most, $template); $template->assign_vars(array('POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, 'POLL_LEFT_CAP_IMG' => $this->user->img('poll_left'), 'POLL_RIGHT_CAP_IMG' => $this->user->img('poll_right'), 'L_MAX_VOTES' => $this->user->lang('MAX_OPTIONS_SELECT', (int) $topic_data['poll_max_options']), 'L_POLL_LENGTH' => $this->_get_poll_length_lang($topic_data['poll_length'], $poll_end), 'S_CAN_VOTE' => $s_can_vote, 'S_DISPLAY_RESULTS' => $this->_show_results($s_can_vote, $cur_voted_id), 'S_IS_MULTI_CHOICE' => $this->_poll_is_multiple_choice($topic_data['poll_max_options']), 'S_POLL_ACTION' => $viewtopic_url, 'S_FORM_TOKEN' => $this->sitemaker->get_form_key('posting'), 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')); }
/** * Constructor * * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\auth\auth $auth * @param \phpbb\user $user * @param \phpbb\request\request_interface $request * @param \phpbb\titania\controller\helper $helper * @param \phpbb\titania\config\config $ext_config * @param \phpbb\titania\access $access * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\request\request $request, \phpbb\titania\controller\helper $helper, \phpbb\titania\config\config $ext_config, access $access, $phpbb_root_path, $php_ext) { $this->db = $db; $this->auth = $auth; $this->user = $user; $this->request = $request; $this->helper = $helper; $this->ext_config = $ext_config; $this->access = $access; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->user->add_lang('viewtopic'); require $this->phpbb_root_path . 'includes/functions_download.' . $this->php_ext; }
/** * Constructor */ public function __construct() { global $cache, $config, $db, $phpbb_extension_manager, $request, $template, $user, $phpbb_root_path; $this->cache = $cache; $this->config = $config; $this->db = $db; $this->ext_manager = $phpbb_extension_manager; $this->request = $request; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->user->add_lang('acp/common'); $this->user->add_lang_ext('vse/topicpreview', 'topic_preview_acp'); }
function main($id, $mode) { global $cache, $config, $db, $phpbb_log, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container; $this->cache = $cache; $this->config = $config; $this->config_text = $phpbb_container->get('config_text'); $this->db = $db; $this->log = $phpbb_log; $this->request = $request; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; $this->phpbb_container = $phpbb_container; // Add the board rules ACP lang file $this->user->add_lang_ext('darkdiesel/pagescroller', 'pagescroller_acp'); $this->tpl_name = 'pagescroller'; $this->page_title = $user->lang('ACP_PAGESCROLLER_SETTINGS'); add_form_key('darkdiesel/pagescroller'); /** @var \darkdiesel\pagescroller\event\main_listener $listener */ $listener = $this->phpbb_container->get('darkdiesel.pagescroller.listener'); $scroller_styles = $listener->get_images('.svg', 'chevron-up-style'); if ($this->request->is_set_post('submit')) { if (!check_form_key('darkdiesel/pagescroller')) { $this->user->add_lang('acp/common'); trigger_error('FORM_INVALID'); } $this->config->set('darkdiesel_pagescroller_horizontal_pos', $this->request->variable('darkdiesel_pagescroller_horizontal_pos', 'right')); $this->config->set('darkdiesel_pagescroller_vertical_pos', $this->request->variable('darkdiesel_pagescroller_vertical_pos', 'bottom')); $this->config->set('darkdiesel_pagescroller_style_type', $this->request->variable('darkdiesel_pagescroller_style_type', '1')); $this->config->set('darkdiesel_pagescroller_style_hide_btns', $this->request->variable('darkdiesel_pagescroller_style_hide_btns', 'false')); $this->config->set('darkdiesel_pagescroller_style_bgcolor', $this->request->variable('darkdiesel_pagescroller_style_bgcolor', '#0076b1')); $this->config->set('darkdiesel_pagescroller_style_chevroncolor', $this->request->variable('darkdiesel_pagescroller_style_chevroncolor', '#FFFFFF')); $this->config->set('darkdiesel_pagescroller_scroll_up_speed', $this->request->variable('darkdiesel_pagescroller_scroll_up_speed', '800')); $this->config->set('darkdiesel_pagescroller_scroll_down_speed', $this->request->variable('darkdiesel_pagescroller_scroll_down_speed', '800')); $this->config->set('darkdiesel_pagescroller_animation_hideshow_enable', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_enable', 'false')); $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_show', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_show', '200')); $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_hide', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_hide', '500')); $this->config->set('darkdiesel_pagescroller_animation_hideshow_visible_part', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_visible_part', '20')); $this->config->set('darkdiesel_pagescroller_animation_hideshow_distance_to_page', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_distance_to_page', '0')); trigger_error($user->lang('ACP_PAGESCROLLER_SETTING_SAVED') . adm_back_link($this->u_action)); } $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'DARKDIESEL_PAGESCROLLER_HORIZONTAL_POS' => $this->config['darkdiesel_pagescroller_horizontal_pos'], 'DARKDIESEL_PAGESCROLLER_VERTICAL_POS' => $this->config['darkdiesel_pagescroller_vertical_pos'], 'DARKDIESEL_PAGESCROLLER_STYLE_TYPE' => $this->config['darkdiesel_pagescroller_style_type'], 'DARKDIESEL_PAGESCROLLER_STYLE_HIDE_BTNS' => $this->config['darkdiesel_pagescroller_style_hide_btns'], 'DARKDIESEL_PAGESCROLLER_STYLE_BGCOLOR' => $this->config['darkdiesel_pagescroller_style_bgcolor'], 'DARKDIESEL_PAGESCROLLER_STYLE_CHEVRONCOLOR' => $this->config['darkdiesel_pagescroller_style_chevroncolor'], 'DARKDIESEL_PAGESCROLLER_SCROLL_UP_SPEED' => $this->config['darkdiesel_pagescroller_scroll_up_speed'], 'DARKDIESEL_PAGESCROLLER_SCROLL_DOWN_SPEED' => $this->config['darkdiesel_pagescroller_scroll_down_speed'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_ENABLE' => $this->config['darkdiesel_pagescroller_animation_hideshow_enable'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_SHOW' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_show'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_HIDE' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_hide'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_VISIBLE_PART' => $this->config['darkdiesel_pagescroller_animation_hideshow_visible_part'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DISTANCE_TO_PAGE' => $this->config['darkdiesel_pagescroller_animation_hideshow_distance_to_page'], 'S_DARKDIESEL_PAGESCROLLER' => true)); for ($i = 0; $i < count($scroller_styles); $i++) { $img = 'pagescroller/styles/all/theme/assets/images/' . 'chevron-up-style' . ($i + 1) . '.svg'; $img_url = isset($scroller_styles['ext/' . $img]) ? '/ext/darkdiesel/' . $img : ''; $this->template->assign_block_vars('style_images', array('STYLE' => $i + 1, 'IMAGE' => generate_board_url() . $img_url)); } }
public function user_sfs_validate_posting($event) { $error_array = $event['error']; $settings = $this->get_settings(); if ($this->user->data['user_id'] == ANONYMOUS && $settings['allow_sfs']) { $this->user->add_lang_ext('rmcgirr83/stopforumspam', 'stopforumspam'); $this->user->add_lang('ucp'); // ensure email is populated on posting $error = $this->validate_email($event['post_data']['email']); if ($error) { $error_array[] = $this->user->lang[$error . '_EMAIL']; } // I just hate empty usernames for guest posting $username_error = $this->validate_username($event['post_data']['username']); if (sizeof($username_error)) { $error_array = $username_error; } if (!sizeof($error_array)) { $check = $this->stopforumspam_check($event['post_data']['username'], $this->user->ip, $event['post_data']['email']); if ($check) { if ($settings['sfs_down'] && $check === 'sfs_down') { return; } $error_array[] = $this->show_message($check); // now ban the spammer by IP if ($settings['sfs_ban_ip']) { $this->ban_by_ip($this->user->ip); } } } } $event['error'] = $error_array; }
/** * Constructor * * @param template $template * @param user $user * @param db_driver $db * @param auth $auth * @param request $request * @param helper $helper * @param db $config * @param manager $ext_manager * @param path_helper $path_helper * @param Container $container * @param string $table_prefix * @param string $root_path * @param string $php_ext */ public function __construct(template $template, user $user, db_driver $db, auth $auth, request $request, helper $helper, db $config, manager $ext_manager, path_helper $path_helper, Container $container, $table_prefix, $root_path, $php_ext) { $this->template = $template; $this->user = $user; $this->db = $db; $this->auth = $auth; $this->request = $request; $this->helper = $helper; $this->config = $config; $this->root_path = $root_path; $this->php_ext = $php_ext; $this->ext_manager = $ext_manager; $this->path_helper = $path_helper; $this->container = $container; $this->table_prefix = $table_prefix; $this->user->add_lang('posting'); $this->user->add_lang_ext('spaceace/ajaxchat', 'ajax_chat'); // sets desired status times $this->times = ['online' => $this->config['status_online_chat'], 'idle' => $this->config['status_idle_chat'], 'offline' => $this->config['status_offline_chat']]; //set delay for each status $this->delay = ['online' => $this->config['delay_online_chat'], 'idle' => $this->config['delay_idle_chat'], 'offline' => $this->config['delay_offline_chat']]; if (!defined('CHAT_TABLE')) { $chat_table = $this->table_prefix . 'ajax_chat'; define('CHAT_TABLE', $chat_table); } if (!defined('CHAT_SESSIONS_TABLE')) { $chat_session_table = $this->table_prefix . 'ajax_chat_sessions'; define('CHAT_SESSIONS_TABLE', $chat_session_table); } include $this->root_path . 'includes/functions_posting.' . $this->php_ext; include $this->root_path . 'includes/functions_display.' . $this->php_ext; $this->ext_path = $this->ext_manager->get_extension_path('spaceace/ajaxchat', true); $this->ext_path_web = $this->path_helper->update_web_root_path($this->ext_path); $this->post = $this->request->get_super_global(\phpbb\request\request_interface::POST); }
/** * API function - The ACP backend, this marks the end of the easy methods */ public function acp_page($id, &$module) { $this->user->add_lang('acp/board'); $this->user->add_lang_ext('derky/sortablescaptcha', 'captcha_sortables'); $module->tpl_name = '@derky_sortablescaptcha/captcha_sortables_acp'; $module->page_title = 'ACP_VC_SETTINGS'; add_form_key($this->acp_form_key); $question_id = $this->request->variable('question_id', 0); $action = $this->request->variable('action', ''); $submit = $this->request->variable('submit', false); // we have two pages, so users might want to navigate from one to the other $this->acp_list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_service_name(); $this->template->assign_vars(array('U_ACTION' => $module->u_action, 'QUESTION_ID' => $question_id, 'CLASS' => $this->get_service_name(), 'U_LIST' => $this->acp_list_url)); // Show the list? if (!$question_id && $action != 'add') { $this->acp_question_list($module); } else { if ($question_id && $action == 'delete') { // Show confirm box and check for last question $this->acp_question_delete_confirm($question_id); } else { $this->acp_add_or_edit_question($question_id, $submit); } } }
/** * Fill in the plupload configuration options in the template * * @param \phpbb\cache\service $cache * @param \phpbb\template\template $template * @param string $s_action The URL to submit the POST data to * @param int $forum_id The ID of the forum * @param int $max_files Maximum number of files allowed. 0 for unlimited. * * @return null */ public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files) { $filters = $this->generate_filter_string($cache, $forum_id); $chunk_size = $this->get_chunk_size(); $resize = $this->generate_resize_string(); $template->assign_vars(array('S_RESIZE' => $resize, 'S_PLUPLOAD' => true, 'FILTERS' => $filters, 'CHUNK_SIZE' => $chunk_size, 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), 'MAX_ATTACHMENTS' => $max_files, 'ATTACH_ORDER' => $this->config['display_order'] ? 'asc' : 'desc', 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files))); $this->user->add_lang('plupload'); }
/** * ACP module constructor * * @access public */ public function __construct() { global $config, $db, $request, $template, $user, $phpbb_log, $phpbb_root_path, $phpEx; $this->config = $config; $this->db = $db; $this->request = $request; $this->template = $template; $this->user = $user; $this->log = $phpbb_log; $this->root_path = $phpbb_root_path; $this->php_ext = $phpEx; $this->fulltext = new \vse\similartopics\core\fulltext_support($this->db); $this->user->add_lang('acp/common'); $this->user->add_lang_ext('vse/similartopics', 'acp_similar_topics'); $this->tpl_name = 'acp_similar_topics'; $this->page_title = $this->user->lang('PST_TITLE_ACP'); }
/** * Main ACP module. * * @param int $id * @param string $mode */ public function main($id, $mode) { $this->config = $GLOBALS['config']; $this->user = $GLOBALS['user']; $this->phpbb_root_path = $GLOBALS['phpbb_root_path']; $this->request = $GLOBALS['request']; $this->template = $GLOBALS['template']; $this->user->add_lang('acp/common'); $this->user->add_lang_ext('mop/timeago', 'timeago_acp'); // initialize error container $error = ''; // silence scrutinizer warning if ($id) { // do nothing } // use switch for future module expansion cases switch ($mode) { case 'general': $this->tpl_name = 'acp_ta_general'; $this->page_title = $this->user->lang('ACP_TIMEAGO_GENERAL_SETTINGS'); $form_key = 'acp_ta_general'; add_form_key($form_key); if (empty($error) && $this->request->is_set_post('submit')) { if (check_form_key($form_key) === false) { trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); } $this->config->set('ta_cat', $this->request->variable('ta_cat', 1)); $this->config->set('ta_cat_extended', $this->request->variable('ta_cat_extended', 0)); $this->config->set('ta_viewforum', $this->request->variable('ta_viewforum', 1)); $this->config->set('ta_viewforum_extended', $this->request->variable('ta_viewforum_extended', 0)); $this->config->set('ta_viewtopic', $this->request->variable('ta_viewtopic', 1)); $this->config->set('ta_viewtopic_extended', $this->request->variable('ta_viewtopic_extended', 0)); $this->config->set('ta_timer', $this->request->variable('ta_timer', 0)); trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); } //end if // set the template variables $this->template->assign_vars(['TA_FORUM_ROOT' => $this->phpbb_root_path, 'TA_CAT' => !empty($this->config['ta_cat']) ? $this->config['ta_cat'] : 0, 'TA_CAT_EXTENDED' => !empty($this->config['ta_cat_extended']) ? true : false, 'TA_VIEWFORUM' => !empty($this->config['ta_viewforum']) ? $this->config['ta_viewforum'] : 0, 'TA_VIEWFORUM_EXTENDED' => !empty($this->config['ta_viewforum_extended']) ? true : false, 'TA_VIEWTOPIC' => !empty($this->config['ta_viewtopic']) ? $this->config['ta_viewtopic'] : 0, 'TA_VIEWTOPIC_EXTENDED' => !empty($this->config['ta_viewtopic_extended']) ? true : false, 'TA_TIMER' => !empty($this->config['ta_timer']) ? $this->config['ta_timer'] : 0, 'U_ACTION' => $this->u_action]); break; default: // obligatory default comment break; } //end switch }
/** * Main ACP module * * @param integer $id * @param string $mode * * @access public * @return void */ public function main($id, $mode) { $this->config = $GLOBALS['config']; $this->user = $GLOBALS['user']; $this->phpbb_root_path = $GLOBALS['phpbb_root_path']; $this->request = $GLOBALS['request']; $this->template = $GLOBALS['template']; $this->user->add_lang('acp/common'); $this->user->add_lang_ext('svennd/simplecount', 'simplecount_var'); // initialize error container $error = ''; // use switch for future module expansion cases switch ($mode) { case 'general': $this->tpl_name = 'acp_sc_general'; $this->page_title = $this->user->lang('ACP_SIMPLECOUNT_GENERAL_SETTINGS'); $form_key = 'acp_sc_general'; add_form_key($form_key); if (empty($error) && $this->request->is_set_post('submit')) { if (check_form_key($form_key) === FALSE) { trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); } $this->config->set('sc_active', $this->request->variable('sc_active', 1)); $this->config->set('sc_posts', $this->request->variable('sc_posts', 1)); $this->config->set('sc_topics', $this->request->variable('sc_topics', 1)); $this->config->set('sc_clicks', $this->request->variable('sc_clicks', 1)); $this->config->set('sc_viewforum_views', $this->request->variable('sc_viewforum_views', 1)); $this->config->set('sc_index_posts', $this->request->variable('sc_index_posts', 0)); $this->config->set('sc_index_topics', $this->request->variable('sc_index_topics', 0)); $this->config->set('sc_index_users', $this->request->variable('sc_index_users', 0)); trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); } //end if // set the template variables $this->template->assign_vars(['SC_ACTIVE' => !empty($this->config['sc_active']) ? $this->config['sc_active'] : 0, 'SC_POSTS' => !empty($this->config['sc_posts']) ? $this->config['sc_posts'] : 0, 'SC_TOPICS' => !empty($this->config['sc_topics']) ? $this->config['sc_topics'] : 0, 'SC_CLICKS' => !empty($this->config['sc_clicks']) ? $this->config['sc_clicks'] : 0, 'SC_VIEWFORUM_VIEWS' => !empty($this->config['sc_viewforum_views']) ? $this->config['sc_viewforum_views'] : 0, 'SC_INDEX_POSTS' => !empty($this->config['sc_index_posts']) ? $this->config['sc_index_posts'] : 0, 'SC_INDEX_TOPICS' => !empty($this->config['sc_index_topics']) ? $this->config['sc_index_topics'] : 0, 'SC_INDEX_USERS' => !empty($this->config['sc_index_users']) ? $this->config['sc_index_users'] : 0, 'U_ACTION' => $this->u_action]); break; default: // obligatory default comment break; } //end switch }
/** * {@inheritdoc} */ public function display(array $bdata, $edit_mode = false) { $this->user->add_lang('viewtopic'); $this->settings = $bdata['settings']; if (!($topic_data = $this->_get_topic_data())) { return array('title' => '', 'content' => ''); } $forum_id = (int) $topic_data['forum_id']; $topic_id = (int) $topic_data['topic_id']; $viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&t={$topic_id}"); $cur_voted_id = $this->_get_users_votes($topic_id); $s_can_vote = $this->_user_can_vote($forum_id, $topic_data, $cur_voted_id); $poll_total = $poll_most = 0; $poll_info = $this->_get_poll_info($topic_data, $poll_total, $poll_most); $poll_info = $this->_parse_poll($topic_data, $poll_info); $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; $this->_build_poll_options($cur_voted_id, $poll_info, $poll_total, $poll_most); $this->ptemplate->assign_vars(array('POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, 'POLL_LEFT_CAP_IMG' => $this->user->img('poll_left'), 'POLL_RIGHT_CAP_IMG' => $this->user->img('poll_right'), 'L_MAX_VOTES' => $this->user->lang('MAX_OPTIONS_SELECT', (int) $topic_data['poll_max_options']), 'L_POLL_LENGTH' => $this->_get_poll_length_lang($topic_data['poll_length'], $poll_end), 'S_CAN_VOTE' => $s_can_vote, 'S_DISPLAY_RESULTS' => $this->_show_results($s_can_vote, $cur_voted_id), 'S_IS_MULTI_CHOICE' => $this->_poll_is_multiple_choice($topic_data['poll_max_options']), 'S_POLL_ACTION' => $viewtopic_url, 'S_FORM_TOKEN' => $this->sitemaker->get_form_key('posting'), 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')); return array('title' => 'POLL', 'content' => $this->ptemplate->render_view('blitze/sitemaker', 'blocks/forum_poll.html', 'forum_poll_block')); }
/** * Obtains the latest version information * * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. * @return string Version info, includes stable and unstable data * @throws \RuntimeException */ public function get_versions($force_update = false, $force_cache = false) { $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file; $info = $this->cache->get($cache_file); if ($info === false && $force_cache) { throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); } else if ($info === false || $force_update) { try { $info = $this->file_downloader->get($this->host, $this->path, $this->file); } catch (\RuntimeException $exception) { throw new \RuntimeException(call_user_func_array(array($this->user, 'lang'), $exception->getMessage())); } $error_string = $this->file_downloader->get_error_string(); if (!empty($error_string)) { throw new \RuntimeException($error_string); } $info = json_decode($info, true); // Sanitize any data we retrieve from a server if (!empty($info)) { $json_sanitizer = function (&$value, $key) { $type_cast_helper = new \phpbb\request\type_cast_helper(); $type_cast_helper->set_var($value, $value, gettype($value), true); }; array_walk_recursive($info, $json_sanitizer); } if (empty($info['stable']) && empty($info['unstable'])) { $this->user->add_lang('acp/common'); throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); } $info['stable'] = (empty($info['stable'])) ? array() : $info['stable']; $info['unstable'] = (empty($info['unstable'])) ? $info['stable'] : $info['unstable']; $this->cache->put($cache_file, $info, 86400); // 24 hours } return $info; }
/** * Show bbcodes and smilies in the quickreply * Template data for Ajax submit * * @param object $event The event object * @return null * @access public */ public function viewtopic_modify_data($event) { $forum_id = $event['forum_id']; $topic_data = $event['topic_data']; $post_list = $event['post_list']; $topic_id = $topic_data['topic_id']; $s_quick_reply = false; if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) { // Quick reply enabled forum $s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false; } if (!$this->user->data['is_registered'] && $s_quick_reply) { $this->helper->enable_qr_for_guests($forum_id, $topic_data); } // Ajaxify viewtopic data if ($this->request->is_ajax() && $this->request->is_set('qr_request')) { $this->helper->ajax_response($event['page_title'], max($post_list), $forum_id); } if ($s_quick_reply) { if (!function_exists('generate_smilies')) { include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext; } // HTML, BBCode, Smilies, Images, Url, Flash and Quote status $bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false; $smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false; $img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false; $url_status = $this->config['allow_post_links'] ? true : false; $flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false; $quote_status = true; // Build custom bbcodes array if ($bbcode_status) { display_custom_bbcodes(); } // Generate smiley listing if ($smilies_status) { generate_smilies('inline', $forum_id); } $this->template->assign_vars(array('S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status)); // Show attachment box for adding attachments $show_attach_box = @ini_get('file_uploads') != '0' && strtolower(@ini_get('file_uploads')) != 'off' && $this->config['allow_attachments'] && $this->auth->acl_get('u_attach') && $this->auth->acl_get('f_attach', $forum_id); if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $show_attach_box) { $this->user->add_lang('posting'); } if ($this->config['qr_attach'] && $show_attach_box) { $this->helper->handle_attachments($forum_id, $topic_id, $show_attach_box); } $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list)))); $this->helper->assign_template_variables_for_qr($forum_id); $add_re = $this->config['qr_enable_re'] ? 'Re: ' : ''; $this->template->assign_var('SUBJECT', $this->request->variable('subject', $add_re . censor_text($topic_data['topic_title']), true)); } $this->template->assign_vars(array('QR_HIDE_POSTS_SUBJECT' => !$this->config['qr_show_subjects'])); }
public function add_thing() { if (!$this->auth->acl_get('u_usermap_add_thing')) { trigger_error('NOT_AUTHORISED'); } include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext; include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext; $bbcode_status = $this->config['tas2580_usermap_allow_bbcode']; $url_status = $this->config['tas2580_usermap_allow_urls']; $img_status = $this->config['tas2580_usermap_allow_img']; $flash_status = $this->config['tas2580_usermap_allow_flash']; $smilies_status = $this->config['tas2580_usermap_allow_smilies']; $marker = ''; $this->user->add_lang('posting'); $submit = $this->request->is_set_post('submit'); if ($submit) { $title = $this->request->variable('title', '', true); $message = $this->request->variable('message', '', true); $marker = $this->request->variable('marker', '', true); $data = array('lon' => (double) substr($this->request->variable('lon', ''), 0, 10), 'lat' => (double) substr($this->request->variable('lat', ''), 0, 10)); $validate_array = array('lon' => array('match', false, self::REGEX_LON), 'lat' => array('match', false, self::REGEX_LAT)); if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $error = validate_data($data, $validate_array); if (utf8_clean_string($title) === '') { $error[] = $this->user->lang['EMPTY_SUBJECT']; } if (utf8_clean_string($message) === '') { $error[] = $this->user->lang['TOO_FEW_CHARS']; } if (empty($marker)) { $error[] = $this->user->lang['NEED_MARKER']; } if (sizeof($error)) { $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'TITLE' => $title, 'MESSAGE' => $message)); } else { generate_text_for_storage($message, $uid, $bitfield, $options, $bbcode_status, $url_status, $smilies_status); $sql_data = array('thing_title' => $title, 'thing_text' => $message, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'thing_lat' => $data['lat'], 'thing_lon' => $data['lon'], 'thing_marker' => $marker, 'thing_user_id' => $this->user->data['user_id']); $sql = 'INSERT INTO ' . $this->things_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); $this->db->sql_query($sql); $thing_id = $this->db->sql_nextid(); trigger_error($this->user->lang['THING_ADDED'] . '<br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_thing', array('id' => $thing_id)) . '">' . $this->user->lang['BACK_TO_THING'] . '</a><br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang['BACK_TO_USERMAP'] . '</a>'); } } $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/things'); generate_smilies('inline', 0); display_custom_bbcodes(); $s_hidden_fields = build_hidden_fields(array('lon' => $this->request->variable('lon', ''), 'lat' => $this->request->variable('lat', ''))); $this->template->assign_vars(array('TITLE' => $this->request->variable('title', '', true), 'MESSAGE' => $this->request->variable('message', '', true), 'MARKER_OPTIONS' => $this->marker_image_select($marker, 'marker/things/'), 'USERMAP_MARKER_PATH' => $path, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => 1, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'FORM_TITLE' => $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name'])))); return $this->helper->render('usermap_thing_form.html', $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name']))); }
/** * Delete the user * * @param type $event */ public function ucp_profile_reg_details_data($event) { $this->user->add_lang(array('acp/common', 'acp/users')); $delete_type = request_var('delete_type', ''); $this->template->assign_vars(array('AUTH_DELETE_POSTS' => $this->auth->acl_get('u_self_delete_posts') ? true : false)); if ($event['submit'] && $delete_type) { if ($this->user->data['user_type'] == USER_FOUNDER) { $this->error[] = 'CANNOT_REMOVE_FOUNDER'; } if (!sizeof($this->error)) { if (confirm_box(true)) { $delete_type = $this->auth->acl_get('u_self_delete_posts') ? $delete_type : 'remove'; user_delete($delete_type, $this->user->data['user_id'], $this->user->data['username']); add_log('admin', 'LOG_USER_DELETED', $this->user->data['username']); trigger_error($this->user->lang['USER_DELETED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . generate_board_url() . '">', '</a>')); } else { confirm_box(false, $this->user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('delete' => 1, 'form_token' => $this->request->variable('form_token', ''), 'submit' => true, 'cur_password' => $this->request->variable('cur_password', '', true), 'delete_type' => $delete_type))); } } } }
/** * Wrapper for \acp_modules::get_module_infos() * * @param string $class Module Class * @param string $basename Module Basename * @return array Module Information * @throws \phpbb\db\migration\exception */ protected function get_module_info($class, $basename) { if (!class_exists('acp_modules')) { include $this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext; $this->user->add_lang('acp/modules'); } $acp_modules = new \acp_modules(); $module = $acp_modules->get_module_infos($basename, $class, true); if (empty($module)) { throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); } return array_pop($module); }