]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/Theme.php
Cleanup of special PageList column types
[SourceForge/phpwiki.git] / lib / Theme.php
1 <?php rcs_id('$Id: Theme.php,v 1.82 2004-04-06 20:00:10 rurban Exp $');
2 /* Copyright (C) 2002, Geoffrey T. Dairiki <dairiki@dairiki.org>
3  *
4  * This file is part of PhpWiki.
5  * 
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.
10  * 
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.
15  * 
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
19  */
20
21 /**
22  * Customize output by themes: templates, css, special links functions, 
23  * and more formatting.
24  */
25
26 require_once('lib/HtmlElement.php');
27
28 /**
29  * Make a link to a wiki page (in this wiki).
30  *
31  * This is a convenience function.
32  *
33  * @param mixed $page_or_rev
34  * Can be:<dl>
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>
38  * </dl>
39  *
40  * @param string $type
41  * One of:<dl>
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>
47  * </dl>
48  * Unless $type of of the latter form, the link will be of class 'wiki', 'wikiunknown',
49  * 'named-wiki', or 'named-wikiunknown', as appropriate.
50  *
51  * @param mixed $label (string or XmlContent object)
52  * Label for the link.  If not given, defaults to the page name.
53  *
54  * @return XmlContent The link
55  */
56 function WikiLink ($page_or_rev, $type = 'known', $label = false) {
57     global $Theme, $request;
58
59     if ($type == 'button') {
60         return $Theme->makeLinkButton($page_or_rev, $label);
61     }
62
63     $version = false;
64     
65     if (isa($page_or_rev, 'WikiDB_PageRevision')) {
66         $version = $page_or_rev->getVersion();
67         $page = $page_or_rev->getPage();
68         $pagename = $page->getName();
69         $wikipage = $pagename;
70         $exists = true;
71     }
72     elseif (isa($page_or_rev, 'WikiDB_Page')) {
73         $page = $page_or_rev;
74         $pagename = $page->getName();
75         $wikipage = $pagename;
76     }
77     elseif (isa($page_or_rev, 'WikiPageName')) {
78         $wikipage = $page_or_rev;
79         $pagename = $wikipage->name;
80     }
81     else {
82         $wikipage = new WikiPageName($page_or_rev, $request->getPage());
83         $pagename = $wikipage->name;
84     }
85     
86     if (!is_string($wikipage) and !$wikipage->isValid('strict'))
87         return $Theme->linkBadWikiWord($wikipage, $label);
88     
89     if ($type == 'auto' or $type == 'if_known') {
90         if (isset($page)) {
91             $current = $page->getCurrentRevision();
92             $exists = ! $current->hasDefaultContents();
93         }
94         else {
95             $dbi = $request->getDbh();
96             $exists = $dbi->isWikiPage($wikipage->name);
97         }
98     }
99     elseif ($type == 'unknown') {
100         $exists = false;
101     }
102     else {
103         $exists = true;
104     }
105
106     // FIXME: this should be somewhere else, if really needed.
107     // WikiLink makes A link, not a string of fancy ones.
108     // (I think that the fancy split links are just confusing.)
109     // Todo: test external ImageLinks http://some/images/next.gif
110     if (isa($wikipage, 'WikiPageName') and !$label 
111         and strchr(substr($wikipage->shortName,1), SUBPAGE_SEPARATOR)) {
112         $parts = explode(SUBPAGE_SEPARATOR, $wikipage->shortName);
113         $last_part = array_pop($parts);
114         $sep = '';
115         $link = HTML::span();
116         foreach ($parts as $part) {
117             $path[] = $part;
118             $parent = join(SUBPAGE_SEPARATOR, $path);
119             if ($part)
120                 $link->pushContent($Theme->linkExistingWikiWord($parent, $sep . $part));
121             $sep = SUBPAGE_SEPARATOR;
122         }
123         if ($exists)
124             $link->pushContent($Theme->linkExistingWikiWord($wikipage, $sep . $last_part, $version));
125         else
126             $link->pushContent($Theme->linkUnknownWikiWord($wikipage, $last_part));
127         return $link;
128     }
129
130     if ($exists) {
131         return $Theme->linkExistingWikiWord($wikipage, $label, $version);
132     }
133     elseif ($type == 'if_known') {
134         if (!$label && isa($wikipage, 'WikiPageName'))
135             $label = $wikipage->shortName;
136         return HTML($label ? $label : $pagename);
137     }
138     else {
139         return $Theme->linkUnknownWikiWord($wikipage, $label);
140     }
141 }
142
143
144
145 /**
146  * Make a button.
147  *
148  * This is a convenience function.
149  *
150  * @param $action string
151  * One of <dl>
152  * <dt>[action]</dt><dd>Perform action (e.g. 'edit') on the selected page.</dd>
153  * <dt>[ActionPage]</dt><dd>Run the actionpage (e.g. 'BackLinks') on the selected page.</dd>
154  * <dt>'submit:'[name]</dt><dd>Make a form submission button with the given name.
155  *      ([name] can be blank for a nameless submit button.)</dd>
156  * <dt>a hash</dt><dd>Query args for the action. E.g.<pre>
157  *      array('action' => 'diff', 'previous' => 'author')
158  * </pre></dd>
159  * </dl>
160  *
161  * @param $label string
162  * A label for the button.  If ommited, a suitable default (based on the valued of $action)
163  * will be picked.
164  *
165  * @param $page_or_rev mixed
166  * Which page (& version) to perform the action on.
167  * Can be one of:<dl>
168  * <dt>A string</dt><dd>The pagename.</dd>
169  * <dt>A WikiDB_Page object</dt><dd>The page.</dd>
170  * <dt>A WikiDB_PageRevision object</dt><dd>A specific version of the page.</dd>
171  * </dl>
172  * ($Page_or_rev is ignored for submit buttons.)
173  */
174 function Button ($action, $label = false, $page_or_rev = false) {
175     global $Theme;
176
177     if (!is_array($action) && preg_match('/submit:(.*)/A', $action, $m))
178         return $Theme->makeSubmitButton($label, $m[1], $class = $page_or_rev);
179     else
180         return $Theme->makeActionButton($action, $label, $page_or_rev);
181 }
182
183
184 class Theme {
185     var $HTML_DUMP_SUFFIX = '';
186     var $DUMP_MODE = false, $dumped_images, $dumped_css; 
187
188     function Theme ($theme_name = 'default') {
189         $this->_name = $theme_name;
190         $themes_dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR . "/themes" : "themes";
191
192         $this->_path  = defined('PHPWIKI_DIR') ? PHPWIKI_DIR . "/" : "";
193         $this->_theme = "themes/$theme_name";
194
195         if ($theme_name != 'default')
196             $this->_default_theme = new Theme;
197
198         $this->_css = array();
199     }
200
201     function file ($file) {
202         return $this->_path . "$this->_theme/$file";
203     }
204
205     function _findFile ($file, $missing_okay = false) {
206         if (file_exists($this->_path . "$this->_theme/$file"))
207             return "$this->_theme/$file";
208
209         // FIXME: this is a short-term hack.  Delete this after all files
210         // get moved into themes/...
211         if (file_exists($this->_path . $file))
212             return $file;
213
214
215         if (isset($this->_default_theme)) {
216             return $this->_default_theme->_findFile($file, $missing_okay);
217         }
218         else if (!$missing_okay) {
219             trigger_error("$file: not found", E_USER_NOTICE);
220         }
221         return false;
222     }
223
224     function _findData ($file, $missing_okay = false) {
225         $path = $this->_findFile($file, $missing_okay);
226         if (!$path)
227             return false;
228
229         if (defined('DATA_PATH'))
230             return DATA_PATH . "/$path";
231         return $path;
232     }
233
234     ////////////////////////////////////////////////////////////////
235     //
236     // Date and Time formatting
237     //
238     ////////////////////////////////////////////////////////////////
239
240     // Note:  Windows' implemetation of strftime does not include certain
241         // format specifiers, such as %e (for date without leading zeros).  In
242         // general, see:
243         // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp
244         // As a result, we have to use %d, and strip out leading zeros ourselves.
245
246     var $_dateFormat = "%B %d, %Y";
247     var $_timeFormat = "%I:%M %p";
248
249     var $_showModTime = true;
250
251     /**
252      * Set format string used for dates.
253      *
254      * @param $fs string Format string for dates.
255      *
256      * @param $show_mod_time bool If true (default) then times
257      * are included in the messages generated by getLastModifiedMessage(),
258      * otherwise, only the date of last modification will be shown.
259      */
260     function setDateFormat ($fs, $show_mod_time = true) {
261         $this->_dateFormat = $fs;
262         $this->_showModTime = $show_mod_time;
263     }
264
265     /**
266      * Set format string used for times.
267      *
268      * @param $fs string Format string for times.
269      */
270     function setTimeFormat ($fs) {
271         $this->_timeFormat = $fs;
272     }
273
274     /**
275      * Format a date.
276      *
277      * Any time zone offset specified in the users preferences is
278      * taken into account by this method.
279      *
280      * @param $time_t integer Unix-style time.
281      *
282      * @return string The date.
283      */
284     function formatDate ($time_t) {
285         global $request;
286         
287         $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
288         // strip leading zeros from date elements (ie space followed by zero)
289         return preg_replace('/ 0/', ' ', 
290                             strftime($this->_dateFormat, $offset_time));
291     }
292
293     /**
294      * Format a date.
295      *
296      * Any time zone offset specified in the users preferences is
297      * taken into account by this method.
298      *
299      * @param $time_t integer Unix-style time.
300      *
301      * @return string The time.
302      */
303     function formatTime ($time_t) {
304         //FIXME: make 24-hour mode configurable?
305         global $request;
306         $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
307         return preg_replace('/^0/', ' ',
308                             strtolower(strftime($this->_timeFormat, $offset_time)));
309     }
310
311     /**
312      * Format a date and time.
313      *
314      * Any time zone offset specified in the users preferences is
315      * taken into account by this method.
316      *
317      * @param $time_t integer Unix-style time.
318      *
319      * @return string The date and time.
320      */
321     function formatDateTime ($time_t) {
322         return $this->formatDate($time_t) . ' ' . $this->formatTime($time_t);
323     }
324
325     /**
326      * Format a (possibly relative) date.
327      *
328      * If enabled in the users preferences, this method might
329      * return a relative day (e.g. 'Today', 'Yesterday').
330      *
331      * Any time zone offset specified in the users preferences is
332      * taken into account by this method.
333      *
334      * @param $time_t integer Unix-style time.
335      *
336      * @return string The day.
337      */
338     function getDay ($time_t) {
339         global $request;
340         
341         if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($time_t))) {
342             return ucfirst($date);
343         }
344         return $this->formatDate($time_t);
345     }
346     
347     /**
348      * Format the "last modified" message for a page revision.
349      *
350      * @param $revision object A WikiDB_PageRevision object.
351      *
352      * @param $show_version bool Should the page version number
353      * be included in the message.  (If this argument is omitted,
354      * then the version number will be shown only iff the revision
355      * is not the current one.
356      *
357      * @return string The "last modified" message.
358      */
359     function getLastModifiedMessage ($revision, $show_version = 'auto') {
360         global $request;
361
362         // dates >= this are considered invalid.
363         if (! defined('EPOCH'))
364             define('EPOCH', 0); // seconds since ~ January 1 1970
365
366         $mtime = $revision->get('mtime');
367         if ($mtime <= EPOCH)
368             return fmt("Never edited.");
369
370         if ($show_version == 'auto')
371             $show_version = !$revision->isCurrent();
372
373         if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($mtime))) {
374             if ($this->_showModTime)
375                 $date =  sprintf(_("%s at %s"),
376                                  $date, $this->formatTime($mtime));
377             
378             if ($show_version)
379                 return fmt("Version %s, saved %s.", $revision->getVersion(), $date);
380             else
381                 return fmt("Last edited %s.", $date);
382         }
383
384         if ($this->_showModTime)
385             $date = $this->formatDateTime($mtime);
386         else
387             $date = $this->formatDate($mtime);
388         
389         if ($show_version)
390             return fmt("Version %s, saved on %s.", $revision->getVersion(), $date);
391         else
392             return fmt("Last edited on %s.", $date);
393     }
394     
395     function _relativeDay ($time_t) {
396         global $request;
397         
398         if (is_numeric($request->getPref('timeOffset')))
399           $offset = 3600 * $request->getPref('timeOffset');
400         else 
401           $offset = 0;          
402
403         $now = time() + $offset;
404         $today = localtime($now, true);
405         $time = localtime($time_t + $offset, true);
406
407         if ($time['tm_yday'] == $today['tm_yday'] && $time['tm_year'] == $today['tm_year'])
408             return _("today");
409         
410         // Note that due to daylight savings chages (and leap seconds), $now minus
411         // 24 hours is not guaranteed to be yesterday.
412         $yesterday = localtime($now - (12 + $today['tm_hour']) * 3600, true);
413         if ($time['tm_yday'] == $yesterday['tm_yday'] && $time['tm_year'] == $yesterday['tm_year'])
414             return _("yesterday");
415
416         return false;
417     }
418
419     ////////////////////////////////////////////////////////////////
420     //
421     // Hooks for other formatting
422     //
423     ////////////////////////////////////////////////////////////////
424
425     //FIXME: PHP 4.1 Warnings
426     //lib/Theme.php:84: Notice[8]: The call_user_method() function is deprecated,
427     //use the call_user_func variety with the array(&$obj, "method") syntax instead
428
429     function getFormatter ($type, $format) {
430         $method = strtolower("get${type}Formatter");
431         if (method_exists($this, $method))
432             return $this->{$method}($format);
433         return false;
434     }
435
436     ////////////////////////////////////////////////////////////////
437     //
438     // Links
439     //
440     ////////////////////////////////////////////////////////////////
441
442     var $_autosplitWikiWords = false;
443
444     function setAutosplitWikiWords($autosplit=false) {
445         $this->_autosplitWikiWords = $autosplit ? true : false;
446     }
447
448     function maybeSplitWikiWord ($wikiword) {
449         if ($this->_autosplitWikiWords)
450             return split_pagename($wikiword);
451         else
452             return $wikiword;
453     }
454
455     var $_anonEditUnknownLinks = true;
456     function setAnonEditUnknownLinks($anonedit=true) {
457         $this->_anonEditUnknownLinks = $anonedit ? true : false;
458     }
459
460     function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
461         global $request;
462
463         if ($version !== false)
464             $url = WikiURL($wikiword, array('version' => $version));
465         else
466             $url = WikiURL($wikiword);
467
468         // Extra steps for dumping page to an html file.
469         // FIXME: shouldn't this be in WikiURL?
470         if ($this->HTML_DUMP_SUFFIX) {
471             // no action or sortby links
472             $url = preg_replace("/\?.*$/","",$url);
473             // urlencode for pagenames with accented letters
474             $url = rawurlencode($url);
475             $url = preg_replace('/^\./', '%2e', $url);
476             // fix url#anchor links (looks awful)
477             if (strstr($url,'%23'))
478                 $url = preg_replace("/%23/",$this->HTML_DUMP_SUFFIX."#",$url);
479             else
480                 $url .= $this->HTML_DUMP_SUFFIX;
481         }
482
483         $link = HTML::a(array('href' => $url));
484
485         if (isa($wikiword, 'WikiPageName'))
486             $default_text = $wikiword->shortName;
487         else
488             $default_text = $wikiword;
489         
490         if (!empty($linktext)) {
491             $link->pushContent($linktext);
492             $link->setAttr('class', 'named-wiki');
493             $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
494         }
495         else {
496             $link->pushContent($this->maybeSplitWikiWord($default_text));
497             $link->setAttr('class', 'wiki');
498         }
499         if ($request->getArg('frame'))
500             $link->setAttr('target', '_top');
501         return $link;
502     }
503
504     function linkUnknownWikiWord($wikiword, $linktext = '') {
505         global $request;
506
507         // Get rid of anchors on unknown wikiwords
508         if (isa($wikiword, 'WikiPageName')) {
509             $default_text = $wikiword->shortName;
510             $wikiword = $wikiword->name;
511         }
512         else {
513             $default_text = $wikiword;
514         }
515         
516         if ($this->DUMP_MODE) { // HTML, PDF or XML
517             $link = HTML::u( empty($linktext) ? $wikiword : $linktext);
518             $link->addTooltip(sprintf(_("Empty link to: %s"), $wikiword));
519             $link->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
520             return $link;
521         } else {
522             // if AnonEditUnknownLinks show "?" only users which are allowed to edit this page
523             if (! $this->_anonEditUnknownLinks and ! mayAccessPage('edit',$request->getArg('pagename'))) {
524                 $text = HTML::span( empty($linktext) ? $wikiword : $linktext);
525                 $text->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
526                 return $text;
527             } else {
528                 $url = WikiURL($wikiword, array('action' => 'create'));
529                 $button = $this->makeButton('?', $url);
530                 $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
531             }
532             $link = HTML::span($button);
533         }
534
535
536         if (!empty($linktext)) {
537             $link->pushContent(HTML::u($linktext));
538             $link->setAttr('class', 'named-wikiunknown');
539         }
540         else {
541             $link->pushContent(HTML::u($this->maybeSplitWikiWord($default_text)));
542             $link->setAttr('class', 'wikiunknown');
543         }
544         if ($request->getArg('frame'))
545             $link->setAttr('target', '_top');
546
547         return $link;
548     }
549
550     function linkBadWikiWord($wikiword, $linktext = '') {
551         global $ErrorManager;
552         
553         if ($linktext) {
554             $text = $linktext;
555         }
556         elseif (isa($wikiword, 'WikiPageName')) {
557             $text = $wikiword->shortName;
558         }
559         else {
560             $text = $wikiword;
561         }
562
563         if (isa($wikiword, 'WikiPageName'))
564             $message = $wikiword->getWarnings();
565         else
566             $message = sprintf(_("'%s': Bad page name"), $wikiword);
567         $ErrorManager->warning($message);
568         
569         return HTML::span(array('class' => 'badwikiword'), $text);
570     }
571     
572     ////////////////////////////////////////////////////////////////
573     //
574     // Images and Icons
575     //
576     ////////////////////////////////////////////////////////////////
577     var $_imageAliases = array();
578     var $_imageAlt = array();
579
580     /**
581      *
582      * (To disable an image, alias the image to <code>false</code>.
583      */
584     function addImageAlias ($alias, $image_name) {
585         // fall back to the PhpWiki-supplied image if not found
586         if ($this->_findFile("images/$image_name", true))
587             $this->_imageAliases[$alias] = $image_name;
588     }
589
590     function addImageAlt ($alias, $alt_text) {
591         $this->_imageAlt[$alias] = $alt_text;
592     }
593     function getImageAlt ($alias) {
594         return $this->_imageAlt[$alias];
595     }
596
597     function getImageURL ($image) {
598         $aliases = &$this->_imageAliases;
599
600         if (isset($aliases[$image])) {
601             $image = $aliases[$image];
602             if (!$image)
603                 return false;
604         }
605
606         // If not extension, default to .png.
607         if (!preg_match('/\.\w+$/', $image))
608             $image .= '.png';
609
610         // FIXME: this should probably be made to fall back
611         //        automatically to .gif, .jpg.
612         //        Also try .gif before .png if browser doesn't like png.
613
614         $path = $this->_findData("images/$image", 'missing okay');
615         if (!$path) // search explicit images/ or button/ links also
616             $path = $this->_findData("$image", 'missing okay');
617
618         if ($this->DUMP_MODE) {
619             if (empty($this->dumped_images)) $this->dumped_images = array();
620             $path = "images/". basename($path);
621             if (!in_array($path,$this->dumped_images)) $this->dumped_images[] = $path;
622         }
623         return $path;   
624     }
625
626     function setLinkIcon($proto, $image = false) {
627         if (!$image)
628             $image = $proto;
629
630         $this->_linkIcons[$proto] = $image;
631     }
632
633     function getLinkIconURL ($proto) {
634         $icons = &$this->_linkIcons;
635         if (!empty($icons[$proto]))
636             return $this->getImageURL($icons[$proto]);
637         elseif (!empty($icons['*']))
638             return $this->getImageURL($icons['*']);
639         return false;
640     }
641
642     function addButtonAlias ($text, $alias = false) {
643         $aliases = &$this->_buttonAliases;
644
645         if (is_array($text))
646             $aliases = array_merge($aliases, $text);
647         elseif ($alias === false)
648             unset($aliases[$text]);
649         else
650             $aliases[$text] = $alias;
651     }
652
653     function getButtonURL ($text) {
654         $aliases = &$this->_buttonAliases;
655         if (isset($aliases[$text]))
656             $text = $aliases[$text];
657
658         $qtext = urlencode($text);
659         $url = $this->_findButton("$qtext.png");
660         if ($url && strstr($url, '%')) {
661             $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
662         }
663         if (!$url) {// Jeff complained about png not supported everywhere. This is not PC
664             $url = $this->_findButton("$qtext.gif");
665             if ($url && strstr($url, '%')) {
666                 $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
667             }
668         }
669         return $url;
670     }
671
672     function _findButton ($button_file) {
673         if (empty($this->_button_path))
674             $this->_button_path = $this->_getButtonPath();
675
676         foreach ($this->_button_path as $dir) {
677             $path = "$dir/$button_file";
678             if (file_exists($this->_path . $path))
679                 return defined('DATA_PATH') ? DATA_PATH . "/$path" : $path;
680         }
681         return false;
682     }
683
684     function _getButtonPath () {
685         $button_dir = $this->_findFile("buttons");
686         $path_dir = $this->_path . $button_dir;
687         if (!file_exists($path_dir) || !is_dir($path_dir))
688             return array();
689         $path = array($button_dir);
690         $dir = dir($path_dir);
691         while (($subdir = $dir->read()) !== false) {
692             if ($subdir[0] == '.')
693                 continue;
694             if ($subdir == 'CVS')
695                 continue;
696             if (is_dir("$path_dir/$subdir"))
697                 $path[] = "$button_dir/$subdir";
698         }
699         $dir->close();
700
701         return $path;
702     }
703
704     ////////////////////////////////////////////////////////////////
705     //
706     // Button style
707     //
708     ////////////////////////////////////////////////////////////////
709
710     function makeButton ($text, $url, $class = false) {
711         // FIXME: don't always try for image button?
712
713         // Special case: URLs like 'submit:preview' generate form
714         // submission buttons.
715         if (preg_match('/^submit:(.*)$/', $url, $m))
716             return $this->makeSubmitButton($text, $m[1], $class);
717
718         $imgurl = $this->getButtonURL($text);
719         if ($imgurl)
720             return new ImageButton($text, $url, $class, $imgurl);
721         else
722             return new Button($text, $url, $class);
723     }
724
725     function makeSubmitButton ($text, $name, $class = false) {
726         $imgurl = $this->getButtonURL($text);
727
728         if ($imgurl)
729             return new SubmitImageButton($text, $name, $class, $imgurl);
730         else
731             return new SubmitButton($text, $name, $class);
732     }
733
734     /**
735      * Make button to perform action.
736      *
737      * This constructs a button which performs an action on the
738      * currently selected version of the current page.
739      * (Or anotherpage or version, if you want...)
740      *
741      * @param $action string The action to perform (e.g. 'edit', 'lock').
742      * This can also be the name of an "action page" like 'LikePages'.
743      * Alternatively you can give a hash of query args to be applied
744      * to the page.
745      *
746      * @param $label string Textual label for the button.  If left empty,
747      * a suitable name will be guessed.
748      *
749      * @param $page_or_rev mixed  The page to link to.  This can be
750      * given as a string (the page name), a WikiDB_Page object, or as
751      * WikiDB_PageRevision object.  If given as a WikiDB_PageRevision
752      * object, the button will link to a specific version of the
753      * designated page, otherwise the button links to the most recent
754      * version of the page.
755      *
756      * @return object A Button object.
757      */
758     function makeActionButton ($action, $label = false, $page_or_rev = false) {
759         extract($this->_get_name_and_rev($page_or_rev));
760
761         if (is_array($action)) {
762             $attr = $action;
763             $action = isset($attr['action']) ? $attr['action'] : 'browse';
764         }
765         else
766             $attr['action'] = $action;
767
768         $class = is_safe_action($action) ? 'wikiaction' : 'wikiadmin';
769         if (!$label)
770             $label = $this->_labelForAction($action);
771
772         if ($version)
773             $attr['version'] = $version;
774
775         if ($action == 'browse')
776             unset($attr['action']);
777
778         return $this->makeButton($label, WikiURL($pagename, $attr), $class);
779     }
780
781     /**
782      * Make a "button" which links to a wiki-page.
783      *
784      * These are really just regular WikiLinks, possibly
785      * disguised (e.g. behind an image button) by the theme.
786      *
787      * This method should probably only be used for links
788      * which appear in page navigation bars, or similar places.
789      *
790      * Use linkExistingWikiWord, or LinkWikiWord for normal links.
791      *
792      * @param $page_or_rev mixed The page to link to.  This can be
793      * given as a string (the page name), a WikiDB_Page object, or as
794      * WikiDB_PageRevision object.  If given as a WikiDB_PageRevision
795      * object, the button will link to a specific version of the
796      * designated page, otherwise the button links to the most recent
797      * version of the page.
798      *
799      * @return object A Button object.
800      */
801     function makeLinkButton ($page_or_rev, $label = false) {
802         extract($this->_get_name_and_rev($page_or_rev));
803
804         $args = $version ? array('version' => $version) : false;
805
806         return $this->makeButton($label ? $label : $this->maybeSplitWikiWord($pagename), 
807                                  WikiURL($pagename, $args), 'wiki');
808     }
809
810     function _get_name_and_rev ($page_or_rev) {
811         $version = false;
812
813         if (empty($page_or_rev)) {
814             global $request;
815             $pagename = $request->getArg("pagename");
816             $version = $request->getArg("version");
817         }
818         elseif (is_object($page_or_rev)) {
819             if (isa($page_or_rev, 'WikiDB_PageRevision')) {
820                 $rev = $page_or_rev;
821                 $page = $rev->getPage();
822                 $version = $rev->getVersion();
823             }
824             else {
825                 $page = $page_or_rev;
826             }
827             $pagename = $page->getName();
828         }
829         else {
830             $pagename = (string) $page_or_rev;
831         }
832         return compact('pagename', 'version');
833     }
834
835     function _labelForAction ($action) {
836         switch ($action) {
837             case 'edit':   return _("Edit");
838             case 'diff':   return _("Diff");
839             case 'logout': return _("Sign Out");
840             case 'login':  return _("Sign In");
841             case 'lock':   return _("Lock Page");
842             case 'unlock': return _("Unlock Page");
843             case 'remove': return _("Remove Page");
844             default:
845                 // I don't think the rest of these actually get used.
846                 // 'setprefs'
847                 // 'upload' 'dumpserial' 'loadfile' 'zip'
848                 // 'save' 'browse'
849                 return gettext(ucfirst($action));
850         }
851     }
852
853     //----------------------------------------------------------------
854     var $_buttonSeparator = "\n | ";
855
856     function setButtonSeparator($separator) {
857         $this->_buttonSeparator = $separator;
858     }
859
860     function getButtonSeparator() {
861         return $this->_buttonSeparator;
862     }
863
864
865     ////////////////////////////////////////////////////////////////
866     //
867     // CSS
868     //
869     // Notes:
870     //
871     // Based on testing with Galeon 1.2.7 (Mozilla 1.2):
872     // Automatic media-based style selection (via <link> tags) only
873     // seems to work for the default style, not for alternate styles.
874     //
875     // Doing
876     //
877     //  <link rel="stylesheet" type="text/css" href="phpwiki.css" />
878     //  <link rel="stylesheet" type="text/css" href="phpwiki-printer.css" media="print" />
879     //
880     // works to make it so that the printer style sheet get used
881     // automatically when printing (or print-previewing) a page
882     // (but when only when the default style is selected.)
883     //
884     // Attempts like:
885     //
886     //  <link rel="alternate stylesheet" title="Modern"
887     //        type="text/css" href="phpwiki-modern.css" />
888     //  <link rel="alternate stylesheet" title="Modern"
889     //        type="text/css" href="phpwiki-printer.css" media="print" />
890     //
891     // Result in two "Modern" choices when trying to select alternate style.
892     // If one selects the first of those choices, one gets phpwiki-modern
893     // both when browsing and printing.  If one selects the second "Modern",
894     // one gets no CSS when browsing, and phpwiki-printer when printing.
895     //
896     // The Real Fix?
897     // =============
898     //
899     // We should probably move to doing the media based style
900     // switching in the CSS files themselves using, e.g.:
901     //
902     //  @import url(print.css) print;
903     //
904     ////////////////////////////////////////////////////////////////
905
906     function _CSSlink($title, $css_file, $media, $is_alt = false) {
907         // Don't set title on default style.  This makes it clear to
908         // the user which is the default (i.e. most supported) style.
909         $link = HTML::link(array('rel'     => $is_alt ? 'alternate stylesheet' : 'stylesheet',
910                                  'type'    => 'text/css',
911                                  'charset' => CHARSET,
912                                  'href'    => $this->_findData($css_file)));
913         if ($is_alt)
914             $link->setAttr('title', $title);
915
916         if ($media) 
917             $link->setAttr('media', $media);
918         if ($this->DUMP_MODE) {
919             if (empty($this->dumped_css)) $this->dumped_css = array();
920             if (!in_array($css_file,$this->dumped_css)) $this->dumped_css[] = $css_file;
921             $link->setAttr('href', basename($link->getAttr('href')));
922         }
923         
924         return $link;
925     }
926
927     /** Set default CSS source for this theme.
928      *
929      * To set styles to be used for different media, pass a
930      * hash for the second argument, e.g.
931      *
932      * $theme->setDefaultCSS('default', array('' => 'normal.css',
933      *                                        'print' => 'printer.css'));
934      *
935      * If you call this more than once, the last one called takes
936      * precedence as the default style.
937      *
938      * @param string $title Name of style (currently ignored, unless
939      * you call this more than once, in which case, some of the style
940      * will become alternate (rather than default) styles, and then their
941      * titles will be used.
942      *
943      * @param mixed $css_files Name of CSS file, or hash containing a mapping
944      * between media types and CSS file names.  Use a key of '' (the empty string)
945      * to set the default CSS for non-specified media.  (See above for an example.)
946      */
947     function setDefaultCSS ($title, $css_files) {
948         if (!is_array($css_files))
949             $css_files = array('' => $css_files);
950         // Add to the front of $this->_css
951         unset($this->_css[$title]);
952         $this->_css = array_merge(array($title => $css_files), $this->_css);
953     }
954
955     /** Set alternate CSS source for this theme.
956      *
957      * @param string $title Name of style.
958      * @param string $css_files Name of CSS file.
959      */
960     function addAlternateCSS ($title, $css_files) {
961         if (!is_array($css_files))
962             $css_files = array('' => $css_files);
963         $this->_css[$title] = $css_files;
964     }
965
966     /**
967         * @return string HTML for CSS.
968      */
969     function getCSS () {
970         $css = array();
971         $is_alt = false;
972         foreach ($this->_css as $title => $css_files) {
973             ksort($css_files); // move $css_files[''] to front.
974             foreach ($css_files as $media => $css_file) {
975                 $css[] = $this->_CSSlink($title, $css_file, $media, $is_alt);
976                 if ($is_alt) break;
977                 
978             }
979             $is_alt = true;
980         }
981         return HTML($css);
982     }
983     
984
985     function findTemplate ($name) {
986         return $this->_path . $this->_findFile("templates/$name.tmpl");
987     }
988
989     var $_MoreHeaders = array();
990     function addMoreHeaders ($element) {
991         array_push($this->_MoreHeaders,$element);
992     }
993     function getMoreHeaders () {
994         if (empty($this->_MoreHeaders))
995             return '';
996         $out = '';
997         //$out = "<!-- More Headers -->\n";
998         foreach ($this->_MoreHeaders as $h) {
999             if (is_object($h))
1000                 $out .= printXML($h);
1001             else
1002                 $out .= "$h\n";
1003         }
1004         return $out;
1005     }
1006
1007     var $_MoreAttr = array();
1008     function addMoreAttr ($id,$element) {
1009         if (empty($this->_MoreAttr) or !is_array($this->_MoreAttr[$id]))
1010             $this->_MoreAttr[$id] = array($element);
1011         else
1012             array_push($this->_MoreAttr[$id],$element);
1013     }
1014     function getMoreAttr ($id) {
1015         if (empty($this->_MoreAttr[$id]))
1016             return '';
1017         $out = '';
1018         foreach ($this->_MoreAttr[$id] as $h) {
1019             if (is_object($h))
1020                 $out .= printXML($h);
1021             else
1022                 $out .= "$h";
1023         }
1024         return $out;
1025     }
1026
1027     /**
1028      * Custom UserPreferences:
1029      * A list of name => _UserPreference class pairs.
1030      * Rationale: Certain themes should be able to extend the predefined list 
1031      * of preferences. Display/editing is done in the theme specific userprefs.tmpl
1032      * but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
1033      * These values are just ignored if another theme is used.
1034      */
1035     function customUserPreferences($array) {
1036         global $customUserPreferenceColumns; // FIXME: really a global?
1037         if (empty($customUserPreferenceColumns)) $customUserPreferenceColumns = array();
1038         //array('wikilens' => new _UserPreference_wikilens());
1039         foreach ($array as $field => $prefobj) {
1040             $customUserPreferenceColumns[$field] = $prefobj;
1041         }
1042     }
1043
1044     /** addPageListColumn(array('rating' => new _PageList_Column_rating('rating', _("Rate"))))
1045      *  Register custom PageList types for special themes, like 
1046      *  'rating' for wikilens
1047      */
1048     function addPageListColumn ($array) {
1049         global $customPageListColumns;
1050         if (empty($customPageListColumns)) $customPageListColumns = array();
1051         foreach ($array as $column => $obj) {
1052             $customPageListColumns[$column] = $obj;
1053         }
1054     }
1055
1056 };
1057
1058
1059 /**
1060  * A class representing a clickable "button".
1061  *
1062  * In it's simplest (default) form, a "button" is just a link associated
1063  * with some sort of wiki-action.
1064  */
1065 class Button extends HtmlElement {
1066     /** Constructor
1067      *
1068      * @param $text string The text for the button.
1069      * @param $url string The url (href) for the button.
1070      * @param $class string The CSS class for the button.
1071      */
1072     function Button ($text, $url, $class = false) {
1073         global $request;
1074         //php5 workaround
1075         if (check_php_version(5)) {
1076             $this->_init('a', array('href' => $url));
1077         } else {
1078             $this->HtmlElement('a', array('href' => $url));
1079         }
1080         if ($class)
1081             $this->setAttr('class', $class);
1082         if ($request->getArg('frame'))
1083             $this->setAttr('target', '_top');
1084         $this->pushContent($GLOBALS['Theme']->maybeSplitWikiWord($text));
1085     }
1086
1087 };
1088
1089
1090 /**
1091  * A clickable image button.
1092  */
1093 class ImageButton extends Button {
1094     /** Constructor
1095      *
1096      * @param $text string The text for the button.
1097      * @param $url string The url (href) for the button.
1098      * @param $class string The CSS class for the button.
1099      * @param $img_url string URL for button's image.
1100      * @param $img_attr array Additional attributes for the &lt;img&gt; tag.
1101      */
1102     function ImageButton ($text, $url, $class, $img_url, $img_attr = false) {
1103         $this->HtmlElement('a', array('href' => $url));
1104         if ($class)
1105             $this->setAttr('class', $class);
1106
1107         if (!is_array($img_attr))
1108             $img_attr = array();
1109         $img_attr['src'] = $img_url;
1110         $img_attr['alt'] = $text;
1111         $img_attr['class'] = 'wiki-button';
1112         $img_attr['border'] = 0;
1113         $this->pushContent(HTML::img($img_attr));
1114     }
1115 };
1116
1117 /**
1118  * A class representing a form <samp>submit</samp> button.
1119  */
1120 class SubmitButton extends HtmlElement {
1121     /** Constructor
1122      *
1123      * @param $text string The text for the button.
1124      * @param $name string The name of the form field.
1125      * @param $class string The CSS class for the button.
1126      */
1127     function SubmitButton ($text, $name = false, $class = false) {
1128         $this->HtmlElement('input', array('type' => 'submit',
1129                                           'value' => $text));
1130         if ($name)
1131             $this->setAttr('name', $name);
1132         if ($class)
1133             $this->setAttr('class', $class);
1134     }
1135
1136 };
1137
1138
1139 /**
1140  * A class representing an image form <samp>submit</samp> button.
1141  */
1142 class SubmitImageButton extends SubmitButton {
1143     /** Constructor
1144      *
1145      * @param $text string The text for the button.
1146      * @param $name string The name of the form field.
1147      * @param $class string The CSS class for the button.
1148      * @param $img_url string URL for button's image.
1149      * @param $img_attr array Additional attributes for the &lt;img&gt; tag.
1150      */
1151     function SubmitImageButton ($text, $name = false, $class = false, $img_url) {
1152         $this->HtmlElement('input', array('type'  => 'image',
1153                                           'src'   => $img_url,
1154                                           'value' => $text,
1155                                           'alt'   => $text));
1156         if ($name)
1157             $this->setAttr('name', $name);
1158         if ($class)
1159             $this->setAttr('class', $class);
1160     }
1161
1162 };
1163
1164 /** 
1165  * A sidebar box with title and body, narrow fixed-width.
1166  * To represent abbrevated content of plugins, links or forms,
1167  * like "Getting Started", "Search", "Sarch Pagename", 
1168  * "Login", "Menu", "Recent Changes", "Last comments", "Last Blogs"
1169  * "Calendar"
1170  * ... See http://tikiwiki.org/
1171  *
1172  * Usage:
1173  * sidebar.tmpl:
1174  *   $menu = SidebarBox("Menu",HTML::dl(HTML::dt(...))); $menu->format();
1175  *   $menu = PluginSidebarBox("RecentChanges",array('limit'=>10)); $menu->format();
1176  */
1177 class SidebarBox {
1178
1179     function SidebarBox($title, $body) {
1180         $this->title = $title;
1181         $this->body = $body;
1182     }
1183     function format() {
1184         return WikiPlugin::makeBox($this->title, $this->body);
1185     }
1186 }
1187
1188 /** 
1189  * A sidebar box for plugins.
1190  * Any plugin may provide a box($args=false, $request=false, $basepage=false) 
1191  * method, with the help of WikiPlugin::makeBox()
1192  */
1193 class PluginSidebarBox extends SidebarBox {
1194
1195     var $_plugin, $_args = false, $_basepage = false;
1196
1197     function PluginSidebarBox($name, $args = false, $basepage = false) {
1198         $loader = new WikiPluginLoader();
1199         $plugin = $loader->getPlugin($name);
1200         if (!method_exists($plugin,'box')) {
1201             return $loader->error(sprintf(_("%s: has no box method"),
1202                                           get_class($plugin)));
1203         }
1204         $this->_plugin   =& $plugin;
1205         $this->_args     = $args ? $args : array();
1206         $this->_basepage = $basepage;
1207     }
1208
1209     function format($args = false) {
1210         return $this->_plugin->box($args ? array_merge($this->_args,$args) : $this->_args,
1211                                    $GLOBALS['request'], 
1212                                    $this->_basepage);
1213     }
1214 }
1215
1216 // Various boxes which are no plugins
1217 class RelatedLinksBox extends SidebarBox {
1218     function RelatedLinksBox($title = false, $body = '', $limit = 20) {
1219         global $request;
1220         $this->title = $title ? $title : _("Related Links");
1221         $this->body = HTML($body);
1222         $page = $request->getPage($request->getArg('pagename'));
1223         $revision = $page->getCurrentRevision();
1224         $page_content = $revision->getTransformedContent();
1225         //$cache = &$page->_wikidb->_cache;
1226         $counter = 0;
1227         $sp = HTML::Raw('&middot; ');
1228         foreach ($page_content->getWikiPageLinks() as $link) {
1229             if (!$request->_dbi->isWikiPage($link)) continue;
1230             $this->body->pushContent($sp,WikiLink($link), HTML::br());
1231             $counter++;
1232             if ($limit and $counter > $limit) continue;
1233         }
1234     }
1235 }
1236
1237 class RelatedExternalLinksBox extends SidebarBox {
1238     function RelatedExternalLinksBox($title = false, $body = '', $limit = 20) {
1239         global $request;
1240         $this->title = $title ? $title : _("External Links");
1241         $this->body = HTML($body);
1242         $page = $request->getPage($request->getArg('pagename'));
1243         $cache = &$page->_wikidb->_cache;
1244         $counter = 0;
1245         $sp = HTML::Raw('&middot; ');
1246         foreach ($cache->getWikiPageLinks() as $link) {
1247             if ($link) {
1248                 $this->body->pushContent($sp, WikiLink($link), HTML::br());
1249                 $counter++;
1250                 if ($limit and $counter > $limit) continue;
1251             }
1252         }
1253     }
1254 }
1255
1256
1257
1258 // $Log: not supported by cvs2svn $
1259 // Revision 1.81  2004/04/01 15:57:10  rurban
1260 // simplified Sidebar theme: table, not absolute css positioning
1261 // added the new box methods.
1262 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1263 //
1264 // Revision 1.80  2004/03/30 02:14:03  rurban
1265 // fixed yet another Prefs bug
1266 // added generic PearDb_iter
1267 // $request->appendValidators no so strict as before
1268 // added some box plugin methods
1269 // PageList commalist for condensed output
1270 //
1271 // Revision 1.79  2004/03/24 19:39:02  rurban
1272 // php5 workaround code (plus some interim debugging code in XmlElement)
1273 //   php5 doesn't work yet with the current XmlElement class constructors,
1274 //   WikiUserNew does work better than php4.
1275 // rewrote WikiUserNew user upgrading to ease php5 update
1276 // fixed pref handling in WikiUserNew
1277 // added Email Notification
1278 // added simple Email verification
1279 // removed emailVerify userpref subclass: just a email property
1280 // changed pref binary storage layout: numarray => hash of non default values
1281 // print optimize message only if really done.
1282 // forced new cookie policy: delete pref cookies, use only WIKI_ID as plain string.
1283 //   prefs should be stored in db or homepage, besides the current session.
1284 //
1285 // Revision 1.78  2004/03/18 22:32:33  rurban
1286 // work to make it php5 compatible
1287 //
1288 // Revision 1.77  2004/03/08 19:30:01  rurban
1289 // fixed Theme->getButtonURL
1290 // AllUsers uses now WikiGroup (also DB User and DB Pref users)
1291 // PageList fix for empty pagenames
1292 //
1293 // Revision 1.76  2004/03/08 18:17:09  rurban
1294 // added more WikiGroup::getMembersOf methods, esp. for special groups
1295 // fixed $LDAP_SET_OPTIONS
1296 // fixed _AuthInfo group methods
1297 //
1298 // Revision 1.75  2004/03/01 09:34:37  rurban
1299 // fixed button path logic: now fallback to default also
1300 //
1301 // Revision 1.74  2004/02/28 21:14:08  rurban
1302 // generally more PHPDOC docs
1303 //   see http://xarch.tu-graz.ac.at/home/rurban/phpwiki/xref/
1304 // fxied WikiUserNew pref handling: empty theme not stored, save only
1305 //   changed prefs, sql prefs improved, fixed password update,
1306 //   removed REPLACE sql (dangerous)
1307 // moved gettext init after the locale was guessed
1308 // + some minor changes
1309 //
1310 // Revision 1.73  2004/02/26 03:22:05  rurban
1311 // also copy css and images with XHTML Dump
1312 //
1313 // Revision 1.72  2004/02/26 02:25:53  rurban
1314 // fix empty and #-anchored links in XHTML Dumps
1315 //
1316 // Revision 1.71  2004/02/15 21:34:37  rurban
1317 // PageList enhanced and improved.
1318 // fixed new WikiAdmin... plugins
1319 // editpage, Theme with exp. htmlarea framework
1320 //   (htmlarea yet committed, this is really questionable)
1321 // WikiUser... code with better session handling for prefs
1322 // enhanced UserPreferences (again)
1323 // RecentChanges for show_deleted: how should pages be deleted then?
1324 //
1325 // Revision 1.70  2004/01/26 09:17:48  rurban
1326 // * changed stored pref representation as before.
1327 //   the array of objects is 1) bigger and 2)
1328 //   less portable. If we would import packed pref
1329 //   objects and the object definition was changed, PHP would fail.
1330 //   This doesn't happen with an simple array of non-default values.
1331 // * use $prefs->retrieve and $prefs->store methods, where retrieve
1332 //   understands the interim format of array of objects also.
1333 // * simplified $prefs->get() and fixed $prefs->set()
1334 // * added $user->_userid and class '_WikiUser' portability functions
1335 // * fixed $user object ->_level upgrading, mostly using sessions.
1336 //   this fixes yesterdays problems with loosing authorization level.
1337 // * fixed WikiUserNew::checkPass to return the _level
1338 // * fixed WikiUserNew::isSignedIn
1339 // * added explodePageList to class PageList, support sortby arg
1340 // * fixed UserPreferences for WikiUserNew
1341 // * fixed WikiPlugin for empty defaults array
1342 // * UnfoldSubpages: added pagename arg, renamed pages arg,
1343 //   removed sort arg, support sortby arg
1344 //
1345 // Revision 1.69  2003/12/05 01:32:28  carstenklapp
1346 // New feature: Easier to run multiple wiks off of one set of code. Name
1347 // your logo and signature image files "YourWikiNameLogo.png" and
1348 // "YourWikiNameSignature.png" and put them all into
1349 // themes/default/images. YourWikiName should match what is defined as
1350 // WIKI_NAME in index.php. In case the image is not found, the default
1351 // shipped with PhpWiki will be used.
1352 //
1353 // Revision 1.68  2003/03/04 01:53:30  dairiki
1354 // Inconsequential decrufting.
1355 //
1356 // Revision 1.67  2003/02/26 03:40:22  dairiki
1357 // New action=create.  Essentially the same as action=edit, except that if the
1358 // page already exists, it falls back to action=browse.
1359 //
1360 // This is for use in the "question mark" links for unknown wiki words
1361 // to avoid problems and confusion when following links from stale pages.
1362 // (If the "unknown page" has been created in the interim, the user probably
1363 // wants to view the page before editing it.)
1364 //
1365 // Revision 1.66  2003/02/26 00:10:26  dairiki
1366 // More/better/different checks for bad page names.
1367 //
1368 // Revision 1.65  2003/02/24 22:41:57  dairiki
1369 // Fix stupid typo.
1370 //
1371 // Revision 1.64  2003/02/24 22:06:14  dairiki
1372 // Attempts to fix auto-selection of printer CSS when printing.
1373 // See new comments lib/Theme.php for more details.
1374 // Also see SF patch #669563.
1375 //
1376 // Revision 1.63  2003/02/23 03:37:05  dairiki
1377 // Stupid typo/bug fix.
1378 //
1379 // Revision 1.62  2003/02/21 04:14:52  dairiki
1380 // New WikiLink type 'if_known'.  This gives linkified name if page
1381 // exists, otherwise, just plain text.
1382 //
1383 // Revision 1.61  2003/02/18 21:52:05  dairiki
1384 // Fix so that one can still link to wiki pages with # in their names.
1385 // (This was made difficult by the introduction of named tags, since
1386 // '[Page #1]' is now a link to anchor '1' in page 'Page'.
1387 //
1388 // Now the ~ escape for page names should work: [Page ~#1].
1389 //
1390 // Revision 1.60  2003/02/15 01:59:47  dairiki
1391 // Theme::getCSS():  Add Default-Style HTTP(-eqiv) header in attempt
1392 // to fix default stylesheet selection on some browsers.
1393 // For details on the Default-Style header, see:
1394 //  http://home.dairiki.org/docs/html4/present/styles.html#h-14.3.2
1395 //
1396 // Revision 1.59  2003/01/04 22:30:16  carstenklapp
1397 // New: display a "Never edited." message instead of an invalid epoch date.
1398 //
1399
1400 // (c-file-style: "gnu")
1401 // Local Variables:
1402 // mode: php
1403 // tab-width: 8
1404 // c-basic-offset: 4
1405 // c-hanging-comment-ender-p: nil
1406 // indent-tabs-mode: nil
1407 // End:
1408 ?>