function ExitWiki($errormsg) { static $exitwiki = 0; global $dbi; if ($exitwiki) { // just in case CloseDataBase calls us exit; } $exitwiki = 1; CloseDataBase($dbi); if ($errormsg != '') { print "<P><hr noshade><h2>" . gettext("WikiFatalError") . "</h2>\n"; print $errormsg; print "\n</BODY></HTML>"; } exit; }
$zipname = "wiki.zip"; if ($include_archive) { $zipname = "wikidb.zip"; } $zip = new ZipWriter("Created by PhpWiki", $zipname); for (reset($pages); $pagename = current($pages); next($pages)) { set_time_limit(30); // Reset watchdog. $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore); if (!is_array($pagehash)) { continue; } if ($include_archive) { $oldpagehash = RetrievePage($dbi, $pagename, $ArchivePageStore); } else { $oldpagehash = false; } $attrib = array('mtime' => $pagehash['lastmodified'], 'is_ascii' => 1); if (($pagehash['flags'] & FLAG_PAGE_LOCKED) != 0) { $attrib['write_protected'] = 1; } $content = MailifyPage($pagehash, $oldpagehash); $zip->addRegularFile(encode_pagename_for_wikizip($pagehash['pagename']), $content, $attrib); } $zip->finish(); } if (defined('WIKI_ADMIN')) { MakeWikiZip($zip == 'all'); } CloseDataBase($dbi); exit;
function GetHitCount($dbi, $pagename) { return; // kluge: we ignore the $dbi for hit counting global $WikiDB; $hcdb = OpenDataBase($WikiDB['hitcount']); if (dbmexists($hcdb['active'], $pagename)) { // increase the hit count $count = dbmfetch($hcdb['active'], $pagename); return $count; } else { return 0; } CloseDataBase($hcdb); }