function member_link($member) { if (is_array($member)) { $link = '<a href="' . OUT_PATH . 'member/' . $member['login'] . '" title="' . $member['login'] . '">' . $member['nicename'] . '</a>'; } else { $who = member_who($member); $link = '<a href="' . OUT_PATH . 'member/' . $who['login'] . '" title="' . $who['login'] . '">' . $who['nicename'] . '</a>'; } return $link; }
<div class="no-post"> <p>本看板目前還沒有文章。</p> <p>現在就<a href="<?php echo OUT_PATH . $BD; ?> /post" title="發表文章">搶下第一篇</a>吧!</p> </div> <?php } else { ?> <ul id="post-board-list"> <?php foreach ($row as $list) { $list["comment_count"] = !empty($list["comment_count"]) ? '<span class="post-comment-count">' . $list["comment_count"] . '</span>' : ''; if ($list['post_author']) { $list['post_author'] = member_link(member_who($list['post_author'])); } else { $list['post_author'] = $list['post_author_nicename']; } $list['category'] = '***'; if (isset($_GET['to']) && $list['id'] == $_GET['to']) { ?> <li id="post-now-reading"> <span class="post-list-category"><?php echo $list['category']; ?> </span> <span class="post-list-title"><?php echo $list['post_title']; echo $list['comment_count']; ?>
<?php if (!$list) { ?> <div class="no-post"> <p>本網站目前還沒有文章。</p> </div> <?php } else { ?> <ul id="post-last-list"> <?php foreach ($list as $item) { $item["comment_count"] = !empty($item["comment_count"]) ? '<span class="post-comment-count">' . $item["comment_count"] . '</span>' : ''; $item['post_board_nicename'] = $board_info[$item['post_board']]['nicename']; if ($item['post_update_member']) { $item['post_author'] = member_link(member_who($item['post_update_member'])); } else { $item['post_author'] = $item['post_update_who']; } switch ($item["post_change"]) { case 'edit': $change = '<span class="post-last-change post-list-edit">修改</span>'; break; case 'reply': $change = '<span class="post-last-change post-list-reply">回覆</span>'; break; default: $change = '<span class="post-last-change post-list-write">發表</span>'; break; } ?>
function feed() { $many = 20; $board = ''; //wait for more fix $result = inget('`id`, `post_title`, `post_author`, `post_author_nicename`, `post_content`, `post_date`, `post_board`', 'posts', $board . 'ORDER BY `post_date` DESC LIMIT 0, ' . $many); $board = board_info(); $who = member_who(); $prefix = isSSL() ? 'https:' : 'http:'; $row = mysql_fetch_all($result); if ($row) { foreach ($row as $id => $list) { $row[$id]['post_board'] = $board[$list['post_board']]['name']; $row[$id]['post_board_nicename'] = $board[$list['post_board']]['nicename']; if ($list['post_author']) { $row[$id]['post_author'] = $who[$list['post_author']]['nicename']; } else { $row[$id]['post_author'] = $list['post_author_nicename']; } $row[$id]['post_content'] = html_transfer(show_text($list['post_content'])); } } header('Content-type: application/xml; charset=utf-8'); echo '<?xml version="1.0" encoding="utf-8"?>' . "\n"; include load_template('feed'); }