Beispiel #1
0
 /**
  *
  */
 public function add_page_viewonline($event)
 {
     if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/mchat') === 0) {
         $event['location'] = $this->user->lang('MCHAT_TITLE');
         $event['location_url'] = $this->helper->route('dmzx_mchat_controller');
     }
 }
Beispiel #2
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);
     }
 }
Beispiel #3
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);
 }
Beispiel #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']);
    }
 /**
  * Display user reputation on user profile page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function prepare_user_reputation_data($event)
 {
     $data = $event['data'];
     $template_data = $event['template_data'];
     $template_data = array_merge($template_data, array('USER_REPUTATION' => $data['user_reputation'], 'U_VIEW_USER_REPUTATION' => $this->helper->route('reputation_details_controller', array('uid' => $data['user_id'])), 'U_RATE_USER' => $this->helper->route('reputation_user_rating_controller', array('uid' => $data['user_id'])), 'U_REPUTATION_REFERER' => $this->helper->get_current_url(), 'S_RATE_USER' => $this->config['rs_user_rating'] && $this->auth->acl_get('u_rs_rate') ? true : false, 'S_VIEW_REPUTATION' => $this->auth->acl_get('u_rs_view') ? true : false));
     $event['template_data'] = $template_data;
 }
Beispiel #6
0
 /**
  * Add link to header
  *
  * @param	object	$event	The event object
  * @return	null
  * @access	public
  */
 public function page_header($event)
 {
     if ($this->auth->acl_get('u_usermap_view')) {
         $this->user->add_lang_ext('tas2580/usermap', 'link');
         $this->template->assign_vars(array('U_USERMAP' => $this->helper->route('tas2580_usermap_index', array())));
     }
 }
 /**
  *  @param		$id			post_id
  *  @param		$part		Code part
  *  @return		mixed		Render output to the template
  **/
 public function downloader($id = 0, $part = 0)
 {
     $id = (int) $id;
     // If download function was disabled
     if (!$this->enable_download) {
         $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_DOWNLOAD_DISABLED']);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
     // Prevent bots
     if ($this->enable_prevent_bots && $this->user->data['is_bot']) {
         redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
     }
     // Check permission
     $sql = 'SELECT forum_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $id;
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
         $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_NO_PERMISSION']);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
     // Login to download
     if ($this->enable_login_required && !$this->user->data['is_registered']) {
         login_box($this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), $this->user->lang['CODEBOX_PLUS_ERROR_LOGIN_REQUIRED']);
     }
     // Captcha
     if ($this->enable_captcha) {
         $tmp_captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
         $tmp_captcha->init(CONFIRM_LOGIN);
         $ok = false;
         if ($this->request->is_set_post('submit')) {
             $tmp_captcha->validate();
             if ($tmp_captcha->is_solved()) {
                 $tmp_captcha->reset();
                 $ok = true;
             }
         }
         // If the form was not submitted yet or the CAPTCHA was not solved
         if (!$ok) {
             // Too many request...
             if ($tmp_captcha->get_attempt_count() >= $this->max_attempt) {
                 $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_CONFIRM']);
                 return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
             }
             $this->template->assign_vars(array('S_CODE_DOWNLOADER_ACTION' => $this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), 'S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $tmp_captcha->get_template()));
             return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
         } else {
             // Downloading
             $this->codebox_output($id, $part);
             garbage_collection();
             return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
             //exit_handler();
         }
     } else {
         // Downloading
         $this->codebox_output($id, $part);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
 }
Beispiel #8
0
 public function base()
 {
     if (!$this->auth->acl_get('a_')) {
         return $this->settings->finish('SLIDER_INVALID_LOGIN', 400, 4, 'slider_home');
     }
     $this->slider_settings();
     return $this->helper->render('nivoslider.html', 'Options Panel');
 }
 public function viewonline_page($event)
 {
     if ($event['on_page'][1] == 'app') {
         if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/contact') === 0) {
             $event['location'] = $this->user->lang('CONTACTFORM_VIEWONLINE');
             $event['location_url'] = $this->helper->route('phpbbde_contactform_main_controller');
         }
     }
 }
Beispiel #10
0
 public function location_viewonline($event)
 {
     if ($event['on_page'][1] == 'app') {
         if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/rating') === 0) {
             $event['location'] = $this->user->lang['VIEWING_RATING'];
             $event['location_url'] = $this->helper->route("bb3top_rating_top");
         }
     }
 }
 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'));
 }
Beispiel #12
0
    public function attachments_data($event)
    {
        $topic_id = $event['topic_id'];
        $sql = 'SELECT COUNT(attach_id) as num_attachments
			FROM ' . ATTACHMENTS_TABLE . " a\n\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tAND a.is_orphan = 0";
        $result = $this->db->sql_query($sql);
        $num_attachments = $this->db->sql_fetchfield('num_attachments');
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('U_ATTACHMENTS_TOPIC' => $this->helper->route("bb3mobi_attach_cat", array('t' => $topic_id)), 'TOTAL_ATTACH_TOPIC' => (int) $num_attachments));
    }
 public function page_header($event)
 {
     $nru_group_id = $this->functions->getnruid();
     if (!$this->config['appform_nru'] && $nru_group_id === (int) $this->user->data['group_id'] || $this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS) {
         $this->template->assign_var('U_APP_FORM', false);
         return;
     }
     $this->user->add_lang_ext('rmcgirr83/applicationform', 'common');
     $this->template->assign_var('U_APP_FORM', $this->helper->route('rmcgirr83_applicationform_displayform'));
 }
Beispiel #14
0
 public function add_page_header_links($event)
 {
     $this->template->assign_vars(array('DONATION_ACHIEVEMENT_ENABLE' => isset($this->config['donation_achievement_enable']) ? $this->config['donation_achievement_enable'] : false, 'DONATION_ACHIEVEMENT' => isset($this->config['donation_achievement']) ? $this->config['donation_achievement'] : false, 'DONATION_INDEX_ENABLE' => isset($this->config['donation_index_enable']) ? $this->config['donation_index_enable'] : false, 'DONATION_INDEX_TOP' => isset($this->config['donation_index_top']) ? $this->config['donation_index_top'] : false, 'DONATION_INDEX_BOTTOM' => isset($this->config['donation_index_bottom']) ? $this->config['donation_index_bottom'] : false, 'DONATION_GOAL_ENABLE' => isset($this->config['donation_goal_enable']) ? $this->config['donation_goal_enable'] : false, 'DONATION_GOAL' => isset($this->config['donation_goal']) ? $this->config['donation_goal'] : false, 'DONATION_GOAL_CURRENCY_ENABLE' => isset($this->config['donation_goal_currency_enable']) ? $this->config['donation_goal_currency_enable'] : false, 'DONATION_GOAL_CURRENCY' => isset($this->config['donation_goal_currency']) ? $this->config['donation_goal_currency'] : false, 'S_DONATE_ENABLED' => isset($this->config['donation_enable']) ? $this->config['donation_enable'] : false));
     if (!empty($this->config['donation_goal_enable']) && $this->config['donation_goal'] > 0) {
         $donation_goal_number = $this->config['donation_achievement'] * 100 / $this->config['donation_goal'];
         $donation_goal_rest = $this->config['donation_goal'] - $this->config['donation_achievement'];
         $this->template->assign_vars(array('DONATION_GOAL_NUMBER' => round($donation_goal_number), 'DONATION_GOAL_REST' => $donation_goal_rest));
     }
     $this->template->assign_vars(array('U_DONATE' => $this->controller_helper->route('dmzx_donation_controller')));
 }
 public function page_header($event)
 {
     $nru_group_id = $this->applicationform->getnruid();
     if (!$this->config['appform_nru'] && $nru_group_id === (int) $this->user->data['group_id'] || $this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS) {
         $this->template->assign_var('U_APP_FORM', false);
         return false;
     }
     $version = phpbb_version_compare($this->config['version'], '3.2.0-b2', '>=');
     $this->user->add_lang_ext('rmcgirr83/applicationform', 'common');
     $this->template->assign_vars(array('U_APP_FORM' => $this->helper->route('rmcgirr83_applicationform_displayform'), 'S_FORUM_VERSION' => $version));
 }
 /**
  * Set category display states
  *
  * @param object $event The event object
  *
  * @return null
  * @access public
  */
 public function show_collapsible_categories($event)
 {
     if (!isset($this->categories)) {
         $this->categories = $this->operator->get_user_categories();
     }
     $fid = 'fid_' . $event['row']['forum_id'];
     $row = isset($event['cat_row']) ? 'cat_row' : 'forum_row';
     $event_row = $event[$row];
     $event_row += array('S_FORUM_HIDDEN' => in_array($fid, $this->categories), 'U_COLLAPSE_URL' => $this->helper->route('phpbb_collapsiblecategories_main_controller', array('forum_id' => $fid, 'hash' => generate_link_hash("collapsible_{$fid}"))));
     $event[$row] = $event_row;
 }
Beispiel #17
0
 /**
  * Controller for mChat
  *
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function handle()
 {
     $ret = $this->render_helper->render_data_for_page();
     // If this was an ajax request, we just create an json_response and return that. It's not ours to handle here.
     if ($this->request->is_ajax() && is_array($ret) && isset($ret['json']) && $ret['json'] === true) {
         return new \Symfony\Component\HttpFoundation\JsonResponse($ret);
     }
     // If error occured, render it
     if (isset($ret['error']) && $ret['error'] == true) {
         return $this->helper->error($ret['error_text'], $ret['error_type']);
     }
     return $this->helper->render($ret['filename'], $ret['lang_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();
    }
Beispiel #19
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);
 }
 /**
  * Show users as viewing Directory on Who Is Online page
  *
  * @param	object $event The event object
  * @return	null
  */
 public function add_page_viewonline($event)
 {
     if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/directory') === 0) {
         $event['location'] = $this->user->lang['DIRECTORY'];
         $event['location_url'] = $this->helper->route('ernadoo_phpbbdirectory_base_controller');
     }
 }
Beispiel #21
0
 /**
  * Display board announcements
  *
  * @return null
  * @access public
  */
 public function display_board_announcements()
 {
     // Do not continue if announcement has been disabled
     if (!$this->config['board_announcements_enable']) {
         return;
     }
     // Get board announcement data from the cache
     $board_announcement_data = $this->cache->get('_board_announcement_data');
     if ($board_announcement_data === false) {
         // Get board announcement data from the config_text object
         $board_announcement_data = $this->config_text->get_array(array('announcement_text', 'announcement_uid', 'announcement_bitfield', 'announcement_options', 'announcement_bgcolor', 'announcement_timestamp'));
         // Cache board announcement data
         $this->cache->put('_board_announcement_data', $board_announcement_data);
     }
     // Get announcement cookie if one exists
     $cookie = $this->request->variable($this->config['cookie_name'] . '_baid', '', true, \phpbb\request\request_interface::COOKIE);
     // Do not continue if announcement has been dismissed
     if (!$this->user->data['board_announcements_status'] || $cookie == $board_announcement_data['announcement_timestamp']) {
         return;
     }
     // Prepare board announcement message for display
     $announcement_message = generate_text_for_display($board_announcement_data['announcement_text'], $board_announcement_data['announcement_uid'], $board_announcement_data['announcement_bitfield'], $board_announcement_data['announcement_options']);
     // Add board announcements language file
     $this->user->add_lang_ext('phpbb/boardannouncements', 'boardannouncements');
     // Output board announcement to the template
     $this->template->assign_vars(array('S_BOARD_ANNOUNCEMENT' => true, 'S_BOARD_ANNOUNCEMENT_DISMISS' => (bool) $this->config['board_announcements_dismiss'], 'BOARD_ANNOUNCEMENT' => $announcement_message, 'BOARD_ANNOUNCEMENT_BGCOLOR' => $board_announcement_data['announcement_bgcolor'], 'U_BOARD_ANNOUNCEMENT_CLOSE' => $this->controller_helper->route('phpbb_boardannouncements_controller', array('hash' => generate_link_hash('close_boardannouncement')))));
 }
Beispiel #22
0
 /**
  * Controller for /help/{mode} routes
  *
  * @param string		$mode
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  * @throws http_exception when the $mode is not known by any extension
  */
 public function handle($mode)
 {
     switch ($mode) {
         case 'faq':
         case 'bbcode':
             $page_title = $mode === 'faq' ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
             $this->user->add_lang($mode, false, true);
             break;
         default:
             $page_title = $this->user->lang['FAQ_EXPLAIN'];
             $ext_name = $lang_file = '';
             /**
              * You can use this event display a custom help page
              *
              * @event core.faq_mode_validation
              * @var	string	page_title		Title of the page
              * @var	string	mode			FAQ that is going to be displayed
              * @var	string	lang_file		Language file containing the help data
              * @var	string	ext_name		Vendor and extension name where the help
              *								language file can be loaded from
              * @since 3.1.4-RC1
              */
             $vars = array('page_title', 'mode', 'lang_file', 'ext_name');
             extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
             if ($ext_name === '' || $lang_file === '') {
                 throw new http_exception(404, 'Not Found');
             }
             $this->user->add_lang($lang_file, false, true, $ext_name);
             break;
     }
     $this->template->assign_vars(array('L_FAQ_TITLE' => $page_title, 'S_IN_FAQ' => true));
     $this->assign_to_template($this->user->help);
     make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
     return $this->helper->render('faq_body.html', $page_title);
 }
 public function add_page_viewonline($event)
 {
     if (strrpos($event['row']['session_page'], 'app.' . $this->phpEx . '/ultimatepoints') === 0) {
         $event['location'] = $this->user->lang('ACP_POINTS');
         $event['location_url'] = $this->helper->route('dmzx_ultimatepoints_controller');
     }
 }
 /**
  * @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');
 }
 public function codebox_template($code = '', $lang = 'text', $file = '', $id = 0, $part = 0)
 {
     if (strlen($code) == 0) {
         return '';
     }
     if (strlen($file) == 0) {
         $file = $this->user->lang['CODEBOX_PLUS_DEFAULT_FILENAME'] . 'txt';
     }
     $re = '<div class="codebox_plus_wrap"><div class="codebox_plus_header">';
     $re .= '<strong>' . $this->user->lang['CODEBOX_PLUS_CODE'] . ': </strong>';
     $re .= '<a href="#" onclick="codebox_plus_select(this, 1); return false;">[' . $this->user->lang['SELECT_ALL_CODE'] . ']</a>';
     $re .= '&nbsp;<a href="#" onclick="codebox_plus_toggle(this, 1); return false;">[' . $this->user->lang['CODEBOX_PLUS_EXPAND'] . '/' . $this->user->lang['CODEBOX_PLUS_COLLAPSE'] . ']</a>';
     if ($this->download_enabled && $lang != 'NULL') {
         $re .= '&nbsp;<a href="' . $this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)) . '" onclick="window.open(this.href); return false;">';
         $re .= '[' . $this->user->lang['CODEBOX_PLUS_DOWNLOAD'] . ']</a> ' . '(' . $file . ')';
     }
     $re .= '</div>';
     #		$re .= '<div><div style="display: ' . (($lang != 'NULL') ? 'none' : 'inline') . ';">';
     $re .= '<div><div style="display: inline;">';
     if ($lang != 'NULL') {
         $re .= $this->codebox_parse_code($this->codebox_decode_code($code), $lang);
     } else {
         $re .= $this->user->lang['CODEBOX_PLUS_NO_PREVIEW'];
     }
     $re .= '</div></div>';
     $re .= '<div class="codebox_plus_footer">' . $this->user->lang['CODEBOX_PLUS_GESHI'] . ' &copy; ' . $this->user->lang['CODEBOX_PLUS_TITLE'] . '</div></div>';
     return $re;
 }
Beispiel #26
0
 public function index()
 {
     // sets a few variables before the actions
     $this->mode = $this->request->variable('mode', 'default');
     $this->last_id = $this->request->variable('last_id', 0);
     $this->last_time = $this->request->variable('last_time', 0);
     $this->post_time = $this->request->variable('last_post', 0);
     $this->read_interval = $this->request->variable('read_interval', 5000);
     // Grabs the right Action depending on ajax requested mode
     if ($this->mode === 'default') {
         $this->defaultAction();
     } else {
         if ($this->mode === 'read') {
             $this->readAction();
         } else {
             if ($this->mode === 'smilies') {
                 $this->smiliesAction();
             } else {
                 if ($this->mode === 'delete') {
                     $this->delAction();
                 }
             }
         }
     }
     // Sets a few variables
     $bbcode_status = $this->config['allow_bbcode'] && $this->config['auth_bbcode_pm'] && $this->auth->acl_get('u_ajaxchat_bbcode') ? true : false;
     $smilies_status = $this->config['allow_smilies'] && $this->config['auth_smilies_pm'] && $this->auth->acl_get('u_pm_smilies') ? true : false;
     $img_status = $this->config['auth_img_pm'] && $this->auth->acl_get('u_pm_img') ? true : false;
     $flash_status = $this->config['auth_flash_pm'] && $this->auth->acl_get('u_pm_flash') ? true : false;
     $url_status = $this->config['allow_post_links'] ? true : false;
     $quote_status = true;
     $this->mode = strtoupper($this->mode);
     $sql = 'SELECT `user_lastpost` FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if ($this->get_status($row['user_lastpost']) === 'online') {
         $refresh = $this->config['refresh_online_chat'];
     } else {
         if ($this->user->data['user_id'] === ANONYMOUS || $this->get_status($row['user_lastpost']) === 'offline') {
             $refresh = $this->config['refresh_offline_chat'];
         } else {
             $refresh = $this->config['refresh_offline_chat'];
         }
     }
     if ($this->user->data['user_id'] === ANONYMOUS || $row['user_lastpost'] === null) {
         $last_post = 0;
     } else {
         $last_post = $row['user_lastpost'];
     }
     $details = base64_decode('Jm5ic3A7PGEgaHJlZj0iaHR0cDovL3d3dy5saXZlbWVtYmVyc29ubHkuY29tIiBzdHlsZT0iZm9udC13ZWlnaHQ6IGJvbGQ7Ij5BSkFYJm5ic3A7Q2hhdCZuYnNwOyZjb3B5OyZuYnNwOzIwMTU8L2E+Jm5ic3A7PHN0cm9uZz5MaXZlJm5ic3A7TWVtYmVycyZuYnNwO09ubHk8L3N0cm9uZz4=');
     //Assign the features template variable
     $this->template->assign_vars(['BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_LINKS_ALLOWED' => $url_status, 'S_COMPOSE_PM' => true, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'S_BBCODE_URL' => $url_status, 'L_DETAILS' => $details, 'REFRESH_TIME' => $refresh, 'LAST_ID' => $this->last_id, 'LAST_POST' => $last_post, 'TIME' => time(), 'L_VERSION' => '3.0.9-BETA', 'STYLE_PATH' => generate_board_url() . '/styles/' . $this->user->style['style_path'], 'EXT_STYLE_PATH' => '' . $this->ext_path_web . 'styles/', 'FILENAME' => $this->helper->route('spaceace_ajaxchat_chat'), 'S_ARCHIVE' => !$this->get ? true : false, 'S_GET_CHAT' => $this->get ? true : false, 'S_' . $this->mode => true]);
     // Generate smiley listing
     \generate_smilies('inline', 0);
     // Build custom bbcodes array
     \display_custom_bbcodes();
     $this->whois_online();
     return $this->helper->render('chat_body.html', $this->user->lang['CHAT_ARCHIVE_EXPLAIN']);
 }
Beispiel #27
0
 /**
  * Add link to header
  *
  * @param	object	$event	The event object
  * @return	null
  * @access	public
  */
 public function page_header($event)
 {
     if ($this->auth->acl_get('u_wiki_view')) {
         $this->user->add_lang_ext('tas2580/wiki', 'common');
         $this->template->assign_vars(array('U_WIKI' => $this->helper->route('tas2580_wiki_index', array())));
     }
 }
    /**
     * Clear user reputation
     *
     * @param int $uid	User ID
     * @return null
     * @access public
     */
    public function clear_user($uid)
    {
        $this->user->add_lang_ext('pico/reputation', 'reputation_system');
        $is_ajax = $this->request->is_ajax();
        $submit = false;
        $sql_array = array('SELECT' => 'r.*, ut.username AS username_to', 'FROM' => array($this->reputations_table => 'r'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'ut'), 'ON' => 'r.user_id_to = ut.user_id ')), 'WHERE' => 'r.user_id_to = ' . $uid);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        //We couldn't find this reputation. May be it was deleted meanwhile?
        if (empty($row)) {
            $message = $this->user->lang('RS_NO_REPUTATION');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $redirect = $this->helper->route('reputation_details_controller', array('uid' => $uid));
        if ($this->request->is_set_post('cancel')) {
            redirect($redirect);
        }
        $post_ids = array();
        $post_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
        $sql = 'SELECT reputation_item_id
			FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}\n\t\t\t\tAND reputation_type_id = {$post_type_id}\n\t\t\tGROUP BY reputation_item_id";
        $result = $this->db->sql_query($sql);
        while ($post_row = $this->db->sql_fetchrow($result)) {
            $post_ids[] = $post_row['reputation_item_id'];
        }
        $this->db->sql_freeresult($result);
        $redirect_text = 'RETURN_PAGE';
        if ($this->auth->acl_gets('m_rs_moderate')) {
            if ($is_ajax) {
                $submit = true;
            } else {
                $s_hidden_fields = build_hidden_fields(array('u' => $uid));
                if (confirm_box(true)) {
                    $submit = true;
                } else {
                    confirm_box(false, $this->user->lang('RS_CLEAR_POST_CONFIRM'), $s_hidden_fields);
                }
            }
        } else {
            $message = $this->user->lang('RS_USER_CANNOT_DELETE');
            $json_data = array('error_msg' => $message);
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($submit) {
            try {
                $this->reputation_manager->clear_user_reputation($uid, $row, $post_ids);
            } catch (\pico\reputation\exception\base $e) {
                // Catch exception
                trigger_error($e->get_message($this->user));
            }
            $message = $this->user->lang('RS_CLEARED_USER');
            $json_data = array('clear_user' => true, 'post_ids' => $post_ids, 'poster_id' => $uid, 'user_reputation' => 0, 'post_reputation' => 0, 'reputation_class' => 'neutral');
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
    }
Beispiel #29
0
 /**
  * @param int  $user_id
  * @param bool $admin
  * @param bool $auto_login
  * @param bool $viewonline
  * @param string $redirect
  */
 public function generate_page($user_id, $admin, $auto_login, $viewonline, $redirect)
 {
     $this->user->add_lang_ext('paul999/tfa', 'common');
     $modules = $this->getModules();
     /**
      * @var module_interface $row
      */
     foreach ($modules as $row) {
         if ($row->is_usable($user_id)) {
             $this->template->assign_block_vars('tfa_options', array_merge(array('ID' => $row->get_name(), 'NAME' => $this->user->lang($row->get_translatable_name()), 'U_SUBMIT_AUTH' => $this->controller_helper->route('paul999_tfa_read_controller_submit', array('user_id' => (int) $user_id, 'admin' => (int) $admin, 'auto_login' => (int) $auto_login, 'viewonline' => (int) $viewonline, 'class' => $row->get_name()))), $row->login_start($user_id)));
         }
     }
     add_form_key('tfa_login_page');
     $random = sha1(random_bytes(32));
     if (!empty($this->user->data['tfa_random'])) {
         throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG');
     }
     $sql_ary = array('tfa_random' => $random, 'tfa_uid' => $user_id);
     $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\tWHERE\n\t\t\t\tsession_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND\n\t\t\t\tsession_user_id = " . (int) $this->user->data['user_id'];
     $this->db->sql_query($sql);
     $this->template->assign_vars(array('REDIRECT' => $redirect, 'RANDOM' => $random));
     page_header('TFA_KEY_REQUIRED');
     $this->template->set_filenames(array('body' => '@paul999_tfa/authenticate_main.html'));
     page_footer(false);
     // Do not include cron on this page!
 }
    /**
     * Display the flags
     *
     * @return null
     * @access public
     */
    public function display_flags()
    {
        $start = $this->request->variable('start', 0);
        $pagination_url = $this->u_action;
        $this->user->add_lang_ext('rmcgirr83/nationalflags', 'common');
        $sql = 'SELECT f.*, COUNT(u.user_flag) as user_count
			FROM ' . $this->flags_table . ' f
				LEFT JOIN ' . USERS_TABLE . " u on f.flag_id = u.user_flag\n\t\t\tGROUP BY f.flag_id\n\t\t\tORDER BY f.flag_name ASC";
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        // for counting of all the flags
        // used for pagination
        $result2 = $this->db->sql_query($sql);
        $row2 = $this->db->sql_fetchrowset($result2);
        $total_count = (int) sizeof($row2);
        $this->db->sql_freeresult($result2);
        unset($row2);
        while ($row = $this->db->sql_fetchrow($result)) {
            $user_count = $this->user->lang('FLAG_USERS', (int) $row['user_count']);
            $this->template->assign_block_vars('flags', array('FLAG_NAME' => $row['flag_name'], 'FLAG_IMG' => $this->ext_path_web . 'flags/' . strtolower($row['flag_image']), 'FLAG_ID' => $row['flag_id'], 'USER_COUNT' => $user_count, 'U_FLAG' => $this->helper->route('rmcgirr83_nationalflags_getflags', array('flag_id' => $row['flag_id'])), 'U_EDIT' => $this->u_action . "&amp;flag_id={$row['flag_id']}&amp;action=edit", 'U_DELETE' => $this->u_action . "&amp;flag_id={$row['flag_id']}&amp;action=delete"));
        }
        $this->db->sql_freeresult($result);
        $start = $this->pagination->validate_start($start, $this->config['topics_per_page'], $total_count);
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_count, $this->config['topics_per_page'], $start);
        $this->template->assign_vars(array('TOTAL_FLAGS' => $total_count, 'S_FLAGS' => true));
    }