2 rcs_id('$Id: loadsave.php,v 1.135 2004-12-26 17:17:25 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 of %s sent to %s"),
101 join("\n",$pages), join(',',$all_users)), E_USER_NOTICE);
103 trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"),
104 join("\n",$pages), 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;
230 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
232 while ($page = $pages->next()) {
233 $request->args = $request_args; // some plugins might change them (esp. on POST)
234 longer_timeout($timeout); // Reset watchdog
236 $current = $page->getCurrentRevision();
237 if ($current->getVersion() == 0)
240 $pagename = $page->getName();
241 $wpn = new WikiPageName($pagename);
242 if (!$wpn->isValid())
244 if (in_array($page->getName(), $excludeList)) {
248 $attrib = array('mtime' => $current->get('mtime'),
250 if ($page->get('locked'))
251 $attrib['write_protected'] = 1;
253 if ($include_archive)
254 $content = MailifyPage($page, 0);
256 $content = MailifyPage($page);
258 $zip->addRegularFile( FilenameForPage($pagename),
262 if (check_php_version(4,1)) {
263 global $ErrorManager;
264 $ErrorManager->popErrorHandler();
268 function DumpToDir (&$request)
270 $directory = $request->getArg('directory');
271 if (empty($directory))
272 $directory = DEFAULT_DUMP_DIR; // See lib/plugin/WikiForm.php:87
273 if (empty($directory))
274 $request->finish(_("You must specify a directory to dump to"));
276 // see if we can access the directory the user wants us to use
277 if (! file_exists($directory)) {
278 if (! mkdir($directory, 0755))
279 $request->finish(fmt("Cannot create directory '%s'", $directory));
281 $html = HTML::p(fmt("Created directory '%s' for the page dump...",
284 $html = HTML::p(fmt("Using directory '%s'", $directory));
287 StartLoadDump($request, _("Dumping Pages"), $html);
289 $dbi =& $request->_dbi;
290 $thispage = $request->getArg('pagename'); // for "Return to ..."
291 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
292 $excludeList = explodePageList($exclude);
294 $excludeList = array();
296 if ($whichpages = $request->getArg('pages')) { // which pagenames
297 if ($whichpages == '[]') // current page
298 $whichpages = $thispage;
299 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
301 $pages = $dbi->getAllPages(false,false,false,$excludeList);
304 $request_args = $request->args;
305 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
307 while ($page = $pages->next()) {
308 $request->args = $request_args; // some plugins might change them (esp. on POST)
309 longer_timeout($timeout); // Reset watchdog
311 $pagename = $page->getName();
312 if (!isa($request,'MockRequest')) {
313 PrintXML(HTML::br(), $pagename, ' ... ');
317 if (in_array($pagename, $excludeList)) {
318 if (!isa($request,'MockRequest')) {
319 PrintXML(_("Skipped."));
324 $filename = FilenameForPage($pagename);
326 if($page->getName() != $filename) {
327 $msg->pushContent(HTML::small(fmt("saved as %s", $filename)),
331 if ($request->getArg('include') == 'all')
332 $data = MailifyPage($page, 0);
334 $data = MailifyPage($page);
336 if ( !($fd = fopen($directory."/".$filename, "wb")) ) {
337 $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing",
338 "$directory/$filename")));
339 $request->finish($msg);
342 $num = fwrite($fd, $data, strlen($data));
343 $msg->pushContent(HTML::small(fmt("%s bytes written", $num)));
344 if (!isa($request,'MockRequest')) {
348 assert($num == strlen($data));
352 EndLoadDump($request);
356 * Dump all pages as XHTML to a directory, as pagename.html.
357 * Copies all used css files to the directory, all used images to a
358 * "images" subdirectory, and all used buttons to a "images/buttons" subdirectory.
359 * The webserver must have write permissions to these directories.
360 * chown httpd HTML_DUMP_DIR; chmod u+rwx HTML_DUMP_DIR
363 * @param string directory (optional) path to dump to. Default: HTML_DUMP_DIR
364 * @param string pages (optional) Comma-seperated of glob-style pagenames to dump
365 * @param string exclude (optional) Comma-seperated of glob-style pagenames to exclude
367 function DumpHtmlToDir (&$request)
369 $directory = $request->getArg('directory');
370 if (empty($directory))
371 $directory = HTML_DUMP_DIR; // See lib/plugin/WikiForm.php:87
372 if (empty($directory))
373 $request->finish(_("You must specify a directory to dump to"));
375 // see if we can access the directory the user wants us to use
376 if (! file_exists($directory)) {
377 if (! mkdir($directory, 0755))
378 $request->finish(fmt("Cannot create directory '%s'", $directory));
380 $html = HTML::p(fmt("Created directory '%s' for the page dump...",
383 $html = HTML::p(fmt("Using directory '%s'", $directory));
385 $request->_TemplatesProcessed = array();
386 StartLoadDump($request, _("Dumping Pages"), $html);
387 $thispage = $request->getArg('pagename'); // for "Return to ..."
389 $dbi =& $request->_dbi;
390 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
391 $excludeList = explodePageList($exclude);
393 $excludeList = array();
395 if ($whichpages = $request->getArg('pages')) { // which pagenames
396 if ($whichpages == '[]') // current page
397 $whichpages = $thispage;
398 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
400 $pages = $dbi->getAllPages(false,false,false,$excludeList);
404 if (defined('HTML_DUMP_SUFFIX'))
405 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
406 $WikiTheme->DUMP_MODE = 'HTML';
408 // check if the dumped file will be accessible from outside
409 $doc_root = $request->get("DOCUMENT_ROOT");
410 $ldir = NormalizeLocalFileName($directory);
411 $wikiroot = NormalizeLocalFileName('');
412 if (string_starts_with($ldir, $doc_root)) {
413 $link_prefix = substr($directory, strlen($doc_root))."/";
414 } elseif (string_starts_with($ldir, $wikiroot)) {
415 $link_prefix = NormalizeWebFileName(substr($directory, strlen($wikiroot)))."/";
419 $prefix = '/' . substr($doc_root,0,2); // add drive where apache is installed
421 $link_prefix = "file://".$prefix.$directory."/";
424 $request_args = $request->args;
425 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
427 while ($page = $pages->next()) {
428 $request->args = $request_args; // some plugins might change them (esp. on POST)
429 longer_timeout($timeout); // Reset watchdog
431 $pagename = $page->getName();
432 if (!isa($request,'MockRequest')) {
433 PrintXML(HTML::br(), $pagename, ' ... ');
436 if (in_array($pagename, $excludeList)) {
437 if (!isa($request,'MockRequest')) {
438 PrintXML(_("Skipped."));
444 $request->setArg('pagename', $pagename); // Template::_basepage fix
445 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
448 $revision = $page->getCurrentRevision();
449 $template = new Template('browse', $request,
450 array('revision' => $revision,
451 'CONTENT' => $revision->getTransformedContent()));
453 $data = GeneratePageasXML($template, $pagename);
455 if ( !($fd = fopen($directory."/".$filename, "wb")) ) {
456 $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing",
457 "$directory/$filename")));
458 $request->finish($msg);
460 $num = fwrite($fd, $data, strlen($data));
461 if ($page->getName() != $filename) {
462 $link = LinkURL($link_prefix.$filename, $filename);
463 $msg->pushContent(HTML::small(_("saved as "), $link, " ... "));
465 $msg->pushContent(HTML::small(fmt("%s bytes written", $num), "\n"));
466 if (!isa($request,'MockRequest')) {
470 $request->chunkOutput();
472 assert($num == strlen($data));
476 $request->_dbi->_cache->invalidate_cache($pagename);
477 unset ($request->_dbi->_cache->_pagedata_cache);
478 unset ($request->_dbi->_cache->_versiondata_cache);
479 unset ($request->_dbi->_cache->_glv_cache);
481 unset ($request->_dbi->_cache->_backend->_page_data);
484 unset($revision->_transformedContent);
486 unset($template->_request);
492 if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) {
493 @mkdir("$directory/images");
494 foreach ($WikiTheme->dumped_images as $img_file) {
495 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
496 $target = "$directory/images/".basename($img_file);
497 if (copy($WikiTheme->_path . $from, $target)) {
498 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
499 if (!isa($request,'MockRequest'))
503 $msg = HTML(HTML::br(), HTML($img_file), HTML::small(fmt("... not found", $target)));
504 if (!isa($request,'MockRequest'))
509 if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) {
511 @mkdir("$directory/images/buttons");
512 foreach ($WikiTheme->dumped_buttons as $text => $img_file) {
513 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
514 $target = "$directory/images/buttons/".basename($img_file);
515 if (copy($WikiTheme->_path . $from, $target)) {
516 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
517 if (!isa($request,'MockRequest'))
521 $msg = HTML(HTML::br(), HTML($img_file), HTML::small(fmt("... not found", $target)));
522 if (!isa($request,'MockRequest'))
527 if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) {
528 foreach ($WikiTheme->dumped_css as $css_file) {
529 if (($from = $WikiTheme->_findFile(basename($css_file), true)) and basename($from)) {
530 $target = "$directory/" . basename($css_file);
531 if (copy($WikiTheme->_path . $from, $target)) {
532 $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target)));
533 if (!isa($request,'MockRequest'))
537 $msg = HTML(HTML::br(), HTML($css_file), HTML::small(fmt("... not found", $target)));
538 if (!isa($request,'MockRequest'))
543 $WikiTheme->HTML_DUMP_SUFFIX = '';
544 $WikiTheme->DUMP_MODE = false;
546 $request->setArg('pagename',$thispage); // Template::_basepage fix
547 EndLoadDump($request);
550 /* Known problem: any plugins or other code which echo()s text will
551 * lead to a corrupted html zip file which may produce the following
552 * errors upon unzipping:
554 * warning [wikihtml.zip]: 2401 extra bytes at beginning or within zipfile
555 * file #58: bad zipfile offset (local header sig): 177561
556 * (attempting to re-compensate)
558 * However, the actual wiki page data should be unaffected.
560 function MakeWikiZipHtml (&$request)
562 $request->_TemplatesProcessed = array();
563 $zipname = "wikihtml.zip";
564 $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $zipname);
565 $dbi =& $request->_dbi;
566 $thispage = $request->getArg('pagename'); // for "Return to ..."
567 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
568 $excludeList = explodePageList($exclude);
570 $excludeList = array();
572 if ($whichpages = $request->getArg('pages')) { // which pagenames
573 if ($whichpages == '[]') // current page
574 $whichpages = $thispage;
575 $pages = new WikiDB_Array_PageIterator(explodePageList($whichpages));
577 $pages = $dbi->getAllPages(false,false,false,$excludeList);
581 if (defined('HTML_DUMP_SUFFIX'))
582 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
583 $WikiTheme->DUMP_MODE = 'ZIPHTML';
585 /* ignore fatals in plugins */
586 if (check_php_version(4,1)) {
587 global $ErrorManager;
588 $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler'));
591 $request_args = $request->args;
592 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
594 while ($page = $pages->next()) {
595 $request->args = $request_args; // some plugins might change them (esp. on POST)
596 longer_timeout($timeout); // Reset watchdog
598 $current = $page->getCurrentRevision();
599 if ($current->getVersion() == 0)
601 $pagename = $page->getName();
602 if (in_array($pagename, $excludeList)) {
606 $attrib = array('mtime' => $current->get('mtime'),
608 if ($page->get('locked'))
609 $attrib['write_protected'] = 1;
611 $request->setArg('pagename',$pagename); // Template::_basepage fix
612 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
613 $revision = $page->getCurrentRevision();
615 $transformedContent = $revision->getTransformedContent();
617 $template = new Template('browse', $request,
618 array('revision' => $revision,
619 'CONTENT' => $transformedContent));
621 $data = GeneratePageasXML($template, $pagename);
623 $zip->addRegularFile( $filename, $data, $attrib);
626 $request->_dbi->_cache->invalidate_cache($pagename);
627 unset ($request->_dbi->_cache->_pagedata_cache);
628 unset ($request->_dbi->_cache->_versiondata_cache);
629 unset ($request->_dbi->_cache->_glv_cache);
631 unset ($request->_dbi->_cache->_backend->_page_data);
633 unset($revision->_transformedContent);
635 unset($template->_request);
641 // FIXME: Deal with css and images here.
643 if (check_php_version(4,1)) {
644 global $ErrorManager;
645 $ErrorManager->popErrorHandler();
647 $WikiTheme->$HTML_DUMP_SUFFIX = '';
648 $WikiTheme->DUMP_MODE = false;
652 ////////////////////////////////////////////////////////////////
654 // Functions for restoring.
656 ////////////////////////////////////////////////////////////////
658 function SavePage (&$request, &$pageinfo, $source, $filename)
660 static $overwite_all = false;
661 $pagedata = $pageinfo['pagedata']; // Page level meta-data.
662 $versiondata = $pageinfo['versiondata']; // Revision level meta-data.
664 if (empty($pageinfo['pagename'])) {
665 PrintXML(HTML::dt(HTML::strong(_("Empty pagename!"))));
669 if (empty($versiondata['author_id']))
670 $versiondata['author_id'] = $versiondata['author'];
672 $pagename = $pageinfo['pagename'];
673 $content = $pageinfo['content'];
675 if ($pagename ==_("InterWikiMap"))
676 $content = _tryinsertInterWikiMap($content);
678 $dbi =& $request->_dbi;
679 $page = $dbi->getPage($pagename);
681 // Try to merge if updated pgsrc contents are different. This
682 // whole thing is hackish
684 // TODO: try merge unless:
685 // if (current contents = default contents && pgsrc_version >=
686 // pgsrc_version) then just upgrade this pgsrc
687 $needs_merge = false;
691 if ($request->getArg('merge')) {
694 else if ($request->getArg('overwrite')) {
698 $current = $page->getCurrentRevision();
699 if ( $current and (! $current->hasDefaultContents())
700 && ($current->getPackedContent() != $content)
701 && ($merging == true) ) {
702 include_once('lib/editpage.php');
703 $request->setArg('pagename', $pagename);
704 $r = $current->getVersion();
705 $request->setArg('revision', $current->getVersion());
706 $p = new LoadFileConflictPageEditor($request);
707 $p->_content = $content;
708 $p->_currentVersion = $r - 1;
709 $p->editPage($saveFailed = true);
710 return; //early return
713 foreach ($pagedata as $key => $value) {
715 $page->set($key, $value);
721 $mesg->pushContent(' ', fmt("from %s", $source));
725 //FIXME: This should not happen! (empty vdata, corrupt cache or db)
726 $current = $page->getCurrentRevision();
728 if ($current->getVersion() == 0) {
729 $mesg->pushContent(' - ', _("New page"));
733 if ( (! $current->hasDefaultContents())
734 && ($current->getPackedContent() != $content) ) {
736 $mesg->pushContent(' ',
737 fmt("has edit conflicts - overwriting anyway"));
739 if (substr_count($source, 'pgsrc')) {
740 $versiondata['author'] = _("The PhpWiki programming team");
741 // but leave authorid as userid who loaded the file
745 $mesg->pushContent(' ', fmt("has edit conflicts - skipped"));
746 $needs_merge = true; // hackish
750 else if ($current->getPackedContent() == $content
751 && $current->get('author') == $versiondata['author']) {
752 // The page metadata is already changed, we don't need a new revision.
753 // This was called previously "is identical to current version %d - skipped"
754 // which is wrong, since the pagedata was stored, not skipped.
755 $mesg->pushContent(' ',
756 fmt("content is identical to current version %d - no new revision created",
757 $current->getVersion()));
764 // in case of failures print the culprit:
765 if (!isa($request,'MockRequest')) {
766 PrintXML(HTML::dt(WikiLink($pagename))); flush();
768 $new = $page->save($content, WIKIDB_FORCE_CREATE, $versiondata);
770 $mesg->pushContent(' ', fmt("- saved to database as version %d",
771 $new->getVersion()));
775 // hackish, $source contains needed path+filename
776 $f = str_replace(sprintf(_("MIME file %s"), ''), '', $f);
777 $f = str_replace(sprintf(_("Serialized file %s"), ''), '', $f);
778 $f = str_replace(sprintf(_("plain file %s"), ''), '', $f);
779 //check if uploaded file? they pass just the content, but the file is gone
782 $meb = Button(array('action' => 'loadfile',
786 _("PhpWikiAdministration"),
788 $owb = Button(array('action' => 'loadfile',
792 _("PhpWikiAdministration"),
794 $mesg->pushContent(' ', $meb, " ", $owb);
795 if (!$overwite_all) {
796 $args = $request->getArgs();
797 $args['overwrite'] = 1;
800 _("PhpWikiAdministration"),
802 $mesg->pushContent(HTML::div(array('class' => 'hint'), $owb));
803 $overwite_all = true;
806 $mesg->pushContent(HTML::em(_(" Sorry, cannot merge.")));
810 if (!isa($request,'MockRequest')) {
812 PrintXML(HTML::dt(HTML::em(WikiLink($pagename))), $mesg);
819 // action=revert (by diff)
820 function RevertPage (&$request)
823 $pagename = $request->getArg('pagename');
824 $version = $request->getArg('version');
826 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
827 HTML::dd(_("missing required version argument")));
830 $dbi =& $request->_dbi;
831 $page = $dbi->getPage($pagename);
832 $current = $page->getCurrentRevision();
833 if ($current->getVersion() == 0) {
834 $mesg->pushContent(' ', _("no page content"));
835 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
839 if ($current->getVersion() == $version) {
840 $mesg->pushContent(' ', _("same version page"));
843 $rev = $page->getRevision($version);
844 $content = $rev->getPackedContent();
845 $versiondata = $rev->_data;
846 $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
847 $new = $page->save($content, $current->getVersion() + 1, $versiondata);
849 $mesg->pushContent(' ', fmt("- version %d saved to database as version %d",
850 $version, $new->getVersion()));
851 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
856 function _tryinsertInterWikiMap($content) {
858 if (strpos($content, "<verbatim>")) {
859 //$error_html = " The newly loaded pgsrc already contains a verbatim block.";
862 if (!$goback && !defined('INTERWIKI_MAP_FILE')) {
863 $error_html = sprintf(" "._("%s: not defined"), "INTERWIKI_MAP_FILE");
866 $mapfile = FindFile(INTERWIKI_MAP_FILE,1);
867 if (!$goback && !file_exists($mapfile)) {
868 $error_html = sprintf(" "._("%s: file not found"), INTERWIKI_MAP_FILE);
872 if (!empty($error_html))
873 trigger_error(_("Default InterWiki map file not loaded.")
874 . $error_html, E_USER_NOTICE);
878 // if loading from virgin setup do echo, otherwise trigger_error E_USER_NOTICE
879 if (!isa($GLOBALS['request'],'MockRequest'))
880 echo sprintf(_("Loading InterWikiMap from external file %s."), $mapfile),"<br />";
882 $fd = fopen ($mapfile, "rb");
883 $data = fread ($fd, filesize($mapfile));
885 $content = $content . "\n<verbatim>\n$data</verbatim>\n";
889 function ParseSerializedPage($text, $default_pagename, $user)
891 if (!preg_match('/^a:\d+:{[si]:\d+/', $text))
894 $pagehash = unserialize($text);
896 // Split up pagehash into four parts:
899 // page-level meta-data
900 // revision-level meta-data
902 if (!defined('FLAG_PAGE_LOCKED'))
903 define('FLAG_PAGE_LOCKED', 1);
904 $pageinfo = array('pagedata' => array(),
905 'versiondata' => array());
907 $pagedata = &$pageinfo['pagedata'];
908 $versiondata = &$pageinfo['versiondata'];
911 if (empty($pagehash['pagename']))
912 $pagehash['pagename'] = $default_pagename;
913 if (empty($pagehash['author'])) {
914 $pagehash['author'] = $user->getId();
917 foreach ($pagehash as $key => $value) {
922 $pageinfo[$key] = $value;
925 $pageinfo[$key] = join("\n", $value);
928 if (($value & FLAG_PAGE_LOCKED) != 0)
929 $pagedata['locked'] = 'yes';
933 $pagedata[$key] = $value;
937 $pagedata['perm'] = ParseMimeifiedPerm($value);
940 $versiondata['mtime'] = $value;
945 $versiondata[$key] = $value;
952 function SortByPageVersion ($a, $b) {
953 return $a['version'] - $b['version'];
957 * Security alert! We should not allow to import config.ini into our wiki (or from a sister wiki?)
958 * because the sql passwords are in plaintext there. And the webserver must be able to read it.
959 * Detected by Santtu Jarvi.
961 function LoadFile (&$request, $filename, $text = false, $mtime = false)
963 if (preg_match("/config$/", dirname($filename)) // our or other config
964 and preg_match("/config.*\.ini/", basename($filename))) // backups and other versions also
966 trigger_error(sprintf("Refused to load %s", $filename), E_USER_WARNING);
969 if (!is_string($text)) {
971 $stat = stat($filename);
973 $text = implode("", file($filename));
976 if (! $request->getArg('start_debug')) @set_time_limit(30); // Reset watchdog
977 else @set_time_limit(240);
979 // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
980 $basename = basename("/dummy/" . $filename);
983 $mtime = time(); // Last resort.
985 $default_pagename = rawurldecode($basename);
986 if ( ($parts = ParseMimeifiedPages($text)) ) {
987 usort($parts, 'SortByPageVersion');
988 foreach ($parts as $pageinfo)
989 SavePage($request, $pageinfo, sprintf(_("MIME file %s"),
990 $filename), $basename);
992 else if ( ($pageinfo = ParseSerializedPage($text, $default_pagename,
993 $request->getUser())) ) {
994 SavePage($request, $pageinfo, sprintf(_("Serialized file %s"),
995 $filename), $basename);
998 $user = $request->getUser();
1000 // Assume plain text file.
1001 $pageinfo = array('pagename' => $default_pagename,
1002 'pagedata' => array(),
1004 => array('author' => $user->getId()),
1005 'content' => preg_replace('/[ \t\r]*\n/', "\n",
1008 SavePage($request, $pageinfo, sprintf(_("plain file %s"), $filename),
1013 function LoadZip (&$request, $zipfile, $files = false, $exclude = false) {
1014 $zip = new ZipReader($zipfile);
1015 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1016 while (list ($fn, $data, $attrib) = $zip->readFile()) {
1017 // FIXME: basename("filewithnoslashes") seems to return
1018 // garbage sometimes.
1019 $fn = basename("/dummy/" . $fn);
1020 if ( ($files && !in_array($fn, $files))
1021 || ($exclude && in_array($fn, $exclude)) ) {
1022 PrintXML(HTML::dt(WikiLink($fn)),
1023 HTML::dd(_("Skipping")));
1027 longer_timeout($timeout); // longer timeout per page
1028 LoadFile($request, $fn, $data, $attrib['mtime']);
1032 function LoadDir (&$request, $dirname, $files = false, $exclude = false) {
1033 $fileset = new LimitedFileSet($dirname, $files, $exclude);
1035 if (!$files and ($skiplist = $fileset->getSkippedFiles())) {
1036 PrintXML(HTML::dt(HTML::strong(_("Skipping"))));
1038 foreach ($skiplist as $file)
1039 $list->pushContent(HTML::li(WikiLink($file)));
1040 PrintXML(HTML::dd($list));
1043 // Defer HomePage loading until the end. If anything goes wrong
1044 // the pages can still be loaded again.
1045 $files = $fileset->getFiles();
1046 if (in_array(HOME_PAGE, $files)) {
1047 $files = array_diff($files, array(HOME_PAGE));
1048 $files[] = HOME_PAGE;
1050 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1051 foreach ($files as $file) {
1052 longer_timeout($timeout); // longer timeout per page
1053 if (substr($file,-1,1) != '~') // refuse to load backup files
1054 LoadFile($request, "$dirname/$file");
1058 class LimitedFileSet extends FileSet {
1059 function LimitedFileSet($dirname, $_include, $exclude) {
1060 $this->_includefiles = $_include;
1061 $this->_exclude = $exclude;
1062 $this->_skiplist = array();
1063 parent::FileSet($dirname);
1066 function _filenameSelector($fn) {
1067 $incl = &$this->_includefiles;
1068 $excl = &$this->_exclude;
1070 if ( ($incl && !in_array($fn, $incl))
1071 || ($excl && in_array($fn, $excl)) ) {
1072 $this->_skiplist[] = $fn;
1079 function getSkippedFiles () {
1080 return $this->_skiplist;
1085 function IsZipFile ($filename_or_fd)
1087 // See if it looks like zip file
1088 if (is_string($filename_or_fd))
1090 $fd = fopen($filename_or_fd, "rb");
1091 $magic = fread($fd, 4);
1096 $fpos = ftell($filename_or_fd);
1097 $magic = fread($filename_or_fd, 4);
1098 fseek($filename_or_fd, $fpos);
1101 return $magic == ZIP_LOCHEAD_MAGIC || $magic == ZIP_CENTHEAD_MAGIC;
1105 function LoadAny (&$request, $file_or_dir, $files = false, $exclude = false)
1107 // Try urlencoded filename for accented characters.
1108 if (!file_exists($file_or_dir)) {
1109 // Make sure there are slashes first to avoid confusing phps
1110 // with broken dirname or basename functions.
1111 // FIXME: windows uses \ and :
1112 if (is_integer(strpos($file_or_dir, "/"))) {
1113 $file_or_dir = FindFile($file_or_dir);
1115 if (!file_exists($file_or_dir))
1116 $file_or_dir = dirname($file_or_dir) . "/"
1117 . urlencode(basename($file_or_dir));
1119 // This is probably just a file.
1120 $file_or_dir = urlencode($file_or_dir);
1124 $type = filetype($file_or_dir);
1125 if ($type == 'link') {
1126 // For symbolic links, use stat() to determine
1127 // the type of the underlying file.
1128 list(,,$mode) = stat($file_or_dir);
1129 $type = ($mode >> 12) & 017;
1132 elseif ($type == 004)
1137 $request->finish(fmt("Unable to load: %s", $file_or_dir));
1139 else if ($type == 'dir') {
1140 LoadDir($request, $file_or_dir, $files, $exclude);
1142 else if ($type != 'file' && !preg_match('/^(http|ftp):/', $file_or_dir))
1144 $request->finish(fmt("Bad file type: %s", $type));
1146 else if (IsZipFile($file_or_dir)) {
1147 LoadZip($request, $file_or_dir, $files, $exclude);
1149 else /* if (!$files || in_array(basename($file_or_dir), $files)) */
1151 LoadFile($request, $file_or_dir);
1155 function LoadFileOrDir (&$request)
1157 $source = $request->getArg('source');
1158 $finder = new FileFinder;
1159 $source = $finder->slashifyPath($source);
1160 $page = rawurldecode(basename($source));
1161 StartLoadDump($request, fmt("Loading '%s'",
1162 HTML(dirname($source),
1163 dirname($source) ? "/" : "",
1164 WikiLink($page,'auto'))));
1166 LoadAny($request, $source);
1168 EndLoadDump($request);
1172 * HomePage was not found so first-time install is supposed to run.
1173 * - import all pgsrc pages.
1174 * - Todo: installer interface to edit config/config.ini settings
1175 * - Todo: ask for existing old index.php to convert to config/config.ini
1177 function SetupWiki (&$request)
1179 global $GenericPages, $LANG;
1181 //FIXME: This is a hack (err, "interim solution")
1182 // This is a bogo-bogo-login: Login without
1183 // saving login information in session state.
1184 // This avoids logging in the unsuspecting
1185 // visitor as "The PhpWiki programming team".
1187 // This really needs to be cleaned up...
1188 // (I'm working on it.)
1189 $real_user = $request->_user;
1190 if (ENABLE_USER_NEW)
1191 $request->_user = new _BogoUser(_("The PhpWiki programming team"));
1194 $request->_user = new WikiUser($request, _("The PhpWiki programming team"),
1197 StartLoadDump($request, _("Loading up virgin wiki"));
1200 $pgsrc = FindLocalizedFile(WIKI_PGSRC);
1201 $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC);
1203 $request->setArg('overwrite',true);
1204 if ($default_pgsrc != $pgsrc) {
1205 LoadAny($request, $default_pgsrc, $GenericPages);
1207 $request->setArg('overwrite',false);
1208 LoadAny($request, $pgsrc);
1209 $dbi =& $request->_dbi;
1211 // Ensure that all mandatory pages are loaded
1212 $finder = new FileFinder;
1213 foreach (array_merge(explode(':','OldTextFormattingRules:TextFormattingRules:PhpWikiAdministration'),
1214 $GLOBALS['AllActionPages'],
1215 array(constant('HOME_PAGE'))) as $f) {
1216 $page = gettext($f);
1217 if (isSubPage($page))
1218 $page = urlencode($page);
1219 if (! $dbi->isWikiPage(urldecode($page)) ) {
1220 // translated version provided?
1221 if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $page, 1))
1222 LoadAny($request, $lf);
1223 else { // load english version of required action page
1224 LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f)));
1228 if (! $dbi->isWikiPage(urldecode($page))) {
1229 trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page),
1235 EndLoadDump($request);
1238 function LoadPostFile (&$request)
1240 $upload = $request->getUploadedFile('file');
1243 $request->finish(_("No uploaded file to upload?")); // FIXME: more concise message
1246 // Dump http headers.
1247 StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
1250 $fd = $upload->open();
1252 LoadZip($request, $fd, false, array(_("RecentChanges")));
1254 LoadFile($request, $upload->getName(), $upload->getContents());
1257 EndLoadDump($request);
1261 $Log: not supported by cvs2svn $
1262 Revision 1.134 2004/12/20 16:05:01 rurban
1263 gettext msg unification
1265 Revision 1.133 2004/12/08 12:57:41 rurban
1266 page-specific timeouts for long multi-page requests
1268 Revision 1.132 2004/12/08 01:18:33 rurban
1269 Disallow loading config*.ini files. Detected by Santtu Jarvi.
1271 Revision 1.131 2004/11/30 17:48:38 rurban
1274 Revision 1.130 2004/11/25 08:28:12 rurban
1275 dont fatal on missing css or imgfiles and actually print the miss
1277 Revision 1.129 2004/11/25 08:11:40 rurban
1278 pass exclude to the get_all_pages backend
1280 Revision 1.128 2004/11/16 16:16:44 rurban
1281 enable Overwrite All for upgrade
1283 Revision 1.127 2004/11/01 10:43:57 rurban
1284 seperate PassUser methods into seperate dir (memory usage)
1285 fix WikiUser (old) overlarge data session
1286 remove wikidb arg from various page class methods, use global ->_dbi instead
1289 Revision 1.126 2004/10/16 15:13:39 rurban
1290 new [Overwrite All] button
1292 Revision 1.125 2004/10/14 19:19:33 rurban
1293 loadsave: check if the dumped file will be accessible from outside.
1294 and some other minor fixes. (cvsclient native not yet ready)
1296 Revision 1.124 2004/10/04 23:44:28 rurban
1297 for older or CGI phps
1299 Revision 1.123 2004/09/25 16:26:54 rurban
1300 deferr notifies (to be improved)
1302 Revision 1.122 2004/09/17 14:25:45 rurban
1305 Revision 1.121 2004/09/08 13:38:00 rurban
1306 improve loadfile stability by using markup=2 as default for undefined markup-style.
1307 use more refs for huge objects.
1308 fix debug=static issue in WikiPluginCached
1310 Revision 1.120 2004/07/08 19:04:42 rurban
1311 more unittest fixes (file backend, metadata RatingsDb)
1313 Revision 1.119 2004/07/08 15:23:59 rurban
1314 less verbose for tests
1316 Revision 1.118 2004/07/08 13:50:32 rurban
1317 various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
1319 Revision 1.117 2004/07/02 09:55:58 rurban
1320 more stability fixes: new DISABLE_GETIMAGESIZE if your php crashes when loading LinkIcons: failing getimagesize in old phps; blockparser stabilized
1322 Revision 1.116 2004/07/01 09:05:41 rurban
1323 support pages and exclude arguments for all 4 dump methods
1325 Revision 1.115 2004/07/01 08:51:22 rurban
1326 dumphtml: added exclude, print pagename before processing
1328 Revision 1.114 2004/06/28 12:51:41 rurban
1329 improved dumphtml and virgin setup
1331 Revision 1.113 2004/06/27 10:26:02 rurban
1332 oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1334 Revision 1.112 2004/06/25 14:29:20 rurban
1335 WikiGroup refactoring:
1336 global group attached to user, code for not_current user.
1337 improved helpers for special groups (avoid double invocations)
1338 new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1339 fixed a XHTML validation error on userprefs.tmpl
1341 Revision 1.111 2004/06/21 16:38:55 rurban
1342 fixed the StartLoadDump html argument hack.
1344 Revision 1.110 2004/06/21 16:22:30 rurban
1345 add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1346 fixed dumping buttons locally (images/buttons/),
1347 support pages arg for dumphtml,
1348 optional directory arg for dumpserial + dumphtml,
1349 fix a AllPages warning,
1350 show dump warnings/errors on DEBUG,
1351 don't warn just ignore on wikilens pagelist columns, if not loaded.
1352 RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1354 Revision 1.109 2004/06/17 11:31:05 rurban
1355 jump back to label after dump/upgrade
1357 Revision 1.108 2004/06/16 12:43:01 rurban
1358 4.0.6 cannot use this errorhandler (not found)
1360 Revision 1.107 2004/06/14 11:31:37 rurban
1361 renamed global $Theme to $WikiTheme (gforge nameclash)
1362 inherit PageList default options from PageList
1363 default sortby=pagename
1364 use options in PageList_Selectable (limit, sortby, ...)
1365 added action revert, with button at action=diff
1366 added option regex to WikiAdminSearchReplace
1368 Revision 1.106 2004/06/13 13:54:25 rurban
1369 Catch fatals on the four dump calls (as file and zip, as html and mimified)
1370 FoafViewer: Check against external requirements, instead of fatal.
1371 Change output for xhtmldumps: using file:// urls to the local fs.
1372 Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY
1373 Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini.
1375 Revision 1.105 2004/06/08 19:48:16 rurban
1376 fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found
1378 Revision 1.104 2004/06/08 13:51:57 rurban
1381 Revision 1.103 2004/06/08 10:54:46 rurban
1382 better acl dump representation, read back acl and owner
1384 Revision 1.102 2004/06/06 16:58:51 rurban
1385 added more required ActionPages for foreign languages
1386 install now english ActionPages if no localized are found. (again)
1387 fixed default anon user level to be 0, instead of -1
1388 (wrong "required administrator to view this page"...)
1390 Revision 1.101 2004/06/04 20:32:53 rurban
1391 Several locale related improvements suggested by Pierrick Meignen
1392 LDAP fix by John Cole
1393 reenable admin check without ENABLE_PAGEPERM in the admin plugins
1395 Revision 1.100 2004/05/02 21:26:38 rurban
1396 limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1397 because they will not survive db sessions, if too large.
1398 extended action=upgrade
1399 some WikiTranslation button work
1400 revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1401 some temp. session debug statements
1403 Revision 1.99 2004/05/02 15:10:07 rurban
1404 new finally reliable way to detect if /index.php is called directly
1405 and if to include lib/main.php
1406 new global AllActionPages
1407 SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1408 WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1409 PageGroupTestOne => subpages
1410 renamed PhpWikiRss to PhpWikiRecentChanges
1411 more docs, default configs, ...
1413 Revision 1.98 2004/04/29 23:25:12 rurban
1414 re-ordered locale init (as in 1.3.9)
1415 fixed loadfile with subpages, and merge/restore anyway
1416 (sf.net bug #844188)
1418 Revision 1.96 2004/04/19 23:13:03 zorloc
1419 Connect the rest of PhpWiki to the IniConfig system. Also the keyword regular expression is not a config setting
1421 Revision 1.95 2004/04/18 01:11:52 rurban
1422 more numeric pagename fixes.
1423 fixed action=upload with merge conflict warnings.
1424 charset changed from constant to global (dynamic utf-8 switching)
1426 Revision 1.94 2004/03/14 16:36:37 rurban
1427 dont load backup files
1429 Revision 1.93 2004/02/26 03:22:05 rurban
1430 also copy css and images with XHTML Dump
1432 Revision 1.92 2004/02/26 02:25:54 rurban
1433 fix empty and #-anchored links in XHTML Dumps
1435 Revision 1.91 2004/02/24 17:19:37 rurban
1436 debugging helpers only
1438 Revision 1.90 2004/02/24 17:09:24 rurban
1439 fixed \r\r\n with dumping on windows
1441 Revision 1.88 2004/02/22 23:20:31 rurban
1442 fixed DumpHtmlToDir,
1443 enhanced sortby handling in PageList
1444 new button_heading th style (enabled),
1445 added sortby and limit support to the db backends and plugins
1446 for paging support (<<prev, next>> links on long lists)
1448 Revision 1.87 2004/01/26 09:17:49 rurban
1449 * changed stored pref representation as before.
1450 the array of objects is 1) bigger and 2)
1451 less portable. If we would import packed pref
1452 objects and the object definition was changed, PHP would fail.
1453 This doesn't happen with an simple array of non-default values.
1454 * use $prefs->retrieve and $prefs->store methods, where retrieve
1455 understands the interim format of array of objects also.
1456 * simplified $prefs->get() and fixed $prefs->set()
1457 * added $user->_userid and class '_WikiUser' portability functions
1458 * fixed $user object ->_level upgrading, mostly using sessions.
1459 this fixes yesterdays problems with loosing authorization level.
1460 * fixed WikiUserNew::checkPass to return the _level
1461 * fixed WikiUserNew::isSignedIn
1462 * added explodePageList to class PageList, support sortby arg
1463 * fixed UserPreferences for WikiUserNew
1464 * fixed WikiPlugin for empty defaults array
1465 * UnfoldSubpages: added pagename arg, renamed pages arg,
1466 removed sort arg, support sortby arg
1468 Revision 1.86 2003/12/02 16:18:26 carstenklapp
1469 Minor enhancement: Provide more meaningful filenames for WikiDB zip
1472 Revision 1.85 2003/11/30 18:18:13 carstenklapp
1473 Minor code optimization: use include_once instead of require_once
1474 inside functions that might not always called.
1476 Revision 1.84 2003/11/26 20:47:47 carstenklapp
1477 Redo bugfix: My last refactoring broke merge-edit & overwrite
1478 functionality again, should be fixed now. Sorry.
1480 Revision 1.83 2003/11/20 22:18:54 carstenklapp
1481 New feature: h1 during merge-edit displays WikiLink to original page.
1482 Internal changes: Replaced some hackish url-generation code in
1483 function SavePage (for pgsrc merge-edit) with appropriate Button()
1486 Revision 1.82 2003/11/18 19:48:01 carstenklapp
1487 Fixed missing gettext _() for button name.
1489 Revision 1.81 2003/11/18 18:28:35 carstenklapp
1490 Bugfix: In the Load File function of PhpWikiAdministration: When doing
1491 a "Merge Edit" or "Restore Anyway", page names containing accented
1492 letters (such as locale/de/pgsrc/G%E4steBuch) would produce a file not
1493 found error (Use FilenameForPage funtion to urlencode page names).
1495 Revision 1.80 2003/03/07 02:46:57 dairiki
1496 Omit checks for safe_mode before set_time_limit(). Just prefix the
1497 set_time_limit() calls with @ so that they fail silently if not
1500 Revision 1.79 2003/02/26 01:56:05 dairiki
1501 Only zip pages with legal pagenames.
1503 Revision 1.78 2003/02/24 02:05:43 dairiki
1504 Fix "n bytes written" message when dumping HTML.
1506 Revision 1.77 2003/02/21 04:12:05 dairiki
1507 Minor fixes for new cached markup.
1509 Revision 1.76 2003/02/16 19:47:17 dairiki
1510 Update WikiDB timestamp when editing or deleting pages.
1512 Revision 1.75 2003/02/15 03:04:30 dairiki
1513 Fix for WikiUser constructor API change.
1515 Revision 1.74 2003/02/15 02:18:04 dairiki
1516 When default language was English (at least), pgsrc was being
1519 LimitedFileSet: Fix typo/bug. ($include was being ignored.)
1521 SetupWiki(): Fix bugs in loading of $GenericPages.
1523 Revision 1.73 2003/01/28 21:09:17 zorloc
1524 The get_cfg_var() function should only be used when one is
1525 interested in the value from php.ini or similar. Use ini_get()
1526 instead to get the effective value of a configuration variable.
1529 Revision 1.72 2003/01/03 22:25:53 carstenklapp
1530 Cosmetic fix to "Merge Edit" & "Overwrite" buttons. Added "The PhpWiki
1531 programming team" as author when loading from pgsrc. Source
1534 Revision 1.71 2003/01/03 02:48:05 carstenklapp
1535 function SavePage: Added loadfile options for overwriting or merge &
1536 compare a loaded pgsrc file with an existing page.
1538 function LoadAny: Added a general error message when unable to load a
1539 file instead of defaulting to "Bad file type".
1547 // c-basic-offset: 4
1548 // c-hanging-comment-ender-p: nil
1549 // indent-tabs-mode: nil