2 rcs_id('$Id: loadsave.php,v 1.128 2004-11-16 16:16:44 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->getDbh();
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();
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->getDbh();
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();
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();
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)) 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($from), 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)) 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($from), 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))) 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($from), 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->getDbh();
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();
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->getDbh();
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->getDbh();
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'];
959 function LoadFile (&$request, $filename, $text = false, $mtime = false)
961 if (!is_string($text)) {
963 $stat = stat($filename);
965 $text = implode("", file($filename));
968 if (! $request->getArg('start_debug'))
969 @set_time_limit(30); // Reset watchdog.
971 @set_time_limit(240);
973 // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
974 $basename = basename("/dummy/" . $filename);
977 $mtime = time(); // Last resort.
979 $default_pagename = rawurldecode($basename);
981 if ( ($parts = ParseMimeifiedPages($text)) ) {
982 usort($parts, 'SortByPageVersion');
983 foreach ($parts as $pageinfo)
984 SavePage($request, $pageinfo, sprintf(_("MIME file %s"),
985 $filename), $basename);
987 else if ( ($pageinfo = ParseSerializedPage($text, $default_pagename,
988 $request->getUser())) ) {
989 SavePage($request, $pageinfo, sprintf(_("Serialized file %s"),
990 $filename), $basename);
993 $user = $request->getUser();
995 // Assume plain text file.
996 $pageinfo = array('pagename' => $default_pagename,
997 'pagedata' => array(),
999 => array('author' => $user->getId()),
1000 'content' => preg_replace('/[ \t\r]*\n/', "\n",
1003 SavePage($request, $pageinfo, sprintf(_("plain file %s"), $filename),
1008 function LoadZip (&$request, $zipfile, $files = false, $exclude = false) {
1009 $zip = new ZipReader($zipfile);
1010 while (list ($fn, $data, $attrib) = $zip->readFile()) {
1011 // FIXME: basename("filewithnoslashes") seems to return
1012 // garbage sometimes.
1013 $fn = basename("/dummy/" . $fn);
1014 if ( ($files && !in_array($fn, $files))
1015 || ($exclude && in_array($fn, $exclude)) ) {
1016 PrintXML(HTML::dt(WikiLink($fn)),
1017 HTML::dd(_("Skipping")));
1022 LoadFile($request, $fn, $data, $attrib['mtime']);
1026 function LoadDir (&$request, $dirname, $files = false, $exclude = false) {
1027 $fileset = new LimitedFileSet($dirname, $files, $exclude);
1029 if (!$files and ($skiplist = $fileset->getSkippedFiles())) {
1030 PrintXML(HTML::dt(HTML::strong(_("Skipping"))));
1032 foreach ($skiplist as $file)
1033 $list->pushContent(HTML::li(WikiLink($file)));
1034 PrintXML(HTML::dd($list));
1037 // Defer HomePage loading until the end. If anything goes wrong
1038 // the pages can still be loaded again.
1039 $files = $fileset->getFiles();
1040 if (in_array(HOME_PAGE, $files)) {
1041 $files = array_diff($files, array(HOME_PAGE));
1042 $files[] = HOME_PAGE;
1044 foreach ($files as $file) {
1045 if (substr($file,-1,1) != '~') // refuse to load backup files
1046 LoadFile($request, "$dirname/$file");
1050 class LimitedFileSet extends FileSet {
1051 function LimitedFileSet($dirname, $_include, $exclude) {
1052 $this->_includefiles = $_include;
1053 $this->_exclude = $exclude;
1054 $this->_skiplist = array();
1055 parent::FileSet($dirname);
1058 function _filenameSelector($fn) {
1059 $incl = &$this->_includefiles;
1060 $excl = &$this->_exclude;
1062 if ( ($incl && !in_array($fn, $incl))
1063 || ($excl && in_array($fn, $excl)) ) {
1064 $this->_skiplist[] = $fn;
1071 function getSkippedFiles () {
1072 return $this->_skiplist;
1077 function IsZipFile ($filename_or_fd)
1079 // See if it looks like zip file
1080 if (is_string($filename_or_fd))
1082 $fd = fopen($filename_or_fd, "rb");
1083 $magic = fread($fd, 4);
1088 $fpos = ftell($filename_or_fd);
1089 $magic = fread($filename_or_fd, 4);
1090 fseek($filename_or_fd, $fpos);
1093 return $magic == ZIP_LOCHEAD_MAGIC || $magic == ZIP_CENTHEAD_MAGIC;
1097 function LoadAny (&$request, $file_or_dir, $files = false, $exclude = false)
1099 // Try urlencoded filename for accented characters.
1100 if (!file_exists($file_or_dir)) {
1101 // Make sure there are slashes first to avoid confusing phps
1102 // with broken dirname or basename functions.
1103 // FIXME: windows uses \ and :
1104 if (is_integer(strpos($file_or_dir, "/"))) {
1105 $file_or_dir = FindFile($file_or_dir);
1107 if (!file_exists($file_or_dir))
1108 $file_or_dir = dirname($file_or_dir) . "/"
1109 . urlencode(basename($file_or_dir));
1111 // This is probably just a file.
1112 $file_or_dir = urlencode($file_or_dir);
1116 $type = filetype($file_or_dir);
1117 if ($type == 'link') {
1118 // For symbolic links, use stat() to determine
1119 // the type of the underlying file.
1120 list(,,$mode) = stat($file_or_dir);
1121 $type = ($mode >> 12) & 017;
1124 elseif ($type == 004)
1129 $request->finish(fmt("Unable to load: %s", $file_or_dir));
1131 else if ($type == 'dir') {
1132 LoadDir($request, $file_or_dir, $files, $exclude);
1134 else if ($type != 'file' && !preg_match('/^(http|ftp):/', $file_or_dir))
1136 $request->finish(fmt("Bad file type: %s", $type));
1138 else if (IsZipFile($file_or_dir)) {
1139 LoadZip($request, $file_or_dir, $files, $exclude);
1141 else /* if (!$files || in_array(basename($file_or_dir), $files)) */
1143 LoadFile($request, $file_or_dir);
1147 function LoadFileOrDir (&$request)
1149 $source = $request->getArg('source');
1150 $finder = new FileFinder;
1151 $source = $finder->slashifyPath($source);
1152 $page = rawurldecode(basename($source));
1153 StartLoadDump($request, fmt("Loading '%s'",
1154 HTML(dirname($source),
1155 dirname($source) ? "/" : "",
1156 WikiLink($page,'auto'))));
1158 LoadAny($request, $source);
1160 EndLoadDump($request);
1163 function SetupWiki (&$request)
1165 global $GenericPages, $LANG;
1168 //FIXME: This is a hack (err, "interim solution")
1169 // This is a bogo-bogo-login: Login without
1170 // saving login information in session state.
1171 // This avoids logging in the unsuspecting
1172 // visitor as "The PhpWiki programming team".
1174 // This really needs to be cleaned up...
1175 // (I'm working on it.)
1176 $real_user = $request->_user;
1177 if (ENABLE_USER_NEW)
1178 $request->_user = new _BogoUser(_("The PhpWiki programming team"));
1181 $request->_user = new WikiUser($request, _("The PhpWiki programming team"),
1184 StartLoadDump($request, _("Loading up virgin wiki"));
1187 $pgsrc = FindLocalizedFile(WIKI_PGSRC);
1188 $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC);
1190 $request->setArg('overwrite',true);
1191 if ($default_pgsrc != $pgsrc) {
1192 LoadAny($request, $default_pgsrc, $GenericPages);
1194 $request->setArg('overwrite',false);
1195 LoadAny($request, $pgsrc);
1197 // Ensure that all mandatory pages are loaded
1198 $finder = new FileFinder;
1199 foreach (array_merge(explode(':','OldTextFormattingRules:TextFormattingRules:PhpWikiAdministration'),
1200 $GLOBALS['AllActionPages'],
1201 array(constant('HOME_PAGE'))) as $f) {
1202 $page = gettext($f);
1203 if (isSubPage($page))
1204 $page = urlencode($page);
1205 if (! $request->_dbi->isWikiPage(urldecode($page)) ) {
1206 // translated version provided?
1207 if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $page, 1))
1208 LoadAny($request, $lf);
1209 else { // load english version of required action page
1210 LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f)));
1214 if (!$request->_dbi->isWikiPage(urldecode($page))) {
1215 trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page),
1221 EndLoadDump($request);
1224 function LoadPostFile (&$request)
1226 $upload = $request->getUploadedFile('file');
1229 $request->finish(_("No uploaded file to upload?")); // FIXME: more concise message
1232 // Dump http headers.
1233 StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
1236 $fd = $upload->open();
1238 LoadZip($request, $fd, false, array(_("RecentChanges")));
1240 LoadFile($request, $upload->getName(), $upload->getContents());
1243 EndLoadDump($request);
1247 $Log: not supported by cvs2svn $
1248 Revision 1.127 2004/11/01 10:43:57 rurban
1249 seperate PassUser methods into seperate dir (memory usage)
1250 fix WikiUser (old) overlarge data session
1251 remove wikidb arg from various page class methods, use global ->_dbi instead
1254 Revision 1.126 2004/10/16 15:13:39 rurban
1255 new [Overwrite All] button
1257 Revision 1.125 2004/10/14 19:19:33 rurban
1258 loadsave: check if the dumped file will be accessible from outside.
1259 and some other minor fixes. (cvsclient native not yet ready)
1261 Revision 1.124 2004/10/04 23:44:28 rurban
1262 for older or CGI phps
1264 Revision 1.123 2004/09/25 16:26:54 rurban
1265 deferr notifies (to be improved)
1267 Revision 1.122 2004/09/17 14:25:45 rurban
1270 Revision 1.121 2004/09/08 13:38:00 rurban
1271 improve loadfile stability by using markup=2 as default for undefined markup-style.
1272 use more refs for huge objects.
1273 fix debug=static issue in WikiPluginCached
1275 Revision 1.120 2004/07/08 19:04:42 rurban
1276 more unittest fixes (file backend, metadata RatingsDb)
1278 Revision 1.119 2004/07/08 15:23:59 rurban
1279 less verbose for tests
1281 Revision 1.118 2004/07/08 13:50:32 rurban
1282 various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
1284 Revision 1.117 2004/07/02 09:55:58 rurban
1285 more stability fixes: new DISABLE_GETIMAGESIZE if your php crashes when loading LinkIcons: failing getimagesize in old phps; blockparser stabilized
1287 Revision 1.116 2004/07/01 09:05:41 rurban
1288 support pages and exclude arguments for all 4 dump methods
1290 Revision 1.115 2004/07/01 08:51:22 rurban
1291 dumphtml: added exclude, print pagename before processing
1293 Revision 1.114 2004/06/28 12:51:41 rurban
1294 improved dumphtml and virgin setup
1296 Revision 1.113 2004/06/27 10:26:02 rurban
1297 oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1299 Revision 1.112 2004/06/25 14:29:20 rurban
1300 WikiGroup refactoring:
1301 global group attached to user, code for not_current user.
1302 improved helpers for special groups (avoid double invocations)
1303 new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1304 fixed a XHTML validation error on userprefs.tmpl
1306 Revision 1.111 2004/06/21 16:38:55 rurban
1307 fixed the StartLoadDump html argument hack.
1309 Revision 1.110 2004/06/21 16:22:30 rurban
1310 add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1311 fixed dumping buttons locally (images/buttons/),
1312 support pages arg for dumphtml,
1313 optional directory arg for dumpserial + dumphtml,
1314 fix a AllPages warning,
1315 show dump warnings/errors on DEBUG,
1316 don't warn just ignore on wikilens pagelist columns, if not loaded.
1317 RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1319 Revision 1.109 2004/06/17 11:31:05 rurban
1320 jump back to label after dump/upgrade
1322 Revision 1.108 2004/06/16 12:43:01 rurban
1323 4.0.6 cannot use this errorhandler (not found)
1325 Revision 1.107 2004/06/14 11:31:37 rurban
1326 renamed global $Theme to $WikiTheme (gforge nameclash)
1327 inherit PageList default options from PageList
1328 default sortby=pagename
1329 use options in PageList_Selectable (limit, sortby, ...)
1330 added action revert, with button at action=diff
1331 added option regex to WikiAdminSearchReplace
1333 Revision 1.106 2004/06/13 13:54:25 rurban
1334 Catch fatals on the four dump calls (as file and zip, as html and mimified)
1335 FoafViewer: Check against external requirements, instead of fatal.
1336 Change output for xhtmldumps: using file:// urls to the local fs.
1337 Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY
1338 Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini.
1340 Revision 1.105 2004/06/08 19:48:16 rurban
1341 fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found
1343 Revision 1.104 2004/06/08 13:51:57 rurban
1346 Revision 1.103 2004/06/08 10:54:46 rurban
1347 better acl dump representation, read back acl and owner
1349 Revision 1.102 2004/06/06 16:58:51 rurban
1350 added more required ActionPages for foreign languages
1351 install now english ActionPages if no localized are found. (again)
1352 fixed default anon user level to be 0, instead of -1
1353 (wrong "required administrator to view this page"...)
1355 Revision 1.101 2004/06/04 20:32:53 rurban
1356 Several locale related improvements suggested by Pierrick Meignen
1357 LDAP fix by John Cole
1358 reenable admin check without ENABLE_PAGEPERM in the admin plugins
1360 Revision 1.100 2004/05/02 21:26:38 rurban
1361 limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1362 because they will not survive db sessions, if too large.
1363 extended action=upgrade
1364 some WikiTranslation button work
1365 revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1366 some temp. session debug statements
1368 Revision 1.99 2004/05/02 15:10:07 rurban
1369 new finally reliable way to detect if /index.php is called directly
1370 and if to include lib/main.php
1371 new global AllActionPages
1372 SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1373 WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1374 PageGroupTestOne => subpages
1375 renamed PhpWikiRss to PhpWikiRecentChanges
1376 more docs, default configs, ...
1378 Revision 1.98 2004/04/29 23:25:12 rurban
1379 re-ordered locale init (as in 1.3.9)
1380 fixed loadfile with subpages, and merge/restore anyway
1381 (sf.net bug #844188)
1383 Revision 1.96 2004/04/19 23:13:03 zorloc
1384 Connect the rest of PhpWiki to the IniConfig system. Also the keyword regular expression is not a config setting
1386 Revision 1.95 2004/04/18 01:11:52 rurban
1387 more numeric pagename fixes.
1388 fixed action=upload with merge conflict warnings.
1389 charset changed from constant to global (dynamic utf-8 switching)
1391 Revision 1.94 2004/03/14 16:36:37 rurban
1392 dont load backup files
1394 Revision 1.93 2004/02/26 03:22:05 rurban
1395 also copy css and images with XHTML Dump
1397 Revision 1.92 2004/02/26 02:25:54 rurban
1398 fix empty and #-anchored links in XHTML Dumps
1400 Revision 1.91 2004/02/24 17:19:37 rurban
1401 debugging helpers only
1403 Revision 1.90 2004/02/24 17:09:24 rurban
1404 fixed \r\r\n with dumping on windows
1406 Revision 1.88 2004/02/22 23:20:31 rurban
1407 fixed DumpHtmlToDir,
1408 enhanced sortby handling in PageList
1409 new button_heading th style (enabled),
1410 added sortby and limit support to the db backends and plugins
1411 for paging support (<<prev, next>> links on long lists)
1413 Revision 1.87 2004/01/26 09:17:49 rurban
1414 * changed stored pref representation as before.
1415 the array of objects is 1) bigger and 2)
1416 less portable. If we would import packed pref
1417 objects and the object definition was changed, PHP would fail.
1418 This doesn't happen with an simple array of non-default values.
1419 * use $prefs->retrieve and $prefs->store methods, where retrieve
1420 understands the interim format of array of objects also.
1421 * simplified $prefs->get() and fixed $prefs->set()
1422 * added $user->_userid and class '_WikiUser' portability functions
1423 * fixed $user object ->_level upgrading, mostly using sessions.
1424 this fixes yesterdays problems with loosing authorization level.
1425 * fixed WikiUserNew::checkPass to return the _level
1426 * fixed WikiUserNew::isSignedIn
1427 * added explodePageList to class PageList, support sortby arg
1428 * fixed UserPreferences for WikiUserNew
1429 * fixed WikiPlugin for empty defaults array
1430 * UnfoldSubpages: added pagename arg, renamed pages arg,
1431 removed sort arg, support sortby arg
1433 Revision 1.86 2003/12/02 16:18:26 carstenklapp
1434 Minor enhancement: Provide more meaningful filenames for WikiDB zip
1437 Revision 1.85 2003/11/30 18:18:13 carstenklapp
1438 Minor code optimization: use include_once instead of require_once
1439 inside functions that might not always called.
1441 Revision 1.84 2003/11/26 20:47:47 carstenklapp
1442 Redo bugfix: My last refactoring broke merge-edit & overwrite
1443 functionality again, should be fixed now. Sorry.
1445 Revision 1.83 2003/11/20 22:18:54 carstenklapp
1446 New feature: h1 during merge-edit displays WikiLink to original page.
1447 Internal changes: Replaced some hackish url-generation code in
1448 function SavePage (for pgsrc merge-edit) with appropriate Button()
1451 Revision 1.82 2003/11/18 19:48:01 carstenklapp
1452 Fixed missing gettext _() for button name.
1454 Revision 1.81 2003/11/18 18:28:35 carstenklapp
1455 Bugfix: In the Load File function of PhpWikiAdministration: When doing
1456 a "Merge Edit" or "Restore Anyway", page names containing accented
1457 letters (such as locale/de/pgsrc/G%E4steBuch) would produce a file not
1458 found error (Use FilenameForPage funtion to urlencode page names).
1460 Revision 1.80 2003/03/07 02:46:57 dairiki
1461 Omit checks for safe_mode before set_time_limit(). Just prefix the
1462 set_time_limit() calls with @ so that they fail silently if not
1465 Revision 1.79 2003/02/26 01:56:05 dairiki
1466 Only zip pages with legal pagenames.
1468 Revision 1.78 2003/02/24 02:05:43 dairiki
1469 Fix "n bytes written" message when dumping HTML.
1471 Revision 1.77 2003/02/21 04:12:05 dairiki
1472 Minor fixes for new cached markup.
1474 Revision 1.76 2003/02/16 19:47:17 dairiki
1475 Update WikiDB timestamp when editing or deleting pages.
1477 Revision 1.75 2003/02/15 03:04:30 dairiki
1478 Fix for WikiUser constructor API change.
1480 Revision 1.74 2003/02/15 02:18:04 dairiki
1481 When default language was English (at least), pgsrc was being
1484 LimitedFileSet: Fix typo/bug. ($include was being ignored.)
1486 SetupWiki(): Fix bugs in loading of $GenericPages.
1488 Revision 1.73 2003/01/28 21:09:17 zorloc
1489 The get_cfg_var() function should only be used when one is
1490 interested in the value from php.ini or similar. Use ini_get()
1491 instead to get the effective value of a configuration variable.
1494 Revision 1.72 2003/01/03 22:25:53 carstenklapp
1495 Cosmetic fix to "Merge Edit" & "Overwrite" buttons. Added "The PhpWiki
1496 programming team" as author when loading from pgsrc. Source
1499 Revision 1.71 2003/01/03 02:48:05 carstenklapp
1500 function SavePage: Added loadfile options for overwriting or merge &
1501 compare a loaded pgsrc file with an existing page.
1503 function LoadAny: Added a general error message when unable to load a
1504 file instead of defaulting to "Bad file type".
1512 // c-basic-offset: 4
1513 // c-hanging-comment-ender-p: nil
1514 // indent-tabs-mode: nil