示例#1
0
 function _getAllThreads($table, $num, $tid = 0, $orderType = 'ASC')
 {
     $result = array();
     $op = $orderType == 'DESC' ? '<' : '>';
     $key = $orderType == 'DESC' ? 'minTid' : 'maxTid';
     $sql = sprintf("SELECT * FROM %s\n\t\t\t\tWHERE tid %s %d\n\t\t\t\tORDER BY tid %s\n\t\t\t\tLIMIT %d", $table, $op, $tid, $orderType, $num);
     $query = DB::query($sql);
     $tIds = $vtIds = array();
     while ($thread = DB::fetch($query)) {
         $result[$key] = $thread['tid'];
         $result['data'][$thread['tid']] = SearchHelper::convertThread($thread);
         if ($result['data'][$thread['tid']]['specialType'] == 'poll') {
             $vtIds[] = $thread['tid'];
         }
     }
     $polls = SearchHelper::getPollInfo($vtIds);
     foreach ($polls as $tId => $poll) {
         $result['data'][$tId]['pollInfo'] = $poll;
     }
     return $result;
 }