Changeset 1258
- Timestamp:
- 2007/01/22 10:50:05 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
temp/test-xoops.ec-cube.net/html/modules/newbb/response.php
r1257 r1258 116 116 $xoopsTpl->assign('lang_moderatedby', _MD_MODERATEDBY); 117 117 118 /* 118 119 $forum_moderators = ""; 119 120 $count = 0; … … 130 131 $xoopsTpl->assign('forum_moderators', $forum_moderators); 131 132 132 133 133 $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); 134 134 if ( !isset($_GET['sortname']) || !in_array($_GET['sortname'], array_keys($sel_sort_array)) ) { … … 193 193 $startdate = time() - (86400* $sortsince); 194 194 $start = !empty($_GET['start']) ? intval($_GET['start']) : 0; 195 196 $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; 195 */ 196 197 $sql = 'SELECT topic_id, topic_title, topic_response, from_unixtime(topic_time) as topic_time, uname FROM xoops_bb_topics as tpc left join xoops_users as usr on tpc.topic_response_uid = usr.uid ORDER BY topic_response, topic_id DESC'; 197 198 if ( !$result = $xoopsDB->query($sql,$forumdata['topics_per_page'],$start) ) { 198 199 redirect_header('index.php',2,_MD_ERROROCCURED); … … 203 204 $topic_lastread = newbb_get_topics_viewed(); 204 205 while ( $myrow = $xoopsDB->fetchArray($result) ) { 205 206 $sql_user = "SELECT uname FROM " .$xoopsDB->prefix('users'). " WHERE uid = " . $myrow['topic_response_uid'];207 $result_user = $xoopsDB->query($sql_user);208 $myrow_user = $xoopsDB->fetchArray($result_user);209 210 $sql_tmp = "SELECT p.post_id FROM ".$xoopsDB->prefix('bb_posts')." p WHERE p.pid = 0 AND p.topic_id = ".$myrow['topic_id'];211 $result_tmp = $xoopsDB->query($sql_tmp);212 $myrow_tmp = $xoopsDB->fetchArray($result_tmp);213 $myrow['post_id'] = $myrow_tmp['post_id'];214 215 if ( empty($myrow['last_poster']) ) {216 $myrow['last_poster'] = $xoopsConfig['anonymous'];217 }218 if ( $myrow['topic_sticky'] == 1 ) {219 $image = $bbImage['folder_sticky'];220 } elseif ( $myrow['topic_status'] == 1 ) {221 $image = $bbImage['locked_topic'];222 } else {223 if ( $myrow['topic_replies'] >= $forumdata['hot_threshold'] ) {224 if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) {225 $image = $bbImage['hot_newposts_topic'];226 } else {227 $image = $bbImage['hot_folder_topic'];228 }229 } else {230 if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) {231 $image = $bbImage['newposts_topic'];232 } else {233 $image = $bbImage['folder_topic'];234 }235 }236 }237 $pagination = '';238 $addlink = '';239 $topiclink = 'viewtopic.php?topic_id='.$myrow['topic_id'].'&forum='.$forum;240 $totalpages = ceil(($myrow['topic_replies'] + 1) / $forumdata['posts_per_page']);241 if ( $totalpages > 1 ) {242 $pagination .= ' <img src="'.XOOPS_URL.'/images/icons/posticon.gif" /> ';243 for ( $i = 1; $i <= $totalpages; $i++ ) {244 245 if ( $i > 3 && $i < $totalpages ) {246 $pagination .= "...";247 } else {248 $addlink = '&start='.(($i - 1) * $forumdata['posts_per_page']);249 $pagination .= '[<a href="'.$topiclink.$addlink.'">'.$i.'</a>]';250 }251 }252 }253 if ( $myrow['icon'] ) {254 $topic_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($myrow['icon']).'" alt="" />';255 } else {256 $topic_icon = '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />';257 }258 if ( $myrow['topic_poster'] != 0 && $myrow['uname'] ) {259 $topic_poster = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$myrow['topic_poster'].'">'.$myrow['uname'].'</a>';260 } else {261 $topic_poster = $xoopsConfig['anonymous'];262 }263 include_once 'class/class.util.php';264 $fix = getFixName($myrow['forum_id']);265 266 206 $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']))); 267 207 }
Note: See TracChangeset
for help on using the changeset viewer.