Beispiel #1
0
 public function viewable_profile($uid)
 {
     if ($uid == 4) {
         return "Master and Commander";
     }
     $sess = new SessionData('account');
     $id = $sess->Retrieve('id');
     if ($id == $uid) {
         return "This is you.";
     }
     $relation = new Relationship();
     $their_friends = $relation->user_friends($uid, 0, 5000);
     $my_friends = $relation->my_friends();
     $connections = count(array_intersect($my_friends, $their_friends));
     $retvalue = $relation->find_connection($uid);
     if ($retvalue) {
         $retvalue .= "<br>You have <a href='search.php?mfriends={$uid}&hide=y'>" . $connections . " friend";
         if ($connections != 1) {
             $retvalue .= "s";
         }
         $retvalue .= "</a> in common.";
         return $retvalue;
     }
     if ($connections > 0) {
         $retvalue = "This is a friend of a friend.<br>You have <a href='search.php?mfriends={$uid}&hide=y'>" . $connections . " friend";
         if ($connections != 1) {
             $retvalue .= "s";
         }
         $retvalue .= "</a> in common.";
         return $retvalue;
     }
     $pendingrequest = $relation->pending_requests();
     if (in_array($uid, $pendingrequest)) {
         $retvalue = "Pending Request.<br>You have <a href='search.php?mfriends={$uid}&hide=y'>" . $connections . " friend";
         if ($connections != 1) {
             $retvalue .= "s";
         }
         $retvalue .= "</a> in common.";
         return $retvalue;
     }
     return FALSE;
 }
Beispiel #2
0
    // Validates Session
    $sess->Login();
}
$log = new log($_SERVER["PHP_SELF"]);
$db = new Database();
// Creates database object
if (!$db->connect()) {
    echo "<p>Error connecting to the database</p>";
}
$id = $sess->Retrieve('id');
$profile = new Profile($id);
$friendarray = $profile->friendsids($id, 0, 5000);
$resultsperpage = 20;
// Adjustable up to 50
$relationpend = new Relationship();
$requestsyourpending = $relationpend->pending_requests();
?>
<title>TheFacebook | Requests</title> 
<link rel="stylesheet" href="style.css"> 
<link rel="shortcut icon" href="favicon.ico"> 


<center>

<table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700>

  <tr><td>

      <table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%>

      <tr><td width=350 bgcolor=#3B5998>
                $success = FALSE;
                break;
        }
        $error .= "<br>";
    } else {
        $error = "</b></font>A request has been sent to " . $profile->retrieve("name") . " to confirm your request.";
        if ($_REQUEST['confirm'] == "Confirm") {
            $error = "</b></font>Confirmed! <a href='profile.php?id=" . $fid . "'>View their profile</a> or <a href='reqs.php'>Go Back to Pending Requests</a>";
        }
        if ($_REQUEST['deny'] == "Deny") {
            $error = "</b></font>The request has been removed. <a href='reqs.php'>Go Back to Pending Requests</a>";
        }
        $success = true;
    }
}
$yourpending = $relation->pending_requests();
if (in_array($fid, $yourpending)) {
    $success = true;
    $relationshipwanted = strtolower($relation->getname('relationshiptype', $relation->getrelationshiptype($id, $fid)));
    $error = "</b></font><form method=post action=addfriend.php><input type=hidden name=id value='" . $fid . "'><a href='profile.php?id=" . $fid . "'>" . $profile->retrieve("name") . "</a> would like you to confirm that you are " . $relationshipwanted . ". <input class=inputsubmit type=submit name='confirm' value='Confirm'><input class=inputsubmit type=submit name='deny' value='Deny'></form>";
}
?>
<title>TheFacebook | Add Friend</title> 
<link rel="stylesheet" href="style.css"> 
<link rel="shortcut icon" href="favicon.ico"> 


<center>

<table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700>