--- moodle_wikidump.php	2009-05-20 15:27:35.000000000 +0100
+++ moodle_wikidump.php_old	2009-05-20 15:30:37.000000000 +0100
@@ -1,4 +1,4 @@
-<?php // $Id: moodle_wikidump.php,v 1.12.4.3 2009/05/10 15:27:35 stronk7 Exp $
+<?php // $Id$
 # ToDo: Binary Content
 #       Binary Linking
 /*
@@ -14,7 +14,7 @@
 #define("EWIKI_WIKIDUMP_ARCNAME", "WikiDump_");
 #define("EWIKI_WIKIDUMP_DEFAULTTYPE", "TAR");
 #define("EWIKI_WIKIDUMP_MAXLEVEL", 1);
-define('EWIKI_DUMP_FILENAME_REGEX',"/[^\\w+]/");
+define('EWIKI_DUMP_FILENAME_REGEX',"/\W\+/");
 
 #-- glue
 #if((function_exists(gzcompress) && EWIKI_WIKIDUMP_DEFAULTTYPE=="ZIP") || EWIKI_WIKIDUMP_DEFAULTTYPE=="TAR"){
@@ -330,16 +330,19 @@
         }
       }
   
+      # Do not translate links when wiki already in pure html - mode
+      if($wiki->htmlmode!=2) {
       $content=preg_replace_callback(
            '/(<a href=")(.*?)(\.html">)/',
             create_function(
             // single quotes are essential here,
             // or alternative escape all $ as \$
             '$matches',
-            'return($matches[1].urlencode(preg_replace(EWIKI_DUMP_FILENAME_REGEX,"",$matches[2])).$matches[3]);'
+            'return($matches[1].preg_replace(EWIKI_DUMP_FILENAME_REGEX,"",$matches[2]).$matches[3]);'
             ),
             $content
             );
+      }
       #-- add file
       // Let's make sure the file exists and is writable first.
       if (!$handle = fopen($exportdir."/".$fn, 'w')) {
@@ -366,8 +369,7 @@
         $timer=array();
         $level=-1;
         $fordump=1;
-		$fixedpagename = str_replace(' ','+',$wiki_entry->pagename);
-        $str_formatted="<ul>\n<li><a href=\"".($fixedpagename).$html_ext."\">".($wiki_entry->pagename)."</a></li>";
+        $str_formatted="<ul>\n<li><a href=\"".($wiki_entry->pagename).$html_ext."\">".($wiki_entry->pagename)."</a></li>";
         $fin_level=format_sitemap($a_sitemap, ($wiki_entry->pagename), $str_formatted, $level, $timer, $fordump);
         $str_formatted.="</ul>".str_pad("", $fin_level*6, "</ul>\n");
         $str_formatted=preg_replace_callback(
