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); }
/** * 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']); }
/** * @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']); } }
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 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')); }
/** * 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']); }
/** * 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); }
/** * BBCode wizard controller accessed with the URL /wizard/bbcode/{mode} * (where {mode} is a placeholder for a string of the bbcode tag name) * intended to be accessed via AJAX only * * @param string $mode Mode taken from the URL * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @throws \phpbb\exception\http_exception An http exception * @access public */ public function bbcode_wizard($mode) { // Only allow AJAX requests if ($this->request->is_ajax()) { switch ($mode) { case 'bbvideo': $this->generate_bbvideo_wizard(); return $this->helper->render('abbc3_bbvideo_wizard.html'); break; case 'url': return $this->helper->render('abbc3_url_wizard.html'); break; } } throw new \phpbb\exception\http_exception(404, 'GENERAL_ERROR'); }
/** * Display popup comment * * @param int $link_id The category ID * @param int $page Page number taken from the URL * @param string $mode add|edit * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @throws \phpbb\exception\http_exception */ public function view($link_id, $page, $mode = 'new') { $this->_check_comments_enable($link_id); $comment_id = $this->request->variable('c', 0); $view = $this->request->variable('view', ''); $start = ($page - 1) * $this->config['dir_comments_per_page']; $this->s_hidden_fields = array_merge($this->s_hidden_fields, array('page' => $page)); $this->_populate_form($link_id, $mode); $sql = 'SELECT COUNT(comment_id) AS nb_comments FROM ' . DIR_COMMENT_TABLE . ' WHERE comment_link_id = ' . (int) $link_id; $result = $this->db->sql_query($sql); $nb_comments = (int) $this->db->sql_fetchfield('nb_comments'); $this->db->sql_freeresult($result); // Make sure $start is set to the last page if it exceeds the amount $start = $this->pagination->validate_start($start, $this->config['dir_comments_per_page'], $nb_comments); $sql_array = array('SELECT' => 'a.comment_id, a.comment_user_id, a. comment_user_ip, a.comment_date, a.comment_text, a.comment_uid, a.comment_bitfield, a.comment_flags, u.username, u.user_id, u.user_colour, z.foe', 'FROM' => array(DIR_COMMENT_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'a.comment_user_id = u.user_id'), array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id')), 'WHERE' => 'a.comment_link_id = ' . (int) $link_id, 'ORDER_BY' => 'a.comment_date DESC'); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, $this->config['dir_comments_per_page'], $start); $have_result = false; while ($comments = $this->db->sql_fetchrow($result)) { $have_result = true; $edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_edit_comment_dir')); $delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_delete_comment_dir')); $this->template->assign_block_vars('comment', array('MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_USER' => get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), 'S_USER_IP' => $comments['comment_user_ip'], 'S_DATE' => $this->user->format_date($comments['comment_date']), 'S_COMMENT' => generate_text_for_display($comments['comment_text'], $comments['comment_uid'], $comments['comment_bitfield'], $comments['comment_flags']), 'S_ID' => $comments['comment_id'], 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_edit_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '', 'S_IGNORE_POST' => $comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id']) ? true : false, 'L_IGNORE_POST' => $comments['foe'] ? $this->user->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'L_POST_DISPLAY' => $comments['foe'] ? $this->user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?c=' . (int) $comments['comment_id'] . '&view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'S_INFO' => $this->auth->acl_get('m_info'))); } $base_url = array('routes' => 'ernadoo_phpbbdirectory_comment_view_controller', 'params' => array('link_id' => (int) $link_id)); $this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_comments, $this->config['dir_comments_per_page'], $start); $this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('DIR_NB_COMMS', (int) $nb_comments), 'S_HAVE_RESULT' => $have_result ? true : false)); return $this->helper->render('comments.html', $this->user->lang['DIR_COMMENT_TITLE']); }
/** * @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 search($start = 1) { if (!$this->auth->acl_get('u_usermap_search')) { trigger_error('NOT_AUTHORISED'); } $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('USERMAP_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('tas2580_usermap_index', array()))); $lon = substr($this->request->variable('lon', ''), 0, 10); $lat = substr($this->request->variable('lat', ''), 0, 10); $dst = $this->request->variable('dst', $this->config['tas2580_usermap_search_distance']); $alpha = 180 * $dst / (6378137 / 1000 * 3.14159); $min_lon = $this->db->sql_escape($lon - $alpha); $max_lon = $this->db->sql_escape($lon + $alpha); $min_lat = $this->db->sql_escape($lat - $alpha); $max_lat = $this->db->sql_escape($lat + $alpha); $where = " WHERE ( user_usermap_lon >= '{$min_lon}' AND user_usermap_lon <= '{$max_lon}') AND ( user_usermap_lat >= '{$min_lat}' AND user_usermap_lat<= '{$max_lat}')"; $limit = (int) $this->config['topics_per_page']; $sql = 'SELECT COUNT(user_id) AS num_users FROM ' . USERS_TABLE . $where; $result = $this->db->sql_query($sql); $total_users = (int) $this->db->sql_fetchfield('num_users'); $this->db->sql_freeresult($result); $sql = 'SELECT user_id, username, user_colour, user_regdate, user_posts, group_id, user_usermap_lon, user_usermap_lat FROM ' . USERS_TABLE . $where; $result = $this->db->sql_query_limit($sql, $limit, ($start - 1) * $limit); while ($row = $this->db->sql_fetchrow($result)) { $distance = $this->get_distance($lon, $lat, $row['user_usermap_lon'], $row['user_usermap_lat']); $this->template->assign_block_vars('memberrow', array('USER_ID' => $row['user_id'], 'USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate']), 'POSTS' => $row['user_posts'], 'GROUP_ID' => $row['group_id'], 'DISTANCE' => $distance)); } $this->pagination->generate_template_pagination(array('routes' => array('tas2580_usermap_search', 'tas2580_usermap_search_page'), 'params' => array()), 'pagination', 'start', $total_users, $limit, ($start - 1) * $limit); $this->template->assign_vars(array('TOTAL_USERS' => $this->user->lang('TOTAL_USERS', (int) $total_users), 'L_SEARCH_EXPLAIN' => $this->user->lang('SEARCH_EXPLAIN', $dst, $lon, $lat))); return $this->helper->render('usermap_search.html', $this->user->lang('USERMAP_SEARCH')); }
/** * Display add form * * @param int $cat_id The category ID * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @throws \phpbb\exception\http_exception */ public function new_link($cat_id) { if (!$this->auth->acl_get('u_submit_dir')) { throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH'); } $cat_id = $this->request->variable('id', $cat_id); $submit = $this->request->is_set_post('submit') ? true : false; $refresh = $this->request->is_set_post('refresh_vc') ? true : false; $title = $this->user->lang['DIR_NEW_SITE']; $this->template->assign_block_vars('dir_navlinks', array('FORUM_NAME' => $title, 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => (int) $cat_id)))); $this->categorie->get($cat_id); // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm']) { $this->captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); $this->captcha->init(CONFIRM_POST); } // If form is done if ($submit || $refresh) { if (false != ($result = $this->_data_processing($cat_id))) { return $result; } } $this->_populate_form($cat_id, 'new', $title); return $this->helper->render('add_site.html', $title); }
/** * 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 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 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(); } elseif ($this->mode === 'read') { $this->readAction(); } elseif ($this->mode === 'add') { $this->addAction(); } elseif ($this->mode === 'smilies') { $this->smiliesAction(); } elseif ($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; $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->get_status($row['user_lastpost']) === 'idle') { $refresh = $this->config['refresh_idle_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']; } //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_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' => false, 'S_BBCODE_URL' => $url_status, 'REFRESH_TIME' => $refresh, 'LAST_ID' => $this->last_id, 'LAST_POST' => $last_post, 'TIME' => time(), '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_POPUP' => !$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_POPUP_EXPLAIN']); }
public function handle() { // Do we have the donation extension enabled if (isset($this->config['donation_enable']) && $this->config['donation_enable'] == 0) { trigger_error($this->user->lang['DONATION_DISABLED'], E_USER_NOTICE); } if (isset($this->config['donation_email']) && $this->config['donation_email'] == '') { trigger_error($this->user->lang['DONATION_DISABLED_EMAIL'], E_USER_NOTICE); } $sql = 'SELECT * FROM ' . $this->donation_table; $result = $this->db->sql_query($sql); $donation = array(); while ($row = $this->db->sql_fetchrow($result)) { $donation[$row['config_name']] = $row['config_value']; } $this->db->sql_freeresult($result); $donation_body = isset($donation['donation_body']) ? $donation['donation_body'] : ''; $donation_cancel = isset($donation['donation_cancel']) ? $donation['donation_cancel'] : ''; $donation_success = isset($donation['donation_success']) ? $donation['donation_success'] : ''; $success_url = generate_board_url() . '/app.php/donation?mode=success'; $cancel_url = generate_board_url() . '/app.php/donation?mode=cancel'; $mode = $this->request->variable('mode', ''); if (!empty($this->config['donation_goal_enable']) && $this->config['donation_goal'] > 0) { $donation_goal_number = $this->config['donation_achievement'] * 100 / $this->config['donation_goal']; $this->template->assign_vars(array('DONATION_GOAL_NUMBER' => round($donation_goal_number))); } // Lets build a page ... $this->template->assign_vars(array('U_DONATE_SUCCESS' => $success_url, 'U_DONATE_CANCEL' => $cancel_url, 'DONATION_EMAIL' => $this->config['donation_email'], 'DONATION_ACHIEVEMENT_ENABLE' => $this->config['donation_achievement_enable'], 'DONATION_ACHIEVEMENT' => $this->config['donation_achievement'], 'DONATION_GOAL_ENABLE' => $this->config['donation_goal_enable'], 'DONATION_GOAL' => $this->config['donation_goal'], 'DONATION_GOAL_CURRENCY_ENABLE' => $this->config['donation_goal_currency_enable'], 'DONATION_GOAL_CURRENCY' => $this->config['donation_goal_currency'], 'DONATION_BODY' => html_entity_decode($donation_body), 'DONATION_CANCEL' => html_entity_decode($donation_cancel), 'DONATION_SUCCESS' => html_entity_decode($donation_success))); // Set up Navlinks $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('DONATION_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('dmzx_donation_controller'))); switch ($mode) { case 'success': return $this->helper->render('donate/success_body.html', $this->user->lang('DONATION_SUCCESSFULL_TITLE')); break; case 'cancel': return $this->helper->render('donate/cancel_body.html', $this->user->lang('DONATION_CANCELLED_TITLE')); break; default: return $this->helper->render('donate/donate_body.html', $this->user->lang('DONATION_TITLE')); break; } }
/** * Display the games * * @return null * @access public */ public function display() { // When PiwikStats-Site are disabled, redirect users back to the forum index if (!empty($this->config['piwik_stats_page_active']) == false) { redirect(append_sid("{$this->root_path}index.{$this->php_ext}")); } // Add the piwikstats ACP lang file $this->user->add_lang_ext('tacitus89/piwikstats', 'piwikstats'); // Set the page title $this->page_title = $this->user->lang('L_PIWIK_STATS'); //get the config text data for piwikstats $config_text = $this->getConfigText(); $piwikData = array(array('module' => 'VisitsSummary', 'action' => 'get', 'graphType' => 'evolution', 'period' => 'day'), array('module' => 'VisitsSummary', 'action' => 'get', 'graphType' => 'evolution', 'period' => 'week'), array('module' => 'VisitTime', 'action' => 'getVisitInformationPerServerTime', 'graphType' => 'verticalBar', 'period' => 'range'), array('module' => 'VisitTime', 'action' => 'getByDayOfWeek', 'graphType' => 'verticalBar', 'period' => 'range'), array('module' => 'DevicesDetection', 'action' => 'getBrowsers', 'graphType' => 'horizontalBar', 'period' => 'range'), array('module' => 'UserCountry', 'action' => 'getCountry', 'graphType' => 'horizontalBar', 'period' => 'range')); foreach ($piwikData as $key => $data) { $this->template->assign_vars(array('PIWIK_' . $key => base64_encode($this->getImage($config_text, $data)))); } $this->template->assign_vars(array('PIWIK_TIME' => $config_text['piwik_time_page'])); // Send all data to the template file return $this->helper->render('piwik.html', $this->user->lang('PIWIK_STATS')); }
public function add_thing() { if (!$this->auth->acl_get('u_usermap_add_thing')) { trigger_error('NOT_AUTHORISED'); } include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext; include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext; $bbcode_status = $this->config['tas2580_usermap_allow_bbcode']; $url_status = $this->config['tas2580_usermap_allow_urls']; $img_status = $this->config['tas2580_usermap_allow_img']; $flash_status = $this->config['tas2580_usermap_allow_flash']; $smilies_status = $this->config['tas2580_usermap_allow_smilies']; $marker = ''; $this->user->add_lang('posting'); $submit = $this->request->is_set_post('submit'); if ($submit) { $title = $this->request->variable('title', '', true); $message = $this->request->variable('message', '', true); $marker = $this->request->variable('marker', '', true); $data = array('lon' => (double) substr($this->request->variable('lon', ''), 0, 10), 'lat' => (double) substr($this->request->variable('lat', ''), 0, 10)); $validate_array = array('lon' => array('match', false, self::REGEX_LON), 'lat' => array('match', false, self::REGEX_LAT)); if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $error = validate_data($data, $validate_array); if (utf8_clean_string($title) === '') { $error[] = $this->user->lang['EMPTY_SUBJECT']; } if (utf8_clean_string($message) === '') { $error[] = $this->user->lang['TOO_FEW_CHARS']; } if (empty($marker)) { $error[] = $this->user->lang['NEED_MARKER']; } if (sizeof($error)) { $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'TITLE' => $title, 'MESSAGE' => $message)); } else { generate_text_for_storage($message, $uid, $bitfield, $options, $bbcode_status, $url_status, $smilies_status); $sql_data = array('thing_title' => $title, 'thing_text' => $message, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'thing_lat' => $data['lat'], 'thing_lon' => $data['lon'], 'thing_marker' => $marker, 'thing_user_id' => $this->user->data['user_id']); $sql = 'INSERT INTO ' . $this->things_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); $this->db->sql_query($sql); $thing_id = $this->db->sql_nextid(); trigger_error($this->user->lang['THING_ADDED'] . '<br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_thing', array('id' => $thing_id)) . '">' . $this->user->lang['BACK_TO_THING'] . '</a><br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang['BACK_TO_USERMAP'] . '</a>'); } } $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/things'); generate_smilies('inline', 0); display_custom_bbcodes(); $s_hidden_fields = build_hidden_fields(array('lon' => $this->request->variable('lon', ''), 'lat' => $this->request->variable('lat', ''))); $this->template->assign_vars(array('TITLE' => $this->request->variable('title', '', true), 'MESSAGE' => $this->request->variable('message', '', true), 'MARKER_OPTIONS' => $this->marker_image_select($marker, 'marker/things/'), 'USERMAP_MARKER_PATH' => $path, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => 1, 'BBCODE_STATUS' => $bbcode_status ? 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' => $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' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'FORM_TITLE' => $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name'])))); return $this->helper->render('usermap_thing_form.html', $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name']))); }
/** * User details controller * * @param int $uid User ID taken from the URL * @param string $sort_key Sort key: id|username|time|point|action (default: id) * @param string $sort_dir Sort direction: dsc|asc (descending|ascending) (default: dsc) * @return Symfony\Component\HttpFoundation\Response A Symfony Response object * @access public */ public function userdetails($uid, $sort_key, $sort_dir) { $this->user->add_lang_ext('pico/reputation', array('reputation_system', 'reputation_rating')); $is_ajax = $this->request->is_ajax(); $referer = $this->symfony_request->get('_referer'); if (empty($this->config['rs_enable'])) { if ($is_ajax) { $json_response = new \phpbb\json_response(); $json_data = array('error_msg' => $this->user->lang('RS_DISABLED')); $json_response->send($json_data); } redirect(append_sid("{$this->root_path}index.{$this->php_ext}")); } $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' WHERE user_type <> 2 AND user_id =' . (int) $uid; $result = $this->db->sql_query($sql); $user_row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); if (empty($user_row)) { $message = $this->user->lang('RS_NO_USER_ID'); $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); } if (!$this->auth->acl_get('u_rs_view')) { $message = $this->user->lang('RS_VIEW_DISALLOWED'); $json_data = array('error_msg' => $message); $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid); $redirect_text = 'RETURN_PAGE'; $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax); } $sort_key_sql = array('username' => 'u.username_clean', 'time' => 'r.reputation_time', 'point' => 'r.reputation_points', 'action' => 'rt.reputation_type_name', 'id' => 'r.reputation_id'); // Sql order depends on sort key $order_by = $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'dsc' ? 'DESC' : 'ASC'); $reputation_type_id = (int) $this->reputation_manager->get_reputation_type_id('post'); $sql_array = array('SELECT' => 'r.*, rt.reputation_type_name, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, p.post_id, p.forum_id, p.post_subject', 'FROM' => array($this->reputations_table => 'r', $this->reputation_types_table => 'rt'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = r.user_id_from'), array('FROM' => array(POSTS_TABLE => 'p'), 'ON' => 'p.post_id = r.reputation_item_id AND r.reputation_type_id = ' . $reputation_type_id)), 'WHERE' => 'r.user_id_to = ' . $uid . ' AND r.reputation_type_id = rt.reputation_type_id', 'ORDER_BY' => $order_by); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('reputation', array('ID' => $row['reputation_id'], 'USERNAME' => get_username_string('full', $row['user_id_from'], $row['username'], $row['user_colour']), 'ACTION' => $this->user->lang('RS_' . strtoupper($row['reputation_type_name']) . '_RATING'), 'AVATAR' => phpbb_get_user_avatar($row), 'TIME' => $this->user->format_date($row['reputation_time']), 'COMMENT' => $row['reputation_comment'], 'POINTS' => $row['reputation_points'], 'POINTS_CLASS' => $this->reputation_helper->reputation_class($row['reputation_points']), 'POINTS_TITLE' => $this->user->lang('RS_POINTS_TITLE', $row['reputation_points']), 'U_DELETE' => $this->helper->route('reputation_delete_controller', array('rid' => $row['reputation_id'])), 'S_COMMENT' => !empty($row['reputation_comment']), 'S_DELETE' => $this->auth->acl_get('m_rs_moderate') || $row['user_id_from'] == $this->user->data['user_id'] && $this->auth->acl_get('u_rs_delete') ? true : false)); // Generate post url $this->reputation_manager->generate_post_link($row); } $this->db->sql_freeresult($result); $this->template->assign_vars(array('USER_ID' => $uid, 'U_USER_DETAILS' => $this->helper->route('reputation_details_controller', array('uid' => $uid)), 'U_SORT_USERNAME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'username', 'sort_dir' => $sort_key == 'username' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_TIME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'time', 'sort_dir' => $sort_key == 'time' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_POINT' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'point', 'sort_dir' => $sort_key == 'point' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_ACTION' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'action', 'sort_dir' => $sort_key == 'action' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_CLEAR' => $this->helper->route('reputation_clear_user_controller', array('uid' => $uid)), 'U_REPUTATION_REFERER' => $referer, 'L_RS_USER_REPUTATION' => $this->user->lang('RS_USER_REPUTATION', get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour'])), 'S_RS_AVATAR' => $this->config['rs_display_avatar'] ? true : false, 'S_RS_COMMENT' => $this->config['rs_enable_comment'] ? true : false, 'S_RS_POINTS_IMG' => $this->config['rs_point_type'] ? true : false, 'S_CLEAR' => $this->auth->acl_gets('m_rs_moderate') ? true : false, 'S_IS_AJAX' => $is_ajax ? true : false)); return $this->helper->render('userdetails.html'); }
/** * Controller for mChat Rules page * * @return \Symfony\Component\HttpFoundation\Response */ public function page_rules() { if (empty($this->config['mchat_rules']) && empty($this->user->lang['MCHAT_RULES'])) { throw new \phpbb\exception\http_exception(404, 'MCHAT_NO_RULES'); } // If the rules are defined in the language file use them, else just use the entry in the database $mchat_rules = isset($this->user->lang['MCHAT_RULES']) ? $this->user->lang('MCHAT_RULES') : $this->config['mchat_rules']; $mchat_rules = explode("\n", $mchat_rules); $mchat_rules = array_map('utf8_htmlspecialchars', $mchat_rules); $mchat_rules = implode('<br />', $mchat_rules); $this->template->assign_var('MCHAT_RULES', $mchat_rules); return $this->helper->render('mchat_rules.html', $this->user->lang('MCHAT_HELP')); }
public function base() { $this->user->add_lang_ext('tas2580/wiki', 'common'); $this->user->add_lang_ext('tas2580/wiki', 'overview'); // get all article $sql = 'SELECT article_title, article_url, article_description, article_views, article_last_edit FROM ' . $this->article_table . ' WHERE article_approved=1 ORDER BY article_id ASC'; $result = $this->db->sql_query($sql); while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('all_wiki_article', array('U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], 'ARTICLE_LASTEDIT' => $this->user->format_date($all_wiki_article['article_last_edit']))); } $this->db->sql_freeresult($result); // get latest article $sql = 'SELECT article_title, article_url, article_description, article_views, article_time_created FROM ' . $this->article_table . ' WHERE article_approved=1 ORDER BY article_time_created DESC'; $result = $this->db->sql_query_limit($sql, 5); while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('latest_wiki_article', array('U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], 'ARTICLE_TIME_CREATED' => $this->user->format_date($all_wiki_article['article_time_created']))); } $this->db->sql_freeresult($result); // get hot article $sql = 'SELECT article_title, article_url, article_description, article_views, article_last_edit FROM ' . $this->article_table . ' WHERE article_approved=1 ORDER BY article_views DESC'; $result = $this->db->sql_query_limit($sql, 5); while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('hot_wiki_article', array('U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], 'ARTICLE_LASTEDIT' => $this->user->format_date($all_wiki_article['article_last_edit']))); } $this->db->sql_freeresult($result); // get sticky article $sql = 'SELECT article_title, article_url, article_description, article_views, article_last_edit FROM ' . $this->article_table . ' WHERE article_approved=1 AND article_sticky=1 ORDER BY article_last_edit DESC'; $result = $this->db->sql_query($sql); while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('sticky_wiki_article', array('U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], 'ARTICLE_LASTEDIT' => $this->user->format_date($all_wiki_article['article_last_edit']))); } $this->db->sql_freeresult($result); return $this->helper->render('overview.html', $this->user->lang['OVERVIEW']); }
/** * Delete a thing * * @param int $id The Thing ID * @return type */ public function wa($user_id) { $this->user->add_lang_ext('tas2580/mobilenotifier', 'common'); $sql = 'SELECT username, user_allow_whatsapp, user_whatsapp FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); $submit = $this->request->is_set_post('submit'); if ($submit) { $wa = $this->phpbb_container->get('tas2580.mobilenotifier.src.helper'); $wa->send($row['user_whatsapp'], 'test'); } $this->template->assign_vars(array('U_ACTION' => $this->helper->route('tas2580_mobilenotifier_send', array('user_id' => $user_id)), 'SEND_WHATSAPP' => $this->user->lang('SEND_WHATSAPP', $row['username']))); return $this->helper->render('whatsapp_send.html', $this->user->lang('SEND_WHATSAPP', $row['username'])); }
public function view_versions($article) { if (!$this->auth->acl_get('u_wiki_versions')) { trigger_error('NOT_AUTHORISED'); } $sql = 'SELECT * FROM ' . $this->article_table . ' WHERE article_url = "' . $this->db->sql_escape($article) . '" ORDER BY article_last_edit DESC'; $result = $this->db->sql_query_limit($sql, 1); $this->data = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); $this->template->assign_vars(array('ARTICLE_TITLE' => $this->data['article_title'], 'S_SET_ACTIVE' => $this->auth->acl_get('u_wiki_set_active'), 'S_DELETE' => $this->auth->acl_get('m_wiki_delete'), 'S_DELETE_ARTICLE' => $this->auth->acl_get('m_wiki_delete_article'), 'U_ACTION' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'compare')), 'U_DELETE_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'detele_article')), 'U_SET_INACTIV' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'deactivate')))); if (!empty($article)) { $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->data['article_title'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_article', array('article' => $article)))); } $start = $this->request->variable('start', 0); $sql_array = array('SELECT' => 'a.article_id, a.article_title, a.article_last_edit, a.article_approved, a.article_edit_reason, u.user_id, u.username, u.user_colour', 'FROM' => array($this->article_table => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = a.article_user_id')), 'WHERE' => 'article_url = "' . $this->db->sql_escape($article) . '"', 'ORDER_BY' => 'a.article_last_edit DESC'); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start); $result2 = $this->db->sql_query($sql); $row2 = $this->db->sql_fetchrowset($result2); $total_count = (int) sizeof($row2); $this->db->sql_freeresult($result2); unset($row2); $i = 1; $has_active_version = false; while ($this->data = $this->db->sql_fetchrow($result)) { if (!$has_active_version) { $has_active_version = $this->data['article_approved'] == 1 ? true : false; } $this->template->assign_block_vars('version_list', array('ID' => $this->data['article_id'], 'NR' => $i++, 'ARTICLE_TITLE' => $this->data['article_title'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'S_ACTIVE' => $this->data['article_approved'] == 1 ? true : false, 'USER' => get_username_string('full', $this->data['user_id'], $this->data['username'], $this->data['user_colour']), 'EDIT_TIME' => $this->user->format_date($this->data['article_last_edit']), 'U_VERSION' => $this->helper->route('tas2580_wiki_article', array('id' => $this->data['article_id'])), 'U_DELETE' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $this->data['article_id'])), 'U_SET_ACTIVE' => $this->helper->route('tas2580_wiki_article', array('action' => 'active', 'id' => $this->data['article_id'])))); } $this->db->sql_freeresult($result); // No active versions and no right to view inactive articles if (!$has_active_version && !$this->auth->acl_get('m_wiki_view_inactive')) { trigger_error('NOT_AUTHORISED'); } $pagination_url = $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'versions')); $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_ITEMS' => $this->user->lang('TOTAL_ITEMS', (int) $total_count))); return $this->helper->render('article_versions.html', $this->user->lang['VERSIONS_WIKI']); }
/** * Display the users of flags page * * @param $flag_id int the id of the flag * @param $page int page number we are on * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @access public */ public function getFlags($flag_id, $page = 0) { // When flags are disabled, redirect users back to the forum index if (empty($this->config['allow_flags'])) { redirect(append_sid("{$this->root_path}index.{$this->php_ext}")); } $flags = $this->cache->get('_user_flags'); // ensure our flag id passed actually exists in the cache if (!isset($flags[$flag_id])) { throw new \RunTimeException($this->user->lang('FLAG_NOT_EXIST')); } $flag_name = $flags[$flag_id]['flag_name']; $page_title = $flag_name; if ($page > 1) { $page_title .= ' - ' . $this->user->lang('PAGE_TITLE_NUMBER', $page); } $this->display_flag($flag_id, ($page - 1) * $this->config['posts_per_page'], $this->config['posts_per_page']); // Send all data to the template file return $this->helper->render('flag_users.html', $page_title); }
/** * Display the form * * @access public */ public function displayform() { $this->user->add_lang_ext('rmcgirr83/applicationform', 'application'); // user can't be a guest and can't be a bot if ($this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS) { throw new http_exception(401, 'LOGIN_APPLICATION_FORM'); } add_form_key('appform'); if ($this->request->is_set_post('submit')) { // Test if form key is valid if (!check_form_key('appform')) { trigger_error($this->user->lang['FORM_INVALID'], E_USER_WARNING); } if (utf8_clean_string($this->request->variable('name', '')) === '' || utf8_clean_string($this->request->variable('why', '')) === '') { trigger_error($this->user->lang['APP_NOT_COMPLETELY_FILLED'], E_USER_WARNING); } $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $this->config['appform_forum_id']; $result = $this->db->sql_query($sql); $forum_name = $this->db->sql_fetchfield('forum_name'); $this->db->sql_freeresult($result); // Setting the variables we need to submit the post to the forum where all the applications come in $subject = sprintf($this->user->lang['APPLICATION_SUBJECT'], $this->user->data['username']); $apply_post = sprintf($this->user->lang['APPLICATION_MESSAGE'], get_username_string('full', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']), utf8_normalize_nfc($this->request->variable('name', '', true)), $this->user->data['user_email'], $this->request->variable('postion', '', true), utf8_normalize_nfc($this->request->variable('why', '', true))); // variables to hold the parameters for submit_post $uid = $bitfield = $options = ''; generate_text_for_storage($apply_post, $uid, $bitfield, $options, true, true, true); $data = array('forum_id' => $this->config['appform_forum_id'], 'icon_id' => false, 'poster_id' => $this->user->data['user_id'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $apply_post, 'message_md5' => md5($apply_post), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'poster_ip' => $this->user->ip, 'post_edit_locked' => 0, 'topic_title' => $subject, 'notify_set' => false, 'notify' => false, 'post_time' => time(), 'forum_name' => $forum_name, 'enable_indexing' => true, 'force_approved_state' => true, 'force_visibility' => true); $poll = array(); // Submit the post! submit_post('post', $subject, $this->user->data['username'], POST_NORMAL, $poll, $data); $message = $this->user->lang['APPLICATION_SEND']; $message = $message . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$this->root_path}index.{$this->php_ext}") . '">', '</a>'); trigger_error($message); } $this->template->assign_vars(array('APPLICATION_POSITIONS' => $this->display_positions(explode("\n", $this->config['appform_positions'])))); // Send all data to the template file return $this->helper->render('appform_body.html', $this->user->lang('APPLICATION_PAGETITLE')); }
/** * Shows a list of topics that have the given $tags assigned * * @param $tags tags seperated by comma (",") * @param $mode the mode indicates whether all tags (AND, default) or any tag (OR) should be assigned to the resulting topics * @param casesensitive wether to search case-sensitive (true) or -insensitive (false, default) */ public function show_tag($tags, $mode, $casesensitive) { // validate mode // default == AND $mode = $mode == 'OR' ? 'OR' : 'AND'; $tags = explode(',', urldecode($tags)); // remove possible duplicates $tags = array_unique($tags); $all_tags = $this->tags_manager->split_valid_tags($tags); if (sizeof($all_tags['invalid']) > 0) { $this->template->assign_var('RH_TOPICTAGS_SEARCH_IGNORED_TAGS', $this->user->lang('RH_TOPICTAGS_SEARCH_IGNORED_TAGS', join(', ', $all_tags['invalid']))); } $tags = $all_tags['valid']; $tags_string = join(', ', $tags); $this->template->assign_var('RH_TOPICTAGS_SEARCH_HEADER', $this->user->lang('RH_TOPICTAGS_SEARCH_HEADER_' . $mode, $tags_string)); if (empty($tags)) { // no valid tags $this->template->assign_var('NO_TOPICS_FOR_TAG', $this->user->lang('RH_TOPICTAGS_NO_TOPICS_FOR_NO_TAG')); return $this->helper->render('show_tag.html', $this->user->lang('RH_TOPICTAGS_TAG_SEARCH')); } $topics_count = $this->tags_manager->count_topics_by_tags($tags, $mode, $casesensitive); if ($topics_count <= 0) { $this->template->assign_var('NO_TOPICS_FOR_TAG', $this->user->lang('RH_TOPICTAGS_NO_TOPICS_FOR_TAG_' . $mode, $tags_string)); } else { $pagination = $this->pagination; $start = $this->request->variable('start', 0); $limit = $this->config['topics_per_page']; $start = $pagination->validate_start($start, $limit, $topics_count); $topics = $this->tags_manager->get_topics_by_tags($tags, $start, $limit, $mode, $casesensitive); $base_url = $this->helper->route('robertheim_topictags_show_tag_controller', array('tags' => urlencode($tags_string))); $base_url = append_sid($base_url); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $topics_count, $limit, $start); $this->user->add_lang('viewforum'); $this->template->assign_vars(array('TOTAL_TOPICS' => $this->user->lang('VIEW_FORUM_TOPICS', $topics_count), 'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'REPORTED_IMG' => $this->user->img('icon_topic_reported', 'TOPIC_REPORTED'), 'UNAPPROVED_IMG' => $this->user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), 'DELETED_IMG' => $this->user->img('icon_topic_deleted', 'TOPIC_DELETED'), 'POLL_IMG' => $this->user->img('icon_topic_poll', 'TOPIC_POLL'), 'S_TOPIC_ICONS' => true)); $this->display_topics($topics); } // else return $this->helper->render('show_tag.html', $this->user->lang('RH_TOPICTAGS_TAG_SEARCH')); }
/** * Display the search page * * @param type $start * @return type */ public function search($start = 1) { if (!$this->auth->acl_get('u_usermap_search')) { trigger_error('NOT_AUTHORISED'); } $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('USERMAP_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('tas2580_usermap_index', array()))); $data = array('lon' => substr($this->request->variable('lon', ''), 0, 10), 'lat' => substr($this->request->variable('lat', ''), 0, 10), 'dst' => (int) $this->request->variable('dst', $this->config['tas2580_usermap_search_distance'])); $validate_array = array('lon' => array('match', false, self::REGEX_LON), 'lat' => array('match', false, self::REGEX_LAT)); if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $error = validate_data($data, $validate_array); if (sizeof($error)) { $error = array_map(array($this->user, 'lang'), $error); trigger_error(implode('<br>', $error) . '<br><br><a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang('BACK_TO_USERMAP') . '</a>'); } $alpha = 180 * $data['dst'] / (6378137 / 1000 * 3.14159); $min_lon = (double) ($data['lon'] - $alpha); $max_lon = (double) ($data['lon'] + $alpha); $min_lat = (double) ($data['lat'] - $alpha); $max_lat = (double) ($data['lat'] + $alpha); $where = " WHERE ( user_usermap_lon * 1 >= {$min_lon} AND user_usermap_lon * 1 <= {$max_lon}) AND ( user_usermap_lat * 1 >= {$min_lat} AND user_usermap_lat * 1 <= {$max_lat})"; $limit = (int) $this->config['topics_per_page']; $sql = 'SELECT COUNT(user_id) AS num_users FROM ' . USERS_TABLE . $where; $result = $this->db->sql_query($sql); $total_users = (int) $this->db->sql_fetchfield('num_users'); $this->db->sql_freeresult($result); $sql = 'SELECT user_id, username, user_colour, user_regdate, user_posts, group_id, user_usermap_lon, user_usermap_lat FROM ' . USERS_TABLE . $where; $result = $this->db->sql_query_limit($sql, $limit, ($start - 1) * $limit); while ($row = $this->db->sql_fetchrow($result)) { $distance = $this->get_distance($data['lon'], $data['lat'], $row['user_usermap_lon'], $row['user_usermap_lat']); $this->template->assign_block_vars('memberrow', array('USER_ID' => $row['user_id'], 'USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate']), 'POSTS' => $row['user_posts'], 'GROUP_ID' => $row['group_id'], 'DISTANCE' => $distance)); } $this->pagination->generate_template_pagination(array('routes' => array('tas2580_usermap_search', 'tas2580_usermap_search_page'), 'params' => array()), 'pagination', 'start', $total_users, $limit, ($start - 1) * $limit); $this->template->assign_vars(array('TOTAL_USERS' => $this->user->lang('TOTAL_USERS', (int) $total_users), 'L_SEARCH_EXPLAIN' => $this->user->lang('SEARCH_EXPLAIN', $data['dst'], $data['lon'], $data['lat']))); return $this->helper->render('usermap_search.html', $this->user->lang('USERMAP_SEARCH')); }
/** * Display the users of flags page * * @param $flag_id int the id of the flag * @param $page int page number we are on * @access public */ public function getFlags($flag_id, $page = 0) { // When flags are disabled, redirect users back to the forum index if (empty($this->config['allow_flags'])) { redirect(append_sid("{$this->root_path}index.{$this->php_ext}")); } // If setting in ACP is set to not allow guests and bots to view the flags if (empty($this->config['flags_display_to_guests']) && ($this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS)) { throw new http_exception(401, 'NOT_AUTHORISED'); } $flags = $this->cache->get('_user_flags'); // ensure our flag id passed actually exists in the cache if (!isset($flags[$flag_id])) { throw new http_exception(404, 'FLAG_NOT_EXIST'); } $flag_name = $flags[$flag_id]['flag_name']; $page_title = $flag_name; if ($page > 1) { $page_title .= ' - ' . $this->user->lang('PAGE_TITLE_NUMBER', $page); } $this->display_flag($flag_id, ($page - 1) * $this->config['posts_per_page'], $this->config['posts_per_page']); // Send all data to the template file return $this->helper->render('flag_users.html', $page_title); }
/** * View an article * * @param string $article URL of the article * @param int $id ID of the article * @return object */ public function view_article($article, $id = 0) { // Setup message parser $this->message_parser = $this->setup_parser(); $where = $id === 0 ? "article_url = '" . $this->db->sql_escape($article) . "' AND article_approved = 1" : 'article_id = ' . (int) $id; $sql_array = array('SELECT' => 'a.*, u.user_id, u.username, u.user_colour', 'FROM' => array($this->article_table => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = a.article_user_id')), 'WHERE' => $where, 'ORDER_BY' => 'a.article_last_edit DESC'); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, 1); $this->data = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); // Do we have a newer version? if ($id === 0 && $this->auth->acl_get('u_wiki_set_active')) { $sql = 'SELECT article_id FROM ' . $this->article_table . "\n\t\t\t\tWHERE article_url = '" . $this->db->sql_escape($this->data['article_url']) . "'\n\t\t\t\t\tAND article_id <> " . (int) $this->data['article_id'] . ' AND article_last_edit > ' . (int) $this->data['article_last_edit'] . ' ORDER BY article_last_edit DESC'; $result = $this->db->sql_query_limit($sql, 1); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); if (!empty($row['article_id'])) { $this->template->assign_vars(array('S_NEW_VERSION' => true, 'U_NEW_VERSION' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'id' => $row['article_id'])))); } } if ($id != 0 && $this->data['article_approved'] != 1 && $this->auth->acl_get('u_wiki_set_active')) { $this->template->assign_vars(array('U_SET_ACTIVE' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'active', 'id' => $id)))); } if (!empty($this->data['article_title']) && !empty($article)) { $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->data['article_title'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_article', array('article' => $article)))); } // If the article do not exist generate it if (!$this->data) { // Do we have a inactive article? if ($this->auth->acl_get('m_wiki_view_inactive')) { $sql = 'SELECT article_id FROM ' . $this->article_table . "\n\t\t\t\t\tWHERE article_url = '" . $this->db->sql_escape($article) . "'"; $result = $this->db->sql_query_limit($sql, 1); $row = $this->db->sql_fetchrow($result); if (!empty($row['article_id'])) { return $this->compare->view_versions($article); } } return $this->edit->edit_article($article); } else { $sources = explode("\n", $this->data['article_sources']); foreach ($sources as $source) { if (!empty($source)) { $this->template->assign_block_vars('article_sources', array('SOURCE' => $source)); } } $this->message_parser->message = $this->data['article_text']; $this->message_parser->bbcode_bitfield = $this->data['bbcode_bitfield']; $this->message_parser->bbcode_uid = $this->data['bbcode_uid']; $allow_bbcode = $allow_magic_url = $allow_smilies = true; $this->message_parser->format_display($allow_bbcode, $allow_magic_url, $allow_smilies); if (!empty($this->data['article_redirect'])) { $redirect_note = $this->user->lang('NO_ARTICLE_REDIRECT', $this->helper->route('tas2580_wiki_article', array('article' => $this->data['article_redirect'])), $this->data['article_redirect']); if ($this->auth->acl_get('u_wiki_set_redirect')) { $redirect_note = $redirect_note . $this->message_parser->message; } } // article views if (isset($this->user->data['session_page']) && !$this->user->data['is_bot'] && (strpos($this->user->data['session_page'], 'wiki/' . $this->data['article_url']) === false || isset($this->user->data['session_created']))) { $article_id = $this->data['article_id']; $sql = 'UPDATE ' . $this->article_table . "\n\t\t\t\t\t\tSET article_views = article_views + 1\n\t\t\t\t\t\tWHERE article_id = {$article_id}"; $this->db->sql_query($sql); } $s_edit_redirect = !empty($this->data['article_redirect']) && $this->auth->acl_get('u_wiki_set_redirect') || empty($this->data['article_redirect']) ? true : false; $this->template->assign_vars(array('ARTICLE_TITLE' => $this->data['article_title'], 'ARTICLE_TEXT' => $this->data['article_redirect'] ? $redirect_note : $this->message_parser->message, 'LAST_EDIT' => $this->user->format_date($this->data['article_last_edit']), 'LAST_EDIT_ISO' => date('Y-m-d', $this->data['article_last_edit']), 'ARTICLE_USER' => get_username_string('full', $this->data['user_id'], $this->data['username'], $this->data['user_colour']), 'S_EDIT' => $this->auth->acl_get('u_wiki_edit') && $s_edit_redirect, 'U_EDIT' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'edit')), 'S_VERSIONS' => $this->auth->acl_get('u_wiki_versions'), 'U_VERSIONS' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'versions')), 'S_DELETE' => $this->auth->acl_get('m_wiki_delete') && !$this->data['article_approved'], 'U_DELETE' => $this->helper->route('tas2580_wiki_index', array('article' => $article, 'action' => 'delete', 'id' => $this->data['article_id'])), 'ARTICLE_VERSION' => $id, 'ARTICLE_VIEWS_TEXT' => $this->user->lang('ARTICLE_VIEWS_TEXT', $this->data['article_views']), 'EDIT_REASON' => $id != 0 ? $this->data['article_edit_reason'] : '', 'U_TOPIC' => $this->data['article_topic_id'] != 0 ? append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, 't=' . $this->data['article_topic_id']) : '')); } return $this->helper->render('article_body.html', $this->data['article_title']); }
public function viewUserFeedbackAction() { // Trigger an error if user does not have view feedback permissions if (!$this->manager->hasViewFeedbackPermission()) { trigger_error($this->user->lang('E_CANNOT_VIEW_FEEDBACK')); } $user_id = $this->request->variable('u', 0); $tab = $this->request->variable('tab', 'all'); $start = $this->request->variable('start', 0); $is_edit_mod = $this->isEditMod(); $action = $this->request->variable('action', 'list'); if ($action == 'list') { $valid_tabs = array('all' => RatingsManager::TAB_TYPE_ALL, 'buy' => RatingsManager::TOPIC_TYPE_BUY, 'sell' => RatingsManager::TOPIC_TYPE_SELL, 'trade' => RatingsManager::TOPIC_TYPE_TRADE, 'left' => RatingsManager::TAB_TYPE_LEFT); if (!isset($valid_tabs[$tab])) { $tab = 'all'; } if (!$user_id) { trigger_error("No user provided - cannot display Trader Feedback"); } $user_page_row = $this->fetch_user_row($this->db, $user_id); if (!$user_page_row) { trigger_error("Could not find specified user!"); } $trader_stats = $this->manager->getUserFeedbackStats($user_id, true); if (!$trader_stats) { trigger_error("Feedback Statistics could not be retrieved"); } if ($tab == 'buy') { $filter = $valid_tabs['sell']; } else { if ($tab == 'sell') { $filter = $valid_tabs['buy']; } else { $filter = $valid_tabs[$tab]; } } // stores the number of total feedbacks that are filtered on a given tab - for pagination purposes // this number is updated by reference by the call to the manager $num_feedbacks = 0; $feedbacks = $this->manager->get_users_feedback($start, self::NUM_PER_PAGE, $user_id, $filter, $is_edit_mod, $num_feedbacks); if ($this->user->data['user_timezone']) { $timezone = new \DateTimeZone($this->user->data['user_timezone']); } else { $timezone = new \DateTimeZone($this->config['board_timezone']); } foreach ($feedbacks as $key => $feedback) { // fetch the appropriate user's information based on the selected tab // if the tab is 'Left for Others' we need to use the to_user_id (the recipient) if ($tab == "left") { $user_row = $this->fetch_user_row($this->db, $feedback['to_user_id']); $view_feedback_url = $this->helper->route('rfd_trader_view', array('u' => $feedback['to_user_id'])); } else { $user_row = $this->fetch_user_row($this->db, $feedback['from_user_id']); $view_feedback_url = $this->helper->route('rfd_trader_view', array('u' => $feedback['from_user_id'])); } $feedback['U_VIEW_FEEDBACK'] = $view_feedback_url; $feedback['table_username'] = $user_row['username']; $feedback['table_user_trader_rating'] = $user_row['user_trader_positive'] - $user_row['user_trader_negative']; $feedback['show_left_for_others'] = $tab == "left"; $comments = $this->manager->getLatestFeedbackComment($feedback['feedback_id']); if ($comments) { $feedback['short_comment'] = $comments['short_comment']; if ($is_edit_mod || $feedback['from_user_id'] == $this->user->data['user_id'] || $feedback['to_user_id'] == $this->user->data['user_id']) { $feedback['long_comment'] = $comments['long_comment']; } } if ($is_edit_mod || $this->canEditFeedback($feedback['date_created'], $feedback['from_user_id'])) { $edit_feedback_url = $this->helper->route('rfd_trader_edit_feedback', array('feedback_id' => $feedback['feedback_id'], 'u' => $user_id)); $feedback['U_EDIT_FEEDBACK'] = $edit_feedback_url; } if ($this->canReplyToFeedback($feedback['from_user_id'], $feedback['to_user_id'], $feedback['topic_id'])) { $feedback['U_REPLY_FEEDBACK'] = $this->helper->route('rfd_trader_feedback', array('reply_id' => $feedback['feedback_id'], 'u' => $user_id)); } $has_open_report = $this->manager->has_open_report($feedback['feedback_id']); // Show report button if the feedback is for the current user viewing the page if ($feedback['to_user_id'] == $this->user->data['user_id'] && !$has_open_report) { $feedback['U_REPORT_FEEDBACK'] = append_sid(generate_board_url() . '/trader/view-feedback/?action=report&id=' . $feedback['feedback_id']); } $feedback['topic_url'] = append_sid(generate_board_url() . "/viewtopic.php?t=" . $feedback['topic_id']); $feedback['date_created'] = new \DateTime('@' . $feedback['date_created']); $feedback['date_created']->setTimezone($timezone); $feedbacks[$key] = $feedback; } $trader_username_full = get_username_string('full', $user_page_row['user_id'], $user_page_row['username'], $user_page_row['user_colour']); $this->template->assign_vars(array('TRADER_USERNAME_FULL' => $trader_username_full, 'TRADER_USERNAME' => $user_page_row['username'], 'U_TRADER_PROFILE' => append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $user_page_row['user_id']), 'trader_stats' => $trader_stats, 'recent_feedback' => $this->manager->getRecentUserFeedbackCounts($user_id), 'U_ACTION_TAB_ALL' => $this->helper->route("rfd_trader_view", array('u' => $user_id, 'tab' => 'all')), 'U_ACTION_TAB_BUY' => $this->helper->route("rfd_trader_view", array('u' => $user_id, 'tab' => 'buy')), 'U_ACTION_TAB_SELL' => $this->helper->route("rfd_trader_view", array('u' => $user_id, 'tab' => 'sell')), 'U_ACTION_TAB_TRADE' => $this->helper->route("rfd_trader_view", array('u' => $user_id, 'tab' => 'trade')), 'U_ACTION_TAB_LEFT' => $this->helper->route("rfd_trader_view", array('u' => $user_id, 'tab' => 'left')), 'CURRENT_TAB' => $tab, 'feedbacks' => $feedbacks, 'TOTAL_FEEDBACKS' => $num_feedbacks)); $base_url = $this->helper->route('rfd_trader_view', array('u' => $user_id)); $this->pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_feedbacks, self::NUM_PER_PAGE, $start); } else { if ($action == 'report') { $this->report_feedback_action($this->request, $this->user); } else { trigger_error("Unknown Action!"); } } return $this->helper->render('view_user_feedback.html', $this->user->lang['TRADER_FEEDBACK_FOR'] . ' ' . $user_page_row['username']); }