Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
captcha-3321861
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
captcha-3321861
Commits
1d23c5d5
Commit
1d23c5d5
authored
14 years ago
by
soxofaan
Browse files
Options
Downloads
Patches
Plain Diff
handle comment forms now per node type (D6: comment_form -> D7: comment_node_{type}_form)
parent
a0583ff0
No related branches found
Branches containing commit
Tags
8.x-1.0-beta1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
captcha.install
+31
-3
31 additions, 3 deletions
captcha.install
with
31 additions
and
3 deletions
captcha.install
+
31
−
3
View file @
1d23c5d5
...
...
@@ -136,11 +136,14 @@ function captcha_install() {
$t
=
get_t
();
// Insert some default CAPTCHA points.
$form_ids
=
array
(
'comment_node_page_form'
,
'contact_site_form'
,
'contact_personal_form'
,
'user_register_form'
,
'user_pass'
,
'user_login'
,
'user_login_block'
,
'forum_node_form'
);
// Add form_ids of all currently known node types too.
foreach
(
node_type_get_names
()
as
$type
=>
$name
)
{
$form_ids
[]
=
'comment_node_'
.
$type
.
'_form'
;
}
foreach
(
$form_ids
as
$form_id
)
{
db_insert
(
'captcha_points'
)
->
fields
(
array
(
...
...
@@ -359,6 +362,31 @@ function captcha_update_7000() {
->
fields
(
array
(
'form_id'
=>
'contact_personal_form'
))
->
condition
(
'form_id'
,
'contact_mail_user'
)
->
execute
();
// TODO: the general comment_form form_id is also split
// in comment_node_{type}_form, e.g. comment_node_page_form
// The D6-style comment_form form_id is split per node type
// in D7: comment_node_{type}_form, e.g. comment_node_page_form.
// Get the current settings for 'comment_form'.
$captcha_point
=
db_query
(
"SELECT * FROM
{
captcha_points
}
WHERE form_id = :comment_form_id"
,
array
(
':comment_form_id'
=>
'comment_form'
)
)
->
fetchObject
();
if
(
$captcha_point
!==
FALSE
)
{
// Create entries for D7-style node form IDs.
$module
=
$captcha_point
->
module
;
$captcha_type
=
$captcha_point
->
captcha_type
;
foreach
(
node_type_get_names
()
as
$type
=>
$name
)
{
$form_id
=
'comment_node_'
.
$type
.
'_form'
;
db_insert
(
'captcha_points'
)
->
fields
(
array
(
'form_id'
=>
$form_id
,
'module'
=>
$module
,
'captcha_type'
=>
$captcha_type
,
))
->
execute
();
}
// Delete outdated entry.
db_delete
(
'captcha_points'
)
->
condition
(
'form_id'
,
'comment_form'
)
->
execute
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment