Commit 9cbb6cbe by pupi1985

Prevent users from favoriting themselves

parent dd724732
......@@ -40,6 +40,8 @@
require_once QA_INCLUDE_DIR.'qa-app-limits.php';
require_once QA_INCLUDE_DIR.'qa-app-updates.php';
// Make sure the user is not favoriting themselves
if ($entitytype != QA_ENTITY_USER || $userid != $entityid) {
if ($favorite)
qa_db_favorite_create($userid, $entitytype, $entityid);
else
......@@ -73,6 +75,7 @@
qa_report_event($action, $userid, $handle, $cookieid, $params);
}
}
function qa_favorite_q_list_view($questions, $usershtml)
......
......@@ -347,7 +347,7 @@
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
$qa_content['error'] = @$errors['page'];
if (isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS) {
if (isset($loginuserid) && $loginuserid != $useraccount['userid'] && !QA_FINAL_EXTERNAL_USERS) {
$favoritemap = qa_get_favorite_non_qs_map();
$favorite = @$favoritemap['user'][$useraccount['userid']];
......
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