Example #1
0
include_once S_ROOT . './source/function_common.php';
//获得空间信息
$space = getspace($_SGLOBAL['supe_uid']);
if (empty($space)) {
    showmessage('space_does_not_exist');
}
$nouids = $space['friends'];
$nouids[] = $space['uid'];
$friendlist = array();
$tempfriendlist = array();
if ($space['feedfriend']) {
    $query = $_SGLOBAL['db']->query("SELECT fuid AS uid, fusername AS username FROM " . tname('friend') . "\r\n\t\t\tWHERE uid IN (" . $space['feedfriend'] . ") LIMIT 0,10");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if (!in_array($value['uid'], $nouids) && $value['username']) {
            realname_set($value['uid'], $value['username']);
            $value['commonfriend'] = getcommonfriend($space['uid'], $value['uid']);
            $value['commonfriendcount'] = count($value['commonfriend']);
            if ($value['commonfriendcount'] > 0) {
                //$value['commonfriend']	= getcommonfriend($space['uid'],$value['uid']);
                $value['cause'] = '好友的好友';
                $tempfriendlist[$value['uid']] = $value;
            }
        }
    }
}
$friendlist = $tempfriendlist;
foreach ($tempfriendlist as $key => $value) {
    $query = $_SGLOBAL['db']->query("SELECT uid,realname  FROM " . tname('spacefield') . " WHERE uid='" . $key . "'");
    $value = $_SGLOBAL['db']->fetch_array($query);
    $friendlist[$value['uid']]['realname'] = $value['realname'];
}
Example #2
0
<?php

//引入基础函数
include_once '../common.php';
include_once './function_cp.php';
include_once './function_magic.php';
include_once './function_common.php';
$recommendid = $_GET['recommendid'];
$recommededid = $_GET['recommendedid'];
$cause = $_GET['cause'];
$realname = $_GET['realname'];
$commonfriendlist = getcommonfriend($recommendid, $recommededid);
$commonfriendcount = count($commonfriendlist);
$count = 0;
$response = '<ul class="avatar_list">';
$response .= '<li class="avatar_li">';
$response .= avatar($recommededid, 'small');
$response .= '<p class="gray"><a href="cp.php?ac=friend&op=add&uid=' . $recommededid . '" id="a_near_friend_' . $recommededid . '" onclick="ajaxmenu(event, this.id, 1)" class="addfriend">加为好友</a></p></li><br/>';
$response .= '<li class="name_li">' . $realname . '<br/>' . $cause . '<br/></li></ul>';
$response .= '共同好友:' . $commonfriendcount . '<br/><ul class="avatar_list">';
foreach ($commonfriendlist as $key => $value) {
    $count++;
    $response .= '<li><a href="space.php?uid=' . $key . '">' . avatar($key, 'small') . '</a><br/>';
    $response .= '<a href="space.php?uid=' . $key . '">' . $value . '</a></li>';
    if ($count == 3) {
        $count = 0;
        break;
    }
}
$response .= '</ul>';
echo $response;