diff --git a/Sources/Recent.php b/Sources/Recent.php index a4e3fd2..b95b9ec 100644 --- a/Sources/Recent.php +++ b/Sources/Recent.php @@ -69,7 +69,7 @@ function getLastPost() function getLastPosts($showlatestcount) { - global $scripturl, $txt, $db_prefix, $user_info, $modSettings; + global $scripturl, $txt, $db_prefix, $user_info, $modSettings, $settings; // Find all the posts. Newer ones will have higher IDs. (assuming the last 4 * number are accessable...) $request = db_query(" @@ -89,6 +89,12 @@ function getLastPosts($showlatestcount) $posts = array(); while ($row = mysql_fetch_assoc($request)) { + if (empty($row)) break; + + // Some sanity check for empty values + //if (! isset ($row['icon'])) $row['icon'] = 'xx'; + //if (! isset ($row['numReplies'])) $row['numReplies'] = 0; + // Censor the subject and post for the preview ;). censorText($row['subject']); censorText($row['body']); @@ -106,9 +112,9 @@ function getLastPosts($showlatestcount) 'link' => '' . $row['bName'] . '' ), 'topic' => $row['ID_TOPIC'], - 'icon' => file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? $settings['images_url'] . '/post/' . $row['icon'] . '.gif' : $settings['default_images_url'] . '/post/' . $row['icon'] . '.gif', - 'views' => $row['numViews'], - 'replies' => $row['numReplies'], + #'icon' => file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? $settings['images_url'] . '/post/' . $row['icon'] . '.gif' : $settings['default_images_url'] . '/post/' . $row['icon'] . '.gif', + #'views' => $row['numViews'], + #'replies' => $row['numReplies'], 'poster' => array( 'id' => $row['ID_MEMBER'], 'name' => $row['posterName'],