$result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $storynum"); while ($row = $db->sql_fetchrow($result)) { $s_sid = intval($row['sid']); $catid = intval($row['catid']); $aid = filter($row['aid'], "nohtml"); $title = filter($row['title'], "nohtml"); $time = $row['time']; $hometext = filter($row['hometext']); $bodytext = filter($row['bodytext']); $comments = intval($row['comments']); $counter = intval($row['counter']); $topic = intval($row['topic']); $informant = filter($row['informant'], "nohtml"); $notes = filter($row['notes']); $acomm = intval($row['acomm']); $score = intval($row['score']); $ratings = intval($row['ratings']); if ($catid > 0) { $row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'")); $cattitle = stripslashes(check_html($row2['title'], "nohtml")); } getTopics($s_sid); formatTimestamp($time); $subject = filter($subject, "nohtml"); $introcount = strlen($hometext); $fullcount = strlen($bodytext); $totalcount = $introcount + $fullcount; $c_count = $comments; $r_options = ""; if (isset($userinfo['umode'])) { $r_options .= "&mode=".$userinfo['umode']; } if (isset($userinfo['uorder'])) { $r_options .= "&order=".$userinfo['uorder']; } if (isset($userinfo['thold'])) { $r_options .= "&thold=".$userinfo['thold']; } $story_link = ""; $morelink = "("; if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) { $morelink .= "$story_link"._READMORE." | "; } else { $morelink .= ""; } if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; } if ($articlecomm == 1 AND $acomm == 0) { if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ.""; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT.""; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS.""; } }