Пример #1
0
     if (api_is_anonymous()) {
         echo '';
         break;
     }
     if (isset($_POST['is_my_friend'])) {
         $relation_type = USER_RELATION_TYPE_FRIEND;
         //My friend
     } else {
         $relation_type = USER_RELATION_TYPE_UNKNOW;
         //Unknown contact
     }
     if (isset($_POST['friend_id'])) {
         $my_current_friend = $_POST['friend_id'];
         UserManager::relate_users($current_user_id, $my_current_friend, $relation_type);
         UserManager::relate_users($my_current_friend, $current_user_id, $relation_type);
         SocialManager::invitation_accepted($my_current_friend, $current_user_id);
         Display::display_normal_message(api_xml_http_response_encode(get_lang('AddedContactToList')));
     }
     break;
 case 'deny_friend':
     if (api_is_anonymous()) {
         echo '';
         break;
     }
     if (isset($_POST['is_my_friend'])) {
         $relation_type = USER_RELATION_TYPE_FRIEND;
         //my friend
     } else {
         $relation_type = USER_RELATION_TYPE_UNKNOW;
         //Contact unknown
     }
 public function accept_friend($username, $password, $userfriend_id)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $user_id = UserManager::get_user_id_from_username($username);
         UserManager::relate_users($userfriend_id, $user_id, USER_RELATION_TYPE_FRIEND);
         SocialManager::invitation_accepted($userfriend_id, $user_id);
         return get_lang('AddedContactToList');
     }
     return get_lang('InvalidId');
 }