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