]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/RecentChanges.php
Fixes invalid HTML generated by PageHistory plugin.
[SourceForge/phpwiki.git] / lib / plugin / RecentChanges.php
1 <?php // -*-php-*-
2 rcs_id('$Id: RecentChanges.php,v 1.76 2003-02-27 22:48:44 dairiki Exp $');
3 /**
4  Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
5
6  This file is part of PhpWiki.
7
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.
12
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.
17
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
21  */
22
23 /**
24  */
25 class _RecentChanges_Formatter
26 {
27     var $_absurls = false;
28
29     function _RecentChanges_Formatter ($rc_args) {
30         $this->_args = $rc_args;
31         $this->_diffargs = array('action' => 'diff');
32
33         if ($rc_args['show_minor'] || !$rc_args['show_major'])
34             $this->_diffargs['previous'] = 'minor';
35
36         // PageHistoryPlugin doesn't have a 'daylist' arg.
37         if (!isset($this->_args['daylist']))
38             $this->_args['daylist'] = false;
39     }
40
41     function include_versions_in_URLs() {
42         return (bool) $this->_args['show_all'];
43     }
44
45     function date ($rev) {
46         global $Theme;
47         return $Theme->getDay($rev->get('mtime'));
48     }
49
50     function time ($rev) {
51         global $Theme;
52         return $Theme->formatTime($rev->get('mtime'));
53     }
54
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);
61     }
62
63     function historyURL ($rev) {
64         $page = $rev->getPage();
65         return WikiURL($page, array('action' => _("PageHistory")),
66                        $this->_absurls);
67     }
68
69     function pageURL ($rev) {
70         return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
71                        '', $this->_absurls);
72     }
73
74     function authorHasPage ($author) {
75         global $WikiNameRegexp, $request;
76         $dbi = $request->getDbh();
77         return preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author);
78     }
79
80     function authorURL ($author) {
81         return $this->authorHasPage() ? WikiURL($author) : false;
82     }
83
84
85     function status ($rev) {
86         if ($rev->hasDefaultContents())
87             return 'deleted';
88         $page = $rev->getPage();
89         $prev = $page->getRevisionBefore($rev->getVersion());
90         if ($prev->hasDefaultContents())
91             return 'new';
92         return 'updated';
93     }
94
95     function importance ($rev) {
96         return $rev->get('is_minor_edit') ? 'minor' : 'major';
97     }
98
99     function summary($rev) {
100         if ( ($summary = $rev->get('summary')) )
101             return $summary;
102
103         switch ($this->status($rev)) {
104             case 'deleted':
105                 return _("Deleted.");
106             case 'new':
107                 return _("New page.");
108             default:
109                 return '';
110         }
111     }
112
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'));
118         global $request;
119         $request->appendValidators($validators);
120     }
121 }
122
123 class _RecentChanges_HtmlFormatter
124 extends _RecentChanges_Formatter
125 {
126     function diffLink ($rev) {
127         global $Theme;
128         return $Theme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action');
129     }
130
131     function historyLink ($rev) {
132         global $Theme;
133         return $Theme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action');
134     }
135
136     function pageLink ($rev, $link_text=false) {
137         $page = $rev->getPage();
138         global $Theme;
139         if ($this->include_versions_in_URLs()) {
140             $version = $rev->getVersion();
141             $exists = !$rev->hasDefaultContents();
142         }
143         else {
144             $version = false;
145             $cur = $page->getCurrentRevision();
146             $exists = !$cur->hasDefaultContents();
147         }
148         if ($exists)
149             return $Theme->linkExistingWikiWord($page->getName(), $link_text, $version);
150         else
151             return $Theme->linkUnknownWikiWord($page->getName(), $link_text);
152     }
153
154     function authorLink ($rev) {
155         $author = $rev->get('author');
156         if ( $this->authorHasPage($author) ) {
157             return WikiLink($author);
158         } else
159             return $author;
160     }
161
162     function summaryAsHTML ($rev) {
163         if ( !($summary = $this->summary($rev)) )
164             return '';
165         return  HTML::strong( array('class' => 'wiki-summary'),
166                               "[",
167                               TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
168                               "]");
169     }
170
171     function rss_icon () {
172         global $request, $Theme;
173
174         $rss_url = $request->getURLtoSelf(array('format' => 'rss'));
175         return $Theme->makeButton("RSS", $rss_url, 'rssicon');
176     }
177
178     function description () {
179         extract($this->_args);
180         // FIXME: say something about show_all.
181         if ($show_major && $show_minor)
182             $edits = _("edits");
183         elseif ($show_major)
184             $edits = _("major edits");
185         else
186             $edits = _("minor edits");
187
188         if ($timespan = $days > 0) {
189             if (intval($days) != $days)
190                 $days = sprintf("%.1f", $days);
191         }
192         $lmt = abs($limit);
193         /**
194          * Depending how this text is split up it can be tricky or
195          * impossible to translate with good grammar. So the seperate
196          * strings for 1 day and %s days are necessary in this case
197          * for translating to multiple languages, due to differing
198          * overlapping ideal word cutting points.
199          *
200          * en: day/days "The %d most recent %s [during (the past] day) are listed below."
201          * de: 1 Tag    "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
202          * de: %s days  "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
203          *
204          * en: day/days "The %d most recent %s during [the past] (day) are listed below."
205          * fr: 1 jour   "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont énumérées ci-dessous."
206          * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont énumérées ci-dessous."
207          */
208         if ($limit > 0) {
209             if ($timespan) {
210                 if (intval($days) == 1)
211                     $desc = fmt("The %d most recent %s during the past day are listed below.",
212                                 $limit, $edits);
213                 else
214                     $desc = fmt("The %d most recent %s during the past %s days are listed below.",
215                                 $limit, $edits, $days);
216             } else
217                 $desc = fmt("The %d most recent %s are listed below.",
218                             $limit, $edits);
219         }
220         elseif ($limit < 0) {  //$limit < 0 means we want oldest pages
221             if ($timespan) {
222                 if (intval($days) == 1)
223                     $desc = fmt("The %d oldest %s during the past day are listed below.",
224                                 $lmt, $edits);
225                 else
226                     $desc = fmt("The %d oldest %s during the past %s days are listed below.",
227                                 $lmt, $edits, $days);
228             } else
229                 $desc = fmt("The %d oldest %s are listed below.",
230                             $lmt, $edits);
231         }
232
233         else {
234             if ($timespan) {
235                 if (intval($days) == 1)
236                     $desc = fmt("The most recent %s during the past day are listed below.",
237                                 $edits);
238                 else
239                     $desc = fmt("The most recent %s during the past %s days are listed below.",
240                                 $edits, $days);
241             } else
242                 $desc = fmt("All %s are listed below.", $edits);
243         }
244         return HTML::p(false, $desc);
245     }
246
247
248     function title () {
249         extract($this->_args);
250         return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
251                      ' ',
252                      $this->rss_icon(),
253                      $this->sidebar_link());
254     }
255
256     function empty_message () {
257         return _("No changes found");
258     }
259     
260         
261     function sidebar_link() {
262         extract($this->_args);
263         $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
264
265         global $request;
266         $sidebarurl = WikiURL($pagetitle, false, 'absurl') . "?format=sidebar";
267
268         $addsidebarjsfunc =
269             "function addPanel() {\n"
270             ."    window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
271             ."       \"$sidebarurl\",\"\");\n"
272             ."}\n";
273         $jsf = JavaScript($addsidebarjsfunc);
274
275         $addsidebarjsclick = " " . "<small style=\"font-weight:normal;\"><a href=\"javascript:addPanel();\">sidebar</a></small>";
276         $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
277                                 ."    (typeof window.sidebar.addPanel == 'function'))\n"
278                                 ."   {\n"
279                                 ."       document.write('$addsidebarjsclick');\n"
280                                 ."   }\n"
281                                 );
282         return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
283     }
284
285     function format ($changes) {
286         include_once('lib/InlineParser.php');
287         
288         $html = HTML(HTML::h2(false, $this->title()));
289         if (($desc = $this->description()))
290             $html->pushContent($desc);
291         
292         if ($this->_args['daylist'])
293             $html->pushContent(new DayButtonBar($this->_args));
294
295         $last_date = '';
296         $lines = false;
297         $first = true;
298
299         while ($rev = $changes->next()) {
300             if (($date = $this->date($rev)) != $last_date) {
301                 if ($lines)
302                     $html->pushContent($lines);
303                 $html->pushContent(HTML::h3($date));
304                 $lines = HTML::ul();
305                 $last_date = $date;
306
307             }
308             $lines->pushContent($this->format_revision($rev));
309
310             if ($first)
311                 $this->setValidators($rev);
312             $first = false;
313         }
314         if ($lines)
315             $html->pushContent($lines);
316         if ($first)
317             $html->pushContent(HTML::p(array('class' => 'rc-empty'),
318                                        $this->empty_message()));
319         
320         return $html;
321     }
322
323     function format_revision ($rev) {
324         $args = &$this->_args;
325
326         $class = 'rc-' . $this->importance($rev);
327
328         $time = $this->time($rev);
329         if (! $rev->get('is_minor_edit'))
330             $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
331
332         $line = HTML::li(array('class' => $class));
333
334
335         if ($args['difflinks'])
336             $line->pushContent($this->diffLink($rev), ' ');
337
338         if ($args['historylinks'])
339             $line->pushContent($this->historyLink($rev), ' ');
340
341         $line->pushContent($this->pageLink($rev), ' ',
342                            $time, ' ',
343                            $this->summaryAsHTML($rev),
344                            ' ... ',
345                            $this->authorLink($rev));
346         return $line;
347     }
348 }
349
350
351 class _RecentChanges_SideBarFormatter
352 extends _RecentChanges_HtmlFormatter
353 {
354     function description () {
355         //omit description
356     }
357     function rss_icon () {
358         //omit rssicon
359     }
360     function title () {
361         //title click opens the normal RC or RE page in the main browser frame
362         extract($this->_args);
363         $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
364         $titlelink->setAttr('target', '_content');
365         return HTML($this->logo(), $titlelink);
366     }
367     function logo () {
368         //logo click opens the HomePage in the main browser frame
369         global $Theme;
370         $img = HTML::img(array('src' => $Theme->getImageURL('logo'),
371                                'border' => 0,
372                                'align' => 'right',
373                                'width' => 32
374                                ));
375         $linkurl = WikiLink(HOME_PAGE, false, $img);
376         $linkurl->setAttr('target', '_content');
377         return $linkurl;
378     }
379
380     function authorLink ($rev) {
381         $author = $rev->get('author');
382         if ( $this->authorHasPage($author) ) {
383             $linkurl = WikiLink($author);
384             $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
385             return $linkurl;
386         } else
387             return $author;
388     }
389     function diffLink ($rev) {
390         $linkurl = parent::diffLink($rev);
391         $linkurl->setAttr('target', '_content');
392         return $linkurl;
393     }
394     function historyLink ($rev) {
395         $linkurl = parent::historyLink($rev);
396         $linkurl->setAttr('target', '_content');
397         return $linkurl;
398     }
399     function pageLink ($rev) {
400         $linkurl = parent::pageLink($rev);
401         $linkurl->setAttr('target', '_content');
402         return $linkurl;
403     }
404     // Overriding summaryAsHTML, because there is no way yet to
405     // return summary as transformed text with
406     // links setAttr('target', '_content') in Mozilla sidebar.
407     // So for now don't create clickable links inside summary
408     // in the sidebar, or else they target the sidebar and not the
409     // main content window.
410     function summaryAsHTML ($rev) {
411         if ( !($summary = $this->summary($rev)) )
412             return '';
413         return HTML::strong(array('class' => 'wiki-summary'),
414                                 "[",
415                                 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
416                                 "]");
417     }
418
419
420     function format ($changes) {
421         $this->_args['daylist'] = false; //only 1 day for Mozilla sidebar
422         $html = _RecentChanges_HtmlFormatter::format ($changes);
423         $html = HTML::div(array('class' => 'wikitext'), $html);
424
425         printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", CHARSET);
426         printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
427         printf('  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
428         printf('<html xmlns="http://www.w3.org/1999/xhtml">');
429
430         printf("<head>\n");
431         extract($this->_args);
432         $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
433         printf("<title>" . $title . "</title>\n");
434         global $Theme;
435         $css = $Theme->getCSS();
436         $css->PrintXML();
437         printf("</head>\n");
438
439         printf("<body class=\"sidebar\">\n");
440         $html->PrintXML();
441         printf("\n</body>\n");
442         printf("</html>\n");
443
444         flush();
445
446         global $request;
447         $request->finish(); // cut rest of page processing short
448     }
449 }
450
451
452 class _RecentChanges_RssFormatter
453 extends _RecentChanges_Formatter
454 {
455     var $_absurls = true;
456
457     function time ($rev) {
458         return Iso8601DateTime($rev->get('mtime'));
459     }
460
461     function pageURI ($rev) {
462         return WikiURL($rev, '', 'absurl');
463     }
464
465     function format ($changes) {
466         include_once('lib/RssWriter.php');
467         $rss = new RssWriter;
468
469
470         $rss->channel($this->channel_properties());
471
472         if (($props = $this->image_properties()))
473             $rss->image($props);
474         if (($props = $this->textinput_properties()))
475             $rss->textinput($props);
476
477         $first = true;
478         while ($rev = $changes->next()) {
479             $rss->addItem($this->item_properties($rev),
480                           $this->pageURI($rev));
481             if ($first)
482                 $this->setValidators($rev);
483             $first = false;
484         }
485
486         $rss->finish();
487         printf("\n<!-- Generated by PhpWiki:\n%s-->\n", $GLOBALS['RCS_IDS']);
488
489         // Flush errors in comment, otherwise it's invalid XML.
490         global $ErrorManager;
491         if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
492             printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
493
494         global $request;        // FIXME
495         $request->finish();     // NORETURN!!!!
496     }
497
498     function image_properties () {
499         global $Theme;
500
501         $img_url = SERVER_URL . $Theme->getImageURL('logo');
502         if (!$img_url)
503             return false;
504
505         return array('title' => WIKI_NAME,
506                      'link' => WikiURL(HOME_PAGE, false, 'absurl'),
507                      'url' => $img_url);
508     }
509
510     function textinput_properties () {
511         return array('title' => _("Search"),
512                      'description' => _("Title Search"),
513                      'name' => 's',
514                      'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
515     }
516
517     function channel_properties () {
518         global $request;
519
520         $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
521
522         return array('title' => WIKI_NAME,
523                      'link' => $rc_url,
524                      'description' => _("RecentChanges"),
525                      'dc:date' => Iso8601DateTime(time()));
526
527         /* FIXME: other things one might like in <channel>:
528          * sy:updateFrequency
529          * sy:updatePeriod
530          * sy:updateBase
531          * dc:subject
532          * dc:publisher
533          * dc:language
534          * dc:rights
535          * rss091:language
536          * rss091:managingEditor
537          * rss091:webmaster
538          * rss091:lastBuildDate
539          * rss091:copyright
540          */
541     }
542
543
544
545
546     function item_properties ($rev) {
547         $page = $rev->getPage();
548         $pagename = $page->getName();
549
550         return array( 'title'           => split_pagename($pagename),
551                       'description'     => $this->summary($rev),
552                       'link'            => $this->pageURL($rev),
553                       'dc:date'         => $this->time($rev),
554                       'dc:contributor'  => $rev->get('author'),
555                       'wiki:version'    => $rev->getVersion(),
556                       'wiki:importance' => $this->importance($rev),
557                       'wiki:status'     => $this->status($rev),
558                       'wiki:diff'       => $this->diffURL($rev),
559                       'wiki:history'    => $this->historyURL($rev)
560                       );
561     }
562 }
563
564 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
565 {
566     /** Constructor
567      *
568      * @param $revisions object a WikiDB_PageRevisionIterator.
569      */
570     function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
571         $this->_revisions = $revisions;
572         $this->_check_current_revision = $check_current_revision;
573     }
574
575     function next () {
576         while (($rev = $this->_revisions->next())) {
577             if ($this->_check_current_revision) {
578                 $page = $rev->getPage();
579                 $check_rev = $page->getCurrentRevision();
580             }
581             else {
582                 $check_rev = $rev;
583             }
584             if (! $check_rev->hasDefaultContents())
585                 return $rev;
586         }
587         $this->free();
588         return false;
589     }
590
591     function free () {
592         $this->_revisions->free();
593     }
594 }
595
596 class WikiPlugin_RecentChanges
597 extends WikiPlugin
598 {
599     function getName () {
600         return _("RecentChanges");
601     }
602
603     function getVersion() {
604         return preg_replace("/[Revision: $]/", '',
605                             "\$Revision: 1.76 $");
606     }
607
608     function managesValidators() {
609         // Note that this is a bit of a fig.
610         // We set validators based on the most recently changed page,
611         // but this fails when the most-recent page is deleted.
612         // (Consider that the Last-Modified time will decrease
613         // when this happens.)
614
615         // We might be better off, leaving this as false (and junking
616         // the validator logic above) and just falling back to the
617         // default behavior (handled by WikiPlugin) of just using
618         // the WikiDB global timestamp as the mtime.
619
620         // Nevertheless, for now, I leave this here, mostly as an
621         // example for how to use appendValidators() and managesValidators().
622         
623         return true;
624     }
625             
626     function getDefaultArguments() {
627         return array('days'         => 2,
628                      'show_minor'   => false,
629                      'show_major'   => true,
630                      'show_all'     => false,
631                      'show_deleted' => 'sometimes',
632                      'limit'        => false,
633                      'format'       => false,
634                      'daylist'      => false,
635                      'difflinks'    => true,
636                      'historylinks' => false,
637                      'caption'      => ''
638                      );
639     }
640
641     function getArgs ($argstr, $request, $defaults = false) {
642         $args = WikiPlugin::getArgs($argstr, $request, $defaults);
643
644         $action = $request->getArg('action');
645         if ($action != 'browse' && ! $request->isActionPage($action))
646             $args['format'] = false; // default -> HTML
647
648         if ($args['format'] == 'rss' && empty($args['limit']))
649             $args['limit'] = 15; // Fix default value for RSS.
650
651         if ($args['format'] == 'sidebar' && empty($args['limit']))
652             $args['limit'] = 1; // Fix default value for sidebar.
653
654         return $args;
655     }
656
657     function getMostRecentParams ($args) {
658         extract($args);
659
660         $params = array('include_minor_revisions' => $show_minor,
661                         'exclude_major_revisions' => !$show_major,
662                         'include_all_revisions' => !empty($show_all));
663
664         if ($limit != 0)
665             $params['limit'] = $limit;
666
667         if ($days > 0.0)
668             $params['since'] = time() - 24 * 3600 * $days;
669         elseif ($days < 0.0)
670             $params['since'] = 24 * 3600 * $days - time();
671
672
673         return $params;
674     }
675
676     function getChanges ($dbi, $args) {
677         $changes = $dbi->mostRecent($this->getMostRecentParams($args));
678
679         $show_deleted = $args['show_deleted'];
680         if ($show_deleted == 'sometimes')
681             $show_deleted = $args['show_minor'];
682
683         if (!$show_deleted)
684             $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
685
686         return $changes;
687     }
688
689     function format ($changes, $args) {
690         global $Theme;
691         $format = $args['format'];
692
693         $fmt_class = $Theme->getFormatter('RecentChanges', $format);
694         if (!$fmt_class) {
695             if ($format == 'rss')
696                 $fmt_class = '_RecentChanges_RssFormatter';
697             elseif ($format == 'rss091') {
698                 include_once "lib/RSSWriter091.php";
699                 $fmt_class = '_RecentChanges_RssFormatter091';
700             }
701             elseif ($format == 'sidebar')
702                 $fmt_class = '_RecentChanges_SideBarFormatter';
703             else
704                 $fmt_class = '_RecentChanges_HtmlFormatter';
705         }
706
707         $fmt = new $fmt_class($args);
708         return $fmt->format($changes);
709     }
710
711     function run ($dbi, $argstr, $request) {
712         $args = $this->getArgs($argstr, $request);
713
714         // HACKish: fix for SF bug #622784  (1000 years of RecentChanges ought
715         // to be enough for anyone.)
716         $args['days'] = min($args['days'], 365000);
717         
718         // Hack alert: format() is a NORETURN for rss formatters.
719         return $this->format($this->getChanges($dbi, $args), $args);
720     }
721 };
722
723
724 class DayButtonBar extends HtmlElement {
725
726     function DayButtonBar ($plugin_args) {
727         $this->HtmlElement('p', array('class' => 'wiki-rc-action'));
728
729         // Display days selection buttons
730         extract($plugin_args);
731
732         // Custom caption
733         if (! $caption) {
734             if ($show_minor)
735                 $caption = _("Show minor edits for:");
736             elseif ($show_all)
737                 $caption = _("Show all changes for:");
738             else
739                 $caption = _("Show changes for:");
740         }
741
742         $this->pushContent($caption, ' ');
743
744         global $Theme;
745         $sep = $Theme->getButtonSeparator();
746
747         $n = 0;
748         foreach (explode(",", $daylist) as $days) {
749             if ($n++)
750                 $this->pushContent($sep);
751             $this->pushContent($this->_makeDayButton($days));
752         }
753     }
754
755     function _makeDayButton ($days) {
756         global $Theme, $request;
757
758         if ($days == 1)
759             $label = _("1 day");
760         elseif ($days < 1)
761             $label = "..."; //alldays
762         else
763             $label = sprintf(_("%s days"), abs($days));
764
765         $url = $request->getURLtoSelf(array('action' => 'browse', 'days' => $days));
766
767         return $Theme->makeButton($label, $url, 'wiki-rc-action');
768     }
769 }
770
771 // $Log: not supported by cvs2svn $
772 // Revision 1.75  2003/02/22 21:39:05  dairiki
773 // Hackish fix for SF bug #622784.
774 //
775 // (The root of the problem is clearly a PHP bug.)
776 //
777 // Revision 1.74  2003/02/21 22:52:21  dairiki
778 // Make sure to interpret relative links (like [/Subpage]) in summary
779 // relative to correct basepage.
780 //
781 // Revision 1.73  2003/02/21 04:12:06  dairiki
782 // Minor fixes for new cached markup.
783 //
784 // Revision 1.72  2003/02/17 02:19:01  dairiki
785 // Fix so that PageHistory will work when the current revision
786 // of a page has been "deleted".
787 //
788 // Revision 1.71  2003/02/16 20:04:48  dairiki
789 // Refactor the HTTP validator generation/checking code.
790 //
791 // This also fixes a number of bugs with yesterdays validator mods.
792 //
793 // Revision 1.70  2003/02/16 05:09:43  dairiki
794 // Starting to fix handling of the HTTP validator headers, Last-Modified,
795 // and ETag.
796 //
797 // Last-Modified was being set incorrectly (but only when DEBUG was not
798 // defined!)  Setting a Last-Modified without setting an appropriate
799 // Expires: and/or Cache-Control: header results in browsers caching
800 // the page unconditionally (for a certain period of time).
801 // This is generally bad, since it means people don't see updated
802 // page contents right away --- this is particularly confusing to
803 // the people who are editing pages since their edits don't show up
804 // next time they browse the page.
805 //
806 // Now, we don't allow caching of pages without revalidation
807 // (via the If-Modified-Since and/or If-None-Match request headers.)
808 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
809 // appropriate value in index.php, but I advise against it.)
810 //
811 // Problems:
812 //
813 //   o Even when request is aborted due to the content not being
814 //     modified, we currently still do almost all the work involved
815 //     in producing the page.  So the only real savings from all
816 //     this logic is in network bandwidth.
817 //
818 //   o Plugins which produce "dynamic" output need to be inspected
819 //     and made to call $request->addToETag() and
820 //     $request->setModificationTime() appropriately, otherwise the
821 //     page can change without the change being detected.
822 //     This leads to stale pages in cache again...
823 //
824 // Revision 1.69  2003/01/18 22:01:43  carstenklapp
825 // Code cleanup:
826 // Reformatting & tabs to spaces;
827 // Added copyleft, getVersion, getDescription, rcs_id.
828 //
829
830 // (c-file-style: "gnu")
831 // Local Variables:
832 // mode: php
833 // tab-width: 8
834 // c-basic-offset: 4
835 // c-hanging-comment-ender-p: nil
836 // indent-tabs-mode: nil
837 // End:
838 ?>