コード例 #1
0
 public function executeAdd(sfWebRequest $request)
 {
     //Set the local vars used in this function for easy access.
     $uid_from = $this->getUser()->getAttribute('id');
     $uid_to = $request->getParameter('uid');
     //Error Checking
     $this->errorCheck(!$this->getUser()->hasAttribute('id'), "Required request paramater uid_from is not set.");
     $this->errorCheck(!$request->hasParameter('uid'), "Required request paramater uid is not set.");
     $this->errorCheck($uid_to == null || $uid_to == 0, "Account id can not be null.");
     $this->errorCheck($uid_to == 1, "Friendship requests to the Administrator account are not allowed.");
     $this->errorCheck(!AccountTable::accountExists($uid_from), "Account ({$uid_from}) does not exist in database.");
     $this->errorCheck(!AccountTable::accountExists($uid_to), "Account ({$uid_to}) does not exist in database.");
     $this->errorCheck(FriendTable::areFriends($uid_from, $uid_to), "Account ({$uid_from}) and ({$uid_to}) are already friends.");
     $this->errorCheck(FriendRequestTable::requestPending($uid_from, $uid_to), "Account ({$uid_from}) has already requested ({$uid_to}) for friendship.");
     $this->errorCheck(FriendRequestTable::requestPending($uid_to, $uid_from), "Account ({$uid_to}) has already requested ({$uid_from}) for friendship.");
     $this->errorCheck($uid_from == $uid_to, "Account ({$uid_from}) can not request friendship with itself.");
     //Request is valid if code reaches here so make a friend request object and save it.
     $friendRequest = new FriendRequest();
     $friendRequest->uid_from = $uid_from;
     $friendRequest->uid_to = $uid_to;
     $friendRequest->save();
     $url = "default/index";
     if ($request->hasParameter('redirect_url')) {
         $url = $request->getParameter('redirect_url') . 'index';
     }
     $this->flashAndRedirect("Friendship successfully requested.", $url);
 }
コード例 #2
0
ファイル: indexSuccess.php プロジェクト: rsanders16/NexusPlus
'><?php 
    echo $friend->getName();
    ?>
</a></div>
        <?php 
}
?>
    </div>
</div>
<div class="right">
    <div id="profile_name"><?php 
echo $profile->getName();
?>
</div>
    <?php 
if (FriendTable::areFriends($sf_user->getAttribute('id'), $profile->getUid()) || $sf_user->getAttribute('id') == $profile->getUid()) {
    ?>
    


        <div class="wall">
            <h4>Wall</h4>
            <form action ="profile/addWallpost" method="post">
                <?php 
    echo $form;
    ?>
                <input type="submit" value="Post">
            </form>

            <?php 
    foreach ($wall as $post) {
コード例 #3
0
ファイル: myUser.class.php プロジェクト: rsanders16/NexusPlus
 public function isFriendsWith($profile)
 {
     return FriendTable::areFriends($this->getAttribute('id'), $profile->getUid()) || $this->getAttribute('id') == $profile->getUid();
 }