]> git.mjollnir.org Git - moodle.git/commitdiff
- Solving problems when trying to autolink entries with apostrophes on it
authorwillcast <willcast>
Tue, 4 Nov 2003 15:04:35 +0000 (15:04 +0000)
committerwillcast <willcast>
Tue, 4 Nov 2003 15:04:35 +0000 (15:04 +0000)
- Idem, when importing entries.

mod/glossary/dynalink.php
mod/glossary/import.php

index b48d07e6b3200be7833dd424f790cd393d4c81ca..74e75439926efb1b1431e40b04fcd76995b765d6 100644 (file)
                              "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);
                 }
             }
         }
index 58aeb26fcd18c7af1ef7bf2ab357a68e0c8a0d36..a78f951cf6722182b7a39ca929ddf9d0d2e042cb 100644 (file)
     
             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]['#'];
             $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 ) {