Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // ignore
- define('IN_PHPBB', true);
- $phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : './';
- $phpEx = substr(strrchr(__FILE__, '.'), 1);
- include $phpbb_root_path . 'common.' . $phpEx;
- // session
- $user->session_begin();
- $auth->acl($user->data);
- $user->setup();
- // initial var setup
- $forum_id = request_var('f', 0);
- $sql_where = $db->sql_in_set('forum_id', array_keys($auth->acl_getf('f_read', true)));
- if ( $forum_id )
- {
- $sql_where = 'forum_id = ' . (int) $forum_id;
- }
- $sql = 'SELECT topic_id, forum_id, icon_id, topic_time, topic_title, topic_views, topic_replies, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time
- FROM ' . TOPICS_TABLE . '
- WHERE ' . $sql_where . '
- AND topic_status <> ' . ITEM_MOVED . '
- ORDER BY topic_time DESC';
- $result = $db->sql_query_limit($sql, 10);
- // grab icons
- $icons = $cache->obtain_icons();
- while ( $row = $db->sql_fetchrow($result) )
- {
- $topic_id = (int) $row['topic_id'];
- $topic_forum_id = $row['forum_id'] ? (int) $row['forum_id'] : $forum_id;
- // generate all the uris ...
- $view_topic_url_params = 'f=' . $topic_forum_id . '&t=' . $topic_id;
- $template->assign_block_vars('topicrow', array(
- 'TOPIC_AUTHOR' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
- 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
- 'LAST_POST_AUTHOR' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'REPLIES' => (int) $row['topic_replies'],
- 'VIEWS' => (int) $row['topic_views'],
- 'TOPIC_TITLE' => censor_text($row['topic_title']),
- 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params),
- ));
- if ( !empty($icons[$row['icon_id']]) )
- {
- $template->alter_block_array('topicrow', array(
- 'TOPIC_ICON_IMG' => $icons[$row['icon_id']]['img'],
- 'TOPIC_ICON_IMG_WIDTH' => $icons[$row['icon_id']]['width'],
- 'TOPIC_ICON_IMG_HEIGHT' => $icons[$row['icon_id']]['height'],
- ), true, 'change');
- }
- }
- $db->sql_freeresult($result);
- $template->assign_vars(array(
- 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
- 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
- ));
- $template->set_filenames(array('body' => 'news_body.html'));
- $template->display('body');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement