Permalink
Browse files

Take care of empty aliases in glossary xml files when importing them.

See bug 1599. Thanks to skodak. :-)
http://moodle.org/bugs/bug.php?op=show&bugid=1599
  • Loading branch information...
1 parent 1194026 commit 49970424741a8b41f0e9f9059c5108a3d212c166 stronk7 committed Jun 28, 2004
Showing with 8 additions and 5 deletions.
  1. +8 −5 mod/glossary/import.php
View
@@ -205,11 +205,14 @@
for($k = 0; $k < sizeof($xmlaliases); $k++) {
/// Importing aliases
$xmlalias = $xmlaliases[$k];
- unset($newalias);
-
- $newalias->entryid = $newentry->id;
- $newalias->alias = addslashes(trim(utf8_decode($xmlalias['#']['NAME'][0]['#'])));
- $newalias->id = insert_record("glossary_alias",$newalias);
+ $aliasname = $xmlalias['#']['NAME'][0]['#'];
+
+ if (!empty($aliasname)) {
+ unset($newalias);
+ $newalias->entryid = $newentry->id;
+ $newalias->alias = addslashes(trim(utf8_decode($aliasname)));
+ $newalias->id = insert_record("glossary_alias",$newalias);
+ }
}
if ( $catsincl ) {

0 comments on commit 4997042

Please sign in to comment.