Commit d13ddf71 by Scott

Prevent users sending private messages to themselves

Fixes #27.
parent 36eacf90
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
$handle = qa_request_part(1); $handle = qa_request_part(1);
$loginuserid = qa_get_logged_in_userid(); $loginuserid = qa_get_logged_in_userid();
$fromhandle = qa_get_logged_in_handle();
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
...@@ -53,6 +54,12 @@ ...@@ -53,6 +54,12 @@
return $qa_content; return $qa_content;
} }
if ($handle === $fromhandle) {
// prevent users sending messages to themselves
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
// Find the user profile and their recent private messages // Find the user profile and their recent private messages
...@@ -114,7 +121,6 @@ ...@@ -114,7 +121,6 @@
else else
$messageid = null; $messageid = null;
$fromhandle = qa_get_logged_in_handle();
$canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES); $canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
$more = strtr(qa_lang($canreply ? 'emails/private_message_reply' : 'emails/private_message_info'), array( $more = strtr(qa_lang($canreply ? 'emails/private_message_reply' : 'emails/private_message_info'), array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment