Skip to content

Commit e45079d

Browse files
committed
Fix #8090 only owner of the wall can delete their own wall messages.
1 parent aeb458a commit e45079d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

main/social/profile.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,19 @@
8181
exit;
8282

8383
} else if (isset($_GET['messageId'])) {
84-
$messageId = Security::remove_XSS($_GET['messageId']);
85-
$status = SocialManager::deleteMessage($messageId);
86-
Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
87-
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
88-
exit;
89-
84+
$messageId = intval($_GET['messageId']);
85+
$messageInfo = MessageManager::get_message_by_id($messageId);
86+
if (!empty($messageInfo)) {
87+
// I can only delete messages of my own wall
88+
if ($messageInfo['user_receiver_id'] == $user_id) {
89+
$status = SocialManager::deleteMessage($messageId);
90+
91+
Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
92+
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
93+
exit;
94+
}
95+
}
96+
api_not_allowed(true);
9097
} else if (isset($_GET['u'])) { //I'm your friend? I can see your profile?
9198
$user_id = intval($_GET['u']);
9299
if (api_is_anonymous($user_id, true)) {

0 commit comments

Comments
 (0)