Advertisement
skouat

derniers-sujets.php

Nov 14th, 2012
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.61 KB | None | 0 0
  1. <?php
  2. define('IN_PHPBB', true);
  3. $phpbb_root_path =  './phpBB3-3.0.11/';
  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. ?>
  19. <html>
  20. <head>
  21.    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  22.    <title>Les dernières news</title>
  23.    <style type="text/css">
  24.       th{
  25.          background-color: #0066FF;
  26.          color: #FFFF99;
  27.       }
  28.    </style>
  29. </head>
  30. <body>
  31. <table width="100%">
  32.    <tr>
  33.    <th >Sujets</th>
  34. <th>Réponses</th>
  35. <th>Vus</th>
  36. <th>Dernier message</th>
  37. </tr>
  38. <?php
  39. $i=0;
  40. while($row = $db->sql_fetchrow($result))
  41. {
  42.    $topic_id = $row['topic_id'];
  43.    $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
  44.    $row_colour = ($i % 2) ? '#FFFFCC' : '#99FFFF';
  45.    echo '<tr bgcolor="' . $row_colour .'">';
  46.    echo '<td>';
  47.    echo '<a href="' . $view_topic_url . '">' . censor_text($row['topic_title']) . '</a><br />';
  48.    echo $user->lang['POST_BY_AUTHOR'] . '&nbsp;' . get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']);
  49.    echo '&nbsp;' . $user->lang['POSTED_ON_DATE'] . '&nbsp;' . $user->format_date($row['topic_time']) . '</td>';
  50.    echo '<td>' . $row['topic_replies'] . '</td>';
  51.    echo '<td>' . $row['topic_views'] . '</td>';
  52.    echo '<td>' . $user->lang['POST_BY_AUTHOR'] . '&nbsp;' . get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
  53.    echo '<a href="' . $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '">' . '&nbsp;' . $user->img('icon_topic_latest', 'VIEW_LATEST_POST') . '</a><br />';
  54.    echo $user->lang['POSTED_ON_DATE'] . $user->format_date($row['topic_last_post_time']) . '</td>';
  55.    echo '</tr>';
  56.    $i++;
  57. }
  58. ?>
  59. </table>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement