|
20 | 20 | echo ''; |
21 | 21 | break; |
22 | 22 | } |
23 | | - $relation_type = USER_RELATION_TYPE_UNKNOWN; //Unknown contact |
24 | | - if (isset($_GET['is_my_friend'])) { |
25 | | - $relation_type = USER_RELATION_TYPE_FRIEND; //My friend |
26 | | - } |
27 | | - |
28 | | - if (isset($_GET['friend_id'])) { |
29 | | - $my_current_friend = $_GET['friend_id']; |
30 | | - UserManager::relate_users($current_user_id, $my_current_friend, $relation_type); |
31 | | - UserManager::relate_users($my_current_friend, $current_user_id, $relation_type); |
32 | | - SocialManager::invitation_accepted($my_current_friend, $current_user_id); |
33 | | - Display::addFlash( |
34 | | - Display::return_message(get_lang('AddedContactToList'), 'success') |
35 | | - ); |
36 | 23 |
|
37 | | - header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php'); |
38 | | - exit; |
| 24 | + if (Security::check_token('get', null, 'invitation')) { |
| 25 | + $relation_type = USER_RELATION_TYPE_UNKNOWN; //Unknown contact |
| 26 | + if (isset($_GET['is_my_friend'])) { |
| 27 | + $relation_type = USER_RELATION_TYPE_FRIEND; //My friend |
| 28 | + } |
| 29 | + |
| 30 | + if (isset($_GET['friend_id'])) { |
| 31 | + $my_current_friend = $_GET['friend_id']; |
| 32 | + UserManager::relate_users($current_user_id, $my_current_friend, $relation_type); |
| 33 | + UserManager::relate_users($my_current_friend, $current_user_id, $relation_type); |
| 34 | + SocialManager::invitation_accepted($my_current_friend, $current_user_id); |
| 35 | + Display::addFlash( |
| 36 | + Display::return_message(get_lang('AddedContactToList'), 'success') |
| 37 | + ); |
| 38 | + } |
39 | 39 | } |
40 | | - break; |
| 40 | + |
| 41 | + header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php'); |
| 42 | + exit; |
41 | 43 | case 'deny_friend': |
42 | 44 | if (api_is_anonymous()) { |
43 | 45 | echo ''; |
|
0 commit comments