/** * */ 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'); } }
/** * 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); } }
/** * 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()))); } }
/** * 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; }
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'); } } }
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')); }
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 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')); }
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 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)); }
/** * 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; }
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)); }
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(); }
/** * 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); }
/** * Display reputation toplist * * @return null * @access public */ public function reputation_toplist() { if ($this->config['rs_enable'] && $this->config['rs_enable_toplist'] && $this->config['rs_toplist_num']) { $this->user->add_lang_ext('pico/reputation', 'reputation_toplist'); $sql = 'SELECT user_id, username, user_colour, user_reputation FROM ' . USERS_TABLE . ' WHERE user_reputation > 0 ORDER BY user_reputation DESC'; $result = $this->db->sql_query_limit($sql, $this->config['rs_toplist_num']); while ($row = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('toplist', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USER_REPUTATION' => $row['user_reputation'], 'U_VIEW_USER_REPUTATION' => $this->helper->route('reputation_details_controller', array('uid' => $row['user_id'])), 'S_DIRECTION' => $this->config['rs_toplist_direction'] ? true : false)); } $this->db->sql_freeresult($result); $this->template->assign_vars(array('S_RS_TOPLIST' => true, 'S_VIEW_REPUTATION' => $this->auth->acl_get('u_rs_view') ? true : false)); } }
public function handle_downloadlog() { if (!$this->auth->acl_get('a_')) { trigger_error('Access Denied'); } else { $this->user->add_lang_ext('dmzx/downloadlog', 'common'); $fileid = $this->request->variable('file', 0); $start = $this->request->variable('start', 0); // Pagination number from ACP $dll = $this->config['downloadlog_value']; // Generate pagination $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs FROM ' . $this->userdownloadslog_table . ' WHERE user_id = user_id AND file_id = ' . $fileid; $result = $this->db->sql_query($sql); $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs'); $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u WHERE u.user_id = d.user_id AND file_id = ' . $fileid . ' ORDER BY d.down_date DESC'; $top_result = $this->db->sql_query_limit($sql, $dll, $start); while ($row = $this->db->sql_fetchrow($top_result)) { $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date']))); } } $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid)); //Start pagination $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start); $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version'])); page_header('Downloaders Log', false); $this->template->set_filenames(array('body' => 'DownloadLog.html')); page_footer(); }
public function position() { if ($this->user->data['user_id'] == ANONYMOUS || !$this->auth->acl_get('u_usermap_add')) { trigger_error('NOT_AUTHORISED'); } $lon = substr($this->request->variable('lon', ''), 0, 10); $lat = substr($this->request->variable('lat', ''), 0, 10); if (confirm_box(true)) { $data = array('user_usermap_lon' => $lon, 'user_usermap_lat' => $lat); if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $error = validate_data($data, array('user_usermap_lon' => array(array('string', true, 5, 10)), 'user_usermap_lat' => array(array('string', true, 5, 10)))); $error = array_map(array($this->user, 'lang'), $error); if (sizeof($error)) { trigger_error(implode('<br>', $error) . '<br><br><a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang('BACK_TO_USERMAP') . '</a>'); } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $data) . ' WHERE user_id = ' . (int) $this->user->data['user_id']; $this->db->sql_query($sql); trigger_error('POSITION_SET'); } else { confirm_box(false, $this->user->lang('CONFIRM_COORDINATES_SET', $lon, $lat), build_hidden_fields(array('lon' => $lon, 'lat' => $lat))); } return $this->index(); }
/** * @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'); }
private function show_report_details() { global $request, $template, $user, $config, $db, $module; if (($report_id = $request->variable('report_id', 0)) == 0) { // no report id - show error message trigger_error('NO_REPORT'); } // fix mcp sidebar link $module->adjust_url('&report_id=' . $report_id); $report_row = $this->manager->get_report($report_id); if (!$report_row) { trigger_error('NO_REPORT'); } $feedback_row = $this->manager->getAllFeedbackInfo($report_row['feedback_id']); if ($user->data['user_timezone']) { $timezone = new \DateTimeZone($user->data['user_timezone']); } else { $timezone = new \DateTimeZone($config['board_timezone']); } $feedback_row['to_username'] = $this->get_username_full($db, $feedback_row['to_user_id']); $feedback_row['from_username'] = $this->get_username_full($db, $feedback_row['from_user_id']); $report_row['date_created'] = new \DateTime('@' . $report_row['date_created']); $report_row['date_created']->setTimezone($timezone); $feedback_row['date_created'] = new \DateTime('@' . $feedback_row['date_created']); $feedback_row['date_created']->setTimezone($timezone); $U_EDIT = $this->helper->route('rfd_trader_edit_feedback', array('feedback_id' => $report_row['feedback_id'])); $template->assign_vars(array('REPORT' => $report_row, 'FEEDBACK' => $feedback_row, 'S_REPORT_CLOSED' => !$report_row['status'], 'U_EDIT' => $U_EDIT)); add_form_key('mcp_trader'); $this->tpl_name = 'mcp_report_details'; }
/** * 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'))))); }
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']); }
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'); } }
/** * 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); } }
/** * @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 . "&flag_id={$row['flag_id']}&action=edit", 'U_DELETE' => $this->u_action . "&flag_id={$row['flag_id']}&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)); }
/** * 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()))); } }
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 .= ' <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 .= ' <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'] . ' © ' . $this->user->lang['CODEBOX_PLUS_TITLE'] . '</div></div>'; return $re; }
/** * 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'); } }
/** * Display recents links added * * @return null */ public function recents() { if ($this->config['dir_recent_block']) { $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); $sql_array = array('SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_thumb, u.user_id, u.username, u.user_colour, c.cat_name', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id'), array('FROM' => array(DIR_CAT_TABLE => 'c'), 'ON' => 'l.link_cat = c.cat_id')), 'WHERE' => $this->db->sql_in_set('l.link_cat', $exclude_array, true) . ' AND l.link_active = 1', 'ORDER_BY' => 'l.link_time DESC, l.link_id DESC'); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, $limit_sql, 0); $num = 0; $rowset = array(); while ($site = $this->db->sql_fetchrow($result)) { $rowset[$site['link_id']] = $site; } $this->db->sql_freeresult($result); if (sizeof($rowset)) { $this->template->assign_block_vars('block', array('S_COL_WIDTH' => 100 / $this->config['dir_recent_columns'] . '%')); foreach ($rowset as $row) { if ($num % $this->config['dir_recent_columns'] == 0) { $this->template->assign_block_vars('block.row', array()); } $this->template->assign_block_vars('block.row.col', array('UC_THUMBNAIL' => '<a href="' . $row['link_url'] . '" onclick="window.open(\'' . $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $row['link_id'])) . '\'); return false;"><img src="' . $row['link_thumb'] . '" title="' . $row['link_name'] . '" alt="' . $row['link_name'] . '" /></a>', 'NAME' => $row['link_name'], 'USER' => get_username_string('full', $row['link_user_id'], $row['username'], $row['user_colour']), 'TIME' => $row['link_time'] ? $this->user->format_date($row['link_time']) : '', 'CAT' => $row['cat_name'], 'COUNT' => $row['link_view'], 'COMMENT' => $row['link_comment'], 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_page_controller', array('cat_id' => (int) $row['link_cat'])), 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), 'L_DIR_SEARCH_NB_CLICKS' => $this->user->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), 'L_DIR_SEARCH_NB_COMMS' => $this->user->lang('DIR_SEARCH_NB_COMMS', (int) $row['link_comment']))); $num++; } while ($num % $this->config['dir_recent_columns'] != 0) { $this->template->assign_block_vars('block.row.col2', array()); $num++; } } } }