function _pagename2filename($type, $pagename, $version) { $fpagename = FilenameForPage($pagename); if (strstr($fpagename, "/")) { $fpagename = preg_replace("/\\//", "%2F", $fpagename); } return $this->_dir_names[$type] . '/' . $fpagename; /* if ($version == 0) return $this->_dir_names[$type].'/'.FilenameForPage($pagename); else return $this->_dir_names[$type].'/'.FilenameForPage($pagename).'--'.$version; */ }
function MakeWikiZipHtml(&$request) { $request->_TemplatesProcessed = array(); $zipname = "wikihtml.zip"; $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $zipname); $dbi =& $request->_dbi; $thispage = $request->getArg('pagename'); // for "Return to ..." if ($exclude = $request->getArg('exclude')) { // exclude which pagenames $excludeList = explodePageList($exclude); } else { $excludeList = array(); } if ($pages = $request->getArg('pages')) { // which pagenames if ($pages == '[]') { // current page $pages = $thispage; } $page_iter = new WikiDB_Array_PageIterator(explodePageList($pages)); } else { $page_iter = $dbi->getAllPages(false, false, false, $excludeList); } global $WikiTheme; if (defined('HTML_DUMP_SUFFIX')) { $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; } $WikiTheme->DUMP_MODE = 'ZIPHTML'; $_bodyAttr = @$WikiTheme->_MoreAttr['body']; unset($WikiTheme->_MoreAttr['body']); /* ignore fatals in plugins */ if (check_php_version(4, 1)) { global $ErrorManager; $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler')); } $request_args = $request->args; $timeout = !$request->getArg('start_debug') ? 20 : 240; while ($page = $page_iter->next()) { $request->args = $request_args; // some plugins might change them (esp. on POST) longer_timeout($timeout); // Reset watchdog $current = $page->getCurrentRevision(); if ($current->getVersion() == 0) { continue; } $pagename = $page->getName(); if (in_array($pagename, $excludeList)) { continue; } $attrib = array('mtime' => $current->get('mtime'), 'is_ascii' => 1); if ($page->get('locked')) { $attrib['write_protected'] = 1; } $request->setArg('pagename', $pagename); // Template::_basepage fix $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX; $revision = $page->getCurrentRevision(); $transformedContent = $revision->getTransformedContent(); $template = new Template('browse', $request, array('revision' => $revision, 'CONTENT' => $transformedContent)); $data = GeneratePageasXML($template, $pagename); $zip->addRegularFile($filename, $data, $attrib); if (USECACHE) { $request->_dbi->_cache->invalidate_cache($pagename); unset($request->_dbi->_cache->_pagedata_cache); unset($request->_dbi->_cache->_versiondata_cache); unset($request->_dbi->_cache->_glv_cache); } unset($request->_dbi->_cache->_backend->_page_data); unset($revision->_transformedContent); unset($revision); unset($template->_request); unset($template); unset($data); } $page_iter->free(); $attrib = false; // Deal with css and images here. if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) { // dirs are created automatically //if ($WikiTheme->dumped_images) $zip->addRegularFile("images", "", $attrib); foreach ($WikiTheme->dumped_images as $img_file) { if ($from = $WikiTheme->_findFile($img_file, true) and basename($from)) { $target = "images/" . basename($img_file); if (check_php_version(4, 3)) { $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib); } else { $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib); } } } } if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) { //if ($WikiTheme->dumped_buttons) $zip->addRegularFile("images/buttons", "", $attrib); foreach ($WikiTheme->dumped_buttons as $text => $img_file) { if ($from = $WikiTheme->_findFile($img_file, true) and basename($from)) { $target = "images/buttons/" . basename($img_file); if (check_php_version(4, 3)) { $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib); } else { $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib); } } } } if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) { foreach ($WikiTheme->dumped_css as $css_file) { if ($from = $WikiTheme->_findFile(basename($css_file), true) and basename($from)) { $target = basename($css_file); if (check_php_version(4, 3)) { $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib); } else { $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib); } } } } $zip->finish(); if (check_php_version(4, 1)) { global $ErrorManager; $ErrorManager->popErrorHandler(); } $WikiTheme->HTML_DUMP_SUFFIX = ''; $WikiTheme->DUMP_MODE = false; $WikiTheme->_MoreAttr['body'] = $_bodyAttr; }
function _DumpHtmlToDir($target, $page_iter, $exclude = false) { global $WikiTheme, $request, $ErrorManager; $silent = true; $zip = false; $directory = false; if ($WikiTheme->DUMP_MODE == 'HTML') { $directory = $target; $silent = false; } elseif ($WikiTheme->DUMP_MODE == 'PDFHTML') { $directory = $target; } elseif (is_object($target)) { // $WikiTheme->DUMP_MODE == 'ZIPHTML' $zip = $target; } $request->_TemplatesProcessed = array(); if ($exclude) { // exclude which pagenames $excludeList = explodePageList($exclude); } else { $excludeList = array('DebugAuthInfo', 'DebugGroupInfo', 'AuthInfo'); } $WikiTheme->VALID_LINKS = array(); if ($request->getArg('format')) { // pagelist $page_iter_sav = $page_iter; foreach ($page_iter_sav->asArray() as $handle) { $WikiTheme->VALID_LINKS[] = is_string($handle) ? $handle : $handle->getName(); } $page_iter_sav->reset(); } if (defined('HTML_DUMP_SUFFIX')) { $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; } $_bodyAttr = @$WikiTheme->_MoreAttr['body']; unset($WikiTheme->_MoreAttr['body']); $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler')); // check if the dumped file will be accessible from outside $doc_root = $request->get("DOCUMENT_ROOT"); if ($WikiTheme->DUMP_MODE == 'HTML') { $ldir = NormalizeLocalFileName($directory); $wikiroot = NormalizeLocalFileName(''); if (string_starts_with($ldir, $doc_root)) { $link_prefix = substr($directory, strlen($doc_root)) . "/"; } elseif (string_starts_with($ldir, $wikiroot)) { $link_prefix = NormalizeWebFileName(substr($directory, strlen($wikiroot))) . "/"; } else { $prefix = ''; if (isWindows()) { $prefix = '/'; // . substr($doc_root,0,2); // add drive where apache is installed } $link_prefix = "file://" . $prefix . $directory . "/"; } } else { $link_prefix = ""; } $request_args = $request->args; $timeout = !$request->getArg('start_debug') ? 60 : 240; if ($directory) { if (isWindows()) { $directory = str_replace("\\", "/", $directory); } // no Win95 support. @mkdir("{$directory}/images"); } $already = array(); $outfiles = array(); $already_images = array(); while ($page = $page_iter->next()) { if (is_string($page)) { $pagename = $page; $page = $request->_dbi->getPage($pagename); } else { $pagename = $page->getName(); } if (empty($firstpage)) { $firstpage = $pagename; } if (array_key_exists($pagename, $already)) { continue; } $already[$pagename] = 1; $current = $page->getCurrentRevision(); //if ($current->getVersion() == 0) // continue; $request->args = $request_args; // some plugins might change them (esp. on POST) longer_timeout($timeout); // Reset watchdog if ($zip) { $attrib = array('mtime' => $current->get('mtime'), 'is_ascii' => 1); if ($page->get('locked')) { $attrib['write_protected'] = 1; } } elseif (!$silent) { if (!isa($request, 'MockRequest')) { PrintXML(HTML::br(), $pagename, ' ... '); flush(); } } if (in_array($pagename, $excludeList)) { if (!$silent and !isa($request, 'MockRequest')) { PrintXML(_("Skipped.")); flush(); } continue; } $relative_base = ''; if ($WikiTheme->DUMP_MODE == 'PDFHTML') { $request->setArg('action', 'pdf'); } // to omit cache headers $request->setArg('pagename', $pagename); // Template::_basepage fix $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX; $args = array('revision' => $current, 'CONTENT' => $current->getTransformedContent(), 'relative_base' => $relative_base); // For every %2F will need to mkdir -p dirname($pagename) if (preg_match("/(%2F|\\/)/", $filename)) { // mkdir -p and set relative base for subdir pages $filename = preg_replace("/%2F/", "/", $filename); $count = substr_count($filename, "/"); $dirname = dirname($filename); if ($directory) { mkdir_p($directory . "/" . $dirname); } // Fails with "XX / YY", "XX" is created, "XX / YY" cannot be written // if (isWindows()) // interesting Windows bug: cannot mkdir "bla " // Since dumps needs to be copied, we have to disallow this for all platforms. $filename = preg_replace("/ \\//", "/", $filename); $relative_base = "../"; while ($count > 1) { $relative_base .= "../"; $count--; } $args['relative_base'] = $relative_base; } $msg = HTML(); $DUMP_MODE = $WikiTheme->DUMP_MODE; $data = GeneratePageasXML(new Template('browse', $request, $args), $pagename, $current, $args); $WikiTheme->DUMP_MODE = $DUMP_MODE; if (preg_match_all("/<img .*?src=\"(\\/.+?)\"/", $data, $m)) { // fix to local relative path for uploaded images, so that pdf will work foreach ($m[1] as $img_file) { $base = basename($img_file); $data = str_replace('src="' . $img_file . '"', 'src="images/' . $base . '"', $data); if (array_key_exists($img_file, $already_images)) { continue; } $already_images[$img_file] = 1; // resolve src from webdata to file $src = $doc_root . $img_file; if (file_exists($src) and $base) { if ($directory) { $target = "{$directory}/images/{$base}"; if (copy($src, $target)) { if (!$silent) { _copyMsg($img_file, fmt("... copied to %s", $target)); } } else { if (!$silent) { _copyMsg($img_file, fmt("... not copied to %s", $target)); } } } else { $target = "images/{$base}"; $zip->addSrcFile($target, $src); } } } } if ($directory) { $outfile = $directory . "/" . $filename; if (!($fd = fopen($outfile, "wb"))) { $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing", $outfile))); $request->finish($msg); } $len = strlen($data); $num = fwrite($fd, $data, $len); if ($pagename != $filename) { $link = LinkURL($link_prefix . $filename, $filename); $msg->pushContent(HTML::small(_("saved as "), $link, " ... ")); } $msg->pushContent(HTML::small(fmt("%s bytes written", $num), "\n")); if (!$silent) { if (!isa($request, 'MockRequest')) { PrintXML($msg); } flush(); $request->chunkOutput(); } assert($num == $len); fclose($fd); $outfiles[] = $outfile; } else { $zip->addRegularFile($filename, $data, $attrib); } if (USECACHE) { $request->_dbi->_cache->invalidate_cache($pagename); unset($request->_dbi->_cache->_pagedata_cache); unset($request->_dbi->_cache->_versiondata_cache); unset($request->_dbi->_cache->_glv_cache); } unset($request->_dbi->_cache->_backend->_page_data); unset($msg); unset($current->_transformedContent); unset($current); if (!empty($template)) { unset($template->_request); unset($template); } unset($data); } $page_iter->free(); $attrib = false; //array('is_ascii' => 0); if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) { // @mkdir("$directory/images"); foreach ($WikiTheme->dumped_images as $img_file) { if (array_key_exists($img_file, $already_images)) { continue; } $already_images[$img_file] = 1; if ($img_file and $from = $WikiTheme->_findFile($img_file, true) and basename($from)) { if ($directory) { $target = "{$directory}/images/" . basename($from); if ($silent) { copy($WikiTheme->_path . $from, $target); } else { if (copy($WikiTheme->_path . $from, $target)) { _copyMsg($from, fmt("... copied to %s", $target)); } else { _copyMsg($from, fmt("... not copied to %s", $target)); } } } else { $target = "images/" . basename($from); $zip->addSrcFile($target, $WikiTheme->_path . $from); } } elseif (!$silent) { _copyMsg($from, _("... not found")); } } } if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) { // Buttons also if ($directory) { @mkdir("{$directory}/images/buttons"); } foreach ($WikiTheme->dumped_buttons as $text => $img_file) { if (array_key_exists($img_file, $already_images)) { continue; } $already_images[$img_file] = 1; if ($img_file and $from = $WikiTheme->_findFile($img_file, true) and basename($from)) { if ($directory) { $target = "{$directory}/images/buttons/" . basename($from); if ($silent) { copy($WikiTheme->_path . $from, $target); } else { if (copy($WikiTheme->_path . $from, $target)) { _copyMsg($from, fmt("... copied to %s", $target)); } else { _copyMsg($from, fmt("... not copied to %s", $target)); } } } else { $target = "images/buttons/" . basename($from); $zip->addSrcFile($target, $WikiTheme->_path . $from); } } elseif (!$silent) { _copyMsg($from, _("... not found")); } } } if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) { foreach ($WikiTheme->dumped_css as $css_file) { if (array_key_exists($css_file, $already_images)) { continue; } $already_images[$css_file] = 1; if ($css_file and $from = $WikiTheme->_findFile(basename($css_file), true) and basename($from)) { // TODO: fix @import url(main.css); if ($directory) { $target = "{$directory}/" . basename($css_file); if ($silent) { copy($WikiTheme->_path . $from, $target); } else { if (copy($WikiTheme->_path . $from, $target)) { _copyMsg($from, fmt("... copied to %s", $target)); } else { _copyMsg($from, fmt("... not copied to %s", $target)); } } } else { //$attrib = array('is_ascii' => 0); $target = basename($css_file); $zip->addSrcFile($target, $WikiTheme->_path . $from); } } elseif (!$silent) { _copyMsg($from, _("... not found")); } } } if ($zip) { $zip->finish(); } if ($WikiTheme->DUMP_MODE == 'PDFHTML') { if (USE_EXTERNAL_HTML2PDF and $outfiles) { $cmd = EXTERNAL_HTML2PDF_PAGELIST . ' "' . join('" "', $outfiles) . '"'; $filename = FilenameForPage($firstpage); if (DEBUG) { $tmpfile = $directory . "/createpdf.bat"; $fp = fopen($tmpfile, "wb"); fwrite($fp, $cmd . " > {$filename}.pdf"); fclose($fp); } if (!headers_sent()) { Header('Content-Type: application/pdf'); passthru($cmd); } else { $tmpdir = getUploadFilePath(); $s = passthru($cmd . " > {$tmpdir}/{$filename}.pdf"); $errormsg = "<br />\nGenerated <a href=\"" . getUploadDataPath() . "{$filename}.pdf\">Upload:{$filename}.pdf</a>\n"; $errormsg .= $s; echo $errormsg; } if (!DEBUG) { foreach ($outfiles as $f) { unlink($f); } } } if (!empty($errormsg)) { $request->discardOutput(); $GLOBALS['ErrorManager']->_postponed_errors = array(); } } $ErrorManager->popErrorHandler(); $WikiTheme->HTML_DUMP_SUFFIX = ''; $WikiTheme->DUMP_MODE = false; $WikiTheme->_MoreAttr['body'] = $_bodyAttr; }
function dumpFile(&$thispage, $filename) { include_once "lib/loadsave.php"; $mailified = MailifyPage($thispage); $attrib = array('mtime' => $thispage->get('mtime'), 'is_ascii' => 1); $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $filename); $zip->addRegularFile(FilenameForPage($thispage->getName()), $mailified, $attrib); $zip->finish(); }
function actionPage(&$request, $action) { global $WikiTheme; global $robots; $pagename = $request->getArg('pagename'); $version = $request->getArg('version'); $page = $request->getPage(); $revision = $page->getCurrentRevision(); $dbi = $request->getDbh(); $actionpage = $dbi->getPage($action); $actionrev = $actionpage->getCurrentRevision(); $pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), $WikiTheme->linkExistingWikiWord($pagename, false, $version))); $request->setValidators(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); $request->appendValidators(array('actionpagerev' => $actionrev->getVersion(), '%mtime' => $actionrev->get('mtime'))); $transformedContent = $actionrev->getTransformedContent(); /* Optionally tell google (and others) not to take notice of action pages. RecentChanges or AllPages might be an exception. */ $args = array(); if (GOOGLE_LINKS_NOFOLLOW) { $robots = "noindex,nofollow"; $args = array('ROBOTS_META' => $robots); } /* Handle other formats: So far we had html only. xml is requested by loaddump, rss is handled by recentchanges, pdf is a special action, but should be a format to dump multiple pages if the actionpage plugin returns a pagelist. rdf and owl are handled by SemanticWeb. */ $format = $request->getArg('format'); /* At first the single page formats: html, xml */ if ($pagename == _("LinkDatabase")) { $template = Template('browse', array('CONTENT' => $transformedContent)); GeneratePage($template, $pagetitle, $revision, $args); } elseif (!$format or $format == 'html' or $format == 'sidebar' or $format == 'contribs') { $template = Template('browse', array('CONTENT' => $transformedContent)); GeneratePage($template, $pagetitle, $revision, $args); } elseif ($format == 'xml') { $request->setArg('format', ''); $template = new Template('browse', $request, array('revision' => $revision, 'CONTENT' => $transformedContent)); $html = GeneratePageAsXML($template, $pagename, $revision); header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']); echo $html; } else { $pagelist = null; require_once 'lib/WikiPlugin.php'; // Then the multi-page formats // rss (if not already handled by RecentChanges) // Need the pagelist from the first plugin foreach ($transformedContent->_content as $cached_element) { if (is_a($cached_element, "Cached_PluginInvocation")) { $loader = new WikiPluginLoader(); $markup = null; // return the first found pagelist $pagelist = $loader->expandPI($cached_element->_pi, $request, $markup, $pagename); if (is_a($pagelist, 'PageList')) { break; } } } if (!$pagelist or !is_a($pagelist, 'PageList')) { if (!in_array($format, array("rss91", "rss2", "rss", "atom", "rdf"))) { trigger_error(sprintf("Format %s requires an actionpage returning a pagelist.", $format) . "\n" . "Fall back to single page mode", E_USER_WARNING); } require_once 'lib/PageList.php'; $pagelist = new PageList(); if ($format == 'pdf') { $pagelist->addPage($page); } } else { foreach ($pagelist->_pages as $page) { $name = $page->getName(); if ($name != $pagename and $page->exists()) { $args['VALID_LINKS'][] = $name; } } } if ($format == 'pdf') { require_once "lib/pdf.php"; array_unshift($args['VALID_LINKS'], $pagename); ConvertAndDisplayPdfPageList($request, $pagelist, $args); } elseif ($format == 'ziphtml') { // need to fix links require_once 'lib/loadsave.php'; array_unshift($args['VALID_LINKS'], $pagename); $request->setArg('zipname', FilenameForPage($pagename) . ".zip"); $request->setArg('pages', $args['VALID_LINKS']); $request->setArg('format', ''); MakeWikiZipHtml($request); } elseif (in_array($format, array("rss91", "rss2", "rss", "atom"))) { $args = $request->getArgs(); //$request->setArg('format',''); if ($pagename == _("RecentChanges")) { $template->printExpansion($args); } else { require_once "lib/plugin/RecentChanges.php"; $plugin = new WikiPlugin_RecentChanges(); return $plugin->format($plugin->getChanges($request->_dbi, $args), $args); } } elseif ($format == 'json') { // for faster autocompletion on searches $req_args =& $request->args; unset($req_args['format']); $json = array('count' => count($pagelist->_pages), 'list' => $args['VALID_LINKS'], 'args' => $req_args, 'phpwiki-version' => PHPWIKI_VERSION); if (loadPhpExtension('json')) { $json_enc = json_encode($json); } else { require_once "lib/pear/JSON.php"; $j = new Services_JSON(); $json_enc = $j->encode($json); } header("Content-Type: application/json"); die($json_enc); } elseif ($format == 'rdf') { // all semantic relations and attributes require_once "lib/SemanticWeb.php"; $rdf = new RdfWriter($request, $pagelist); $rdf->format(); } elseif ($format == 'rdfs') { require_once "lib/SemanticWeb.php"; $rdf = new RdfsWriter($request, $pagelist); $rdf->format(); } elseif ($format == 'owl') { // or daml? require_once "lib/SemanticWeb.php"; $rdf = new OwlWriter($request, $pagelist); $rdf->format(); } else { if (!in_array($pagename, array(_("LinkDatabase")))) { trigger_error(sprintf(_("Unsupported argument: %s=%s"), "format", $format), E_USER_WARNING); } $template = Template('browse', array('CONTENT' => $transformedContent)); GeneratePage($template, $pagetitle, $revision, $args); } } $request->checkValidators(); flush(); return ''; }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); // allow plugin-form if (!empty($s)) { $page = $s; } if (!$page) { return ''; } if (!$dbi->isWikiPage($page)) { return fmt("Page %s not found.", WikiLink($page, 'unknown')); } $p = $dbi->getPage($page); include_once "lib/loadsave.php"; $mailified = MailifyPage($p, $format == 'backup' ? 99 : 1); // fixup_headers massages the page dump headers depending on // the 'format' argument, 'normal'(default) or 'forcvs'. // // Normal: Don't add X-Rcs-Id, add unique Message-Id, don't // strip any fields from Content-Type. // // ForCVS: Add empty X-Rcs-Id, strip attributes from // Content-Type field: "author", "version", "lastmodified", // "author_id", "hits". $this->pagename = $page; $this->generateMessageId($mailified); if ($format == 'forcvs') { $this->fixup_headers_forcvs($mailified); } else { // backup or normal $this->fixup_headers($mailified); } if ($download) { // TODO: we need a way to hook into the generated headers, to override // Content-Type, Set-Cookie, Cache-control, ... $request->discardOutput(); // Hijack the http request from PhpWiki. ob_end_clean(); // clean up after hijacking $request //ob_end_flush(); //debugging Header("Content-disposition: attachment; filename=\"" . FilenameForPage($page) . "\""); // Read charset from generated page itself. // Inconsequential at the moment, since loadsave.php // always generates headers $charset = $p->get('charset'); if (!$charset) { $charset = $GLOBALS['charset']; } // We generate 3 Content-Type headers! first in loadsave, // then here and the mimified string $mailified also has it! Header("Content-Type: text/plain; name=\"" . FilenameForPage($page) . "\"; charset=\"" . $charset . "\""); $request->checkValidators(); // let $request provide last modifed & etag Header("Content-Id: <" . $this->MessageId . ">"); // be nice to http keepalive~s // FIXME: he length is wrong BTW. must strip the header. Header("Content-Length: " . strlen($mailified)); // Here comes our prepared mime file echo $mailified; exit; // noreturn! php exits. return; } // We are displaing inline preview in a WikiPage, so wrap the // text if it is too long--unless quoted-printable (TODO). $mailified = safe_wordwrap($mailified, 70); $dlcvs = Button(array('action' => $this->getName(), 'format' => 'forcvs', 'download' => true), _("Download for CVS"), $page); $dl = Button(array('action' => $this->getName(), 'download' => true), _("Download for backup"), $page); $dlall = Button(array('action' => $this->getName(), 'format' => 'backup', 'download' => true), _("Download all revisions for backup"), $page); $h2 = HTML::h2(fmt("Preview: Page dump of %s", WikiLink($page, 'auto'))); global $WikiTheme; if (!($Sep = $WikiTheme->getButtonSeparator())) { $Sep = " "; } if ($format == 'forcvs') { $desc = _("(formatted for PhpWiki developers as pgsrc template, not for backing up)"); $altpreviewbuttons = HTML(Button(array('action' => $this->getName()), _("Preview as normal format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page)); } elseif ($format == 'backup') { $desc = _("(formatted for backing up: all revisions)"); // all revisions $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => ''), _("Preview as normal format"), $page)); } else { $desc = _("(normal formatting: latest revision only)"); $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page)); } $warning = HTML(_("Please use one of the downloadable versions rather than copying and pasting from the above preview.") . " " . _("The wordwrap of the preview doesn't take nested markup or list indentation into consideration!") . " ", HTML::em(_("PhpWiki developers should manually inspect the downloaded file for nested markup before rewrapping with emacs and checking into CVS."))); return HTML($h2, HTML::em($desc), HTML::pre($mailified), $altpreviewbuttons, HTML::div(array('class' => 'errors'), HTML::strong(_("Warning:")), " ", $warning), $dl, $Sep, $dlall, $Sep, $dlcvs); }