0 OR i.topic IS NULL) ORDER BY t.topic_type DESC, p.post_time DESC LIMIT $lastn"; $result = $db->sql_query($sql); while (($row = $db->sql_fetchrow($result))) { $numcomments = $row['topic_replies']; $age = floor(($now - $row['post_time'])/60); if ($age) { $ageLbl = ($age % 60) . 'm ago'; $age = floor($age/60); } else $ageLbl = 'now'; if ($age) { $ageLbl = ($age % 24) . 'h' . $ageLbl; $age = floor($age/24); } if ($age) $ageLbl = $age . 'd' . $ageLbl; $comment = ''; if ($row['source'] && $row['url']) { $link = $row['url'] . '?comments=' . $numcomments; } else { $link = "/forum/viewtopic.php?t=" . $row['topic_id']; $comment = 'forum'; $numcomments++; } if ($row['topic_type'] == 1) $comment .= ($comment?' ':'') . 'sticky'; else if ($row['topic_type'] == 2) $comment .= ($comment?' ':'') . 'announcement'; $title = preg_replace("/<[^>]*>/", "", $row['topic_title']); /*if (strlen($title) > 30) $title = substr($title, 0, 28) . "…";*/ echo "
  • " . $title . " (" . $comment . ($comment?', ':'') . $numcomments . ", $ageLbl)
  • \n"; } } function ThreadDisplay($thread_id) { global $phpbb_root_path, $CFG, $display_userdata, $userdata, $db; $CFG['posts_limit'] = 0; $CFG['date_format'] = "m/d/Y"; $CFG['time_format'] = "h:i a"; $CFG['posts_order'] = 'p.post_time ASC'; // Might as well update topic watch data... if ($display_userdata && $display_userdata['session_logged_in']) $db->sql_query("UPDATE " . TOPICS_WATCH_TABLE . " SET notify_status=0 WHERE user_id=" . $display_userdata['user_id'] . " AND topic_id=" . $thread_id); $userdata = $display_userdata; $posts = phpbb_fetch_thread($thread_id); $is_auth = auth(AUTH_ALL, $posts[0]['forum_id'], $display_userdata); if ($is_auth['auth_read']) { for ($i = 1; $i < count($posts); $i++) { $post = $posts[$i]; echo '
    '; $pnum = $post['post_id']; echo "#$pnum "; echo ''; if (($uid = $post['user_id']) != -1) { if (strpos($_SERVER['HTTP_USER_AGENT'], '+http') === false) { echo '' . $post['username'] . ''; } $av_type = $post['user_avatar_type']; if ($av_type > 0) { if ($av_type == 1) { echo ''; } elseif ($av_type > 1) { echo ''; } } } else { if (($uname = $post['post_username'])) echo $uname . " (unregistered)"; else echo "Anonymous"; } echo " "; echo "" . $post['date'] . " " . $post['time'] . ""; if (($subj = $post['post_subject'])) echo " " . $subj . ""; if (strpos($_SERVER['HTTP_USER_AGENT'], '+http') === false) { echo '
      '; if ($is_auth['auth_reply']) echo '
    • reply
    • '; foreach (array('edit' => 'editpost', 'delete' => 'delete') as $funcname => $funccmd) { if ($is_auth['auth_mod'] || ($is_auth['auth_' . $funcname] && ($display_userdata['user_id'] === $post['user_id']))) echo '
    • ' . $funcname . '
    • '; } if ($is_auth['auth_mod']) echo '
    • IP
    • '; echo '
    '; } echo "
    "; echo '
    '; echo $posts[$i]['post_text']; echo '
    '; } } echo "
    "; if (strpos($_SERVER['HTTP_USER_AGENT'], '+http') === false) { if ($display_userdata && $display_userdata['session_logged_in']) { echo "Log out (" . $display_userdata['username'] . ")\n"; } else { echo "Log in/Register\n"; } if ($is_auth['auth_reply']) echo "Post a comment"; if ($is_auth['auth_read']) echo " (forum view)"; echo "
    Comments powered by phpBB (how to do this)
    "; } } // See if they're in the friends group $query = $db->sql_query("SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE group_id=364 AND user_pending=0 AND user_id=" . $display_userdata['user_id']); $user_friend = $db->sql_fetchrow($query); if (isset($_GET['style'])) $style = '.' . $_GET['style']; ?>