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)));
    }
 public function poster_data_email($event)
 {
     if ($this->user->data['user_id'] == ANONYMOUS && $this->config['allow_sfs']) {
         // Output the data vars to the template
         $this->template->assign_vars(array('SFS' => true, 'EMAIL' => $this->request->variable('email', '')));
     }
 }
    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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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();
    }
 public function main()
 {
     $topic_id = $this->request->variable('t', 0);
     $post_id = $this->request->variable('p', 0);
     $forum_id = $this->request->variable('f', 0);
     $mode = $this->request->variable('mode', '');
     $book_submit = $this->request->variable('book', false);
     $viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic." . $this->php_ext . "", "f={$forum_id}&t={$topic_id}");
     $return_link = '<br /><br />' . sprintf($this->user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>');
     $body = 'add_bookmark';
     if ($mode == 'delete') {
         $sql = 'DELETE FROM ' . $this->postbookmark_table . "\n\t\t\t\tWHERE user_id = {$this->user->data['user_id']}\n\t\t\t\t\tAND post_id = {$post_id}";
         $this->db->sql_query($sql);
         $message = $this->user->lang['POST_BOOKMARK_REMOVED'];
         $this->helper->output_response($message, $return_link, $viewtopic_url);
     } else {
         if ($mode == 'find') {
             $body = 'find_bookmark';
             $this->helper->get_bookmarks($mode);
         } else {
             $bookmark_desc = $this->request->variable('bookmark_desc', '', true);
             if ($book_submit) {
                 $sql = 'INSERT INTO ' . $this->postbookmark_table . ' ' . $this->db->sql_build_array('INSERT', array('user_id' => $this->user->data['user_id'], 'post_id' => $post_id, 'topic_id' => $topic_id, 'bookmark_time' => time(), 'bookmark_desc' => $bookmark_desc));
                 $this->db->sql_query($sql);
                 $message = $this->user->lang['POST_BOOKMARK_ADDED'];
                 $this->helper->output_response($message, $return_link, $viewtopic_url);
             }
         }
     }
     $this->template->assign_vars(array('U_POST_ACTION' => append_sid("{$this->phpbb_root_path}postbookmark", "f={$forum_id}&amp;t={$topic_id}&amp;p={$post_id}&amp;mode={$mode}")));
     page_header($this->user->lang['POST_BOOKMARK_ADD']);
     $this->template->set_filenames(array('body' => $body . '.html'));
     page_footer();
     return new Response('', 200);
 }
 public function main($event)
 {
     $total_posts = $this->config['num_posts'];
     $total_topics = $this->config['num_topics'];
     $total_users = $this->config['num_users'];
     $total_files = $this->config['num_files'];
     $start_date = date("d M Y, H:i:s", $this->config['board_startdate']);
     $boarddays = ceil((time() - $this->config['board_startdate']) / 86400);
     $l_total_file_s = $total_files == 0 ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
     $posts_per_day = $total_posts / $boarddays;
     $l_posts_per_day_s = $posts_per_day == 0 ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
     $posts_per_year = $posts_per_day * 364.25;
     $l_posts_per_year_s = $posts_per_year == 0 ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
     $posts_per_user = $total_posts / $total_users;
     $l_posts_per_user_s = $posts_per_user == 0 ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
     $posts_per_topic = $total_posts / $total_topics;
     $l_posts_per_topic_s = $posts_per_topic == 0 ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
     $topics_per_day = $total_topics / $boarddays;
     $l_topics_per_day_s = $topics_per_day == 0 ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
     $topics_per_year = $topics_per_day * 364.25;
     $l_topics_per_year_s = $topics_per_year == 0 ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
     $topics_per_user = $total_topics / $total_users;
     $l_topics_per_user_s = $topics_per_user == 0 ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
     $files_per_day = $total_files / $boarddays;
     $l_files_per_day_s = $files_per_day == 0 ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
     $files_per_year = $files_per_day * 364.25;
     $l_files_per_year_s = $files_per_year == 0 ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
     $files_per_user = $total_files / $total_users;
     $l_files_per_user_s = $files_per_day == 0 ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
     $users_per_day = $total_users / $boarddays;
     $l_users_per_day_s = $users_per_day == 0 ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
     $users_per_year = $users_per_day * 364.25;
     $l_users_per_year_s = $users_per_year == 0 ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';
     $this->template->assign_vars(array('POSTS_PER_DAY' => sprintf($this->user->lang[$l_posts_per_day_s], $posts_per_day), 'POSTS_PER_YEAR' => sprintf($this->user->lang[$l_posts_per_year_s], $posts_per_year), 'POSTS_PER_TOPIC' => sprintf($this->user->lang[$l_posts_per_topic_s], $posts_per_topic), 'POSTS_PER_USER' => sprintf($this->user->lang[$l_posts_per_user_s], $posts_per_user), 'TOPICS_PER_DAY' => sprintf($this->user->lang[$l_topics_per_day_s], $topics_per_day), 'TOPICS_PER_YEAR' => sprintf($this->user->lang[$l_topics_per_year_s], $topics_per_year), 'TOPICS_PER_USER' => sprintf($this->user->lang[$l_topics_per_user_s], $topics_per_user), 'TOTAL_FILES' => sprintf($this->user->lang[$l_total_file_s], $total_files), 'FILES_PER_DAY' => sprintf($this->user->lang[$l_files_per_day_s], $files_per_day), 'FILES_PER_YEAR' => sprintf($this->user->lang[$l_files_per_year_s], $files_per_year), 'FILES_PER_USER' => sprintf($this->user->lang[$l_files_per_user_s], $files_per_user), 'USERS_PER_DAY' => sprintf($this->user->lang[$l_users_per_day_s], $users_per_day), 'USERS_PER_YEAR' => sprintf($this->user->lang[$l_users_per_year_s], $users_per_year), 'START_DATE' => $start_date, 'BOARD_VERSION' => $this->config['version']));
 }
Example #6
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');
 }
 /**
  * This listener is run when the KernelEvents::EXCEPTION event is triggered
  *
  * @param GetResponseForExceptionEvent $event
  * @return null
  */
 public function on_kernel_exception(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     $message = $exception->getMessage();
     if ($exception instanceof \phpbb\exception\exception_interface) {
         $message = $this->language->lang_array($message, $exception->get_parameters());
     }
     if (!$event->getRequest()->isXmlHttpRequest()) {
         page_header($this->language->lang('INFORMATION'));
         $this->template->assign_vars(array('MESSAGE_TITLE' => $this->language->lang('INFORMATION'), 'MESSAGE_TEXT' => $message));
         $this->template->set_filenames(array('body' => 'message_body.html'));
         page_footer(true, false, false);
         $response = new Response($this->template->assign_display('body'), 500);
     } else {
         $data = array();
         if (!empty($message)) {
             $data['message'] = $message;
         }
         if (defined('DEBUG')) {
             $data['trace'] = $exception->getTrace();
         }
         $response = new JsonResponse($data, 500);
     }
     if ($exception instanceof HttpExceptionInterface) {
         $response->setStatusCode($exception->getStatusCode());
         $response->headers->add($exception->getHeaders());
     }
     $event->setResponse($response);
 }
 /**
  * Do some postprocessing just before the page gets rendered
  *
  * @param Event $event
  */
 public function postProcessLayout(Event $event)
 {
     if (isset($this->config['body_class'])) {
         $this->template->append_var('BODY_CLASS', $this->config['body_class']);
     }
     //$this->contaoConnector->test();
 }
 /**
  * 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));
 }
Example #10
0
 public function handle()
 {
     $title = $this->display();
     $this->template->assign_vars(array('L_FAQ_TITLE' => $title, 'S_IN_FAQ' => true));
     make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
     return $this->helper->render('faq_body.html', $title);
 }
 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_options()
 {
     // Create a form key for preventing CSRF attacks
     $form_key = 'login_redirect';
     add_form_key($form_key);
     // Is the form being submitted
     if ($this->request->is_set_post('submit')) {
         // Is the submitted form is valid
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Check that the entered topics are valid
         $this->topic_valid($this->request->variable('redirect_announce_topic_id', ''), $this->user->lang('INVALID_ANNOUNCEMENT_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_welcome_topic_id', ''), $this->user->lang('INVALID_WELCOME_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_group_topic_id', ''), $this->user->lang('INVALID_GROUP_TOPIC'));
         // If no errors, process the form data
         // Set the options the user configured
         $this->set_options();
         // Add option settings change action to the admin log
         $phpbb_log = $this->container->get('log');
         $phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_LOGIN_REDIRECT');
         // Option settings have been updated and logged
         // Confirm this to the user and provide link back to previous page
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     // Set output vars for display in the template
     $this->template->assign_vars(array('REDIRECT_ANNOUNCE' => isset($this->config['redirect_announce']) ? $this->config['redirect_announce'] : '', 'REDIRECT_ANNOUNCE_PRIORITY' => isset($this->config['redirect_announce_priority']) ? $this->config['redirect_announce_priority'] : '', 'REDIRECT_ANNOUNCE_REFRESH' => isset($this->config['redirect_announce_refresh']) ? $this->config['redirect_announce_refresh'] : '', 'REDIRECT_ANNOUNCE_TOPIC_ID' => isset($this->config['redirect_announce_topic_id']) ? $this->config['redirect_announce_topic_id'] : '', 'REDIRECT_ANY_ANNOUNCE' => isset($this->config['redirect_any_announce']) ? $this->config['redirect_any_announce'] : '', 'REDIRECT_ENABLED' => isset($this->config['redirect_enabled']) ? $this->config['redirect_enabled'] : '', 'REDIRECT_GROUP' => isset($this->config['redirect_group']) ? $this->config['redirect_group'] : '', 'REDIRECT_GROUP_ALL' => isset($this->config['redirect_group_all']) ? $this->config['redirect_group_all'] : '', 'REDIRECT_GROUP_REFRESH' => isset($this->config['redirect_group_refresh']) ? $this->config['redirect_group_refresh'] : '', 'REDIRECT_GROUP_TOPIC_ID' => isset($this->config['redirect_group_topic_id']) ? $this->config['redirect_group_topic_id'] : '', 'REDIRECT_WELCOME' => isset($this->config['redirect_welcome']) ? $this->config['redirect_welcome'] : '', 'REDIRECT_WELCOME_REFRESH' => isset($this->config['redirect_welcome_refresh']) ? $this->config['redirect_welcome_refresh'] : '', 'REDIRECT_WELCOME_TOPIC_ID' => isset($this->config['redirect_welcome_topic_id']) ? $this->config['redirect_welcome_topic_id'] : '', 'S_REDIRECT_GROUP_OPTIONS' => group_select_options($this->config['redirect_group_id'], false, false), 'U_ACTION' => $this->u_action));
 }
Example #12
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']);
    }
Example #13
0
 /**
  * Display the edit form
  *
  * @param bool $preview
  */
 protected function display_edit_form($preview = false)
 {
     generate_smilies('inline', 0);
     display_custom_bbcodes();
     add_form_key('article');
     $this->template->assign_vars(array('S_PREVIEW' => $preview, 'TITLE' => $this->data['article_title'], 'MESSAGE' => $preview ? $this->data['article_text'] : $this->message_parser->message, 'PREVIEW_MESSAGE' => $this->message_parser->message, 'SOURCES' => $this->data['article_sources'], 'S_BBCODE_ALLOWED' => $this->option['bbcode'], 'S_LINKS_ALLOWED' => $this->option['url'], 'S_BBCODE_IMG' => $this->option['img'], 'S_BBCODE_FLASH' => $this->option['flash'], 'S_BBCODE_QUOTE' => $this->option['quote'], 'BBCODE_STATUS' => $this->option['bbcode'] ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->option['img'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->option['flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->option['smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->option['bbcode'] && $this->option['url'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'TOPIC_ID' => (int) $this->data['article_topic_id'], 'S_AUTH_ACTIVATE' => $this->auth->acl_get('u_wiki_set_active'), 'S_AUTH_EDIT_TOPIC' => $this->auth->acl_get('u_wiki_edit_topic'), 'S_AUTH_REDIRECT' => $this->auth->acl_get('u_wiki_set_redirect'), 'S_AUTH_STICKY' => $this->auth->acl_get('u_wiki_set_sticky'), 'S_ACTIVE' => $preview ? $this->data['article_approved'] : 1, 'S_STICKY' => $this->data['article_sticky'], 'ARTICLE_REDIRECT' => $this->data['article_redirect'], 'ARTICLE_DESCRIPTION' => $this->data['article_description']));
 }
Example #14
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);
            }
        }
    }
 /**
  * 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);
 }
Example #16
0
 public function modify_posting($event)
 {
     if ($event['mode'] == 'post' && !$event['forum_id']) {
         $forum_ary = array();
         $forum_read_ary = $this->auth->acl_getf('f_read');
         foreach ($forum_read_ary as $forum_id => $allowed) {
             if ($allowed['f_read'] && $this->auth->acl_get('f_post', $forum_id)) {
                 if (!$this->exclude_forum($forum_id, $this->config['newtopic_forum'])) {
                     continue;
                 }
                 $forum_ary[] = (int) $forum_id;
             }
         }
         if (sizeof($forum_ary)) {
             // Fetching topics of public forums
             $sql = 'SELECT forum_id, forum_name, forum_type FROM ' . FORUMS_TABLE . "\n\t\t\t\t\tWHERE " . $this->db->sql_in_set('forum_id', $forum_ary) . "\n\t\t\t\t\t\tAND forum_type != " . FORUM_LINK;
             $result = $this->db->sql_query($sql);
             $forumrow = $this->db->sql_fetchrowset($result);
             $this->db->sql_freeresult($result);
             $s_forum_options = '<select id="f" name="f" onchange="this.form.submit();">';
             foreach ($forumrow as $row) {
                 $s_forum_options .= '<option value="' . $row['forum_id'] . '"' . ($row['forum_id'] == $forum_id ? ' selected="selected"' : '') . '' . ($row['forum_type'] == FORUM_CAT ? ' disabled="disabled" class="disabled-option"' : '') . '>' . ($row['forum_type'] != FORUM_CAT ? '&nbsp;&nbsp;' : '') . $row['forum_name'] . '</option>';
                 $forum_id = $row['forum_type'] == FORUM_POST ? $row['forum_id'] : '';
             }
             $s_forum_options .= '</select>';
             $this->template->assign_vars(array('S_FORUM_OPTIONS' => $s_forum_options, 'S_FORUM_OPT_TRUE' => $forum_id ? true : false));
             $event['forum_id'] = $forum_id;
         }
     }
 }
 /**
  * Add <select>s to forum preferences page
  *
  * Event: core.acp_manage_forums_display_form
  */
 public function acp_manage_forums_display_form($event)
 {
     if ($event['forum_data']['forum_type'] == FORUM_POST) {
         $topic_sort_options = $this->gen_topic_sort_options($event['forum_data']);
         $this->template->assign_vars(array('S_SORTTOPICS_BY_OPTIONS' => $topic_sort_options['by'], 'S_SORTTOPICS_ORDER_OPTIONS' => $topic_sort_options['order']));
     }
 }
 /**
  * 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);
     }
 }
 /**
  * Only display quick reply for admins and mods
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function viewtopic_modify_page_title($event)
 {
     $is_authed = $this->auth->acl_gets('a_', 'm_');
     if (!$is_authed) {
         $this->template->assign_vars(array('S_QUICK_REPLY' => false));
     }
 }
 /**
  * Constructor
  *
  * @param \phpbb\controller\helper	$helper		Controller helper object
  * @param \phpbb\template			$template	Template object
  */
 public function __construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, $root_path)
 {
     $template_path = $template->get_user_style();
     $template_path = $template_path[0];
     $this->size = (int) $config['default_gravatar_size'] ?: 80;
     $this->default_avatar = $root_path . 'styles/' . $template_path . '/theme/images/no_avatar.gif';
 }
 public function main($event)
 {
     // add lang file
     $this->user->add_lang_ext('v12mike/postoftheday', 'postoftheday');
     $this->functions->topposts();
     $this->template->assign_vars(array('S_POSTOFTHEDAY' => 1, 'S_POSTOFTHEDAY_LOCATION' => $this->config['post_of_the_day_location']));
 }
Example #22
0
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('rt_enable' => $this->request->variable('rt_enable', (int) $this->user->data['user_rt_enable']), 'rt_alt_location' => $this->request->variable('rt_alt_location', (int) $this->user->data['user_rt_alt_location']), 'rt_sort_start_time' => $this->request->variable('rt_sort_start_time', (int) $this->user->data['user_rt_sort_start_time']), 'rt_unread_only' => $this->request->variable('rt_unread_only', (int) $this->user->data['user_rt_unread_only'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit'] && $this->auth->acl_get('u_rt_view')) {
         $this->user->add_lang_ext('paybas/recenttopics', 'recenttopics_ucp');
         $template_vars = array();
         if ($this->auth->acl_get('u_rt_enable') || $this->auth->acl_get('u_rt_alt_location') || $this->auth->acl_get('u_rt_sort_start_time') || $this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('S_RT_SHOW' => true);
         }
         if ($this->auth->acl_get('u_rt_enable')) {
             $template_vars += array('A_RT_ENABLE' => true, 'S_RT_ENABLE' => $event['data']['rt_enable']);
         }
         if ($this->auth->acl_get('u_rt_alt_location')) {
             $template_vars += array('A_RT_ALT_LOCATION' => true, 'S_RT_ALT_LOCATION' => $event['data']['rt_alt_location']);
         }
         if ($this->auth->acl_get('u_rt_sort_start_time')) {
             $template_vars += array('A_RT_SORT_START_TIME' => true, 'S_RT_SORT_START_TIME' => $event['data']['rt_sort_start_time']);
         }
         if ($this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('A_RT_UNREAD_ONLY' => true, 'S_RT_UNREAD_ONLY' => $event['data']['rt_unread_only']);
         }
         $this->template->assign_vars($template_vars);
     }
 }
Example #23
0
 public function page_header($event)
 {
     // add lang file
     $this->user->add_lang_ext('dmzx/newtopic', 'common');
     $forum_box = $this->make_forum_select2(false, false, false, false);
     $this->template->assign_vars(array('EXT_NEW_TOPIC' => $forum_box));
 }
 /**
  * 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);
     }
 }
 /**
  * Allow to change their colour
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_profile_info($event)
 {
     $this->user->add_lang_ext('dmzx/usernamecolourchanger', 'common');
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('user_colour' => $this->request->variable('user_colour', $this->user->data['user_colour'], true)));
     $this->template->assign_vars(array('COLOUR' => $event['data']['user_colour'], 'USE_USERNAMECOLOURCHANGER' => $this->auth->acl_get('u_usernamecolourchanger_use')));
 }
Example #26
0
 /**
  * {@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';
 }
 function main($id, $mode)
 {
     global $phpbb_container, $user, $template, $config, $request;
     $this->phpbb_container = $phpbb_container;
     $this->user = $user;
     $this->template = $template;
     $this->config = $config;
     $this->request = $request;
     $this->log = $this->phpbb_container->get('log');
     $this->tpl_name = 'acp_codebox_plus';
     $this->page_title = $this->user->lang('CODEBOX_PLUS_TITLE');
     add_form_key('o0johntam0o/acp_codebox_plus');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('o0johntam0o/acp_codebox_plus')) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set('codebox_plus_syntax_highlighting', $request->variable('codebox_plus_syntax_highlighting', 0));
         $this->config->set('codebox_plus_expanded', $request->variable('codebox_plus_expanded', 0));
         $this->config->set('codebox_plus_download', $request->variable('codebox_plus_download', 0));
         $this->config->set('codebox_plus_login_required', $request->variable('codebox_plus_login_required', 0));
         $this->config->set('codebox_plus_prevent_bots', $request->variable('codebox_plus_prevent_bots', 0));
         $this->config->set('codebox_plus_captcha', $request->variable('codebox_plus_captcha', 0));
         $this->config->set('codebox_plus_max_attempt', $request->variable('codebox_plus_max_attempt', 0));
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'CODEBOX_PLUS_LOG_MSG');
         trigger_error($this->user->lang('CODEBOX_PLUS_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_CODEBOX_PLUS_VERSION' => isset($this->config['codebox_plus_version']) ? $this->config['codebox_plus_version'] : 0, 'S_CODEBOX_PLUS_SYNTAX_HIGHLIGHTING' => isset($this->config['codebox_plus_syntax_highlighting']) ? $this->config['codebox_plus_syntax_highlighting'] : 0, 'S_CODEBOX_PLUS_EXPANDED' => isset($this->config['codebox_plus_expanded']) ? $this->config['codebox_plus_expanded'] : 0, 'S_CODEBOX_PLUS_DOWNLOAD' => isset($this->config['codebox_plus_download']) ? $this->config['codebox_plus_download'] : 0, 'S_CODEBOX_PLUS_LOGIN_REQUIRED' => isset($this->config['codebox_plus_login_required']) ? $this->config['codebox_plus_login_required'] : 0, 'S_CODEBOX_PLUS_PREVENT_BOTS' => isset($this->config['codebox_plus_prevent_bots']) ? $this->config['codebox_plus_prevent_bots'] : 0, 'S_CODEBOX_PLUS_CAPTCHA' => isset($this->config['codebox_plus_captcha']) ? $this->config['codebox_plus_captcha'] : 0, 'S_CODEBOX_PLUS_MAX_ATTEMPT' => isset($this->config['codebox_plus_max_attempt']) ? $this->config['codebox_plus_max_attempt'] : 0));
 }
Example #28
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);
     }
 }
 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     // Add the common lang file
     $this->user->add_lang(array('acp/common'));
     // Add the board snowstormlights ACP lang file
     $this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'snowstorm_lights';
     // Set the page title for our ACP page
     $this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
     // Define the name of the form for use as a form key
     $form_key = 'acp_snowstorm_lights';
     add_form_key($form_key);
     // If form is submitted or previewed
     if ($this->request->is_set_post('submit')) {
         // Test if form key is valid
         if (!check_form_key($form_key)) {
             trigger_error('FORM_INVALID');
         }
         // Store the config enable/disable state
         $scl_enabled = $this->request->variable('scl_enabled', 0);
         $this->config->set('scl_enabled', $scl_enabled);
         $snow_enabled = $request->variable('snow_enabled', 0);
         $this->config->set('snow_enabled', $snow_enabled);
         // Output message to user for the update
         trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
     }
     // Output data to the template
     $this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
 }
Example #30
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');
 }