2 /* Copyright (C) 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam
4 * This file is part of PhpWiki.
6 * PhpWiki is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * PhpWiki is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with PhpWiki; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Customize output by themes: templates, css, special links functions,
23 * and more formatting.
26 require_once(dirname(__FILE__).'/HtmlElement.php');
29 * Make a link to a wiki page (in this wiki).
31 * This is a convenience function.
33 * @param mixed $page_or_rev
35 * <dt>A string</dt><dd>The page to link to.</dd>
36 * <dt>A WikiDB_Page object</dt><dd>The page to link to.</dd>
37 * <dt>A WikiDB_PageRevision object</dt><dd>A specific version of the page to link to.</dd>
42 * <dt>'unknown'</dt><dd>Make link appropriate for a non-existant page.</dd>
43 * <dt>'known'</dt><dd>Make link appropriate for an existing page.</dd>
44 * <dt>'auto'</dt><dd>Either 'unknown' or 'known' as appropriate.</dd>
45 * <dt>'button'</dt><dd>Make a button-style link.</dd>
46 * <dt>'if_known'</dt><dd>Only linkify if page exists.</dd>
48 * Unless $type of of the latter form, the link will be of class 'wiki', 'wikiunknown',
49 * 'named-wiki', or 'named-wikiunknown', as appropriate.
51 * @param mixed $label (string or XmlContent object)
52 * Label for the link. If not given, defaults to the page name.
54 * @return XmlContent The link
56 function WikiLink ($page_or_rev, $type = 'known', $label = false) {
57 global $WikiTheme, $request;
59 if ($type == 'button') {
60 return $WikiTheme->makeLinkButton($page_or_rev, $label);
65 if (isa($page_or_rev, 'WikiDB_PageRevision')) {
66 $version = $page_or_rev->getVersion();
67 if ($page_or_rev->isCurrent())
69 $page = $page_or_rev->getPage();
70 $pagename = $page->getName();
71 $wikipage = $pagename;
74 elseif (isa($page_or_rev, 'WikiDB_Page')) {
76 $pagename = $page->getName();
77 $wikipage = $pagename;
79 elseif (isa($page_or_rev, 'WikiPageName')) {
80 $wikipage = $page_or_rev;
81 $pagename = $wikipage->name;
82 if (!$wikipage->isValid('strict'))
83 return $WikiTheme->linkBadWikiWord($wikipage, $label);
86 $wikipage = new WikiPageName($page_or_rev, $request->getPage());
87 $pagename = $wikipage->name;
88 if (!$wikipage->isValid('strict'))
89 return $WikiTheme->linkBadWikiWord($wikipage, $label);
92 if ($type == 'auto' or $type == 'if_known') {
94 $exists = $page->exists();
97 $dbi =& $request->_dbi;
98 $exists = $dbi->isWikiPage($wikipage->name);
101 elseif ($type == 'unknown') {
108 // FIXME: this should be somewhere else, if really needed.
109 // WikiLink makes A link, not a string of fancy ones.
110 // (I think that the fancy split links are just confusing.)
111 // Todo: test external ImageLinks http://some/images/next.gif
112 if (isa($wikipage, 'WikiPageName') and
114 strchr(substr($wikipage->shortName,1), SUBPAGE_SEPARATOR))
116 $parts = explode(SUBPAGE_SEPARATOR, $wikipage->shortName);
117 $last_part = array_pop($parts);
119 $link = HTML::span();
120 foreach ($parts as $part) {
122 $parent = join(SUBPAGE_SEPARATOR, $path);
123 if ($WikiTheme->_autosplitWikiWords)
126 $link->pushContent($WikiTheme->linkExistingWikiWord($parent, $sep . $part));
127 $sep = $WikiTheme->_autosplitWikiWords
128 ? ' ' . SUBPAGE_SEPARATOR : SUBPAGE_SEPARATOR;
131 $link->pushContent($WikiTheme->linkExistingWikiWord($wikipage, $sep . $last_part,
134 $link->pushContent($WikiTheme->linkUnknownWikiWord($wikipage, $sep . $last_part));
139 return $WikiTheme->linkExistingWikiWord($wikipage, $label, $version);
141 elseif ($type == 'if_known') {
142 if (!$label && isa($wikipage, 'WikiPageName'))
143 $label = $wikipage->shortName;
144 return HTML($label ? $label : $pagename);
147 return $WikiTheme->linkUnknownWikiWord($wikipage, $label);
156 * This is a convenience function.
158 * @param $action string
160 * <dt>[action]</dt><dd>Perform action (e.g. 'edit') on the selected page.</dd>
161 * <dt>[ActionPage]</dt><dd>Run the actionpage (e.g. 'BackLinks') on the selected page.</dd>
162 * <dt>'submit:'[name]</dt><dd>Make a form submission button with the given name.
163 * ([name] can be blank for a nameless submit button.)</dd>
164 * <dt>a hash</dt><dd>Query args for the action. E.g.<pre>
165 * array('action' => 'diff', 'previous' => 'author')
169 * @param $label string
170 * A label for the button. If ommited, a suitable default (based on the valued of $action)
173 * @param $page_or_rev mixed
174 * Which page (& version) to perform the action on.
176 * <dt>A string</dt><dd>The pagename.</dd>
177 * <dt>A WikiDB_Page object</dt><dd>The page.</dd>
178 * <dt>A WikiDB_PageRevision object</dt><dd>A specific version of the page.</dd>
180 * ($Page_or_rev is ignored for submit buttons.)
182 function Button ($action, $label = false, $page_or_rev = false, $options = false) {
185 if (!is_array($action) && preg_match('/^submit:(.*)/', $action, $m))
186 return $WikiTheme->makeSubmitButton($label, $m[1], $page_or_rev, $options);
188 return $WikiTheme->makeActionButton($action, $label, $page_or_rev, $options);
192 var $HTML_DUMP_SUFFIX = '';
193 var $DUMP_MODE = false, $dumped_images, $dumped_css;
196 * noinit: Do not initialize unnecessary items in default_theme fallback twice.
198 function Theme ($theme_name = 'default', $noinit = false) {
199 $this->_name = $theme_name;
200 $this->_themes_dir = NormalizeLocalFileName("themes");
201 $this->_path = defined('PHPWIKI_DIR') ? NormalizeLocalFileName("") : "";
202 $this->_theme = "themes/$theme_name";
204 if ($theme_name != 'default')
205 $this->_default_theme = new Theme('default',true);
208 $script_url = deduce_script_name();
209 if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug']))
210 $script_url .= ("?start_debug=".$_GET['start_debug']);
211 $this->addMoreHeaders(JavaScript("var data_path = '". javascript_quote_string(DATA_PATH) ."';\n"
212 ."var pagename = '". javascript_quote_string($GLOBALS['request']->getArg('pagename')) ."';\n"
213 ."var script_url= '". javascript_quote_string($script_url) ."';\n"
214 ."var stylepath = '". javascript_quote_string(DATA_PATH) . '/'.$this->_theme."/';\n"));
216 if ((is_object($GLOBALS['request']) // guard against unittests
217 and $GLOBALS['request']->getPref('doubleClickEdit'))
218 or ENABLE_DOUBLECLICKEDIT)
219 $this->initDoubleClickEdit();
221 // will be replaced by acDropDown
222 if (ENABLE_LIVESEARCH) { // by bitflux.ch
223 $this->initLiveSearch();
225 // replaces external LiveSearch
226 if (defined("ENABLE_ACDROPDOWN") and ENABLE_ACDROPDOWN) {
227 $this->initMoAcDropDown();
229 $this->_css = array();
232 function file ($file) {
233 return $this->_path . "$this->_theme/$file";
236 function _findFile ($file, $missing_okay = false) {
237 if (file_exists($this->file($file)))
238 return "$this->_theme/$file";
240 // FIXME: this is a short-term hack. Delete this after all files
241 // get moved into themes/...
242 if (file_exists($this->_path . $file))
245 if (isset($this->_default_theme)) {
246 return $this->_default_theme->_findFile($file, $missing_okay);
248 else if (!$missing_okay) {
249 if (DEBUG & function_exists('debug_backtrace')) { // >= 4.3.0
250 echo "<pre>", printSimpleTrace(debug_backtrace()), "</pre>\n";
252 trigger_error("$this->_theme/$file: not found", E_USER_NOTICE);
257 function _findData ($file, $missing_okay = false) {
258 $path = $this->_findFile($file, $missing_okay);
262 if (defined('DATA_PATH'))
263 return DATA_PATH . "/$path";
267 ////////////////////////////////////////////////////////////////
269 // Date and Time formatting
271 ////////////////////////////////////////////////////////////////
273 // Note: Windows' implemetation of strftime does not include certain
274 // format specifiers, such as %e (for date without leading zeros). In
276 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp
277 // As a result, we have to use %d, and strip out leading zeros ourselves.
279 var $_dateFormat = "%B %d, %Y";
280 var $_timeFormat = "%I:%M %p";
282 var $_showModTime = true;
285 * Set format string used for dates.
287 * @param $fs string Format string for dates.
289 * @param $show_mod_time bool If true (default) then times
290 * are included in the messages generated by getLastModifiedMessage(),
291 * otherwise, only the date of last modification will be shown.
293 function setDateFormat ($fs, $show_mod_time = true) {
294 $this->_dateFormat = $fs;
295 $this->_showModTime = $show_mod_time;
299 * Set format string used for times.
301 * @param $fs string Format string for times.
303 function setTimeFormat ($fs) {
304 $this->_timeFormat = $fs;
310 * Any time zone offset specified in the users preferences is
311 * taken into account by this method.
313 * @param $time_t integer Unix-style time.
315 * @return string The date.
317 function formatDate ($time_t) {
320 $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
321 // strip leading zeros from date elements (ie space followed by zero)
322 return preg_replace('/ 0/', ' ',
323 strftime($this->_dateFormat, $offset_time));
329 * Any time zone offset specified in the users preferences is
330 * taken into account by this method.
332 * @param $time_t integer Unix-style time.
334 * @return string The time.
336 function formatTime ($time_t) {
337 //FIXME: make 24-hour mode configurable?
339 $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
340 return preg_replace('/^0/', ' ',
341 strtolower(strftime($this->_timeFormat, $offset_time)));
345 * Format a date and time.
347 * Any time zone offset specified in the users preferences is
348 * taken into account by this method.
350 * @param $time_t integer Unix-style time.
352 * @return string The date and time.
354 function formatDateTime ($time_t) {
355 return $this->formatDate($time_t) . ' ' . $this->formatTime($time_t);
359 * Format a (possibly relative) date.
361 * If enabled in the users preferences, this method might
362 * return a relative day (e.g. 'Today', 'Yesterday').
364 * Any time zone offset specified in the users preferences is
365 * taken into account by this method.
367 * @param $time_t integer Unix-style time.
369 * @return string The day.
371 function getDay ($time_t) {
374 if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($time_t))) {
375 return ucfirst($date);
377 return $this->formatDate($time_t);
381 * Format the "last modified" message for a page revision.
383 * @param $revision object A WikiDB_PageRevision object.
385 * @param $show_version bool Should the page version number
386 * be included in the message. (If this argument is omitted,
387 * then the version number will be shown only iff the revision
388 * is not the current one.
390 * @return string The "last modified" message.
392 function getLastModifiedMessage ($revision, $show_version = 'auto') {
394 if (!$revision) return '';
396 // dates >= this are considered invalid.
397 if (! defined('EPOCH'))
398 define('EPOCH', 0); // seconds since ~ January 1 1970
400 $mtime = $revision->get('mtime');
402 return fmt("Never edited");
404 if ($show_version == 'auto')
405 $show_version = !$revision->isCurrent();
407 if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($mtime))) {
408 if ($this->_showModTime)
409 $date = sprintf(_("%s at %s"),
410 $date, $this->formatTime($mtime));
413 return fmt("Version %s, saved %s", $revision->getVersion(), $date);
415 return fmt("Last edited %s", $date);
418 if ($this->_showModTime)
419 $date = $this->formatDateTime($mtime);
421 $date = $this->formatDate($mtime);
424 return fmt("Version %s, saved on %s", $revision->getVersion(), $date);
426 return fmt("Last edited on %s", $date);
429 function _relativeDay ($time_t) {
432 if (is_numeric($request->getPref('timeOffset')))
433 $offset = 3600 * $request->getPref('timeOffset');
437 $now = time() + $offset;
438 $today = localtime($now, true);
439 $time = localtime($time_t + $offset, true);
441 if ($time['tm_yday'] == $today['tm_yday'] && $time['tm_year'] == $today['tm_year'])
444 // Note that due to daylight savings chages (and leap seconds), $now minus
445 // 24 hours is not guaranteed to be yesterday.
446 $yesterday = localtime($now - (12 + $today['tm_hour']) * 3600, true);
447 if ($time['tm_yday'] == $yesterday['tm_yday']
448 and $time['tm_year'] == $yesterday['tm_year'])
449 return _("yesterday");
455 * Format the "Author" and "Owner" messages for a page revision.
457 function getOwnerMessage ($page) {
458 if (!ENABLE_PAGEPERM or !class_exists("PagePermission"))
460 $dbi =& $GLOBALS['request']->_dbi;
461 $owner = $page->getOwner();
464 if ( mayAccessPage('change',$page->getName()) )
465 return fmt("Owner: %s", $this->makeActionButton(array('action'=>_("chown"),
466 's' => $page->getName()),
469 if ( $dbi->isWikiPage($owner) )
470 return fmt("Owner: %s", WikiLink($owner));
472 return fmt("Owner: %s", '"'.$owner.'"');
476 /* New behaviour: (by Matt Brown)
477 Prefer author (name) over internal author_id (IP) */
478 function getAuthorMessage ($revision) {
479 if (!$revision) return '';
480 $dbi =& $GLOBALS['request']->_dbi;
481 $author = $revision->get('author');
482 if (!$author) $author = $revision->get('author_id');
483 if (!$author) return '';
484 if ( $dbi->isWikiPage($author) ) {
485 return fmt("by %s", WikiLink($author));
487 return fmt("by %s", '"'.$author.'"');
491 ////////////////////////////////////////////////////////////////
493 // Hooks for other formatting
495 ////////////////////////////////////////////////////////////////
497 //FIXME: PHP 4.1 Warnings
498 //lib/Theme.php:84: Notice[8]: The call_user_method() function is deprecated,
499 //use the call_user_func variety with the array(&$obj, "method") syntax instead
501 function getFormatter ($type, $format) {
502 $method = strtolower("get${type}Formatter");
503 if (method_exists($this, $method))
504 return $this->{$method}($format);
508 ////////////////////////////////////////////////////////////////
512 ////////////////////////////////////////////////////////////////
514 var $_autosplitWikiWords = false;
515 function setAutosplitWikiWords($autosplit=true) {
516 $this->_autosplitWikiWords = $autosplit ? true : false;
519 function maybeSplitWikiWord ($wikiword) {
520 if ($this->_autosplitWikiWords)
521 return SplitPagename($wikiword);
526 var $_anonEditUnknownLinks = true;
527 function setAnonEditUnknownLinks($anonedit=true) {
528 $this->_anonEditUnknownLinks = $anonedit ? true : false;
531 function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
534 if ($version !== false and !$this->HTML_DUMP_SUFFIX)
535 $url = WikiURL($wikiword, array('version' => $version));
537 $url = WikiURL($wikiword);
539 // Extra steps for dumping page to an html file.
540 if ($this->HTML_DUMP_SUFFIX) {
541 $url = preg_replace('/^\./', '%2e', $url); // dot pages
544 $link = HTML::a(array('href' => $url));
546 if (isa($wikiword, 'WikiPageName'))
547 $default_text = $wikiword->shortName;
549 $default_text = $wikiword;
551 if (!empty($linktext)) {
552 $link->pushContent($linktext);
553 $link->setAttr('class', 'named-wiki');
554 $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
557 $link->pushContent($this->maybeSplitWikiWord($default_text));
558 $link->setAttr('class', 'wiki');
560 if ($request->getArg('frame'))
561 $link->setAttr('target', '_top');
565 function linkUnknownWikiWord($wikiword, $linktext = '') {
568 // Get rid of anchors on unknown wikiwords
569 if (isa($wikiword, 'WikiPageName')) {
570 $default_text = $wikiword->shortName;
571 $wikiword = $wikiword->name;
574 $default_text = $wikiword;
577 if ($this->DUMP_MODE) { // HTML, PDF or XML
578 $link = HTML::u( empty($linktext) ? $wikiword : $linktext);
579 $link->addTooltip(sprintf(_("Empty link to: %s"), $wikiword));
580 $link->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
583 // if AnonEditUnknownLinks show "?" only users which are allowed to edit this page
584 if (! $this->_anonEditUnknownLinks and
585 ( ! $request->_user->isSignedIn()
586 or ! mayAccessPage('edit', $request->getArg('pagename'))))
588 $text = HTML::span( empty($linktext) ? $wikiword : $linktext);
589 $text->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
592 $url = WikiURL($wikiword, array('action' => 'create'));
593 $button = $this->makeButton('?', $url);
594 $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
598 $link = HTML::span();
599 if (!empty($linktext)) {
600 $link->pushContent(HTML::u($linktext));
601 $link->setAttr('class', 'named-wikiunknown');
604 $link->pushContent(HTML::u($this->maybeSplitWikiWord($default_text)));
605 $link->setAttr('class', 'wikiunknown');
607 if (!isa($button, "ImageButton"))
608 $button->setAttr('rel', 'nofollow');
609 $link->pushContent($button);
610 if ($request->getPref('googleLink')) {
611 $gbutton = $this->makeButton('G', "http://www.google.com/search?q="
612 . urlencode($wikiword));
613 $gbutton->addTooltip(sprintf(_("Google:%s"), $wikiword));
614 $link->pushContent($gbutton);
616 if ($request->getArg('frame'))
617 $link->setAttr('target', '_top');
622 function linkBadWikiWord($wikiword, $linktext = '') {
623 global $ErrorManager;
628 elseif (isa($wikiword, 'WikiPageName')) {
629 $text = $wikiword->shortName;
635 if (isa($wikiword, 'WikiPageName'))
636 $message = $wikiword->getWarnings();
638 $message = sprintf(_("'%s': Bad page name"), $wikiword);
639 $ErrorManager->warning($message);
641 return HTML::span(array('class' => 'badwikiword'), $text);
644 ////////////////////////////////////////////////////////////////
648 ////////////////////////////////////////////////////////////////
649 var $_imageAliases = array();
650 var $_imageAlt = array();
654 * (To disable an image, alias the image to <code>false</code>.
656 function addImageAlias ($alias, $image_name) {
657 // fall back to the PhpWiki-supplied image if not found
658 if ((empty($this->_imageAliases[$alias])
659 and $this->_findFile("images/$image_name", true))
660 or $image_name === false)
661 $this->_imageAliases[$alias] = $image_name;
664 function addImageAlt ($alias, $alt_text) {
665 $this->_imageAlt[$alias] = $alt_text;
667 function getImageAlt ($alias) {
668 return $this->_imageAlt[$alias];
671 function getImageURL ($image) {
672 $aliases = &$this->_imageAliases;
674 if (isset($aliases[$image])) {
675 $image = $aliases[$image];
680 // If not extension, default to .png.
681 if (!preg_match('/\.\w+$/', $image))
684 // FIXME: this should probably be made to fall back
685 // automatically to .gif, .jpg.
686 // Also try .gif before .png if browser doesn't like png.
688 $path = $this->_findData("images/$image", 'missing okay');
689 if (!$path) // search explicit images/ or button/ links also
690 $path = $this->_findData("$image", 'missing okay');
692 if ($this->DUMP_MODE) {
693 if (empty($this->dumped_images)) $this->dumped_images = array();
694 $path = "images/". basename($path);
695 if (!in_array($path,$this->dumped_images))
696 $this->dumped_images[] = $path;
701 function setLinkIcon($proto, $image = false) {
705 $this->_linkIcons[$proto] = $image;
708 function getLinkIconURL ($proto) {
709 $icons = &$this->_linkIcons;
710 if (!empty($icons[$proto]))
711 return $this->getImageURL($icons[$proto]);
712 elseif (!empty($icons['*']))
713 return $this->getImageURL($icons['*']);
717 var $_linkIcon = 'front'; // or 'after' or 'no'.
718 // maybe also 'spanall': there is a scheme currently in effect with front, which
719 // spans the icon only to the first, to let the next words wrap on line breaks
720 // see stdlib.php:PossiblyGlueIconToText()
721 function getLinkIconAttr () {
722 return $this->_linkIcon;
724 function setLinkIconAttr ($where) {
725 $this->_linkIcon = $where;
728 function addButtonAlias ($text, $alias = false) {
729 $aliases = &$this->_buttonAliases;
732 $aliases = array_merge($aliases, $text);
733 elseif ($alias === false)
734 unset($aliases[$text]);
736 $aliases[$text] = $alias;
739 function getButtonURL ($text) {
740 $aliases = &$this->_buttonAliases;
741 if (isset($aliases[$text]))
742 $text = $aliases[$text];
744 $qtext = urlencode($text);
745 $url = $this->_findButton("$qtext.png");
746 if ($url && strstr($url, '%')) {
747 $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
749 if (!$url) {// Jeff complained about png not supported everywhere.
750 // This was not PC until 2005.
751 $url = $this->_findButton("$qtext.gif");
752 if ($url && strstr($url, '%')) {
753 $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
756 if ($url and $this->DUMP_MODE) {
757 if (empty($this->dumped_buttons)) $this->dumped_buttons = array();
759 if (defined('DATA_PATH'))
760 $file = substr($url,strlen(DATA_PATH)+1);
761 $url = "images/buttons/".basename($file);
762 if (!array_key_exists($text, $this->dumped_buttons))
763 $this->dumped_buttons[$text] = $file;
768 function _findButton ($button_file) {
769 if (empty($this->_button_path))
770 $this->_button_path = $this->_getButtonPath();
772 foreach ($this->_button_path as $dir) {
773 if ($path = $this->_findData("$dir/$button_file", 1))
779 function _getButtonPath () {
780 $button_dir = $this->_findFile("buttons");
781 $path_dir = $this->_path . $button_dir;
782 if (!file_exists($path_dir) || !is_dir($path_dir))
784 $path = array($button_dir);
786 $dir = dir($path_dir);
787 while (($subdir = $dir->read()) !== false) {
788 if ($subdir[0] == '.')
790 if ($subdir == 'CVS')
792 if (is_dir("$path_dir/$subdir"))
793 $path[] = "$button_dir/$subdir";
796 // add default buttons
797 $path[] = "themes/default/buttons";
798 $path_dir = $this->_path . "themes/default/buttons";
799 $dir = dir($path_dir);
800 while (($subdir = $dir->read()) !== false) {
801 if ($subdir[0] == '.')
803 if ($subdir == 'CVS')
805 if (is_dir("$path_dir/$subdir"))
806 $path[] = "themes/default/buttons/$subdir";
813 ////////////////////////////////////////////////////////////////
817 ////////////////////////////////////////////////////////////////
819 function makeButton ($text, $url, $class = false, $options = false) {
820 // FIXME: don't always try for image button?
822 // Special case: URLs like 'submit:preview' generate form
823 // submission buttons.
824 if (preg_match('/^submit:(.*)$/', $url, $m))
825 return $this->makeSubmitButton($text, $m[1], $class, $options);
827 if (is_string($text))
828 $imgurl = $this->getButtonURL($text);
832 return new ImageButton($text, $url,
833 in_array($class,array("wikiaction","wikiadmin"))?"wikibutton":$class,
836 return new Button($this->maybeSplitWikiWord($text), $url,
840 function makeSubmitButton ($text, $name, $class = false, $options = false) {
841 $imgurl = $this->getButtonURL($text);
844 return new SubmitImageButton($text, $name, !$class ? "wikibutton" : $class, $imgurl, $options);
846 return new SubmitButton($text, $name, $class, $options);
850 * Make button to perform action.
852 * This constructs a button which performs an action on the
853 * currently selected version of the current page.
854 * (Or anotherpage or version, if you want...)
856 * @param $action string The action to perform (e.g. 'edit', 'lock').
857 * This can also be the name of an "action page" like 'LikePages'.
858 * Alternatively you can give a hash of query args to be applied
861 * @param $label string Textual label for the button. If left empty,
862 * a suitable name will be guessed.
864 * @param $page_or_rev mixed The page to link to. This can be
865 * given as a string (the page name), a WikiDB_Page object, or as
866 * WikiDB_PageRevision object. If given as a WikiDB_PageRevision
867 * object, the button will link to a specific version of the
868 * designated page, otherwise the button links to the most recent
869 * version of the page.
871 * @return object A Button object.
873 function makeActionButton ($action, $label = false, $page_or_rev = false, $options = false) {
874 extract($this->_get_name_and_rev($page_or_rev));
876 if (is_array($action)) {
878 $action = isset($attr['action']) ? $attr['action'] : 'browse';
881 $attr['action'] = $action;
883 $class = is_safe_action($action) ? 'wikiaction' : 'wikiadmin';
885 $label = $this->_labelForAction($action);
888 $attr['version'] = $version;
890 if ($action == 'browse')
891 unset($attr['action']);
893 $options = $this->fixAccesskey($options);
895 return $this->makeButton($label, WikiURL($pagename, $attr), $class, $options);
898 function tooltipAccessKeyPrefix() {
899 static $tooltipAccessKeyPrefix = null;
900 if ($tooltipAccessKeyPrefix) return $tooltipAccessKeyPrefix;
902 $tooltipAccessKeyPrefix = 'alt';
903 if (isBrowserOpera()) $tooltipAccessKeyPrefix = 'shift-esc';
904 elseif (isBrowserSafari() or browserDetect("Mac") or isBrowserKonqueror())
905 $tooltipAccessKeyPrefix = 'ctrl';
906 // ff2 win and x11 only
907 elseif ((browserDetect("firefox/2") or browserDetect("minefield/3") or browserDetect("SeaMonkey/1.1"))
908 and ((browserDetect("windows") or browserDetect("x11"))))
909 $tooltipAccessKeyPrefix = 'alt-shift';
910 return $tooltipAccessKeyPrefix;
913 /** Define the accesskey in the title only, with ending [p] or [alt-p].
914 * This fixes the prefix in the title and sets the accesskey.
916 function fixAccesskey($attrs) {
917 if (!empty($attrs['title']) and preg_match("/\[(alt-)?(.)\]$/", $attrs['title'], $m))
919 if (empty($attrs['accesskey'])) $attrs['accesskey'] = $m[2];
920 // firefox 'alt-shift', MSIE: 'alt', ... see wikibits.js
921 $attrs['title'] = preg_replace("/\[(alt-)?(.)\]$/", "[".$this->tooltipAccessKeyPrefix()."-\\2]", $attrs['title']);
927 * Make a "button" which links to a wiki-page.
929 * These are really just regular WikiLinks, possibly
930 * disguised (e.g. behind an image button) by the theme.
932 * This method should probably only be used for links
933 * which appear in page navigation bars, or similar places.
935 * Use linkExistingWikiWord, or LinkWikiWord for normal links.
937 * @param $page_or_rev mixed The page to link to. This can be
938 * given as a string (the page name), a WikiDB_Page object, or as
939 * WikiDB_PageRevision object. If given as a WikiDB_PageRevision
940 * object, the button will link to a specific version of the
941 * designated page, otherwise the button links to the most recent
942 * version of the page.
944 * @return object A Button object.
946 function makeLinkButton ($page_or_rev, $label = false, $action = false) {
947 extract($this->_get_name_and_rev($page_or_rev));
949 $args = $version ? array('version' => $version) : false;
950 if ($action) $args['action'] = $action;
952 return $this->makeButton($label ? $label : $pagename,
953 WikiURL($pagename, $args), 'wiki');
956 function _get_name_and_rev ($page_or_rev) {
959 if (empty($page_or_rev)) {
961 $pagename = $request->getArg("pagename");
962 $version = $request->getArg("version");
964 elseif (is_object($page_or_rev)) {
965 if (isa($page_or_rev, 'WikiDB_PageRevision')) {
967 $page = $rev->getPage();
968 if (!$rev->isCurrent()) $version = $rev->getVersion();
971 $page = $page_or_rev;
973 $pagename = $page->getName();
975 elseif (is_numeric($page_or_rev)) {
976 $version = $page_or_rev;
979 $pagename = (string) $page_or_rev;
981 return compact('pagename', 'version');
984 function _labelForAction ($action) {
986 case 'edit': return _("Edit");
987 case 'diff': return _("Diff");
988 case 'logout': return _("Sign Out");
989 case 'login': return _("Sign In");
990 case 'lock': return _("Lock Page");
991 case 'unlock': return _("Unlock Page");
992 case 'remove': return _("Remove Page");
994 // I don't think the rest of these actually get used.
996 // 'upload' 'dumpserial' 'loadfile' 'zip'
998 return gettext(ucfirst($action));
1002 //----------------------------------------------------------------
1003 var $_buttonSeparator = "\n | ";
1005 function setButtonSeparator($separator) {
1006 $this->_buttonSeparator = $separator;
1009 function getButtonSeparator() {
1010 return $this->_buttonSeparator;
1014 ////////////////////////////////////////////////////////////////
1020 // Based on testing with Galeon 1.2.7 (Mozilla 1.2):
1021 // Automatic media-based style selection (via <link> tags) only
1022 // seems to work for the default style, not for alternate styles.
1026 // <link rel="stylesheet" type="text/css" href="phpwiki.css" />
1027 // <link rel="stylesheet" type="text/css" href="phpwiki-printer.css" media="print" />
1029 // works to make it so that the printer style sheet get used
1030 // automatically when printing (or print-previewing) a page
1031 // (but when only when the default style is selected.)
1035 // <link rel="alternate stylesheet" title="Modern"
1036 // type="text/css" href="phpwiki-modern.css" />
1037 // <link rel="alternate stylesheet" title="Modern"
1038 // type="text/css" href="phpwiki-printer.css" media="print" />
1040 // Result in two "Modern" choices when trying to select alternate style.
1041 // If one selects the first of those choices, one gets phpwiki-modern
1042 // both when browsing and printing. If one selects the second "Modern",
1043 // one gets no CSS when browsing, and phpwiki-printer when printing.
1048 // We should probably move to doing the media based style
1049 // switching in the CSS files themselves using, e.g.:
1051 // @import url(print.css) print;
1053 ////////////////////////////////////////////////////////////////
1055 function _CSSlink($title, $css_file, $media, $is_alt = false) {
1056 // Don't set title on default style. This makes it clear to
1057 // the user which is the default (i.e. most supported) style.
1058 if ($is_alt and isBrowserKonqueror())
1060 $link = HTML::link(array('rel' => $is_alt ? 'alternate stylesheet' : 'stylesheet',
1061 'type' => 'text/css',
1062 'charset' => $GLOBALS['charset'],
1063 'href' => $this->_findData($css_file)));
1065 $link->setAttr('title', $title);
1068 $link->setAttr('media', $media);
1069 if ($this->DUMP_MODE) {
1070 if (empty($this->dumped_css)) $this->dumped_css = array();
1071 if (!in_array($css_file,$this->dumped_css)) $this->dumped_css[] = $css_file;
1072 $link->setAttr('href', basename($link->getAttr('href')));
1078 /** Set default CSS source for this theme.
1080 * To set styles to be used for different media, pass a
1081 * hash for the second argument, e.g.
1083 * $theme->setDefaultCSS('default', array('' => 'normal.css',
1084 * 'print' => 'printer.css'));
1086 * If you call this more than once, the last one called takes
1087 * precedence as the default style.
1089 * @param string $title Name of style (currently ignored, unless
1090 * you call this more than once, in which case, some of the style
1091 * will become alternate (rather than default) styles, and then their
1092 * titles will be used.
1094 * @param mixed $css_files Name of CSS file, or hash containing a mapping
1095 * between media types and CSS file names. Use a key of '' (the empty string)
1096 * to set the default CSS for non-specified media. (See above for an example.)
1098 function setDefaultCSS ($title, $css_files) {
1099 if (!is_array($css_files))
1100 $css_files = array('' => $css_files);
1101 // Add to the front of $this->_css
1102 unset($this->_css[$title]);
1103 $this->_css = array_merge(array($title => $css_files), $this->_css);
1106 /** Set alternate CSS source for this theme.
1108 * @param string $title Name of style.
1109 * @param string $css_files Name of CSS file.
1111 function addAlternateCSS ($title, $css_files) {
1112 if (!is_array($css_files))
1113 $css_files = array('' => $css_files);
1114 $this->_css[$title] = $css_files;
1118 * @return string HTML for CSS.
1120 function getCSS () {
1123 foreach ($this->_css as $title => $css_files) {
1124 ksort($css_files); // move $css_files[''] to front.
1125 foreach ($css_files as $media => $css_file) {
1126 if (!empty($this->DUMP_MODE)) {
1127 if ($media == 'print')
1128 $css[] = $this->_CSSlink($title, $css_file, '', $is_alt);
1130 $css[] = $this->_CSSlink($title, $css_file, $media, $is_alt);
1139 function findTemplate ($name) {
1140 if ($tmp = $this->_findFile("templates/$name.tmpl", 1))
1141 return $this->_path . $tmp;
1143 $f1 = $this->file("templates/$name.tmpl");
1144 //trigger_error("findTemplate($name) pwd: ".getcwd(), E_USER_ERROR);
1145 if (isset($this->_default_theme)) {
1146 $f2 = $this->_default_theme->file("templates/$name.tmpl");
1147 //trigger_error("$f1 nor $f2 found", E_USER_ERROR);
1149 trigger_error("$f1 not found", E_USER_ERROR);
1154 var $_MoreHeaders = array();
1155 function addMoreHeaders ($element) {
1156 $this->_MoreHeaders[] = $element;
1157 if (!empty($this->_headers_printed) and $this->_headers_printed) {
1158 trigger_error(_("Some action(page) wanted to add more headers, but they were already printed.")
1159 ."\n". $element->asXML(),
1165 * Singleton. Only called once, by the head template. See the warning above.
1167 function getMoreHeaders () {
1168 // actionpages cannot add headers, because recursive template expansion
1169 // already expanded the head template before.
1170 $this->_headers_printed = 1;
1171 if (empty($this->_MoreHeaders))
1174 //$out = "<!-- More Headers -->\n";
1175 foreach ($this->_MoreHeaders as $h) {
1177 $out .= printXML($h);
1184 var $_MoreAttr = array();
1185 // new arg: named elements to be able to remove them. such as DoubleClickEdit for htmldumps
1186 function addMoreAttr ($tag, $name, $element) {
1187 // protect from duplicate attr (body jscript: themes, prefs, ...)
1188 static $_attr_cache = array();
1189 $hash = md5($tag."/".$element);
1190 if (!empty($_attr_cache[$hash])) return;
1191 $_attr_cache[$hash] = 1;
1193 if (empty($this->_MoreAttr) or !is_array($this->_MoreAttr[$tag]))
1194 $this->_MoreAttr[$tag] = array($name => $element);
1196 $this->_MoreAttr[$tag][$name] = $element;
1199 function getMoreAttr ($tag) {
1200 if (empty($this->_MoreAttr[$tag]))
1203 foreach ($this->_MoreAttr[$tag] as $name => $element) {
1204 if (is_object($element))
1205 $out .= printXML($element);
1213 * Common Initialisations
1217 * The ->load() method replaces the formerly global code in themeinfo.php.
1218 * Without this you would not be able to derive from other themes.
1222 // CSS file defines fonts, colors and background images for this
1223 // style. The companion '*-heavy.css' file isn't defined, it's just
1224 // expected to be in the same directory that the base style is in.
1226 // This should result in phpwiki-printer.css being used when
1227 // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
1228 $this->setDefaultCSS('PhpWiki',
1229 array('' => 'phpwiki.css',
1230 'print' => 'phpwiki-printer.css'));
1232 // This allows one to manually select "Printer" style (when browsing page)
1233 // to see what the printer style looks like.
1234 $this->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen');
1235 $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
1236 $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
1238 if (isBrowserIE()) {
1239 $this->addMoreHeaders($this->_CSSlink(0,
1240 $this->_findFile('IEFixes.css'),'all'));
1241 $this->addMoreHeaders("\n");
1245 * The logo image appears on every page and links to the HomePage.
1247 $this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
1249 $this->addImageAlias('search', 'search.png');
1252 * The Signature image is shown after saving an edited page. If this
1253 * is set to false then the "Thank you for editing..." screen will
1257 $this->addImageAlias('signature', WIKI_NAME . "Signature.png");
1258 // Uncomment this next line to disable the signature.
1259 //$this->addImageAlias('signature', false);
1264 $this->setLinkIcon('http');
1265 $this->setLinkIcon('https');
1266 $this->setLinkIcon('ftp');
1267 $this->setLinkIcon('mailto');
1268 $this->setLinkIcon('interwiki');
1269 $this->setLinkIcon('wikiuser');
1270 $this->setLinkIcon('*', 'url');
1272 $this->setButtonSeparator("\n | ");
1275 * WikiWords can automatically be split by inserting spaces between
1276 * the words. The default is to leave WordsSmashedTogetherLikeSo.
1278 $this->setAutosplitWikiWords(false);
1281 * Layout improvement with dangling links for mostly closed wiki's:
1282 * If false, only users with edit permissions will be presented the
1283 * special wikiunknown class with "?" and Tooltip.
1284 * If true (default), any user will see the ?, but will be presented
1285 * the PrintLoginForm on a click.
1287 //$this->setAnonEditUnknownLinks(false);
1290 * You may adjust the formats used for formatting dates and times
1291 * below. (These examples give the default formats.)
1292 * Formats are given as format strings to PHP strftime() function See
1293 * http://www.php.net/manual/en/function.strftime.php for details.
1294 * Do not include the server's zone (%Z), times are converted to the
1297 * Suggestion for french:
1298 * $this->setDateFormat("%A %e %B %Y");
1299 * $this->setTimeFormat("%H:%M:%S");
1300 * Suggestion for capable php versions, using the server locale:
1301 * $this->setDateFormat("%x");
1302 * $this->setTimeFormat("%X");
1304 //$this->setDateFormat("%B %d, %Y");
1305 //$this->setTimeFormat("%I:%M %p");
1308 * To suppress times in the "Last edited on" messages, give a
1309 * give a second argument of false:
1311 //$this->setDateFormat("%B %d, %Y", false);
1315 * Custom UserPreferences:
1316 * A list of name => _UserPreference class pairs.
1317 * Rationale: Certain themes should be able to extend the predefined list
1318 * of preferences. Display/editing is done in the theme specific userprefs.tmpl
1319 * but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
1320 * See themes/wikilens/themeinfo.php
1322 //$this->customUserPreference();
1325 * Register custom PageList type and define custom PageList classes.
1326 * Rationale: Certain themes should be able to extend the predefined list
1327 * of pagelist types. E.g. certain plugins, like MostPopular might use
1328 * info=pagename,hits,rating
1329 * which displays the rating column whenever the wikilens theme is active.
1330 * See themes/wikilens/themeinfo.php
1332 //$this->addPageListColumn();
1337 * Custom UserPreferences:
1338 * A list of name => _UserPreference class pairs.
1339 * Rationale: Certain themes should be able to extend the predefined list
1340 * of preferences. Display/editing is done in the theme specific userprefs.tmpl
1341 * but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
1342 * These values are just ignored if another theme is used.
1344 function customUserPreferences($array) {
1345 global $customUserPreferenceColumns; // FIXME: really a global?
1346 if (empty($customUserPreferenceColumns)) $customUserPreferenceColumns = array();
1347 //array('wikilens' => new _UserPreference_wikilens());
1348 foreach ($array as $field => $prefobj) {
1349 $customUserPreferenceColumns[$field] = $prefobj;
1353 /** addPageListColumn(array('rating' => new _PageList_Column_rating('rating', _("Rate"))))
1354 * Register custom PageList types for special themes, like
1355 * 'rating' for wikilens
1357 function addPageListColumn ($array) {
1358 global $customPageListColumns;
1359 if (empty($customPageListColumns)) $customPageListColumns = array();
1360 foreach ($array as $column => $obj) {
1361 $customPageListColumns[$column] = $obj;
1365 // Works only on action=browse. Patch #970004 by pixels
1366 // Usage: call $WikiTheme->initDoubleClickEdit() from theme init or
1367 // define ENABLE_DOUBLECLICKEDIT
1368 function initDoubleClickEdit() {
1369 if (!$this->HTML_DUMP_SUFFIX)
1370 $this->addMoreAttr('body', 'DoubleClickEdit', HTML::Raw(" ondblclick=\"url = document.URL; url2 = url; if (url.indexOf('?') != -1) url2 = url.slice(0, url.indexOf('?')); if ((url.indexOf('action') == -1) || (url.indexOf('action=browse') != -1)) document.location = url2 + '?action=edit';\""));
1373 // Immediate title search results via XMLHTML(HttpRequest)
1374 // by Bitflux GmbH, bitflux.ch. You need to install the livesearch.js seperately.
1375 // Google's or acdropdown is better.
1376 function initLiveSearch() {
1377 //subclasses of Sidebar will init this twice
1378 static $already = 0;
1379 if (!$this->HTML_DUMP_SUFFIX and !$already) {
1380 $this->addMoreAttr('body', 'LiveSearch',
1381 HTML::Raw(" onload=\"liveSearchInit()"));
1382 $this->addMoreHeaders(JavaScript('var liveSearchURI="'
1383 .WikiURL(_("TitleSearch"),false,true).'";'));
1384 $this->addMoreHeaders(JavaScript('', array
1385 ('src' => $this->_findData('livesearch.js'))));
1390 // Immediate title search results via XMLHttpRequest
1391 // using the shipped moacdropdown js-lib
1392 function initMoAcDropDown() {
1393 //subclasses of Sidebar will init this twice
1394 static $already = 0;
1395 if (!$this->HTML_DUMP_SUFFIX and !$already) {
1396 $dir = $this->_findData('moacdropdown');
1397 // if autocomplete_remote is used: (getobject2 also for calc. the showlist width)
1399 foreach (array("mobrowser.js","modomevent3.js","modomt.js",
1400 "modomext.js","getobject2.js","xmlextras.js") as $js)
1402 $this->addMoreHeaders(JavaScript('', array('src' => "$dir/js/$js")));
1404 $this->addMoreHeaders(JavaScript('', array('src' => "$dir/js/acdropdown.js")));
1406 $this->addMoreHeaders(JavaScript('', array('src' => DATA_PATH . "/themes/default/moacdropdown.js")));
1408 //$this->addMoreHeaders($this->_CSSlink(0,
1409 // $this->_findFile('moacdropdown/css/dropdown.css'), 'all'));
1410 $this->addMoreHeaders(HTML::style(" @import url( $dir/css/dropdown.css );\n"));
1412 // for local xmlrpc requests
1413 $xmlrpc_url = deduce_script_name();
1414 //if (1 or DATABASE_TYPE == 'dba')
1415 $xmlrpc_url = DATA_PATH . "/RPC2.php";
1416 if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug']))
1417 $xmlrpc_url .= ("?start_debug=".$_GET['start_debug']);
1418 $this->addMoreHeaders(JavaScript("var xmlrpc_url = '$xmlrpc_url'"));
1424 function calendarLink($date = false) {
1425 return $this->calendarBase() . SUBPAGE_SEPARATOR .
1426 strftime("%Y-%m-%d", $date ? $date : time());
1429 function calendarBase() {
1430 static $UserCalPageTitle = false;
1433 if (!$UserCalPageTitle)
1434 $UserCalPageTitle = $request->_user->getId() .
1435 SUBPAGE_SEPARATOR . _("Calendar");
1436 if (!$UserCalPageTitle)
1437 $UserCalPageTitle = (BLOG_EMPTY_DEFAULT_PREFIX ? ''
1438 : ($request->_user->getId() . SUBPAGE_SEPARATOR)) . "Blog";
1439 return $UserCalPageTitle;
1442 function calendarInit($force = false) {
1443 $dbi = $GLOBALS['request']->getDbh();
1444 // display flat calender dhtml in the sidebar
1445 if ($force or $dbi->isWikiPage($this->calendarBase())) {
1446 $jslang = @$GLOBALS['LANG'];
1447 $this->addMoreHeaders
1450 $this->_findFile('jscalendar/calendar-phpwiki.css'), 'all'));
1451 $this->addMoreHeaders
1453 array('src' => $this->_findData('jscalendar/calendar'.(DEBUG?'':'_stripped').'.js'))));
1454 if (!($langfile = $this->_findData("jscalendar/lang/calendar-$jslang.js")))
1455 $langfile = $this->_findData("jscalendar/lang/calendar-en.js");
1456 $this->addMoreHeaders(JavaScript('',array('src' => $langfile)));
1457 $this->addMoreHeaders
1460 $this->_findData('jscalendar/calendar-setup'.(DEBUG?'':'_stripped').'.js'))));
1462 // Get existing date entries for the current user
1463 require_once("lib/TextSearchQuery.php");
1464 $iter = $dbi->titleSearch(new TextSearchQuery("^".$this->calendarBase().SUBPAGE_SEPARATOR, true, "auto"));
1465 $existing = array();
1466 while ($page = $iter->next()) {
1467 if ($page->exists())
1468 $existing[] = basename($page->_pagename);
1470 if (!empty($existing)) {
1471 $js_exist = '{"'.join('":1,"',$existing).'":1}';
1472 //var SPECIAL_DAYS = {"2004-05-11":1,"2004-05-12":1,"2004-06-01":1}
1473 $this->addMoreHeaders(JavaScript('
1474 // This table holds the existing calender entries for the current user
1475 // calculated from the database
1476 var SPECIAL_DAYS = '.$js_exist.';
1477 // This function returns true if the date exists in SPECIAL_DAYS
1478 function dateExists(date, y, m, d) {
1479 var year = date.getFullYear();
1481 m = m < 10 ? "0" + m : m; // integer, 0..11
1482 d = d < 10 ? "0" + d : d; // integer, 1..31
1483 var date = year+"-"+m+"-"+d;
1484 var exists = SPECIAL_DAYS[date];
1485 if (!exists) return false;
1488 // This is the actual date status handler.
1489 // Note that it receives the date object as well as separate
1490 // values of year, month and date.
1491 function dateStatusFunc(date, y, m, d) {
1492 if (dateExists(date, y, m, d)) return "existing";
1497 $this->addMoreHeaders(JavaScript('
1498 function dateStatusFunc(date, y, m, d) { return false;}'));
1503 ////////////////////////////////////////////////////////////////
1507 ////////////////////////////////////////////////////////////////
1509 /** CbUserLogin (&$request, $userid)
1510 * Callback when a user logs in
1512 function CbUserLogin (&$request, $userid) {
1516 /** CbNewUserEdit (&$request, $userid)
1517 * Callback when a new user creates or edits a page
1519 function CbNewUserEdit (&$request, $userid) {
1520 ; // i.e. create homepage with Template/UserPage
1523 /** CbNewUserLogin (&$request, $userid)
1524 * Callback when a "new user" logs in.
1525 * What is new? We only record changes, not logins.
1526 * Should we track user actions?
1527 * Let's say a new user is a user without homepage.
1529 function CbNewUserLogin (&$request, $userid) {
1533 /** CbUserLogout (&$request, $userid)
1534 * Callback when a user logs out
1536 function CbUserLogout (&$request, $userid) {
1544 * A class representing a clickable "button".
1546 * In it's simplest (default) form, a "button" is just a link associated
1547 * with some sort of wiki-action.
1549 class Button extends HtmlElement {
1552 * @param $text string The text for the button.
1553 * @param $url string The url (href) for the button.
1554 * @param $class string The CSS class for the button.
1555 * @param $options array Additional attributes for the <input> tag.
1557 function Button ($text, $url, $class=false, $options=false) {
1560 if (check_php_version(5)) {
1561 $this->_init('a', array('href' => $url));
1563 $this->__construct('a', array('href' => $url));
1566 $this->setAttr('class', $class);
1567 if ($request->getArg('frame'))
1568 $this->setAttr('target', '_top');
1569 if (!empty($options) and is_array($options)) {
1570 foreach ($options as $key => $val)
1571 $this->setAttr($key, $val);
1573 // Google honors this
1574 if (in_array(strtolower($text), array('edit','create','diff','pdf'))
1575 and !$request->_user->isAuthenticated())
1576 $this->setAttr('rel', 'nofollow');
1577 $this->pushContent($GLOBALS['WikiTheme']->maybeSplitWikiWord($text));
1584 * A clickable image button.
1586 class ImageButton extends Button {
1589 * @param $text string The text for the button.
1590 * @param $url string The url (href) for the button.
1591 * @param $class string The CSS class for the button.
1592 * @param $img_url string URL for button's image.
1593 * @param $img_attr array Additional attributes for the <img> tag.
1595 function ImageButton ($text, $url, $class, $img_url, $img_attr=false) {
1596 $this->__construct('a', array('href' => $url));
1598 $this->setAttr('class', $class);
1599 // Google honors this
1600 if (in_array(strtolower($text), array('edit','create','diff','pdf'))
1601 and !$GLOBALS['request']->_user->isAuthenticated())
1602 $this->setAttr('rel', 'nofollow');
1604 if (!is_array($img_attr))
1605 $img_attr = array();
1606 $img_attr['src'] = $img_url;
1607 $img_attr['alt'] = $text;
1608 $img_attr['class'] = 'wiki-button';
1609 $img_attr['border'] = 0;
1610 $this->pushContent(HTML::img($img_attr));
1615 * A class representing a form <samp>submit</samp> button.
1617 class SubmitButton extends HtmlElement {
1620 * @param $text string The text for the button.
1621 * @param $name string The name of the form field.
1622 * @param $class string The CSS class for the button.
1623 * @param $options array Additional attributes for the <input> tag.
1625 function SubmitButton ($text, $name=false, $class=false, $options=false) {
1626 $this->__construct('input', array('type' => 'submit',
1629 $this->setAttr('name', $name);
1631 $this->setAttr('class', $class);
1632 if (!empty($options)) {
1633 foreach ($options as $key => $val)
1634 $this->setAttr($key, $val);
1642 * A class representing an image form <samp>submit</samp> button.
1644 class SubmitImageButton extends SubmitButton {
1647 * @param $text string The text for the button.
1648 * @param $name string The name of the form field.
1649 * @param $class string The CSS class for the button.
1650 * @param $img_url string URL for button's image.
1651 * @param $img_attr array Additional attributes for the <img> tag.
1653 function SubmitImageButton ($text, $name=false, $class=false, $img_url, $img_attr=false) {
1654 $this->__construct('input', array('type' => 'image',
1659 $this->setAttr('name', $name);
1661 $this->setAttr('class', $class);
1662 if (!empty($img_attr)) {
1663 foreach ($img_attr as $key => $val)
1664 $this->setAttr($key, $val);
1671 * A sidebar box with title and body, narrow fixed-width.
1672 * To represent abbrevated content of plugins, links or forms,
1673 * like "Getting Started", "Search", "Sarch Pagename",
1674 * "Login", "Menu", "Recent Changes", "Last comments", "Last Blogs"
1676 * ... See http://tikiwiki.org/
1680 * $menu = SidebarBox("Menu",HTML::dl(HTML::dt(...))); $menu->format();
1681 * $menu = PluginSidebarBox("RecentChanges",array('limit'=>10)); $menu->format();
1685 function SidebarBox($title, $body) {
1686 require_once('lib/WikiPlugin.php');
1687 $this->title = $title;
1688 $this->body = $body;
1691 return WikiPlugin::makeBox($this->title, $this->body);
1696 * A sidebar box for plugins.
1697 * Any plugin may provide a box($args=false, $request=false, $basepage=false)
1698 * method, with the help of WikiPlugin::makeBox()
1700 class PluginSidebarBox extends SidebarBox {
1702 var $_plugin, $_args = false, $_basepage = false;
1704 function PluginSidebarBox($name, $args = false, $basepage = false) {
1705 require_once("lib/WikiPlugin.php");
1707 $loader = new WikiPluginLoader();
1708 $plugin = $loader->getPlugin($name);
1710 return $loader->_error(sprintf(_("Plugin %s: undefined"),
1713 if (!method_exists($plugin, 'box')) {
1714 return $loader->_error(sprintf(_("%s: has no box method"),
1715 get_class($plugin)));
1717 $this->_plugin =& $plugin;
1718 $this->_args = $args ? $args : array();
1719 $this->_basepage = $basepage;
1722 function format($args = false) {
1723 return $this->_plugin->box($args ? array_merge($this->_args, $args) : $this->_args,
1724 $GLOBALS['request'],
1729 // Various boxes which are no plugins
1730 class RelatedLinksBox extends SidebarBox {
1731 function RelatedLinksBox($title = false, $body = '', $limit = 20) {
1733 $this->title = $title ? $title : _("Related Links");
1734 $this->body = HTML($body);
1735 $page = $request->getPage($request->getArg('pagename'));
1736 $revision = $page->getCurrentRevision();
1737 $page_content = $revision->getTransformedContent();
1738 //$cache = &$page->_wikidb->_cache;
1740 $sp = HTML::Raw('· ');
1741 foreach ($page_content->getWikiPageLinks() as $link) {
1742 $linkto = $link['linkto'];
1743 if (!$request->_dbi->isWikiPage($linkto)) continue;
1744 $this->body->pushContent($sp, WikiLink($linkto), HTML::br());
1746 if ($limit and $counter > $limit) continue;
1751 class RelatedExternalLinksBox extends SidebarBox {
1752 function RelatedExternalLinksBox($title = false, $body = '', $limit = 20) {
1754 $this->title = $title ? $title : _("External Links");
1755 $this->body = HTML($body);
1756 $page = $request->getPage($request->getArg('pagename'));
1757 $cache = &$page->_wikidb->_cache;
1759 $sp = HTML::Raw('· ');
1760 foreach ($cache->getWikiPageLinks() as $link) {
1761 $linkto = $link['linkto'];
1763 $this->body->pushContent($sp, WikiLink($linkto), HTML::br());
1765 if ($limit and $counter > $limit) continue;
1771 function listAvailableThemes() {
1772 $available_themes = array();
1773 $dir_root = 'themes';
1774 if (defined('PHPWIKI_DIR'))
1775 $dir_root = PHPWIKI_DIR . "/$dir_root";
1776 $dir = dir($dir_root);
1778 while($entry = $dir->read()) {
1779 if (is_dir($dir_root.'/'.$entry)
1780 and file_exists($dir_root.'/'.$entry.'/themeinfo.php'))
1782 array_push($available_themes, $entry);
1787 return $available_themes;
1790 function listAvailableLanguages() {
1791 $available_languages = array('en');
1792 $dir_root = 'locale';
1793 if (defined('PHPWIKI_DIR'))
1794 $dir_root = PHPWIKI_DIR . "/$dir_root";
1795 if ($dir = dir($dir_root)) {
1796 while($entry = $dir->read()) {
1797 if (is_dir($dir_root."/".$entry) and is_dir($dir_root.'/'.$entry.'/LC_MESSAGES'))
1799 array_push($available_languages, $entry);
1804 return $available_languages;
1807 // $Log: not supported by cvs2svn $
1808 // Revision 1.146 2007/09/15 12:34:09 rurban
1809 // allow object button text
1811 // Revision 1.145 2007/09/12 19:37:26 rurban
1812 // Add script_url to global js
1814 // Revision 1.144 2007/08/25 18:31:12 rurban
1815 // protect options, improve docs style
1817 // Revision 1.143 2007/07/15 17:39:18 rurban
1818 // No mozilla round and background for Image buttons
1820 // Revision 1.142 2007/07/01 09:36:09 rurban
1821 // themes are now easier derivable classes from other themes.
1822 // removed global code setters, switched to $WikiTheme->load() in main
1824 // Revision 1.141 2007/06/02 18:24:30 rurban
1825 // Added accesskeys. Added js stylepath
1827 // Revision 1.140 2007/03/10 18:27:20 rurban
1828 // Patch 1677965 by Erwann Penet
1830 // Revision 1.138 2007/01/07 18:43:37 rurban
1831 // Remove fatals when no intermediate template was found. Deprecate subclasses of subthemes (blog of Sidebar). Warn about lost _MoreHeaders. $noinit: Do not initialize unnecessary items in default_theme fallback twice. Move over calendarInit from themes/Sidebar/themeinfo.php.
1833 // Revision 1.137 2007/01/02 13:19:23 rurban
1834 // add getobject2.js to acdropdown to calculate the sizes. add global xmlrpc_url for local xml requests (interface simplification). stabilize theme and language detection: require magic files there
1836 // Revision 1.136 2006/12/06 22:07:31 rurban
1837 // Add new Button argument to override any option.
1839 // Revision 1.135 2006/04/17 17:28:21 rurban
1840 // honor getWikiPageLinks change linkto=>relation
1842 // Revision 1.134 2006/03/19 16:24:38 rurban
1843 // fix syntax error with patch #1377650
1845 // Revision 1.133 2006/03/19 14:24:38 rurban
1846 // sf.net patch #1377650 by Matt Brown: Always prefer legible author name over author_id property
1848 // Revision 1.132 2005/07/24 09:51:22 rurban
1849 // guard doubleClickEdit for unittests, add AcDropDown support
1851 // Revision 1.131 2005/06/10 06:09:06 rurban
1852 // enable getPref('doubleClickEdit')
1854 // Revision 1.130 2005/05/06 16:43:35 rurban
1857 // Revision 1.129 2005/05/05 08:57:26 rurban
1858 // support action=revert
1860 // Revision 1.128 2005/04/23 11:23:49 rurban
1861 // improve semantics in the setAutosplitWikiWords method: switch to true if no args
1863 // Revision 1.127 2005/02/11 14:45:44 rurban
1864 // support ENABLE_LIVESEARCH, enable PDO sessions
1866 // Revision 1.126 2005/02/04 11:43:18 rurban
1869 // Revision 1.125 2005/02/03 05:09:56 rurban
1870 // livesearch.js support
1872 // Revision 1.124 2005/01/27 16:28:15 rurban
1873 // especially for Google: nofollow on unauthenticated edit,diff,create,pdf
1875 // Revision 1.123 2005/01/25 07:03:02 rurban
1876 // change addMoreAttr() to support named attr, to remove DoubleClickEdit for htmldumps
1878 // Revision 1.122 2005/01/21 11:51:22 rurban
1881 // Revision 1.121 2005/01/20 10:14:37 rurban
1882 // rel=nofollow on edit/create page links
1884 // Revision 1.120 2004/12/20 13:20:23 rurban
1885 // fix problem described in patch #1088131. SidebarBox may be used before lib/WikiPlugin.php
1888 // Revision 1.119 2004/12/14 21:38:12 rurban
1891 // Revision 1.118 2004/12/13 14:34:46 rurban
1892 // box parent method exists
1894 // Revision 1.117 2004/11/30 17:44:54 rurban
1895 // revisison neutral
1897 // Revision 1.116 2004/11/21 11:59:16 rurban
1898 // remove final \n to be ob_cache independent
1900 // Revision 1.115 2004/11/17 17:24:02 rurban
1901 // more verbose on fatal template not found
1903 // Revision 1.114 2004/11/11 18:31:26 rurban
1904 // add simple backtrace on such general failures to get at least an idea where
1906 // Revision 1.113 2004/11/09 17:11:04 rurban
1907 // * revert to the wikidb ref passing. there's no memory abuse there.
1908 // * use new wikidb->_cache->_id_cache[] instead of wikidb->_iwpcache, to effectively
1909 // store page ids with getPageLinks (GleanDescription) of all existing pages, which
1910 // are also needed at the rendering for linkExistingWikiWord().
1911 // pass options to pageiterator.
1912 // use this cache also for _get_pageid()
1913 // This saves about 8 SELECT count per page (num all pagelinks).
1914 // * fix passing of all page fields to the pageiterator.
1915 // * fix overlarge session data which got broken with the latest ACCESS_LOG_SQL changes
1917 // Revision 1.112 2004/11/03 16:50:31 rurban
1918 // some new defaults and constants, renamed USE_DOUBLECLICKEDIT to ENABLE_DOUBLECLICKEDIT
1920 // Revision 1.111 2004/10/21 20:20:53 rurban
1921 // From patch #970004 "Double clic to edit" by pixels.
1923 // Revision 1.110 2004/10/15 11:05:10 rurban
1924 // fix yesterdays premature dumphtml fix for $default_text (thanks John Shen)
1926 // Revision 1.109 2004/10/14 21:06:02 rurban
1927 // fix dumphtml with USE_PATH_INFO (again). fix some PageList refs
1929 // Revision 1.108 2004/09/26 12:24:02 rurban
1930 // no anchor (PCRE memory), explicit ^ instead
1932 // Revision 1.107 2004/06/21 16:22:29 rurban
1933 // add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1934 // fixed dumping buttons locally (images/buttons/),
1935 // support pages arg for dumphtml,
1936 // optional directory arg for dumpserial + dumphtml,
1937 // fix a AllPages warning,
1938 // show dump warnings/errors on DEBUG,
1939 // don't warn just ignore on wikilens pagelist columns, if not loaded.
1940 // RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1942 // Revision 1.106 2004/06/20 14:42:54 rurban
1943 // various php5 fixes (still broken at blockparser)
1945 // Revision 1.105 2004/06/14 11:31:36 rurban
1946 // renamed global $Theme to $WikiTheme (gforge nameclash)
1947 // inherit PageList default options from PageList
1948 // default sortby=pagename
1949 // use options in PageList_Selectable (limit, sortby, ...)
1950 // added action revert, with button at action=diff
1951 // added option regex to WikiAdminSearchReplace
1953 // Revision 1.104 2004/06/11 09:07:30 rurban
1954 // support theme-specific LinkIconAttr: front or after or none
1956 // Revision 1.103 2004/06/07 22:44:14 rurban
1957 // added simplified chown, setacl actions
1959 // Revision 1.102 2004/06/07 18:59:28 rurban
1960 // added Chown link to Owner in statusbar
1962 // Revision 1.101 2004/06/03 12:59:40 rurban
1963 // simplify translation
1964 // NS4 wrap=virtual only
1966 // Revision 1.100 2004/06/03 10:18:19 rurban
1967 // fix FileUser locking issues, new config ENABLE_PAGEPERM
1969 // Revision 1.99 2004/06/01 15:27:59 rurban
1970 // AdminUser only ADMIN_USER not member of Administrators
1971 // some RateIt improvements by dfrankow
1972 // edit_toolbar buttons
1974 // Revision 1.98 2004/05/27 17:49:05 rurban
1975 // renamed DB_Session to DbSession (in CVS also)
1976 // added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals
1977 // remove leading slash in error message
1978 // added force_unlock parameter to File_Passwd (no return on stale locks)
1979 // fixed adodb session AffectedRows
1980 // added FileFinder helpers to unify local filenames and DATA_PATH names
1981 // editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR
1983 // Revision 1.97 2004/05/18 16:23:39 rurban
1984 // rename split_pagename to SplitPagename
1986 // Revision 1.96 2004/05/13 13:48:34 rurban
1987 // doc update for the new 1.3.10 release
1989 // Revision 1.94 2004/05/13 11:52:34 rurban
1990 // search also default buttons
1992 // Revision 1.93 2004/05/12 10:49:55 rurban
1993 // require_once fix for those libs which are loaded before FileFinder and
1994 // its automatic include_path fix, and where require_once doesn't grok
1995 // dirname(__FILE__) != './lib'
1996 // upgrade fix with PearDB
1997 // navbar.tmpl: remove spaces for IE button alignment
1999 // Revision 1.92 2004/05/03 21:57:47 rurban
2000 // locale updates: we previously lost some words because of wrong strings in
2001 // PhotoAlbum, german rewording.
2002 // fixed $_SESSION registering (lost session vars, esp. prefs)
2003 // fixed ending slash in listAvailableLanguages/Themes
2005 // Revision 1.91 2004/05/03 11:40:42 rurban
2006 // put listAvailableLanguages() and listAvailableThemes() from SystemInfo and
2007 // UserPreferences into Themes.php
2009 // Revision 1.90 2004/05/02 19:12:14 rurban
2010 // fix sf.net bug #945154 Konqueror alt css
2012 // Revision 1.89 2004/04/29 21:25:45 rurban
2013 // default theme navbar consistency: linkButtons instead of action buttons
2014 // 3rd makeLinkButtin arg for action support
2016 // Revision 1.88 2004/04/19 18:27:45 rurban
2017 // Prevent from some PHP5 warnings (ref args, no :: object init)
2018 // php5 runs now through, just one wrong XmlElement object init missing
2019 // Removed unneccesary UpgradeUser lines
2020 // Changed WikiLink to omit version if current (RecentChanges)
2022 // Revision 1.87 2004/04/19 09:13:23 rurban
2023 // new pref: googleLink
2025 // Revision 1.86 2004/04/18 01:11:51 rurban
2026 // more numeric pagename fixes.
2027 // fixed action=upload with merge conflict warnings.
2028 // charset changed from constant to global (dynamic utf-8 switching)
2030 // Revision 1.85 2004/04/12 13:04:50 rurban
2031 // added auth_create: self-registering Db users
2033 // removed rating recommendations
2034 // ziplib reformatting
2036 // Revision 1.84 2004/04/10 02:30:49 rurban
2037 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
2038 // Fixed "cannot setlocale..." (sf.net problem)
2040 // Revision 1.83 2004/04/09 17:49:03 rurban
2041 // Added PhpWiki RssFeed to Sidebar
2042 // sidebar formatting
2043 // some browser dependant fixes (old-browser support)
2045 // Revision 1.82 2004/04/06 20:00:10 rurban
2046 // Cleanup of special PageList column types
2047 // Added support of plugin and theme specific Pagelist Types
2048 // Added support for theme specific UserPreferences
2049 // Added session support for ip-based throttling
2050 // sql table schema change: ALTER TABLE session ADD sess_ip CHAR(15);
2051 // Enhanced postgres schema
2052 // Added DB_Session_dba support
2054 // Revision 1.81 2004/04/01 15:57:10 rurban
2055 // simplified Sidebar theme: table, not absolute css positioning
2056 // added the new box methods.
2057 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
2059 // Revision 1.80 2004/03/30 02:14:03 rurban
2060 // fixed yet another Prefs bug
2061 // added generic PearDb_iter
2062 // $request->appendValidators no so strict as before
2063 // added some box plugin methods
2064 // PageList commalist for condensed output
2066 // Revision 1.79 2004/03/24 19:39:02 rurban
2067 // php5 workaround code (plus some interim debugging code in XmlElement)
2068 // php5 doesn't work yet with the current XmlElement class constructors,
2069 // WikiUserNew does work better than php4.
2070 // rewrote WikiUserNew user upgrading to ease php5 update
2071 // fixed pref handling in WikiUserNew
2072 // added Email Notification
2073 // added simple Email verification
2074 // removed emailVerify userpref subclass: just a email property
2075 // changed pref binary storage layout: numarray => hash of non default values
2076 // print optimize message only if really done.
2077 // forced new cookie policy: delete pref cookies, use only WIKI_ID as plain string.
2078 // prefs should be stored in db or homepage, besides the current session.
2080 // Revision 1.78 2004/03/18 22:32:33 rurban
2081 // work to make it php5 compatible
2083 // Revision 1.77 2004/03/08 19:30:01 rurban
2084 // fixed Theme->getButtonURL
2085 // AllUsers uses now WikiGroup (also DB User and DB Pref users)
2086 // PageList fix for empty pagenames
2088 // Revision 1.76 2004/03/08 18:17:09 rurban
2089 // added more WikiGroup::getMembersOf methods, esp. for special groups
2090 // fixed $LDAP_SET_OPTIONS
2091 // fixed _AuthInfo group methods
2093 // Revision 1.75 2004/03/01 09:34:37 rurban
2094 // fixed button path logic: now fallback to default also
2096 // Revision 1.74 2004/02/28 21:14:08 rurban
2097 // generally more PHPDOC docs
2098 // see http://xarch.tu-graz.ac.at/home/rurban/phpwiki/xref/
2099 // fxied WikiUserNew pref handling: empty theme not stored, save only
2100 // changed prefs, sql prefs improved, fixed password update,
2101 // removed REPLACE sql (dangerous)
2102 // moved gettext init after the locale was guessed
2103 // + some minor changes
2105 // Revision 1.73 2004/02/26 03:22:05 rurban
2106 // also copy css and images with XHTML Dump
2108 // Revision 1.72 2004/02/26 02:25:53 rurban
2109 // fix empty and #-anchored links in XHTML Dumps
2111 // Revision 1.71 2004/02/15 21:34:37 rurban
2112 // PageList enhanced and improved.
2113 // fixed new WikiAdmin... plugins
2114 // editpage, Theme with exp. htmlarea framework
2115 // (htmlarea yet committed, this is really questionable)
2116 // WikiUser... code with better session handling for prefs
2117 // enhanced UserPreferences (again)
2118 // RecentChanges for show_deleted: how should pages be deleted then?
2120 // Revision 1.70 2004/01/26 09:17:48 rurban
2121 // * changed stored pref representation as before.
2122 // the array of objects is 1) bigger and 2)
2123 // less portable. If we would import packed pref
2124 // objects and the object definition was changed, PHP would fail.
2125 // This doesn't happen with an simple array of non-default values.
2126 // * use $prefs->retrieve and $prefs->store methods, where retrieve
2127 // understands the interim format of array of objects also.
2128 // * simplified $prefs->get() and fixed $prefs->set()
2129 // * added $user->_userid and class '_WikiUser' portability functions
2130 // * fixed $user object ->_level upgrading, mostly using sessions.
2131 // this fixes yesterdays problems with loosing authorization level.
2132 // * fixed WikiUserNew::checkPass to return the _level
2133 // * fixed WikiUserNew::isSignedIn
2134 // * added explodePageList to class PageList, support sortby arg
2135 // * fixed UserPreferences for WikiUserNew
2136 // * fixed WikiPlugin for empty defaults array
2137 // * UnfoldSubpages: added pagename arg, renamed pages arg,
2138 // removed sort arg, support sortby arg
2140 // Revision 1.69 2003/12/05 01:32:28 carstenklapp
2141 // New feature: Easier to run multiple wiks off of one set of code. Name
2142 // your logo and signature image files "YourWikiNameLogo.png" and
2143 // "YourWikiNameSignature.png" and put them all into
2144 // themes/default/images. YourWikiName should match what is defined as
2145 // WIKI_NAME in index.php. In case the image is not found, the default
2146 // shipped with PhpWiki will be used.
2148 // Revision 1.68 2003/03/04 01:53:30 dairiki
2149 // Inconsequential decrufting.
2151 // Revision 1.67 2003/02/26 03:40:22 dairiki
2152 // New action=create. Essentially the same as action=edit, except that if the
2153 // page already exists, it falls back to action=browse.
2155 // This is for use in the "question mark" links for unknown wiki words
2156 // to avoid problems and confusion when following links from stale pages.
2157 // (If the "unknown page" has been created in the interim, the user probably
2158 // wants to view the page before editing it.)
2160 // Revision 1.66 2003/02/26 00:10:26 dairiki
2161 // More/better/different checks for bad page names.
2163 // Revision 1.65 2003/02/24 22:41:57 dairiki
2166 // Revision 1.64 2003/02/24 22:06:14 dairiki
2167 // Attempts to fix auto-selection of printer CSS when printing.
2168 // See new comments lib/Theme.php for more details.
2169 // Also see SF patch #669563.
2171 // Revision 1.63 2003/02/23 03:37:05 dairiki
2172 // Stupid typo/bug fix.
2174 // Revision 1.62 2003/02/21 04:14:52 dairiki
2175 // New WikiLink type 'if_known'. This gives linkified name if page
2176 // exists, otherwise, just plain text.
2178 // Revision 1.61 2003/02/18 21:52:05 dairiki
2179 // Fix so that one can still link to wiki pages with # in their names.
2180 // (This was made difficult by the introduction of named tags, since
2181 // '[Page #1]' is now a link to anchor '1' in page 'Page'.
2183 // Now the ~ escape for page names should work: [Page ~#1].
2185 // Revision 1.60 2003/02/15 01:59:47 dairiki
2186 // Theme::getCSS(): Add Default-Style HTTP(-eqiv) header in attempt
2187 // to fix default stylesheet selection on some browsers.
2188 // For details on the Default-Style header, see:
2189 // http://home.dairiki.org/docs/html4/present/styles.html#h-14.3.2
2191 // Revision 1.59 2003/01/04 22:30:16 carstenklapp
2192 // New: display a "Never edited." message instead of an invalid epoch date.
2195 // (c-file-style: "gnu")
2199 // c-basic-offset: 4
2200 // c-hanging-comment-ender-p: nil
2201 // indent-tabs-mode: nil