/ Published in: PHP

URL: http://mark.haktstudios.com/
A simple PHPBB3 post grabber script that I wrote for a friend a while back.
Expand |
Embed | Plain Text
<?php /* Stand alone test */ $phpbb_root_path = './Forum/'; include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); /* end test section */ function post_count($tid) { $sql = 'SELECT * FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $tid; return $count; } $topic_limit = request_var('topic_limit', 1); $forums = array_unique(array_keys($auth->acl_getf('f_read', true))); //ignored in sql statement to include all topics despite permissions // Select the last topics ignoring permissions $sql = 'SELECT * FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u WHERE post_approved = 1 AND u.user_id = p.poster_id AND p.forum_id = 1 AND p.post_subject NOT LIKE "Re:%" ORDER BY post_time DESC LIMIT 0,' . $topic_limit; $result = $db->sql_query($sql); // Process Data while ($row = $db->sql_fetchrow($result)) { // variables $fid = $row['forum_id']; $tid = $row['topic_id']; $pid = $row['post_id']; $subject = $row['post_subject']; $text = $row['post_text']; $bitfield = $row['bbcode_bitfield']; $bbuid = $row['bbcode_uid']; $uid = $row['poster_id']; $url = generate_board_url() . "/viewtopic.{$phpEx}?f={$fid}&t={$tid}&p={$pid}#p{$pid}"; //added topic link to url $profile = generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$uid}"; // added profile link to url $options = $row['bbcode_options'] = (($row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) + (($row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + (($row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0); $text = generate_text_for_display($text, $uid, $bitfield, $options); // display echo ' <a target="_blank" href="' . $url . '">' . $subject . '</a>, <a target="_blank" href="' . $profile . '">' . $username . '</a>, ' . $date .' <br /> <br /> '; echo $text; }
You need to login to post a comment.