From: Don S. <ri...@us...> - 2004-09-13 19:47:23
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4157/class Modified Files: Forum.php Log Message: Fixing post count logic Index: Forum.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Forum.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Forum.php 13 Sep 2004 19:43:31 -0000 1.26 --- Forum.php 13 Sep 2004 19:47:11 -0000 1.27 *************** *** 310,319 **** if(!empty($this->_id)) { /* Develop total replies and extended thread information */ ! $sql = 'SELECT COUNT(id),SUM(replies) FROM ' . $GLOBALS["core"]->tbl_prefix . 'mod_phpwsbb_threads WHERE fid=' . $this->getId() . ' ORDER BY lastpost DESC'; $t = $GLOBALS["core"]->getRow($sql); ! $this->_threads = $t['COUNT(id)']; ! $this->_posts = $t['SUM(replies)']; ! if (empty($this->_posts)) ! $this->_posts = 0; $sql = "SELECT id FROM " . $GLOBALS["core"]->tbl_prefix . "mod_phpwsbb_threads WHERE fid=" . $this->getId() . " ORDER BY lastpost DESC"; --- 310,319 ---- if(!empty($this->_id)) { /* Develop total replies and extended thread information */ ! $sql = "SELECT COUNT(id), SUM(replies) FROM " . $GLOBALS["core"]->tbl_prefix . "mod_phpwsbb_threads WHERE fid=" . $this->getId() . " ORDER BY lastpost DESC"; $t = $GLOBALS["core"]->getRow($sql); ! $this->_threads = $t["COUNT(id)"]; ! ! /* Replies doesn't include the original post in the thread, add # of threads */ ! $this->_posts = $t["SUM(replies)"] + $this->_threads; $sql = "SELECT id FROM " . $GLOBALS["core"]->tbl_prefix . "mod_phpwsbb_threads WHERE fid=" . $this->getId() . " ORDER BY lastpost DESC"; |