Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
763
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.02 KB | None | 0 0
  1. <?php
  2. define('IN_PHPBB', true);
  3. $phpbb_root_path =  './phpBB3/';
  4. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  5. include($phpbb_root_path . 'common.' . $phpEx);
  6. $user->session_begin();
  7. $auth->acl($user->data);
  8. $user->setup();
  9. $forum_id = request_var('forum_id', 0);
  10. $where = ($forum_id) ? " WHERE forum_id=$forum_id" : 'WHERE ' .$db->sql_in_set('forum_id', array_keys($auth->acl_getf('f_read', true)));
  11. $sql = 'SELECT forum_id,topic_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
  12.     FROM ' . TOPICS_TABLE .
  13.         $where .
  14.         ' AND topic_status <>' . ITEM_MOVED . '
  15.                 ORDER BY topic_time DESC ' .
  16.         ' LIMIT 0 , 10 ';
  17. $result = $db->sql_query($sql);
  18. $template->set_filenames(array('body' => 'news_body.html'));
  19. $template->assign_vars(array(
  20.     'LAST_POST_IMG'             => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
  21. ));
  22. while($row = $db->sql_fetchrow($result))
  23. {
  24.     $topic_id = $row['topic_id'];
  25.     $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
  26.     $template->assign_block_vars('topicrow', array(
  27.         'FIRST_POST_TIME'   => $user->format_date($row['topic_time']),
  28.         'LAST_POST_AUTHOR'  => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
  29.         'LAST_POST_TIME'    => $user->format_date($row['topic_last_post_time']),
  30.         'REPLIES'           => $row['topic_replies'],
  31.         'TOPIC_AUTHOR'      => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
  32.         'TOPIC_TITLE'       => censor_text($row['topic_title']),
  33.         'U_LAST_POST'       => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
  34.         'U_VIEW_TOPIC'      => $view_topic_url,
  35.         'VIEWS'             => $row['topic_views'],
  36.     ));
  37. }
  38. $template->display('body');
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement