diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-12-11 20:22:59 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-12-11 20:22:59 +0000 |
commit | 56ac29fad891078c20c06e3d5e1f29a045f65e13 (patch) | |
tree | 2e2827086de3a0c8dab479b7b3b692cee6a101cf /modules | |
parent | 81a6bcd7a2d3509ea9a55a81f8db0c744003b2f0 (diff) | |
download | brdo-56ac29fad891078c20c06e3d5e1f29a045f65e13.tar.gz brdo-56ac29fad891078c20c06e3d5e1f29a045f65e13.tar.bz2 |
- Avoid empty synonyms being inserted. Patch by Marco.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/taxonomy.module | 6 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index d7a0c244d..150acf060 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -206,8 +206,10 @@ function taxonomy_save_term($edit) { // synonyms (very cool idea indeed) db_query("DELETE FROM term_synonym WHERE tid = '%d'", $edit["tid"]); if ($edit["synonyms"]) { - foreach (explode ("\n", $edit["synonyms"]) as $synonym) { - db_query("INSERT INTO term_synonym (tid, name) VALUES ('%d', '%s')", $edit["tid"], chop($synonym)); + foreach (explode ("\n", str_replace("\r", "", $edit["synonyms"])) as $synonym) { + if ($synonym) { + db_query("INSERT INTO term_synonym (tid, name) VALUES ('%d', '%s')", $edit["tid"], chop($synonym)); + } } } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index d7a0c244d..150acf060 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -206,8 +206,10 @@ function taxonomy_save_term($edit) { // synonyms (very cool idea indeed) db_query("DELETE FROM term_synonym WHERE tid = '%d'", $edit["tid"]); if ($edit["synonyms"]) { - foreach (explode ("\n", $edit["synonyms"]) as $synonym) { - db_query("INSERT INTO term_synonym (tid, name) VALUES ('%d', '%s')", $edit["tid"], chop($synonym)); + foreach (explode ("\n", str_replace("\r", "", $edit["synonyms"])) as $synonym) { + if ($synonym) { + db_query("INSERT INTO term_synonym (tid, name) VALUES ('%d', '%s')", $edit["tid"], chop($synonym)); + } } } |