public function see($mid, $uid, $type)
 {
     $map["uid"] = $uid;
     $map["type"] = "basic";
     $r = $this->where($map)->find();
     $privacy = unserialize($r["privacy"]);
     //没有设置过的话,默认从缓存里面读
     if (!$privacy) {
         $site_opts = TS_D("Option")->get();
         $privacy = unserialize($site_opts["privacy"]);
     }
     $privacy = intval($privacy[$type]);
     if ($mid == $uid) {
         //如果是看自己空间,肯定显示
         return true;
     } else {
         //看别人空间
         switch ($privacy) {
             case 0:
                 return true;
                 //任何人
             //任何人
             case 1:
                 $api = new TS_API();
                 return $api->friend_areFriends($mid, $uid);
                 //仅好友
             case 2:
                 return false;
                 //他自己可看
             //他自己可看
             default:
                 return true;
         }
     }
 }
Exemple #2
0
-------------------------------------*/
$r = $api->user_getLinkName(1);
ts_dump($r);
/* ===========================================================================================
 * ========================================= FRIEND ==========================================
 * ===========================================================================================
 */
/*-------------------------------------
=  friend_get()
-------------------------------------*/
$fris = $api->friend_get();
ts_dump($fris);
/*-------------------------------------
= friend_areFriends
-------------------------------------*/
$r = $api->friend_areFriends(1, 2);
ts_dump($r);
/*-------------------------------------
= friend_getAppUsers -- 待完成
-------------------------------------*/
$r = $api->friend_getAppUsers();
ts_dump($r);
/* ===========================================================================================
 * ========================================= SITE ============================================
 * ===========================================================================================
 */
/*-------------------------------------
=  site_get()
-------------------------------------*/
$r = $api->site_get();
ts_dump($r);
 public function filterPrivacy($value)
 {
     $api = new TS_API();
     //基本信息过滤
     if (isset($value['privacy'])) {
         $privacy = $value['privacy'];
         $home = isset($value['display']) ? $value['display'] : $value['home'];
     } else {
         $privacy = $value[0];
         $home = $value[1];
     }
     if ($this->uid != $this->mid && (1 == $privacy && false == $api->friend_areFriends($this->uid, $this->mid))) {
         return false;
     }
     if (1 == $this->home && 1 != $home) {
         return false;
     }
     if ($this->uid != $this->mid && $privacy == 2) {
         return false;
     }
     return true;
 }
Exemple #4
0
function getPrivacy($v, $mid, $uid)
{
    $full = explode("-", $v);
    $num = count($full);
    $privacy = $full[$num - 2];
    $display = $full[$num - 1];
    if ($display == 0) {
        //设置为不显示,当然返回false喽~~
        return false;
    } else {
        if ($mid == $uid) {
            //如果是看自己空间,肯定也显示
            return true;
        } else {
            //看别人空间
            switch ($privacy) {
                case 0:
                    return true;
                    //任何人
                //任何人
                case 1:
                    $api = new TS_API();
                    return $api->friend_areFriends($mid, $uid);
                    //仅好友
                case 2:
                    return false;
                    //他自己可看
            }
        }
    }
}
Exemple #5
0
function check_relationship($uid, $mid = 0)
{
    $api = new TS_API();
    if (!$mid) {
        $mid = $api->user_getLoggedInUser();
    }
    if ($uid == $mid) {
        return 'self';
    } elseif ($api->friend_areFriends($uid, $mid)) {
        return 'friend';
    } else {
        return 'stranger';
    }
}