2 rcs_id('$Id: loadsave.php,v 1.132 2004-12-08 01:18:33 rurban Exp $');
5 Copyright 1999, 2000, 2001, 2002, 2004 $ThePhpWikiProgrammingTeam
7 This file is part of PhpWiki.
9 PhpWiki is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 PhpWiki is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with PhpWiki; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 require_once("lib/ziplib.php");
26 require_once("lib/Template.php");
29 * ignore fatal errors during dump
31 function _dump_error_handler(&$error) {
32 if ($error->isFatal()) {
33 $error->errno = E_USER_WARNING;
36 return true; // Ignore error
38 if (preg_match('/Plugin/', $error->errstr))
41 // let the message come through: call the remaining handlers:
45 function StartLoadDump(&$request, $title, $html = '')
47 // MockRequest is from the unit testsuite, a faked request. (may be cmd-line)
48 // We are silent on unittests.
49 if (isa($request,'MockRequest'))
51 // FIXME: This is a hack. This really is the worst overall hack in phpwiki.
53 $html->pushContent('%BODY%');
54 $tmpl = Template('html', array('TITLE' => $title,
56 'CONTENT' => $html ? $html : '%BODY%'));
57 echo ereg_replace('%BODY%.*', '', $tmpl->getExpansion($html));
58 $request->chunkOutput();
60 // set marker for sendPageChangeNotification()
61 $request->_deferredPageChangeNotification = array();
64 function EndLoadDump(&$request)
66 if (isa($request,'MockRequest'))
68 $action = $request->getArg('action');
71 case 'zip': $label = _("ZIP files of database"); break;
72 case 'dumpserial': $label = _("Dump to directory"); break;
73 case 'upload': $label = _("Upload File"); break;
74 case 'loadfile': $label = _("Load File"); break;
75 case 'upgrade': $label = _("Upgrade"); break;
77 case 'ziphtml': $label = _("Dump pages as XHTML"); break;
79 if ($label) $label = str_replace(" ","_",$label);
80 if ($action == 'browse') // loading virgin
81 $pagelink = WikiLink(HOME_PAGE);
83 $pagelink = WikiLink(new WikiPageName(_("PhpWikiAdministration"),false,$label));
85 // do deferred sendPageChangeNotification()
86 if (!empty($request->_deferredPageChangeNotification)) {
87 $pages = $all_emails = $all_users = array();
88 foreach ($request->_deferredPageChangeNotification as $p) {
89 list($pagename, $emails, $userids) = $p;
91 $all_emails = array_unique(array_merge($all_emails, $emails));
92 $all_users = array_unique(array_merge($all_users, $userids));
94 $editedby = sprintf(_("Edited by: %s"), $request->_user->getId());
95 $content = "Loaded the following pages:\n" . join("\n", $pages);
96 if (mail(join(',',$all_emails),"[".WIKI_NAME."] "._("LoadDump"),
100 trigger_error(sprintf(_("PageChange Notification sent to %s"),
101 join(',',$all_users)), E_USER_NOTICE);
103 trigger_error(sprintf(_("PageChange Notification Error: Couldn't send to %s"),
104 join(',',$all_users)), E_USER_WARNING);
109 unset($request->_deferredPageChangeNotification);
111 PrintXML(HTML::p(HTML::strong(_("Complete."))),
112 HTML::p(fmt("Return to %s", $pagelink)));
113 echo "</body></html>\n";
117 ////////////////////////////////////////////////////////////////
119 // Functions for dumping.
121 ////////////////////////////////////////////////////////////////
125 * http://www.nacs.uci.edu/indiv/ehood/MIME/2045/rfc2045.html
126 * http://www.faqs.org/rfcs/rfc2045.html
127 * (RFC 1521 has been superceeded by RFC 2045 & others).
129 * Also see http://www.faqs.org/rfcs/rfc2822.html
131 function MailifyPage ($page, $nversions = 1)
133 $current = $page->getCurrentRevision();
136 if (STRICT_MAILABLE_PAGEDUMPS) {
137 $from = defined('SERVER_ADMIN') ? SERVER_ADMIN : 'foo@bar';
138 //This is for unix mailbox format: (not RFC (2)822)
139 // $head .= "From $from " . CTime(time()) . "\r\n";
140 $head .= "Subject: " . rawurlencode($page->getName()) . "\r\n";
141 $head .= "From: $from (PhpWiki)\r\n";
142 // RFC 2822 requires only a Date: and originator (From:)
143 // field, however the obsolete standard RFC 822 also
144 // requires a destination field.
145 $head .= "To: $from (PhpWiki)\r\n";
147 $head .= "Date: " . Rfc2822DateTime($current->get('mtime')) . "\r\n";
148 $head .= sprintf("Mime-Version: 1.0 (Produced by PhpWiki %s)\r\n",
151 // This should just be entered by hand (or by script?)
152 // in the actual pgsrc files, since only they should have
154 //$head .= "X-Rcs-Id: \$Id\$\r\n";
156 $iter = $page->getAllRevisions();
158 while ($revision = $iter->next()) {
159 $parts[] = MimeifyPageRevision($revision);
160 if ($nversions > 0 && count($parts) >= $nversions)
163 if (count($parts) > 1)
164 return $head . MimeMultipart($parts);
166 return $head . $parts[0];
170 * Compute filename to used for storing contents of a wiki page.
172 * Basically we do a rawurlencode() which encodes everything except
173 * ASCII alphanumerics and '.', '-', and '_'.
175 * But we also want to encode leading dots to avoid filenames like
176 * '.', and '..'. (Also, there's no point in generating "hidden" file
177 * names, like '.foo'.)
179 * @param $pagename string Pagename.
180 * @return string Filename for page.
182 function FilenameForPage ($pagename)
184 $enc = rawurlencode($pagename);
185 return preg_replace('/^\./', '%2e', $enc);
189 * The main() function which generates a zip archive of a PhpWiki.
191 * If $include_archive is false, only the current version of each page
192 * is included in the zip file; otherwise all archived versions are
195 function MakeWikiZip (&$request)
197 if ($request->getArg('include') == 'all') {
198 $zipname = WIKI_NAME . _("FullDump") . date('Ymd-Hi') . '.zip';
199 $include_archive = true;
202 $zipname = WIKI_NAME . _("LatestSnapshot") . date('Ymd-Hi') . '.zip';
203 $include_archive = false;
207 $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $zipname);
209 /* ignore fatals in plugins */
210 if (check_php_version(4,1)) {
211 global $ErrorManager;
212 $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler'));
215 $dbi =& $request->_dbi;
216 $thispage = $request->getArg('pagename'); // for "Return to ..."
217 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
218 $excludeList = explodePageList($exclude);
220 $excludeList = array();
222 if ($whichpages = $request->getArg('pages')) { // which pagenames
223 if ($whichpages == '[]') // current page
224 $whichpages = $thispage;
225 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
227 $pages = $dbi->getAllPages(false,false,false,$excludeList);
229 $request_args = $request->args;
231 while ($page = $pages->next()) {
232 $request->args = $request_args; // some plugins might change them (esp. on POST)
233 if (! $request->getArg('start_debug'))
234 @set_time_limit(30); // Reset watchdog
236 @set_time_limit(240);
238 $current = $page->getCurrentRevision();
239 if ($current->getVersion() == 0)
242 $pagename = $page->getName();
243 $wpn = new WikiPageName($pagename);
244 if (!$wpn->isValid())
246 if (in_array($page->getName(), $excludeList)) {
250 $attrib = array('mtime' => $current->get('mtime'),
252 if ($page->get('locked'))
253 $attrib['write_protected'] = 1;
255 if ($include_archive)
256 $content = MailifyPage($page, 0);
258 $content = MailifyPage($page);
260 $zip->addRegularFile( FilenameForPage($pagename),
264 if (check_php_version(4,1)) {
265 global $ErrorManager;
266 $ErrorManager->popErrorHandler();
270 function DumpToDir (&$request)
272 $directory = $request->getArg('directory');
273 if (empty($directory))
274 $directory = DEFAULT_DUMP_DIR; // See lib/plugin/WikiForm.php:87
275 if (empty($directory))
276 $request->finish(_("You must specify a directory to dump to"));
278 // see if we can access the directory the user wants us to use
279 if (! file_exists($directory)) {
280 if (! mkdir($directory, 0755))
281 $request->finish(fmt("Cannot create directory '%s'", $directory));
283 $html = HTML::p(fmt("Created directory '%s' for the page dump...",
286 $html = HTML::p(fmt("Using directory '%s'", $directory));
289 StartLoadDump($request, _("Dumping Pages"), $html);
291 $dbi =& $request->_dbi;
292 $thispage = $request->getArg('pagename'); // for "Return to ..."
293 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
294 $excludeList = explodePageList($exclude);
296 $excludeList = array();
298 if ($whichpages = $request->getArg('pages')) { // which pagenames
299 if ($whichpages == '[]') // current page
300 $whichpages = $thispage;
301 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
303 $pages = $dbi->getAllPages(false,false,false,$excludeList);
306 $request_args = $request->args;
308 while ($page = $pages->next()) {
309 $request->args = $request_args; // some plugins might change them (esp. on POST)
310 if (! $request->getArg('start_debug'))
311 @set_time_limit(30); // Reset watchdog.
313 @set_time_limit(240);
315 $pagename = $page->getName();
316 if (!isa($request,'MockRequest')) {
317 PrintXML(HTML::br(), $pagename, ' ... ');
321 if (in_array($pagename, $excludeList)) {
322 if (!isa($request,'MockRequest')) {
323 PrintXML(_("Skipped."));
328 $filename = FilenameForPage($pagename);
330 if($page->getName() != $filename) {
331 $msg->pushContent(HTML::small(fmt("saved as %s", $filename)),
335 if ($request->getArg('include') == 'all')
336 $data = MailifyPage($page, 0);
338 $data = MailifyPage($page);
340 if ( !($fd = fopen($directory."/".$filename, "wb")) ) {
341 $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing",
342 "$directory/$filename")));
343 $request->finish($msg);
346 $num = fwrite($fd, $data, strlen($data));
347 $msg->pushContent(HTML::small(fmt("%s bytes written", $num)));
348 if (!isa($request,'MockRequest')) {
352 assert($num == strlen($data));
356 EndLoadDump($request);
360 * Dump all pages as XHTML to a directory, as pagename.html.
361 * Copies all used css files to the directory, all used images to a
362 * "images" subdirectory, and all used buttons to a "images/buttons" subdirectory.
363 * The webserver must have write permissions to these directories.
364 * chown httpd HTML_DUMP_DIR; chmod u+rwx HTML_DUMP_DIR
367 * @param string directory (optional) path to dump to. Default: HTML_DUMP_DIR
368 * @param string pages (optional) Comma-seperated of glob-style pagenames to dump
369 * @param string exclude (optional) Comma-seperated of glob-style pagenames to exclude
371 function DumpHtmlToDir (&$request)
373 $directory = $request->getArg('directory');
374 if (empty($directory))
375 $directory = HTML_DUMP_DIR; // See lib/plugin/WikiForm.php:87
376 if (empty($directory))
377 $request->finish(_("You must specify a directory to dump to"));
379 // see if we can access the directory the user wants us to use
380 if (! file_exists($directory)) {
381 if (! mkdir($directory, 0755))
382 $request->finish(fmt("Cannot create directory '%s'", $directory));
384 $html = HTML::p(fmt("Created directory '%s' for the page dump...",
387 $html = HTML::p(fmt("Using directory '%s'", $directory));
389 $request->_TemplatesProcessed = array();
390 StartLoadDump($request, _("Dumping Pages"), $html);
391 $thispage = $request->getArg('pagename'); // for "Return to ..."
393 $dbi =& $request->_dbi;
394 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
395 $excludeList = explodePageList($exclude);
397 $excludeList = array();
399 if ($whichpages = $request->getArg('pages')) { // which pagenames
400 if ($whichpages == '[]') // current page
401 $whichpages = $thispage;
402 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
404 $pages = $dbi->getAllPages(false,false,false,$excludeList);
408 if (defined('HTML_DUMP_SUFFIX'))
409 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
410 $WikiTheme->DUMP_MODE = 'HTML';
411 $request_args = $request->args;
413 // check if the dumped file will be accessible from outside
414 $doc_root = $request->get("DOCUMENT_ROOT");
415 $ldir = NormalizeLocalFileName($directory);
416 $wikiroot = NormalizeLocalFileName('');
417 if (string_starts_with($ldir, $doc_root)) {
418 $link_prefix = substr($directory, strlen($doc_root))."/";
419 } elseif (string_starts_with($ldir, $wikiroot)) {
420 $link_prefix = NormalizeWebFileName(substr($directory, strlen($wikiroot)))."/";
424 $prefix = '/' . substr($doc_root,0,2); // add drive where apache is installed
426 $link_prefix = "file://".$prefix.$directory."/";
429 while ($page = $pages->next()) {
430 $request->args = $request_args; // some plugins might change them (esp. on POST)
431 if (! $request->getArg('start_debug'))
432 @set_time_limit(30); // Reset watchdog.
434 @set_time_limit(240);
436 $pagename = $page->getName();
437 if (!isa($request,'MockRequest')) {
438 PrintXML(HTML::br(), $pagename, ' ... ');
441 if (in_array($pagename, $excludeList)) {
442 if (!isa($request,'MockRequest')) {
443 PrintXML(_("Skipped."));
449 $request->setArg('pagename', $pagename); // Template::_basepage fix
450 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
453 $revision = $page->getCurrentRevision();
454 $template = new Template('browse', $request,
455 array('revision' => $revision,
456 'CONTENT' => $revision->getTransformedContent()));
458 $data = GeneratePageasXML($template, $pagename);
460 if ( !($fd = fopen($directory."/".$filename, "wb")) ) {
461 $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing",
462 "$directory/$filename")));
463 $request->finish($msg);
465 $num = fwrite($fd, $data, strlen($data));
466 if ($page->getName() != $filename) {
467 $link = LinkURL($link_prefix.$filename, $filename);
468 $msg->pushContent(HTML::small(_("saved as "), $link, " ... "));
470 $msg->pushContent(HTML::small(fmt("%s bytes written", $num), "\n"));
471 if (!isa($request,'MockRequest')) {
475 $request->chunkOutput();
477 assert($num == strlen($data));
481 $request->_dbi->_cache->invalidate_cache($pagename);
482 unset ($request->_dbi->_cache->_pagedata_cache);
483 unset ($request->_dbi->_cache->_versiondata_cache);
484 unset ($request->_dbi->_cache->_glv_cache);
486 unset ($request->_dbi->_cache->_backend->_page_data);
489 unset($revision->_transformedContent);
491 unset($template->_request);
497 if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) {
498 @mkdir("$directory/images");
499 foreach ($WikiTheme->dumped_images as $img_file) {
500 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
501 $target = "$directory/images/".basename($img_file);
502 if (copy($WikiTheme->_path . $from, $target)) {
503 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
504 if (!isa($request,'MockRequest'))
508 $msg = HTML(HTML::br(), HTML($img_file), HTML::small(fmt("... not found", $target)));
509 if (!isa($request,'MockRequest'))
514 if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) {
516 @mkdir("$directory/images/buttons");
517 foreach ($WikiTheme->dumped_buttons as $text => $img_file) {
518 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
519 $target = "$directory/images/buttons/".basename($img_file);
520 if (copy($WikiTheme->_path . $from, $target)) {
521 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
522 if (!isa($request,'MockRequest'))
526 $msg = HTML(HTML::br(), HTML($img_file), HTML::small(fmt("... not found", $target)));
527 if (!isa($request,'MockRequest'))
532 if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) {
533 foreach ($WikiTheme->dumped_css as $css_file) {
534 if (($from = $WikiTheme->_findFile(basename($css_file), true)) and basename($from)) {
535 $target = "$directory/" . basename($css_file);
536 if (copy($WikiTheme->_path . $from, $target)) {
537 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
538 if (!isa($request,'MockRequest'))
542 $msg = HTML(HTML::br(), HTML($css_file), HTML::small(fmt("... not found", $target)));
543 if (!isa($request,'MockRequest'))
548 $WikiTheme->HTML_DUMP_SUFFIX = '';
549 $WikiTheme->DUMP_MODE = false;
551 $request->setArg('pagename',$thispage); // Template::_basepage fix
552 EndLoadDump($request);
555 /* Known problem: any plugins or other code which echo()s text will
556 * lead to a corrupted html zip file which may produce the following
557 * errors upon unzipping:
559 * warning [wikihtml.zip]: 2401 extra bytes at beginning or within zipfile
560 * file #58: bad zipfile offset (local header sig): 177561
561 * (attempting to re-compensate)
563 * However, the actual wiki page data should be unaffected.
565 function MakeWikiZipHtml (&$request)
567 $request->_TemplatesProcessed = array();
568 $zipname = "wikihtml.zip";
569 $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $zipname);
570 $dbi =& $request->_dbi;
571 $thispage = $request->getArg('pagename'); // for "Return to ..."
572 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
573 $excludeList = explodePageList($exclude);
575 $excludeList = array();
577 if ($whichpages = $request->getArg('pages')) { // which pagenames
578 if ($whichpages == '[]') // current page
579 $whichpages = $thispage;
580 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
582 $pages = $dbi->getAllPages(false,false,false,$excludeList);
586 if (defined('HTML_DUMP_SUFFIX'))
587 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
589 /* ignore fatals in plugins */
590 if (check_php_version(4,1)) {
591 global $ErrorManager;
592 $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler'));
595 $request_args = $request->args;
597 while ($page = $pages->next()) {
598 $request->args = $request_args; // some plugins might change them (esp. on POST)
599 if (! $request->getArg('start_debug'))
600 @set_time_limit(30); // Reset watchdog.
602 @set_time_limit(240);
604 $current = $page->getCurrentRevision();
605 if ($current->getVersion() == 0)
607 $pagename = $page->getName();
608 if (in_array($pagename, $excludeList)) {
612 $attrib = array('mtime' => $current->get('mtime'),
614 if ($page->get('locked'))
615 $attrib['write_protected'] = 1;
617 $request->setArg('pagename',$pagename); // Template::_basepage fix
618 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
619 $revision = $page->getCurrentRevision();
621 $transformedContent = $revision->getTransformedContent();
623 $template = new Template('browse', $request,
624 array('revision' => $revision,
625 'CONTENT' => $transformedContent));
627 $data = GeneratePageasXML($template, $pagename);
629 $zip->addRegularFile( $filename, $data, $attrib);
632 $request->_dbi->_cache->invalidate_cache($pagename);
633 unset ($request->_dbi->_cache->_pagedata_cache);
634 unset ($request->_dbi->_cache->_versiondata_cache);
635 unset ($request->_dbi->_cache->_glv_cache);
637 unset ($request->_dbi->_cache->_backend->_page_data);
639 unset($revision->_transformedContent);
641 unset($template->_request);
645 // FIXME: Deal with css and images here.
647 if (check_php_version(4,1)) {
648 global $ErrorManager;
649 $ErrorManager->popErrorHandler();
651 $WikiTheme->$HTML_DUMP_SUFFIX = '';
655 ////////////////////////////////////////////////////////////////
657 // Functions for restoring.
659 ////////////////////////////////////////////////////////////////
661 function SavePage (&$request, &$pageinfo, $source, $filename)
663 static $overwite_all = false;
664 $pagedata = $pageinfo['pagedata']; // Page level meta-data.
665 $versiondata = $pageinfo['versiondata']; // Revision level meta-data.
667 if (empty($pageinfo['pagename'])) {
668 PrintXML(HTML::dt(HTML::strong(_("Empty pagename!"))));
672 if (empty($versiondata['author_id']))
673 $versiondata['author_id'] = $versiondata['author'];
675 $pagename = $pageinfo['pagename'];
676 $content = $pageinfo['content'];
678 if ($pagename ==_("InterWikiMap"))
679 $content = _tryinsertInterWikiMap($content);
681 $dbi =& $request->_dbi;
682 $page = $dbi->getPage($pagename);
684 // Try to merge if updated pgsrc contents are different. This
685 // whole thing is hackish
687 // TODO: try merge unless:
688 // if (current contents = default contents && pgsrc_version >=
689 // pgsrc_version) then just upgrade this pgsrc
690 $needs_merge = false;
694 if ($request->getArg('merge')) {
697 else if ($request->getArg('overwrite')) {
701 $current = $page->getCurrentRevision();
702 if ( $current and (! $current->hasDefaultContents())
703 && ($current->getPackedContent() != $content)
704 && ($merging == true) ) {
705 include_once('lib/editpage.php');
706 $request->setArg('pagename', $pagename);
707 $r = $current->getVersion();
708 $request->setArg('revision', $current->getVersion());
709 $p = new LoadFileConflictPageEditor($request);
710 $p->_content = $content;
711 $p->_currentVersion = $r - 1;
712 $p->editPage($saveFailed = true);
713 return; //early return
716 foreach ($pagedata as $key => $value) {
718 $page->set($key, $value);
724 $mesg->pushContent(' ', fmt("from %s", $source));
728 //FIXME: This should not happen! (empty vdata, corrupt cache or db)
729 $current = $page->getCurrentRevision();
731 if ($current->getVersion() == 0) {
732 $mesg->pushContent(' - ', _("new page"));
736 if ( (! $current->hasDefaultContents())
737 && ($current->getPackedContent() != $content) ) {
739 $mesg->pushContent(' ',
740 fmt("has edit conflicts - overwriting anyway"));
742 if (substr_count($source, 'pgsrc')) {
743 $versiondata['author'] = _("The PhpWiki programming team");
744 // but leave authorid as userid who loaded the file
748 $mesg->pushContent(' ', fmt("has edit conflicts - skipped"));
749 $needs_merge = true; // hackish
753 else if ($current->getPackedContent() == $content
754 && $current->get('author') == $versiondata['author']) {
755 // The page metadata is already changed, we don't need a new revision.
756 // This was called previously "is identical to current version %d - skipped"
757 // which is wrong, since the pagedata was stored, not skipped.
758 $mesg->pushContent(' ',
759 fmt("content is identical to current version %d - no new revision created",
760 $current->getVersion()));
767 // in case of failures print the culprit:
768 if (!isa($request,'MockRequest')) {
769 PrintXML(HTML::dt(WikiLink($pagename))); flush();
771 $new = $page->save($content, WIKIDB_FORCE_CREATE, $versiondata);
773 $mesg->pushContent(' ', fmt("- saved to database as version %d",
774 $new->getVersion()));
778 // hackish, $source contains needed path+filename
779 $f = str_replace(sprintf(_("MIME file %s"), ''), '', $f);
780 $f = str_replace(sprintf(_("Serialized file %s"), ''), '', $f);
781 $f = str_replace(sprintf(_("plain file %s"), ''), '', $f);
782 //check if uploaded file? they pass just the content, but the file is gone
785 $meb = Button(array('action' => 'loadfile',
789 _("PhpWikiAdministration"),
791 $owb = Button(array('action' => 'loadfile',
795 _("PhpWikiAdministration"),
797 $mesg->pushContent(' ', $meb, " ", $owb);
798 if (!$overwite_all) {
799 $args = $request->getArgs();
800 $args['overwrite'] = 1;
803 _("PhpWikiAdministration"),
805 $mesg->pushContent(HTML::div(array('class' => 'hint'), $owb));
806 $overwite_all = true;
809 $mesg->pushContent(HTML::em(_(" Sorry, cannot merge.")));
813 if (!isa($request,'MockRequest')) {
815 PrintXML(HTML::dt(HTML::em(WikiLink($pagename))), $mesg);
822 // action=revert (by diff)
823 function RevertPage (&$request)
826 $pagename = $request->getArg('pagename');
827 $version = $request->getArg('version');
829 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
830 HTML::dd(_("missing required version argument")));
833 $dbi =& $request->_dbi;
834 $page = $dbi->getPage($pagename);
835 $current = $page->getCurrentRevision();
836 if ($current->getVersion() == 0) {
837 $mesg->pushContent(' ', _("no page content"));
838 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
842 if ($current->getVersion() == $version) {
843 $mesg->pushContent(' ', _("same version page"));
846 $rev = $page->getRevision($version);
847 $content = $rev->getPackedContent();
848 $versiondata = $rev->_data;
849 $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
850 $new = $page->save($content, $current->getVersion() + 1, $versiondata);
852 $mesg->pushContent(' ', fmt("- version %d saved to database as version %d",
853 $version, $new->getVersion()));
854 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
859 function _tryinsertInterWikiMap($content) {
861 if (strpos($content, "<verbatim>")) {
862 //$error_html = " The newly loaded pgsrc already contains a verbatim block.";
865 if (!$goback && !defined('INTERWIKI_MAP_FILE')) {
866 $error_html = sprintf(" "._("%s: not defined"), "INTERWIKI_MAP_FILE");
869 $mapfile = FindFile(INTERWIKI_MAP_FILE,1);
870 if (!$goback && !file_exists($mapfile)) {
871 $error_html = sprintf(" "._("%s: file not found"), INTERWIKI_MAP_FILE);
875 if (!empty($error_html))
876 trigger_error(_("Default InterWiki map file not loaded.")
877 . $error_html, E_USER_NOTICE);
881 // if loading from virgin setup do echo, otherwise trigger_error E_USER_NOTICE
882 if (!isa($GLOBALS['request'],'MockRequest'))
883 echo sprintf(_("Loading InterWikiMap from external file %s."), $mapfile),"<br />";
885 $fd = fopen ($mapfile, "rb");
886 $data = fread ($fd, filesize($mapfile));
888 $content = $content . "\n<verbatim>\n$data</verbatim>\n";
892 function ParseSerializedPage($text, $default_pagename, $user)
894 if (!preg_match('/^a:\d+:{[si]:\d+/', $text))
897 $pagehash = unserialize($text);
899 // Split up pagehash into four parts:
902 // page-level meta-data
903 // revision-level meta-data
905 if (!defined('FLAG_PAGE_LOCKED'))
906 define('FLAG_PAGE_LOCKED', 1);
907 $pageinfo = array('pagedata' => array(),
908 'versiondata' => array());
910 $pagedata = &$pageinfo['pagedata'];
911 $versiondata = &$pageinfo['versiondata'];
914 if (empty($pagehash['pagename']))
915 $pagehash['pagename'] = $default_pagename;
916 if (empty($pagehash['author'])) {
917 $pagehash['author'] = $user->getId();
920 foreach ($pagehash as $key => $value) {
925 $pageinfo[$key] = $value;
928 $pageinfo[$key] = join("\n", $value);
931 if (($value & FLAG_PAGE_LOCKED) != 0)
932 $pagedata['locked'] = 'yes';
936 $pagedata[$key] = $value;
940 $pagedata['perm'] = ParseMimeifiedPerm($value);
943 $versiondata['mtime'] = $value;
948 $versiondata[$key] = $value;
955 function SortByPageVersion ($a, $b) {
956 return $a['version'] - $b['version'];
960 * Security alert! We should not allow to import config.ini into our wiki (or from a sister wiki?)
961 * because the sql passwords are in plaintext there. And the webserver must be able to read it.
962 * Detected by Santtu Jarvi.
964 function LoadFile (&$request, $filename, $text = false, $mtime = false)
966 if (preg_match("/config$/", dirname($filename)) // our or other config
967 and preg_match("/config.*\.ini/", basename($filename))) // backups and other versions also
969 trigger_error(sprintf("Refused to load %s", $filename), E_USER_WARNING);
972 if (!is_string($text)) {
974 $stat = stat($filename);
976 $text = implode("", file($filename));
979 if (! $request->getArg('start_debug'))
980 @set_time_limit(30); // Reset watchdog.
982 @set_time_limit(240);
984 // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
985 $basename = basename("/dummy/" . $filename);
988 $mtime = time(); // Last resort.
990 $default_pagename = rawurldecode($basename);
991 if ( ($parts = ParseMimeifiedPages($text)) ) {
992 usort($parts, 'SortByPageVersion');
993 foreach ($parts as $pageinfo)
994 SavePage($request, $pageinfo, sprintf(_("MIME file %s"),
995 $filename), $basename);
997 else if ( ($pageinfo = ParseSerializedPage($text, $default_pagename,
998 $request->getUser())) ) {
999 SavePage($request, $pageinfo, sprintf(_("Serialized file %s"),
1000 $filename), $basename);
1003 $user = $request->getUser();
1005 // Assume plain text file.
1006 $pageinfo = array('pagename' => $default_pagename,
1007 'pagedata' => array(),
1009 => array('author' => $user->getId()),
1010 'content' => preg_replace('/[ \t\r]*\n/', "\n",
1013 SavePage($request, $pageinfo, sprintf(_("plain file %s"), $filename),
1018 function LoadZip (&$request, $zipfile, $files = false, $exclude = false) {
1019 $zip = new ZipReader($zipfile);
1020 while (list ($fn, $data, $attrib) = $zip->readFile()) {
1021 // FIXME: basename("filewithnoslashes") seems to return
1022 // garbage sometimes.
1023 $fn = basename("/dummy/" . $fn);
1024 if ( ($files && !in_array($fn, $files))
1025 || ($exclude && in_array($fn, $exclude)) ) {
1026 PrintXML(HTML::dt(WikiLink($fn)),
1027 HTML::dd(_("Skipping")));
1032 LoadFile($request, $fn, $data, $attrib['mtime']);
1036 function LoadDir (&$request, $dirname, $files = false, $exclude = false) {
1037 $fileset = new LimitedFileSet($dirname, $files, $exclude);
1039 if (!$files and ($skiplist = $fileset->getSkippedFiles())) {
1040 PrintXML(HTML::dt(HTML::strong(_("Skipping"))));
1042 foreach ($skiplist as $file)
1043 $list->pushContent(HTML::li(WikiLink($file)));
1044 PrintXML(HTML::dd($list));
1047 // Defer HomePage loading until the end. If anything goes wrong
1048 // the pages can still be loaded again.
1049 $files = $fileset->getFiles();
1050 if (in_array(HOME_PAGE, $files)) {
1051 $files = array_diff($files, array(HOME_PAGE));
1052 $files[] = HOME_PAGE;
1054 foreach ($files as $file) {
1055 if (substr($file,-1,1) != '~') // refuse to load backup files
1056 LoadFile($request, "$dirname/$file");
1060 class LimitedFileSet extends FileSet {
1061 function LimitedFileSet($dirname, $_include, $exclude) {
1062 $this->_includefiles = $_include;
1063 $this->_exclude = $exclude;
1064 $this->_skiplist = array();
1065 parent::FileSet($dirname);
1068 function _filenameSelector($fn) {
1069 $incl = &$this->_includefiles;
1070 $excl = &$this->_exclude;
1072 if ( ($incl && !in_array($fn, $incl))
1073 || ($excl && in_array($fn, $excl)) ) {
1074 $this->_skiplist[] = $fn;
1081 function getSkippedFiles () {
1082 return $this->_skiplist;
1087 function IsZipFile ($filename_or_fd)
1089 // See if it looks like zip file
1090 if (is_string($filename_or_fd))
1092 $fd = fopen($filename_or_fd, "rb");
1093 $magic = fread($fd, 4);
1098 $fpos = ftell($filename_or_fd);
1099 $magic = fread($filename_or_fd, 4);
1100 fseek($filename_or_fd, $fpos);
1103 return $magic == ZIP_LOCHEAD_MAGIC || $magic == ZIP_CENTHEAD_MAGIC;
1107 function LoadAny (&$request, $file_or_dir, $files = false, $exclude = false)
1109 // Try urlencoded filename for accented characters.
1110 if (!file_exists($file_or_dir)) {
1111 // Make sure there are slashes first to avoid confusing phps
1112 // with broken dirname or basename functions.
1113 // FIXME: windows uses \ and :
1114 if (is_integer(strpos($file_or_dir, "/"))) {
1115 $file_or_dir = FindFile($file_or_dir);
1117 if (!file_exists($file_or_dir))
1118 $file_or_dir = dirname($file_or_dir) . "/"
1119 . urlencode(basename($file_or_dir));
1121 // This is probably just a file.
1122 $file_or_dir = urlencode($file_or_dir);
1126 $type = filetype($file_or_dir);
1127 if ($type == 'link') {
1128 // For symbolic links, use stat() to determine
1129 // the type of the underlying file.
1130 list(,,$mode) = stat($file_or_dir);
1131 $type = ($mode >> 12) & 017;
1134 elseif ($type == 004)
1139 $request->finish(fmt("Unable to load: %s", $file_or_dir));
1141 else if ($type == 'dir') {
1142 LoadDir($request, $file_or_dir, $files, $exclude);
1144 else if ($type != 'file' && !preg_match('/^(http|ftp):/', $file_or_dir))
1146 $request->finish(fmt("Bad file type: %s", $type));
1148 else if (IsZipFile($file_or_dir)) {
1149 LoadZip($request, $file_or_dir, $files, $exclude);
1151 else /* if (!$files || in_array(basename($file_or_dir), $files)) */
1153 LoadFile($request, $file_or_dir);
1157 function LoadFileOrDir (&$request)
1159 $source = $request->getArg('source');
1160 $finder = new FileFinder;
1161 $source = $finder->slashifyPath($source);
1162 $page = rawurldecode(basename($source));
1163 StartLoadDump($request, fmt("Loading '%s'",
1164 HTML(dirname($source),
1165 dirname($source) ? "/" : "",
1166 WikiLink($page,'auto'))));
1168 LoadAny($request, $source);
1170 EndLoadDump($request);
1174 * HomePage was not found so first-time install is supposed to run.
1175 * - import all pgsrc pages.
1176 * - Todo: installer interface to edit config/config.ini settings
1177 * - Todo: ask for existing old index.php to convert to config/config.ini
1179 function SetupWiki (&$request)
1181 global $GenericPages, $LANG;
1183 //FIXME: This is a hack (err, "interim solution")
1184 // This is a bogo-bogo-login: Login without
1185 // saving login information in session state.
1186 // This avoids logging in the unsuspecting
1187 // visitor as "The PhpWiki programming team".
1189 // This really needs to be cleaned up...
1190 // (I'm working on it.)
1191 $real_user = $request->_user;
1192 if (ENABLE_USER_NEW)
1193 $request->_user = new _BogoUser(_("The PhpWiki programming team"));
1196 $request->_user = new WikiUser($request, _("The PhpWiki programming team"),
1199 StartLoadDump($request, _("Loading up virgin wiki"));
1202 $pgsrc = FindLocalizedFile(WIKI_PGSRC);
1203 $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC);
1205 $request->setArg('overwrite',true);
1206 if ($default_pgsrc != $pgsrc) {
1207 LoadAny($request, $default_pgsrc, $GenericPages);
1209 $request->setArg('overwrite',false);
1210 LoadAny($request, $pgsrc);
1211 $dbi =& $request->_dbi;
1213 // Ensure that all mandatory pages are loaded
1214 $finder = new FileFinder;
1215 foreach (array_merge(explode(':','OldTextFormattingRules:TextFormattingRules:PhpWikiAdministration'),
1216 $GLOBALS['AllActionPages'],
1217 array(constant('HOME_PAGE'))) as $f) {
1218 $page = gettext($f);
1219 if (isSubPage($page))
1220 $page = urlencode($page);
1221 if (! $dbi->isWikiPage(urldecode($page)) ) {
1222 // translated version provided?
1223 if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $page, 1))
1224 LoadAny($request, $lf);
1225 else { // load english version of required action page
1226 LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f)));
1230 if (! $dbi->isWikiPage(urldecode($page))) {
1231 trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page),
1237 EndLoadDump($request);
1240 function LoadPostFile (&$request)
1242 $upload = $request->getUploadedFile('file');
1245 $request->finish(_("No uploaded file to upload?")); // FIXME: more concise message
1248 // Dump http headers.
1249 StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
1252 $fd = $upload->open();
1254 LoadZip($request, $fd, false, array(_("RecentChanges")));
1256 LoadFile($request, $upload->getName(), $upload->getContents());
1259 EndLoadDump($request);
1263 $Log: not supported by cvs2svn $
1264 Revision 1.131 2004/11/30 17:48:38 rurban
1267 Revision 1.130 2004/11/25 08:28:12 rurban
1268 dont fatal on missing css or imgfiles and actually print the miss
1270 Revision 1.129 2004/11/25 08:11:40 rurban
1271 pass exclude to the get_all_pages backend
1273 Revision 1.128 2004/11/16 16:16:44 rurban
1274 enable Overwrite All for upgrade
1276 Revision 1.127 2004/11/01 10:43:57 rurban
1277 seperate PassUser methods into seperate dir (memory usage)
1278 fix WikiUser (old) overlarge data session
1279 remove wikidb arg from various page class methods, use global ->_dbi instead
1282 Revision 1.126 2004/10/16 15:13:39 rurban
1283 new [Overwrite All] button
1285 Revision 1.125 2004/10/14 19:19:33 rurban
1286 loadsave: check if the dumped file will be accessible from outside.
1287 and some other minor fixes. (cvsclient native not yet ready)
1289 Revision 1.124 2004/10/04 23:44:28 rurban
1290 for older or CGI phps
1292 Revision 1.123 2004/09/25 16:26:54 rurban
1293 deferr notifies (to be improved)
1295 Revision 1.122 2004/09/17 14:25:45 rurban
1298 Revision 1.121 2004/09/08 13:38:00 rurban
1299 improve loadfile stability by using markup=2 as default for undefined markup-style.
1300 use more refs for huge objects.
1301 fix debug=static issue in WikiPluginCached
1303 Revision 1.120 2004/07/08 19:04:42 rurban
1304 more unittest fixes (file backend, metadata RatingsDb)
1306 Revision 1.119 2004/07/08 15:23:59 rurban
1307 less verbose for tests
1309 Revision 1.118 2004/07/08 13:50:32 rurban
1310 various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
1312 Revision 1.117 2004/07/02 09:55:58 rurban
1313 more stability fixes: new DISABLE_GETIMAGESIZE if your php crashes when loading LinkIcons: failing getimagesize in old phps; blockparser stabilized
1315 Revision 1.116 2004/07/01 09:05:41 rurban
1316 support pages and exclude arguments for all 4 dump methods
1318 Revision 1.115 2004/07/01 08:51:22 rurban
1319 dumphtml: added exclude, print pagename before processing
1321 Revision 1.114 2004/06/28 12:51:41 rurban
1322 improved dumphtml and virgin setup
1324 Revision 1.113 2004/06/27 10:26:02 rurban
1325 oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1327 Revision 1.112 2004/06/25 14:29:20 rurban
1328 WikiGroup refactoring:
1329 global group attached to user, code for not_current user.
1330 improved helpers for special groups (avoid double invocations)
1331 new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1332 fixed a XHTML validation error on userprefs.tmpl
1334 Revision 1.111 2004/06/21 16:38:55 rurban
1335 fixed the StartLoadDump html argument hack.
1337 Revision 1.110 2004/06/21 16:22:30 rurban
1338 add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1339 fixed dumping buttons locally (images/buttons/),
1340 support pages arg for dumphtml,
1341 optional directory arg for dumpserial + dumphtml,
1342 fix a AllPages warning,
1343 show dump warnings/errors on DEBUG,
1344 don't warn just ignore on wikilens pagelist columns, if not loaded.
1345 RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1347 Revision 1.109 2004/06/17 11:31:05 rurban
1348 jump back to label after dump/upgrade
1350 Revision 1.108 2004/06/16 12:43:01 rurban
1351 4.0.6 cannot use this errorhandler (not found)
1353 Revision 1.107 2004/06/14 11:31:37 rurban
1354 renamed global $Theme to $WikiTheme (gforge nameclash)
1355 inherit PageList default options from PageList
1356 default sortby=pagename
1357 use options in PageList_Selectable (limit, sortby, ...)
1358 added action revert, with button at action=diff
1359 added option regex to WikiAdminSearchReplace
1361 Revision 1.106 2004/06/13 13:54:25 rurban
1362 Catch fatals on the four dump calls (as file and zip, as html and mimified)
1363 FoafViewer: Check against external requirements, instead of fatal.
1364 Change output for xhtmldumps: using file:// urls to the local fs.
1365 Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY
1366 Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini.
1368 Revision 1.105 2004/06/08 19:48:16 rurban
1369 fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found
1371 Revision 1.104 2004/06/08 13:51:57 rurban
1374 Revision 1.103 2004/06/08 10:54:46 rurban
1375 better acl dump representation, read back acl and owner
1377 Revision 1.102 2004/06/06 16:58:51 rurban
1378 added more required ActionPages for foreign languages
1379 install now english ActionPages if no localized are found. (again)
1380 fixed default anon user level to be 0, instead of -1
1381 (wrong "required administrator to view this page"...)
1383 Revision 1.101 2004/06/04 20:32:53 rurban
1384 Several locale related improvements suggested by Pierrick Meignen
1385 LDAP fix by John Cole
1386 reenable admin check without ENABLE_PAGEPERM in the admin plugins
1388 Revision 1.100 2004/05/02 21:26:38 rurban
1389 limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1390 because they will not survive db sessions, if too large.
1391 extended action=upgrade
1392 some WikiTranslation button work
1393 revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1394 some temp. session debug statements
1396 Revision 1.99 2004/05/02 15:10:07 rurban
1397 new finally reliable way to detect if /index.php is called directly
1398 and if to include lib/main.php
1399 new global AllActionPages
1400 SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1401 WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1402 PageGroupTestOne => subpages
1403 renamed PhpWikiRss to PhpWikiRecentChanges
1404 more docs, default configs, ...
1406 Revision 1.98 2004/04/29 23:25:12 rurban
1407 re-ordered locale init (as in 1.3.9)
1408 fixed loadfile with subpages, and merge/restore anyway
1409 (sf.net bug #844188)
1411 Revision 1.96 2004/04/19 23:13:03 zorloc
1412 Connect the rest of PhpWiki to the IniConfig system. Also the keyword regular expression is not a config setting
1414 Revision 1.95 2004/04/18 01:11:52 rurban
1415 more numeric pagename fixes.
1416 fixed action=upload with merge conflict warnings.
1417 charset changed from constant to global (dynamic utf-8 switching)
1419 Revision 1.94 2004/03/14 16:36:37 rurban
1420 dont load backup files
1422 Revision 1.93 2004/02/26 03:22:05 rurban
1423 also copy css and images with XHTML Dump
1425 Revision 1.92 2004/02/26 02:25:54 rurban
1426 fix empty and #-anchored links in XHTML Dumps
1428 Revision 1.91 2004/02/24 17:19:37 rurban
1429 debugging helpers only
1431 Revision 1.90 2004/02/24 17:09:24 rurban
1432 fixed \r\r\n with dumping on windows
1434 Revision 1.88 2004/02/22 23:20:31 rurban
1435 fixed DumpHtmlToDir,
1436 enhanced sortby handling in PageList
1437 new button_heading th style (enabled),
1438 added sortby and limit support to the db backends and plugins
1439 for paging support (<<prev, next>> links on long lists)
1441 Revision 1.87 2004/01/26 09:17:49 rurban
1442 * changed stored pref representation as before.
1443 the array of objects is 1) bigger and 2)
1444 less portable. If we would import packed pref
1445 objects and the object definition was changed, PHP would fail.
1446 This doesn't happen with an simple array of non-default values.
1447 * use $prefs->retrieve and $prefs->store methods, where retrieve
1448 understands the interim format of array of objects also.
1449 * simplified $prefs->get() and fixed $prefs->set()
1450 * added $user->_userid and class '_WikiUser' portability functions
1451 * fixed $user object ->_level upgrading, mostly using sessions.
1452 this fixes yesterdays problems with loosing authorization level.
1453 * fixed WikiUserNew::checkPass to return the _level
1454 * fixed WikiUserNew::isSignedIn
1455 * added explodePageList to class PageList, support sortby arg
1456 * fixed UserPreferences for WikiUserNew
1457 * fixed WikiPlugin for empty defaults array
1458 * UnfoldSubpages: added pagename arg, renamed pages arg,
1459 removed sort arg, support sortby arg
1461 Revision 1.86 2003/12/02 16:18:26 carstenklapp
1462 Minor enhancement: Provide more meaningful filenames for WikiDB zip
1465 Revision 1.85 2003/11/30 18:18:13 carstenklapp
1466 Minor code optimization: use include_once instead of require_once
1467 inside functions that might not always called.
1469 Revision 1.84 2003/11/26 20:47:47 carstenklapp
1470 Redo bugfix: My last refactoring broke merge-edit & overwrite
1471 functionality again, should be fixed now. Sorry.
1473 Revision 1.83 2003/11/20 22:18:54 carstenklapp
1474 New feature: h1 during merge-edit displays WikiLink to original page.
1475 Internal changes: Replaced some hackish url-generation code in
1476 function SavePage (for pgsrc merge-edit) with appropriate Button()
1479 Revision 1.82 2003/11/18 19:48:01 carstenklapp
1480 Fixed missing gettext _() for button name.
1482 Revision 1.81 2003/11/18 18:28:35 carstenklapp
1483 Bugfix: In the Load File function of PhpWikiAdministration: When doing
1484 a "Merge Edit" or "Restore Anyway", page names containing accented
1485 letters (such as locale/de/pgsrc/G%E4steBuch) would produce a file not
1486 found error (Use FilenameForPage funtion to urlencode page names).
1488 Revision 1.80 2003/03/07 02:46:57 dairiki
1489 Omit checks for safe_mode before set_time_limit(). Just prefix the
1490 set_time_limit() calls with @ so that they fail silently if not
1493 Revision 1.79 2003/02/26 01:56:05 dairiki
1494 Only zip pages with legal pagenames.
1496 Revision 1.78 2003/02/24 02:05:43 dairiki
1497 Fix "n bytes written" message when dumping HTML.
1499 Revision 1.77 2003/02/21 04:12:05 dairiki
1500 Minor fixes for new cached markup.
1502 Revision 1.76 2003/02/16 19:47:17 dairiki
1503 Update WikiDB timestamp when editing or deleting pages.
1505 Revision 1.75 2003/02/15 03:04:30 dairiki
1506 Fix for WikiUser constructor API change.
1508 Revision 1.74 2003/02/15 02:18:04 dairiki
1509 When default language was English (at least), pgsrc was being
1512 LimitedFileSet: Fix typo/bug. ($include was being ignored.)
1514 SetupWiki(): Fix bugs in loading of $GenericPages.
1516 Revision 1.73 2003/01/28 21:09:17 zorloc
1517 The get_cfg_var() function should only be used when one is
1518 interested in the value from php.ini or similar. Use ini_get()
1519 instead to get the effective value of a configuration variable.
1522 Revision 1.72 2003/01/03 22:25:53 carstenklapp
1523 Cosmetic fix to "Merge Edit" & "Overwrite" buttons. Added "The PhpWiki
1524 programming team" as author when loading from pgsrc. Source
1527 Revision 1.71 2003/01/03 02:48:05 carstenklapp
1528 function SavePage: Added loadfile options for overwriting or merge &
1529 compare a loaded pgsrc file with an existing page.
1531 function LoadAny: Added a general error message when unable to load a
1532 file instead of defaulting to "Bad file type".
1540 // c-basic-offset: 4
1541 // c-hanging-comment-ender-p: nil
1542 // indent-tabs-mode: nil