本文整理汇总了PHP中phpbb\controller\helper::render方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::render方法的具体用法?PHP helper::render怎么用?PHP helper::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\controller\helper
的用法示例。
在下文中一共展示了helper::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
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);
}
示例2: page
/**
* 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']);
}
示例3: downloader
/**
* @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']);
}
}
示例4: base
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');
}
示例5: handle
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'));
}
示例6: handle
/**
* 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']);
}
示例7: display
/**
* 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);
}
示例8: bbcode_wizard
/**
* 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');
}
示例9: view
/**
* 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']);
}
示例10: main
/**
* @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');
}
示例11: search
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'));
}
示例12: new_link
/**
* 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);
}
示例13: handle
/**
* 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);
}
示例14: index
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']);
}
示例15: index
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']);
}