Permalink
Browse files

Fix for Bug #1820 - wiki export does not keep correct links

Create filenames with + (next+page.html).
  • Loading branch information...
skaldrom
skaldrom committed Sep 3, 2004
1 parent 766634b commit d9742e40712889bea04b6ccede3b2743732670aa
Showing with 14 additions and 8 deletions.
  1. +13 −8 mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
  2. +1 −0 mod/wiki/view.php
@@ -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"){
@@ -72,7 +72,7 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
'<INPUT TYPE="HIDDEN" NAME="wikipage" VALUE="'.$wikipage.'">'."\n".
"<CENTER>\n";
- // Export binaroes too ?
+ // Export binaries too ?
if(!$wiki->ewikiacceptbinary) {
$ret.='<INPUT TYPE="HIDDEN" NAME="exportbinaries" VALUE="0">'.$exportdestinations[0]."\n";
} else {
@@ -139,12 +139,14 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
$filestozip=array();
#-- disable protected email
- foreach($ewiki_plugins["link_url"] as $key => $linkplugin){
- if($linkplugin == "ewiki_email_protect_link"){
- unset($ewiki_plugins["link_url"][$key]);
+ if(count($ewiki_plugins["link_url"])) {
+ foreach($ewiki_plugins["link_url"] as $key => $linkplugin){
+ if($linkplugin == "ewiki_email_protect_link"){
+ unset($ewiki_plugins["link_url"][$key]);
+ }
}
}
-
+
/// HTML-Export
if($exportformats==1) {
#-- if exportformats is html
@@ -249,8 +251,7 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
#-- convert all pages
- foreach($a_pagelist as $pagename){
-
+ foreach($a_pagelist as $pagename){
if ((!in_array($pagename, $a_virtual))) {
$id = $pagename;
#-- not a virtual page
@@ -273,8 +274,10 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
if (empty($content)){
switch ($row["flags"] & EWIKI_DB_F_TYPE) {
+ // Text Page
case (EWIKI_DB_F_TEXT):
#print "<pre>"; print_r($row[content]); print "\n-------------</pre>";
+
if($exportformats==1) {/// HTML-Export
$content = ewiki_format($row["content"]);
} else {
@@ -285,6 +288,7 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
if($exportformats==1) {
$content = str_replace($a_images, $a_rimages, $content);
}
+
$fn = preg_replace(EWIKI_DUMP_FILENAME_REGEX, "", urlencode($id));
$fn = $fn.$html_ext;
if($exportformats==1) {/// HTML-Export
@@ -427,6 +431,7 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
if(!deldir($exportbasedir)) {
error("Cannot delete $exportbasedir");
}
+ #exit();
return false;
} else {
return get_string("exportsuccessful","wiki")."<br>";
View
@@ -125,6 +125,7 @@
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/feature/imgresize_gd.php");
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/moodle/moodle_highlight.php");
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/moodle/f_fixhtml.php");
+ include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/moodle/wikinews.php");
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/moodle/sitemap.php");
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php");
include_once($CFG->dirroot."/mod/wiki/ewiki/plugins/aview/backlinks.php");

0 comments on commit d9742e4

Please sign in to comment.