Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
70b78091
Commit
70b78091
authored
May 23, 2006
by
drumm
Browse files
#41042
by DriesK, Moshe, and Jaza, Duplicate tag handling
parent
7aa1963a
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/taxonomy.module
View file @
70b78091
...
...
@@ -734,8 +734,9 @@ function taxonomy_node_save($nid, $terms) {
// this, "somecmpany, llc", "and ""this"" w,o.rks", foo bar
$regexp
=
'%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'
;
preg_match_all
(
$regexp
,
$vid_value
,
$matches
);
$typed_terms
=
$matches
[
1
];
$typed_terms
=
array_unique
(
$matches
[
1
]
)
;
$inserted
=
array
();
foreach
(
$typed_terms
as
$typed_term
)
{
// If a user has escaped a term (to demonstrate that it is a group,
// or includes a comma or quote character), we remove the escape
...
...
@@ -760,7 +761,11 @@ function taxonomy_node_save($nid, $terms) {
$typed_term_tid
=
$edit
[
'tid'
];
}
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
// Defend against duplicate, different cased tags
if
(
!
isset
(
$inserted
[
$typed_term_tid
]))
{
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
$inserted
[
$typed_term_tid
]
=
TRUE
;
}
}
}
}
...
...
modules/taxonomy/taxonomy.module
View file @
70b78091
...
...
@@ -734,8 +734,9 @@ function taxonomy_node_save($nid, $terms) {
// this, "somecmpany, llc", "and ""this"" w,o.rks", foo bar
$regexp
=
'%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'
;
preg_match_all
(
$regexp
,
$vid_value
,
$matches
);
$typed_terms
=
$matches
[
1
];
$typed_terms
=
array_unique
(
$matches
[
1
]
)
;
$inserted
=
array
();
foreach
(
$typed_terms
as
$typed_term
)
{
// If a user has escaped a term (to demonstrate that it is a group,
// or includes a comma or quote character), we remove the escape
...
...
@@ -760,7 +761,11 @@ function taxonomy_node_save($nid, $terms) {
$typed_term_tid
=
$edit
[
'tid'
];
}
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
// Defend against duplicate, different cased tags
if
(
!
isset
(
$inserted
[
$typed_term_tid
]))
{
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
$inserted
[
$typed_term_tid
]
=
TRUE
;
}
}
}
}
...
...
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