Index: /temp/test-xoops.ec-cube.net/html/modules/newbb/response.php
===================================================================
--- /temp/test-xoops.ec-cube.net/html/modules/newbb/response.php	(revision 1257)
+++ /temp/test-xoops.ec-cube.net/html/modules/newbb/response.php	(revision 1258)
@@ -116,4 +116,5 @@
 $xoopsTpl->assign('lang_moderatedby', _MD_MODERATEDBY);
 
+/*
 $forum_moderators = "";
 $count = 0;
@@ -130,5 +131,4 @@
 $xoopsTpl->assign('forum_moderators', $forum_moderators);
 
-
 $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);
 if ( !isset($_GET['sortname']) || !in_array($_GET['sortname'], array_keys($sel_sort_array)) ) {
@@ -193,6 +193,7 @@
 $startdate = time() - (86400* $sortsince);
 $start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
-
-$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;
+*/
+
+$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';
 if ( !$result = $xoopsDB->query($sql,$forumdata['topics_per_page'],$start) ) {
     redirect_header('index.php',2,_MD_ERROROCCURED);
@@ -203,65 +204,4 @@
 $topic_lastread = newbb_get_topics_viewed();
 while ( $myrow = $xoopsDB->fetchArray($result) ) {
-	
-	$sql_user = "SELECT uname FROM " .$xoopsDB->prefix('users'). " WHERE uid = " . $myrow['topic_response_uid'];
-	$result_user = $xoopsDB->query($sql_user);
-	$myrow_user = $xoopsDB->fetchArray($result_user);
-	
-	$sql_tmp = "SELECT p.post_id FROM ".$xoopsDB->prefix('bb_posts')." p WHERE p.pid = 0 AND p.topic_id = ".$myrow['topic_id'];
-	$result_tmp = $xoopsDB->query($sql_tmp);
-	$myrow_tmp = $xoopsDB->fetchArray($result_tmp);
-	$myrow['post_id'] = $myrow_tmp['post_id'];
-	
-    if ( empty($myrow['last_poster']) ) {
-        $myrow['last_poster'] = $xoopsConfig['anonymous'];
-    }
-    if ( $myrow['topic_sticky'] == 1 ) {
-        $image = $bbImage['folder_sticky'];
-    } elseif ( $myrow['topic_status'] == 1 ) {
-        $image = $bbImage['locked_topic'];
-    } else {
-        if ( $myrow['topic_replies'] >= $forumdata['hot_threshold'] ) {
-            if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) {
-                $image = $bbImage['hot_newposts_topic'];
-            } else {
-                $image = $bbImage['hot_folder_topic'];
-            }
-        } else {
-            if ( empty($topic_lastread[$myrow['topic_id']]) || ($topic_lastread[$myrow['topic_id']] < $myrow['last_post_time'] )) {
-                $image = $bbImage['newposts_topic'];
-            } else {
-                $image = $bbImage['folder_topic'];
-            }
-        }
-    }
-    $pagination = '';
-    $addlink = '';
-    $topiclink = 'viewtopic.php?topic_id='.$myrow['topic_id'].'&amp;forum='.$forum;
-    $totalpages = ceil(($myrow['topic_replies'] + 1) / $forumdata['posts_per_page']);
-    if ( $totalpages > 1 ) {
-        $pagination .= '&nbsp;&nbsp;&nbsp;<img src="'.XOOPS_URL.'/images/icons/posticon.gif" /> ';
-        for ( $i = 1; $i <= $totalpages; $i++ ) {
-
-            if ( $i > 3 && $i < $totalpages ) {
-                $pagination .= "...";
-            } else {
-                $addlink = '&amp;start='.(($i - 1) * $forumdata['posts_per_page']);
-                $pagination .= '[<a href="'.$topiclink.$addlink.'">'.$i.'</a>]';
-            }
-        }
-    }
-    if ( $myrow['icon'] ) {
-        $topic_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($myrow['icon']).'" alt="" />';
-    } else {
-        $topic_icon = '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />';
-    }
-    if ( $myrow['topic_poster'] != 0 && $myrow['uname'] ) {
-        $topic_poster = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$myrow['topic_poster'].'">'.$myrow['uname'].'</a>';
-    } else {
-        $topic_poster = $xoopsConfig['anonymous'];
-    }
-    include_once 'class/class.util.php';
-    $fix = getFixName($myrow['forum_id']);
-
 	$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'])));
 }
