2 rcs_id('$Id: RecentChanges.php,v 1.103 2004-12-15 17:45:09 rurban Exp $');
4 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
6 This file is part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 class _RecentChanges_Formatter
27 var $_absurls = false;
29 function _RecentChanges_Formatter ($rc_args) {
30 $this->_args = $rc_args;
31 $this->_diffargs = array('action' => 'diff');
33 if ($rc_args['show_minor'] || !$rc_args['show_major'])
34 $this->_diffargs['previous'] = 'minor';
36 // PageHistoryPlugin doesn't have a 'daylist' arg.
37 if (!isset($this->_args['daylist']))
38 $this->_args['daylist'] = false;
41 function include_versions_in_URLs() {
42 return (bool) $this->_args['show_all'];
45 function date ($rev) {
47 return $WikiTheme->getDay($rev->get('mtime'));
50 function time ($rev) {
52 return $WikiTheme->formatTime($rev->get('mtime'));
55 function diffURL ($rev) {
56 $args = $this->_diffargs;
57 if ($this->include_versions_in_URLs())
58 $args['version'] = $rev->getVersion();
59 $page = $rev->getPage();
60 return WikiURL($page->getName(), $args, $this->_absurls);
63 function historyURL ($rev) {
64 $page = $rev->getPage();
65 return WikiURL($page, array('action' => _("PageHistory")),
69 function pageURL ($rev) {
70 return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
74 function authorHasPage ($author) {
75 global $WikiNameRegexp, $request;
76 $dbi = $request->getDbh();
77 return isWikiWord($author) && $dbi->isWikiPage($author);
80 function authorURL ($author) {
81 return $this->authorHasPage() ? WikiURL($author) : false;
85 function status ($rev) {
86 if ($rev->hasDefaultContents())
88 $page = $rev->getPage();
89 $prev = $page->getRevisionBefore($rev->getVersion());
90 if ($prev->hasDefaultContents())
95 function importance ($rev) {
96 return $rev->get('is_minor_edit') ? 'minor' : 'major';
99 function summary($rev) {
100 if ( ($summary = $rev->get('summary')) )
103 switch ($this->status($rev)) {
107 return _("New page");
113 function setValidators($most_recent_rev) {
114 $rev = $most_recent_rev;
115 $validators = array('RecentChanges-top' =>
116 array($rev->getPageName(), $rev->getVersion()),
117 '%mtime' => $rev->get('mtime'));
119 $request->appendValidators($validators);
123 class _RecentChanges_HtmlFormatter
124 extends _RecentChanges_Formatter
126 function diffLink ($rev) {
128 return $WikiTheme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action');
131 function historyLink ($rev) {
133 return $WikiTheme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action');
136 function pageLink ($rev, $link_text=false) {
138 return WikiLink($rev,'auto',$link_text);
140 $page = $rev->getPage();
142 if ($this->include_versions_in_URLs()) {
143 $version = $rev->getVersion();
144 if ($rev->isCurrent())
146 $exists = !$rev->hasDefaultContents();
150 $cur = $page->getCurrentRevision();
151 $exists = !$cur->hasDefaultContents();
154 return $WikiTheme->linkExistingWikiWord($page->getName(), $link_text, $version);
156 return $WikiTheme->linkUnknownWikiWord($page->getName(), $link_text);
160 function authorLink ($rev) {
161 $author = $rev->get('author');
162 if ( $this->authorHasPage($author) ) {
163 return WikiLink($author);
168 function summaryAsHTML ($rev) {
169 if ( !($summary = $this->summary($rev)) )
171 return HTML::strong( array('class' => 'wiki-summary'),
173 TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
177 function rss_icon () {
178 global $request, $WikiTheme;
180 $rss_url = $request->getURLtoSelf(array('format' => 'rss'));
181 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
182 $WikiTheme->makeButton("RSS", $rss_url, 'rssicon'));
184 function rss2_icon () {
185 global $request, $WikiTheme;
187 $rss_url = $request->getURLtoSelf(array('format' => 'rss2'));
188 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
189 $WikiTheme->makeButton("RSS2", $rss_url, 'rssicon'));
192 function description () {
193 extract($this->_args);
194 // FIXME: say something about show_all.
195 if ($show_major && $show_minor)
198 $edits = _("major edits");
200 $edits = _("minor edits");
201 if (isset($caption) and $caption == _("Recent Comments"))
202 $edits = _("comments");
204 if ($timespan = $days > 0) {
205 if (intval($days) != $days)
206 $days = sprintf("%.1f", $days);
210 * Depending how this text is split up it can be tricky or
211 * impossible to translate with good grammar. So the seperate
212 * strings for 1 day and %s days are necessary in this case
213 * for translating to multiple languages, due to differing
214 * overlapping ideal word cutting points.
216 * en: day/days "The %d most recent %s [during (the past] day) are listed below."
217 * de: 1 Tag "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
218 * de: %s days "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
220 * en: day/days "The %d most recent %s during [the past] (day) are listed below."
221 * fr: 1 jour "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont énumérées ci-dessous."
222 * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont énumérées ci-dessous."
226 if (intval($days) == 1)
227 $desc = fmt("The %d most recent %s during the past day are listed below.",
230 $desc = fmt("The %d most recent %s during the past %s days are listed below.",
231 $limit, $edits, $days);
233 $desc = fmt("The %d most recent %s are listed below.",
236 elseif ($limit < 0) { //$limit < 0 means we want oldest pages
238 if (intval($days) == 1)
239 $desc = fmt("The %d oldest %s during the past day are listed below.",
242 $desc = fmt("The %d oldest %s during the past %s days are listed below.",
243 $lmt, $edits, $days);
245 $desc = fmt("The %d oldest %s are listed below.",
251 if (intval($days) == 1)
252 $desc = fmt("The most recent %s during the past day are listed below.",
255 $desc = fmt("The most recent %s during the past %s days are listed below.",
258 $desc = fmt("All %s are listed below.", $edits);
260 if (isset($this->_args['page'])) // RelatedChanges
261 return HTML::p(false, $desc, HTML::br(), fmt("(to pages linked from \"%s\")",$this->_args['page']));
262 return HTML::p(false, $desc);
267 extract($this->_args);
268 return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
270 $this->rss_icon(), HTML::raw(' '), $this->rss2_icon(),
271 $this->sidebar_link());
274 function empty_message () {
275 if (isset($this->_args['caption']) and $this->_args['caption'] == _("Recent Comments"))
276 return _("No comments found");
278 return _("No changes found");
281 function sidebar_link() {
282 extract($this->_args);
283 $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
286 $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
289 "function addPanel() {\n"
290 ." window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
291 ." \"$sidebarurl\",\"\");\n"
293 $jsf = JavaScript($addsidebarjsfunc);
296 $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
297 $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
298 $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
299 ." (typeof window.sidebar.addPanel == 'function'))\n"
301 ." document.write('$addsidebarjsclick');\n"
304 return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
307 function format ($changes) {
308 include_once('lib/InlineParser.php');
310 $html = HTML(HTML::h2(false, $this->title()));
311 if (($desc = $this->description()))
312 $html->pushContent($desc);
314 if ($this->_args['daylist'])
315 $html->pushContent(new DayButtonBar($this->_args));
321 while ($rev = $changes->next()) {
322 if (($date = $this->date($rev)) != $last_date) {
324 $html->pushContent($lines);
325 $html->pushContent(HTML::h3($date));
330 // enforce view permission
331 if (mayAccessPage('view', $rev->_pagename)) {
332 $lines->pushContent($this->format_revision($rev));
335 $this->setValidators($rev);
340 $html->pushContent($lines);
342 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
343 $this->empty_message()));
348 function format_revision ($rev) {
349 $args = &$this->_args;
351 $class = 'rc-' . $this->importance($rev);
353 $time = $this->time($rev);
354 if (! $rev->get('is_minor_edit'))
355 $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
357 $line = HTML::li(array('class' => $class));
360 if ($args['difflinks'])
361 $line->pushContent($this->diffLink($rev), ' ');
363 if ($args['historylinks'])
364 $line->pushContent($this->historyLink($rev), ' ');
366 $line->pushContent($this->pageLink($rev), ' ',
368 $this->summaryAsHTML($rev),
370 $this->authorLink($rev));
376 class _RecentChanges_SideBarFormatter
377 extends _RecentChanges_HtmlFormatter
379 function rss_icon () {
382 function rss2_icon () { }
384 //title click opens the normal RC or RE page in the main browser frame
385 extract($this->_args);
386 $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
387 $titlelink->setAttr('target', '_content');
388 return HTML($this->logo(), $titlelink);
391 //logo click opens the HomePage in the main browser frame
393 $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'),
396 'style' => 'height:2.5ex'
398 $linkurl = WikiLink(HOME_PAGE, false, $img);
399 $linkurl->setAttr('target', '_content');
403 function authorLink ($rev) {
404 $author = $rev->get('author');
405 if ( $this->authorHasPage($author) ) {
406 $linkurl = WikiLink($author);
407 $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
413 function diffLink ($rev) {
414 $linkurl = parent::diffLink($rev);
415 $linkurl->setAttr('target', '_content');
416 // FIXME: Smelly hack to get smaller diff buttons in sidebar
417 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
420 function historyLink ($rev) {
421 $linkurl = parent::historyLink($rev);
422 $linkurl->setAttr('target', '_content');
423 // FIXME: Smelly hack to get smaller history buttons in sidebar
424 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
427 function pageLink ($rev) {
428 $linkurl = parent::pageLink($rev);
429 $linkurl->setAttr('target', '_content');
432 // Overriding summaryAsHTML, because there is no way yet to
433 // return summary as transformed text with
434 // links setAttr('target', '_content') in Mozilla sidebar.
435 // So for now don't create clickable links inside summary
436 // in the sidebar, or else they target the sidebar and not the
437 // main content window.
438 function summaryAsHTML ($rev) {
439 if ( !($summary = $this->summary($rev)) )
441 return HTML::strong(array('class' => 'wiki-summary'),
443 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
448 function format ($changes) {
449 $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
450 $html = _RecentChanges_HtmlFormatter::format ($changes);
451 $html = HTML::div(array('class' => 'wikitext'), $html);
453 $request->discardOutput();
455 printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", $GLOBALS['charset']);
456 printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
457 printf(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
458 printf('<html xmlns="http://www.w3.org/1999/xhtml">');
461 extract($this->_args);
462 $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
463 printf("<title>" . $title . "</title>\n");
465 $css = $WikiTheme->getCSS();
469 printf("<body class=\"sidebar\">\n");
471 echo '<a href="http://www.feedvalidator.org/check.cgi?url=http://phpwiki.org/RecentChanges?format=rss"><img src="themes/default/buttons/valid-rss.png" alt="[Valid RSS]" title="Validate the RSS feed" width="44" height="15" /></a>';
472 printf("\n</body>\n");
475 $request->finish(); // cut rest of page processing short
479 class _RecentChanges_BoxFormatter
480 extends _RecentChanges_HtmlFormatter
482 function rss_icon () {
484 function rss2_icon () {
488 function authorLink ($rev) {
490 function diffLink ($rev) {
492 function historyLink ($rev) {
494 function summaryAsHTML ($rev) {
496 function description () {
498 function format ($changes) {
499 include_once('lib/InlineParser.php');
504 $sp = HTML::Raw('· ');
505 while ($rev = $changes->next()) {
506 // enforce view permission
507 if (mayAccessPage('view',$rev->_pagename)) {
508 if ($link = $this->pageLink($rev)) // some entries may be empty (/Blog/.. interim pages)
509 $html->pushContent($sp, $link, HTML::br());
511 $this->setValidators($rev);
516 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
517 $this->empty_message()));
522 class _RecentChanges_RssFormatter
523 extends _RecentChanges_Formatter
525 var $_absurls = true;
527 function time ($rev) {
528 return Iso8601DateTime($rev->get('mtime'));
531 function pageURI ($rev) {
532 return WikiURL($rev, '', 'absurl');
535 function format ($changes) {
537 include_once('lib/RssWriter.php');
538 $rss = new RssWriter;
540 $rss->channel($this->channel_properties());
542 if (($props = $this->image_properties()))
544 if (($props = $this->textinput_properties()))
545 $rss->textinput($props);
548 while ($rev = $changes->next()) {
549 // enforce view permission
550 if (mayAccessPage('view', $rev->_pagename)) {
551 $rss->addItem($this->item_properties($rev),
552 $this->pageURI($rev));
554 $this->setValidators($rev);
560 $request->discardOutput();
562 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
564 // Flush errors in comment, otherwise it's invalid XML.
565 global $ErrorManager;
566 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
567 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
569 $request->finish(); // NORETURN!!!!
572 function image_properties () {
575 $img_url = AbsoluteURL($WikiTheme->getImageURL('logo'));
579 return array('title' => WIKI_NAME,
580 'link' => WikiURL(HOME_PAGE, false, 'absurl'),
584 function textinput_properties () {
585 return array('title' => _("Search"),
586 'description' => _("Title Search"),
588 'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
591 function channel_properties () {
594 $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
595 return array('title' => WIKI_NAME,
597 'description' => _("RecentChanges"),
598 'dc:date' => Iso8601DateTime(time()),
599 'dc:language' => $GLOBALS['LANG']);
601 /* FIXME: other things one might like in <channel>:
610 * rss091:managingEditor
612 * rss091:lastBuildDate
617 function item_properties ($rev) {
618 $page = $rev->getPage();
619 $pagename = $page->getName();
621 return array( 'title' => SplitPagename($pagename),
622 'description' => $this->summary($rev),
623 'link' => $this->pageURL($rev),
624 'dc:date' => $this->time($rev),
625 'dc:contributor' => $rev->get('author'),
626 'wiki:version' => $rev->getVersion(),
627 'wiki:importance' => $this->importance($rev),
628 'wiki:status' => $this->status($rev),
629 'wiki:diff' => $this->diffURL($rev),
630 'wiki:history' => $this->historyURL($rev)
635 /** explicit application/rss+xml Content-Type,
636 * simplified xml structure (no namespace),
637 * support for xml-rpc cloud registerProcedure (not yet)
639 class _RecentChanges_Rss2Formatter
640 extends _RecentChanges_RssFormatter {
642 function format ($changes) {
643 include_once('lib/RssWriter2.php');
644 $rss = new RssWriter2;
646 $rss->channel($this->channel_properties());
647 if (($props = $this->cloud_properties()))
649 if (($props = $this->image_properties()))
651 if (($props = $this->textinput_properties()))
652 $rss->textinput($props);
654 while ($rev = $changes->next()) {
655 // enforce view permission
656 if (mayAccessPage('view', $rev->_pagename)) {
657 $rss->addItem($this->item_properties($rev),
658 $this->pageURI($rev));
660 $this->setValidators($rev);
666 $request->discardOutput();
668 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
669 // Flush errors in comment, otherwise it's invalid XML.
670 global $ErrorManager;
671 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
672 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
674 $request->finish(); // NORETURN!!!!
677 function channel_properties () {
678 $chann_10 = parent::channel_properties();
679 return array_merge($chann_10,
680 array('generator' => 'PhpWiki-'.PHPWIKI_VERSION,
681 //<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
682 //<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
683 //<docs>http://blogs.law.harvard.edu/tech/rss</docs>
684 'copyright' => COPYRIGHTPAGE_URL
688 function cloud_properties () { return false; } // xml-rpc registerProcedure not yet implemented
689 function cloud_properties_test () {
690 return array('protocol' => 'xml-rpc', // xml-rpc or soap or http-post
691 'registerProcedure' => 'wiki.rssPleaseNotify',
692 'path' => DATA_PATH.'/RPC2.php',
693 'port' => !SERVER_PORT ? '80' : (SERVER_PROTOCOL == 'https' ? '443' : '80'),
694 'domain' => SERVER_NAME);
698 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
702 * @param $revisions object a WikiDB_PageRevisionIterator.
704 function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
705 $this->_revisions = $revisions;
706 $this->_check_current_revision = $check_current_revision;
710 while (($rev = $this->_revisions->next())) {
711 if ($this->_check_current_revision) {
712 $page = $rev->getPage();
713 $check_rev = $page->getCurrentRevision();
718 if (! $check_rev->hasDefaultContents())
727 class WikiPlugin_RecentChanges
730 function getName () {
731 return _("RecentChanges");
734 function getVersion() {
735 return preg_replace("/[Revision: $]/", '',
736 "\$Revision: 1.103 $");
739 function managesValidators() {
740 // Note that this is a bit of a fig.
741 // We set validators based on the most recently changed page,
742 // but this fails when the most-recent page is deleted.
743 // (Consider that the Last-Modified time will decrease
744 // when this happens.)
746 // We might be better off, leaving this as false (and junking
747 // the validator logic above) and just falling back to the
748 // default behavior (handled by WikiPlugin) of just using
749 // the WikiDB global timestamp as the mtime.
751 // Nevertheless, for now, I leave this here, mostly as an
752 // example for how to use appendValidators() and managesValidators().
757 function getDefaultArguments() {
758 return array('days' => 2,
759 'show_minor' => false,
760 'show_major' => true,
762 'show_deleted' => 'sometimes',
767 'historylinks' => false,
772 function getArgs ($argstr, $request, $defaults = false) {
773 $args = WikiPlugin::getArgs($argstr, $request, $this->getDefaultArguments());
775 $action = $request->getArg('action');
776 if ($action != 'browse' && ! $request->isActionPage($action))
777 $args['format'] = false; // default -> HTML
779 if ($args['format'] == 'rss' && empty($args['limit']))
780 $args['limit'] = 15; // Fix default value for RSS.
781 if ($args['format'] == 'rss2' && empty($args['limit']))
782 $args['limit'] = 15; // Fix default value for RSS2.
784 if ($args['format'] == 'sidebar' && empty($args['limit']))
785 $args['limit'] = 10; // Fix default value for sidebar.
790 function getMostRecentParams ($args) {
793 $params = array('include_minor_revisions' => $show_minor,
794 'exclude_major_revisions' => !$show_major,
795 'include_all_revisions' => !empty($show_all));
797 $params['limit'] = $limit;
800 $params['since'] = time() - 24 * 3600 * $days;
802 $params['since'] = 24 * 3600 * $days - time();
807 function getChanges ($dbi, $args) {
808 $changes = $dbi->mostRecent($this->getMostRecentParams($args));
810 $show_deleted = $args['show_deleted'];
811 if ($show_deleted == 'sometimes')
812 $show_deleted = $args['show_minor'];
815 $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
820 function format ($changes, $args) {
822 $format = $args['format'];
824 $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format);
826 if ($format == 'rss')
827 $fmt_class = '_RecentChanges_RssFormatter';
828 elseif ($format == 'rss2')
829 $fmt_class = '_RecentChanges_Rss2Formatter';
830 elseif ($format == 'rss091') {
831 include_once "lib/RSSWriter091.php";
832 $fmt_class = '_RecentChanges_RssFormatter091';
834 elseif ($format == 'sidebar')
835 $fmt_class = '_RecentChanges_SideBarFormatter';
836 elseif ($format == 'box')
837 $fmt_class = '_RecentChanges_BoxFormatter';
839 $fmt_class = '_RecentChanges_HtmlFormatter';
842 $fmt = new $fmt_class($args);
843 return $fmt->format($changes);
846 function run($dbi, $argstr, &$request, $basepage) {
847 $args = $this->getArgs($argstr, $request);
849 // HACKish: fix for SF bug #622784 (1000 years of RecentChanges ought
850 // to be enough for anyone.)
851 $args['days'] = min($args['days'], 365000);
853 // Hack alert: format() is a NORETURN for rss formatters.
854 return $this->format($this->getChanges($dbi, $args), $args);
857 // box is used to display a fixed-width, narrow version with common header.
858 // just a numbered list of limit pagenames, without date.
859 function box($args = false, $request = false, $basepage = false) {
860 if (!$request) $request =& $GLOBALS['request'];
861 if (!isset($args['limit'])) $args['limit'] = 15;
862 $args['format'] = 'box';
863 $args['show_minor'] = false;
864 $args['show_major'] = true;
865 $args['show_deleted'] = 'sometimes';
866 $args['show_all'] = false;
868 return $this->makeBox(WikiLink($this->getName(),'',SplitPagename($this->getName())),
869 $this->format($this->getChanges($request->_dbi, $args), $args));
875 class DayButtonBar extends HtmlElement {
877 function DayButtonBar ($plugin_args) {
878 $this->__construct('p', array('class' => 'wiki-rc-action'));
880 // Display days selection buttons
881 extract($plugin_args);
886 $caption = _("Show minor edits for:");
888 $caption = _("Show all changes for:");
890 $caption = _("Show changes for:");
893 $this->pushContent($caption, ' ');
896 $sep = $WikiTheme->getButtonSeparator();
899 foreach (explode(",", $daylist) as $days) {
901 $this->pushContent($sep);
902 $this->pushContent($this->_makeDayButton($days));
906 function _makeDayButton ($days) {
907 global $WikiTheme, $request;
912 $label = "..."; //alldays
914 $label = sprintf(_("%s days"), abs($days));
916 $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days));
918 return $WikiTheme->makeButton($label, $url, 'wiki-rc-action');
922 // $Log: not supported by cvs2svn $
923 // Revision 1.102 2004/12/06 19:29:24 rurban
924 // simplify RSS: add RSS2 link (rss tag only, new content-type)
926 // Revision 1.101 2004/11/10 19:32:24 rurban
927 // * optimize increaseHitCount, esp. for mysql.
928 // * prepend dirs to the include_path (phpwiki_dir for faster searches)
929 // * Pear_DB version logic (awful but needed)
930 // * fix broken ADODB quote
931 // * _extract_page_data simplification
933 // Revision 1.100 2004/06/28 16:35:12 rurban
934 // prevent from shell commands
936 // Revision 1.99 2004/06/20 14:42:54 rurban
937 // various php5 fixes (still broken at blockparser)
939 // Revision 1.98 2004/06/14 11:31:39 rurban
940 // renamed global $Theme to $WikiTheme (gforge nameclash)
941 // inherit PageList default options from PageList
942 // default sortby=pagename
943 // use options in PageList_Selectable (limit, sortby, ...)
944 // added action revert, with button at action=diff
945 // added option regex to WikiAdminSearchReplace
947 // Revision 1.97 2004/06/03 18:58:27 rurban
948 // days links requires action=RelatedChanges arg
950 // Revision 1.96 2004/05/18 16:23:40 rurban
951 // rename split_pagename to SplitPagename
953 // Revision 1.95 2004/05/16 22:07:35 rurban
954 // check more config-default and predefined constants
955 // various PagePerm fixes:
956 // fix default PagePerms, esp. edit and view for Bogo and Password users
957 // implemented Creator and Owner
958 // BOGOUSERS renamed to BOGOUSER
959 // fixed syntax errors in signin.tmpl
961 // Revision 1.94 2004/05/14 20:55:03 rurban
962 // simplified RecentComments
964 // Revision 1.93 2004/05/14 17:33:07 rurban
965 // new plugin RecentChanges
967 // Revision 1.92 2004/04/21 04:29:10 rurban
968 // Two convenient RecentChanges extensions
969 // RelatedChanges (only links from current page)
970 // RecentEdits (just change the default args)
972 // Revision 1.91 2004/04/19 18:27:46 rurban
973 // Prevent from some PHP5 warnings (ref args, no :: object init)
974 // php5 runs now through, just one wrong XmlElement object init missing
975 // Removed unneccesary UpgradeUser lines
976 // Changed WikiLink to omit version if current (RecentChanges)
978 // Revision 1.90 2004/04/18 01:11:52 rurban
979 // more numeric pagename fixes.
980 // fixed action=upload with merge conflict warnings.
981 // charset changed from constant to global (dynamic utf-8 switching)
983 // Revision 1.89 2004/04/10 02:30:49 rurban
984 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
985 // Fixed "cannot setlocale..." (sf.net problem)
987 // Revision 1.88 2004/04/01 15:57:10 rurban
988 // simplified Sidebar theme: table, not absolute css positioning
989 // added the new box methods.
990 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
992 // Revision 1.87 2004/03/30 02:14:03 rurban
993 // fixed yet another Prefs bug
994 // added generic PearDb_iter
995 // $request->appendValidators no so strict as before
996 // added some box plugin methods
997 // PageList commalist for condensed output
999 // Revision 1.86 2004/03/12 13:31:43 rurban
1000 // enforce PagePermissions, errormsg if not Admin
1002 // Revision 1.85 2004/02/17 12:11:36 rurban
1003 // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...)
1005 // Revision 1.84 2004/02/15 22:29:42 rurban
1006 // revert premature performance fix
1008 // Revision 1.83 2004/02/15 21:34:37 rurban
1009 // PageList enhanced and improved.
1010 // fixed new WikiAdmin... plugins
1011 // editpage, Theme with exp. htmlarea framework
1012 // (htmlarea yet committed, this is really questionable)
1013 // WikiUser... code with better session handling for prefs
1014 // enhanced UserPreferences (again)
1015 // RecentChanges for show_deleted: how should pages be deleted then?
1017 // Revision 1.82 2004/01/25 03:58:43 rurban
1018 // use stdlib:isWikiWord()
1020 // Revision 1.81 2003/11/28 21:06:31 carstenklapp
1021 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
1022 // instead of 1. Make diff buttons smaller with css. Added description
1023 // line back in at the top.
1025 // Revision 1.80 2003/11/27 15:17:01 carstenklapp
1026 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
1027 // button, to allow an image button for it to be added to Themes. Output
1028 // RSS button in small text size when theme has no button image.
1030 // Revision 1.79 2003/04/29 14:34:20 dairiki
1031 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
1033 // Revision 1.78 2003/03/04 01:55:05 dairiki
1034 // Fix to ensure absolute URL for logo in RSS recent changes.
1036 // Revision 1.77 2003/02/27 23:23:38 dairiki
1037 // Fix my breakage of CSS and sidebar RecentChanges output.
1039 // Revision 1.76 2003/02/27 22:48:44 dairiki
1040 // Fixes invalid HTML generated by PageHistory plugin.
1042 // (<noscript> is block-level and not allowed within <p>.)
1044 // Revision 1.75 2003/02/22 21:39:05 dairiki
1045 // Hackish fix for SF bug #622784.
1047 // (The root of the problem is clearly a PHP bug.)
1049 // Revision 1.74 2003/02/21 22:52:21 dairiki
1050 // Make sure to interpret relative links (like [/Subpage]) in summary
1051 // relative to correct basepage.
1053 // Revision 1.73 2003/02/21 04:12:06 dairiki
1054 // Minor fixes for new cached markup.
1056 // Revision 1.72 2003/02/17 02:19:01 dairiki
1057 // Fix so that PageHistory will work when the current revision
1058 // of a page has been "deleted".
1060 // Revision 1.71 2003/02/16 20:04:48 dairiki
1061 // Refactor the HTTP validator generation/checking code.
1063 // This also fixes a number of bugs with yesterdays validator mods.
1065 // Revision 1.70 2003/02/16 05:09:43 dairiki
1066 // Starting to fix handling of the HTTP validator headers, Last-Modified,
1069 // Last-Modified was being set incorrectly (but only when DEBUG was not
1070 // defined!) Setting a Last-Modified without setting an appropriate
1071 // Expires: and/or Cache-Control: header results in browsers caching
1072 // the page unconditionally (for a certain period of time).
1073 // This is generally bad, since it means people don't see updated
1074 // page contents right away --- this is particularly confusing to
1075 // the people who are editing pages since their edits don't show up
1076 // next time they browse the page.
1078 // Now, we don't allow caching of pages without revalidation
1079 // (via the If-Modified-Since and/or If-None-Match request headers.)
1080 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
1081 // appropriate value in index.php, but I advise against it.)
1085 // o Even when request is aborted due to the content not being
1086 // modified, we currently still do almost all the work involved
1087 // in producing the page. So the only real savings from all
1088 // this logic is in network bandwidth.
1090 // o Plugins which produce "dynamic" output need to be inspected
1091 // and made to call $request->addToETag() and
1092 // $request->setModificationTime() appropriately, otherwise the
1093 // page can change without the change being detected.
1094 // This leads to stale pages in cache again...
1096 // Revision 1.69 2003/01/18 22:01:43 carstenklapp
1098 // Reformatting & tabs to spaces;
1099 // Added copyleft, getVersion, getDescription, rcs_id.
1102 // (c-file-style: "gnu")
1106 // c-basic-offset: 4
1107 // c-hanging-comment-ender-p: nil
1108 // indent-tabs-mode: nil