$lists = array(); $pages = ''; $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}comment WHERE item_mid={$mid} AND item_id={$itemid} AND status=3"); $items = $r['num']; $pages = pages($items, $page, $pagesize); $result = $db->query("SELECT * FROM {$DT_PRE}comment WHERE item_mid={$mid} AND item_id={$itemid} AND status=3 ORDER BY itemid ASC LIMIT {$offset},{$pagesize}"); $floor = $page == 1 ? 0 : ($page - 1) * $pagesize; while ($r = $db->fetch_array($result)) { $r['floor'] = ++$floor; $r['addtime'] = timetodate($r['addtime'], 5); $r['replytime'] = $r['replytime'] ? timetodate($r['replytime'], 5) : ''; if ($r['username']) { $r['name'] = $r['hidden'] ? $MOD['comment_am'] : $r['username']; $r['uname'] = $r['hidden'] ? '' : $r['username']; } else { $r['name'] = 'IP:' . hide_ip($r['ip']); $r['uname'] = ''; } $lists[] = $r; } $stat = $r = $db->get_one("SELECT * FROM {$DT_PRE}comment_stat WHERE moduleid={$mid} AND itemid={$itemid}"); if ($stat && $stat['comment']) { $stat['pc1'] = dround($stat['star1'] * 100 / $stat['comment'], 2, true) . '%'; $stat['pc2'] = dround($stat['star2'] * 100 / $stat['comment'], 2, true) . '%'; $stat['pc3'] = dround($stat['star3'] * 100 / $stat['comment'], 2, true) . '%'; } else { $stat['star1'] = $stat['star2'] = $stat['star3'] = 0; $stat['pc1'] = $stat['pc2'] = $stat['pc3'] = '0%'; } $moduleid = $mid; $head_title = $title . $L['comment_title'] . $DT['seo_delimiter'] . $MODULE[$mid]['name'];
$result = System::$db->getAll($sql); foreach ($result as $row) { $city = convertip($row["ip"]); //转 GBK if ($_G['product']['charset'] == "utf-8") { $city = iconv("gbk", 'utf-8', $city); } echo "<tr class='" . zebra($i, array("line", "band")) . "'>"; echo '<td>' . $row['id'] . '</td>'; echo '<td><a href="?account=' . $row["aid"] . '&q=' . urlencode($row['account']) . '">' . $row['account'] . '</a></td>'; echo '<td><a href="?event=' . $row["event"] . '">' . $Logbook[$row["event"]] . '</a></td>'; echo "<td>" . date("Y-m-d H:i:s", $row['dateline']) . " <span class='text-key'>" . $_G['project']['weeks'][gmdate("w", $row['dateline'])] . "</span></td>"; echo "<td>" . date("Y-m-d H:i:s", $row['modify']) . " <span class='text-key'>" . $_G['project']['weeks'][gmdate("w", $row['modify'])] . "</span></td>"; echo "<td>" . FormatDateDiff($row['dateline'], $row['modify']) . "</td>"; echo "<td>" . FormatDateDiff($row['dateline'], time()) . "前</td>"; echo "<td>" . hide_ip($row["ip"]) . "</td>"; echo "<td>" . $city . "</td>"; echo "</tr>"; if ($row["description"]) { echo '<tr><td colspan="9" class="choice">' . nl2br($row["description"]) . '</td></tr>'; } } if (count($result) == 0) { echo '<tr><td colspan="9" class="notice">没有检索到相关日志记录</td></tr>'; } //关闭数据库 System::connect(); ?> </table> <?php //关闭数据库