-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
25 lines (24 loc) · 1.09 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
//获得读者墙
function getFriendWall()
{
$db = Typecho_Db::get();
$sql = $db->select('COUNT(author) AS cnt', 'author', 'url', 'mail')
->from('table.comments')
->where('status = ?', 'approved')
->where('type = ?', 'comment')
->where('authorId = ?', '0')
->where('mail != ?', '[email protected]') //排除自己上墙
->group('author')
->order('cnt', Typecho_Db::SORT_DESC)
->limit('15'); //读取几位用户的信息
$result = $db->fetchAll($sql);
if (count($result) > 0) {
$maxNum = $result[0]['cnt'];
foreach ($result as $value) {
$mostactive .= '<li><a target="_blank" rel="nofollow" href="' . $value['url'] . '"><span class="pic" style="background: url(http://1.gravatar.com/avatar/'.md5(strtolower($value['mail'])).'?s=36&d=&r=G) no-repeat; "></span><em>' . $value['author'] . '</em><strong>+' . $value['cnt'] . '</strong><br />' . $value['url'] . '</a></li>';
}
echo $mostactive;
}
}
?>