Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
6565d5c0
Commit
6565d5c0
authored
Apr 16, 2010
by
Richard Mansfield
Browse files
Check content for spam on anonymous feedback
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
8b9ae69b
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/comment/lib.php
View file @
6565d5c0
...
...
@@ -466,7 +466,7 @@ class ArtefactTypeComment extends ArtefactType {
if
(
!
$USER
->
is_logged_in
())
{
$form
[
'spam'
]
=
array
(
'secret'
=>
get_config
(
'formsecret'
),
'mintime'
=>
3
,
'mintime'
=>
1
,
'hash'
=>
array
(
'authorname'
,
'message'
,
'ispublic'
,
'message'
,
'submit'
),
);
$form
[
'elements'
][
'authorname'
]
=
array
(
...
...
@@ -700,6 +700,27 @@ function delete_comment_submit(Pieform $form, $values) {
redirect
(
$url
);
}
function
add_feedback_form_validate
(
Pieform
$form
,
$values
)
{
if
(
$form
->
get_property
(
'spam'
))
{
require_once
(
get_config
(
'libroot'
)
.
'antispam.php'
);
$spamtrap
=
new_spam_trap
(
array
(
array
(
'type'
=>
'body'
,
'value'
=>
$values
[
'message'
],
),
));
if
(
$form
->
spam_error
()
||
$spamtrap
->
is_spam
())
{
$msg
=
get_string
(
'formerror'
);
$emailcontact
=
get_config
(
'emailcontact'
);
if
(
!
empty
(
$emailcontact
))
{
$msg
.
=
' '
.
get_string
(
'formerroremail'
,
'mahara'
,
$emailcontact
,
$emailcontact
);
}
$form
->
set_error
(
'message'
,
$msg
);
}
}
}
function
add_feedback_form_submit
(
Pieform
$form
,
$values
)
{
global
$view
,
$artefact
,
$USER
;
$data
=
(
object
)
array
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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