From: willcast Date: Tue, 4 Nov 2003 15:04:35 +0000 (+0000) Subject: - Solving problems when trying to autolink entries with apostrophes on it X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fd9f0ec83ae58781c9e0cba6a21788847b379dff;p=moodle.git - Solving problems when trying to autolink entries with apostrophes on it - Idem, when importing entries. --- diff --git a/mod/glossary/dynalink.php b/mod/glossary/dynalink.php index b48d07e6b3..74e7543992 100644 --- a/mod/glossary/dynalink.php +++ b/mod/glossary/dynalink.php @@ -67,15 +67,18 @@ "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, "",$concept->casesensitive,$concept->fullmatch); } - $text = glossary_link_concepts($text,$currentconcept,$href_tag_begin, "",$concept->casesensitive,$concept->fullmatch); } } } diff --git a/mod/glossary/import.php b/mod/glossary/import.php index 58aeb26fcd..a78f951cf6 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -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 ) {