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