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
f54156e6
Commit
f54156e6
authored
Aug 01, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle points/events for comment voting
parent
a31b8060
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
votes.php
qa-include/app/votes.php
+14
-10
qa-event-limits.php
qa-include/plugins/qa-event-limits.php
+3
-0
No files found.
qa-include/app/votes.php
View file @
f54156e6
...
@@ -112,7 +112,7 @@ function qa_vote_error_html($post, $vote, $userid, $topage)
...
@@ -112,7 +112,7 @@ function qa_vote_error_html($post, $vote, $userid, $topage)
* @param $handle
* @param $handle
* @param $cookieid
* @param $cookieid
* @param $vote
* @param $vote
* @return
mixe
d
* @return
voi
d
*/
*/
function
qa_vote_set
(
$post
,
$userid
,
$handle
,
$cookieid
,
$vote
)
function
qa_vote_set
(
$post
,
$userid
,
$handle
,
$cookieid
,
$vote
)
{
{
...
@@ -130,9 +130,13 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
...
@@ -130,9 +130,13 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
qa_db_uservote_set
(
$post
[
'postid'
],
$userid
,
$vote
);
qa_db_uservote_set
(
$post
[
'postid'
],
$userid
,
$vote
);
qa_db_post_recount_votes
(
$post
[
'postid'
]);
qa_db_post_recount_votes
(
$post
[
'postid'
]);
$postisanswer
=
(
$post
[
'basetype'
]
==
'A'
);
if
(
!
in_array
(
$post
[
'basetype'
],
array
(
'Q'
,
'A'
,
'C'
)))
{
return
;
}
$prefix
=
strtolower
(
$post
[
'basetype'
]);
if
(
$p
ostisanswer
)
{
if
(
$p
refix
===
'a'
)
{
qa_db_post_acount_update
(
$post
[
'parentid'
]);
qa_db_post_acount_update
(
$post
[
'parentid'
]);
qa_db_unupaqcount_update
();
qa_db_unupaqcount_update
();
}
}
...
@@ -140,24 +144,24 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
...
@@ -140,24 +144,24 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
$columns
=
array
();
$columns
=
array
();
if
(
$vote
>
0
||
$oldvote
>
0
)
if
(
$vote
>
0
||
$oldvote
>
0
)
$columns
[]
=
$p
ostisanswer
?
'aupvotes'
:
'q
upvotes'
;
$columns
[]
=
$p
refix
.
'
upvotes'
;
if
(
$vote
<
0
||
$oldvote
<
0
)
if
(
$vote
<
0
||
$oldvote
<
0
)
$columns
[]
=
$p
ostisanswer
?
'adownvotes'
:
'q
downvotes'
;
$columns
[]
=
$p
refix
.
'
downvotes'
;
qa_db_points_update_ifuser
(
$userid
,
$columns
);
qa_db_points_update_ifuser
(
$userid
,
$columns
);
qa_db_points_update_ifuser
(
$post
[
'userid'
],
array
(
$p
ostisanswer
?
'avoteds'
:
'q
voteds'
,
'upvoteds'
,
'downvoteds'
));
qa_db_points_update_ifuser
(
$post
[
'userid'
],
array
(
$p
refix
.
'
voteds'
,
'upvoteds'
,
'downvoteds'
));
if
(
$p
ost
[
'basetype'
]
==
'Q
'
)
if
(
$p
refix
===
'q
'
)
qa_db_hotness_update
(
$post
[
'postid'
]);
qa_db_hotness_update
(
$post
[
'postid'
]);
if
(
$vote
<
0
)
if
(
$vote
<
0
)
$event
=
$p
ostisanswer
?
'a_vote_down'
:
'q
_vote_down'
;
$event
=
$p
refix
.
'
_vote_down'
;
elseif
(
$vote
>
0
)
elseif
(
$vote
>
0
)
$event
=
$p
ostisanswer
?
'a_vote_up'
:
'q
_vote_up'
;
$event
=
$p
refix
.
'
_vote_up'
;
else
else
$event
=
$p
ostisanswer
?
'a_vote_nil'
:
'q
_vote_nil'
;
$event
=
$p
refix
.
'
_vote_nil'
;
qa_report_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
array
(
qa_report_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
array
(
'postid'
=>
$post
[
'postid'
],
'postid'
=>
$post
[
'postid'
],
...
...
qa-include/plugins/qa-event-limits.php
View file @
f54156e6
...
@@ -58,6 +58,9 @@ class qa_event_limits
...
@@ -58,6 +58,9 @@ class qa_event_limits
case
'a_vote_up'
:
case
'a_vote_up'
:
case
'a_vote_down'
:
case
'a_vote_down'
:
case
'a_vote_nil'
:
case
'a_vote_nil'
:
case
'c_vote_up'
:
case
'c_vote_down'
:
case
'c_vote_nil'
:
qa_limits_increment
(
$userid
,
QA_LIMIT_VOTES
);
qa_limits_increment
(
$userid
,
QA_LIMIT_VOTES
);
break
;
break
;
...
...
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