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
6a36c080
Commit
6a36c080
authored
Jul 24, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor qa_vote_error_html, improve error messages
parent
e00174ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
votes.php
qa-include/app/votes.php
+20
-9
No files found.
qa-include/app/votes.php
View file @
6a36c080
...
...
@@ -45,17 +45,30 @@ function qa_vote_error_html($post, $vote, $userid, $topage)
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
if
(
is_array
(
$post
)
&&
!
$post
[
'hidden'
]
&&
!
$post
[
'queued'
]
&&
(
$post
[
'basetype'
]
==
'Q'
||
$post
[
'basetype'
]
==
'A'
)
&&
qa_opt
((
$post
[
'basetype'
]
==
'Q'
)
?
'voting_on_qs'
:
'voting_on_as'
)
&&
if
(
$post
[
'hidden'
])
{
return
qa_lang_html
(
'main/vote_disabled_hidden'
);
}
if
(
$post
[
'queued'
])
{
return
qa_lang_html
(
'main/vote_disabled_queued'
);
}
$allowVoting
=
qa_opt
(
$post
[
'basetype'
]
==
'Q'
?
'voting_on_qs'
:
'voting_on_as'
);
if
((
$post
[
'basetype'
]
===
'Q'
||
$post
[
'basetype'
]
===
'A'
)
&&
$allowVoting
&&
(
!
isset
(
$post
[
'userid'
])
||
!
isset
(
$userid
)
||
$post
[
'userid'
]
!=
$userid
)
)
{
$permiterror
=
qa_user_post_permit_error
((
$post
[
'basetype'
]
==
'Q'
)
?
'permit_vote_q'
:
'permit_vote_a'
,
$post
,
QA_LIMIT_VOTES
);
$errordownonly
=
!
$permiterror
&&
$vote
<
0
;
if
(
$errordownonly
)
if
(
$errordownonly
)
{
$permiterror
=
qa_user_post_permit_error
(
'permit_vote_down'
,
$post
);
}
switch
(
$permiterror
)
{
case
false
:
return
false
;
break
;
case
'login'
:
return
qa_insert_login_links
(
qa_lang_html
(
'main/vote_must_login'
),
$topage
);
break
;
...
...
@@ -71,13 +84,11 @@ function qa_vote_error_html($post, $vote, $userid, $topage)
default
:
return
qa_lang_html
(
'users/no_permission'
);
break
;
case
false
:
return
false
;
}
}
else
return
qa_lang_html
(
'main/vote_not_allowed'
);
// voting option should not have been presented (but could happen due to options change)
}
else
{
// voting option should not have been presented (but could happen due to options change)
return
qa_lang_html
(
'main/vote_not_allowed'
);
}
}
...
...
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