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
e43e3539
Commit
e43e3539
authored
9 years ago
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent bypass of allow_multi_answers option
Closes #235.
parent
147e6e30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
question-submit.php
qa-include/pages/question-submit.php
+19
-4
No files found.
qa-include/pages/question-submit.php
View file @
e43e3539
...
...
@@ -333,6 +333,7 @@
$errors
[
'content'
]
=
qa_lang_html
(
'misc/form_security_again'
);
else
{
// call any filter plugins
$filtermodules
=
qa_load_modules_with
(
'filter'
,
'filter_answer'
);
foreach
(
$filtermodules
as
$filtermodule
)
{
$oldin
=
$in
;
...
...
@@ -340,9 +341,11 @@
qa_update_post_text
(
$in
,
$oldin
);
}
// check CAPTCHA
if
(
$usecaptcha
)
qa_captcha_validate_post
(
$errors
);
// check for duplicate posts
if
(
empty
(
$errors
))
{
$testwords
=
implode
(
' '
,
qa_string_to_words
(
$in
[
'content'
]));
...
...
@@ -352,12 +355,24 @@
$errors
[
'content'
]
=
qa_lang_html
(
'question/duplicate_content'
);
}
$userid
=
qa_get_logged_in_userid
();
// if this is an additional answer, check we can add it
if
(
empty
(
$errors
)
&&
!
qa_opt
(
'allow_multi_answers'
))
{
foreach
(
$answers
as
$answer
)
{
if
(
qa_post_is_by_user
(
$answer
,
$userid
,
qa_cookie_get
()))
{
$errors
[]
=
''
;
break
;
}
}
}
// create the answer
if
(
empty
(
$errors
))
{
$userid
=
qa_get_logged_in_userid
();
$handle
=
qa_get_logged_in_handle
();
$cookieid
=
isset
(
$userid
)
?
qa_cookie_get
()
:
qa_cookie_get_create
();
// create a new cookie if necessary
$handle
=
qa_get_logged_in_handle
();
$cookieid
=
isset
(
$userid
)
?
qa_cookie_get
()
:
qa_cookie_get_create
();
// create a new cookie if necessary
$answerid
=
qa_answer_create
(
$userid
,
$handle
,
$cookieid
,
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
],
$in
[
'notify'
],
$in
[
'email'
],
$answerid
=
qa_answer_create
(
$userid
,
$handle
,
$cookieid
,
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
],
$in
[
'notify'
],
$in
[
'email'
],
$question
,
$in
[
'queued'
],
$in
[
'name'
]);
return
$answerid
;
...
...
This diff is collapsed.
Click to expand it.
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