| 1 | <?php |
|---|
| 2 | // $Id: viewforum.php,v 1.7 2006/05/01 02:37:28 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | // Author: Kazumi Ono (AKA onokazu) // |
|---|
| 28 | // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // |
|---|
| 29 | // Project: The XOOPS Project // |
|---|
| 30 | // ------------------------------------------------------------------------- // |
|---|
| 31 | |
|---|
| 32 | include "header.php"; |
|---|
| 33 | |
|---|
| 34 | $forum = intval($_GET['forum']); |
|---|
| 35 | if ( $forum < 1 ) { |
|---|
| 36 | redirect_header("index.php", 2, _MD_ERRORFORUM); |
|---|
| 37 | exit(); |
|---|
| 38 | } |
|---|
| 39 | $sql = 'SELECT forum_type, forum_name, forum_access, allow_html, allow_sig, posts_per_page, hot_threshold, topics_per_page FROM '.$xoopsDB->prefix('bb_forums').' WHERE forum_id = '.$forum; |
|---|
| 40 | if ( !$result = $xoopsDB->query($sql) ) { |
|---|
| 41 | redirect_header("index.php", 2, _MD_ERRORCONNECT); |
|---|
| 42 | exit(); |
|---|
| 43 | } |
|---|
| 44 | if ( !$forumdata = $xoopsDB->fetchArray($result) ) { |
|---|
| 45 | redirect_header("index.php", 2, _MD_ERROREXIST); |
|---|
| 46 | exit(); |
|---|
| 47 | } |
|---|
| 48 | // this page uses smarty template |
|---|
| 49 | // this must be set before including main header.php |
|---|
| 50 | $xoopsOption['template_main'] = 'newbb_viewresponse.html'; |
|---|
| 51 | include XOOPS_ROOT_PATH."/header.php"; |
|---|
| 52 | $can_post = 0; |
|---|
| 53 | $show_reg = 0; |
|---|
| 54 | if ( $forumdata['forum_type'] == 1 ) { |
|---|
| 55 | // this is a private forum. |
|---|
| 56 | $xoopsTpl->assign('is_private_forum', true); |
|---|
| 57 | $accesserror = 0; |
|---|
| 58 | if ( $xoopsUser ) { |
|---|
| 59 | if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|---|
| 60 | if ( !check_priv_forum_auth($xoopsUser->getVar("uid"), $forum, false) ) { |
|---|
| 61 | $accesserror = 1; |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | } else { |
|---|
| 65 | $accesserror = 1; |
|---|
| 66 | } |
|---|
| 67 | if ( $accesserror == 1 ) { |
|---|
| 68 | redirect_header("index.php",2,_MD_NORIGHTTOACCESS); |
|---|
| 69 | exit(); |
|---|
| 70 | } |
|---|
| 71 | $can_post = 1; |
|---|
| 72 | $show_reg = 1; |
|---|
| 73 | } else { |
|---|
| 74 | // this is not a priv forum |
|---|
| 75 | $xoopsTpl->assign('is_private_forum', false); |
|---|
| 76 | if ( $forumdata['forum_access'] == 1 ) { |
|---|
| 77 | // this is a reg user only forum |
|---|
| 78 | if ( $xoopsUser ) { |
|---|
| 79 | $can_post = 1; |
|---|
| 80 | } else { |
|---|
| 81 | $show_reg = 1; |
|---|
| 82 | } |
|---|
| 83 | } elseif ( $forumdata['forum_access'] == 2 ) { |
|---|
| 84 | // this is an open forum |
|---|
| 85 | $can_post = 1; |
|---|
| 86 | } else { |
|---|
| 87 | // this is an admin/moderator only forum |
|---|
| 88 | if ( $xoopsUser ) { |
|---|
| 89 | if ( $xoopsUserIsAdmin || is_moderator($forum, $xoopsUser->uid()) ) { |
|---|
| 90 | $can_post = 1; |
|---|
| 91 | } |
|---|
| 92 | } |
|---|
| 93 | } |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | $xoopsTpl->assign("forum_id", $forum); |
|---|
| 97 | |
|---|
| 98 | if ( $can_post == 1 ) { |
|---|
| 99 | $xoopsTpl->assign('viewer_can_post', true); |
|---|
| 100 | $xoopsTpl->assign('forum_post_or_register', "newtopic.php?forum=".$forum); |
|---|
| 101 | } else { |
|---|
| 102 | $xoopsTpl->assign('viewer_can_post', false); |
|---|
| 103 | if ( $show_reg == 1 ) { |
|---|
| 104 | $xoopsTpl->assign('forum_post_or_register', XOOPS_URL.'/user.php?xoops_redirect='.htmlspecialchars($xoopsRequestUri)); |
|---|
| 105 | } else { |
|---|
| 106 | $xoopsTpl->assign('forum_post_or_register', ""); |
|---|
| 107 | } |
|---|
| 108 | } |
|---|
| 109 | $xoopsTpl->assign('forum_index_title', sprintf(_MD_FORUMINDEX,$xoopsConfig['sitename'])); |
|---|
| 110 | $xoopsTpl->assign('forum_image_folder', $bbImage['folder_topic']); |
|---|
| 111 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 112 | $xoopsTpl->assign('forum_name', $myts->makeTboxData4Show($forumdata['forum_name'])); |
|---|
| 113 | $xoopsTpl->assign('lang_moderatedby', _MD_MODERATEDBY); |
|---|
| 114 | |
|---|
| 115 | $forum_moderators = ""; |
|---|
| 116 | $count = 0; |
|---|
| 117 | $moderators = get_moderators($forum); |
|---|
| 118 | foreach ( $moderators as $mods ) { |
|---|
| 119 | foreach ( $mods as $mod_id => $mod_name ) { |
|---|
| 120 | if ( $count > 0 ) { |
|---|
| 121 | $forum_moderators .= ", "; |
|---|
| 122 | } |
|---|
| 123 | $forum_moderators .= '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$mod_id.'">'.$myts->makeTboxData4Show($mod_name).'</a>'; |
|---|
| 124 | $count = 1; |
|---|
| 125 | } |
|---|
| 126 | } |
|---|
| 127 | $xoopsTpl->assign('forum_moderators', $forum_moderators); |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | $sel_sort_array = array("t.topic_response"=>_MD_RESPONSE, "t.topic_title"=>_MD_TOPICTITLE, "t.topic_replies"=>_MD_NUMBERREPLIES, "u.uname"=>_MD_TOPICPOSTER, "t.topic_views"=>_MD_VIEWS, "p.post_time"=>_MD_LASTPOSTTIME); |
|---|
| 131 | if ( !isset($_GET['sortname']) || !in_array($_GET['sortname'], array_keys($sel_sort_array)) ) { |
|---|
| 132 | $sortname = "p.post_time"; |
|---|
| 133 | } else { |
|---|
| 134 | $sortname = $_GET['sortname']; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | $xoopsTpl->assign('lang_sortby', _MD_SORTEDBY); |
|---|
| 138 | |
|---|
| 139 | $forum_selection_sort = '<select name="sortname">'; |
|---|
| 140 | foreach ( $sel_sort_array as $sort_k => $sort_v ) { |
|---|
| 141 | $forum_selection_sort .= '<option value="'.$sort_k.'"'.(($sortname == $sort_k) ? ' selected="selected"' : '').'>'.$sort_v.'</option>'; |
|---|
| 142 | } |
|---|
| 143 | $forum_selection_sort .= '</select>'; |
|---|
| 144 | |
|---|
| 145 | // assign to template |
|---|
| 146 | $xoopsTpl->assign('forum_selection_sort', $forum_selection_sort); |
|---|
| 147 | |
|---|
| 148 | $sortorder = (!isset($_GET['sortorder']) || $_GET['sortorder'] != "ASC") ? "DESC" : "ASC"; |
|---|
| 149 | $forum_selection_order = '<select name="sortorder">'; |
|---|
| 150 | $forum_selection_order .= '<option value="ASC"'.(($sortorder == "ASC") ? ' selected="selected"' : '').'>'._MD_ASCENDING.'</option>'; |
|---|
| 151 | $forum_selection_order .= '<option value="DESC"'.(($sortorder == "DESC") ? ' selected="selected"' : '').'>'._MD_DESCENDING.'</option>'; |
|---|
| 152 | $forum_selection_order .= '</select>'; |
|---|
| 153 | |
|---|
| 154 | // assign to template |
|---|
| 155 | $xoopsTpl->assign('forum_selection_order', $forum_selection_order); |
|---|
| 156 | |
|---|
| 157 | $sortsince = !empty($_GET['sortsince']) ? intval($_GET['sortsince']) : 100; |
|---|
| 158 | $sel_since_array = array(1, 2, 5, 10, 20, 30, 40, 60, 75, 100); |
|---|
| 159 | $forum_selection_since = '<select name="sortsince">'; |
|---|
| 160 | foreach ($sel_since_array as $sort_since_v) { |
|---|
| 161 | $forum_selection_since .= '<option value="'.$sort_since_v.'"'.(($sortsince == $sort_since_v) ? ' selected="selected"' : '').'>'.sprintf(_MD_FROMLASTDAYS,$sort_since_v).'</option>'; |
|---|
| 162 | } |
|---|
| 163 | $forum_selection_since .= '<option value="365"'.(($sortsince == 365) ? ' selected="selected"' : '').'>'.sprintf(_MD_THELASTYEAR,365).'</option>'; |
|---|
| 164 | $forum_selection_since .= '<option value="1000"'.(($sortsince == 1000) ? ' selected="selected"' : '').'>'.sprintf(_MD_BEGINNING,1000).'</option>'; |
|---|
| 165 | $forum_selection_since .= '</select>'; |
|---|
| 166 | |
|---|
| 167 | // assign to template |
|---|
| 168 | $xoopsTpl->assign('forum_selection_since', $forum_selection_since); |
|---|
| 169 | $xoopsTpl->assign('lang_go', _MD_GO); |
|---|
| 170 | |
|---|
| 171 | $xoopsTpl->assign('h_topic_link', "viewforum.php?forum=$forum&sortname=t.topic_title&sortsince=$sortsince&sortorder=". (($sortname == "t.topic_title" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 172 | $xoopsTpl->assign('lang_topic', _MD_TOPIC); |
|---|
| 173 | |
|---|
| 174 | // Âбþ¾õ¶· |
|---|
| 175 | $xoopsTpl->assign('h_reply_response', "viewforum.php?forum=$forum&sortname=t.topic_response&sortsince=$sortsince&sortorder=". (($sortname == "t.topic_response" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 176 | $xoopsTpl->assign('lang_response', _MD_RESPONSE); |
|---|
| 177 | |
|---|
| 178 | $xoopsTpl->assign('h_reply_link', "viewforum.php?forum=$forum&sortname=t.topic_replies&sortsince=$sortsince&sortorder=". (($sortname == "t.topic_replies" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 179 | $xoopsTpl->assign('lang_replies', _MD_REPLIES); |
|---|
| 180 | |
|---|
| 181 | $xoopsTpl->assign('h_poster_link', "viewforum.php?forum=$forum&sortname=u.uname&sortsince=$sortsince&sortorder=". (($sortname == "u.uname" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 182 | $xoopsTpl->assign('lang_poster', _MD_POSTER); |
|---|
| 183 | |
|---|
| 184 | $xoopsTpl->assign('h_views_link', "viewforum.php?forum=$forum&sortname=t.topic_views&sortsince=$sortsince&sortorder=". (($sortname == "t.topic_views" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 185 | $xoopsTpl->assign('lang_views', _MD_VIEWS); |
|---|
| 186 | |
|---|
| 187 | $xoopsTpl->assign('h_date_link', "viewforum.php?forum=$forum&sortname=p.post_time&sortsince=$sortsince&sortorder=". (($sortname == "p.post_time" && $sortorder == "DESC") ? "ASC" : "DESC")); |
|---|
| 188 | $xoopsTpl->assign('lang_date', _MD_DATE); |
|---|
| 189 | |
|---|
| 190 | $startdate = time() - (86400* $sortsince); |
|---|
| 191 | $start = !empty($_GET['start']) ? intval($_GET['start']) : 0; |
|---|
| 192 | |
|---|
| 193 | $sql = 'SELECT t.*, p.post_id, p.forum_id, u.uname, u2.uname as last_poster, p.post_time as last_post_time, p.icon FROM '.$xoopsDB->prefix("bb_topics").' t LEFT JOIN '.$xoopsDB->prefix('users').' u ON u.uid = t.topic_poster LEFT JOIN '.$xoopsDB->prefix('bb_posts').' p ON p.post_id = t.topic_last_post_id LEFT JOIN '.$xoopsDB->prefix('users').' u2 ON u2.uid = p.uid WHERE t.forum_id = '.$forum.' AND (p.post_time > '.$startdate.' OR t.topic_sticky=1) ORDER BY topic_sticky DESC, '.$sortname.' '.$sortorder; |
|---|
| 194 | if ( !$result = $xoopsDB->query($sql,$forumdata['topics_per_page'],$start) ) { |
|---|
| 195 | redirect_header('index.php',2,_MD_ERROROCCURED); |
|---|
| 196 | exit(); |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | // Read topic 'lastread' times from cookie, if exists |
|---|
| 200 | $topic_lastread = newbb_get_topics_viewed(); |
|---|
| 201 | while ( $myrow = $xoopsDB->fetchArray($result) ) { |
|---|
| 202 | |
|---|
| 203 | $sql_user = "SELECT uname FROM " .$xoopsDB->prefix('users'). " WHERE uid = " . $myrow['topic_response_uid']; |
|---|
| 204 | $result_user = $xoopsDB->query($sql_user); |
|---|
| 205 | $myrow_user = $xoopsDB->fetchArray($result_user); |
|---|
| 206 | |
|---|
| 207 | $sql_tmp = "SELECT p.post_id FROM ".$xoopsDB->prefix('bb_posts')." p WHERE p.pid = 0 AND p.topic_id = ".$myrow['topic_id']; |
|---|
| 208 | $result_tmp = $xoopsDB->query($sql_tmp); |
|---|
| 209 | $myrow_tmp = $xoopsDB->fetchArray($result_tmp); |
|---|
| 210 | $myrow['post_id'] = $myrow_tmp['post_id']; |
|---|
| 211 | |
|---|
| 212 | if ( empty($myrow['last_poster']) ) { |
|---|
| 213 | $myrow['last_poster'] = $xoopsConfig['anonymous']; |
|---|
| 214 | } |
|---|
| 215 | if ( $myrow['topic_sticky'] == 1 ) { |
|---|
| 216 | $image = $bbImage['folder_sticky']; |
|---|
| 217 | } elseif ( $myrow['topic_status'] == 1 ) { |
|---|
| 218 | $image = $bbImage['locked_topic']; |
|---|
| 219 | } else { |
|---|
| 220 | if ( $myrow['topic_replies'] >= $forumdata['hot_threshold'] ) { |
|---|
| 221 | if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) { |
|---|
| 222 | $image = $bbImage['hot_newposts_topic']; |
|---|
| 223 | } else { |
|---|
| 224 | $image = $bbImage['hot_folder_topic']; |
|---|
| 225 | } |
|---|
| 226 | } else { |
|---|
| 227 | if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) { |
|---|
| 228 | $image = $bbImage['newposts_topic']; |
|---|
| 229 | } else { |
|---|
| 230 | $image = $bbImage['folder_topic']; |
|---|
| 231 | } |
|---|
| 232 | } |
|---|
| 233 | } |
|---|
| 234 | $pagination = ''; |
|---|
| 235 | $addlink = ''; |
|---|
| 236 | $topiclink = 'viewtopic.php?topic_id='.$myrow['topic_id'].'&forum='.$forum; |
|---|
| 237 | $totalpages = ceil(($myrow['topic_replies'] + 1) / $forumdata['posts_per_page']); |
|---|
| 238 | if ( $totalpages > 1 ) { |
|---|
| 239 | $pagination .= ' <img src="'.XOOPS_URL.'/images/icons/posticon.gif" /> '; |
|---|
| 240 | for ( $i = 1; $i <= $totalpages; $i++ ) { |
|---|
| 241 | |
|---|
| 242 | if ( $i > 3 && $i < $totalpages ) { |
|---|
| 243 | $pagination .= "..."; |
|---|
| 244 | } else { |
|---|
| 245 | $addlink = '&start='.(($i - 1) * $forumdata['posts_per_page']); |
|---|
| 246 | $pagination .= '[<a href="'.$topiclink.$addlink.'">'.$i.'</a>]'; |
|---|
| 247 | } |
|---|
| 248 | } |
|---|
| 249 | } |
|---|
| 250 | if ( $myrow['icon'] ) { |
|---|
| 251 | $topic_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($myrow['icon']).'" alt="" />'; |
|---|
| 252 | } else { |
|---|
| 253 | $topic_icon = '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />'; |
|---|
| 254 | } |
|---|
| 255 | if ( $myrow['topic_poster'] != 0 && $myrow['uname'] ) { |
|---|
| 256 | $topic_poster = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$myrow['topic_poster'].'">'.$myrow['uname'].'</a>'; |
|---|
| 257 | } else { |
|---|
| 258 | $topic_poster = $xoopsConfig['anonymous']; |
|---|
| 259 | } |
|---|
| 260 | include_once 'class/class.util.php'; |
|---|
| 261 | $fix = getFixName($myrow['forum_id']); |
|---|
| 262 | |
|---|
| 263 | $xoopsTpl->append('topics', array('topic_response_user'=>$myrow_user['uname'], 'topic_id'=>$myrow['topic_id'], 'topic_response'=>$myrow['topic_response'], 'topic_response_uname'=>$myrow['topic_response_uname'], 'fix'=>$fix, 'topic_number'=>$myrow['post_id'], 'topic_icon'=>$topic_icon, 'topic_folder'=>$image, 'topic_title'=>$myts->makeTboxData4Show($myrow['topic_title']), 'topic_link'=>$topiclink, 'topic_page_jump'=>$pagination, 'topic_replies'=>$myrow['topic_replies'], 'topic_poster'=>$topic_poster, 'topic_views'=>$myrow['topic_views'], 'topic_last_posttime'=>formatTimestamp($myrow['last_post_time']), 'topic_last_poster'=>$myts->makeTboxData4Show($myrow['last_poster']))); |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | // Âбþ¾õ¶· |
|---|
| 267 | $xoopsTpl->assign('arrResponse', $arrResponse); |
|---|
| 268 | |
|---|
| 269 | /* |
|---|
| 270 | // ¥æ¡¼¥¶¡¼¾ðÊó¼èÆÀ |
|---|
| 271 | $member_handler =& xoops_gethandler('member'); |
|---|
| 272 | $xoopsUserIsAdmin = false; |
|---|
| 273 | $user_id = ""; |
|---|
| 274 | $user_name = ""; |
|---|
| 275 | if (!empty($_SESSION['xoopsUserId'])) { |
|---|
| 276 | $xoopsUser =& $member_handler->getUser($_SESSION['xoopsUserId']); |
|---|
| 277 | if (is_object($xoopsUser)) { |
|---|
| 278 | $xoopsUserIsAdmin = $xoopsUser->isAdmin(); |
|---|
| 279 | } |
|---|
| 280 | $user_id = $_SESSION['xoopsUserId']; |
|---|
| 281 | $user_name = $xoopsUser->uname(); |
|---|
| 282 | } |
|---|
| 283 | |
|---|
| 284 | //sfprintr($xoopsUser->uname()); |
|---|
| 285 | |
|---|
| 286 | // Âбþ¾õ¶·¹¹¿·¤¹¤ë |
|---|
| 287 | //if($_GET['mode'] == 'response' and $xoopsUserIsAdmin and is_numeric($_GET['topic_id'])){ |
|---|
| 288 | if($_GET['mode'] == 'response' and is_numeric($_GET['topic_id'])){ |
|---|
| 289 | $sql = 'UPDATE '.$xoopsDB->prefix("bb_topics").' SET topic_response = '.$_GET["response_".$_GET['topic_id']]; |
|---|
| 290 | if($user_id != ""){ |
|---|
| 291 | $sql .= ', topic_response_uid = '.$user_id; |
|---|
| 292 | }else{ |
|---|
| 293 | $sql .= ', topic_response_uid = NULL'; |
|---|
| 294 | } |
|---|
| 295 | $sql .= ' WHERE topic_id = '.$_GET['topic_id']; |
|---|
| 296 | |
|---|
| 297 | if ( !$xoopsDB->queryF($sql)) { |
|---|
| 298 | redirect_header('index.php',2,_MD_ERROROCCURED); |
|---|
| 299 | exit(); |
|---|
| 300 | } |
|---|
| 301 | // ¥ê¥í¡¼¥É |
|---|
| 302 | header("Location: " . $_SERVER['PHP_SELF'] . "?forum=" . $_GET['forum'] . "&sortname=p.post_time&sortorder=DESC&sortsince=" . $_GET['sortsince'] . "&start=" . $_GET['start']); |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | $xoopsTpl->assign('xoopsUserIsAdmin', $xoopsUserIsAdmin); |
|---|
| 306 | */ |
|---|
| 307 | |
|---|
| 308 | $xoopsTpl->assign('lang_by', _MD_BY); |
|---|
| 309 | |
|---|
| 310 | $xoopsTpl->assign('img_newposts', $bbImage['newposts_topic']); |
|---|
| 311 | $xoopsTpl->assign('img_hotnewposts', $bbImage['hot_newposts_topic']); |
|---|
| 312 | $xoopsTpl->assign('img_folder', $bbImage['folder_topic']); |
|---|
| 313 | $xoopsTpl->assign('img_hotfolder', $bbImage['hot_folder_topic']); |
|---|
| 314 | $xoopsTpl->assign('img_locked', $bbImage['locked_topic']); |
|---|
| 315 | $xoopsTpl->assign('img_sticky', $bbImage['folder_sticky']); |
|---|
| 316 | $xoopsTpl->assign('lang_newposts', _MD_NEWPOSTS); |
|---|
| 317 | $xoopsTpl->assign('lang_hotnewposts', _MD_MORETHAN); |
|---|
| 318 | $xoopsTpl->assign('lang_hotnonewposts', _MD_MORETHAN2); |
|---|
| 319 | $xoopsTpl->assign('lang_nonewposts', _MD_NONEWPOSTS); |
|---|
| 320 | $xoopsTpl->assign('lang_legend', _MD_LEGEND); |
|---|
| 321 | $xoopsTpl->assign('lang_topiclocked', _MD_TOPICLOCKED); |
|---|
| 322 | $xoopsTpl->assign('lang_topicsticky', _MD_TOPICSTICKY); |
|---|
| 323 | $xoopsTpl->assign("lang_search", _MD_SEARCH); |
|---|
| 324 | $xoopsTpl->assign("lang_advsearch", _MD_ADVSEARCH); |
|---|
| 325 | |
|---|
| 326 | $sql = 'SELECT COUNT(*) FROM '.$xoopsDB->prefix('bb_topics').' WHERE forum_id = '.$forum.' AND (topic_time > '.$startdate.' OR topic_sticky = 1)'; |
|---|
| 327 | if ( !$r = $xoopsDB->query($sql) ) { |
|---|
| 328 | //redirect_header('index.php',2,_MD_ERROROCCURED); |
|---|
| 329 | //exit(); |
|---|
| 330 | } |
|---|
| 331 | list($all_topics) = $xoopsDB->fetchRow($r); |
|---|
| 332 | if ( $all_topics > $forumdata['topics_per_page'] ) { |
|---|
| 333 | include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|---|
| 334 | $nav = new XoopsPageNav($all_topics, $forumdata['topics_per_page'], $start, "start", 'forum='.$forum.'&sortname='.$sortname.'&sortorder='.$sortorder.'&sortsince='.$sortsince); |
|---|
| 335 | $xoopsTpl->assign('forum_pagenav', $nav->renderNav(4)); |
|---|
| 336 | } else { |
|---|
| 337 | $xoopsTpl->assign('forum_pagenav', ''); |
|---|
| 338 | } |
|---|
| 339 | |
|---|
| 340 | // ¥«¥Æ¥´¥ê̾¼èÆÀ |
|---|
| 341 | $sql = "SELECT c.cat_id, c.cat_title FROM ".$xoopsDB->prefix("bb_categories")." c, ".$xoopsDB->prefix("bb_forums")." f WHERE c.cat_id = f.cat_id AND forum_id = $forum"; |
|---|
| 342 | |
|---|
| 343 | if ( !$result = $xoopsDB->query($sql) ) { |
|---|
| 344 | //redirect_header('index.php',2,_MD_ERROROCCURED); |
|---|
| 345 | //exit(); |
|---|
| 346 | } |
|---|
| 347 | $arrCat = $xoopsDB->fetchArray($result); |
|---|
| 348 | $xoopsTpl->assign('arrCat', $arrCat); |
|---|
| 349 | |
|---|
| 350 | $xoopsTpl->assign('forum_jumpbox', make_jumpbox($forum)); |
|---|
| 351 | include XOOPS_ROOT_PATH."/footer.php"; |
|---|
| 352 | ?> |
|---|