2 rcs_id('$Id: RecentChanges.php,v 1.105 2005-01-25 03:50:54 uckelman 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 pre_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);
263 function description() {
264 return HTML::p(false, $this->pre_description());
269 extract($this->_args);
270 return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
272 $this->rss_icon(), HTML::raw(' '), $this->rss2_icon(),
273 $this->sidebar_link());
276 function empty_message () {
277 if (isset($this->_args['caption']) and $this->_args['caption'] == _("Recent Comments"))
278 return _("No comments found");
280 return _("No changes found");
283 function sidebar_link() {
284 extract($this->_args);
285 $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
288 $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
291 "function addPanel() {\n"
292 ." window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
293 ." \"$sidebarurl\",\"\");\n"
295 $jsf = JavaScript($addsidebarjsfunc);
298 $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
299 $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
300 $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
301 ." (typeof window.sidebar.addPanel == 'function'))\n"
303 ." document.write('$addsidebarjsclick');\n"
306 return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
309 function format ($changes) {
310 include_once('lib/InlineParser.php');
312 $html = HTML(HTML::h2(false, $this->title()));
313 if (($desc = $this->description()))
314 $html->pushContent($desc);
316 if ($this->_args['daylist'])
317 $html->pushContent(new DayButtonBar($this->_args));
323 while ($rev = $changes->next()) {
324 if (($date = $this->date($rev)) != $last_date) {
326 $html->pushContent($lines);
327 $html->pushContent(HTML::h3($date));
332 // enforce view permission
333 if (mayAccessPage('view', $rev->_pagename)) {
334 $lines->pushContent($this->format_revision($rev));
337 $this->setValidators($rev);
342 $html->pushContent($lines);
344 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
345 $this->empty_message()));
350 function format_revision ($rev) {
351 $args = &$this->_args;
353 $class = 'rc-' . $this->importance($rev);
355 $time = $this->time($rev);
356 if (! $rev->get('is_minor_edit'))
357 $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
359 $line = HTML::li(array('class' => $class));
362 if ($args['difflinks'])
363 $line->pushContent($this->diffLink($rev), ' ');
365 if ($args['historylinks'])
366 $line->pushContent($this->historyLink($rev), ' ');
368 $line->pushContent($this->pageLink($rev), ' ',
370 $this->summaryAsHTML($rev),
372 $this->authorLink($rev));
378 class _RecentChanges_SideBarFormatter
379 extends _RecentChanges_HtmlFormatter
381 function rss_icon () {
384 function rss2_icon () { }
386 //title click opens the normal RC or RE page in the main browser frame
387 extract($this->_args);
388 $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
389 $titlelink->setAttr('target', '_content');
390 return HTML($this->logo(), $titlelink);
393 //logo click opens the HomePage in the main browser frame
395 $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'),
398 'style' => 'height:2.5ex'
400 $linkurl = WikiLink(HOME_PAGE, false, $img);
401 $linkurl->setAttr('target', '_content');
405 function authorLink ($rev) {
406 $author = $rev->get('author');
407 if ( $this->authorHasPage($author) ) {
408 $linkurl = WikiLink($author);
409 $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
415 function diffLink ($rev) {
416 $linkurl = parent::diffLink($rev);
417 $linkurl->setAttr('target', '_content');
418 // FIXME: Smelly hack to get smaller diff buttons in sidebar
419 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
422 function historyLink ($rev) {
423 $linkurl = parent::historyLink($rev);
424 $linkurl->setAttr('target', '_content');
425 // FIXME: Smelly hack to get smaller history buttons in sidebar
426 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
429 function pageLink ($rev) {
430 $linkurl = parent::pageLink($rev);
431 $linkurl->setAttr('target', '_content');
434 // Overriding summaryAsHTML, because there is no way yet to
435 // return summary as transformed text with
436 // links setAttr('target', '_content') in Mozilla sidebar.
437 // So for now don't create clickable links inside summary
438 // in the sidebar, or else they target the sidebar and not the
439 // main content window.
440 function summaryAsHTML ($rev) {
441 if ( !($summary = $this->summary($rev)) )
443 return HTML::strong(array('class' => 'wiki-summary'),
445 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
450 function format ($changes) {
451 $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
452 $html = _RecentChanges_HtmlFormatter::format ($changes);
453 $html = HTML::div(array('class' => 'wikitext'), $html);
455 $request->discardOutput();
457 printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", $GLOBALS['charset']);
458 printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
459 printf(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
460 printf('<html xmlns="http://www.w3.org/1999/xhtml">');
463 extract($this->_args);
464 $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
465 printf("<title>" . $title . "</title>\n");
467 $css = $WikiTheme->getCSS();
471 printf("<body class=\"sidebar\">\n");
473 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>';
474 printf("\n</body>\n");
477 $request->finish(); // cut rest of page processing short
481 class _RecentChanges_BoxFormatter
482 extends _RecentChanges_HtmlFormatter
484 function rss_icon () {
486 function rss2_icon () {
490 function authorLink ($rev) {
492 function diffLink ($rev) {
494 function historyLink ($rev) {
496 function summaryAsHTML ($rev) {
498 function description () {
500 function format ($changes) {
501 include_once('lib/InlineParser.php');
506 $sp = HTML::Raw('· ');
507 while ($rev = $changes->next()) {
508 // enforce view permission
509 if (mayAccessPage('view',$rev->_pagename)) {
510 if ($link = $this->pageLink($rev)) // some entries may be empty (/Blog/.. interim pages)
511 $html->pushContent($sp, $link, HTML::br());
513 $this->setValidators($rev);
518 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
519 $this->empty_message()));
524 class _RecentChanges_RssFormatter
525 extends _RecentChanges_Formatter
527 var $_absurls = true;
529 function time ($rev) {
530 return Iso8601DateTime($rev->get('mtime'));
533 function pageURI ($rev) {
534 return WikiURL($rev, '', 'absurl');
537 function format ($changes) {
539 include_once('lib/RssWriter.php');
540 $rss = new RssWriter;
542 $rss->channel($this->channel_properties());
544 if (($props = $this->image_properties()))
546 if (($props = $this->textinput_properties()))
547 $rss->textinput($props);
550 while ($rev = $changes->next()) {
551 // enforce view permission
552 if (mayAccessPage('view', $rev->_pagename)) {
553 $rss->addItem($this->item_properties($rev),
554 $this->pageURI($rev));
556 $this->setValidators($rev);
562 $request->discardOutput();
564 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
566 // Flush errors in comment, otherwise it's invalid XML.
567 global $ErrorManager;
568 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
569 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
571 $request->finish(); // NORETURN!!!!
574 function image_properties () {
577 $img_url = AbsoluteURL($WikiTheme->getImageURL('logo'));
581 return array('title' => WIKI_NAME,
582 'link' => WikiURL(HOME_PAGE, false, 'absurl'),
586 function textinput_properties () {
587 return array('title' => _("Search"),
588 'description' => _("Title Search"),
590 'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
593 function channel_properties () {
596 $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
597 return array('title' => WIKI_NAME,
599 'description' => _("RecentChanges"),
600 'dc:date' => Iso8601DateTime(time()),
601 'dc:language' => $GLOBALS['LANG']);
603 /* FIXME: other things one might like in <channel>:
612 * rss091:managingEditor
614 * rss091:lastBuildDate
619 function item_properties ($rev) {
620 $page = $rev->getPage();
621 $pagename = $page->getName();
623 return array( 'title' => SplitPagename($pagename),
624 'description' => $this->summary($rev),
625 'link' => $this->pageURL($rev),
626 'dc:date' => $this->time($rev),
627 'dc:contributor' => $rev->get('author'),
628 'wiki:version' => $rev->getVersion(),
629 'wiki:importance' => $this->importance($rev),
630 'wiki:status' => $this->status($rev),
631 'wiki:diff' => $this->diffURL($rev),
632 'wiki:history' => $this->historyURL($rev)
637 /** explicit application/rss+xml Content-Type,
638 * simplified xml structure (no namespace),
639 * support for xml-rpc cloud registerProcedure (not yet)
641 class _RecentChanges_Rss2Formatter
642 extends _RecentChanges_RssFormatter {
644 function format ($changes) {
645 include_once('lib/RssWriter2.php');
646 $rss = new RssWriter2;
648 $rss->channel($this->channel_properties());
649 if (($props = $this->cloud_properties()))
651 if (($props = $this->image_properties()))
653 if (($props = $this->textinput_properties()))
654 $rss->textinput($props);
656 while ($rev = $changes->next()) {
657 // enforce view permission
658 if (mayAccessPage('view', $rev->_pagename)) {
659 $rss->addItem($this->item_properties($rev),
660 $this->pageURI($rev));
662 $this->setValidators($rev);
668 $request->discardOutput();
670 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
671 // Flush errors in comment, otherwise it's invalid XML.
672 global $ErrorManager;
673 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
674 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
676 $request->finish(); // NORETURN!!!!
679 function channel_properties () {
680 $chann_10 = parent::channel_properties();
681 return array_merge($chann_10,
682 array('generator' => 'PhpWiki-'.PHPWIKI_VERSION,
683 //<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
684 //<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
685 //<docs>http://blogs.law.harvard.edu/tech/rss</docs>
686 'copyright' => COPYRIGHTPAGE_URL
690 function cloud_properties () { return false; } // xml-rpc registerProcedure not yet implemented
691 function cloud_properties_test () {
692 return array('protocol' => 'xml-rpc', // xml-rpc or soap or http-post
693 'registerProcedure' => 'wiki.rssPleaseNotify',
694 'path' => DATA_PATH.'/RPC2.php',
695 'port' => !SERVER_PORT ? '80' : (SERVER_PROTOCOL == 'https' ? '443' : '80'),
696 'domain' => SERVER_NAME);
700 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
704 * @param $revisions object a WikiDB_PageRevisionIterator.
706 function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
707 $this->_revisions = $revisions;
708 $this->_check_current_revision = $check_current_revision;
712 while (($rev = $this->_revisions->next())) {
713 if ($this->_check_current_revision) {
714 $page = $rev->getPage();
715 $check_rev = $page->getCurrentRevision();
720 if (! $check_rev->hasDefaultContents())
729 class WikiPlugin_RecentChanges
732 function getName () {
733 return _("RecentChanges");
736 function getVersion() {
737 return preg_replace("/[Revision: $]/", '',
738 "\$Revision: 1.105 $");
741 function managesValidators() {
742 // Note that this is a bit of a fig.
743 // We set validators based on the most recently changed page,
744 // but this fails when the most-recent page is deleted.
745 // (Consider that the Last-Modified time will decrease
746 // when this happens.)
748 // We might be better off, leaving this as false (and junking
749 // the validator logic above) and just falling back to the
750 // default behavior (handled by WikiPlugin) of just using
751 // the WikiDB global timestamp as the mtime.
753 // Nevertheless, for now, I leave this here, mostly as an
754 // example for how to use appendValidators() and managesValidators().
759 function getDefaultArguments() {
760 return array('days' => 2,
761 'show_minor' => false,
762 'show_major' => true,
764 'show_deleted' => 'sometimes',
769 'historylinks' => false,
774 function getArgs ($argstr, $request, $defaults = false) {
775 $args = WikiPlugin::getArgs($argstr, $request, $this->getDefaultArguments());
777 $action = $request->getArg('action');
778 if ($action != 'browse' && ! $request->isActionPage($action))
779 $args['format'] = false; // default -> HTML
781 if ($args['format'] == 'rss' && empty($args['limit']))
782 $args['limit'] = 15; // Fix default value for RSS.
783 if ($args['format'] == 'rss2' && empty($args['limit']))
784 $args['limit'] = 15; // Fix default value for RSS2.
786 if ($args['format'] == 'sidebar' && empty($args['limit']))
787 $args['limit'] = 10; // Fix default value for sidebar.
792 function getMostRecentParams ($args) {
795 $params = array('include_minor_revisions' => $show_minor,
796 'exclude_major_revisions' => !$show_major,
797 'include_all_revisions' => !empty($show_all));
799 $params['limit'] = $limit;
802 $params['since'] = time() - 24 * 3600 * $days;
804 $params['since'] = 24 * 3600 * $days - time();
809 function getChanges ($dbi, $args) {
810 $changes = $dbi->mostRecent($this->getMostRecentParams($args));
812 $show_deleted = $args['show_deleted'];
813 if ($show_deleted == 'sometimes')
814 $show_deleted = $args['show_minor'];
817 $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
822 function format ($changes, $args) {
824 $format = $args['format'];
826 $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format);
828 if ($format == 'rss')
829 $fmt_class = '_RecentChanges_RssFormatter';
830 elseif ($format == 'rss2')
831 $fmt_class = '_RecentChanges_Rss2Formatter';
832 elseif ($format == 'rss091') {
833 include_once "lib/RSSWriter091.php";
834 $fmt_class = '_RecentChanges_RssFormatter091';
836 elseif ($format == 'sidebar')
837 $fmt_class = '_RecentChanges_SideBarFormatter';
838 elseif ($format == 'box')
839 $fmt_class = '_RecentChanges_BoxFormatter';
841 $fmt_class = '_RecentChanges_HtmlFormatter';
844 $fmt = new $fmt_class($args);
845 return $fmt->format($changes);
848 function run($dbi, $argstr, &$request, $basepage) {
849 $args = $this->getArgs($argstr, $request);
851 // HACKish: fix for SF bug #622784 (1000 years of RecentChanges ought
852 // to be enough for anyone.)
853 $args['days'] = min($args['days'], 365000);
855 // Hack alert: format() is a NORETURN for rss formatters.
856 return $this->format($this->getChanges($dbi, $args), $args);
859 // box is used to display a fixed-width, narrow version with common header.
860 // just a numbered list of limit pagenames, without date.
861 function box($args = false, $request = false, $basepage = false) {
862 if (!$request) $request =& $GLOBALS['request'];
863 if (!isset($args['limit'])) $args['limit'] = 15;
864 $args['format'] = 'box';
865 $args['show_minor'] = false;
866 $args['show_major'] = true;
867 $args['show_deleted'] = 'sometimes';
868 $args['show_all'] = false;
870 return $this->makeBox(WikiLink($this->getName(),'',SplitPagename($this->getName())),
871 $this->format($this->getChanges($request->_dbi, $args), $args));
877 class DayButtonBar extends HtmlElement {
879 function DayButtonBar ($plugin_args) {
880 $this->__construct('p', array('class' => 'wiki-rc-action'));
882 // Display days selection buttons
883 extract($plugin_args);
888 $caption = _("Show minor edits for:");
890 $caption = _("Show all changes for:");
892 $caption = _("Show changes for:");
895 $this->pushContent($caption, ' ');
898 $sep = $WikiTheme->getButtonSeparator();
901 foreach (explode(",", $daylist) as $days) {
903 $this->pushContent($sep);
904 $this->pushContent($this->_makeDayButton($days));
908 function _makeDayButton ($days) {
909 global $WikiTheme, $request;
914 $label = "..."; //alldays
916 $label = sprintf(_("%s days"), abs($days));
918 $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days));
920 return $WikiTheme->makeButton($label, $url, 'wiki-rc-action');
924 // $Log: not supported by cvs2svn $
925 // Revision 1.104 2005/01/24 23:15:16 uckelman
926 // The extra description for RelatedChanges was appearing in RecentChanges
927 // and PageHistory due to a bad test in _RecentChanges_HtmlFormatter. Fixed.
929 // Revision 1.103 2004/12/15 17:45:09 rurban
932 // Revision 1.102 2004/12/06 19:29:24 rurban
933 // simplify RSS: add RSS2 link (rss tag only, new content-type)
935 // Revision 1.101 2004/11/10 19:32:24 rurban
936 // * optimize increaseHitCount, esp. for mysql.
937 // * prepend dirs to the include_path (phpwiki_dir for faster searches)
938 // * Pear_DB version logic (awful but needed)
939 // * fix broken ADODB quote
940 // * _extract_page_data simplification
942 // Revision 1.100 2004/06/28 16:35:12 rurban
943 // prevent from shell commands
945 // Revision 1.99 2004/06/20 14:42:54 rurban
946 // various php5 fixes (still broken at blockparser)
948 // Revision 1.98 2004/06/14 11:31:39 rurban
949 // renamed global $Theme to $WikiTheme (gforge nameclash)
950 // inherit PageList default options from PageList
951 // default sortby=pagename
952 // use options in PageList_Selectable (limit, sortby, ...)
953 // added action revert, with button at action=diff
954 // added option regex to WikiAdminSearchReplace
956 // Revision 1.97 2004/06/03 18:58:27 rurban
957 // days links requires action=RelatedChanges arg
959 // Revision 1.96 2004/05/18 16:23:40 rurban
960 // rename split_pagename to SplitPagename
962 // Revision 1.95 2004/05/16 22:07:35 rurban
963 // check more config-default and predefined constants
964 // various PagePerm fixes:
965 // fix default PagePerms, esp. edit and view for Bogo and Password users
966 // implemented Creator and Owner
967 // BOGOUSERS renamed to BOGOUSER
968 // fixed syntax errors in signin.tmpl
970 // Revision 1.94 2004/05/14 20:55:03 rurban
971 // simplified RecentComments
973 // Revision 1.93 2004/05/14 17:33:07 rurban
974 // new plugin RecentChanges
976 // Revision 1.92 2004/04/21 04:29:10 rurban
977 // Two convenient RecentChanges extensions
978 // RelatedChanges (only links from current page)
979 // RecentEdits (just change the default args)
981 // Revision 1.91 2004/04/19 18:27:46 rurban
982 // Prevent from some PHP5 warnings (ref args, no :: object init)
983 // php5 runs now through, just one wrong XmlElement object init missing
984 // Removed unneccesary UpgradeUser lines
985 // Changed WikiLink to omit version if current (RecentChanges)
987 // Revision 1.90 2004/04/18 01:11:52 rurban
988 // more numeric pagename fixes.
989 // fixed action=upload with merge conflict warnings.
990 // charset changed from constant to global (dynamic utf-8 switching)
992 // Revision 1.89 2004/04/10 02:30:49 rurban
993 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
994 // Fixed "cannot setlocale..." (sf.net problem)
996 // Revision 1.88 2004/04/01 15:57:10 rurban
997 // simplified Sidebar theme: table, not absolute css positioning
998 // added the new box methods.
999 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1001 // Revision 1.87 2004/03/30 02:14:03 rurban
1002 // fixed yet another Prefs bug
1003 // added generic PearDb_iter
1004 // $request->appendValidators no so strict as before
1005 // added some box plugin methods
1006 // PageList commalist for condensed output
1008 // Revision 1.86 2004/03/12 13:31:43 rurban
1009 // enforce PagePermissions, errormsg if not Admin
1011 // Revision 1.85 2004/02/17 12:11:36 rurban
1012 // 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, ...)
1014 // Revision 1.84 2004/02/15 22:29:42 rurban
1015 // revert premature performance fix
1017 // Revision 1.83 2004/02/15 21:34:37 rurban
1018 // PageList enhanced and improved.
1019 // fixed new WikiAdmin... plugins
1020 // editpage, Theme with exp. htmlarea framework
1021 // (htmlarea yet committed, this is really questionable)
1022 // WikiUser... code with better session handling for prefs
1023 // enhanced UserPreferences (again)
1024 // RecentChanges for show_deleted: how should pages be deleted then?
1026 // Revision 1.82 2004/01/25 03:58:43 rurban
1027 // use stdlib:isWikiWord()
1029 // Revision 1.81 2003/11/28 21:06:31 carstenklapp
1030 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
1031 // instead of 1. Make diff buttons smaller with css. Added description
1032 // line back in at the top.
1034 // Revision 1.80 2003/11/27 15:17:01 carstenklapp
1035 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
1036 // button, to allow an image button for it to be added to Themes. Output
1037 // RSS button in small text size when theme has no button image.
1039 // Revision 1.79 2003/04/29 14:34:20 dairiki
1040 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
1042 // Revision 1.78 2003/03/04 01:55:05 dairiki
1043 // Fix to ensure absolute URL for logo in RSS recent changes.
1045 // Revision 1.77 2003/02/27 23:23:38 dairiki
1046 // Fix my breakage of CSS and sidebar RecentChanges output.
1048 // Revision 1.76 2003/02/27 22:48:44 dairiki
1049 // Fixes invalid HTML generated by PageHistory plugin.
1051 // (<noscript> is block-level and not allowed within <p>.)
1053 // Revision 1.75 2003/02/22 21:39:05 dairiki
1054 // Hackish fix for SF bug #622784.
1056 // (The root of the problem is clearly a PHP bug.)
1058 // Revision 1.74 2003/02/21 22:52:21 dairiki
1059 // Make sure to interpret relative links (like [/Subpage]) in summary
1060 // relative to correct basepage.
1062 // Revision 1.73 2003/02/21 04:12:06 dairiki
1063 // Minor fixes for new cached markup.
1065 // Revision 1.72 2003/02/17 02:19:01 dairiki
1066 // Fix so that PageHistory will work when the current revision
1067 // of a page has been "deleted".
1069 // Revision 1.71 2003/02/16 20:04:48 dairiki
1070 // Refactor the HTTP validator generation/checking code.
1072 // This also fixes a number of bugs with yesterdays validator mods.
1074 // Revision 1.70 2003/02/16 05:09:43 dairiki
1075 // Starting to fix handling of the HTTP validator headers, Last-Modified,
1078 // Last-Modified was being set incorrectly (but only when DEBUG was not
1079 // defined!) Setting a Last-Modified without setting an appropriate
1080 // Expires: and/or Cache-Control: header results in browsers caching
1081 // the page unconditionally (for a certain period of time).
1082 // This is generally bad, since it means people don't see updated
1083 // page contents right away --- this is particularly confusing to
1084 // the people who are editing pages since their edits don't show up
1085 // next time they browse the page.
1087 // Now, we don't allow caching of pages without revalidation
1088 // (via the If-Modified-Since and/or If-None-Match request headers.)
1089 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
1090 // appropriate value in index.php, but I advise against it.)
1094 // o Even when request is aborted due to the content not being
1095 // modified, we currently still do almost all the work involved
1096 // in producing the page. So the only real savings from all
1097 // this logic is in network bandwidth.
1099 // o Plugins which produce "dynamic" output need to be inspected
1100 // and made to call $request->addToETag() and
1101 // $request->setModificationTime() appropriately, otherwise the
1102 // page can change without the change being detected.
1103 // This leads to stale pages in cache again...
1105 // Revision 1.69 2003/01/18 22:01:43 carstenklapp
1107 // Reformatting & tabs to spaces;
1108 // Added copyleft, getVersion, getDescription, rcs_id.
1111 // (c-file-style: "gnu")
1115 // c-basic-offset: 4
1116 // c-hanging-comment-ender-p: nil
1117 // indent-tabs-mode: nil