Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
latoilescoute-dev
scoodle
Commits
f5e57943
Commit
f5e57943
authored
Oct 14, 2016
by
Antonin
Browse files
Problèmes d'envois de commentaire de l'administrateur sur un sondage avec mot de passe.
parent
df8bbf3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
action/add_comment.php
View file @
f5e57943
...
...
@@ -34,6 +34,7 @@ $poll = null;
$message
=
null
;
$result
=
false
;
$comments
=
array
();
$is_admin
=
false
;
/* Services */
/*----------*/
...
...
@@ -53,9 +54,16 @@ if (!empty($_POST['poll'])) {
$poll
=
$pollService
->
findById
(
$poll_id
);
}
if
(
!
empty
(
$_POST
[
'poll_admin'
]))
{
$admin_poll_id
=
filter_input
(
INPUT_POST
,
'poll_admin'
,
FILTER_VALIDATE_REGEXP
,
[
'options'
=>
[
'regexp'
=>
POLL_REGEX
]]);
if
(
strlen
(
$admin_poll_id
)
===
24
)
{
$is_admin
=
(
$pollService
->
findByAdminId
(
$admin_poll_id
)
!=
null
);
}
}
if
(
!
$poll
)
{
$message
=
new
Message
(
'error'
,
__
(
'Error'
,
'This poll doesn\'t exist !'
));
}
else
if
(
$poll
&&
!
$securityService
->
canAccessPoll
(
$poll
))
{
}
else
if
(
$poll
&&
!
$securityService
->
canAccessPoll
(
$poll
)
&&
!
$is_admin
)
{
$message
=
new
Message
(
'error'
,
__
(
'Password'
,
'Wrong password'
));
}
else
{
$name
=
$inputService
->
filterName
(
$_POST
[
'name'
]);
...
...
tpl/part/comments.tpl
View file @
f5e57943
...
...
@@ -8,6 +8,9 @@
<form
action=
"
{
'action/add_comment.php'
|
resource
}
"
method=
"POST"
id=
"comment_form"
>
<input
type=
"hidden"
name=
"poll"
value=
"
{
$poll_id
}
"
/>
{
if
!
empty
(
$admin_poll_id
)
}
<input
type=
"hidden"
name=
"poll_admin"
value=
"
{
$admin_poll_id
}
"
/>
{/
if
}
<div
class=
"hidden-print jumbotron"
>
<div
class=
"col-md-6 col-md-offset-3"
>
<fieldset
id=
"add-comment"
><legend>
{__('Comments', 'Add a comment to the poll')}
</legend>
...
...
Write
Preview
Supports
Markdown
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