function getTopic($where, $page, $num) { global $DB, $table_topic; $TopicArr = array(); $Tsql = "SELECT COUNT(`tid`) FROM `" . $table_topic . "` " . $where; $TotalTopic = $DB->fetch_one($Tsql); if ($TotalTopic > 0) { $RSql = "SELECT * FROM `" . $table_topic . "` " . $where . " ORDER BY `tid` DESC LIMIT " . ($page - 1) * $num . "," . $num; $Result = $DB->query($RSql); while ($Re = $DB->fetch_array($Result)) { $TopicArr[] = array("tid" => $Re['tid'], "fid" => $Re['fid'], "author" => stripslashes($Re['author']), "authorid" => $Re['authorid'], "authorico" => $Re['authorico'], "title" => filterHTML($Re['subject']), "subject" => Truncate(filterHTML($Re['subject']), 84), "dateline" => $Re['dateline'], "lasttime" => getCountDown($Re['lasttime']), "lastauthor" => stripslashes($Re['lastauthor']), "lastauthorid" => $Re['lastauthorid'], "lastauthorico" => $Re['lastauthorico'], "views" => $Re['views'], "replies" => $Re['replies'], "stick" => $Re['stick'], "digest" => $Re['digest'], "lockout" => $Re['lockout']); } } $return['Total'] = $TotalTopic; $return['Topic'] = $TopicArr; $return['Page'] = $this->Pagination($TotalTopic, $num, $page); return $return; }
function getTopicInfo($tid) { global $DB, $table_topic; $Re = $DB->fetch_one_array("SELECT * FROM `" . $table_topic . "` WHERE `tid` = " . $tid); $TopicInfo = array("tid" => $Re['tid'], "fid" => $Re['fid'], "author" => stripslashes($Re['author']), "authorid" => $Re['authorid'], "authorico" => $Re['authorico'], "subject" => filterHTML($Re['subject']), "dateline" => $Re['dateline'], "lasttime" => getCountDown($Re['lasttime']), "lastauthor" => stripslashes($Re['lastauthor']), "lastauthorid" => $Re['lastauthorid'], "lastauthorico" => $Re['lastauthorico'], "views" => $Re['views'], "replies" => $Re['replies'], "stick" => $Re['stick'], "digest" => $Re['digest'], "lockout" => $Re['lockout']); return $TopicInfo; }