]> git.mjollnir.org Git - moodle.git/commitdiff
fixes HTM files parsing
authordiml <diml>
Mon, 7 Apr 2008 19:56:44 +0000 (19:56 +0000)
committerdiml <diml>
Mon, 7 Apr 2008 19:56:44 +0000 (19:56 +0000)
search/documents/physical_htm.php

index b336443ea9870b6670177c36b4e664f8a4202cb5..90b8c0100eb9485f4d7a945c07b1a453bdcbd8f0 100644 (file)
@@ -24,16 +24,16 @@ function get_text_for_indexing_htm(&$resource){
     if (!isadmin($USER->id)) return;
 
     // just get text
-    $text = implode('', file("{$CFG->dataroot}/{$resource->course}/($resource->reference)"));
+    $text = implode('', file("{$CFG->dataroot}/{$resource->course}/{$resource->reference}"));
 
     // extract keywords and other interesting meta information and put it back as real content for indexing
-    if (preg_match('/(.*)<meta ([^>]*)>(.*)/is',$text, $matches)){
+    if (preg_match('/(.*)<meta ([^>]*)>(.*)/is', $text, $matches)){
         $prefix = $matches[1];
         $meta_attributes = $matches[2];
         $suffix = $matches[3];
-        if (preg_match('/name="(keywords|description)"/i', $attributes)){
-            preg_match('/content="[^"]+"/i', $attributes, $matches);
-            $text = $prefix.' '.$matches[1].' '.$suffix;
+        if (preg_match('/name="(keywords|description)"/i', $meta_attributes)){
+            preg_match('/content="[^"]+"/i', $meta_attributes, $matches);
+            $text = $prefix.' '.$matches[0].' '.$suffix;
         }
     }
     // filter all html tags