File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 44use Chamilo \CoreBundle \Entity \Message ;
55use Chamilo \CoreBundle \Entity \MessageFeedback ;
66use ChamiloSession as Session ;
7+ use Symfony \Component \HttpFoundation \JsonResponse ;
78
89/**
910 * Responses to AJAX calls.
6162 echo '' ;
6263 break ;
6364 }
64- $ my_delete_friend = (int ) $ _POST ['delete_friend_id ' ];
65+
66+ if (!Security::check_token ('post ' , null , 'social ' )) {
67+ exit ;
68+ }
69+
6570 if (isset ($ _POST ['delete_friend_id ' ])) {
71+ $ my_delete_friend = (int ) $ _POST ['delete_friend_id ' ];
6672 SocialManager::remove_user_rel_user ($ my_delete_friend );
73+
74+ JsonResponse::create ([
75+ 'secToken ' => Security::get_token ('social ' ),
76+ ])->send ();
77+ break ;
6778 }
6879 break ;
6980 case 'show_my_friends ' :
Original file line number Diff line number Diff line change 1717$ this_section = SECTION_SOCIAL ;
1818
1919$ htmlHeadXtra [] = '<script>
20+ var socialSecToken = " ' .Security::get_token ('social ' ).'";
21+
2022function delete_friend (element_div) {
2123 id_image = $(element_div).attr("id");
2224 user_id = id_image.split("_");
@@ -26,8 +28,14 @@ function delete_friend (element_div) {
2628 type: "POST",
2729 url: " ' .api_get_path (WEB_AJAX_PATH ).'social.ajax.php?a=delete_friend",
2830 data: "delete_friend_id="+user_id[1],
29- success: function(datos) {
31+ data: {
32+ "delete_friend_id": user_id[1],
33+ "social_sec_token": socialSecToken,
34+ },
35+ success: function(data) {
3036 $("#user_card_"+user_id[1]).hide("slow");
37+
38+ socialSecToken = data.secToken;
3139 }
3240 });
3341 }
You can’t perform that action at this time.
0 commit comments