2 rcs_id('$Id: loadsave.php,v 1.143 2006-08-25 21:48:39 rurban Exp $');
5 Copyright 1999,2000,2001,2002,2004,2005,2006 $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
24 require_once("lib/ziplib.php");
25 require_once("lib/Template.php");
28 * ignore fatal errors during dump
30 function _dump_error_handler(&$error) {
31 if ($error->isFatal()) {
32 $error->errno = E_USER_WARNING;
35 return true; // Ignore error
37 if (preg_match('/Plugin/', $error->errstr))
40 // let the message come through: call the remaining handlers:
44 function StartLoadDump(&$request, $title, $html = '')
46 // MockRequest is from the unit testsuite, a faked request. (may be cmd-line)
47 // We are silent on unittests.
48 if (isa($request,'MockRequest'))
50 // FIXME: This is a hack. This really is the worst overall hack in phpwiki.
52 $html->pushContent('%BODY%');
53 $tmpl = Template('html', array('TITLE' => $title,
55 'CONTENT' => $html ? $html : '%BODY%'));
56 echo ereg_replace('%BODY%.*', '', $tmpl->getExpansion($html));
57 $request->chunkOutput();
59 // set marker for sendPageChangeNotification()
60 $request->_deferredPageChangeNotification = array();
63 function EndLoadDump(&$request)
65 if (isa($request,'MockRequest'))
67 $action = $request->getArg('action');
70 case 'zip': $label = _("ZIP files of database"); break;
71 case 'dumpserial': $label = _("Dump to directory"); break;
72 case 'upload': $label = _("Upload File"); break;
73 case 'loadfile': $label = _("Load File"); break;
74 case 'upgrade': $label = _("Upgrade"); break;
76 case 'ziphtml': $label = _("Dump pages as XHTML"); break;
78 if ($label) $label = str_replace(" ","_",$label);
79 if ($action == 'browse') // loading virgin
80 $pagelink = WikiLink(HOME_PAGE);
82 $pagelink = WikiLink(new WikiPageName(_("PhpWikiAdministration"),false,$label));
84 // do deferred sendPageChangeNotification()
85 if (!empty($request->_deferredPageChangeNotification)) {
86 $pages = $all_emails = $all_users = array();
87 foreach ($request->_deferredPageChangeNotification as $p) {
88 list($pagename, $emails, $userids) = $p;
90 $all_emails = array_unique(array_merge($all_emails, $emails));
91 $all_users = array_unique(array_merge($all_users, $userids));
93 $editedby = sprintf(_("Edited by: %s"), $request->_user->getId());
94 $content = "Loaded the following pages:\n" . join("\n", $pages);
95 if (mail(join(',',$all_emails),"[".WIKI_NAME."] "._("LoadDump"),
99 trigger_error(sprintf(_("PageChange Notification of %s sent to %s"),
100 join("\n",$pages), join(',',$all_users)), E_USER_NOTICE);
102 trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"),
103 join("\n",$pages), join(',',$all_users)), E_USER_WARNING);
108 unset($request->_deferredPageChangeNotification);
110 PrintXML(HTML::p(HTML::strong(_("Complete."))),
111 HTML::p(fmt("Return to %s", $pagelink)));
112 echo "</body></html>\n";
116 ////////////////////////////////////////////////////////////////
118 // Functions for dumping.
120 ////////////////////////////////////////////////////////////////
124 * http://www.nacs.uci.edu/indiv/ehood/MIME/2045/rfc2045.html
125 * http://www.faqs.org/rfcs/rfc2045.html
126 * (RFC 1521 has been superceeded by RFC 2045 & others).
128 * Also see http://www.faqs.org/rfcs/rfc2822.html
130 function MailifyPage ($page, $nversions = 1)
132 $current = $page->getCurrentRevision();
135 if (STRICT_MAILABLE_PAGEDUMPS) {
136 $from = defined('SERVER_ADMIN') ? SERVER_ADMIN : 'foo@bar';
137 //This is for unix mailbox format: (not RFC (2)822)
138 // $head .= "From $from " . CTime(time()) . "\r\n";
139 $head .= "Subject: " . rawurlencode($page->getName()) . "\r\n";
140 $head .= "From: $from (PhpWiki)\r\n";
141 // RFC 2822 requires only a Date: and originator (From:)
142 // field, however the obsolete standard RFC 822 also
143 // requires a destination field.
144 $head .= "To: $from (PhpWiki)\r\n";
146 $head .= "Date: " . Rfc2822DateTime($current->get('mtime')) . "\r\n";
147 $head .= sprintf("Mime-Version: 1.0 (Produced by PhpWiki %s)\r\n",
150 // This should just be entered by hand (or by script?)
151 // in the actual pgsrc files, since only they should have
153 //$head .= "X-Rcs-Id: \$Id\$\r\n";
155 $iter = $page->getAllRevisions();
157 while ($revision = $iter->next()) {
158 $parts[] = MimeifyPageRevision($page, $revision);
159 if ($nversions > 0 && count($parts) >= $nversions)
162 if (count($parts) > 1)
163 return $head . MimeMultipart($parts);
165 return $head . $parts[0];
169 * Compute filename to used for storing contents of a wiki page.
171 * Basically we do a rawurlencode() which encodes everything except
172 * ASCII alphanumerics and '.', '-', and '_'.
174 * But we also want to encode leading dots to avoid filenames like
175 * '.', and '..'. (Also, there's no point in generating "hidden" file
176 * names, like '.foo'.)
178 * @param $pagename string Pagename.
179 * @return string Filename for page.
181 function FilenameForPage ($pagename)
183 $enc = rawurlencode($pagename);
184 // For every %2F will need to mkdir -p dirname($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 ($pages = $request->getArg('pages')) { // which pagenames
223 if ($pages == '[]') // current page
225 $page_iter = new WikiDB_Array_PageIterator(explodePageList($pages));
227 $page_iter = $dbi->getAllPages(false,false,false,$excludeList);
229 $request_args = $request->args;
230 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
232 while ($page = $page_iter->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 ($pages = $request->getArg('pages')) { // which pagenames
297 if ($pages == '[]') // current page
299 $page_iter = new WikiDB_Array_PageIterator(explodePageList($pages));
301 $page_iter = $dbi->getAllPages(false,false,false,$excludeList);
304 $request_args = $request->args;
305 $timeout = (! $request->getArg('start_debug')) ? 30 : 240;
307 while ($page = $page_iter->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);
355 function _copyMsg($page, $smallmsg) {
356 if (!isa($GLOBALS['request'], 'MockRequest')) {
357 if ($page) $msg = HTML(HTML::br(), HTML($page), HTML::small($smallmsg));
358 else $msg = HTML::small($smallmsg);
364 function mkdir_p($pathname, $permission = 0777) {
365 $arr = explode("/", $pathname);
367 return mkdir($pathname, $permission);
369 $s = array_shift($arr);
371 foreach ($arr as $p) {
374 $ok = mkdir($curr, $permission);
376 if (!$ok) return FALSE;
382 * Dump all pages as XHTML to a directory, as pagename.html.
383 * Copies all used css files to the directory, all used images to a
384 * "images" subdirectory, and all used buttons to a "images/buttons" subdirectory.
385 * The webserver must have write permissions to these directories.
386 * chown httpd HTML_DUMP_DIR; chmod u+rwx HTML_DUMP_DIR
389 * @param string directory (optional) path to dump to. Default: HTML_DUMP_DIR
390 * @param string pages (optional) Comma-seperated of glob-style pagenames to dump
391 * @param string exclude (optional) Comma-seperated of glob-style pagenames to exclude
393 function DumpHtmlToDir (&$request)
395 $directory = $request->getArg('directory');
396 if (empty($directory))
397 $directory = HTML_DUMP_DIR; // See lib/plugin/WikiForm.php:87
398 if (empty($directory))
399 $request->finish(_("You must specify a directory to dump to"));
401 // see if we can access the directory the user wants us to use
402 if (! file_exists($directory)) {
403 if (! mkdir($directory, 0755))
404 $request->finish(fmt("Cannot create directory '%s'", $directory));
406 $html = HTML::p(fmt("Created directory '%s' for the page dump...",
409 $html = HTML::p(fmt("Using directory '%s'", $directory));
411 $request->_TemplatesProcessed = array();
412 StartLoadDump($request, _("Dumping Pages"), $html);
413 $thispage = $request->getArg('pagename'); // for "Return to ..."
415 $dbi =& $request->_dbi;
416 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
417 $excludeList = explodePageList($exclude);
419 $excludeList = array();
421 if ($pages = $request->getArg('pages')) { // which pagenames
422 if ($pages == '[]') // current page
424 $page_iter = new WikiDB_Array_PageIterator(explodePageList($pages));
425 // not at admin page: dump only the current page
426 } elseif ($thispage != _("PhpWikiAdministration")) {
427 $page_iter = new WikiDB_Array_PageIterator(array($thispage));
429 $page_iter = $dbi->getAllPages(false,false,false,$excludeList);
433 if (defined('HTML_DUMP_SUFFIX'))
434 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
435 $WikiTheme->DUMP_MODE = 'HTML';
436 $_bodyAttr = @$WikiTheme->_MoreAttr['body'];
437 unset($WikiTheme->_MoreAttr['body']);
439 // check if the dumped file will be accessible from outside
440 $doc_root = $request->get("DOCUMENT_ROOT");
441 $ldir = NormalizeLocalFileName($directory);
442 $wikiroot = NormalizeLocalFileName('');
443 if (string_starts_with($ldir, $doc_root)) {
444 $link_prefix = substr($directory, strlen($doc_root))."/";
445 } elseif (string_starts_with($ldir, $wikiroot)) {
446 $link_prefix = NormalizeWebFileName(substr($directory, strlen($wikiroot)))."/";
450 $prefix = '/' . substr($doc_root,0,2); // add drive where apache is installed
452 $link_prefix = "file://".$prefix.$directory."/";
455 $request_args = $request->args;
456 $timeout = (! $request->getArg('start_debug')) ? 20 : 240;
458 while ($page = $page_iter->next()) {
459 $request->args = $request_args; // some plugins might change them (esp. on POST)
460 longer_timeout($timeout); // Reset watchdog
462 $pagename = $page->getName();
463 if (!isa($request,'MockRequest')) {
464 PrintXML(HTML::br(), $pagename, ' ... ');
467 if (in_array($pagename, $excludeList)) {
468 if (!isa($request,'MockRequest')) {
469 PrintXML(_("Skipped."));
475 $request->setArg('pagename', $pagename); // Template::_basepage fix
476 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
477 $revision = $page->getCurrentRevision();
478 $args = array('revision' => $revision,
479 'CONTENT' => $revision->getTransformedContent());
480 // For every %2F will need to mkdir -p dirname($pagename)
481 if (preg_match("/%2F/", $filename)) {
482 // mkdir -p and set relative base for subdir pages
483 $dirname = dirname($pagename);
484 mkdir_p($directory."/".$dirname);
485 $count = substr_count($filename, "%2F");
486 $filename = preg_replace("/%2F/", "/", $filename);
487 $relative_base = "../";
489 $relative_base .= "../";
492 $args['relative_base'] = $relative_base;
495 $template = new Template('browse', $request,
496 array('revision' => $revision,
497 'CONTENT' => $revision->getTransformedContent()));
499 $data = GeneratePageasXML($template, $pagename);
501 if ( !($fd = fopen($directory."/".$filename, "wb")) ) {
502 $msg->pushContent(HTML::strong(fmt("couldn't open file '%s' for writing",
503 "$directory/$filename")));
504 $request->finish($msg);
506 $num = fwrite($fd, $data, strlen($data));
507 if ($page->getName() != $filename) {
508 $link = LinkURL($link_prefix.$filename, $filename);
509 $msg->pushContent(HTML::small(_("saved as "), $link, " ... "));
511 $msg->pushContent(HTML::small(fmt("%s bytes written", $num), "\n"));
512 if (!isa($request, 'MockRequest')) {
516 $request->chunkOutput();
518 assert($num == strlen($data));
522 $request->_dbi->_cache->invalidate_cache($pagename);
523 unset ($request->_dbi->_cache->_pagedata_cache);
524 unset ($request->_dbi->_cache->_versiondata_cache);
525 unset ($request->_dbi->_cache->_glv_cache);
527 unset ($request->_dbi->_cache->_backend->_page_data);
530 unset($revision->_transformedContent);
532 unset($template->_request);
538 if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) {
539 @mkdir("$directory/images");
540 foreach ($WikiTheme->dumped_images as $img_file) {
542 and ($from = $WikiTheme->_findFile($img_file, true))
545 $target = "$directory/images/".basename($img_file);
546 if (copy($WikiTheme->_path . $from, $target)) {
547 _copyMsg($from, fmt("... copied to %s", $target));
549 _copyMsg($from, fmt("... not copied to %s", $target));
552 _copyMsg($from, _("... not found"));
556 if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) {
558 @mkdir("$directory/images/buttons");
559 foreach ($WikiTheme->dumped_buttons as $text => $img_file) {
561 and ($from = $WikiTheme->_findFile($img_file, true))
564 $target = "$directory/images/buttons/".basename($img_file);
565 if (copy($WikiTheme->_path . $from, $target)) {
566 _copyMsg($from, fmt("... copied to %s", $target));
568 _copyMsg($from, fmt("... not copied to %s", $target));
571 _copyMsg($from, _("... not found"));
575 if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) {
576 foreach ($WikiTheme->dumped_css as $css_file) {
578 and ($from = $WikiTheme->_findFile(basename($css_file), true))
581 $target = "$directory/" . basename($css_file);
582 if (copy($WikiTheme->_path . $from, $target)) {
583 _copyMsg($from, fmt("... copied to %s", $target));
585 _copyMsg($from, fmt("... not copied to %s", $target));
588 _copyMsg($from, _("... not found"));
592 $WikiTheme->HTML_DUMP_SUFFIX = '';
593 $WikiTheme->DUMP_MODE = false;
594 $WikiTheme->_MoreAttr['body'] = $_bodyAttr;
596 $request->setArg('pagename',$thispage); // Template::_basepage fix
597 EndLoadDump($request);
600 /* Known problem: any plugins or other code which echo()s text will
601 * lead to a corrupted html zip file which may produce the following
602 * errors upon unzipping:
604 * warning [wikihtml.zip]: 2401 extra bytes at beginning or within zipfile
605 * file #58: bad zipfile offset (local header sig): 177561
606 * (attempting to re-compensate)
608 * However, the actual wiki page data should be unaffected.
610 function MakeWikiZipHtml (&$request)
612 $request->_TemplatesProcessed = array();
613 $zipname = "wikihtml.zip";
614 $zip = new ZipWriter("Created by PhpWiki " . PHPWIKI_VERSION, $zipname);
615 $dbi =& $request->_dbi;
616 $thispage = $request->getArg('pagename'); // for "Return to ..."
617 if ($exclude = $request->getArg('exclude')) { // exclude which pagenames
618 $excludeList = explodePageList($exclude);
620 $excludeList = array();
622 if ($pages = $request->getArg('pages')) { // which pagenames
623 if ($pages == '[]') // current page
625 $page_iter = new WikiDB_Array_PageIterator(explodePageList($pages));
627 $page_iter = $dbi->getAllPages(false,false,false,$excludeList);
631 if (defined('HTML_DUMP_SUFFIX'))
632 $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX;
633 $WikiTheme->DUMP_MODE = 'ZIPHTML';
634 $_bodyAttr = @$WikiTheme->_MoreAttr['body'];
635 unset($WikiTheme->_MoreAttr['body']);
637 /* ignore fatals in plugins */
638 if (check_php_version(4,1)) {
639 global $ErrorManager;
640 $ErrorManager->pushErrorHandler(new WikiFunctionCb('_dump_error_handler'));
643 $request_args = $request->args;
644 $timeout = (! $request->getArg('start_debug')) ? 20 : 240;
646 while ($page = $page_iter->next()) {
647 $request->args = $request_args; // some plugins might change them (esp. on POST)
648 longer_timeout($timeout); // Reset watchdog
650 $current = $page->getCurrentRevision();
651 if ($current->getVersion() == 0)
653 $pagename = $page->getName();
654 if (in_array($pagename, $excludeList)) {
658 $attrib = array('mtime' => $current->get('mtime'),
660 if ($page->get('locked'))
661 $attrib['write_protected'] = 1;
663 $request->setArg('pagename',$pagename); // Template::_basepage fix
664 $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX;
665 $revision = $page->getCurrentRevision();
667 $transformedContent = $revision->getTransformedContent();
669 $template = new Template('browse', $request,
670 array('revision' => $revision,
671 'CONTENT' => $transformedContent));
673 $data = GeneratePageasXML($template, $pagename);
675 $zip->addRegularFile( $filename, $data, $attrib );
678 $request->_dbi->_cache->invalidate_cache($pagename);
679 unset ($request->_dbi->_cache->_pagedata_cache);
680 unset ($request->_dbi->_cache->_versiondata_cache);
681 unset ($request->_dbi->_cache->_glv_cache);
683 unset ($request->_dbi->_cache->_backend->_page_data);
685 unset($revision->_transformedContent);
687 unset($template->_request);
694 // Deal with css and images here.
695 if (!empty($WikiTheme->dumped_images) and is_array($WikiTheme->dumped_images)) {
696 // dirs are created automatically
697 //if ($WikiTheme->dumped_images) $zip->addRegularFile("images", "", $attrib);
698 foreach ($WikiTheme->dumped_images as $img_file) {
699 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
700 $target = "images/".basename($img_file);
701 if (check_php_version(4,3))
702 $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib);
704 $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib);
708 if (!empty($WikiTheme->dumped_buttons) and is_array($WikiTheme->dumped_buttons)) {
709 //if ($WikiTheme->dumped_buttons) $zip->addRegularFile("images/buttons", "", $attrib);
710 foreach ($WikiTheme->dumped_buttons as $text => $img_file) {
711 if (($from = $WikiTheme->_findFile($img_file, true)) and basename($from)) {
712 $target = "images/buttons/".basename($img_file);
713 if (check_php_version(4,3))
714 $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib);
716 $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib);
720 if (!empty($WikiTheme->dumped_css) and is_array($WikiTheme->dumped_css)) {
721 foreach ($WikiTheme->dumped_css as $css_file) {
722 if (($from = $WikiTheme->_findFile(basename($css_file), true)) and basename($from)) {
723 $target = basename($css_file);
724 if (check_php_version(4,3))
725 $zip->addRegularFile($target, file_get_contents($WikiTheme->_path . $from), $attrib);
727 $zip->addRegularFile($target, join('', file($WikiTheme->_path . $from)), $attrib);
733 if (check_php_version(4,1)) {
734 global $ErrorManager;
735 $ErrorManager->popErrorHandler();
737 $WikiTheme->HTML_DUMP_SUFFIX = '';
738 $WikiTheme->DUMP_MODE = false;
739 $WikiTheme->_MoreAttr['body'] = $_bodyAttr;
743 ////////////////////////////////////////////////////////////////
745 // Functions for restoring.
747 ////////////////////////////////////////////////////////////////
749 function SavePage (&$request, &$pageinfo, $source, $filename)
751 static $overwite_all = false;
752 $pagedata = $pageinfo['pagedata']; // Page level meta-data.
753 $versiondata = $pageinfo['versiondata']; // Revision level meta-data.
755 if (empty($pageinfo['pagename'])) {
756 PrintXML(HTML::dt(HTML::strong(_("Empty pagename!"))));
760 if (empty($versiondata['author_id']))
761 $versiondata['author_id'] = $versiondata['author'];
763 $pagename = $pageinfo['pagename'];
764 $content = $pageinfo['content'];
766 if ($pagename ==_("InterWikiMap"))
767 $content = _tryinsertInterWikiMap($content);
769 $dbi =& $request->_dbi;
770 $page = $dbi->getPage($pagename);
772 // Try to merge if updated pgsrc contents are different. This
773 // whole thing is hackish
775 // TODO: try merge unless:
776 // if (current contents = default contents && pgsrc_version >=
777 // pgsrc_version) then just upgrade this pgsrc
778 $needs_merge = false;
782 if ($request->getArg('merge')) {
785 else if ($request->getArg('overwrite')) {
789 $current = $page->getCurrentRevision();
790 if ( $current and (! $current->hasDefaultContents())
791 && ($current->getPackedContent() != $content)
792 && ($merging == true) ) {
793 include_once('lib/editpage.php');
794 $request->setArg('pagename', $pagename);
795 $r = $current->getVersion();
796 $request->setArg('revision', $current->getVersion());
797 $p = new LoadFileConflictPageEditor($request);
798 $p->_content = $content;
799 $p->_currentVersion = $r - 1;
800 $p->editPage($saveFailed = true);
801 return; //early return
804 foreach ($pagedata as $key => $value) {
806 $page->set($key, $value);
812 $mesg->pushContent(' ', fmt("from %s", $source));
816 //FIXME: This should not happen! (empty vdata, corrupt cache or db)
817 $current = $page->getCurrentRevision();
819 if ($current->getVersion() == 0) {
820 $mesg->pushContent(' - ', _("New page"));
824 if ( (! $current->hasDefaultContents())
825 && ($current->getPackedContent() != $content) ) {
827 $mesg->pushContent(' ',
828 fmt("has edit conflicts - overwriting anyway"));
830 if (substr_count($source, 'pgsrc')) {
831 $versiondata['author'] = _("The PhpWiki programming team");
832 // but leave authorid as userid who loaded the file
836 $mesg->pushContent(' ', fmt("has edit conflicts - skipped"));
837 $needs_merge = true; // hackish
841 else if ($current->getPackedContent() == $content
842 && $current->get('author') == $versiondata['author']) {
843 // The page metadata is already changed, we don't need a new revision.
844 // This was called previously "is identical to current version %d - skipped"
845 // which is wrong, since the pagedata was stored, not skipped.
846 $mesg->pushContent(' ',
847 fmt("content is identical to current version %d - no new revision created",
848 $current->getVersion()));
855 // in case of failures print the culprit:
856 if (!isa($request,'MockRequest')) {
857 PrintXML(HTML::dt(WikiLink($pagename))); flush();
859 $new = $page->save($content, WIKIDB_FORCE_CREATE, $versiondata);
861 $mesg->pushContent(' ', fmt("- saved to database as version %d",
862 $new->getVersion()));
866 // hackish, $source contains needed path+filename
867 $f = str_replace(sprintf(_("MIME file %s"), ''), '', $f);
868 $f = str_replace(sprintf(_("Serialized file %s"), ''), '', $f);
869 $f = str_replace(sprintf(_("plain file %s"), ''), '', $f);
870 //check if uploaded file? they pass just the content, but the file is gone
873 $meb = Button(array('action' => 'loadfile',
877 _("PhpWikiAdministration"),
879 $owb = Button(array('action' => 'loadfile',
883 _("PhpWikiAdministration"),
885 $mesg->pushContent(' ', $meb, " ", $owb);
886 if (!$overwite_all) {
887 $args = $request->getArgs();
888 $args['overwrite'] = 1;
891 _("PhpWikiAdministration"),
893 $mesg->pushContent(HTML::div(array('class' => 'hint'), $owb));
894 $overwite_all = true;
897 $mesg->pushContent(HTML::em(_(" Sorry, cannot merge.")));
901 if (!isa($request,'MockRequest')) {
903 PrintXML(HTML::dt(HTML::em(WikiLink($pagename))), $mesg);
910 // action=revert (by diff)
911 function RevertPage (&$request)
914 $pagename = $request->getArg('pagename');
915 $version = $request->getArg('version');
917 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
918 HTML::dd(_("missing required version argument")));
921 $dbi =& $request->_dbi;
922 $page = $dbi->getPage($pagename);
923 $current = $page->getCurrentRevision();
924 $currversion = $current->getVersion();
925 if ($currversion == 0) {
926 $mesg->pushContent(' ', _("no page content"));
927 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
932 if ($currversion == $version) {
933 $mesg->pushContent(' ', _("same version page"));
934 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
939 if ($request->getArg('cancel')) {
940 $mesg->pushContent(' ', _("Cancelled"));
941 PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)),
946 if (!$request->getArg('verify')) {
947 $mesg->pushContent(HTML::br(),
950 HTML::form(array('action' => $request->getPostURL(),
952 HiddenInputs($request->getArgs(), false, array('verify')),
953 HiddenInputs(array('verify' => 1)),
954 Button('submit:verify', _("Yes"), 'button'),
956 Button('submit:cancel', _("Cancel"), 'button')));
957 $rev = $page->getRevision($version);
958 $html = HTML(HTML::dt(fmt("Revert %s to version $version", WikiLink($pagename))),
960 $rev->getTransformedContent());
961 $template = Template('browse',
962 array('CONTENT' => $html));
963 GeneratePage($template, $pagename, $rev);
964 $request->checkValidators();
968 $rev = $page->getRevision($version);
969 $content = $rev->getPackedContent();
970 $versiondata = $rev->_data;
971 $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
972 $new = $page->save($content, $currversion + 1, $versiondata);
975 $pagelink = WikiLink($pagename);
976 $mesg->pushContent(fmt("Revert: %s", $pagelink),
977 fmt("- version %d saved to database as version %d",
978 $version, $new->getVersion()));
979 // Force browse of current page version.
980 $request->setArg('version', false);
981 $template = Template('savepage', array());
982 $template->replace('CONTENT', $new->getTransformedContent());
984 GeneratePage($template, $mesg, $new);
988 function _tryinsertInterWikiMap($content) {
990 if (strpos($content, "<verbatim>")) {
991 //$error_html = " The newly loaded pgsrc already contains a verbatim block.";
994 if (!$goback && !defined('INTERWIKI_MAP_FILE')) {
995 $error_html = sprintf(" "._("%s: not defined"), "INTERWIKI_MAP_FILE");
998 $mapfile = FindFile(INTERWIKI_MAP_FILE,1);
999 if (!$goback && !file_exists($mapfile)) {
1000 $error_html = sprintf(" "._("%s: file not found"), INTERWIKI_MAP_FILE);
1004 if (!empty($error_html))
1005 trigger_error(_("Default InterWiki map file not loaded.")
1006 . $error_html, E_USER_NOTICE);
1010 // if loading from virgin setup do echo, otherwise trigger_error E_USER_NOTICE
1011 if (!isa($GLOBALS['request'], 'MockRequest'))
1012 echo sprintf(_("Loading InterWikiMap from external file %s."), $mapfile),"<br />";
1014 $fd = fopen ($mapfile, "rb");
1015 $data = fread ($fd, filesize($mapfile));
1017 $content = $content . "\n<verbatim>\n$data</verbatim>\n";
1021 function ParseSerializedPage($text, $default_pagename, $user)
1023 if (!preg_match('/^a:\d+:{[si]:\d+/', $text))
1026 $pagehash = unserialize($text);
1028 // Split up pagehash into four parts:
1031 // page-level meta-data
1032 // revision-level meta-data
1034 if (!defined('FLAG_PAGE_LOCKED'))
1035 define('FLAG_PAGE_LOCKED', 1);
1036 $pageinfo = array('pagedata' => array(),
1037 'versiondata' => array());
1039 $pagedata = &$pageinfo['pagedata'];
1040 $versiondata = &$pageinfo['versiondata'];
1042 // Fill in defaults.
1043 if (empty($pagehash['pagename']))
1044 $pagehash['pagename'] = $default_pagename;
1045 if (empty($pagehash['author'])) {
1046 $pagehash['author'] = $user->getId();
1049 foreach ($pagehash as $key => $value) {
1054 $pageinfo[$key] = $value;
1057 $pageinfo[$key] = join("\n", $value);
1060 if (($value & FLAG_PAGE_LOCKED) != 0)
1061 $pagedata['locked'] = 'yes';
1065 $pagedata[$key] = $value;
1069 $pagedata['perm'] = ParseMimeifiedPerm($value);
1071 case 'lastmodified':
1072 $versiondata['mtime'] = $value;
1077 $versiondata[$key] = $value;
1084 function SortByPageVersion ($a, $b) {
1085 return $a['version'] - $b['version'];
1089 * Security alert! We should not allow to import config.ini into our wiki (or from a sister wiki?)
1090 * because the sql passwords are in plaintext there. And the webserver must be able to read it.
1091 * Detected by Santtu Jarvi.
1093 function LoadFile (&$request, $filename, $text = false, $mtime = false)
1095 if (preg_match("/config$/", dirname($filename)) // our or other config
1096 and preg_match("/config.*\.ini/", basename($filename))) // backups and other versions also
1098 trigger_error(sprintf("Refused to load %s", $filename), E_USER_WARNING);
1101 if (!is_string($text)) {
1103 $stat = stat($filename);
1105 $text = implode("", file($filename));
1108 if (! $request->getArg('start_debug')) @set_time_limit(30); // Reset watchdog
1109 else @set_time_limit(240);
1111 // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
1112 $basename = basename("/dummy/" . $filename);
1115 $mtime = time(); // Last resort.
1117 $default_pagename = rawurldecode($basename);
1118 if ( ($parts = ParseMimeifiedPages($text)) ) {
1119 usort($parts, 'SortByPageVersion');
1120 foreach ($parts as $pageinfo)
1121 SavePage($request, $pageinfo, sprintf(_("MIME file %s"),
1122 $filename), $basename);
1124 else if ( ($pageinfo = ParseSerializedPage($text, $default_pagename,
1125 $request->getUser())) ) {
1126 SavePage($request, $pageinfo, sprintf(_("Serialized file %s"),
1127 $filename), $basename);
1130 $user = $request->getUser();
1132 // Assume plain text file.
1133 $pageinfo = array('pagename' => $default_pagename,
1134 'pagedata' => array(),
1136 => array('author' => $user->getId()),
1137 'content' => preg_replace('/[ \t\r]*\n/', "\n",
1140 SavePage($request, $pageinfo, sprintf(_("plain file %s"), $filename),
1145 function LoadZip (&$request, $zipfile, $files = false, $exclude = false) {
1146 $zip = new ZipReader($zipfile);
1147 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1148 while (list ($fn, $data, $attrib) = $zip->readFile()) {
1149 // FIXME: basename("filewithnoslashes") seems to return
1150 // garbage sometimes.
1151 $fn = basename("/dummy/" . $fn);
1152 if ( ($files && !in_array($fn, $files))
1153 || ($exclude && in_array($fn, $exclude)) ) {
1154 PrintXML(HTML::dt(WikiLink($fn)),
1155 HTML::dd(_("Skipping")));
1159 longer_timeout($timeout); // longer timeout per page
1160 LoadFile($request, $fn, $data, $attrib['mtime']);
1164 function LoadDir (&$request, $dirname, $files = false, $exclude = false) {
1165 $fileset = new LimitedFileSet($dirname, $files, $exclude);
1167 if (!$files and ($skiplist = $fileset->getSkippedFiles())) {
1168 PrintXML(HTML::dt(HTML::strong(_("Skipping"))));
1170 foreach ($skiplist as $file)
1171 $list->pushContent(HTML::li(WikiLink($file)));
1172 PrintXML(HTML::dd($list));
1175 // Defer HomePage loading until the end. If anything goes wrong
1176 // the pages can still be loaded again.
1177 $files = $fileset->getFiles();
1178 if (in_array(HOME_PAGE, $files)) {
1179 $files = array_diff($files, array(HOME_PAGE));
1180 $files[] = HOME_PAGE;
1182 $timeout = (! $request->getArg('start_debug')) ? 20 : 120;
1183 foreach ($files as $file) {
1184 longer_timeout($timeout); // longer timeout per page
1185 if (substr($file,-1,1) != '~') // refuse to load backup files
1186 LoadFile($request, "$dirname/$file");
1190 class LimitedFileSet extends FileSet {
1191 function LimitedFileSet($dirname, $_include, $exclude) {
1192 $this->_includefiles = $_include;
1193 $this->_exclude = $exclude;
1194 $this->_skiplist = array();
1195 parent::FileSet($dirname);
1198 function _filenameSelector($fn) {
1199 $incl = &$this->_includefiles;
1200 $excl = &$this->_exclude;
1202 if ( ($incl && !in_array($fn, $incl))
1203 || ($excl && in_array($fn, $excl)) ) {
1204 $this->_skiplist[] = $fn;
1211 function getSkippedFiles () {
1212 return $this->_skiplist;
1217 function IsZipFile ($filename_or_fd)
1219 // See if it looks like zip file
1220 if (is_string($filename_or_fd))
1222 $fd = fopen($filename_or_fd, "rb");
1223 $magic = fread($fd, 4);
1228 $fpos = ftell($filename_or_fd);
1229 $magic = fread($filename_or_fd, 4);
1230 fseek($filename_or_fd, $fpos);
1233 return $magic == ZIP_LOCHEAD_MAGIC || $magic == ZIP_CENTHEAD_MAGIC;
1237 function LoadAny (&$request, $file_or_dir, $files = false, $exclude = false)
1239 // Try urlencoded filename for accented characters.
1240 if (!file_exists($file_or_dir)) {
1241 // Make sure there are slashes first to avoid confusing phps
1242 // with broken dirname or basename functions.
1243 // FIXME: windows uses \ and :
1244 if (is_integer(strpos($file_or_dir, "/"))) {
1245 $file_or_dir = FindFile($file_or_dir);
1247 if (!file_exists($file_or_dir))
1248 $file_or_dir = dirname($file_or_dir) . "/"
1249 . urlencode(basename($file_or_dir));
1251 // This is probably just a file.
1252 $file_or_dir = urlencode($file_or_dir);
1256 $type = filetype($file_or_dir);
1257 if ($type == 'link') {
1258 // For symbolic links, use stat() to determine
1259 // the type of the underlying file.
1260 list(,,$mode) = stat($file_or_dir);
1261 $type = ($mode >> 12) & 017;
1264 elseif ($type == 004)
1269 $request->finish(fmt("Unable to load: %s", $file_or_dir));
1271 else if ($type == 'dir') {
1272 LoadDir($request, $file_or_dir, $files, $exclude);
1274 else if ($type != 'file' && !preg_match('/^(http|ftp):/', $file_or_dir))
1276 $request->finish(fmt("Bad file type: %s", $type));
1278 else if (IsZipFile($file_or_dir)) {
1279 LoadZip($request, $file_or_dir, $files, $exclude);
1281 else /* if (!$files || in_array(basename($file_or_dir), $files)) */
1283 LoadFile($request, $file_or_dir);
1287 function LoadFileOrDir (&$request)
1289 $source = $request->getArg('source');
1290 $finder = new FileFinder;
1291 $source = $finder->slashifyPath($source);
1292 $page = rawurldecode(basename($source));
1293 StartLoadDump($request, fmt("Loading '%s'",
1294 HTML(dirname($source),
1295 dirname($source) ? "/" : "",
1296 WikiLink($page,'auto'))));
1298 LoadAny($request, $source);
1300 EndLoadDump($request);
1304 * HomePage was not found so first-time install is supposed to run.
1305 * - import all pgsrc pages.
1306 * - Todo: installer interface to edit config/config.ini settings
1307 * - Todo: ask for existing old index.php to convert to config/config.ini
1308 * - Todo: theme-specific pages:
1309 * blog - HomePage, ADMIN_USER/Blogs
1311 function SetupWiki (&$request)
1313 global $GenericPages, $LANG;
1315 //FIXME: This is a hack (err, "interim solution")
1316 // This is a bogo-bogo-login: Login without
1317 // saving login information in session state.
1318 // This avoids logging in the unsuspecting
1319 // visitor as "The PhpWiki programming team".
1321 // This really needs to be cleaned up...
1322 // (I'm working on it.)
1323 $real_user = $request->_user;
1324 if (ENABLE_USER_NEW)
1325 $request->_user = new _BogoUser(_("The PhpWiki programming team"));
1328 $request->_user = new WikiUser($request, _("The PhpWiki programming team"),
1331 StartLoadDump($request, _("Loading up virgin wiki"));
1334 $pgsrc = FindLocalizedFile(WIKI_PGSRC);
1335 $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC);
1337 $request->setArg('overwrite', true);
1338 if ($default_pgsrc != $pgsrc) {
1339 LoadAny($request, $default_pgsrc, $GenericPages);
1341 $request->setArg('overwrite', false);
1342 LoadAny($request, $pgsrc);
1343 $dbi =& $request->_dbi;
1345 // Ensure that all mandatory pages are loaded
1346 $finder = new FileFinder;
1347 foreach (array_merge(explode(':','Help/OldTextFormattingRules:Help/TextFormattingRules:PhpWikiAdministration'),
1348 $GLOBALS['AllActionPages'],
1349 array(constant('HOME_PAGE'))) as $f)
1351 $page = gettext($f);
1352 $epage = urlencode($page);
1353 if (! $dbi->isWikiPage($page) ) {
1354 // translated version provided?
1355 if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $epage, 1)) {
1356 LoadAny($request, $lf);
1357 } else { // load english version of required action page
1358 LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f)));
1362 if (! $dbi->isWikiPage($page)) {
1363 trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page),
1369 EndLoadDump($request);
1372 function LoadPostFile (&$request)
1374 $upload = $request->getUploadedFile('file');
1377 $request->finish(_("No uploaded file to upload?")); // FIXME: more concise message
1380 // Dump http headers.
1381 StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
1384 $fd = $upload->open();
1386 LoadZip($request, $fd, false, array(_("RecentChanges")));
1388 LoadFile($request, $upload->getName(), $upload->getContents());
1391 EndLoadDump($request);
1395 $Log: not supported by cvs2svn $
1396 Revision 1.142 2006/03/19 17:16:32 rurban
1397 remove remaining cruft
1399 Revision 1.141 2006/03/19 17:11:32 rurban
1400 add verify to RevertPage, display reverted page as template
1402 Revision 1.140 2006/03/07 20:45:43 rurban
1403 wikihash for php-5.1
1405 Revision 1.139 2005/08/27 18:02:43 rurban
1406 fix and expand pages
1408 Revision 1.138 2005/08/27 09:39:10 rurban
1409 dumphtml when not at admin page: dump the current or given page
1411 Revision 1.137 2005/01/30 23:14:38 rurban
1414 Revision 1.136 2005/01/25 07:07:24 rurban
1415 remove body tags in html dumps, add css and images to zipdumps, simplify printing
1417 Revision 1.135 2004/12/26 17:17:25 rurban
1418 announce dumps - mult.requests to avoid request::finish, e.g. LinkDatabase, PdfOut, ...
1420 Revision 1.134 2004/12/20 16:05:01 rurban
1421 gettext msg unification
1423 Revision 1.133 2004/12/08 12:57:41 rurban
1424 page-specific timeouts for long multi-page requests
1426 Revision 1.132 2004/12/08 01:18:33 rurban
1427 Disallow loading config*.ini files. Detected by Santtu Jarvi.
1429 Revision 1.131 2004/11/30 17:48:38 rurban
1432 Revision 1.130 2004/11/25 08:28:12 rurban
1433 dont fatal on missing css or imgfiles and actually print the miss
1435 Revision 1.129 2004/11/25 08:11:40 rurban
1436 pass exclude to the get_all_pages backend
1438 Revision 1.128 2004/11/16 16:16:44 rurban
1439 enable Overwrite All for upgrade
1441 Revision 1.127 2004/11/01 10:43:57 rurban
1442 seperate PassUser methods into seperate dir (memory usage)
1443 fix WikiUser (old) overlarge data session
1444 remove wikidb arg from various page class methods, use global ->_dbi instead
1447 Revision 1.126 2004/10/16 15:13:39 rurban
1448 new [Overwrite All] button
1450 Revision 1.125 2004/10/14 19:19:33 rurban
1451 loadsave: check if the dumped file will be accessible from outside.
1452 and some other minor fixes. (cvsclient native not yet ready)
1454 Revision 1.124 2004/10/04 23:44:28 rurban
1455 for older or CGI phps
1457 Revision 1.123 2004/09/25 16:26:54 rurban
1458 deferr notifies (to be improved)
1460 Revision 1.122 2004/09/17 14:25:45 rurban
1463 Revision 1.121 2004/09/08 13:38:00 rurban
1464 improve loadfile stability by using markup=2 as default for undefined markup-style.
1465 use more refs for huge objects.
1466 fix debug=static issue in WikiPluginCached
1468 Revision 1.120 2004/07/08 19:04:42 rurban
1469 more unittest fixes (file backend, metadata RatingsDb)
1471 Revision 1.119 2004/07/08 15:23:59 rurban
1472 less verbose for tests
1474 Revision 1.118 2004/07/08 13:50:32 rurban
1475 various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
1477 Revision 1.117 2004/07/02 09:55:58 rurban
1478 more stability fixes: new DISABLE_GETIMAGESIZE if your php crashes when loading LinkIcons: failing getimagesize in old phps; blockparser stabilized
1480 Revision 1.116 2004/07/01 09:05:41 rurban
1481 support pages and exclude arguments for all 4 dump methods
1483 Revision 1.115 2004/07/01 08:51:22 rurban
1484 dumphtml: added exclude, print pagename before processing
1486 Revision 1.114 2004/06/28 12:51:41 rurban
1487 improved dumphtml and virgin setup
1489 Revision 1.113 2004/06/27 10:26:02 rurban
1490 oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1492 Revision 1.112 2004/06/25 14:29:20 rurban
1493 WikiGroup refactoring:
1494 global group attached to user, code for not_current user.
1495 improved helpers for special groups (avoid double invocations)
1496 new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1497 fixed a XHTML validation error on userprefs.tmpl
1499 Revision 1.111 2004/06/21 16:38:55 rurban
1500 fixed the StartLoadDump html argument hack.
1502 Revision 1.110 2004/06/21 16:22:30 rurban
1503 add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1504 fixed dumping buttons locally (images/buttons/),
1505 support pages arg for dumphtml,
1506 optional directory arg for dumpserial + dumphtml,
1507 fix a AllPages warning,
1508 show dump warnings/errors on DEBUG,
1509 don't warn just ignore on wikilens pagelist columns, if not loaded.
1510 RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1512 Revision 1.109 2004/06/17 11:31:05 rurban
1513 jump back to label after dump/upgrade
1515 Revision 1.108 2004/06/16 12:43:01 rurban
1516 4.0.6 cannot use this errorhandler (not found)
1518 Revision 1.107 2004/06/14 11:31:37 rurban
1519 renamed global $Theme to $WikiTheme (gforge nameclash)
1520 inherit PageList default options from PageList
1521 default sortby=pagename
1522 use options in PageList_Selectable (limit, sortby, ...)
1523 added action revert, with button at action=diff
1524 added option regex to WikiAdminSearchReplace
1526 Revision 1.106 2004/06/13 13:54:25 rurban
1527 Catch fatals on the four dump calls (as file and zip, as html and mimified)
1528 FoafViewer: Check against external requirements, instead of fatal.
1529 Change output for xhtmldumps: using file:// urls to the local fs.
1530 Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY
1531 Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini.
1533 Revision 1.105 2004/06/08 19:48:16 rurban
1534 fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found
1536 Revision 1.104 2004/06/08 13:51:57 rurban
1539 Revision 1.103 2004/06/08 10:54:46 rurban
1540 better acl dump representation, read back acl and owner
1542 Revision 1.102 2004/06/06 16:58:51 rurban
1543 added more required ActionPages for foreign languages
1544 install now english ActionPages if no localized are found. (again)
1545 fixed default anon user level to be 0, instead of -1
1546 (wrong "required administrator to view this page"...)
1548 Revision 1.101 2004/06/04 20:32:53 rurban
1549 Several locale related improvements suggested by Pierrick Meignen
1550 LDAP fix by John Cole
1551 reenable admin check without ENABLE_PAGEPERM in the admin plugins
1553 Revision 1.100 2004/05/02 21:26:38 rurban
1554 limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1555 because they will not survive db sessions, if too large.
1556 extended action=upgrade
1557 some WikiTranslation button work
1558 revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1559 some temp. session debug statements
1561 Revision 1.99 2004/05/02 15:10:07 rurban
1562 new finally reliable way to detect if /index.php is called directly
1563 and if to include lib/main.php
1564 new global AllActionPages
1565 SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1566 WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1567 PageGroupTestOne => subpages
1568 renamed PhpWikiRss to PhpWikiRecentChanges
1569 more docs, default configs, ...
1571 Revision 1.98 2004/04/29 23:25:12 rurban
1572 re-ordered locale init (as in 1.3.9)
1573 fixed loadfile with subpages, and merge/restore anyway
1574 (sf.net bug #844188)
1576 Revision 1.96 2004/04/19 23:13:03 zorloc
1577 Connect the rest of PhpWiki to the IniConfig system. Also the keyword regular expression is not a config setting
1579 Revision 1.95 2004/04/18 01:11:52 rurban
1580 more numeric pagename fixes.
1581 fixed action=upload with merge conflict warnings.
1582 charset changed from constant to global (dynamic utf-8 switching)
1584 Revision 1.94 2004/03/14 16:36:37 rurban
1585 dont load backup files
1587 Revision 1.93 2004/02/26 03:22:05 rurban
1588 also copy css and images with XHTML Dump
1590 Revision 1.92 2004/02/26 02:25:54 rurban
1591 fix empty and #-anchored links in XHTML Dumps
1593 Revision 1.91 2004/02/24 17:19:37 rurban
1594 debugging helpers only
1596 Revision 1.90 2004/02/24 17:09:24 rurban
1597 fixed \r\r\n with dumping on windows
1599 Revision 1.88 2004/02/22 23:20:31 rurban
1600 fixed DumpHtmlToDir,
1601 enhanced sortby handling in PageList
1602 new button_heading th style (enabled),
1603 added sortby and limit support to the db backends and plugins
1604 for paging support (<<prev, next>> links on long lists)
1606 Revision 1.87 2004/01/26 09:17:49 rurban
1607 * changed stored pref representation as before.
1608 the array of objects is 1) bigger and 2)
1609 less portable. If we would import packed pref
1610 objects and the object definition was changed, PHP would fail.
1611 This doesn't happen with an simple array of non-default values.
1612 * use $prefs->retrieve and $prefs->store methods, where retrieve
1613 understands the interim format of array of objects also.
1614 * simplified $prefs->get() and fixed $prefs->set()
1615 * added $user->_userid and class '_WikiUser' portability functions
1616 * fixed $user object ->_level upgrading, mostly using sessions.
1617 this fixes yesterdays problems with loosing authorization level.
1618 * fixed WikiUserNew::checkPass to return the _level
1619 * fixed WikiUserNew::isSignedIn
1620 * added explodePageList to class PageList, support sortby arg
1621 * fixed UserPreferences for WikiUserNew
1622 * fixed WikiPlugin for empty defaults array
1623 * UnfoldSubpages: added pagename arg, renamed pages arg,
1624 removed sort arg, support sortby arg
1626 Revision 1.86 2003/12/02 16:18:26 carstenklapp
1627 Minor enhancement: Provide more meaningful filenames for WikiDB zip
1630 Revision 1.85 2003/11/30 18:18:13 carstenklapp
1631 Minor code optimization: use include_once instead of require_once
1632 inside functions that might not always called.
1634 Revision 1.84 2003/11/26 20:47:47 carstenklapp
1635 Redo bugfix: My last refactoring broke merge-edit & overwrite
1636 functionality again, should be fixed now. Sorry.
1638 Revision 1.83 2003/11/20 22:18:54 carstenklapp
1639 New feature: h1 during merge-edit displays WikiLink to original page.
1640 Internal changes: Replaced some hackish url-generation code in
1641 function SavePage (for pgsrc merge-edit) with appropriate Button()
1644 Revision 1.82 2003/11/18 19:48:01 carstenklapp
1645 Fixed missing gettext _() for button name.
1647 Revision 1.81 2003/11/18 18:28:35 carstenklapp
1648 Bugfix: In the Load File function of PhpWikiAdministration: When doing
1649 a "Merge Edit" or "Restore Anyway", page names containing accented
1650 letters (such as locale/de/pgsrc/G%E4steBuch) would produce a file not
1651 found error (Use FilenameForPage funtion to urlencode page names).
1653 Revision 1.80 2003/03/07 02:46:57 dairiki
1654 Omit checks for safe_mode before set_time_limit(). Just prefix the
1655 set_time_limit() calls with @ so that they fail silently if not
1658 Revision 1.79 2003/02/26 01:56:05 dairiki
1659 Only zip pages with legal pagenames.
1661 Revision 1.78 2003/02/24 02:05:43 dairiki
1662 Fix "n bytes written" message when dumping HTML.
1664 Revision 1.77 2003/02/21 04:12:05 dairiki
1665 Minor fixes for new cached markup.
1667 Revision 1.76 2003/02/16 19:47:17 dairiki
1668 Update WikiDB timestamp when editing or deleting pages.
1670 Revision 1.75 2003/02/15 03:04:30 dairiki
1671 Fix for WikiUser constructor API change.
1673 Revision 1.74 2003/02/15 02:18:04 dairiki
1674 When default language was English (at least), pgsrc was being
1677 LimitedFileSet: Fix typo/bug. ($include was being ignored.)
1679 SetupWiki(): Fix bugs in loading of $GenericPages.
1681 Revision 1.73 2003/01/28 21:09:17 zorloc
1682 The get_cfg_var() function should only be used when one is
1683 interested in the value from php.ini or similar. Use ini_get()
1684 instead to get the effective value of a configuration variable.
1687 Revision 1.72 2003/01/03 22:25:53 carstenklapp
1688 Cosmetic fix to "Merge Edit" & "Overwrite" buttons. Added "The PhpWiki
1689 programming team" as author when loading from pgsrc. Source
1692 Revision 1.71 2003/01/03 02:48:05 carstenklapp
1693 function SavePage: Added loadfile options for overwriting or merge &
1694 compare a loaded pgsrc file with an existing page.
1696 function LoadAny: Added a general error message when unable to load a
1697 file instead of defaulting to "Bad file type".
1705 // c-basic-offset: 4
1706 // c-hanging-comment-ender-p: nil
1707 // indent-tabs-mode: nil