1 <?php rcs_id('$Id: Theme.php,v 1.116 2004-11-21 11:59:16 rurban Exp $');
2 /* Copyright (C) 2002,2004 $ThePhpWikiProgrammingTeam
4 * This file is part of PhpWiki.
6 * PhpWiki is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * PhpWiki is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with PhpWiki; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Customize output by themes: templates, css, special links functions,
23 * and more formatting.
26 require_once(dirname(__FILE__).'/HtmlElement.php');
29 * Make a link to a wiki page (in this wiki).
31 * This is a convenience function.
33 * @param mixed $page_or_rev
35 * <dt>A string</dt><dd>The page to link to.</dd>
36 * <dt>A WikiDB_Page object</dt><dd>The page to link to.</dd>
37 * <dt>A WikiDB_PageRevision object</dt><dd>A specific version of the page to link to.</dd>
42 * <dt>'unknown'</dt><dd>Make link appropriate for a non-existant page.</dd>
43 * <dt>'known'</dt><dd>Make link appropriate for an existing page.</dd>
44 * <dt>'auto'</dt><dd>Either 'unknown' or 'known' as appropriate.</dd>
45 * <dt>'button'</dt><dd>Make a button-style link.</dd>
46 * <dt>'if_known'</dt><dd>Only linkify if page exists.</dd>
48 * Unless $type of of the latter form, the link will be of class 'wiki', 'wikiunknown',
49 * 'named-wiki', or 'named-wikiunknown', as appropriate.
51 * @param mixed $label (string or XmlContent object)
52 * Label for the link. If not given, defaults to the page name.
54 * @return XmlContent The link
56 function WikiLink ($page_or_rev, $type = 'known', $label = false) {
57 global $WikiTheme, $request;
59 if ($type == 'button') {
60 return $WikiTheme->makeLinkButton($page_or_rev, $label);
65 if (isa($page_or_rev, 'WikiDB_PageRevision')) {
66 $version = $page_or_rev->getVersion();
67 if ($page_or_rev->isCurrent())
69 $page = $page_or_rev->getPage();
70 $pagename = $page->getName();
71 $wikipage = $pagename;
74 elseif (isa($page_or_rev, 'WikiDB_Page')) {
76 $pagename = $page->getName();
77 $wikipage = $pagename;
79 elseif (isa($page_or_rev, 'WikiPageName')) {
80 $wikipage = $page_or_rev;
81 $pagename = $wikipage->name;
82 if (!$wikipage->isValid('strict'))
83 return $WikiTheme->linkBadWikiWord($wikipage, $label);
86 $wikipage = new WikiPageName($page_or_rev, $request->getPage());
87 $pagename = $wikipage->name;
88 if (!$wikipage->isValid('strict'))
89 return $WikiTheme->linkBadWikiWord($wikipage, $label);
92 if ($type == 'auto' or $type == 'if_known') {
94 $exists = $page->exists();
97 $dbi =& $request->_dbi;
98 $exists = $dbi->isWikiPage($wikipage->name);
101 elseif ($type == 'unknown') {
108 // FIXME: this should be somewhere else, if really needed.
109 // WikiLink makes A link, not a string of fancy ones.
110 // (I think that the fancy split links are just confusing.)
111 // Todo: test external ImageLinks http://some/images/next.gif
112 if (isa($wikipage, 'WikiPageName') and
114 strchr(substr($wikipage->shortName,1), SUBPAGE_SEPARATOR))
116 $parts = explode(SUBPAGE_SEPARATOR, $wikipage->shortName);
117 $last_part = array_pop($parts);
119 $link = HTML::span();
120 foreach ($parts as $part) {
122 $parent = join(SUBPAGE_SEPARATOR, $path);
123 if ($WikiTheme->_autosplitWikiWords)
126 $link->pushContent($WikiTheme->linkExistingWikiWord($parent, $sep . $part));
127 $sep = $WikiTheme->_autosplitWikiWords ? ' ' . SUBPAGE_SEPARATOR : SUBPAGE_SEPARATOR;
130 $link->pushContent($WikiTheme->linkExistingWikiWord($wikipage, $sep . $last_part, $version));
132 $link->pushContent($WikiTheme->linkUnknownWikiWord($wikipage, $sep . $last_part));
137 return $WikiTheme->linkExistingWikiWord($wikipage, $label, $version);
139 elseif ($type == 'if_known') {
140 if (!$label && isa($wikipage, 'WikiPageName'))
141 $label = $wikipage->shortName;
142 return HTML($label ? $label : $pagename);
145 return $WikiTheme->linkUnknownWikiWord($wikipage, $label);
154 * This is a convenience function.
156 * @param $action string
158 * <dt>[action]</dt><dd>Perform action (e.g. 'edit') on the selected page.</dd>
159 * <dt>[ActionPage]</dt><dd>Run the actionpage (e.g. 'BackLinks') on the selected page.</dd>
160 * <dt>'submit:'[name]</dt><dd>Make a form submission button with the given name.
161 * ([name] can be blank for a nameless submit button.)</dd>
162 * <dt>a hash</dt><dd>Query args for the action. E.g.<pre>
163 * array('action' => 'diff', 'previous' => 'author')
167 * @param $label string
168 * A label for the button. If ommited, a suitable default (based on the valued of $action)
171 * @param $page_or_rev mixed
172 * Which page (& version) to perform the action on.
174 * <dt>A string</dt><dd>The pagename.</dd>
175 * <dt>A WikiDB_Page object</dt><dd>The page.</dd>
176 * <dt>A WikiDB_PageRevision object</dt><dd>A specific version of the page.</dd>
178 * ($Page_or_rev is ignored for submit buttons.)
180 function Button ($action, $label = false, $page_or_rev = false) {
183 if (!is_array($action) && preg_match('/^submit:(.*)/', $action, $m))
184 return $WikiTheme->makeSubmitButton($label, $m[1], $class = $page_or_rev);
186 return $WikiTheme->makeActionButton($action, $label, $page_or_rev);
191 var $HTML_DUMP_SUFFIX = '';
192 var $DUMP_MODE = false, $dumped_images, $dumped_css;
194 function Theme ($theme_name = 'default') {
195 $this->_name = $theme_name;
196 $this->_themes_dir = NormalizeLocalFileName("themes");
197 $this->_path = defined('PHPWIKI_DIR') ? NormalizeLocalFileName("") : "";
198 $this->_theme = "themes/$theme_name";
199 if (ENABLE_DOUBLECLICKEDIT) // by pixels
200 $this->initDoubleClickEdit();
202 if ($theme_name != 'default')
203 $this->_default_theme = new Theme;
205 $this->_css = array();
208 function file ($file) {
209 return $this->_path . "$this->_theme/$file";
212 function _findFile ($file, $missing_okay = false) {
213 if (file_exists($this->file($file)))
214 return "$this->_theme/$file";
216 // FIXME: this is a short-term hack. Delete this after all files
217 // get moved into themes/...
218 if (file_exists($this->_path . $file))
221 if (isset($this->_default_theme)) {
222 return $this->_default_theme->_findFile($file, $missing_okay);
224 else if (!$missing_okay) {
225 if (DEBUG & function_exists('debug_backtrace')) { // >= 4.3.0
226 echo "<pre>", printSimpleTrace(debug_backtrace()), "</pre>\n";
228 trigger_error("$this->_theme/$file: not found", E_USER_NOTICE);
233 function _findData ($file, $missing_okay = false) {
234 $path = $this->_findFile($file, $missing_okay);
238 if (defined('DATA_PATH'))
239 return DATA_PATH . "/$path";
243 ////////////////////////////////////////////////////////////////
245 // Date and Time formatting
247 ////////////////////////////////////////////////////////////////
249 // Note: Windows' implemetation of strftime does not include certain
250 // format specifiers, such as %e (for date without leading zeros). In
252 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp
253 // As a result, we have to use %d, and strip out leading zeros ourselves.
255 var $_dateFormat = "%B %d, %Y";
256 var $_timeFormat = "%I:%M %p";
258 var $_showModTime = true;
261 * Set format string used for dates.
263 * @param $fs string Format string for dates.
265 * @param $show_mod_time bool If true (default) then times
266 * are included in the messages generated by getLastModifiedMessage(),
267 * otherwise, only the date of last modification will be shown.
269 function setDateFormat ($fs, $show_mod_time = true) {
270 $this->_dateFormat = $fs;
271 $this->_showModTime = $show_mod_time;
275 * Set format string used for times.
277 * @param $fs string Format string for times.
279 function setTimeFormat ($fs) {
280 $this->_timeFormat = $fs;
286 * Any time zone offset specified in the users preferences is
287 * taken into account by this method.
289 * @param $time_t integer Unix-style time.
291 * @return string The date.
293 function formatDate ($time_t) {
296 $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
297 // strip leading zeros from date elements (ie space followed by zero)
298 return preg_replace('/ 0/', ' ',
299 strftime($this->_dateFormat, $offset_time));
305 * Any time zone offset specified in the users preferences is
306 * taken into account by this method.
308 * @param $time_t integer Unix-style time.
310 * @return string The time.
312 function formatTime ($time_t) {
313 //FIXME: make 24-hour mode configurable?
315 $offset_time = $time_t + 3600 * $request->getPref('timeOffset');
316 return preg_replace('/^0/', ' ',
317 strtolower(strftime($this->_timeFormat, $offset_time)));
321 * Format a date and time.
323 * Any time zone offset specified in the users preferences is
324 * taken into account by this method.
326 * @param $time_t integer Unix-style time.
328 * @return string The date and time.
330 function formatDateTime ($time_t) {
331 return $this->formatDate($time_t) . ' ' . $this->formatTime($time_t);
335 * Format a (possibly relative) date.
337 * If enabled in the users preferences, this method might
338 * return a relative day (e.g. 'Today', 'Yesterday').
340 * Any time zone offset specified in the users preferences is
341 * taken into account by this method.
343 * @param $time_t integer Unix-style time.
345 * @return string The day.
347 function getDay ($time_t) {
350 if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($time_t))) {
351 return ucfirst($date);
353 return $this->formatDate($time_t);
357 * Format the "last modified" message for a page revision.
359 * @param $revision object A WikiDB_PageRevision object.
361 * @param $show_version bool Should the page version number
362 * be included in the message. (If this argument is omitted,
363 * then the version number will be shown only iff the revision
364 * is not the current one.
366 * @return string The "last modified" message.
368 function getLastModifiedMessage ($revision, $show_version = 'auto') {
371 // dates >= this are considered invalid.
372 if (! defined('EPOCH'))
373 define('EPOCH', 0); // seconds since ~ January 1 1970
375 $mtime = $revision->get('mtime');
377 return fmt("Never edited");
379 if ($show_version == 'auto')
380 $show_version = !$revision->isCurrent();
382 if ($request->getPref('relativeDates') && ($date = $this->_relativeDay($mtime))) {
383 if ($this->_showModTime)
384 $date = sprintf(_("%s at %s"),
385 $date, $this->formatTime($mtime));
388 return fmt("Version %s, saved %s", $revision->getVersion(), $date);
390 return fmt("Last edited %s", $date);
393 if ($this->_showModTime)
394 $date = $this->formatDateTime($mtime);
396 $date = $this->formatDate($mtime);
399 return fmt("Version %s, saved on %s", $revision->getVersion(), $date);
401 return fmt("Last edited on %s", $date);
404 function _relativeDay ($time_t) {
407 if (is_numeric($request->getPref('timeOffset')))
408 $offset = 3600 * $request->getPref('timeOffset');
412 $now = time() + $offset;
413 $today = localtime($now, true);
414 $time = localtime($time_t + $offset, true);
416 if ($time['tm_yday'] == $today['tm_yday'] && $time['tm_year'] == $today['tm_year'])
419 // Note that due to daylight savings chages (and leap seconds), $now minus
420 // 24 hours is not guaranteed to be yesterday.
421 $yesterday = localtime($now - (12 + $today['tm_hour']) * 3600, true);
422 if ($time['tm_yday'] == $yesterday['tm_yday'] && $time['tm_year'] == $yesterday['tm_year'])
423 return _("yesterday");
429 * Format the "Author" and "Owner" messages for a page revision.
431 function getOwnerMessage ($page) {
432 if (!ENABLE_PAGEPERM or !class_exists("PagePermission"))
434 $dbi =& $GLOBALS['request']->_dbi;
435 $owner = $page->getOwner();
438 if ( mayAccessPage('change',$page->getName()) )
439 return fmt("Owner: %s", $this->makeActionButton(array('action'=>_("chown"),
440 's' => $page->getName()),
443 if ( $dbi->isWikiPage($owner) )
444 return fmt("Owner: %s", WikiLink($owner));
446 return fmt("Owner: %s", '"'.$owner.'"');
450 function getAuthorMessage ($revision, $only_authenticated = true) {
451 $dbi =& $GLOBALS['request']->_dbi;
452 $author = $revision->get('author_id');
453 if ( $author or $only_authenticated ) {
454 if (!$author) $author = $revision->get('author');
455 if (!$author) return '';
456 if ( $dbi->isWikiPage($author) )
457 return fmt("by %s", WikiLink($author));
459 return fmt("by %s", '"'.$author.'"');
463 ////////////////////////////////////////////////////////////////
465 // Hooks for other formatting
467 ////////////////////////////////////////////////////////////////
469 //FIXME: PHP 4.1 Warnings
470 //lib/Theme.php:84: Notice[8]: The call_user_method() function is deprecated,
471 //use the call_user_func variety with the array(&$obj, "method") syntax instead
473 function getFormatter ($type, $format) {
474 $method = strtolower("get${type}Formatter");
475 if (method_exists($this, $method))
476 return $this->{$method}($format);
480 ////////////////////////////////////////////////////////////////
484 ////////////////////////////////////////////////////////////////
486 var $_autosplitWikiWords = false;
488 function setAutosplitWikiWords($autosplit=false) {
489 $this->_autosplitWikiWords = $autosplit ? true : false;
492 function maybeSplitWikiWord ($wikiword) {
493 if ($this->_autosplitWikiWords)
494 return SplitPagename($wikiword);
499 var $_anonEditUnknownLinks = true;
500 function setAnonEditUnknownLinks($anonedit=true) {
501 $this->_anonEditUnknownLinks = $anonedit ? true : false;
504 function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
507 if ($version !== false and !$this->HTML_DUMP_SUFFIX)
508 $url = WikiURL($wikiword, array('version' => $version));
510 $url = WikiURL($wikiword);
512 // Extra steps for dumping page to an html file.
513 if ($this->HTML_DUMP_SUFFIX) {
514 $url = preg_replace('/^\./', '%2e', $url); // dot pages
517 $link = HTML::a(array('href' => $url));
519 if (isa($wikiword, 'WikiPageName'))
520 $default_text = $wikiword->shortName;
522 $default_text = $wikiword;
524 if (!empty($linktext)) {
525 $link->pushContent($linktext);
526 $link->setAttr('class', 'named-wiki');
527 $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
530 $link->pushContent($this->maybeSplitWikiWord($default_text));
531 $link->setAttr('class', 'wiki');
533 if ($request->getArg('frame'))
534 $link->setAttr('target', '_top');
538 function linkUnknownWikiWord($wikiword, $linktext = '') {
541 // Get rid of anchors on unknown wikiwords
542 if (isa($wikiword, 'WikiPageName')) {
543 $default_text = $wikiword->shortName;
544 $wikiword = $wikiword->name;
547 $default_text = $wikiword;
550 if ($this->DUMP_MODE) { // HTML, PDF or XML
551 $link = HTML::u( empty($linktext) ? $wikiword : $linktext);
552 $link->addTooltip(sprintf(_("Empty link to: %s"), $wikiword));
553 $link->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
556 // if AnonEditUnknownLinks show "?" only users which are allowed to edit this page
557 if (! $this->_anonEditUnknownLinks and ! mayAccessPage('edit', $request->getArg('pagename'))) {
558 $text = HTML::span( empty($linktext) ? $wikiword : $linktext);
559 $text->setAttr('class', empty($linktext) ? 'wikiunknown' : 'named-wikiunknown');
562 $url = WikiURL($wikiword, array('action' => 'create'));
563 $button = $this->makeButton('?', $url);
564 $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
568 $link = HTML::span();
569 if (!empty($linktext)) {
570 $link->pushContent(HTML::u($linktext));
571 $link->setAttr('class', 'named-wikiunknown');
574 $link->pushContent(HTML::u($this->maybeSplitWikiWord($default_text)));
575 $link->setAttr('class', 'wikiunknown');
577 $link->pushContent($button);
578 if ($request->getPref('googleLink')) {
579 $gbutton = $this->makeButton('G', "http://www.google.com/search?q=$wikiword");
580 $gbutton->addTooltip(sprintf(_("Google:%s"), $wikiword));
581 $link->pushContent($gbutton);
583 if ($request->getArg('frame'))
584 $link->setAttr('target', '_top');
588 function linkBadWikiWord($wikiword, $linktext = '') {
589 global $ErrorManager;
594 elseif (isa($wikiword, 'WikiPageName')) {
595 $text = $wikiword->shortName;
601 if (isa($wikiword, 'WikiPageName'))
602 $message = $wikiword->getWarnings();
604 $message = sprintf(_("'%s': Bad page name"), $wikiword);
605 $ErrorManager->warning($message);
607 return HTML::span(array('class' => 'badwikiword'), $text);
610 ////////////////////////////////////////////////////////////////
614 ////////////////////////////////////////////////////////////////
615 var $_imageAliases = array();
616 var $_imageAlt = array();
620 * (To disable an image, alias the image to <code>false</code>.
622 function addImageAlias ($alias, $image_name) {
623 // fall back to the PhpWiki-supplied image if not found
624 if ($this->_findFile("images/$image_name", true))
625 $this->_imageAliases[$alias] = $image_name;
628 function addImageAlt ($alias, $alt_text) {
629 $this->_imageAlt[$alias] = $alt_text;
631 function getImageAlt ($alias) {
632 return $this->_imageAlt[$alias];
635 function getImageURL ($image) {
636 $aliases = &$this->_imageAliases;
638 if (isset($aliases[$image])) {
639 $image = $aliases[$image];
644 // If not extension, default to .png.
645 if (!preg_match('/\.\w+$/', $image))
648 // FIXME: this should probably be made to fall back
649 // automatically to .gif, .jpg.
650 // Also try .gif before .png if browser doesn't like png.
652 $path = $this->_findData("images/$image", 'missing okay');
653 if (!$path) // search explicit images/ or button/ links also
654 $path = $this->_findData("$image", 'missing okay');
656 if ($this->DUMP_MODE) {
657 if (empty($this->dumped_images)) $this->dumped_images = array();
658 $path = "images/". basename($path);
659 if (!in_array($path,$this->dumped_images)) $this->dumped_images[] = $path;
664 function setLinkIcon($proto, $image = false) {
668 $this->_linkIcons[$proto] = $image;
671 function getLinkIconURL ($proto) {
672 $icons = &$this->_linkIcons;
673 if (!empty($icons[$proto]))
674 return $this->getImageURL($icons[$proto]);
675 elseif (!empty($icons['*']))
676 return $this->getImageURL($icons['*']);
680 var $_linkIcon = 'front'; // or 'after' or 'no'.
681 // maybe also 'spanall': there is a scheme currently in effect with front, which
682 // spans the icon only to the first, to let the next words wrap on line breaks
683 // see stdlib.php:PossiblyGlueIconToText()
684 function getLinkIconAttr () {
685 return $this->_linkIcon;
687 function setLinkIconAttr ($where) {
688 $this->_linkIcon = $where;
691 function addButtonAlias ($text, $alias = false) {
692 $aliases = &$this->_buttonAliases;
695 $aliases = array_merge($aliases, $text);
696 elseif ($alias === false)
697 unset($aliases[$text]);
699 $aliases[$text] = $alias;
702 function getButtonURL ($text) {
703 $aliases = &$this->_buttonAliases;
704 if (isset($aliases[$text]))
705 $text = $aliases[$text];
707 $qtext = urlencode($text);
708 $url = $this->_findButton("$qtext.png");
709 if ($url && strstr($url, '%')) {
710 $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
712 if (!$url) {// Jeff complained about png not supported everywhere. This is not PC
713 $url = $this->_findButton("$qtext.gif");
714 if ($url && strstr($url, '%')) {
715 $url = preg_replace('|([^/]+)$|e', 'urlencode("\\1")', $url);
718 if ($url and $this->DUMP_MODE) {
719 if (empty($this->dumped_buttons)) $this->dumped_buttons = array();
721 if (defined('DATA_PATH'))
722 $file = substr($url,strlen(DATA_PATH)+1);
723 $url = "images/buttons/".basename($file);
724 if (!array_key_exists($text, $this->dumped_buttons))
725 $this->dumped_buttons[$text] = $file;
730 function _findButton ($button_file) {
731 if (empty($this->_button_path))
732 $this->_button_path = $this->_getButtonPath();
734 foreach ($this->_button_path as $dir) {
735 if ($path = $this->_findData("$dir/$button_file", 1))
741 function _getButtonPath () {
742 $button_dir = $this->_findFile("buttons");
743 $path_dir = $this->_path . $button_dir;
744 if (!file_exists($path_dir) || !is_dir($path_dir))
746 $path = array($button_dir);
748 $dir = dir($path_dir);
749 while (($subdir = $dir->read()) !== false) {
750 if ($subdir[0] == '.')
752 if ($subdir == 'CVS')
754 if (is_dir("$path_dir/$subdir"))
755 $path[] = "$button_dir/$subdir";
758 // add default buttons
759 $path[] = "themes/default/buttons";
760 $path_dir = $this->_path . "themes/default/buttons";
761 $dir = dir($path_dir);
762 while (($subdir = $dir->read()) !== false) {
763 if ($subdir[0] == '.')
765 if ($subdir == 'CVS')
767 if (is_dir("$path_dir/$subdir"))
768 $path[] = "themes/default/buttons/$subdir";
775 ////////////////////////////////////////////////////////////////
779 ////////////////////////////////////////////////////////////////
781 function makeButton ($text, $url, $class = false) {
782 // FIXME: don't always try for image button?
784 // Special case: URLs like 'submit:preview' generate form
785 // submission buttons.
786 if (preg_match('/^submit:(.*)$/', $url, $m))
787 return $this->makeSubmitButton($text, $m[1], $class);
789 $imgurl = $this->getButtonURL($text);
791 return new ImageButton($text, $url, $class, $imgurl);
793 return new Button($this->maybeSplitWikiWord($text), $url, $class);
796 function makeSubmitButton ($text, $name, $class = false) {
797 $imgurl = $this->getButtonURL($text);
800 return new SubmitImageButton($text, $name, $class, $imgurl);
802 return new SubmitButton($text, $name, $class);
806 * Make button to perform action.
808 * This constructs a button which performs an action on the
809 * currently selected version of the current page.
810 * (Or anotherpage or version, if you want...)
812 * @param $action string The action to perform (e.g. 'edit', 'lock').
813 * This can also be the name of an "action page" like 'LikePages'.
814 * Alternatively you can give a hash of query args to be applied
817 * @param $label string Textual label for the button. If left empty,
818 * a suitable name will be guessed.
820 * @param $page_or_rev mixed The page to link to. This can be
821 * given as a string (the page name), a WikiDB_Page object, or as
822 * WikiDB_PageRevision object. If given as a WikiDB_PageRevision
823 * object, the button will link to a specific version of the
824 * designated page, otherwise the button links to the most recent
825 * version of the page.
827 * @return object A Button object.
829 function makeActionButton ($action, $label = false, $page_or_rev = false) {
830 extract($this->_get_name_and_rev($page_or_rev));
832 if (is_array($action)) {
834 $action = isset($attr['action']) ? $attr['action'] : 'browse';
837 $attr['action'] = $action;
839 $class = is_safe_action($action) ? 'wikiaction' : 'wikiadmin';
841 $label = $this->_labelForAction($action);
844 $attr['version'] = $version;
846 if ($action == 'browse')
847 unset($attr['action']);
849 return $this->makeButton($label, WikiURL($pagename, $attr), $class);
853 * Make a "button" which links to a wiki-page.
855 * These are really just regular WikiLinks, possibly
856 * disguised (e.g. behind an image button) by the theme.
858 * This method should probably only be used for links
859 * which appear in page navigation bars, or similar places.
861 * Use linkExistingWikiWord, or LinkWikiWord for normal links.
863 * @param $page_or_rev mixed The page to link to. This can be
864 * given as a string (the page name), a WikiDB_Page object, or as
865 * WikiDB_PageRevision object. If given as a WikiDB_PageRevision
866 * object, the button will link to a specific version of the
867 * designated page, otherwise the button links to the most recent
868 * version of the page.
870 * @return object A Button object.
872 function makeLinkButton ($page_or_rev, $label = false, $action = false) {
873 extract($this->_get_name_and_rev($page_or_rev));
875 $args = $version ? array('version' => $version) : false;
876 if ($action) $args['action'] = $action;
878 return $this->makeButton($label ? $label : $pagename,
879 WikiURL($pagename, $args), 'wiki');
882 function _get_name_and_rev ($page_or_rev) {
885 if (empty($page_or_rev)) {
887 $pagename = $request->getArg("pagename");
888 $version = $request->getArg("version");
890 elseif (is_object($page_or_rev)) {
891 if (isa($page_or_rev, 'WikiDB_PageRevision')) {
893 $page = $rev->getPage();
894 if (!$rev->isCurrent()) $version = $rev->getVersion();
897 $page = $page_or_rev;
899 $pagename = $page->getName();
902 $pagename = (string) $page_or_rev;
904 return compact('pagename', 'version');
907 function _labelForAction ($action) {
909 case 'edit': return _("Edit");
910 case 'diff': return _("Diff");
911 case 'logout': return _("Sign Out");
912 case 'login': return _("Sign In");
913 case 'lock': return _("Lock Page");
914 case 'unlock': return _("Unlock Page");
915 case 'remove': return _("Remove Page");
917 // I don't think the rest of these actually get used.
919 // 'upload' 'dumpserial' 'loadfile' 'zip'
921 return gettext(ucfirst($action));
925 //----------------------------------------------------------------
926 var $_buttonSeparator = "\n | ";
928 function setButtonSeparator($separator) {
929 $this->_buttonSeparator = $separator;
932 function getButtonSeparator() {
933 return $this->_buttonSeparator;
937 ////////////////////////////////////////////////////////////////
943 // Based on testing with Galeon 1.2.7 (Mozilla 1.2):
944 // Automatic media-based style selection (via <link> tags) only
945 // seems to work for the default style, not for alternate styles.
949 // <link rel="stylesheet" type="text/css" href="phpwiki.css" />
950 // <link rel="stylesheet" type="text/css" href="phpwiki-printer.css" media="print" />
952 // works to make it so that the printer style sheet get used
953 // automatically when printing (or print-previewing) a page
954 // (but when only when the default style is selected.)
958 // <link rel="alternate stylesheet" title="Modern"
959 // type="text/css" href="phpwiki-modern.css" />
960 // <link rel="alternate stylesheet" title="Modern"
961 // type="text/css" href="phpwiki-printer.css" media="print" />
963 // Result in two "Modern" choices when trying to select alternate style.
964 // If one selects the first of those choices, one gets phpwiki-modern
965 // both when browsing and printing. If one selects the second "Modern",
966 // one gets no CSS when browsing, and phpwiki-printer when printing.
971 // We should probably move to doing the media based style
972 // switching in the CSS files themselves using, e.g.:
974 // @import url(print.css) print;
976 ////////////////////////////////////////////////////////////////
978 function _CSSlink($title, $css_file, $media, $is_alt = false) {
979 // Don't set title on default style. This makes it clear to
980 // the user which is the default (i.e. most supported) style.
981 if ($is_alt and isBrowserKonqueror())
983 $link = HTML::link(array('rel' => $is_alt ? 'alternate stylesheet' : 'stylesheet',
984 'type' => 'text/css',
985 'charset' => $GLOBALS['charset'],
986 'href' => $this->_findData($css_file)));
988 $link->setAttr('title', $title);
991 $link->setAttr('media', $media);
992 if ($this->DUMP_MODE) {
993 if (empty($this->dumped_css)) $this->dumped_css = array();
994 if (!in_array($css_file,$this->dumped_css)) $this->dumped_css[] = $css_file;
995 $link->setAttr('href', basename($link->getAttr('href')));
1001 /** Set default CSS source for this theme.
1003 * To set styles to be used for different media, pass a
1004 * hash for the second argument, e.g.
1006 * $theme->setDefaultCSS('default', array('' => 'normal.css',
1007 * 'print' => 'printer.css'));
1009 * If you call this more than once, the last one called takes
1010 * precedence as the default style.
1012 * @param string $title Name of style (currently ignored, unless
1013 * you call this more than once, in which case, some of the style
1014 * will become alternate (rather than default) styles, and then their
1015 * titles will be used.
1017 * @param mixed $css_files Name of CSS file, or hash containing a mapping
1018 * between media types and CSS file names. Use a key of '' (the empty string)
1019 * to set the default CSS for non-specified media. (See above for an example.)
1021 function setDefaultCSS ($title, $css_files) {
1022 if (!is_array($css_files))
1023 $css_files = array('' => $css_files);
1024 // Add to the front of $this->_css
1025 unset($this->_css[$title]);
1026 $this->_css = array_merge(array($title => $css_files), $this->_css);
1029 /** Set alternate CSS source for this theme.
1031 * @param string $title Name of style.
1032 * @param string $css_files Name of CSS file.
1034 function addAlternateCSS ($title, $css_files) {
1035 if (!is_array($css_files))
1036 $css_files = array('' => $css_files);
1037 $this->_css[$title] = $css_files;
1041 * @return string HTML for CSS.
1043 function getCSS () {
1046 foreach ($this->_css as $title => $css_files) {
1047 ksort($css_files); // move $css_files[''] to front.
1048 foreach ($css_files as $media => $css_file) {
1049 $css[] = $this->_CSSlink($title, $css_file, $media, $is_alt);
1058 function findTemplate ($name) {
1059 if ($tmp = $this->_findFile("templates/$name.tmpl", 1))
1060 return $this->_path . $tmp;
1062 $f1 = $this->file("templates/$name.tmpl");
1063 trigger_error("pwd: ".getcwd(), E_USER_ERROR);
1064 if (isset($this->_default_theme)) {
1065 $f2 = $this->_default_theme->file("templates/$name.tmpl");
1066 trigger_error("$f1 nor $f2 found", E_USER_ERROR);
1068 trigger_error("$f1 not found", E_USER_ERROR);
1073 var $_MoreHeaders = array();
1074 function addMoreHeaders ($element) {
1075 array_push($this->_MoreHeaders,$element);
1077 function getMoreHeaders () {
1078 if (empty($this->_MoreHeaders))
1081 //$out = "<!-- More Headers -->\n";
1082 foreach ($this->_MoreHeaders as $h) {
1084 $out .= printXML($h);
1091 var $_MoreAttr = array();
1092 function addMoreAttr ($id, $element) {
1093 // protect from duplicate attr (body jscript: themes, prefs, ...)
1094 static $_attr_cache = array();
1095 $hash = md5($id."/".$element);
1096 if (!empty($_attr_cache[$hash])) return;
1097 $_attr_cache[$hash] = 1;
1099 if (empty($this->_MoreAttr) or !is_array($this->_MoreAttr[$id]))
1100 $this->_MoreAttr[$id] = array($element);
1102 array_push($this->_MoreAttr[$id],$element);
1104 function getMoreAttr ($id) {
1105 if (empty($this->_MoreAttr[$id]))
1108 foreach ($this->_MoreAttr[$id] as $h) {
1110 $out .= printXML($h);
1118 * Custom UserPreferences:
1119 * A list of name => _UserPreference class pairs.
1120 * Rationale: Certain themes should be able to extend the predefined list
1121 * of preferences. Display/editing is done in the theme specific userprefs.tmpl
1122 * but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
1123 * These values are just ignored if another theme is used.
1125 function customUserPreferences($array) {
1126 global $customUserPreferenceColumns; // FIXME: really a global?
1127 if (empty($customUserPreferenceColumns)) $customUserPreferenceColumns = array();
1128 //array('wikilens' => new _UserPreference_wikilens());
1129 foreach ($array as $field => $prefobj) {
1130 $customUserPreferenceColumns[$field] = $prefobj;
1134 /** addPageListColumn(array('rating' => new _PageList_Column_rating('rating', _("Rate"))))
1135 * Register custom PageList types for special themes, like
1136 * 'rating' for wikilens
1138 function addPageListColumn ($array) {
1139 global $customPageListColumns;
1140 if (empty($customPageListColumns)) $customPageListColumns = array();
1141 foreach ($array as $column => $obj) {
1142 $customPageListColumns[$column] = $obj;
1146 // Works only on action=browse. Patch #970004 by pixels
1147 // Usage: call $WikiTheme->initDoubleClickEdit() from theme init or
1148 // define ENABLE_DOUBLECLICKEDIT
1149 function initDoubleClickEdit() {
1150 $this->addMoreAttr('body', HTML::Raw(" ondblclick=\"url = document.URL; url2 = url; if (url.indexOf('?') != -1) url2 = url.slice(0, url.indexOf('?')); if ((url.indexOf('action') == -1) || (url.indexOf('action=browse') != -1)) document.location = url2 + '?action=edit';\""));
1156 * A class representing a clickable "button".
1158 * In it's simplest (default) form, a "button" is just a link associated
1159 * with some sort of wiki-action.
1161 class Button extends HtmlElement {
1164 * @param $text string The text for the button.
1165 * @param $url string The url (href) for the button.
1166 * @param $class string The CSS class for the button.
1168 function Button ($text, $url, $class = false) {
1171 if (check_php_version(5)) {
1172 $this->_init('a', array('href' => $url));
1174 $this->__construct('a', array('href' => $url));
1177 $this->setAttr('class', $class);
1178 if ($request->getArg('frame'))
1179 $this->setAttr('target', '_top');
1180 $this->pushContent($GLOBALS['WikiTheme']->maybeSplitWikiWord($text));
1187 * A clickable image button.
1189 class ImageButton extends Button {
1192 * @param $text string The text for the button.
1193 * @param $url string The url (href) for the button.
1194 * @param $class string The CSS class for the button.
1195 * @param $img_url string URL for button's image.
1196 * @param $img_attr array Additional attributes for the <img> tag.
1198 function ImageButton ($text, $url, $class, $img_url, $img_attr = false) {
1199 $this->__construct('a', array('href' => $url));
1201 $this->setAttr('class', $class);
1203 if (!is_array($img_attr))
1204 $img_attr = array();
1205 $img_attr['src'] = $img_url;
1206 $img_attr['alt'] = $text;
1207 $img_attr['class'] = 'wiki-button';
1208 $img_attr['border'] = 0;
1209 $this->pushContent(HTML::img($img_attr));
1214 * A class representing a form <samp>submit</samp> button.
1216 class SubmitButton extends HtmlElement {
1219 * @param $text string The text for the button.
1220 * @param $name string The name of the form field.
1221 * @param $class string The CSS class for the button.
1223 function SubmitButton ($text, $name = false, $class = false) {
1224 $this->__construct('input', array('type' => 'submit',
1227 $this->setAttr('name', $name);
1229 $this->setAttr('class', $class);
1236 * A class representing an image form <samp>submit</samp> button.
1238 class SubmitImageButton extends SubmitButton {
1241 * @param $text string The text for the button.
1242 * @param $name string The name of the form field.
1243 * @param $class string The CSS class for the button.
1244 * @param $img_url string URL for button's image.
1245 * @param $img_attr array Additional attributes for the <img> tag.
1247 function SubmitImageButton ($text, $name = false, $class = false, $img_url) {
1248 $this->__construct('input', array('type' => 'image',
1253 $this->setAttr('name', $name);
1255 $this->setAttr('class', $class);
1261 * A sidebar box with title and body, narrow fixed-width.
1262 * To represent abbrevated content of plugins, links or forms,
1263 * like "Getting Started", "Search", "Sarch Pagename",
1264 * "Login", "Menu", "Recent Changes", "Last comments", "Last Blogs"
1266 * ... See http://tikiwiki.org/
1270 * $menu = SidebarBox("Menu",HTML::dl(HTML::dt(...))); $menu->format();
1271 * $menu = PluginSidebarBox("RecentChanges",array('limit'=>10)); $menu->format();
1275 function SidebarBox($title, $body) {
1276 $this->title = $title;
1277 $this->body = $body;
1280 return WikiPlugin::makeBox($this->title, $this->body);
1285 * A sidebar box for plugins.
1286 * Any plugin may provide a box($args=false, $request=false, $basepage=false)
1287 * method, with the help of WikiPlugin::makeBox()
1289 class PluginSidebarBox extends SidebarBox {
1291 var $_plugin, $_args = false, $_basepage = false;
1293 function PluginSidebarBox($name, $args = false, $basepage = false) {
1294 $loader = new WikiPluginLoader();
1295 $plugin = $loader->getPlugin($name);
1296 if (!method_exists($plugin,'box')) {
1297 return $loader->error(sprintf(_("%s: has no box method"),
1298 get_class($plugin)));
1300 $this->_plugin =& $plugin;
1301 $this->_args = $args ? $args : array();
1302 $this->_basepage = $basepage;
1305 function format($args = false) {
1306 return $this->_plugin->box($args ? array_merge($this->_args,$args) : $this->_args,
1307 $GLOBALS['request'],
1312 // Various boxes which are no plugins
1313 class RelatedLinksBox extends SidebarBox {
1314 function RelatedLinksBox($title = false, $body = '', $limit = 20) {
1316 $this->title = $title ? $title : _("Related Links");
1317 $this->body = HTML($body);
1318 $page = $request->getPage($request->getArg('pagename'));
1319 $revision = $page->getCurrentRevision();
1320 $page_content = $revision->getTransformedContent();
1321 //$cache = &$page->_wikidb->_cache;
1323 $sp = HTML::Raw('· ');
1324 foreach ($page_content->getWikiPageLinks() as $link) {
1325 if (!$request->_dbi->isWikiPage($link)) continue;
1326 $this->body->pushContent($sp, WikiLink($link), HTML::br());
1328 if ($limit and $counter > $limit) continue;
1333 class RelatedExternalLinksBox extends SidebarBox {
1334 function RelatedExternalLinksBox($title = false, $body = '', $limit = 20) {
1336 $this->title = $title ? $title : _("External Links");
1337 $this->body = HTML($body);
1338 $page = $request->getPage($request->getArg('pagename'));
1339 $cache = &$page->_wikidb->_cache;
1341 $sp = HTML::Raw('· ');
1342 foreach ($cache->getWikiPageLinks() as $link) {
1344 $this->body->pushContent($sp, WikiLink($link), HTML::br());
1346 if ($limit and $counter > $limit) continue;
1352 function listAvailableThemes() {
1353 $available_themes = array();
1354 $dir_root = 'themes';
1355 if (defined('PHPWIKI_DIR'))
1356 $dir_root = PHPWIKI_DIR . "/$dir_root";
1357 $dir = dir($dir_root);
1359 while($entry = $dir->read()) {
1360 if (is_dir($dir_root.'/'.$entry)
1361 && (substr($entry,0,1) != '.')
1362 && $entry != 'CVS') {
1363 array_push($available_themes, $entry);
1368 return $available_themes;
1371 function listAvailableLanguages() {
1372 $available_languages = array('en');
1373 $dir_root = 'locale';
1374 if (defined('PHPWIKI_DIR'))
1375 $dir_root = PHPWIKI_DIR . "/$dir_root";
1376 if ($dir = dir($dir_root)) {
1377 while($entry = $dir->read()) {
1378 if (is_dir($dir_root."/".$entry)
1379 && (substr($entry,0,1) != '.')
1383 array_push($available_languages, $entry);
1388 return $available_languages;
1391 // $Log: not supported by cvs2svn $
1392 // Revision 1.115 2004/11/17 17:24:02 rurban
1393 // more verbose on fatal template not found
1395 // Revision 1.114 2004/11/11 18:31:26 rurban
1396 // add simple backtrace on such general failures to get at least an idea where
1398 // Revision 1.113 2004/11/09 17:11:04 rurban
1399 // * revert to the wikidb ref passing. there's no memory abuse there.
1400 // * use new wikidb->_cache->_id_cache[] instead of wikidb->_iwpcache, to effectively
1401 // store page ids with getPageLinks (GleanDescription) of all existing pages, which
1402 // are also needed at the rendering for linkExistingWikiWord().
1403 // pass options to pageiterator.
1404 // use this cache also for _get_pageid()
1405 // This saves about 8 SELECT count per page (num all pagelinks).
1406 // * fix passing of all page fields to the pageiterator.
1407 // * fix overlarge session data which got broken with the latest ACCESS_LOG_SQL changes
1409 // Revision 1.112 2004/11/03 16:50:31 rurban
1410 // some new defaults and constants, renamed USE_DOUBLECLICKEDIT to ENABLE_DOUBLECLICKEDIT
1412 // Revision 1.111 2004/10/21 20:20:53 rurban
1413 // From patch #970004 "Double clic to edit" by pixels.
1415 // Revision 1.110 2004/10/15 11:05:10 rurban
1416 // fix yesterdays premature dumphtml fix for $default_text (thanks John Shen)
1418 // Revision 1.109 2004/10/14 21:06:02 rurban
1419 // fix dumphtml with USE_PATH_INFO (again). fix some PageList refs
1421 // Revision 1.108 2004/09/26 12:24:02 rurban
1422 // no anchor (PCRE memory), explicit ^ instead
1424 // Revision 1.107 2004/06/21 16:22:29 rurban
1425 // add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1426 // fixed dumping buttons locally (images/buttons/),
1427 // support pages arg for dumphtml,
1428 // optional directory arg for dumpserial + dumphtml,
1429 // fix a AllPages warning,
1430 // show dump warnings/errors on DEBUG,
1431 // don't warn just ignore on wikilens pagelist columns, if not loaded.
1432 // RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1434 // Revision 1.106 2004/06/20 14:42:54 rurban
1435 // various php5 fixes (still broken at blockparser)
1437 // Revision 1.105 2004/06/14 11:31:36 rurban
1438 // renamed global $Theme to $WikiTheme (gforge nameclash)
1439 // inherit PageList default options from PageList
1440 // default sortby=pagename
1441 // use options in PageList_Selectable (limit, sortby, ...)
1442 // added action revert, with button at action=diff
1443 // added option regex to WikiAdminSearchReplace
1445 // Revision 1.104 2004/06/11 09:07:30 rurban
1446 // support theme-specific LinkIconAttr: front or after or none
1448 // Revision 1.103 2004/06/07 22:44:14 rurban
1449 // added simplified chown, setacl actions
1451 // Revision 1.102 2004/06/07 18:59:28 rurban
1452 // added Chown link to Owner in statusbar
1454 // Revision 1.101 2004/06/03 12:59:40 rurban
1455 // simplify translation
1456 // NS4 wrap=virtual only
1458 // Revision 1.100 2004/06/03 10:18:19 rurban
1459 // fix FileUser locking issues, new config ENABLE_PAGEPERM
1461 // Revision 1.99 2004/06/01 15:27:59 rurban
1462 // AdminUser only ADMIN_USER not member of Administrators
1463 // some RateIt improvements by dfrankow
1464 // edit_toolbar buttons
1466 // Revision 1.98 2004/05/27 17:49:05 rurban
1467 // renamed DB_Session to DbSession (in CVS also)
1468 // added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals
1469 // remove leading slash in error message
1470 // added force_unlock parameter to File_Passwd (no return on stale locks)
1471 // fixed adodb session AffectedRows
1472 // added FileFinder helpers to unify local filenames and DATA_PATH names
1473 // editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR
1475 // Revision 1.97 2004/05/18 16:23:39 rurban
1476 // rename split_pagename to SplitPagename
1478 // Revision 1.96 2004/05/13 13:48:34 rurban
1479 // doc update for the new 1.3.10 release
1481 // Revision 1.94 2004/05/13 11:52:34 rurban
1482 // search also default buttons
1484 // Revision 1.93 2004/05/12 10:49:55 rurban
1485 // require_once fix for those libs which are loaded before FileFinder and
1486 // its automatic include_path fix, and where require_once doesn't grok
1487 // dirname(__FILE__) != './lib'
1488 // upgrade fix with PearDB
1489 // navbar.tmpl: remove spaces for IE button alignment
1491 // Revision 1.92 2004/05/03 21:57:47 rurban
1492 // locale updates: we previously lost some words because of wrong strings in
1493 // PhotoAlbum, german rewording.
1494 // fixed $_SESSION registering (lost session vars, esp. prefs)
1495 // fixed ending slash in listAvailableLanguages/Themes
1497 // Revision 1.91 2004/05/03 11:40:42 rurban
1498 // put listAvailableLanguages() and listAvailableThemes() from SystemInfo and
1499 // UserPreferences into Themes.php
1501 // Revision 1.90 2004/05/02 19:12:14 rurban
1502 // fix sf.net bug #945154 Konqueror alt css
1504 // Revision 1.89 2004/04/29 21:25:45 rurban
1505 // default theme navbar consistency: linkButtons instead of action buttons
1506 // 3rd makeLinkButtin arg for action support
1508 // Revision 1.88 2004/04/19 18:27:45 rurban
1509 // Prevent from some PHP5 warnings (ref args, no :: object init)
1510 // php5 runs now through, just one wrong XmlElement object init missing
1511 // Removed unneccesary UpgradeUser lines
1512 // Changed WikiLink to omit version if current (RecentChanges)
1514 // Revision 1.87 2004/04/19 09:13:23 rurban
1515 // new pref: googleLink
1517 // Revision 1.86 2004/04/18 01:11:51 rurban
1518 // more numeric pagename fixes.
1519 // fixed action=upload with merge conflict warnings.
1520 // charset changed from constant to global (dynamic utf-8 switching)
1522 // Revision 1.85 2004/04/12 13:04:50 rurban
1523 // added auth_create: self-registering Db users
1525 // removed rating recommendations
1526 // ziplib reformatting
1528 // Revision 1.84 2004/04/10 02:30:49 rurban
1529 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
1530 // Fixed "cannot setlocale..." (sf.net problem)
1532 // Revision 1.83 2004/04/09 17:49:03 rurban
1533 // Added PhpWiki RssFeed to Sidebar
1534 // sidebar formatting
1535 // some browser dependant fixes (old-browser support)
1537 // Revision 1.82 2004/04/06 20:00:10 rurban
1538 // Cleanup of special PageList column types
1539 // Added support of plugin and theme specific Pagelist Types
1540 // Added support for theme specific UserPreferences
1541 // Added session support for ip-based throttling
1542 // sql table schema change: ALTER TABLE session ADD sess_ip CHAR(15);
1543 // Enhanced postgres schema
1544 // Added DB_Session_dba support
1546 // Revision 1.81 2004/04/01 15:57:10 rurban
1547 // simplified Sidebar theme: table, not absolute css positioning
1548 // added the new box methods.
1549 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1551 // Revision 1.80 2004/03/30 02:14:03 rurban
1552 // fixed yet another Prefs bug
1553 // added generic PearDb_iter
1554 // $request->appendValidators no so strict as before
1555 // added some box plugin methods
1556 // PageList commalist for condensed output
1558 // Revision 1.79 2004/03/24 19:39:02 rurban
1559 // php5 workaround code (plus some interim debugging code in XmlElement)
1560 // php5 doesn't work yet with the current XmlElement class constructors,
1561 // WikiUserNew does work better than php4.
1562 // rewrote WikiUserNew user upgrading to ease php5 update
1563 // fixed pref handling in WikiUserNew
1564 // added Email Notification
1565 // added simple Email verification
1566 // removed emailVerify userpref subclass: just a email property
1567 // changed pref binary storage layout: numarray => hash of non default values
1568 // print optimize message only if really done.
1569 // forced new cookie policy: delete pref cookies, use only WIKI_ID as plain string.
1570 // prefs should be stored in db or homepage, besides the current session.
1572 // Revision 1.78 2004/03/18 22:32:33 rurban
1573 // work to make it php5 compatible
1575 // Revision 1.77 2004/03/08 19:30:01 rurban
1576 // fixed Theme->getButtonURL
1577 // AllUsers uses now WikiGroup (also DB User and DB Pref users)
1578 // PageList fix for empty pagenames
1580 // Revision 1.76 2004/03/08 18:17:09 rurban
1581 // added more WikiGroup::getMembersOf methods, esp. for special groups
1582 // fixed $LDAP_SET_OPTIONS
1583 // fixed _AuthInfo group methods
1585 // Revision 1.75 2004/03/01 09:34:37 rurban
1586 // fixed button path logic: now fallback to default also
1588 // Revision 1.74 2004/02/28 21:14:08 rurban
1589 // generally more PHPDOC docs
1590 // see http://xarch.tu-graz.ac.at/home/rurban/phpwiki/xref/
1591 // fxied WikiUserNew pref handling: empty theme not stored, save only
1592 // changed prefs, sql prefs improved, fixed password update,
1593 // removed REPLACE sql (dangerous)
1594 // moved gettext init after the locale was guessed
1595 // + some minor changes
1597 // Revision 1.73 2004/02/26 03:22:05 rurban
1598 // also copy css and images with XHTML Dump
1600 // Revision 1.72 2004/02/26 02:25:53 rurban
1601 // fix empty and #-anchored links in XHTML Dumps
1603 // Revision 1.71 2004/02/15 21:34:37 rurban
1604 // PageList enhanced and improved.
1605 // fixed new WikiAdmin... plugins
1606 // editpage, Theme with exp. htmlarea framework
1607 // (htmlarea yet committed, this is really questionable)
1608 // WikiUser... code with better session handling for prefs
1609 // enhanced UserPreferences (again)
1610 // RecentChanges for show_deleted: how should pages be deleted then?
1612 // Revision 1.70 2004/01/26 09:17:48 rurban
1613 // * changed stored pref representation as before.
1614 // the array of objects is 1) bigger and 2)
1615 // less portable. If we would import packed pref
1616 // objects and the object definition was changed, PHP would fail.
1617 // This doesn't happen with an simple array of non-default values.
1618 // * use $prefs->retrieve and $prefs->store methods, where retrieve
1619 // understands the interim format of array of objects also.
1620 // * simplified $prefs->get() and fixed $prefs->set()
1621 // * added $user->_userid and class '_WikiUser' portability functions
1622 // * fixed $user object ->_level upgrading, mostly using sessions.
1623 // this fixes yesterdays problems with loosing authorization level.
1624 // * fixed WikiUserNew::checkPass to return the _level
1625 // * fixed WikiUserNew::isSignedIn
1626 // * added explodePageList to class PageList, support sortby arg
1627 // * fixed UserPreferences for WikiUserNew
1628 // * fixed WikiPlugin for empty defaults array
1629 // * UnfoldSubpages: added pagename arg, renamed pages arg,
1630 // removed sort arg, support sortby arg
1632 // Revision 1.69 2003/12/05 01:32:28 carstenklapp
1633 // New feature: Easier to run multiple wiks off of one set of code. Name
1634 // your logo and signature image files "YourWikiNameLogo.png" and
1635 // "YourWikiNameSignature.png" and put them all into
1636 // themes/default/images. YourWikiName should match what is defined as
1637 // WIKI_NAME in index.php. In case the image is not found, the default
1638 // shipped with PhpWiki will be used.
1640 // Revision 1.68 2003/03/04 01:53:30 dairiki
1641 // Inconsequential decrufting.
1643 // Revision 1.67 2003/02/26 03:40:22 dairiki
1644 // New action=create. Essentially the same as action=edit, except that if the
1645 // page already exists, it falls back to action=browse.
1647 // This is for use in the "question mark" links for unknown wiki words
1648 // to avoid problems and confusion when following links from stale pages.
1649 // (If the "unknown page" has been created in the interim, the user probably
1650 // wants to view the page before editing it.)
1652 // Revision 1.66 2003/02/26 00:10:26 dairiki
1653 // More/better/different checks for bad page names.
1655 // Revision 1.65 2003/02/24 22:41:57 dairiki
1658 // Revision 1.64 2003/02/24 22:06:14 dairiki
1659 // Attempts to fix auto-selection of printer CSS when printing.
1660 // See new comments lib/Theme.php for more details.
1661 // Also see SF patch #669563.
1663 // Revision 1.63 2003/02/23 03:37:05 dairiki
1664 // Stupid typo/bug fix.
1666 // Revision 1.62 2003/02/21 04:14:52 dairiki
1667 // New WikiLink type 'if_known'. This gives linkified name if page
1668 // exists, otherwise, just plain text.
1670 // Revision 1.61 2003/02/18 21:52:05 dairiki
1671 // Fix so that one can still link to wiki pages with # in their names.
1672 // (This was made difficult by the introduction of named tags, since
1673 // '[Page #1]' is now a link to anchor '1' in page 'Page'.
1675 // Now the ~ escape for page names should work: [Page ~#1].
1677 // Revision 1.60 2003/02/15 01:59:47 dairiki
1678 // Theme::getCSS(): Add Default-Style HTTP(-eqiv) header in attempt
1679 // to fix default stylesheet selection on some browsers.
1680 // For details on the Default-Style header, see:
1681 // http://home.dairiki.org/docs/html4/present/styles.html#h-14.3.2
1683 // Revision 1.59 2003/01/04 22:30:16 carstenklapp
1684 // New: display a "Never edited." message instead of an invalid epoch date.
1687 // (c-file-style: "gnu")
1691 // c-basic-offset: 4
1692 // c-hanging-comment-ender-p: nil
1693 // indent-tabs-mode: nil