SHOW:
|
|
- or go back to the newest paste.
1 | - | //PATH TO FORUM |
1 | + | // Path to forum and necessary initial vars |
2 | define('IN_PHPBB', true); | |
3 | define('NO_KILL_ON_DB_ERROR',true); | |
4 | $phpEx = "php"; | |
5 | $starttime = 0; | |
6 | $phpbb_root_path = "forum/"; | |
7 | - | |
7 | + | |
8 | - | // PHPBB vars |
8 | + | // Include common functions. |
9 | include_once($phpbb_root_path . 'common.' . $phpEx); | |
10 | // Start session management. | |
11 | $user->session_begin(); | |
12 | $user->setup('viewforum'); | |
13 | - | // Grab 10 latest posts |
13 | + | |
14 | - | $db_selected = @mysql_select_db($dbname); |
14 | + | // Require config for DB credentials. |
15 | - | $sql = 'SELECT topic_id,topic_title,topic_time,topic_first_poster_name,topic_replies,topic_first_post_id FROM `' . $table_prefix . 'topics` where `forum_id` = 2 ORDER BY `topic_id` DESC LIMIT 10'; |
15 | + | |
16 | - | $result = @mysql_query("$sql"); |
16 | + | // Connect to database. |
17 | $dbc = @mysql_connect($dbhost,$dbuser,$dbpasswd); | |
18 | - | // Format post in $allnews |
18 | + | |
19 | - | |
19 | + | // Error if connection could not be made. |
20 | - | while ($row = @mysql_fetch_array($result)) { |
20 | + | |
21 | else { | |
22 | - | $time = date("M j/y",$row[2]); |
22 | + | // Grab 10 latest posts |
23 | - | $post_info = mysql_fetch_array(mysql_query("SELECT * FROM `{$table_prefix}posts` where `post_id` = {$row[5]}")); |
23 | + | $db_selected = @mysql_select_db($dbname); |
24 | - | if (! include_once($phpbb_root_path . 'common.php')) return; |
24 | + | $sql = 'SELECT topic_id,topic_title,topic_time,topic_first_poster_name,topic_replies,topic_first_post_id FROM `' . $table_prefix . 'topics` where `forum_id` = 2 ORDER BY `topic_id` DESC LIMIT 10'; |
25 | $result = @mysql_query("$sql"); | |
26 | - | $user->optionset('viewsmilies', TRUE); |
26 | + | |
27 | - | $user->optionset('bbcode', TRUE); |
27 | + | // Format posts in $allnews array |
28 | - | $user->theme['template_path'] = "prosilver"; |
28 | + | while ($row = @mysql_fetch_array($result)) { |
29 | $time = date("M j/y",$row[2]); | |
30 | - | $post = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], 7); |
30 | + | $post_info = mysql_fetch_array(mysql_query("SELECT * FROM `{$table_prefix}posts` where `post_id` = {$row[5]}")); |
31 | - | $comments = "<a href=\"http://rly.cc/forum/viewtopic.php?t={$row[0]}\">({$row[4]})</a> "; |
31 | + | // The "7" flags on emoticons, BBCode, and magicURLs |
32 | - | $allnews[$row[2]] = " |
32 | + | $post = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], 7); |
33 | $comments = "<a href=\"http://rly.cc/forum/viewtopic.php?t={$row[0]}\">({$row[4]})</a> "; | |
34 | - | |
34 | + | $allnews[$row[2]] = " |
35 | - | } |
35 | + | |
36 | } | |
37 | - | // Close that DB! |
37 | + | |
38 | - | @mysql_close($dbc); |
38 | + | // Close that DB! |
39 | @mysql_close($dbc); | |
40 | - | // Sort the array numerically. |
40 | + | |
41 | - | krsort($allnews, SORT_NUMERIC); |
41 | + | // Output our news! |
42 | - | $sent = 0; |
42 | + | foreach ($allnews as $i => $data) echo $data; |