/** * Show a message if can't view topics * * @param object $event The event object * @return null * @access public */ public function modify_template_vars($event) { if (!$this->auth->acl_get('f_topic_view', $event['forum_id'])) { $this->user->add_lang_ext('rmcgirr83/topicrestriction', 'common'); $this->template->assign_var('S_CAN_VIEW_TOPICS', true); } }
/** * {@inheritdoc} */ public function get_template_side($module_id) { if (isset($this->config['board3_clock_src_' . $module_id]) && !empty($this->config['board3_clock_src_' . $module_id])) { $this->template->assign_var('B3P_CLOCK_SRC', $this->config['board3_clock_src_' . $module_id]); } return 'clock_side.html'; }
/** * Update the template variables * * @param object $event The event object * @return null * @access public */ public function page_header($event) { // Let's try and set the base language, if not default to 'en' $lang_array = array('af', 'sq', 'ar', 'hy', 'az', 'eu', 'be', 'bn', 'bs', 'bg', 'my', 'ca', 'ceb', 'zh-CN', 'zh-TW', 'hr', 'cs', 'da', 'nl', 'en', 'eo', 'et', 'tl', 'fi', 'fr', 'gl', 'ka', 'de', 'el', 'gu', 'ht', 'ha', 'iw', 'hi', 'hmn', 'hu', 'is', 'ig', 'id', 'ga', 'it', 'ja', 'jv', 'kn', 'kk', 'km', 'ko', 'lo', 'la', 'lv', 'lt', 'mk', 'mg', 'ms', 'ml', 'mt', 'mi', 'mr', 'mn', 'no', 'ny', 'fa', 'pl', 'pt', 'pa', 'ro', 'ru', 'sr', 'si', 'sk', 'sl', 'so', 'es', 'su', 'sw', 'sv', 'tg', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz', 'vi', 'cy', 'yi', 'yo', 'zu'); $base_lang = in_array($this->config['default_lang'], $lang_array) ? $this->config['default_lang'] : 'en'; $this->template->assign_var('BASE_LANG', $base_lang); }
/** * Display support topics from all contributions or of a specific type. * * @param string $type Contribution type's string identifier * @return \Symfony\Component\HttpFoundation\Response */ public function display_topics($type) { $type_id = $this->get_type_id($type); if ($type_id === false) { return $this->helper->error('NO_PAGE', 404); } if ($type == 'all') { // Mark all topics read if ($this->request->variable('mark', '') == 'topics') { $this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT); } // Mark all topics read $this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics'))); } $this->display->assign_global_vars(); $u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all')); $this->template->assign_var('U_ALL_SUPPORT', $u_all_support); // Generate the main breadcrumbs $this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support)); // Links to the support topic lists foreach ($this->types->get_all() as $id => $class) { $this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs)); } $data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id)); // Canonical URL $data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type))); $this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical()); return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE'); }
/** * Show a message if can't post without approval * * @param object $event The event object * @return null * @access public */ public function modify_template_vars($event) { if ($this->check_auth($event['forum_id'])) { $this->user->add_lang_ext('rmcgirr83/newtopicsneedapproval', 'common'); $this->template->assign_var('S_REQUIRES_APPROVAL', true); } }
/** * Get config var * * @return null * @access public */ public function get_holiday_config() { /* XMAS Start */ $this->template->assign_var('S_ENABLE_XMAS', $this->config['enable_xmas']); /* XMAS Stop */ /* VALENTINE Start */ $this->template->assign_var('S_ENABLE_VALENTINE', $this->config['enable_valentine']); /* VALENTINE Stop */ }
/** * Load and set Layout Sections during * early phpbb page / template processing * * @param Event $event */ public function initContaoLayout(data $event) { // Load dynamic rendered layout sections // and syncs session for loggedin users $sections = $this->contaoConnector->loadLayout(); if (isset($sections->overall_header)) { $this->template->assign_var('CONTAO_LAYOUT_HEADER', $sections->overall_header); } if (isset($sections->overall_footer)) { $this->template->assign_var('CONTAO_LAYOUT_FOOTER', $sections->overall_footer); } }
public function show() { $this->phpbb_container->get('blitze.sitemaker.util')->add_assets(array('css' => array('@blitze_sitemaker/vendor/fontawesome/css/font-awesome.min.css'))); $this->template->assign_var('L_INDEX', $this->user->lang('HOME')); if ($this->page_can_have_blocks()) { $edit_mode = $this->toggle_edit_mode(); $display_mode = $this->get_display_modes(); $u_edit_mode = $this->get_edit_mode_url($edit_mode, $display_mode); $this->show_blocks($edit_mode, $display_mode); $this->template->assign_vars(array('S_SITEMAKER' => true, 'U_EDIT_MODE' => $u_edit_mode)); } }
/** * Display blocks for current route * * @param bool $edit_mode * @param array $route_info * @param int $style_id * @param $display_modes */ public function display($edit_mode, array $route_info, $style_id, array $display_modes) { $ex_positions = $route_info['ex_positions']; $users_groups = $this->groups->get_users_groups(); $positions = $this->get_blocks_for_route($route_info, $style_id, $edit_mode); $blocks_per_position = array(); foreach ($positions as $position => $blocks) { $pos_count_key = "s_{$position}_count"; $blocks_per_position[$pos_count_key] = 0; $this->show_position($position, $blocks, $ex_positions, $users_groups, $blocks_per_position[$pos_count_key], $display_modes, $edit_mode); } $this->template->assign_var('S_HAS_BLOCKS', sizeof($positions)); $this->template->assign_vars(array_change_key_case($blocks_per_position, CASE_UPPER)); }
/** * {@inheritdoc} */ public function get_template_side($module_id) { $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 = $this->db->sql_query($sql, 3600); while ($row = $this->db->sql_fetchrow($result)) { $style = $this->request->variable('style', 0); if (!empty($style)) { $url = str_replace('style=' . $style, 'style=' . $row['style_id'], $this->modules_helper->route('board3_portal_controller')); } else { $url = $this->modules_helper->route('board3_portal_controller') . '?style=' . $row['style_id']; } ++$style_count; $style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>'; } $this->db->sql_freeresult($result); if (strlen($style_select)) { $this->template->assign_var('STYLE_SELECT', $style_select); } // Assign specific vars $this->template->assign_vars(array('S_STYLE_OPTIONS' => $this->config['override_user_style'] || $style_count < 2 ? '' : $style_select)); return 'stylechanger_side.html'; }
function acp_page($id, &$module) { $captcha_vars = array(self::$CONFIG_SITEKEY => 'RECAPTCHA2_SITEKEY', self::$CONFIG_SECRETKEY => 'RECAPTCHA2_SECRETKEY'); $module->tpl_name = '@gothick_recaptcha2/captcha_recaptcha2_acp'; $module->page_title = 'ACP_VC_SETTINGS'; $form_key = 'acp_captcha'; add_form_key($form_key); if ($this->request->is_set_post('submit') && check_form_key($form_key)) { $captcha_vars = array_keys($captcha_vars); foreach ($captcha_vars as $captcha_var) { $value = $this->request->variable($captcha_var, ''); if ($value) { $this->config->set($captcha_var, $value); } } $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CONFIG_VISUAL'); trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); } else { if ($this->request->is_set_post('submit')) { trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); } } foreach ($captcha_vars as $captcha_var => $template_var) { $var = $this->request->is_set_post($captcha_var) ? $this->request->variable($captcha_var, '') : (isset($this->config[$captcha_var]) ? $this->config[$captcha_var] : ''); $this->template->assign_var($template_var, $var); } $this->template->assign_vars(array('CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_service_name(), 'U_ACTION' => $module->u_action)); }
/** * {@inheritdoc} */ public function add_user_form_group($title, $form) { $this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form)); $this->template->assign_block_vars('options', array('LEGEND' => $this->language->lang($title), 'S_LEGEND' => true)); foreach ($form as $input_name => $input_options) { if (!isset($input_options['type'])) { continue; } $tpl_ary = array(); $tpl_ary['TYPE'] = $input_options['type']; $tpl_ary['TITLE'] = $this->language->lang($input_options['label']); $tpl_ary['KEY'] = $input_name; $tpl_ary['S_EXPLAIN'] = false; if (isset($input_options['default'])) { $default = $input_options['default']; $default = preg_replace_callback('#\\{L_([A-Z0-9\\-_]*)\\}#s', array($this, 'lang_replace_callback'), $default); $tpl_ary['DEFAULT'] = $default; } if (isset($input_options['description'])) { $tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']); $tpl_ary['S_EXPLAIN'] = true; } if (in_array($input_options['type'], array('select', 'radio'))) { for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) { if (isset($input_options['options'][$i]['label'])) { $input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']); } } $tpl_ary['OPTIONS'] = $input_options['options']; } $this->template->assign_block_vars('options', $tpl_ary); } $this->template->set_filenames(array('form_install' => 'installer_form.html')); $this->form = $this->template->assign_display('form_install'); }
/** * Display all channels and news * * @return void * @access public */ public function news_overview() { // Catch all channels from the database $csql = 'SELECT c.channel_id, g.group_name, c.channel_name, c.vRefresh FROM phpbb_consim_news_channel c INNER JOIN ' . GROUPS_TABLE . ' g ON c.group_id = g.group_id'; $cresult = $this->db->sql_query($csql); while ($crow = $this->db->sql_fetchrow($cresult)) { $this->template->assign_block_vars('allChannels', array('GROUP' => isset($this->user->lang['G_' . $crow['group_name']]) ? $this->user->lang['G_' . $crow['group_name']] : $crow['group_name'], 'CHANNELNAME' => $crow['channel_name'], 'VREFRESH' => $crow['vRefresh'] == 1 ? $this->user->lang['YES'] : $this->user->lang['NO'], 'EDITCHANNEL' => build_url("action") . "&action=edit_channel&channel_id=" . $crow['channel_id'])); } // Add link to add a channel $this->template->assign_var('ADDCHANNEL', build_url("action") . "&action=add_channel"); // Catch all topics from the database $tsql = 'SELECT topic_id, topic_name FROM phpbb_consim_news_topics'; $tresult = $this->db->sql_query($tsql); while ($trow = $this->db->sql_fetchrow($tresult)) { $this->template->assign_block_vars('allTopics', array('TOPICID' => $trow['topic_id'], 'DELETETOPIC' => build_url("action") . '&action=delete_topic&topic_id=' . $trow['topic_id'], 'NAME' => $trow['topic_name'])); } // Catch all news from the database $nsql = "SELECT n.news_id, n.content, c.channel_name, t.topic_name FROM phpbb_consim_news n\n\t\t\tINNER JOIN phpbb_consim_news_channel c ON n.channel_id = c.channel_id\n\t\t\tINNER JOIN phpbb_consim_news_topics t ON n.topic_id = t.topic_id\n\t\t\tORDER BY news_id ASC"; $nresult = $this->db->sql_query($nsql); while ($nrow = $this->db->sql_fetchrow($nresult)) { $this->template->assign_block_vars('NewsBlock', array('CONTENT' => $nrow['content'], 'CHANNEL' => $nrow['channel_name'], 'TOPIC' => $nrow['topic_name'], 'EDITNEWS' => build_url("action") . "&action=edit_news&news_id=" . $nrow['news_id'])); } // Add link to add a news $this->template->assign_var('ADDNEWS', build_url("action") . "&action=add_news"); }
/** * Display author details page. * * @return \Symfony\Component\HttpFoundation\Response */ protected function details() { $this->author->get_rating(); // Canonical URL $this->template->assign_var('U_CANONICAL', $this->author->get_url()); return $this->helper->render('authors/author_details.html', $this->get_title('AUTHOR_DETAILS')); }
/** * List installed styles */ protected function show_installed() { // Get all installed styles $styles = $this->get_styles(); if (!count($styles)) { trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } usort($styles, array($this, 'sort_styles')); // Get users $users = $this->get_users(); // Add users counter to rows foreach ($styles as &$style) { $style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0; } // Set up styles list variables // Addons should increase this number and update template variable $this->styles_list_cols = 4; $this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols); // Show styles list $this->show_styles_list($styles, 0, 0); // Show styles with invalid inherits_id foreach ($styles as $style) { if (empty($style['_shown'])) { $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree'])); $this->list_style($style, 0); } } // Add buttons $this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'activate', 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE'])); $this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'deactivate', 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE'])); if (isset($this->style_counters) && $this->style_counters['total'] > 1) { $this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'uninstall', 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'])); } }
/** * Modifies the page header */ public function page_header() { if (!defined('PHPBB_USE_BOARD_URL_PATH')) { define('PHPBB_USE_BOARD_URL_PATH', true); } $this->times = ['online' => $this->config['status_online_chat'], 'idle' => $this->config['status_idle_chat'], 'offline' => $this->config['status_offline_chat']]; $this->user->add_lang_ext('spaceace/ajaxchat', 'ajax_chat'); //Declares the ACP switches if ($this->config['display_ajax_chat'] === '1') { $this->template->assign_var('S_CHAT_ENABLED', true); } if ($this->config['whois_chatting'] === '1') { $this->template->assign_var('S_WHOIS_CHATTING', true); } if ($this->config['location_ajax_chat'] === '1') { $this->template->assign_var('S_AJAX_CHAT_ACP_POSITION', true); } if ($this->config['location_ajax_chat_override'] === '1') { $this->template->assign_var('S_AJAX_CHAT_POSITION_OVERRIDE', true); } //Declaring a few UCP switches and basic values $this->template->assign_vars(array('U_CHAT' => $this->helper->route('spaceace_ajaxchat_chat'), 'S_SHOUT' => true, 'DEFAULT_COLOR' => $this->config['default_color_ajax_chat'], 'CHAT_RULES' => $this->config['rule_ajax_chat'], 'SCRIPT_PATH' => $this->config['script_path'], 'COOKIE_NAME' => $this->config['cookie_name'] . '_fonthold', 'EXT_PATH' => $this->ext_manager->get_extension_path('spaceace/ajaxchat', true), 'S_AJAX_CHAT_VIEW' => $this->user->data['user_ajax_chat_view'], 'S_AJAX_CHAT_AVATARS' => $this->user->data['user_ajax_chat_avatars'], 'S_AJAX_CHAT_POSITION' => $this->user->data['user_ajax_chat_position'], 'S_AJAX_CHAT_SOUND' => $this->user->data['user_ajax_chat_sound'], 'S_AJAX_CHAT_AVATAR_HOVER' => $this->user->data['user_ajax_chat_avatar_hover'], 'S_AJAX_CHAT_ONLINELIST' => $this->user->data['user_ajax_chat_onlinelist'], 'S_AJAXCHAT_VIEW' => $this->auth->acl_get('u_ajaxchat_view'), 'S_AJAXCHAT_POST' => $this->auth->acl_get('u_ajaxchat_post'), 'S_AJAXCHAT_BBCODE' => $this->auth->acl_get('u_ajaxchat_bbcode'), 'M_AJAXCHAT_DELETE' => $this->auth->acl_get('m_ajaxchat_delete'))); if (!$this->config['index_display_ajax_chat']) { $this->template->assign_var('S_AJAX_CHAT_VIEW', $this->config['index_display_ajax_chat']); } }
/** * Show a message if can't post without approval * * @param object $event The event object * @return null * @access public */ public function modify_template_vars($event) { $forum_id = $event['forum_id']; if (!$this->check_auth($forum_id)) { $this->user->add_lang_ext('rmcgirr83/topicrestriction', 'common'); $this->template->assign_var('S_CAN_VIEW_TOPICS', true); } }
/** * Get user engagement stats */ public function user_contributions() { // percent users involved $sql = 'SELECT COUNT(*) AS posters FROM ' . USERS_TABLE . ' WHERE user_posts <> 0'; $result = $this->db->sql_query($sql); $posters = $this->db->sql_fetchfield('posters'); $this->db->sql_freeresult($result); $this->template->assign_var('PERCENT_CONTRIB', sprintf('%.1f', $posters / $this->config['num_users'] * 100)); }
public function top_rating() { if (!$this->config['top_rating_integrate'] || !$this->config['top_rating_type'] && !isset($this->user->data['user_type'])) { return; } if ($this->config['top_rating_integrate'] == 1) { $this->template->assign_var('TOP_COUNT', $this->config['top_per_page']); $this->rating->view_top(array(), $this->config['top_per_page']); } else { if ($this->config['top_rating_integrate'] == 2) { $this->rating->view_cat(); } } if ($this->config['top_rating_anounce']) { $this->rating->view_announce(); } $this->template->assign_vars(array('U_MARK_FORUMS' => '', 'L_NO_FORUMS' => $this->config['top_rating_desc'])); }
/** * Assign branch sort options to template. */ protected function assign_branches() { foreach ($this->get_branches() as $branch => $vars) { $this->template->assign_block_vars('sort_branches', $vars); if ($vars['ACTIVE']) { $this->template->assign_var('ACTIVE_BRANCH', $vars['NAME']); } } }
/** * Assign template variables if quick reply is enabled * * @param int $forum_id Forum ID */ public function assign_template_variables_for_qr($forum_id) { if ($this->phpbb_extension_manager->is_enabled('rxu/PostsMerging') && $this->user->data['is_registered'] && $this->config['merge_interval']) { // Always show the checkbox if PostsMerging extension is installed. $this->user->add_lang_ext('rxu/PostsMerging', 'posts_merging'); $this->template->assign_var('POSTS_MERGING_OPTION', true); } $this->template->assign_vars(array('S_QR_COLOUR_NICKNAME' => $this->config['qr_color_nickname'], 'S_QR_NOT_CHANGE_SUBJECT' => $this->auth->acl_get('f_qr_change_subject', $forum_id) ? false : true, 'QR_HIDE_SUBJECT_BOX' => $this->config['qr_hide_subject_box'], 'S_QR_COMMA_ENABLE' => $this->config['qr_comma'], 'S_QR_QUICKNICK_ENABLE' => $this->config['qr_quicknick'], 'S_QR_QUICKNICK_REF' => $this->config['qr_quicknick_ref'], 'S_QR_QUICKNICK_PM' => $this->config['qr_quicknick_pm'], 'S_QR_QUICKQUOTE_ENABLE' => $this->config['qr_quickquote'], 'S_QR_QUICKQUOTE_LINK' => $this->config['qr_quickquote_link'], 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote'], 'S_QR_CE_ENABLE' => $this->config['qr_ctrlenter'], 'QR_SOURCE_POST' => $this->config['qr_source_post'], 'S_DISPLAY_USERNAME' => !$this->user->data['is_registered'], 'MESSAGE' => $this->request->variable('message', '', true), 'READ_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_QR_CAPS_ENABLE' => $this->config['qr_capslock_transfer'], 'S_QR_SHOW_BUTTON_TRANSLIT' => $this->config['qr_show_button_translit'], 'L_FULL_EDITOR' => $this->config['qr_ajax_submit'] ? $this->user->lang['PREVIEW'] : $this->user->lang['FULL_EDITOR'], 'S_QR_AJAX_SUBMIT' => $this->config['qr_ajax_submit'], 'S_QR_AJAX_PAGINATION' => $this->config['qr_ajax_pagination'] && $this->user->data['ajax_pagination'], 'S_QR_ENABLE_SCROLL' => $this->user->data['qr_enable_scroll'], 'S_QR_SCROLL_INTERVAL' => $this->config['qr_scroll_time'], 'S_QR_SOFT_SCROLL' => $this->config['qr_scroll_time'] && $this->user->data['qr_soft_scroll'], 'S_QR_ALLOWED_GUEST' => $this->config['qr_allow_for_guests'] && $this->user->data['user_id'] == ANONYMOUS, 'S_ABBC3_INSTALLED' => $this->phpbb_extension_manager->is_enabled('vse/abbc3'))); }
public function show() { $this->util->add_assets(array('css' => array($this->util->asset_path . 'ext/blitze/sitemaker/components/fontawesome/css/font-awesome.min.css'))); $this->template->assign_var('L_INDEX', $this->user->lang('HOME')); if ($this->page_can_have_blocks() === false) { return; } $edit_mode = $this->toggle_edit_mode(); $route = $this->get_route(); $style_id = $this->get_style_id(); $display_mode = $this->get_display_modes(); $u_edit_mode = $this->get_edit_mode_url($edit_mode, $display_mode); $blocks = $this->phpbb_container->get('blitze.sitemaker.blocks'); $route_info = $blocks->get_route_info($route, $style_id, $edit_mode); $this->show_admin_bar($edit_mode, $route_info); $blocks->display($edit_mode, $route_info, $style_id, $display_mode); $this->template->assign_vars(array('S_SITEMAKER' => true, 'U_EDIT_MODE' => $u_edit_mode)); }
/** * Parse template variables for module * * @param int $module_id Module ID * @param string $type Module type (center or side) * * @return string Template file name or false if nothing should * be displayed */ protected function parse_template($module_id, $type) { $attach_forums = false; $where = ''; // Get filetypes and put them into an array $filetypes = $this->get_selected_filetypes($module_id); if ($this->config['board3_attachments_forum_ids_' . $module_id] !== '') { $attach_forums_config = strpos($this->config['board3_attachments_forum_ids_' . $module_id], ',') !== false ? explode(',', $this->config['board3_attachments_forum_ids_' . $module_id]) : array($this->config['board3_attachments_forum_ids_' . $module_id]); $forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true))); if ($this->config['board3_attachments_forum_exclude_' . $module_id]) { $forum_list = array_unique(array_diff($forum_list, $attach_forums_config)); } else { $forum_list = array_unique(array_intersect($attach_forums_config, $forum_list)); } } else { $forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true))); } if (sizeof($forum_list)) { $attach_forums = true; $where = 'AND ' . $this->db->sql_in_set('t.forum_id', $forum_list); } if (sizeof($filetypes)) { if ($this->config['board3_attachments_exclude_' . $module_id]) { $where .= ' AND ' . $this->db->sql_in_set('a.extension', $filetypes, true); } else { $where .= ' AND ' . $this->db->sql_in_set('a.extension', $filetypes); } } if ($attach_forums === true) { // Just grab all attachment info from database $sql = 'SELECT a.*, t.forum_id FROM ' . ATTACHMENTS_TABLE . ' a, ' . TOPICS_TABLE . ' t WHERE a.topic_id <> 0 AND a.topic_id = t.topic_id ' . $where . ' ORDER BY filetime ' . (!$this->config['display_order'] ? 'DESC' : 'ASC') . ', post_msg_id ASC'; $result = $this->db->sql_query_limit($sql, $this->config['board3_attachments_number_' . $module_id], 0, 600); while ($row = $this->db->sql_fetchrow($result)) { $size_lang = $row['filesize'] >= 1048576 ? $this->user->lang['MIB'] : ($row['filesize'] >= 1024 ? $this->user->lang['KIB'] : $this->user->lang['BYTES']); $row['filesize'] = $row['filesize'] >= 1048576 ? round(round($row['filesize'] / 1048576 * 100) / 100, 2) : ($row['filesize'] >= 1024 ? round(round($row['filesize'] / 1024 * 100) / 100, 2) : $row['filesize']); $raw_filename = utf8_substr($row['real_filename'], 0, strrpos($row['real_filename'], '.')); $replace = character_limit($raw_filename, $this->config['board3_attach_max_length_' . $module_id]); $this->template->assign_block_vars('attach_' . $type, array('FILESIZE' => $row['filesize'] . ' ' . $size_lang, 'FILETIME' => $this->user->format_date($row['filetime']), 'DOWNLOAD_COUNT' => (int) $row['download_count'], 'FILENAME' => $replace, 'REAL_FILENAME' => $row['real_filename'], 'PHYSICAL_FILENAME' => basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], 'POST_IDS' => !empty($post_ids[$row['attach_id']]) ? $post_ids[$row['attach_id']] : '', 'POST_MSG_ID' => $row['post_msg_id'], 'U_FILE' => append_sid($this->phpbb_root_path . 'download/file.' . $this->php_ext, 'id=' . $row['attach_id']), 'U_TOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, 'p=' . $row['post_msg_id'] . '#p' . $row['post_msg_id']))); } $this->db->sql_freeresult($result); $this->template->assign_var('S_DISPLAY_ATTACHMENTS', true); } else { $this->template->assign_var('S_DISPLAY_ATTACHMENTS', false); } return 'attachments_' . $type . '.html'; }
/** * Check if mchat should be displayed on index. * * @param object $event The event object * @return null * @access public */ public function display_mchat_on_index($event) { $mchat_on_index = $this->config['mchat_on_index']; $mchat_view = $this->auth->acl_get('u_mchat_view') ? true : false; if ($mchat_on_index && $mchat_view) { $this->template->assign_var('S_MCHAT_ON_INDEX', true); $this->render_helper->render_data_for_page(true); } }
public function initialize_sceditor() { // Activate the SCEditor $this->template->assign_vars(array('S_SCEDITOR' => true, 'MAX_FONTSIZE' => $this->config['max_post_font_size'], 'U_EMOTICONS_ROOT' => $this->root_path . $this->config['smilies_path'] . '/', 'U_CSS' => $this->root_path . 'ext/cosmo/sceditor/styles/all/template/js/themes/' . $this->css_file)); // Localize it maybe? $lang = $this->get_lang(); if ($lang) { $this->template->assign_var('L_SCEDITOR_LANG', $lang); } // We need to get all smilies with url and code $sql = 'SELECT smiley_url, code FROM ' . SMILIES_TABLE; // Caching the smilies for 10 minutes should be okay // they don't get changed so often $result = $this->db->sql_query($sql, 600); while ($row = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('emoticons', array('code' => $row['code'], 'url' => $row['smiley_url'])); } }
/** * Display blocks for current route * * @param bool $edit_mode * @param array $route_info * @param int $style_id * @param $display_modes */ public function display($edit_mode, array $route_info, $style_id, array $display_modes) { $ex_positions = $route_info['ex_positions']; $users_groups = $this->get_users_groups(); $positions = $this->get_blocks_for_route($route_info, $style_id, $edit_mode); $blocks_per_position = array(); foreach ($positions as $position => $blocks) { $pos_count_key = 's_' . $position . '_count'; $blocks_per_position[$pos_count_key] = 0; if ($this->_exclude_position($position, $ex_positions, $edit_mode)) { continue; } foreach ($blocks as $entity) { $this->render($display_modes, $edit_mode, $entity->to_array(), $users_groups, $blocks_per_position[$pos_count_key]); } } $this->template->assign_var('S_HAS_BLOCKS', sizeof($positions)); $this->template->assign_vars(array_change_key_case($blocks_per_position, CASE_UPPER)); }
/** * Add Whatsapp to contact data * * @param object $event The event object * @return null * @access public */ public function viewtopic_modify_post_row($event) { if ($event['row']['user_allow_whatsapp'] != 1 || empty($event['row']['user_whatsapp'])) { return; } $this->template->assign_var('S_INCLUDE_MOBILENOTIFIER_CSS', true); $cp_row = $event['cp_row']; $cp_row['blockrow'][] = array('PROFILE_FIELD_IDENT' => 'tas2580_whatsap', 'PROFILE_FIELD_NAME' => $this->user->lang('WHATSAPP'), 'PROFILE_FIELD_CONTACT' => $this->helper->route('tas2580_mobilenotifier_send', array('user_id' => $event['row']['user_id'])), 'S_PROFILE_CONTACT' => 1); $event['cp_row'] = $cp_row; }
/** * @param int $user_id * @param bool $admin * @param bool $auto_login * @param bool $viewonline * @param string $class * @return \Symfony\Component\HttpFoundation\Response * @throws http_exception */ public function submit($user_id, $admin, $auto_login, $viewonline, $class) { $this->user->add_lang_ext('paul999/tfa', 'common'); if (!check_form_key('tfa_login_page')) { throw new http_exception(403, 'FORM_INVALID'); } if (empty($this->user->data['tfa_random']) || $user_id != $this->user->data['tfa_uid']) { throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG'); } $random = $this->request->variable('random', ''); if ($this->user->data['tfa_random'] !== $random || strlen($random) !== 40) { throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG'); } $sql_ary = array('tfa_random' => '', 'tfa_uid' => 0); $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\tWHERE\n\t\t\t\tsession_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND\n\t\t\t\tsession_user_id = '" . (int) $this->user->data['user_id']; $this->db->sql_query($sql); if (empty($class)) { throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG'); } $module = $this->session_helper->findModule($class); if ($module == null) { throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG'); } $redirect = $this->request->variable('redirect', "{$this->root_path}/index.{$this->php_ext}"); try { if (!$module->login($user_id)) { $this->template->assign_var('S_ERROR', $this->user->lang('TFA_INCORRECT_KEY')); $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); } } catch (http_exception $ex) { if ($ex->getStatusCode() == 400) { $this->template->assign_var('S_ERROR', $ex->getMessage()); $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); } } $old_session_id = $this->user->session_id; if ($admin) { $cookie_expire = time() - 31536000; $this->user->set_cookie('u', '', $cookie_expire); $this->user->set_cookie('sid', '', $cookie_expire); } $result = $this->user->session_create($user_id, $admin, $auto_login, $viewonline); // Successful session creation if ($result === true) { // If admin re-authentication we remove the old session entry because a new one has been created... if ($admin) { // the login array is used because the user ids do not differ for re-authentication $sql = 'DELETE FROM ' . SESSIONS_TABLE . "\n\t\t\t\t\tWHERE session_id = '" . $this->db->sql_escape($old_session_id) . "'\n\t\t\t\t\tAND session_user_id = " . (int) $user_id; $this->db->sql_query($sql); redirect(append_sid("{$this->root_path}adm/index.{$this->php_ext}", false, true, $this->user->data['session_id'])); } redirect(append_sid($redirect, false, true, $this->user->data['session_id'])); } throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG'); }
/** * Extension front handler method. This is called automatically when your extension is accessed * through index.php?ext=example/foobar * * @param array $columns Columns to display * * @return null */ public function handle($columns = array()) { // Do not run portal if it's already active if ($this->portal_active) { return; } $this->controller_helper->run_initial_tasks(); // Set portal active $this->portal_active = true; // Check if we should limit the columns to display $this->set_allowed_columns($columns); // Set default data $this->portal_modules = obtain_portal_modules(); $display_online = false; /** * set up column_count array * with this we can hide unneeded parts of the portal */ $this->module_count = array('total' => 0, 'top' => 0, 'left' => 0, 'center' => 0, 'right' => 0, 'bottom' => 0); /** * start assigning block vars */ foreach ($this->portal_modules as $row) { if (!($module = $this->controller_helper->get_portal_module($row))) { continue; } // Load module language file $this->controller_helper->load_module_language($module); $template_module = $this->get_module_template($row, $module); if (empty($template_module)) { continue; } // Custom Blocks that have been defined in the ACP will return an array instead of just the name of the template file $this->controller_helper->assign_module_vars($row, $template_module); // Check if we need to show the online list $display_online = $this->controller_helper->check_online_list($row['module_classname'], $display_online); unset($template_module); } // Redirect to index if there are currently no active modules $this->check_redirect(); // Assign specific vars $this->assign_template_vars(); // Return if columns were specified. Columns are only specified if // portal columns are displayed on pages other than the portal itself. if ($this->allowed_columns !== 0) { $this->template->assign_var('S_PORTAL_ALL', true); return; } // And now to output the page. page_header($this->user->lang('PORTAL'), $display_online); // foobar_body.html is in ./ext/foobar/example/styles/prosilver/template/foobar_body.html $this->template->set_filenames(array('body' => 'portal/portal_body.html')); $this->make_jumpbox($this->config['board3_display_jumpbox']); page_footer(); }
public function show_sitemaker() { $this->blocks->show(); $this->set_assets(); if ($this->startpage) { $this->template->destroy_block_vars('navlinks'); $this->template->assign_var('S_PT_SHOW_FORUM', true); } // Hide login/whois/birthday on index_body.html $this->template->assign_vars(array('S_USER_LOGGED_IN' => true, 'S_DISPLAY_ONLINE_LIST' => false, 'S_DISPLAY_BIRTHDAY_LIST' => false)); }