Example #1
0
function ewiki_page_wiki_dump_tarball($id, $data, $action)
{
    #-- return legacy page
    if (empty($_REQUEST["download_tarball"])) {
        $url = ewiki_script("", $id);
        return ewiki_make_title($id, $id, 2) . ewiki_t(<<<END
_{WIKIDUMP}
<br /><br />
<form action="{$url}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$id}">
<input type="submit" name="download_tarball" value="_{download tarball}">
<br /><br />
<input type="checkbox" name="dump_images" value="1"> _{with images}<br />
<input type="checkbox" name="dump_virtual" value="1"> _{include virtual pages}<br />
<input type="checkbox" name="dump_fullhtml" value="1" checked> _{complete .html files}<br />
&nbsp; &nbsp; &nbsp; <input type="checkbox" name="dump_linksto" value="1"> _{with backlink pages}<br />
</form>
END
);
    } else {
        $di = $_REQUEST["dump_images"];
        $fh = $_REQUEST["dump_fullhtml"];
        $bl = $_REQUEST["dump_linksto"];
        $vp = $_REQUEST["dump_virtual"];
        $_REQUEST = $_GET = $_POST = array();
        set_time_limit(180);
        ewiki_page_wiki_dump_send($di, $fh, $vp, $bl);
    }
}
Example #2
0
function ewiki_page_wiki_dump_tarball($id = 0, $data = 0, $action = 0)
{
    #-- return legacy page
    if (empty($_REQUEST["download_tarball"])) {
        if ($action == "wikidump") {
            $url = ewiki_script("", "WikiDump");
            return ewiki_make_title($id, $id, 2) . ewiki_t(<<<END
_{WIKIDUMP}
<br /><br />
<form action="{$url}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="dump_id" value="{$id}">
<input type="hidden" name="dump_depth" value=1>
<input type="submit" name="download_tarball" value= "_{DOWNLOAD_ARCHIVE}">
<br /><br />
<input type="checkbox" name="dump_images" value="1" checked> _{with images}<br />
<input type="hidden" name="dump_fullhtml" value="1">
<input type="hidden" name="dump_virtual" value="0"><br />
Archive Format:
<select NAME="dump_arctype">
  <option VALUE="ZIP">ZIP
  <option VALUE="TAR">TAR
</select>

</form>
END
);
        } else {
            return "";
        }
    } else {
        $di = $_REQUEST["dump_images"];
        $fh = $_REQUEST["dump_fullhtml"];
        $vp = $_REQUEST["dump_virtual"];
        $rp = $_REQUEST["dump_id"];
        #-- $_REQUEST["dump_depth"]==100 will give a complete dump
        if ($_REQUEST["dump_depth"] > EWIKI_WIKIDUMP_MAXLEVEL && $_REQUEST["dump_depth"] != 100) {
            $dd = EWIKI_WIKIDUMP_MAXLEVEL;
        } else {
            $dd = $_REQUEST["dump_depth"];
        }
        $at = $_REQUEST["dump_arctype"];
        $al = 9;
        #$_REQUEST["dump_arclevel"];
        $_REQUEST = $_GET = $_POST = array();
        if (!ewiki_auth($rp, $str_null, "view")) {
            return ewiki_make_title($id, $id, 2) . "<p>You either do not have permission to access the page {$rp} or it does not exist.</p>";
        }
        ewiki_page_wiki_dump_send($di, $fh, $vp, $rp, $dd, $at, $al);
    }
}
function moodle_ewiki_page_wiki_dump($id = 0, $data = 0, $action = 0)
{
    global $userid, $groupid, $cm, $wikipage, $wiki, $course, $CFG;
    #-- return legacy page
    $cont = true;
    if (!empty($_REQUEST["wikiexport"])) {
        $binaries = $_REQUEST["exportbinaries"];
        if (!$wiki->ewikiacceptbinary) {
            $binaries = 0;
        }
        $exportformats = $_REQUEST["exportformats"];
        if ($wiki->htmlmode == 2) {
            $exportformats = 1;
        }
        $cont = ewiki_page_wiki_dump_send($binaries, $exportformats, $_REQUEST["withvirtualpages"], $_REQUEST["exportdestinations"]);
    }
    if ($cont === false) {
        die;
    }
    $url = ewiki_script("", "WikiExport");
    $ret = ewiki_make_title($id, ewiki_t($id), 2);
    $ret .= $cont && $cont !== true ? $cont . "<br /><br />\n" : "";
    $ret .= get_string("wikiexportcomment", "wiki");
    // removing name="form" from the following form as it does not validate
    // and is not referenced. MDL-7861
    $ret .= "<br /><br />\n" . '<FORM method="post" action="view.php">' . "\n" . "<div class=\"wikiexportbox\">\n" . '<INPUT type="hidden" name="page" value="WikiExport" />' . "\n" . '<INPUT type="hidden" name="userid" value="' . $userid . '" />' . "\n" . '<INPUT type="hidden" name="groupid" value="' . $groupid . '" />' . "\n" . '<INPUT type="hidden" name="id" value="' . $cm->id . '" />' . "\n" . '<INPUT type="hidden" name="wikipage" value="' . $wikipage . '" />' . "\n";
    // Export binaries too ?
    if (!$wiki->ewikiacceptbinary) {
        $ret .= '<INPUT type="hidden" name="exportbinaries" value="0" />' . $exportdestinations[0] . "\n";
    } else {
        $ret .= '<INPUT type="hidden" name="exportbinaries" value="0" />' . "\n";
    }
    $ret .= "<TABLE cellpadding=\"5\">\n";
    if ($wiki->ewikiacceptbinary) {
        $ret .= "  <TR valign=\"top\">\n" . '    <TD align="right">' . get_string("withbinaries", "wiki") . ":</TD>\n" . "    <TD>\n" . '      <input type="checkbox" name="exportbinaries" value="1"' . ($_REQUEST["exportbinaries"] == 1 ? " checked" : "") . " />\n" . "    </TD>\n" . "  </TR>\n";
    }
    $ret .= "  <TR valign=\"top\">\n" . '    <TD align="right">' . get_string("withvirtualpages", "wiki") . ":</TD>\n" . "    <TD>\n" . '      <input type="checkbox" name="withvirtualpages" value="1"' . ($_REQUEST["withvirtualpages"] == 1 ? " checked" : "") . " />\n" . "    </TD>\n" . "  </TR>\n";
    $exportformats = array("0" => get_string("plaintext", "wiki"), "1" => get_string("html", "wiki"));
    /// Formats
    $ret .= "  <TR valign=\"top\">\n" . '    <TD align="right">' . get_string("exportformats", "wiki") . ":</TD>\n" . "    <TD>\n";
    if ($wiki->htmlmode != 2) {
        $ret .= choose_from_menu($exportformats, "exportformats", $_REQUEST["exportformats"], "", "", "", true) . "\n";
    } else {
        $ret .= '<INPUT type="hidden" name="exportformats" value="1" />' . get_string("html", "wiki");
    }
    $ret .= "    </TD>\n" . "  </TR>\n";
    /// Destination
    $exportdestinations = array("0" => get_string("downloadaszip", "wiki"));
    if (wiki_is_teacher($wiki)) {
        // Get Directory List
        $rawdirs = get_directory_list("{$CFG->dataroot}/{$course->id}", 'moddata', true, true, false);
        foreach ($rawdirs as $rawdir) {
            $exportdestinations[$rawdir] = get_string("moduledirectory", "wiki") . ": " . $rawdir;
        }
    }
    $ret .= "  <TR valign=\"top\">\n" . '    <TD align="right">' . get_string("exportto", "wiki") . ":</TD>\n" . "    <TD>\n";
    if (count($exportdestinations) == 1) {
        $ret .= '<INPUT type="hidden" name="exportdestinations" value="0" />' . $exportdestinations[0] . "\n";
    } else {
        $ret .= choose_from_menu($exportdestinations, "exportdestinations", $_REQUEST["exportdestinations"], "", "", "", true) . "\n";
    }
    $ret .= "    </TD>\n" . "  </TR>\n" . "</TABLE>\n" . '  <input type="submit" name="wikiexport" value= "' . get_string("export", "wiki") . '" />' . "\n" . "</div>\n";
    "</FORM>\n";
    return $ret;
}