2 rcs_id('$Id: loadsave.php,v 1.133 2004-12-08 12:57:41 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;
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;
584 /* ignore fatals in plugins */
585 if (check_php_version(4,1)) {
586 global $ErrorManager;
587 $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler'));
590 $request_args = $request->args;
591 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
593 while ($page = $pages->next()) {
594 $request->args = $request_args; // some plugins might change them (esp. on POST)
595 longer_timeout($timeout); // Reset watchdog
597 $current = $page->getCurrentRevision();
598 if ($current->getVersion() == 0)
600 $pagename = $page->getName();
601 if (in_array($pagename, $excludeList)) {
605 $attrib = array('mtime' => $current->get('mtime'),
607 if ($page->get('locked'))
608 $attrib['write_protected'] = 1;
610 $request->setArg('pagename',$pagename); // Template::_basepage fix
611 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
612 $revision = $page->getCurrentRevision();
614 $transformedContent = $revision->getTransformedContent();
616 $template = new Template('browse', $request,
617 array('revision' => $revision,
618 'CONTENT' => $transformedContent));
620 $data = GeneratePageasXML($template, $pagename);
622 $zip->addRegularFile( $filename, $data, $attrib);
625 $request->_dbi->_cache->invalidate_cache($pagename);
626 unset ($request->_dbi->_cache->_pagedata_cache);
627 unset ($request->_dbi->_cache->_versiondata_cache);
628 unset ($request->_dbi->_cache->_glv_cache);
630 unset ($request->_dbi->_cache->_backend->_page_data);
632 unset($revision->_transformedContent);
634 unset($template->_request);
638 // FIXME: Deal with css and images here.
640 if (check_php_version(4,1)) {
641 global $ErrorManager;
642 $ErrorManager->popErrorHandler();
644 $WikiTheme->$HTML_DUMP_SUFFIX = '';
648 ////////////////////////////////////////////////////////////////
650 // Functions for restoring.
652 ////////////////////////////////////////////////////////////////
654 function SavePage (&$request, &$pageinfo, $source, $filename)
656 static $overwite_all = false;
657 $pagedata = $pageinfo['pagedata']; // Page level meta-data.
658 $versiondata = $pageinfo['versiondata']; // Revision level meta-data.
660 if (empty($pageinfo['pagename'])) {
661 PrintXML(HTML::dt(HTML::strong(_("Empty pagename!"))));
665 if (empty($versiondata['author_id']))
666 $versiondata['author_id'] = $versiondata['author'];
668 $pagename = $pageinfo['pagename'];
669 $content = $pageinfo['content'];
671 if ($pagename ==_("InterWikiMap"))
672 $content = _tryinsertInterWikiMap($content);
674 $dbi =& $request->_dbi;
675 $page = $dbi->getPage($pagename);
677 // Try to merge if updated pgsrc contents are different. This
678 // whole thing is hackish
680 // TODO: try merge unless:
681 // if (current contents = default contents && pgsrc_version >=
682 // pgsrc_version) then just upgrade this pgsrc
683 $needs_merge = false;
687 if ($request->getArg('merge')) {
690 else if ($request->getArg('overwrite')) {
694 $current = $page->getCurrentRevision();
695 if ( $current and (! $current->hasDefaultContents())
696 && ($current->getPackedContent() != $content)
697 && ($merging == true) ) {
698 include_once('lib/editpage.php');
699 $request->setArg('pagename', $pagename);
700 $r = $current->getVersion();
701 $request->setArg('revision', $current->getVersion());
702 $p = new LoadFileConflictPageEditor($request);
703 $p->_content = $content;
704 $p->_currentVersion = $r - 1;
705 $p->editPage($saveFailed = true);
706 return; //early return
709 foreach ($pagedata as $key => $value) {
711 $page->set($key, $value);
717 $mesg->pushContent(' ', fmt("from %s", $source));
721 //FIXME: This should not happen! (empty vdata, corrupt cache or db)
722 $current = $page->getCurrentRevision();
724 if ($current->getVersion() == 0) {
725 $mesg->pushContent(' - ', _("new page"));
729 if ( (! $current->hasDefaultContents())
730 && ($current->getPackedContent() != $content) ) {
732 $mesg->pushContent(' ',
733 fmt("has edit conflicts - overwriting anyway"));
735 if (substr_count($source, 'pgsrc')) {
736 $versiondata['author'] = _("The PhpWiki programming team");
737 // but leave authorid as userid who loaded the file
741 $mesg->pushContent(' ', fmt("has edit conflicts - skipped"));
742 $needs_merge = true; // hackish
746 else if ($current->getPackedContent() == $content
747 && $current->get('author') == $versiondata['author']) {
748 // The page metadata is already changed, we don't need a new revision.
749 // This was called previously "is identical to current version %d - skipped"
750 // which is wrong, since the pagedata was stored, not skipped.
751 $mesg->pushContent(' ',
752 fmt("content is identical to current version %d - no new revision created",
753 $current->getVersion()));
760 // in case of failures print the culprit:
761 if (!isa($request,'MockRequest')) {
762 PrintXML(HTML::dt(WikiLink($pagename))); flush();
764 $new = $page->save($content, WIKIDB_FORCE_CREATE, $versiondata);
766 $mesg->pushContent(' ', fmt("- saved to database as version %d",
767 $new->getVersion()));
771 // hackish, $source contains needed path+filename
772 $f = str_replace(sprintf(_("MIME file %s"), ''), '', $f);
773 $f = str_replace(sprintf(_("Serialized file %s"), ''), '', $f);
774 $f = str_replace(sprintf(_("plain file %s"), ''), '', $f);
775 //check if uploaded file? they pass just the content, but the file is gone
778 $meb = Button(array('action' => 'loadfile',
782 _("PhpWikiAdministration"),
784 $owb = Button(array('action' => 'loadfile',
788 _("PhpWikiAdministration"),
790 $mesg->pushContent(' ', $meb, " ", $owb);
791 if (!$overwite_all) {
792 $args = $request->getArgs();
793 $args['overwrite'] = 1;
796 _("PhpWikiAdministration"),
798 $mesg->pushContent(HTML::div(array('class' => 'hint'), $owb));
799 $overwite_all = true;
802 $mesg->pushContent(HTML::em(_(" Sorry, cannot merge.")));
806 if (!isa($request,'MockRequest')) {
808 PrintXML(HTML::dt(HTML::em(WikiLink($pagename))), $mesg);
815 // action=revert (by diff)
816 function RevertPage (&$request)
819 $pagename = $request->getArg('pagename');
820 $version = $request->getArg('version');
822 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
823 HTML::dd(_("missing required version argument")));
826 $dbi =& $request->_dbi;
827 $page = $dbi->getPage($pagename);
828 $current = $page->getCurrentRevision();
829 if ($current->getVersion() == 0) {
830 $mesg->pushContent(' ', _("no page content"));
831 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
835 if ($current->getVersion() == $version) {
836 $mesg->pushContent(' ', _("same version page"));
839 $rev = $page->getRevision($version);
840 $content = $rev->getPackedContent();
841 $versiondata = $rev->_data;
842 $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
843 $new = $page->save($content, $current->getVersion() + 1, $versiondata);
845 $mesg->pushContent(' ', fmt("- version %d saved to database as version %d",
846 $version, $new->getVersion()));
847 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
852 function _tryinsertInterWikiMap($content) {
854 if (strpos($content, "<verbatim>")) {
855 //$error_html = " The newly loaded pgsrc already contains a verbatim block.";
858 if (!$goback && !defined('INTERWIKI_MAP_FILE')) {
859 $error_html = sprintf(" "._("%s: not defined"), "INTERWIKI_MAP_FILE");
862 $mapfile = FindFile(INTERWIKI_MAP_FILE,1);
863 if (!$goback && !file_exists($mapfile)) {
864 $error_html = sprintf(" "._("%s: file not found"), INTERWIKI_MAP_FILE);
868 if (!empty($error_html))
869 trigger_error(_("Default InterWiki map file not loaded.")
870 . $error_html, E_USER_NOTICE);
874 // if loading from virgin setup do echo, otherwise trigger_error E_USER_NOTICE
875 if (!isa($GLOBALS['request'],'MockRequest'))
876 echo sprintf(_("Loading InterWikiMap from external file %s."), $mapfile),"<br />";
878 $fd = fopen ($mapfile, "rb");
879 $data = fread ($fd, filesize($mapfile));
881 $content = $content . "\n<verbatim>\n$data</verbatim>\n";
885 function ParseSerializedPage($text, $default_pagename, $user)
887 if (!preg_match('/^a:\d+:{[si]:\d+/', $text))
890 $pagehash = unserialize($text);
892 // Split up pagehash into four parts:
895 // page-level meta-data
896 // revision-level meta-data
898 if (!defined('FLAG_PAGE_LOCKED'))
899 define('FLAG_PAGE_LOCKED', 1);
900 $pageinfo = array('pagedata' => array(),
901 'versiondata' => array());
903 $pagedata = &$pageinfo['pagedata'];
904 $versiondata = &$pageinfo['versiondata'];
907 if (empty($pagehash['pagename']))
908 $pagehash['pagename'] = $default_pagename;
909 if (empty($pagehash['author'])) {
910 $pagehash['author'] = $user->getId();
913 foreach ($pagehash as $key => $value) {
918 $pageinfo[$key] = $value;
921 $pageinfo[$key] = join("\n", $value);
924 if (($value & FLAG_PAGE_LOCKED) != 0)
925 $pagedata['locked'] = 'yes';
929 $pagedata[$key] = $value;
933 $pagedata['perm'] = ParseMimeifiedPerm($value);
936 $versiondata['mtime'] = $value;
941 $versiondata[$key] = $value;
948 function SortByPageVersion ($a, $b) {
949 return $a['version'] - $b['version'];
953 * Security alert! We should not allow to import config.ini into our wiki (or from a sister wiki?)
954 * because the sql passwords are in plaintext there. And the webserver must be able to read it.
955 * Detected by Santtu Jarvi.
957 function LoadFile (&$request, $filename, $text = false, $mtime = false)
959 if (preg_match("/config$/", dirname($filename)) // our or other config
960 and preg_match("/config.*\.ini/", basename($filename))) // backups and other versions also
962 trigger_error(sprintf("Refused to load %s", $filename), E_USER_WARNING);
965 if (!is_string($text)) {
967 $stat = stat($filename);
969 $text = implode("", file($filename));
972 if (! $request->getArg('start_debug')) @set_time_limit(30); // Reset watchdog
973 else @set_time_limit(240);
975 // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
976 $basename = basename("/dummy/" . $filename);
979 $mtime = time(); // Last resort.
981 $default_pagename = rawurldecode($basename);
982 if ( ($parts = ParseMimeifiedPages($text)) ) {
983 usort($parts, 'SortByPageVersion');
984 foreach ($parts as $pageinfo)
985 SavePage($request, $pageinfo, sprintf(_("MIME file %s"),
986 $filename), $basename);
988 else if ( ($pageinfo = ParseSerializedPage($text, $default_pagename,
989 $request->getUser())) ) {
990 SavePage($request, $pageinfo, sprintf(_("Serialized file %s"),
991 $filename), $basename);
994 $user = $request->getUser();
996 // Assume plain text file.
997 $pageinfo = array('pagename' => $default_pagename,
998 'pagedata' => array(),
1000 => array('author' => $user->getId()),
1001 'content' => preg_replace('/[ \t\r]*\n/', "\n",
1004 SavePage($request, $pageinfo, sprintf(_("plain file %s"), $filename),
1009 function LoadZip (&$request, $zipfile, $files = false, $exclude = false) {
1010 $zip = new ZipReader($zipfile);
1011 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1012 while (list ($fn, $data, $attrib) = $zip->readFile()) {
1013 // FIXME: basename("filewithnoslashes") seems to return
1014 // garbage sometimes.
1015 $fn = basename("/dummy/" . $fn);
1016 if ( ($files && !in_array($fn, $files))
1017 || ($exclude && in_array($fn, $exclude)) ) {
1018 PrintXML(HTML::dt(WikiLink($fn)),
1019 HTML::dd(_("Skipping")));
1023 longer_timeout($timeout); // longer timeout per page
1024 LoadFile($request, $fn, $data, $attrib['mtime']);
1028 function LoadDir (&$request, $dirname, $files = false, $exclude = false) {
1029 $fileset = new LimitedFileSet($dirname, $files, $exclude);
1031 if (!$files and ($skiplist = $fileset->getSkippedFiles())) {
1032 PrintXML(HTML::dt(HTML::strong(_("Skipping"))));
1034 foreach ($skiplist as $file)
1035 $list->pushContent(HTML::li(WikiLink($file)));
1036 PrintXML(HTML::dd($list));
1039 // Defer HomePage loading until the end. If anything goes wrong
1040 // the pages can still be loaded again.
1041 $files = $fileset->getFiles();
1042 if (in_array(HOME_PAGE, $files)) {
1043 $files = array_diff($files, array(HOME_PAGE));
1044 $files[] = HOME_PAGE;
1046 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1047 foreach ($files as $file) {
1048 longer_timeout($timeout); // longer timeout per page
1049 if (substr($file,-1,1) != '~') // refuse to load backup files
1050 LoadFile($request, "$dirname/$file");
1054 class LimitedFileSet extends FileSet {
1055 function LimitedFileSet($dirname, $_include, $exclude) {
1056 $this->_includefiles = $_include;
1057 $this->_exclude = $exclude;
1058 $this->_skiplist = array();
1059 parent::FileSet($dirname);
1062 function _filenameSelector($fn) {
1063 $incl = &$this->_includefiles;
1064 $excl = &$this->_exclude;
1066 if ( ($incl && !in_array($fn, $incl))
1067 || ($excl && in_array($fn, $excl)) ) {
1068 $this->_skiplist[] = $fn;
1075 function getSkippedFiles () {
1076 return $this->_skiplist;
1081 function IsZipFile ($filename_or_fd)
1083 // See if it looks like zip file
1084 if (is_string($filename_or_fd))
1086 $fd = fopen($filename_or_fd, "rb");
1087 $magic = fread($fd, 4);
1092 $fpos = ftell($filename_or_fd);
1093 $magic = fread($filename_or_fd, 4);
1094 fseek($filename_or_fd, $fpos);
1097 return $magic == ZIP_LOCHEAD_MAGIC || $magic == ZIP_CENTHEAD_MAGIC;
1101 function LoadAny (&$request, $file_or_dir, $files = false, $exclude = false)
1103 // Try urlencoded filename for accented characters.
1104 if (!file_exists($file_or_dir)) {
1105 // Make sure there are slashes first to avoid confusing phps
1106 // with broken dirname or basename functions.
1107 // FIXME: windows uses \ and :
1108 if (is_integer(strpos($file_or_dir, "/"))) {
1109 $file_or_dir = FindFile($file_or_dir);
1111 if (!file_exists($file_or_dir))
1112 $file_or_dir = dirname($file_or_dir) . "/"
1113 . urlencode(basename($file_or_dir));
1115 // This is probably just a file.
1116 $file_or_dir = urlencode($file_or_dir);
1120 $type = filetype($file_or_dir);
1121 if ($type == 'link') {
1122 // For symbolic links, use stat() to determine
1123 // the type of the underlying file.
1124 list(,,$mode) = stat($file_or_dir);
1125 $type = ($mode >> 12) & 017;
1128 elseif ($type == 004)
1133 $request->finish(fmt("Unable to load: %s", $file_or_dir));
1135 else if ($type == 'dir') {
1136 LoadDir($request, $file_or_dir, $files, $exclude);
1138 else if ($type != 'file' && !preg_match('/^(http|ftp):/', $file_or_dir))
1140 $request->finish(fmt("Bad file type: %s", $type));
1142 else if (IsZipFile($file_or_dir)) {
1143 LoadZip($request, $file_or_dir, $files, $exclude);
1145 else /* if (!$files || in_array(basename($file_or_dir), $files)) */
1147 LoadFile($request, $file_or_dir);
1151 function LoadFileOrDir (&$request)
1153 $source = $request->getArg('source');
1154 $finder = new FileFinder;
1155 $source = $finder->slashifyPath($source);
1156 $page = rawurldecode(basename($source));
1157 StartLoadDump($request, fmt("Loading '%s'",
1158 HTML(dirname($source),
1159 dirname($source) ? "/" : "",
1160 WikiLink($page,'auto'))));
1162 LoadAny($request, $source);
1164 EndLoadDump($request);
1168 * HomePage was not found so first-time install is supposed to run.
1169 * - import all pgsrc pages.
1170 * - Todo: installer interface to edit config/config.ini settings
1171 * - Todo: ask for existing old index.php to convert to config/config.ini
1173 function SetupWiki (&$request)
1175 global $GenericPages, $LANG;
1177 //FIXME: This is a hack (err, "interim solution")
1178 // This is a bogo-bogo-login: Login without
1179 // saving login information in session state.
1180 // This avoids logging in the unsuspecting
1181 // visitor as "The PhpWiki programming team".
1183 // This really needs to be cleaned up...
1184 // (I'm working on it.)
1185 $real_user = $request->_user;
1186 if (ENABLE_USER_NEW)
1187 $request->_user = new _BogoUser(_("The PhpWiki programming team"));
1190 $request->_user = new WikiUser($request, _("The PhpWiki programming team"),
1193 StartLoadDump($request, _("Loading up virgin wiki"));
1196 $pgsrc = FindLocalizedFile(WIKI_PGSRC);
1197 $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC);
1199 $request->setArg('overwrite',true);
1200 if ($default_pgsrc != $pgsrc) {
1201 LoadAny($request, $default_pgsrc, $GenericPages);
1203 $request->setArg('overwrite',false);
1204 LoadAny($request, $pgsrc);
1205 $dbi =& $request->_dbi;
1207 // Ensure that all mandatory pages are loaded
1208 $finder = new FileFinder;
1209 foreach (array_merge(explode(':','OldTextFormattingRules:TextFormattingRules:PhpWikiAdministration'),
1210 $GLOBALS['AllActionPages'],
1211 array(constant('HOME_PAGE'))) as $f) {
1212 $page = gettext($f);
1213 if (isSubPage($page))
1214 $page = urlencode($page);
1215 if (! $dbi->isWikiPage(urldecode($page)) ) {
1216 // translated version provided?
1217 if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $page, 1))
1218 LoadAny($request, $lf);
1219 else { // load english version of required action page
1220 LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f)));
1224 if (! $dbi->isWikiPage(urldecode($page))) {
1225 trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page),
1231 EndLoadDump($request);
1234 function LoadPostFile (&$request)
1236 $upload = $request->getUploadedFile('file');
1239 $request->finish(_("No uploaded file to upload?")); // FIXME: more concise message
1242 // Dump http headers.
1243 StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
1246 $fd = $upload->open();
1248 LoadZip($request, $fd, false, array(_("RecentChanges")));
1250 LoadFile($request, $upload->getName(), $upload->getContents());
1253 EndLoadDump($request);
1257 $Log: not supported by cvs2svn $
1258 Revision 1.132 2004/12/08 01:18:33 rurban
1259 Disallow loading config*.ini files. Detected by Santtu Jarvi.
1261 Revision 1.131 2004/11/30 17:48:38 rurban
1264 Revision 1.130 2004/11/25 08:28:12 rurban
1265 dont fatal on missing css or imgfiles and actually print the miss
1267 Revision 1.129 2004/11/25 08:11:40 rurban
1268 pass exclude to the get_all_pages backend
1270 Revision 1.128 2004/11/16 16:16:44 rurban
1271 enable Overwrite All for upgrade
1273 Revision 1.127 2004/11/01 10:43:57 rurban
1274 seperate PassUser methods into seperate dir (memory usage)
1275 fix WikiUser (old) overlarge data session
1276 remove wikidb arg from various page class methods, use global ->_dbi instead
1279 Revision 1.126 2004/10/16 15:13:39 rurban
1280 new [Overwrite All] button
1282 Revision 1.125 2004/10/14 19:19:33 rurban
1283 loadsave: check if the dumped file will be accessible from outside.
1284 and some other minor fixes. (cvsclient native not yet ready)
1286 Revision 1.124 2004/10/04 23:44:28 rurban
1287 for older or CGI phps
1289 Revision 1.123 2004/09/25 16:26:54 rurban
1290 deferr notifies (to be improved)
1292 Revision 1.122 2004/09/17 14:25:45 rurban
1295 Revision 1.121 2004/09/08 13:38:00 rurban
1296 improve loadfile stability by using markup=2 as default for undefined markup-style.
1297 use more refs for huge objects.
1298 fix debug=static issue in WikiPluginCached
1300 Revision 1.120 2004/07/08 19:04:42 rurban
1301 more unittest fixes (file backend, metadata RatingsDb)
1303 Revision 1.119 2004/07/08 15:23:59 rurban
1304 less verbose for tests
1306 Revision 1.118 2004/07/08 13:50:32 rurban
1307 various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
1309 Revision 1.117 2004/07/02 09:55:58 rurban
1310 more stability fixes: new DISABLE_GETIMAGESIZE if your php crashes when loading LinkIcons: failing getimagesize in old phps; blockparser stabilized
1312 Revision 1.116 2004/07/01 09:05:41 rurban
1313 support pages and exclude arguments for all 4 dump methods
1315 Revision 1.115 2004/07/01 08:51:22 rurban
1316 dumphtml: added exclude, print pagename before processing
1318 Revision 1.114 2004/06/28 12:51:41 rurban
1319 improved dumphtml and virgin setup
1321 Revision 1.113 2004/06/27 10:26:02 rurban
1322 oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1324 Revision 1.112 2004/06/25 14:29:20 rurban
1325 WikiGroup refactoring:
1326 global group attached to user, code for not_current user.
1327 improved helpers for special groups (avoid double invocations)
1328 new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1329 fixed a XHTML validation error on userprefs.tmpl
1331 Revision 1.111 2004/06/21 16:38:55 rurban
1332 fixed the StartLoadDump html argument hack.
1334 Revision 1.110 2004/06/21 16:22:30 rurban
1335 add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1336 fixed dumping buttons locally (images/buttons/),
1337 support pages arg for dumphtml,
1338 optional directory arg for dumpserial + dumphtml,
1339 fix a AllPages warning,
1340 show dump warnings/errors on DEBUG,
1341 don't warn just ignore on wikilens pagelist columns, if not loaded.
1342 RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1344 Revision 1.109 2004/06/17 11:31:05 rurban
1345 jump back to label after dump/upgrade
1347 Revision 1.108 2004/06/16 12:43:01 rurban
1348 4.0.6 cannot use this errorhandler (not found)
1350 Revision 1.107 2004/06/14 11:31:37 rurban
1351 renamed global $Theme to $WikiTheme (gforge nameclash)
1352 inherit PageList default options from PageList
1353 default sortby=pagename
1354 use options in PageList_Selectable (limit, sortby, ...)
1355 added action revert, with button at action=diff
1356 added option regex to WikiAdminSearchReplace
1358 Revision 1.106 2004/06/13 13:54:25 rurban
1359 Catch fatals on the four dump calls (as file and zip, as html and mimified)
1360 FoafViewer: Check against external requirements, instead of fatal.
1361 Change output for xhtmldumps: using file:// urls to the local fs.
1362 Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY
1363 Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini.
1365 Revision 1.105 2004/06/08 19:48:16 rurban
1366 fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found
1368 Revision 1.104 2004/06/08 13:51:57 rurban
1371 Revision 1.103 2004/06/08 10:54:46 rurban
1372 better acl dump representation, read back acl and owner
1374 Revision 1.102 2004/06/06 16:58:51 rurban
1375 added more required ActionPages for foreign languages
1376 install now english ActionPages if no localized are found. (again)
1377 fixed default anon user level to be 0, instead of -1
1378 (wrong "required administrator to view this page"...)
1380 Revision 1.101 2004/06/04 20:32:53 rurban
1381 Several locale related improvements suggested by Pierrick Meignen
1382 LDAP fix by John Cole
1383 reenable admin check without ENABLE_PAGEPERM in the admin plugins
1385 Revision 1.100 2004/05/02 21:26:38 rurban
1386 limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1387 because they will not survive db sessions, if too large.
1388 extended action=upgrade
1389 some WikiTranslation button work
1390 revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1391 some temp. session debug statements
1393 Revision 1.99 2004/05/02 15:10:07 rurban
1394 new finally reliable way to detect if /index.php is called directly
1395 and if to include lib/main.php
1396 new global AllActionPages
1397 SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1398 WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1399 PageGroupTestOne => subpages
1400 renamed PhpWikiRss to PhpWikiRecentChanges
1401 more docs, default configs, ...
1403 Revision 1.98 2004/04/29 23:25:12 rurban
1404 re-ordered locale init (as in 1.3.9)
1405 fixed loadfile with subpages, and merge/restore anyway
1406 (sf.net bug #844188)
1408 Revision 1.96 2004/04/19 23:13:03 zorloc
1409 Connect the rest of PhpWiki to the IniConfig system. Also the keyword regular expression is not a config setting
1411 Revision 1.95 2004/04/18 01:11:52 rurban
1412 more numeric pagename fixes.
1413 fixed action=upload with merge conflict warnings.
1414 charset changed from constant to global (dynamic utf-8 switching)
1416 Revision 1.94 2004/03/14 16:36:37 rurban
1417 dont load backup files
1419 Revision 1.93 2004/02/26 03:22:05 rurban
1420 also copy css and images with XHTML Dump
1422 Revision 1.92 2004/02/26 02:25:54 rurban
1423 fix empty and #-anchored links in XHTML Dumps
1425 Revision 1.91 2004/02/24 17:19:37 rurban
1426 debugging helpers only
1428 Revision 1.90 2004/02/24 17:09:24 rurban
1429 fixed \r\r\n with dumping on windows
1431 Revision 1.88 2004/02/22 23:20:31 rurban
1432 fixed DumpHtmlToDir,
1433 enhanced sortby handling in PageList
1434 new button_heading th style (enabled),
1435 added sortby and limit support to the db backends and plugins
1436 for paging support (<<prev, next>> links on long lists)
1438 Revision 1.87 2004/01/26 09:17:49 rurban
1439 * changed stored pref representation as before.
1440 the array of objects is 1) bigger and 2)
1441 less portable. If we would import packed pref
1442 objects and the object definition was changed, PHP would fail.
1443 This doesn't happen with an simple array of non-default values.
1444 * use $prefs->retrieve and $prefs->store methods, where retrieve
1445 understands the interim format of array of objects also.
1446 * simplified $prefs->get() and fixed $prefs->set()
1447 * added $user->_userid and class '_WikiUser' portability functions
1448 * fixed $user object ->_level upgrading, mostly using sessions.
1449 this fixes yesterdays problems with loosing authorization level.
1450 * fixed WikiUserNew::checkPass to return the _level
1451 * fixed WikiUserNew::isSignedIn
1452 * added explodePageList to class PageList, support sortby arg
1453 * fixed UserPreferences for WikiUserNew
1454 * fixed WikiPlugin for empty defaults array
1455 * UnfoldSubpages: added pagename arg, renamed pages arg,
1456 removed sort arg, support sortby arg
1458 Revision 1.86 2003/12/02 16:18:26 carstenklapp
1459 Minor enhancement: Provide more meaningful filenames for WikiDB zip
1462 Revision 1.85 2003/11/30 18:18:13 carstenklapp
1463 Minor code optimization: use include_once instead of require_once
1464 inside functions that might not always called.
1466 Revision 1.84 2003/11/26 20:47:47 carstenklapp
1467 Redo bugfix: My last refactoring broke merge-edit & overwrite
1468 functionality again, should be fixed now. Sorry.
1470 Revision 1.83 2003/11/20 22:18:54 carstenklapp
1471 New feature: h1 during merge-edit displays WikiLink to original page.
1472 Internal changes: Replaced some hackish url-generation code in
1473 function SavePage (for pgsrc merge-edit) with appropriate Button()
1476 Revision 1.82 2003/11/18 19:48:01 carstenklapp
1477 Fixed missing gettext _() for button name.
1479 Revision 1.81 2003/11/18 18:28:35 carstenklapp
1480 Bugfix: In the Load File function of PhpWikiAdministration: When doing
1481 a "Merge Edit" or "Restore Anyway", page names containing accented
1482 letters (such as locale/de/pgsrc/G%E4steBuch) would produce a file not
1483 found error (Use FilenameForPage funtion to urlencode page names).
1485 Revision 1.80 2003/03/07 02:46:57 dairiki
1486 Omit checks for safe_mode before set_time_limit(). Just prefix the
1487 set_time_limit() calls with @ so that they fail silently if not
1490 Revision 1.79 2003/02/26 01:56:05 dairiki
1491 Only zip pages with legal pagenames.
1493 Revision 1.78 2003/02/24 02:05:43 dairiki
1494 Fix "n bytes written" message when dumping HTML.
1496 Revision 1.77 2003/02/21 04:12:05 dairiki
1497 Minor fixes for new cached markup.
1499 Revision 1.76 2003/02/16 19:47:17 dairiki
1500 Update WikiDB timestamp when editing or deleting pages.
1502 Revision 1.75 2003/02/15 03:04:30 dairiki
1503 Fix for WikiUser constructor API change.
1505 Revision 1.74 2003/02/15 02:18:04 dairiki
1506 When default language was English (at least), pgsrc was being
1509 LimitedFileSet: Fix typo/bug. ($include was being ignored.)
1511 SetupWiki(): Fix bugs in loading of $GenericPages.
1513 Revision 1.73 2003/01/28 21:09:17 zorloc
1514 The get_cfg_var() function should only be used when one is
1515 interested in the value from php.ini or similar. Use ini_get()
1516 instead to get the effective value of a configuration variable.
1519 Revision 1.72 2003/01/03 22:25:53 carstenklapp
1520 Cosmetic fix to "Merge Edit" & "Overwrite" buttons. Added "The PhpWiki
1521 programming team" as author when loading from pgsrc. Source
1524 Revision 1.71 2003/01/03 02:48:05 carstenklapp
1525 function SavePage: Added loadfile options for overwriting or merge &
1526 compare a loaded pgsrc file with an existing page.
1528 function LoadAny: Added a general error message when unable to load a
1529 file instead of defaulting to "Bad file type".
1537 // c-basic-offset: 4
1538 // c-hanging-comment-ender-p: nil
1539 // indent-tabs-mode: nil