} if ($total != 0) { if ($start >= $total) { $start = $total - 20; if ($start < 0) { $start = 0; } } else { if ($start < 0) { $start = $total - 20; if ($start < 0) { $start = 0; } } } $friends = bbs_getfriends($currentuser["userid"], $start); if ($friends === FALSE) { html_error_quit("系统错误1"); } ?> <table class="main adj"> <col class="center"/><col/><col/><col class="center"/> <caption>好友名单 (共 <?php echo $total; ?> 位好友)</caption> <tbody> <tr><th>序号</th><th>好友代号</th><th>好友说明</th><th>删除好友</th></tr> <?php $i = 0; foreach ($friends as $friend) {
/** * function getFriends get my friends * bbs_getfriends return array(ID,EXP) * * @param int $start * @param int $num * @return array the element is User * @access public */ public function getFriends($start = 0, $num = null) { $friends = array(); $num = is_null($num) ? $this->getFriendNum() : $num; $res = bbs_getfriends($this->userid, $start, $num); foreach ((array) $res as $v) { $info = array(); if (bbs_getuser($v['ID'], $info) != 0) { $friends[] = new User($info, array("exp" => $v['EXP'])); } } return $friends; }