Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
9cbb6cbe
Commit
9cbb6cbe
authored
Oct 06, 2014
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent users from favoriting themselves
parent
dd724732
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
32 deletions
+35
-32
qa-app-favorites.php
qa-include/qa-app-favorites.php
+34
-31
qa-page-user-profile.php
qa-include/qa-page-user-profile.php
+1
-1
No files found.
qa-include/qa-app-favorites.php
View file @
9cbb6cbe
...
...
@@ -40,38 +40,41 @@
require_once
QA_INCLUDE_DIR
.
'qa-app-limits.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-app-updates.php'
;
if
(
$favorite
)
qa_db_favorite_create
(
$userid
,
$entitytype
,
$entityid
);
else
qa_db_favorite_delete
(
$userid
,
$entitytype
,
$entityid
);
switch
(
$entitytype
)
{
case
QA_ENTITY_QUESTION
:
$action
=
$favorite
?
'q_favorite'
:
'q_unfavorite'
;
$params
=
array
(
'postid'
=>
$entityid
);
break
;
case
QA_ENTITY_USER
:
$action
=
$favorite
?
'u_favorite'
:
'u_unfavorite'
;
$params
=
array
(
'userid'
=>
$entityid
);
break
;
case
QA_ENTITY_TAG
:
$action
=
$favorite
?
'tag_favorite'
:
'tag_unfavorite'
;
$params
=
array
(
'wordid'
=>
$entityid
);
break
;
case
QA_ENTITY_CATEGORY
:
$action
=
$favorite
?
'cat_favorite'
:
'cat_unfavorite'
;
$params
=
array
(
'categoryid'
=>
$entityid
);
break
;
default
:
qa_fatal_error
(
'Favorite type not recognized'
);
break
;
// 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
qa_db_favorite_delete
(
$userid
,
$entitytype
,
$entityid
);
switch
(
$entitytype
)
{
case
QA_ENTITY_QUESTION
:
$action
=
$favorite
?
'q_favorite'
:
'q_unfavorite'
;
$params
=
array
(
'postid'
=>
$entityid
);
break
;
case
QA_ENTITY_USER
:
$action
=
$favorite
?
'u_favorite'
:
'u_unfavorite'
;
$params
=
array
(
'userid'
=>
$entityid
);
break
;
case
QA_ENTITY_TAG
:
$action
=
$favorite
?
'tag_favorite'
:
'tag_unfavorite'
;
$params
=
array
(
'wordid'
=>
$entityid
);
break
;
case
QA_ENTITY_CATEGORY
:
$action
=
$favorite
?
'cat_favorite'
:
'cat_unfavorite'
;
$params
=
array
(
'categoryid'
=>
$entityid
);
break
;
default
:
qa_fatal_error
(
'Favorite type not recognized'
);
break
;
}
qa_report_event
(
$action
,
$userid
,
$handle
,
$cookieid
,
$params
);
}
qa_report_event
(
$action
,
$userid
,
$handle
,
$cookieid
,
$params
);
}
...
...
qa-include/qa-page-user-profile.php
View file @
9cbb6cbe
...
...
@@ -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'
]];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment