Esempio n. 1
0
 /**
  * Display an article
  *
  * @param	string	$article	URL of the article
  * @return	object
  */
 public function article($article)
 {
     $this->user->add_lang_ext('tas2580/wiki', 'common');
     if (!$this->auth->acl_get('u_wiki_view')) {
         trigger_error('NOT_AUTHORISED');
     }
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
     $this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
     include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
     $action = $this->request->variable('action', '');
     $id = $this->request->variable('id', 0);
     switch ($action) {
         case 'edit':
             return $this->edit->edit_article($article);
         case 'versions':
             return $this->compare->view_versions($article);
         case 'compare':
             $from = $this->request->variable('from', 0);
             $to = $this->request->variable('to', 0);
             return $this->compare->compare_versions($article, $from, $to);
         case 'delete':
             return $this->delete->version($id);
         case 'detele_article':
             return $this->delete->article($article);
         case 'active':
             return $this->edit->active($id);
         case 'deactivate':
             return $this->edit->deactivate($article);
         default:
             return $this->view->view_article($article, $id);
     }
 }
Esempio n. 2
0
 /**
  * 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');
 }
Esempio n. 3
0
    public function get_bookmarks($ext_mode = '', $forums = array())
    {
        define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
        $start = $this->request->variable('start', 0);
        $sql = 'SELECT COUNT(post_id) as posts_count
			FROM ' . POSTS_BOOKMARKS_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'];
        $result = $this->db->sql_query($sql);
        $posts_count = (int) $this->db->sql_fetchfield('posts_count');
        $this->db->sql_freeresult($result);
        $sql_where = $sql_fields = '';
        if ($ext_mode != 'find') {
            $sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
            $sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
        }
        $pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
        $sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
			FROM ' . POSTS_BOOKMARKS_TABLE . ' b
			LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
			LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
			' . $sql_where . '
			WHERE b.user_id = ' . $this->user->data['user_id'] . '
			ORDER BY b.bookmark_time ASC';
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
            $post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
            // Send vars to template
            $this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
    }
Esempio n. 4
0
    /**
     * Controller for route /paypal
     *
     * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
     */
    public function page()
    {
        $this->user->add_lang_ext('tas2580/paypal', 'common');
        $amount_list = '';
        $sql = 'SELECT *
			FROM ' . $this->table_amount . '
			ORDER BY amount_value';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $amount_list .= '<option value="' . number_format($row['amount_value'] / 100, 2) . '">' . number_format($row['amount_value'] / 100, 2) . '</option>';
        }
        $sql = 'SELECT *
			FROM ' . $this->table_items . '
			ORDER BY item_name';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('items', array('ITEM_NAME' => $row['item_name'], 'ITEM' => generate_text_for_display($row['item_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'ITEM_ID' => $row['item_id']));
        }
        $sql = 'SELECT *
			FROM ' . $this->table_config;
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->template->assign_vars(array('PAYPAL_TITLE' => $row['paypal_title'], 'PAYPAL_TEXT' => generate_text_for_display($row['paypal_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'PAYPAL_EMAIL' => $row['paypal_email'], 'AMOUNT_LIST' => $amount_list, 'PAYPAL_ACTION' => $row['paypal_sandbox'] == 1 ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'S_SANDBOX' => $row['paypal_sandbox'] == 1 ? true : false, 'S_CURL' => function_exists('curl_init'), 'CURRENCY_CODE' => $this->currency_code_select($row['paypal_currency']), 'CURRENCY' => $row['paypal_currency'], 'USER_ID' => $this->user->data['user_id'], 'IPN_URL' => $this->helper->route('tas2580_paypal_ipn', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL), 'RETURN_URL' => $this->helper->route('tas2580_paypal_controller', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL)));
        return $this->helper->render('paypal_body.html', $row['paypal_title']);
    }
    function main()
    {
        $sql = 'SELECT *
				FROM ' . $this->points_values_table;
        $result = $this->db->sql_query($sql);
        $points_values = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // Add part to bar
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'FORUM_NAME' => sprintf($this->user->lang['POINTS_INFO'], $this->config['points_name'])));
        // Read out all the need values
        $info_attach = $points_values['points_per_attach'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach']) . '&nbsp;' . $this->config['points_name']);
        $info_addtional_attach = $points_values['points_per_attach_file'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach_file']) . '&nbsp;' . $this->config['points_name']);
        $info_poll = $points_values['points_per_poll'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll']) . '&nbsp;' . $this->config['points_name']);
        $info_poll_option = $points_values['points_per_poll_option'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll_option']) . '&nbsp;' . $this->config['points_name']);
        $info_topic_word = $points_values['points_per_topic_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_word']) . '&nbsp;' . $this->config['points_name']);
        $info_topic_character = $points_values['points_per_topic_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_character']) . '&nbsp;' . $this->config['points_name']);
        $info_post_word = $points_values['points_per_post_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_word']) . '&nbsp;' . $this->config['points_name']);
        $info_post_character = $points_values['points_per_post_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_character']) . '&nbsp;' . $this->config['points_name']);
        $info_cost_warning = $points_values['points_per_warn'] == 0 ? sprintf($this->user->lang['INFO_NO_COST'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_warn']) . '&nbsp;' . $this->config['points_name']);
        $info_reg_bonus = $points_values['reg_points_bonus'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['reg_points_bonus']) . '&nbsp;' . $this->config['points_name']);
        $info_points_bonus = $points_values['points_bonus_chance'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->user->lang['INFO_BONUS_CHANCE_EXPLAIN'], $this->functions_points->number_format_points($points_values['points_bonus_chance']), $this->functions_points->number_format_points($points_values['points_bonus_min']), $this->functions_points->number_format_points($points_values['points_bonus_max']), $this->config['points_name']);
        $this->template->assign_vars(array('USER_POINTS' => sprintf($this->functions_points->number_format_points($this->user->data['user_points'])), 'POINTS_NAME' => $this->config['points_name'], 'LOTTERY_NAME' => $points_values['lottery_name'], 'BANK_NAME' => $points_values['bank_name'], 'POINTS_INFO_DESCRIPTION' => sprintf($this->user->lang['POINTS_INFO_DESCRIPTION'], $this->config['points_name']), 'INFO_ATTACH' => $info_attach, 'INFO_ADD_ATTACH' => $info_addtional_attach, 'INFO_POLL' => $info_poll, 'INFO_POLL_OPTION' => $info_poll_option, 'INFO_TOPIC_WORD' => $info_topic_word, 'INFO_TOPIC_CHARACTER' => $info_topic_character, 'INFO_POST_WORD' => $info_post_word, 'INFO_POST_CHARACTER' => $info_post_character, 'INFO_COST_WARNING' => $info_cost_warning, 'INFO_REG_BONUS' => $info_reg_bonus, 'INFO_POINTS_BONUS' => $info_points_bonus, 'U_TRANSFER_USER' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'transfer_user')), 'U_LOGS' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'logs')), 'U_LOTTERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'lottery')), 'U_BANK' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank')), 'U_ROBBERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'robbery')), 'U_INFO' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'U_USE_TRANSFER' => $this->auth->acl_get('u_use_transfer'), 'U_USE_LOGS' => $this->auth->acl_get('u_use_logs'), 'U_USE_LOTTERY' => $this->auth->acl_get('u_use_lottery'), 'U_USE_BANK' => $this->auth->acl_get('u_use_bank'), 'U_USE_ROBBERY' => $this->auth->acl_get('u_use_robbery')));
        // Generate the page
        page_header($this->user->lang['POINTS_INFO']);
        // Generate the page template
        $this->template->set_filenames(array('body' => 'points/points_info.html'));
        page_footer();
    }
Esempio n. 6
0
    public function page_header_after($event)
    {
        $context = $this->phpbb_container->get('template_context');
        $rootref =& $context->get_root_ref();
        if (isset($this->config['menu_enabled']) && $this->config['menu_enabled']) {
            $sql = 'SELECT *
				FROM ' . $this->menu_colors;
            $result = $this->db->sql_query($sql);
            $row = $this->db->sql_fetchrow($result);
            if ($this->db->sql_affectedrows()) {
                $this->template->assign_vars(array('S_MENU_COLOR' => $row['color_name'], 'S_MENU_FONT_COLOR' => $row['color_text'], 'S_MENU_FONT_COLOR_HOVER' => $row['color_text_hover'], 'S_MENU_DECORATION' => $row['color_text_hover_decor'], 'S_MENU_WEIGHT' => $row['color_text_weight'], 'S_MENU_SEARCH' => $row['color_display_search'], 'S_MENU_TEXT_TRANSFORM' => $row['color_text_transform'], 'S_MENU_ALIGN' => $row['color_align']));
                $sql = 'SELECT *
					FROM ' . $this->menu_buttons . '
					WHERE button_display = 1
						AND parent_id = 0
					ORDER BY left_id';
                $result = $this->db->sql_query($sql);
                while ($row = $this->db->sql_fetchrow($result)) {
                    if ($row['button_only_registered'] && $this->user->data['user_id'] == ANONYMOUS || $row['button_only_guest'] && $this->user->data['user_id'] != ANONYMOUS) {
                        continue;
                    }
                    if (preg_match("/\\{(.*)\\}/", $row['button_url'])) {
                        $brackets = array("{", "}");
                        $var_name = strtoupper(str_replace($brackets, '', $row['button_url']));
                        $row['button_url'] = $rootref[$var_name];
                    }
                    if (preg_match("/\\{(.*)\\}/", $row['button_name'])) {
                        $brackets = array("{L_", "}");
                        $var_name = strtoupper(str_replace($brackets, '', $row['button_name']));
                        $row['button_name'] = $this->user->lang[$var_name];
                    }
                    $this->template->assign_block_vars('buttons', array('ID' => $row['button_id'], 'URL' => $row['button_url'], 'NAME' => $row['button_name'], 'EXTERNAL' => $row['button_external']));
                    $sub_sql = 'SELECT *
						FROM ' . $this->menu_buttons . '
						WHERE button_display = 1
							AND parent_id = ' . $row['button_id'] . '
						ORDER BY left_id';
                    $sub_result = $this->db->sql_query($sub_sql);
                    while ($sub_row = $this->db->sql_fetchrow($sub_result)) {
                        if ($sub_row['button_only_registered'] && $this->user->data['user_id'] == ANONYMOUS || $sub_row['button_only_guest'] && $this->user->data['user_id'] != ANONYMOUS) {
                            continue;
                        }
                        if (preg_match("/\\{(.*)\\}/", $sub_row['button_url'])) {
                            $brackets = array("{", "}");
                            $var_name = strtoupper(str_replace($brackets, '', $sub_row['button_url']));
                            $sub_row['button_url'] = $rootref[$var_name];
                        }
                        if (preg_match("/\\{(.*)\\}/", $sub_row['button_name'])) {
                            $brackets = array("{L_", "}");
                            $var_name = strtoupper(str_replace($brackets, '', $sub_row['button_name']));
                            $sub_row['button_name'] = $this->user->lang[$var_name];
                        }
                        $this->template->assign_block_vars('buttons.sub', array('ID' => $sub_row['button_id'], 'URL' => $sub_row['button_url'], 'NAME' => $sub_row['button_name'], 'EXTERNAL' => $sub_row['button_external']));
                    }
                    $this->db->sql_freeresult($sub_result);
                }
                $this->db->sql_freeresult($result);
            }
        }
    }
 /**
  * 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));
 }
Esempio n. 8
0
 public function display_list()
 {
     $this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
     /**
      * From phpBB faq.php
      */
     // Pull the array data from the lang pack
     $switch_column = $found_switch = false;
     $help_blocks = array();
     foreach ($this->user->help as $help_ary) {
         if ($help_ary[0] == '--') {
             if ($help_ary[1] == '--') {
                 $switch_column = true;
                 $found_switch = true;
                 continue;
             }
             $this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
             if ($switch_column) {
                 $switch_column = false;
             }
             continue;
         }
         $this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
     }
     // Lets build a page ...
     $this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
     $this->display->assign_global_vars();
     return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
 }
Esempio n. 9
0
 public function crawler()
 {
     $this->template->assign_vars(array('S_CRAWLER' => true, 'S_CRAWLER_SPEED' => $this->config['crawler_speed'], 'S_CRAWLER_BEHAVIOR' => $this->config['crawler_behavior'], 'S_CRAWLER_NEUTRAL' => $this->config['crawler_neutral'], 'S_CRAWLER_DIRECTION' => $this->config['crawler_direction'], 'S_CRAWLER_MOVEATLEAST' => $this->config['crawler_moveatleast']));
     $crawler_ids = explode(',', $this->config['crawler_id']);
     foreach ($crawler_ids as $crawler_id) {
         $this->template->assign_block_vars('crawlerrow', array('CRAWLER_ID' => trim($crawler_id)));
     }
 }
Esempio n. 10
0
 public function handle()
 {
     if (!function_exists('display_forums')) {
         include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     }
     display_forums('', $this->config['load_moderators']);
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('FORUM'), 'U_VIEW_FORUM' => $this->helper->route('blitze_sitemaker_forum')));
     return $this->helper->render('index_body.html', $this->user->lang('FORUM_INDEX'));
 }
Esempio n. 11
0
 /**
  * Pass assets to template
  */
 public function set_assets()
 {
     $this->_prep_scripts();
     foreach ($this->scripts as $type => $scripts) {
         foreach ($scripts as $file) {
             $this->template->assign_block_vars($type, array('UA_FILE' => trim($file)));
         }
     }
     $this->scripts = array();
 }
Esempio n. 12
0
    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $sql = 'SELECT user_id, username, user_posts, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . "\n\t\t\t\tAND user_posts <> 0\n\t\t\t\tAND username <> ''\n\t\t\tORDER BY user_posts DESC";
        $result = $this->db->sql_query_limit($sql, $this->config['board3_topposters_' . $module_id], 0, 600);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('topposters', array('S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&amp;sr=posts'), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'POSTER_POSTS' => $row['user_posts']));
        }
        $this->db->sql_freeresult($result);
        return 'topposters_side.html';
    }
Esempio n. 13
0
    /**
     * This method is called to show the UCP page.
     * You can assign template variables to the template, or do anything else here.
     *
     * @param string $table
     * @param string $where Extra where clause. Please make sure to use AND as first.
     */
    protected function show_ucp_complete($table, $where = '')
    {
        $sql = 'SELECT *
			FROM ' . $this->db->sql_escape($table) . '
			WHERE user_id = ' . (int) $this->user->data['user_id'] . ' ' . $where . '
			ORDER BY registration_id ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('keys', array('CLASS' => $this->get_name(), 'ID' => $row['registration_id'], 'REGISTERED' => $this->user->format_date($row['registered']), 'LAST_USED' => $row['last_used'] ? $this->user->format_date($row['last_used']) : false, 'TYPE' => $this->user->lang($this->get_translatable_name())));
        }
        $this->db->sql_freeresult($result);
    }
Esempio n. 14
0
 /**
  * Render block
  *
  * @param array $display_modes
  * @param bool $edit_mode
  * @param array $data
  * @param array $users_groups
  * @param int $position_counter
  */
 public function render(array $display_modes, $edit_mode, array $data, array $users_groups, &$position_counter)
 {
     $position = $data['position'];
     $service_name = $data['name'];
     if ($this->_block_is_viewable($data, $display_modes, $users_groups, $edit_mode) && ($block_instance = $this->block_factory->get_block($service_name)) !== null) {
         $block = $block_instance->display($data, $edit_mode);
         if ($content = $this->_get_block_content($block, $edit_mode)) {
             $tpl_data = array_merge($data, array('TITLE' => $this->_get_block_title($data['title'], $block['title']), 'CONTENT' => $content));
             $this->template->assign_block_vars($position, array_change_key_case($tpl_data, CASE_UPPER));
             $position_counter++;
         }
     }
 }
Esempio n. 15
0
    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $sql = 'SELECT user_id, username, user_regdate, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . '
				AND user_inactive_time = 0
			ORDER BY user_regdate DESC';
        $result = $this->db->sql_query_limit($sql, $this->config['board3_max_last_member_' . $module_id], 0, 600);
        while (($row = $this->db->sql_fetchrow($result)) && $row['username']) {
            $this->template->assign_block_vars('latest_members', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate'], $format = 'd M')));
        }
        $this->db->sql_freeresult($result);
        return 'latest_members_side.html';
    }
 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));
     }
 }
Esempio n. 17
0
 /**
  * User authorisation levels output
  *
  * @param	int		$album_id		The current album the user is in.
  * @param	int		$album_status	The albums status bit.
  * @param	int		$album_user_id	The user-id of the album owner. Saves us a call to the cache if it is set.
  * @return		null
  *
  * borrowed from phpBB3
  * @author: phpBB Group
  * @function: gen_forum_auth_level
  */
 public function display($album_id, $album_status, $album_user_id = -1)
 {
     $locked = $album_status == ITEM_LOCKED && !$this->auth->acl_check('m_', $album_id, $album_user_id) ? true : false;
     $this->auth->load_user_premissions($this->user->data['user_id']);
     $rules = array($this->auth->acl_check('i_view', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_VIEW_CAN'] : $this->user->lang['ALBUM_VIEW_CANNOT'], $this->auth->acl_check('i_upload', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_UPLOAD_CAN'] : $this->user->lang['ALBUM_UPLOAD_CANNOT'], $this->auth->acl_check('i_edit', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_EDIT_CAN'] : $this->user->lang['ALBUM_EDIT_CANNOT'], $this->auth->acl_check('i_delete', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_DELETE_CAN'] : $this->user->lang['ALBUM_DELETE_CANNOT']);
     if ($this->config['phpbb_gallery_allow_comments'] && $this->auth->acl_check('c_read', $album_id, $album_user_id)) {
         $rules[] = $this->auth->acl_check('c_post', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_COMMENT_CAN'] : $this->user->lang['ALBUM_COMMENT_CANNOT'];
     }
     if ($this->config['phpbb_gallery_allow_rates']) {
         $rules[] = $this->auth->acl_check('i_rate', $album_id, $album_user_id) && !$locked ? $this->user->lang['ALBUM_RATE_CAN'] : $this->user->lang['ALBUM_RATE_CANNOT'];
     }
     foreach ($rules as $rule) {
         $this->template->assign_block_vars('rules', array('RULE' => $rule));
     }
 }
Esempio n. 18
0
 /**
  * Display the page
  *
  * @param string $route The route name for a page
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  * @throws http_exception
  * @access public
  */
 public function display($route)
 {
     // Add the pages controller language file
     $this->user->add_lang_ext('phpbb/pages', 'pages_controller');
     // Load the page data to display
     $page = $this->load_page_data($route);
     // Set the page title
     $page_title = $page->get_title();
     // Assign the page data to template variables
     $this->template->assign_vars(array('PAGE_TITLE' => $page_title, 'PAGE_CONTENT' => $page->get_content_for_display()));
     // Create breadcrumbs
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $page_title, 'U_VIEW_FORUM' => $this->helper->route('phpbb_pages_main_controller', array('route' => $route))));
     // Send all data to the template file
     return $this->helper->render($page->get_template(), $page_title);
 }
Esempio n. 19
0
    public function index_modify_page_title($event)
    {
        $this->user->add_lang_ext('dmzx/newestmembers', 'common');
        $sql = 'SELECT user_id, username, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
			ORDER BY user_id DESC';
        $result = $this->db->sql_query_limit($sql, 5);
        if ($result) {
            while ($row = $this->db->sql_fetchrow($result)) {
                $this->template->assign_block_vars('newestmembers', array('NEWESTMEMBERS' => sprintf($this->user->lang['NEWEST_MEMBERS'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))));
            }
        }
        $this->db->sql_freeresult($result);
    }
Esempio n. 20
0
 /**
  * Render language select form
  *
  * @param string	$selected_language
  */
 protected function render_language_select($selected_language = null)
 {
     $langs = $this->lang_helper->get_available_languages();
     foreach ($langs as $lang) {
         $this->template->assign_block_vars('language_select_item', array('VALUE' => $lang['iso'], 'NAME' => $lang['local_name'], 'SELECTED' => $lang['iso'] === $selected_language));
     }
 }
Esempio n. 21
0
 /**
  * Generates all the data in the template to show the topics list.
  *
  * @param array $topics the topics to display
  */
 private function display_topics($topics)
 {
     include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     $pagination = $this->pagination;
     foreach ($topics as $t) {
         $topic = new topic($t, $this->user, $this->auth, $this->content_visibility, $this->phpbb_root_path, $this->php_ext);
         // Send vars to template
         $topic_row = array('FORUM_ID' => $topic->forum_id(), 'TOPIC_ID' => $topic->topic_id(), 'TOPIC_AUTHOR' => $topic->author('username'), 'TOPIC_AUTHOR_COLOUR' => $topic->author('colour'), 'TOPIC_AUTHOR_FULL' => $topic->author('full'), 'FIRST_POST_TIME' => $topic->topic_time(), 'LAST_POST_SUBJECT' => $topic->last_post_subject(), 'LAST_POST_TIME' => $topic->last_post_time(), 'LAST_VIEW_TIME' => $topic->last_view_time(), 'LAST_POST_AUTHOR' => $topic->last_author('username'), 'LAST_POST_AUTHOR_COLOUR' => $topic->last_author('colour'), 'LAST_POST_AUTHOR_FULL' => $topic->last_author('full'), 'REPLIES' => $topic->replies(), 'VIEWS' => $topic->views(), 'TOPIC_TITLE' => $topic->topic_title(), 'TOPIC_TYPE' => $topic->topic_type(), 'FORUM_NAME' => $topic->forum_name(), 'TOPIC_IMG_STYLE' => $topic->img_style(), 'TOPIC_FOLDER_IMG' => $topic->folder_img(), 'TOPIC_FOLDER_IMG_ALT' => $topic->folder_img_alt(), 'TOPIC_ICON_IMG' => '', 'TOPIC_ICON_IMG_WIDTH' => '', 'TOPIC_ICON_IMG_HEIGHT' => '', 'ATTACH_ICON_IMG' => $topic->attach_icon_img(), 'UNAPPROVED_IMG' => $topic->unapproved_img(), 'S_TOPIC_TYPE' => $topic->topic_type(), 'S_USER_POSTED' => $topic->user_posted(), 'S_UNREAD_TOPIC' => $topic->unread_topic(), 'S_TOPIC_REPORTED' => $topic->topic_reported(), 'S_TOPIC_UNAPPROVED' => $topic->topic_unapproved(), 'S_POSTS_UNAPPROVED' => $topic->posts_unapproved(), 'S_TOPIC_DELETED' => $topic->topic_deleted(), 'S_HAS_POLL' => $topic->has_poll(), 'S_POST_ANNOUNCE' => $topic->post_announce(), 'S_POST_GLOBAL' => $topic->post_global(), 'S_POST_STICKY' => $topic->post_sticky(), 'S_TOPIC_LOCKED' => $topic->locked(), 'S_TOPIC_MOVED' => $topic->moved(), 'U_NEWEST_POST' => $topic->newest_post_url(), 'U_LAST_POST' => $topic->last_post_url(), 'U_LAST_POST_AUTHOR' => $topic->last_post_author(), 'U_TOPIC_AUTHOR' => $topic->topic_author(), 'U_VIEW_TOPIC' => $topic->view_topic_url(), 'U_MCP_REPORT' => $topic->mcp_report(), 'U_MCP_QUEUE' => $topic->u_mcp_queue(), 'S_TOPIC_TYPE_SWITCH' => $topic->topic_type_switch());
         // create row for event so it is simmilar to the core.viewforum_modify_topicrow
         $row = $t;
         /**
          * Modify the topic data before it is assigned to the template
          *
          * @event robertheim.topictags.viewforum_modify_topicrow
          * @var	array	row			Array with topic data
          * @var	array	topic_row	Template array with topic data
          * @since 0.0.13-b1
          */
         $vars = array('row', 'topic_row');
         extract($this->phpbb_dispatcher->trigger_event('robertheim.topictags.viewforum_modify_topicrow', compact($vars)));
         $this->template->assign_block_vars('topicrow', $topic_row);
         // mini pagination of posts in topic-rowss
         $pagination->generate_template_pagination($topic->view_topic_url(), 'topicrow.pagination', 'start', $topic->replies() + 1, $this->config['posts_per_page'], 1, true, true);
     }
     // foreach
 }
Esempio n. 22
0
 /**
  * @return Response
  */
 public function main()
 {
     $this->lang->add_lang('common', 'paul999/downloadpage');
     $sql = 'SELECT * FROM ' . $this->versions_table . ' WHERE active = 1 ORDER BY sort DESC';
     $result = $this->db->sql_query($sql);
     while ($row = $this->db->sql_fetchrow($result)) {
         $this->template->assign_block_vars('releases', array('NAME' => $row['name'], 'EOL' => $row['eol'], 'L_EOL' => $this->lang->lang('PHPBB_EOL', $row['name']), 'L_ALWAYS_CURRENT_DOWNLOAD' => $this->lang->lang('ALWAYS_CURRENT', ''), 'L_ALWAYS_CURRENT_UPDATE' => $this->lang->lang('ALWAYS_CURRENT', '')));
         // Yes, we do a queries in a loop here.
         // However, as the versions table should have <= 3 versions this should be fine.
         $sql_row = 'SELECT * FROM ' . $this->releases_table . ' WHERE version_id = ' . $row['version_id'] . ' AND active = 1 ORDER BY release_time DESC';
         $result_row = $this->db->sql_query($sql_row);
         while ($row_row = $this->db->sql_fetchrow($result_row)) {
             $this->template->assign_block_vars('releases.versions', array('RELEASED_AT' => $this->lang->lang('RELEASED_AT', $this->user->format_date($row_row['release_time']))));
             $sql = 'SELECT * FROM ' . $this->downloads_table . ' WHERE active = 1 AND release_id = ' . (int) $row_row['release_id'];
             $int_result = $this->db->sql_query($sql);
             while ($int_row = $this->db->sql_fetchrow($int_result)) {
                 $this->template->assign_block_vars('releases.versions.downloads', array('U_DOWNLOAD' => $this->controller_helper->route('paul999_downloadpage_download', array('id' => $int_row['download_id'])), 'NAME' => $int_row['name'], 'S_FULL_PACKAGE' => $int_row['type'] == constants::FULL_PACKAGE, 'S_LANG_PACKAGE' => $int_row['type'] == constants::TRANSLATION, 'S_UPDATE_PACKAGE' => $int_row['type'] == constants::UPDATE_PACKAGE));
             }
             $this->db->sql_freeresult($int_result);
         }
         $this->db->sql_freeresult($result_row);
     }
     $this->db->sql_freeresult($result);
     return $this->controller_helper->render('@paul999_downloadpage/download_main.html');
 }
    /**
     * Sets template variables to render report reasons select HTML input
     *
     * @param int	$reason_id
     * @return null
     */
    public function display_reasons($reason_id = 0)
    {
        $sql = 'SELECT *
			FROM ' . REPORTS_REASONS_TABLE . '
			ORDER BY reason_order ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
            if (isset($this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) {
                $row['reason_description'] = $this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
                $row['reason_title'] = $this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
            }
            $this->template->assign_block_vars('reason', array('ID' => $row['reason_id'], 'TITLE' => $row['reason_title'], 'DESCRIPTION' => $row['reason_description'], 'S_SELECTED' => $row['reason_id'] == $reason_id ? true : false));
        }
        $this->db->sql_freeresult($result);
    }
Esempio n. 24
0
 /**
  * Assign the template block variables for the history array
  *
  * @param array $history History array
  *
  * @return void
  */
 public function assign_history_display($history)
 {
     $max_activity = $this->get_max_day_activity($history);
     // If there hasn't been any activity, there's nothing to assign
     if (!$max_activity) {
         return;
     }
     $prev_month = 0;
     foreach ($history as $year => $months) {
         foreach ($months as $month => $days) {
             foreach ($days as $day => $actions) {
                 $action_vars = array();
                 $remainder_pct = 100;
                 $px_offset = sizeof($actions);
                 foreach ($actions as $action => $count) {
                     $action = strtoupper($action);
                     $action_vars[$action . '_CNT'] = $count;
                     $action_vars[$action . '_PCT'] = round($count / $max_activity * 100);
                     $remainder_pct -= $action_vars[$action . '_PCT'];
                     $px_offset -= $count ? 1 : 0;
                 }
                 $this->template->assign_block_vars('dayrow', array_merge($action_vars, array('DAY' => $day, 'MONTH' => $month, 'YEAR' => $year, 'REMAINDER_PCT' => $remainder_pct, 'MONTH_SWITCH' => $prev_month != $month ? true : false, 'PIXEL_OFFSET' => $px_offset)));
                 $prev_month = $month;
             }
         }
     }
 }
Esempio n. 25
0
 /**
  * Build pull down menu options of available rule parents
  *
  * @param object $entity The rule entity object
  * @param int $language Language selection identifier; default: 0
  * @param int $parent_id Category to display rules from; default: 0
  * @param string $mode Display menu for add or edit mode
  * @return null
  * @access protected
  */
 protected function build_parent_select_menu($entity, $language = 0, $parent_id = 0, $mode = 'edit')
 {
     $language = $mode == 'edit' ? $entity->get_language() : $language;
     $parent_id = $mode == 'edit' ? $entity->get_parent_id() : $parent_id;
     // Prepare rule pull-down field
     $rule_menu_items = $this->rule_operator->get_rules($language);
     $padding = '';
     $padding_store = array();
     $right = 0;
     // Process each rule menu item for pull-down
     /* @var $rule_menu_item \phpbb\boardrules\entity\rule */
     foreach ($rule_menu_items as $rule_menu_item) {
         if ($rule_menu_item->get_left_id() < $right) {
             $padding .= '&nbsp;&nbsp;';
             $padding_store[$rule_menu_item->get_parent_id()] = $padding;
         } else {
             if ($rule_menu_item->get_left_id() > $right + 1) {
                 $padding = isset($padding_store[$rule_menu_item->get_parent_id()]) ? $padding_store[$rule_menu_item->get_parent_id()] : '';
             }
         }
         $right = $rule_menu_item->get_right_id();
         // Set output block vars for display in the template
         $this->template->assign_block_vars('rulemenu', array('RULE_ID' => $rule_menu_item->get_id(), 'RULE_TITLE' => $padding . $rule_menu_item->get_title(), 'S_DISABLED' => $mode == 'edit' && ($rule_menu_item->get_left_id() > $entity->get_left_id() && $rule_menu_item->get_right_id() < $entity->get_right_id() || $rule_menu_item->get_id() == $entity->get_id()) ? true : false, 'S_RULE_PARENT' => $rule_menu_item->get_id() == $parent_id));
     }
 }
Esempio n. 26
0
 /**
  * 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));
 }
Esempio n. 27
0
    /**
     * Assign editable fields to template, mode can be profile (for profile change) or register (for registration)
     * Called by ucp_profile and ucp_register
     */
    public function generate_profile_fields($mode, $lang_id)
    {
        $sql_where = '';
        switch ($mode) {
            case 'register':
                // If the field is required we show it on the registration page
                $sql_where .= ' AND f.field_show_on_reg = 1';
                break;
            case 'profile':
                // Show hidden fields to moderators/admins
                if (!$this->auth->acl_gets('a_', 'm_') && !$this->auth->acl_getf_global('m_')) {
                    $sql_where .= ' AND f.field_show_profile = 1';
                }
                break;
            default:
                trigger_error('Wrong profile mode specified', E_USER_ERROR);
                break;
        }
        $sql = 'SELECT l.*, f.*
			FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . " f\n\t\t\tWHERE f.field_active = 1\n\t\t\t\t{$sql_where}\n\t\t\t\tAND l.lang_id = " . (int) $lang_id . '
				AND l.field_id = f.field_id
			ORDER BY f.field_order';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            // Return templated field
            $profile_field = $this->type_collection[$row['field_type']];
            $tpl_snippet = $profile_field->process_field_row('change', $row);
            $this->template->assign_block_vars('profile_fields', array('LANG_NAME' => $this->user->lang($row['lang_name']), 'LANG_EXPLAIN' => $this->user->lang($row['lang_explain']), 'FIELD' => $tpl_snippet, 'FIELD_ID' => $profile_field->get_field_ident($row), 'S_REQUIRED' => $row['field_required'] ? true : false));
        }
        $this->db->sql_freeresult($result);
    }
Esempio n. 28
0
 /**
  * Outputs the metadata into the template
  *
  * @return null
  */
 public function output_template_data()
 {
     $this->template->assign_vars(array('META_NAME' => $this->metadata['name'], 'META_TYPE' => $this->metadata['type'], 'META_DESCRIPTION' => isset($this->metadata['description']) ? $this->metadata['description'] : '', 'META_HOMEPAGE' => isset($this->metadata['homepage']) ? $this->metadata['homepage'] : '', 'META_VERSION' => isset($this->metadata['version']) ? $this->metadata['version'] : '', 'META_TIME' => isset($this->metadata['time']) ? $this->metadata['time'] : '', 'META_LICENSE' => $this->metadata['license'], 'META_REQUIRE_PHP' => isset($this->metadata['require']['php']) ? $this->metadata['require']['php'] : '', 'META_REQUIRE_PHP_FAIL' => !$this->validate_require_php(), 'META_REQUIRE_PHPBB' => isset($this->metadata['extra']['soft-require']['phpbb/phpbb']) ? $this->metadata['extra']['soft-require']['phpbb/phpbb'] : '', 'META_REQUIRE_PHPBB_FAIL' => !$this->validate_require_phpbb(), 'META_DISPLAY_NAME' => isset($this->metadata['extra']['display-name']) ? $this->metadata['extra']['display-name'] : ''));
     foreach ($this->metadata['authors'] as $author) {
         $this->template->assign_block_vars('meta_authors', array('AUTHOR_NAME' => $author['name'], 'AUTHOR_EMAIL' => isset($author['email']) ? $author['email'] : '', 'AUTHOR_HOMEPAGE' => isset($author['homepage']) ? $author['homepage'] : '', 'AUTHOR_ROLE' => isset($author['role']) ? $author['role'] : ''));
     }
 }
Esempio n. 29
0
 /**
  * Abstracted method to generate acp configuration pages out of a list of display vars, using
  * the function build_cfg_template().
  * Build configuration template for acp configuration pages
  *
  * @param array $display_vars The display vars for this acp site
  */
 protected function generate_stuff_for_cfg_template($display_vars)
 {
     $this->new_config = $this->config;
     $cfg_array = $this->request->is_set('config') ? $this->request->variable('config', ['' => ''], true) : $this->new_config;
     $error = isset($error) ? $error : [];
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $this->template->assign_block_vars('options', ['S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars]);
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $this->template->assign_block_vars('options', ['KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content]);
         //unset($display_vars['vars'][$config_key]);
     }
     $this->template->assign_vars(['S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action]);
 }
Esempio n. 30
0
    /**
     * Display popup comment
     *
     * @param	int		$link_id		The category ID
     * @param	int		$page			Page number taken from the URL
     * @param	string	$mode			add|edit
     * @return	\Symfony\Component\HttpFoundation\Response	A Symfony Response object
     * @throws	\phpbb\exception\http_exception
     */
    public function view($link_id, $page, $mode = 'new')
    {
        $this->_check_comments_enable($link_id);
        $comment_id = $this->request->variable('c', 0);
        $view = $this->request->variable('view', '');
        $start = ($page - 1) * $this->config['dir_comments_per_page'];
        $this->s_hidden_fields = array_merge($this->s_hidden_fields, array('page' => $page));
        $this->_populate_form($link_id, $mode);
        $sql = 'SELECT COUNT(comment_id) AS nb_comments
			FROM ' . DIR_COMMENT_TABLE . '
			WHERE comment_link_id = ' . (int) $link_id;
        $result = $this->db->sql_query($sql);
        $nb_comments = (int) $this->db->sql_fetchfield('nb_comments');
        $this->db->sql_freeresult($result);
        // Make sure $start is set to the last page if it exceeds the amount
        $start = $this->pagination->validate_start($start, $this->config['dir_comments_per_page'], $nb_comments);
        $sql_array = array('SELECT' => 'a.comment_id, a.comment_user_id, a. comment_user_ip, a.comment_date, a.comment_text, a.comment_uid, a.comment_bitfield, a.comment_flags, u.username, u.user_id, u.user_colour, z.foe', 'FROM' => array(DIR_COMMENT_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'a.comment_user_id = u.user_id'), array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id')), 'WHERE' => 'a.comment_link_id = ' . (int) $link_id, 'ORDER_BY' => 'a.comment_date DESC');
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $this->config['dir_comments_per_page'], $start);
        $have_result = false;
        while ($comments = $this->db->sql_fetchrow($result)) {
            $have_result = true;
            $edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_edit_comment_dir'));
            $delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_delete_comment_dir'));
            $this->template->assign_block_vars('comment', array('MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_USER' => get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), 'S_USER_IP' => $comments['comment_user_ip'], 'S_DATE' => $this->user->format_date($comments['comment_date']), 'S_COMMENT' => generate_text_for_display($comments['comment_text'], $comments['comment_uid'], $comments['comment_bitfield'], $comments['comment_flags']), 'S_ID' => $comments['comment_id'], 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_edit_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '', 'S_IGNORE_POST' => $comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id']) ? true : false, 'L_IGNORE_POST' => $comments['foe'] ? $this->user->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'L_POST_DISPLAY' => $comments['foe'] ? $this->user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?c=' . (int) $comments['comment_id'] . '&view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'S_INFO' => $this->auth->acl_get('m_info')));
        }
        $base_url = array('routes' => 'ernadoo_phpbbdirectory_comment_view_controller', 'params' => array('link_id' => (int) $link_id));
        $this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_comments, $this->config['dir_comments_per_page'], $start);
        $this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('DIR_NB_COMMS', (int) $nb_comments), 'S_HAVE_RESULT' => $have_result ? true : false));
        return $this->helper->render('comments.html', $this->user->lang['DIR_COMMENT_TITLE']);
    }