Permalink
Browse files

- Solving problems when trying to autolink entries with apostrophes o…

…n it

- Idem, when importing entries.
  • Loading branch information...
1 parent 3bbde52 commit fd9f0ec83ae58781c9e0cba6a21788847b379dff willcast committed Nov 4, 2003
Showing with 13 additions and 10 deletions.
  1. +9 −6 mod/glossary/dynalink.php
  2. +4 −4 mod/glossary/import.php
View
@@ -67,15 +67,18 @@ function glossary_dynamic_link($courseid, $text) {
"onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid\&concept=$concept->concept', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
}
- $currentconcept = trim(strip_tags(str_replace("|", "\|", $concept->concept)));
- if ( !$concept->category ) {
- if ( $aliases = get_records("glossary_alias","entryid",$concept->id) ) {
- foreach ($aliases as $alias) {
- $currentconcept .= "|" . trim(strip_tags(str_replace("|", "\|", $alias->alias)));
+ $currentconcept = str_replace("|", "\|", $concept->concept);
+ $currentconcept = str_replace("'", "\'", $currentconcept);
+ if ( $currentconcept = trim(strip_tags($currentconcept)) ) {
+ if ( !$concept->category ) {
+ if ( $aliases = get_records("glossary_alias","entryid",$concept->id) ) {
+ foreach ($aliases as $alias) {
+ $currentconcept .= "|" . trim(strip_tags(str_replace("|", "\|", $alias->alias)));
+ }
}
}
+ $text = glossary_link_concepts($text,$currentconcept,$href_tag_begin, "</a>",$concept->casesensitive,$concept->fullmatch);
}
- $text = glossary_link_concepts($text,$currentconcept,$href_tag_begin, "</a>",$concept->casesensitive,$concept->fullmatch);
}
}
}
View
@@ -90,10 +90,10 @@
if ( $xmlglossary['NAME'][0]['#'] ) {
unset($glossary);
- $glossary->name = $xmlglossary['NAME'][0]['#'];
+ $glossary->name = addslashes(utf8_decode($xmlglossary['NAME'][0]['#']));
$glossary->course = $course->id;
$glossary->globalglossary = $xmlglossary['GLOBALGLOSSARY'][0]['#'];
- $glossary->intro = $xmlglossary['INTRO'][0]['#'];
+ $glossary->intro = addslashes(utf8_decode($xmlglossary['INTRO'][0]['#']));
$glossary->showspecial = $xmlglossary['SHOWSPECIAL'][0]['#'];
$glossary->showalphabet = $xmlglossary['SHOWALPHABET'][0]['#'];
$glossary->showall = $xmlglossary['SHOWALL'][0]['#'];
@@ -151,8 +151,8 @@
$xmlentry = $xmlentries[$i];
unset($newentry);
- $newentry->concept = $xmlentry['#']['CONCEPT'][0]['#'];
- $newentry->definition = $xmlentry['#']['DEFINITION'][0]['#'];
+ $newentry->concept = addslashes(utf8_decode($xmlentry['#']['CONCEPT'][0]['#']));
+ $newentry->definition = addslashes(utf8_decode($xmlentry['#']['DEFINITION'][0]['#']));
$permissiongranted = 1;
if ( $newentry->concept and $newentry->definition ) {

0 comments on commit fd9f0ec

Please sign in to comment.