]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/RecentChanges.php
add ATOM support, a very questionable format
[SourceForge/phpwiki.git] / lib / plugin / RecentChanges.php
1 <?php // -*-php-*-
2 rcs_id('$Id: RecentChanges.php,v 1.119 2007-07-01 09:17:45 rurban Exp $');
3 /**
4  Copyright 1999,2000,2001,2002,2007 $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 include_once("lib/WikiPlugin.php");
24
25 /**
26  */
27 class _RecentChanges_Formatter
28 {
29     var $_absurls = false;
30
31     function _RecentChanges_Formatter ($rc_args) {
32         $this->_args = $rc_args;
33         $this->_diffargs = array('action' => 'diff');
34
35         if ($rc_args['show_minor'] || !$rc_args['show_major'])
36             $this->_diffargs['previous'] = 'minor';
37
38         // PageHistoryPlugin doesn't have a 'daylist' arg.
39         if (!isset($this->_args['daylist']))
40             $this->_args['daylist'] = false;
41     }
42
43     function include_versions_in_URLs() {
44         return (bool) $this->_args['show_all'];
45     }
46
47     function date ($rev) {
48         global $WikiTheme;
49         return $WikiTheme->getDay($rev->get('mtime'));
50     }
51
52     function time ($rev) {
53         global $WikiTheme;
54         return $WikiTheme->formatTime($rev->get('mtime'));
55     }
56
57     function diffURL ($rev) {
58         $args = $this->_diffargs;
59         if ($this->include_versions_in_URLs())
60             $args['version'] = $rev->getVersion();
61         $page = $rev->getPage();
62         return WikiURL($page->getName(), $args, $this->_absurls);
63     }
64
65     function historyURL ($rev) {
66         $page = $rev->getPage();
67         return WikiURL($page, array('action' => _("PageHistory")),
68                        $this->_absurls);
69     }
70
71     function pageURL ($rev) {
72         return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
73                        '', $this->_absurls);
74     }
75
76     function authorHasPage ($author) {
77         global $WikiNameRegexp, $request;
78         $dbi = $request->getDbh();
79         return isWikiWord($author) && $dbi->isWikiPage($author);
80     }
81
82     function authorURL ($author) {
83         return $this->authorHasPage() ? WikiURL($author) : false;
84     }
85
86
87     function status ($rev) {
88         if ($rev->hasDefaultContents())
89             return 'deleted';
90         $page = $rev->getPage();
91         $prev = $page->getRevisionBefore($rev->getVersion());
92         if ($prev->hasDefaultContents())
93             return 'new';
94         return 'updated';
95     }
96
97     function importance ($rev) {
98         return $rev->get('is_minor_edit') ? 'minor' : 'major';
99     }
100
101     function summary($rev) {
102         if ( ($summary = $rev->get('summary')) )
103             return $summary;
104
105         switch ($this->status($rev)) {
106             case 'deleted':
107                 return _("Deleted");
108             case 'new':
109                 return _("New page");
110             default:
111                 return '';
112         }
113     }
114
115     function setValidators($most_recent_rev) {
116         $rev = $most_recent_rev;
117         $validators = array('RecentChanges-top' =>
118                             array($rev->getPageName(), $rev->getVersion()),
119                             '%mtime' => $rev->get('mtime'));
120         global $request;
121         $request->appendValidators($validators);
122     }
123 }
124
125 class _RecentChanges_HtmlFormatter
126 extends _RecentChanges_Formatter
127 {
128     function diffLink ($rev) {
129         global $WikiTheme;
130         $button = $WikiTheme->makeButton(_("diff"), $this->diffURL($rev), 'wiki-rc-action');
131         $button->setAttr('rel', 'nofollow');
132         return HTML("(",$button,")");
133     }
134
135     /* deletions: red, additions: green */
136     function diffSummary ($rev) {
137         $html = $this->diffURL($rev);
138         return '';
139     }
140
141     function historyLink ($rev) {
142         global $WikiTheme;
143         $button = $WikiTheme->makeButton(_("hist"), $this->historyURL($rev), 'wiki-rc-action');
144         $button->setAttr('rel', 'nofollow');
145         return HTML("(",$button,")");
146     }
147
148     function pageLink ($rev, $link_text=false) {
149
150         return WikiLink($this->include_versions_in_URLs() ? $rev : $rev->getPage(),'auto',$link_text);
151         /*
152         $page = $rev->getPage();
153         global $WikiTheme;
154         if ($this->include_versions_in_URLs()) {
155             $version = $rev->getVersion();
156             if ($rev->isCurrent())
157                 $version = false;
158             $exists = !$rev->hasDefaultContents();
159         }
160         else {
161             $version = false;
162             $cur = $page->getCurrentRevision();
163             $exists = !$cur->hasDefaultContents();
164         }
165         if ($exists)
166             return $WikiTheme->linkExistingWikiWord($page->getName(), $link_text, $version);
167         else
168             return $WikiTheme->linkUnknownWikiWord($page->getName(), $link_text);
169         */
170     }
171
172     function authorLink ($rev) {
173         return WikiLink($rev->get('author'), 'if_known');
174     }
175
176     /* Link to all users contributions (contribs and owns) */
177     function authorContribs ($rev) {
178         $author = $rev->get('author');
179         if (preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $author)) return '';
180         return HTML('(',
181                     Button(array('action' => _("RecentChanges"), 
182                                  'format' => 'contribs',
183                                  'author' => $author,
184                                  'days' => 360),
185                            _("contribs"),
186                            $author),
187                     ' | ',
188                     Button(array('action' => _("RecentChanges"), 
189                                  'format' => 'contribs',
190                                  'owner' => $author,
191                                  'days' => 360),
192                            _("new pages"),
193                            $author),
194                     ')');
195     }
196
197     function summaryAsHTML ($rev) {
198         if ( !($summary = $this->summary($rev)) )
199             return '';
200         return  HTML::span( array('class' => 'wiki-summary'),
201                             "(",
202                             TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
203                             ")");
204     }
205
206     function rss_icon () {
207         global $request, $WikiTheme;
208
209         $rss_url = $request->getURLtoSelf(array('action' => 'RecentChanges', 'format' => 'rss'));
210         return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), 
211                            $WikiTheme->makeButton("RSS", $rss_url, 'rssicon'));
212     }
213     function rss2_icon () {
214         global $request, $WikiTheme;
215
216         $rss_url = $request->getURLtoSelf(array('action' => 'RecentChanges', 'format' => 'rss2'));
217         return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), 
218                            $WikiTheme->makeButton("xml", $rss_url, 'rssicon'));
219     }
220     function atom_icon () {
221         global $request, $WikiTheme;
222         if (DEBUG) {
223             $rss_url = $request->getURLtoSelf(array('action' => 'RecentChanges', 'format' => 'atom'));
224             return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), 
225                            $WikiTheme->makeButton("atom", $rss_url, 'rssicon'));
226         }
227     }
228     function grazr_icon () {
229         global $request, $WikiTheme;
230         $rss_url = 'http://grazr.com/gzpanel.html?' . 
231             WikiURL($request->getArg('pagename'),array('action' => 'RecentChanges', 'format' => 'rss2'),true);
232         return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), 
233                            $WikiTheme->makeButton("grazr-it", $rss_url, 'rssicon'));
234     }
235
236     function pre_description () {
237         extract($this->_args);
238         // FIXME: say something about show_all.
239         if ($show_major && $show_minor)
240             $edits = _("edits");
241         elseif ($show_major)
242             $edits = _("major edits");
243         else
244             $edits = _("minor edits");
245         if (isset($caption) and $caption == _("Recent Comments"))
246             $edits = _("comments");
247         if (!empty($only_new)) {
248             $edits = _("created new pages");
249         }
250         if (!empty($author)) {
251             global $request;
252             if ($author == '[]')
253                 $author = $request->_user->getID();
254             $edits .= sprintf(_(" for pages changed by %s"), $author);
255         }
256         if (!empty($owner)) {
257             global $request;
258             if ($owner == '[]')
259                 $owner = $request->_user->getID();
260             $edits .= sprintf(_(" for pages owned by %s"), $owner);
261         }
262         if ($timespan = $days > 0) {
263             if (intval($days) != $days)
264                 $days = sprintf("%.1f", $days);
265         }
266         $lmt = abs($limit);
267         /**
268          * Depending how this text is split up it can be tricky or
269          * impossible to translate with good grammar. So the seperate
270          * strings for 1 day and %s days are necessary in this case
271          * for translating to multiple languages, due to differing
272          * overlapping ideal word cutting points.
273          *
274          * en: day/days "The %d most recent %s [during (the past] day) are listed below."
275          * de: 1 Tag    "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
276          * de: %s days  "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
277          *
278          * en: day/days "The %d most recent %s during [the past] (day) are listed below."
279          * fr: 1 jour   "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont Ã©numérées ci-dessous."
280          * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont Ã©numérées ci-dessous."
281          */
282         if ($limit > 0) {
283             if ($timespan) {
284                 if (intval($days) == 1)
285                     $desc = fmt("The %d most recent %s during the past day are listed below.",
286                                 $limit, $edits);
287                 else
288                     $desc = fmt("The %d most recent %s during the past %s days are listed below.",
289                                 $limit, $edits, $days);
290             } else
291                 $desc = fmt("The %d most recent %s are listed below.",
292                             $limit, $edits);
293         }
294         elseif ($limit < 0) {  //$limit < 0 means we want oldest pages
295             if ($timespan) {
296                 if (intval($days) == 1)
297                     $desc = fmt("The %d oldest %s during the past day are listed below.",
298                                 $lmt, $edits);
299                 else
300                     $desc = fmt("The %d oldest %s during the past %s days are listed below.",
301                                 $lmt, $edits, $days);
302             } else
303                 $desc = fmt("The %d oldest %s are listed below.",
304                             $lmt, $edits);
305         }
306
307         else {
308             if ($timespan) {
309                 if (intval($days) == 1)
310                     $desc = fmt("The most recent %s during the past day are listed below.",
311                                 $edits);
312                 else
313                     $desc = fmt("The most recent %s during the past %s days are listed below.",
314                                 $edits, $days);
315             } else
316                 $desc = fmt("All %s are listed below.", $edits);
317         }
318         return $desc;
319     }    
320
321     function description() {
322         return HTML::p(false, $this->pre_description());
323     }
324
325
326     function title () {
327         extract($this->_args);
328         return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
329                      ' ',
330                      $this->rss_icon(), 
331                      HTML::raw('&nbsp;'), $this->rss2_icon(),
332                      HTML::raw('&nbsp;'), $this->grazr_icon(),
333                      HTML::raw('&nbsp;'), $this->atom_icon(),
334                      $this->sidebar_link());
335     }
336
337     function empty_message() {
338         if (isset($this->_args['caption']) and $this->_args['caption'] == _("Recent Comments"))
339             return _("No comments found");
340         else 
341             return _("No changes found");
342     }
343         
344     function sidebar_link() {
345         extract($this->_args);
346         $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
347
348         global $request;
349         $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
350
351         $addsidebarjsfunc =
352             "function addPanel() {\n"
353             ."    window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
354             ."       \"$sidebarurl\",\"\");\n"
355             ."}\n";
356         $jsf = JavaScript($addsidebarjsfunc);
357
358         global $WikiTheme;
359         $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
360         $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
361         $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
362                                 ."    (typeof window.sidebar.addPanel == 'function'))\n"
363                                 ."   {\n"
364                                 ."       document.write('$addsidebarjsclick');\n"
365                                 ."   }\n"
366                                 );
367         return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
368     }
369
370     function format ($changes) {
371         include_once('lib/InlineParser.php');
372         
373         $html = HTML(HTML::h2(false, $this->title()));
374         if (($desc = $this->description()))
375             $html->pushContent($desc);
376         
377         if ($this->_args['daylist'])
378             $html->pushContent(new DayButtonBar($this->_args));
379
380         $last_date = '';
381         $lines = false;
382         $first = true;
383
384         while ($rev = $changes->next()) {
385             if (($date = $this->date($rev)) != $last_date) {
386                 if ($lines)
387                     $html->pushContent($lines);
388                 // for user contributions no extra date line
389                 $html->pushContent(HTML::h3($date));
390                 $lines = HTML::ul();
391                 $last_date = $date;
392
393             }
394             // enforce view permission
395             if (mayAccessPage('view', $rev->_pagename)) {
396                 $lines->pushContent($this->format_revision($rev));
397                 if ($first)
398                     $this->setValidators($rev);
399                 $first = false;
400             }
401         }
402         if ($lines)
403             $html->pushContent($lines);
404         if ($first)
405             $html->pushContent(HTML::p(array('class' => 'rc-empty'),
406                                        $this->empty_message()));
407         
408         return $html;
409     }
410
411     function format_revision ($rev) {
412         global $WikiTheme;
413         $args = &$this->_args;
414
415         $class = 'rc-' . $this->importance($rev);
416
417         $time = $this->time($rev);
418         if (! $rev->get('is_minor_edit'))
419             $time = HTML::span(array('class' => 'pageinfo-majoredit'), $time);
420
421         $line = HTML::li(array('class' => $class));
422
423         if ($args['difflinks'])
424             $line->pushContent($this->diffLink($rev), ' ');
425
426         if ($args['historylinks'])
427             $line->pushContent($this->historyLink($rev), ' ');
428
429         if (isa($WikiTheme, 'Theme_MonoBook')) {
430             $line->pushContent(
431                                $args['historylinks'] ? '' : $this->historyLink($rev),
432                                ' . . ', $this->pageLink($rev), '; ',
433                                $time, ' . . ',
434                                $this->authorLink($rev),' ',
435                                $this->authorContribs($rev),' ',
436                                $this->summaryAsHTML($rev));
437         } else {
438             $line->pushContent($this->pageLink($rev), ' ',
439                                $time, ' ',
440                                $this->summaryAsHTML($rev),
441                                ' ... ',
442                                $this->authorLink($rev));
443         }
444         return $line;
445     }
446
447 }
448
449 /* format=contribs: no seperation into extra dates
450  * 14:41, 3 December 2006 (hist) (diff) Talk:PhpWiki (added diff link)  (top)
451  */
452 class _RecentChanges_UserContribsFormatter
453 extends _RecentChanges_HtmlFormatter
454 {
455     function title () {
456         extract($this->_args);
457         return array(_("UserContribs"),":",$author ? $author : $owner,
458                      ' ',
459                      $this->rss_icon(), 
460                      HTML::raw('&nbsp;'), $this->rss2_icon(),
461                      //HTML::raw('&nbsp;'), $this->grazr_icon(),
462                      HTML::raw('&nbsp;'), $this->atom_icon());
463     }
464
465     function format ($changes) {
466         include_once('lib/InlineParser.php');
467         
468         $html = HTML(HTML::h2(false, $this->title()));
469         $lines = HTML::ol();
470         $first = true; $count = 0;
471         while ($rev = $changes->next()) {
472             if (mayAccessPage('view', $rev->_pagename)) {
473                 $lines->pushContent($this->format_revision($rev));
474                 if ($first)
475                     $this->setValidators($rev);
476                 $first = false;
477             }
478             $count++;
479         }
480         $this->_args['limit'] = $count;
481         if (($desc = $this->description()))
482             $html->pushContent($desc);
483         if ($this->_args['daylist'])
484             $html->pushContent(new DayButtonBar($this->_args));
485         if ($first)
486             $html->pushContent(HTML::p(array('class' => 'rc-empty'),
487                                        $this->empty_message()));
488         else                               
489             $html->pushContent($lines);
490         
491         return $html;
492     }
493
494     function format_revision ($rev) {
495         $args = &$this->_args;
496         $class = 'rc-' . $this->importance($rev);
497         $time = $this->time($rev);
498         if (! $rev->get('is_minor_edit'))
499             $time = HTML::span(array('class' => 'pageinfo-majoredit'), $time);
500
501         $line = HTML::li(array('class' => $class));
502
503         $line->pushContent($this->time($rev),", ");
504         $line->pushContent($this->date($rev)," ");
505         $line->pushContent($this->diffLink($rev), ' ');
506         $line->pushContent($this->historyLink($rev), ' ');
507         $line->pushContent($this->pageLink($rev), ' ',
508                            $this->summaryAsHTML($rev));
509         return $line;
510     }
511 }
512
513 class _RecentChanges_SideBarFormatter
514 extends _RecentChanges_HtmlFormatter
515 {
516     function rss_icon () {
517         //omit rssicon
518     }
519     function rss2_icon () { }
520     function title () {
521         //title click opens the normal RC or RE page in the main browser frame
522         extract($this->_args);
523         $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
524         $titlelink->setAttr('target', '_content');
525         return HTML($this->logo(), $titlelink);
526     }
527     function logo () {
528         //logo click opens the HomePage in the main browser frame
529         global $WikiTheme;
530         $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'),
531                                'border' => 0,
532                                'align' => 'right',
533                                'style' => 'height:2.5ex'
534                                ));
535         $linkurl = WikiLink(HOME_PAGE, false, $img);
536         $linkurl->setAttr('target', '_content');
537         return $linkurl;
538     }
539
540     function authorLink ($rev) {
541         $author = $rev->get('author');
542         if ( $this->authorHasPage($author) ) {
543             $linkurl = WikiLink($author);
544             $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
545             return $linkurl;
546         } else
547             return $author;
548     }
549
550     function diffLink ($rev) {
551         $linkurl = parent::diffLink($rev);
552         $linkurl->setAttr('target', '_content');
553         $linkurl->setAttr('rel', 'nofollow');
554         // FIXME: Smelly hack to get smaller diff buttons in sidebar
555         $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
556         return $linkurl;
557     }
558     function historyLink ($rev) {
559         $linkurl = parent::historyLink($rev);
560         $linkurl->setAttr('target', '_content');
561         // FIXME: Smelly hack to get smaller history buttons in sidebar
562         $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
563         return $linkurl;
564     }
565     function pageLink ($rev) {
566         $linkurl = parent::pageLink($rev);
567         $linkurl->setAttr('target', '_content');
568         return $linkurl;
569     }
570     // Overriding summaryAsHTML, because there is no way yet to
571     // return summary as transformed text with
572     // links setAttr('target', '_content') in Mozilla sidebar.
573     // So for now don't create clickable links inside summary
574     // in the sidebar, or else they target the sidebar and not the
575     // main content window.
576     function summaryAsHTML ($rev) {
577         if ( !($summary = $this->summary($rev)) )
578             return '';
579         return HTML::span(array('class' => 'wiki-summary'),
580                           "[",
581                           /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
582                           "]");
583     }
584
585
586     function format ($changes) {
587         $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
588         $html = _RecentChanges_HtmlFormatter::format ($changes);
589         $html = HTML::div(array('class' => 'wikitext'), $html);
590         global $request;
591         $request->discardOutput();
592         
593         printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", $GLOBALS['charset']);
594         printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
595         printf('  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
596         printf('<html xmlns="http://www.w3.org/1999/xhtml">');
597
598         printf("<head>\n");
599         extract($this->_args);
600         $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
601         printf("<title>" . $title . "</title>\n");
602         global $WikiTheme;
603         $css = $WikiTheme->getCSS();
604         $css->PrintXML();
605         printf("</head>\n");
606
607         printf("<body class=\"sidebar\">\n");
608         $html->PrintXML();
609         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>';
610         printf("\n</body>\n");
611         printf("</html>\n");
612
613         $request->finish(); // cut rest of page processing short
614     }
615 }
616
617 class _RecentChanges_BoxFormatter
618 extends _RecentChanges_HtmlFormatter
619 {
620     function rss_icon () {
621     }
622     function rss2_icon () {
623     }
624     function title () {
625     }
626     function authorLink ($rev) {
627     }
628     function diffLink ($rev) {
629     }
630     function historyLink ($rev) {
631     }
632     function summaryAsHTML ($rev) {
633     }
634     function description () {
635     }
636     function format ($changes) {
637         include_once('lib/InlineParser.php');
638         $last_date = '';
639         $first = true;
640         $html = HTML();
641         $counter = 1;
642         $sp = HTML::Raw("\n&nbsp;&middot;&nbsp;");
643         while ($rev = $changes->next()) {
644             // enforce view permission
645             if (mayAccessPage('view',$rev->_pagename)) {
646                 if ($link = $this->pageLink($rev)) // some entries may be empty 
647                                                    // (/Blog/.. interim pages)
648                     $html->pushContent($sp, $link, HTML::br());
649                 if ($first)
650                     $this->setValidators($rev);
651                 $first = false;
652             }
653         }
654         if ($first)
655             $html->pushContent(HTML::p(array('class' => 'rc-empty'),
656                                        $this->empty_message()));
657         return $html;
658     }
659 }
660
661 class _RecentChanges_RssFormatter
662 extends _RecentChanges_Formatter
663 {
664     var $_absurls = true;
665
666     function time ($rev) {
667         return Iso8601DateTime($rev->get('mtime'));
668     }
669
670     function pageURI ($rev) {
671         return WikiURL($rev, '', 'absurl');
672     }
673
674     function format ($changes) {
675         
676         include_once('lib/RssWriter.php');
677         $rss = new RssWriter;
678
679         $rss->channel($this->channel_properties());
680
681         if (($props = $this->image_properties()))
682             $rss->image($props);
683         if (($props = $this->textinput_properties()))
684             $rss->textinput($props);
685
686         $first = true;
687         while ($rev = $changes->next()) {
688             // enforce view permission
689             if (mayAccessPage('view', $rev->_pagename)) {
690                 $rss->addItem($this->item_properties($rev),
691                               $this->pageURI($rev));
692                 if ($first)
693                     $this->setValidators($rev);
694                 $first = false;
695             }
696         }
697
698         global $request;
699         $request->discardOutput();
700         $rss->finish();
701         printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
702
703         // Flush errors in comment, otherwise it's invalid XML.
704         global $ErrorManager;
705         if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
706             printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
707
708         $request->finish();     // NORETURN!!!!
709     }
710
711     function image_properties () {
712         global $WikiTheme;
713
714         $img_url = AbsoluteURL($WikiTheme->getImageURL('logo'));
715         if (!$img_url)
716             return false;
717
718         return array('title' => WIKI_NAME,
719                      'link' => WikiURL(HOME_PAGE, false, 'absurl'),
720                      'url' => $img_url);
721     }
722
723     function textinput_properties () {
724         return array('title' => _("Search"),
725                      'description' => _("Title Search"),
726                      'name' => 's',
727                      'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
728     }
729
730     function channel_properties () {
731         global $request;
732
733         $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
734         return array('title' => WIKI_NAME,
735                      'link' => $rc_url,
736                      'description' => _("RecentChanges"),
737                      'dc:date' => Iso8601DateTime(time()),
738                      'dc:language' => $GLOBALS['LANG']);
739
740         /* FIXME: other things one might like in <channel>:
741          * sy:updateFrequency
742          * sy:updatePeriod
743          * sy:updateBase
744          * dc:subject
745          * dc:publisher
746          * dc:language
747          * dc:rights
748          * rss091:language
749          * rss091:managingEditor
750          * rss091:webmaster
751          * rss091:lastBuildDate
752          * rss091:copyright
753          */
754     }
755
756     function item_properties ($rev) {
757         $page = $rev->getPage();
758         $pagename = $page->getName();
759
760         return array( 'title'           => SplitPagename($pagename),
761                       'description'     => $this->summary($rev),
762                       'link'            => $this->pageURL($rev),
763                       'dc:date'         => $this->time($rev),
764                       'dc:contributor'  => $rev->get('author'),
765                       'wiki:version'    => $rev->getVersion(),
766                       'wiki:importance' => $this->importance($rev),
767                       'wiki:status'     => $this->status($rev),
768                       'wiki:diff'       => $this->diffURL($rev),
769                       'wiki:history'    => $this->historyURL($rev)
770                       );
771     }
772 }
773
774 /** explicit application/rss+xml Content-Type,
775  * simplified xml structure (no namespace),
776  * support for xml-rpc cloud registerProcedure (not yet)
777  */
778 class _RecentChanges_Rss2Formatter
779 extends _RecentChanges_RssFormatter {
780
781     function format ($changes) {
782         include_once('lib/RssWriter2.php');
783         $rss = new RssWriter2;
784
785         $rss->channel($this->channel_properties());
786         if (($props = $this->cloud_properties()))
787             $rss->cloud($props);
788         if (($props = $this->image_properties()))
789             $rss->image($props);
790         if (($props = $this->textinput_properties()))
791             $rss->textinput($props);
792         $first = true;
793         while ($rev = $changes->next()) {
794             // enforce view permission
795             if (mayAccessPage('view', $rev->_pagename)) {
796                 $rss->addItem($this->item_properties($rev),
797                               $this->pageURI($rev));
798                 if ($first)
799                     $this->setValidators($rev);
800                 $first = false;
801             }
802         }
803
804         global $request;
805         $request->discardOutput();
806         $rss->finish();
807         printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
808         // Flush errors in comment, otherwise it's invalid XML.
809         global $ErrorManager;
810         if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
811             printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
812
813         $request->finish();     // NORETURN!!!!
814     }
815
816     function channel_properties () {
817         $chann_10 = parent::channel_properties();
818         return array_merge($chann_10,
819                            array('generator' => 'PhpWiki-'.PHPWIKI_VERSION,
820                                  //<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
821                                  //<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
822                                  //<docs>http://blogs.law.harvard.edu/tech/rss</docs>
823                                  'copyright' => COPYRIGHTPAGE_URL
824                                  ));
825     }
826
827     // xml-rpc registerProcedure not yet implemented
828     function cloud_properties () { return false; } 
829     function cloud_properties_test () {
830         return array('protocol' => 'xml-rpc', // xml-rpc or soap or http-post
831                      'registerProcedure' => 'wiki.rssPleaseNotify',
832                      'path' => DATA_PATH.'/RPC2.php',
833                      'port' => !SERVER_PORT ? '80' : (SERVER_PROTOCOL == 'https' ? '443' : '80'),
834                      'domain' => SERVER_NAME);
835     }
836 }
837
838 /** Explicit application/atom+xml Content-Type
839  *  A weird, questionable format
840  */
841 class _RecentChanges_AtomFormatter
842 extends _RecentChanges_RssFormatter {
843
844     function format ($changes) {
845         global $request;
846         include_once('lib/RssWriter.php');
847         $rss = new AtomFeed;
848
849         // "channel" is called "feed" in atom
850         $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
851         $feed_props = array('title' => WIKI_NAME,
852                             'link' => array('rel'=>"alternate",
853                                             'type'=>"text/html",
854                                             'href' => $rc_url),
855                             'id' => md5($rc_url),                
856                             'modified' => Iso8601DateTime(time()),
857                             'generator' => 'PhpWiki-'.PHPWIKI_VERSION,
858                             'tagline' => '');
859         $rss->feed($feed_props);
860         $first = true;
861         while ($rev = $changes->next()) {
862             // enforce view permission
863             if (mayAccessPage('view', $rev->_pagename)) {
864                 $props = $this->item_properties($rev);
865                 $rss->addItem($props,
866                               false,
867                               $this->pageURI($rev));
868                 if ($first)
869                     $this->setValidators($rev);
870                 $first = false;
871             }
872         }
873
874         $request->discardOutput();
875         $rss->finish();
876         printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
877         // Flush errors in comment, otherwise it's invalid XML.
878         global $ErrorManager;
879         if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
880             printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
881
882         $request->finish();     // NORETURN!!!!
883     }
884
885     function item_properties ($rev) {
886         $page = $rev->getPage();
887         $pagename = $page->getName();
888         return array( 'title'           => $pagename,
889                       'link'            => array('rel' => 'alternate',
890                                                  'type' => 'text/html',
891                                                  'href' => $this->pageURL($rev)),
892                       'summary'         => $this->summary($rev),
893                       'modified'        => $this->time($rev)."Z",
894                       'issued'          => $this->time($rev),
895                       'created'         => $this->time($rev)."Z",
896                       'author'          => new XmlElement('author', new XmlElement('name', $rev->get('author')))
897                       );
898     }
899 }
900
901 /**
902  * Filter by non-empty
903  */
904 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
905 {
906     /** Constructor
907      *
908      * @param $revisions object a WikiDB_PageRevisionIterator.
909      */
910     function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
911         $this->_revisions = $revisions;
912         $this->_check_current_revision = $check_current_revision;
913     }
914
915     function next () {
916         while (($rev = $this->_revisions->next())) {
917             if ($this->_check_current_revision) {
918                 $page = $rev->getPage();
919                 $check_rev = $page->getCurrentRevision();
920             }
921             else {
922                 $check_rev = $rev;
923             }
924             if (! $check_rev->hasDefaultContents())
925                 return $rev;
926         }
927         $this->free();
928         return false;
929     }
930
931 }
932
933 /**
934  * Filter by only_new.
935  * Only new created pages
936  */
937 class NewPageRevisionIterator extends WikiDB_PageRevisionIterator
938 {
939     /** Constructor
940      *
941      * @param $revisions object a WikiDB_PageRevisionIterator.
942      */
943     function NewPageRevisionIterator ($revisions) {
944         $this->_revisions = $revisions;
945     }
946
947     function next () {
948         while (($rev = $this->_revisions->next())) {
949             if ($rev->getVersion() == 1)
950                 return $rev;
951         }
952         $this->free();
953         return false;
954     }
955 }
956
957 /**
958  * Filter by author
959  */
960 class AuthorPageRevisionIterator extends WikiDB_PageRevisionIterator
961 {
962     function AuthorPageRevisionIterator ($revisions, $author) {
963         $this->_revisions = $revisions;
964         $this->_author = $author;
965     }
966
967     function next () {
968         while (($rev = $this->_revisions->next())) {
969             if ($rev->get('author_id') == $this->_author)
970                 return $rev;
971         }
972         $this->free();
973         return false;
974     }
975 }
976
977 /**
978  * Filter by owner
979  */
980 class OwnerPageRevisionIterator extends WikiDB_PageRevisionIterator
981 {
982     function OwnerPageRevisionIterator ($revisions, $owner) {
983         $this->_revisions = $revisions;
984         $this->_owner = $owner;
985     }
986
987     function next () {
988         while (($rev = $this->_revisions->next())) {
989             $page = $rev->getPage();
990             if ($page->getOwner() == $this->_owner)
991                 return $rev;
992         }
993         $this->free();
994         return false;
995     }
996 }
997
998 class WikiPlugin_RecentChanges
999 extends WikiPlugin
1000 {
1001     function getName () {
1002         return _("RecentChanges");
1003     }
1004
1005     function getVersion() {
1006         return preg_replace("/[Revision: $]/", '',
1007                             "\$Revision: 1.119 $");
1008     }
1009
1010     function managesValidators() {
1011         // Note that this is a bit of a fig.
1012         // We set validators based on the most recently changed page,
1013         // but this fails when the most-recent page is deleted.
1014         // (Consider that the Last-Modified time will decrease
1015         // when this happens.)
1016
1017         // We might be better off, leaving this as false (and junking
1018         // the validator logic above) and just falling back to the
1019         // default behavior (handled by WikiPlugin) of just using
1020         // the WikiDB global timestamp as the mtime.
1021
1022         // Nevertheless, for now, I leave this here, mostly as an
1023         // example for how to use appendValidators() and managesValidators().
1024         
1025         return true;
1026     }
1027             
1028     function getDefaultArguments() {
1029         return array('days'         => 2,
1030                      'show_minor'   => false,
1031                      'show_major'   => true,
1032                      'show_all'     => false,
1033                      'show_deleted' => 'sometimes',
1034                      'only_new'     => false,
1035                      'author'       => false,
1036                      'owner'        => false,
1037                      'limit'        => false,
1038                      'format'       => false,
1039                      'daylist'      => false,
1040                      'difflinks'    => true,
1041                      'historylinks' => false,
1042                      'caption'      => ''
1043                      );
1044     }
1045
1046     function getArgs ($argstr, $request, $defaults = false) {
1047         if (!$defaults) $defaults = $this->getDefaultArguments();
1048         $args = WikiPlugin::getArgs($argstr, $request, $defaults);
1049
1050         $action = $request->getArg('action');
1051         if ($action != 'browse' && ! $request->isActionPage($action))
1052             $args['format'] = false; // default -> HTML
1053
1054         if ($args['format'] == 'rss' && empty($args['limit']))
1055             $args['limit'] = 15; // Fix default value for RSS.
1056         if ($args['format'] == 'rss2' && empty($args['limit']))
1057             $args['limit'] = 15; // Fix default value for RSS2.
1058
1059         if ($args['format'] == 'sidebar' && empty($args['limit']))
1060             $args['limit'] = 10; // Fix default value for sidebar.
1061
1062         return $args;
1063     }
1064
1065     function getMostRecentParams (&$args) {
1066         $show_all = false; $show_minor = false; $show_major = false;
1067         $limit = false;
1068         extract($args);
1069
1070         $params = array('include_minor_revisions' => $show_minor,
1071                         'exclude_major_revisions' => !$show_major,
1072                         'include_all_revisions' => !empty($show_all));
1073         if ($limit != 0)
1074             $params['limit'] = $limit;
1075         if (!empty($args['author'])) {
1076             global $request;
1077             if ($args['author'] == '[]')
1078                 $args['author'] = $request->_user->getID();
1079             $params['author'] = $args['author'];
1080         }
1081         if (!empty($args['owner'])) {
1082             global $request;
1083             if ($args['owner'] == '[]')
1084                 $args['owner'] = $request->_user->getID();
1085             $params['owner'] = $args['owner'];
1086         }
1087         if (!empty($days)) {
1088           if ($days > 0.0)
1089             $params['since'] = time() - 24 * 3600 * $days;
1090           elseif ($days < 0.0)
1091             $params['since'] = 24 * 3600 * $days - time();
1092         }
1093
1094         return $params;
1095     }
1096
1097     function getChanges ($dbi, $args) {
1098         $changes = $dbi->mostRecent($this->getMostRecentParams($args));
1099
1100         $show_deleted = @$args['show_deleted'];
1101         $show_all = @$args['show_all'];
1102         if ($show_deleted == 'sometimes')
1103             $show_deleted = @$args['show_minor'];
1104
1105         if (!empty($args['only_new']))
1106             $changes = new NewPageRevisionIterator($changes);
1107         if (!empty($args['author']))
1108             $changes = new AuthorPageRevisionIterator($changes, $args['author']);
1109         if (!empty($args['owner']))
1110             $changes = new OwnerPageRevisionIterator($changes, $args['owner']);
1111         if (!$show_deleted)
1112             $changes = new NonDeletedRevisionIterator($changes, !$show_all);
1113
1114         return $changes;
1115     }
1116
1117     function format ($changes, $args) {
1118         global $WikiTheme;
1119         $format = $args['format'];
1120
1121         $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format);
1122         if (!$fmt_class) {
1123             if ($format == 'rss')
1124                 $fmt_class = '_RecentChanges_RssFormatter';
1125             elseif ($format == 'rss2')
1126                 $fmt_class = '_RecentChanges_Rss2Formatter';
1127             elseif ($format == 'atom')
1128                 $fmt_class = '_RecentChanges_AtomFormatter';
1129             elseif ($format == 'rss091') {
1130                 include_once "lib/RSSWriter091.php";
1131                 $fmt_class = '_RecentChanges_RssFormatter091';
1132             }
1133             elseif ($format == 'sidebar')
1134                 $fmt_class = '_RecentChanges_SideBarFormatter';
1135             elseif ($format == 'box')
1136                 $fmt_class = '_RecentChanges_BoxFormatter';
1137             elseif ($format == 'contribs')
1138                 $fmt_class = '_RecentChanges_UserContribsFormatter';
1139             else
1140                 $fmt_class = '_RecentChanges_HtmlFormatter';
1141         }
1142
1143         $fmt = new $fmt_class($args);
1144         return $fmt->format($changes);
1145     }
1146
1147     function run($dbi, $argstr, &$request, $basepage) {
1148         $args = $this->getArgs($argstr, $request);
1149
1150         // HACKish: fix for SF bug #622784  (1000 years of RecentChanges ought
1151         // to be enough for anyone.)
1152         $args['days'] = min($args['days'], 365000);
1153         
1154         // Hack alert: format() is a NORETURN for rss formatters.
1155         return $this->format($this->getChanges($dbi, $args), $args);
1156     }
1157
1158     // box is used to display a fixed-width, narrow version with common header.
1159     // just a numbered list of limit pagenames, without date.
1160     function box($args = false, $request = false, $basepage = false) {
1161         if (!$request) $request =& $GLOBALS['request'];
1162         if (!isset($args['limit'])) $args['limit'] = 15;
1163         $args['format'] = 'box';
1164         $args['show_minor'] = false;
1165         $args['show_major'] = true;
1166         $args['show_deleted'] = 'sometimes';
1167         $args['show_all'] = false;
1168         $args['days'] = 90;
1169         return $this->makeBox(WikiLink($this->getName(),'',
1170                                        SplitPagename($this->getName())),
1171                               $this->format
1172                               ($this->getChanges($request->_dbi, $args), $args));
1173     }
1174
1175 };
1176
1177
1178 class DayButtonBar extends HtmlElement {
1179
1180     function DayButtonBar ($plugin_args) {
1181         $this->__construct('p', array('class' => 'wiki-rc-action'));
1182
1183         // Display days selection buttons
1184         extract($plugin_args);
1185
1186         // Custom caption
1187         if (! $caption) {
1188             if ($show_minor)
1189                 $caption = _("Show minor edits for:");
1190             elseif ($show_all)
1191                 $caption = _("Show all changes for:");
1192             else
1193                 $caption = _("Show changes for:");
1194             if ($only_new)
1195                 $caption = _("All new pages since:");
1196         }
1197
1198         $this->pushContent($caption, ' ');
1199
1200         global $WikiTheme;
1201         $sep = $WikiTheme->getButtonSeparator();
1202
1203         $n = 0;
1204         foreach (explode(",", $daylist) as $days) {
1205             if ($n++)
1206                 $this->pushContent($sep);
1207             $this->pushContent($this->_makeDayButton($days));
1208         }
1209     }
1210
1211     function _makeDayButton ($days) {
1212         global $WikiTheme, $request;
1213
1214         if ($days == 1)
1215             $label = _("1 day");
1216         elseif ($days < 1)
1217             $label = "..."; //alldays
1218         else
1219             $label = sprintf(_("%s days"), abs($days));
1220
1221         $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days));
1222
1223         return $WikiTheme->makeButton($label, $url, 'wiki-rc-action');
1224     }
1225 }
1226
1227 // $Log: not supported by cvs2svn $
1228 // Revision 1.118  2007/06/02 18:24:59  rurban
1229 // global WikiTheme
1230 //
1231 // Revision 1.117  2007/05/30 20:43:31  rurban
1232 // added MonoBook UserContribs
1233 //
1234 // Revision 1.116  2007/05/13 18:13:41  rurban
1235 // use all filters, not just the first, ignoring the others. improve wording a bit
1236 //
1237 // Revision 1.115  2007/04/08 16:24:10  rurban
1238 // Remove redundant code in ->authorLink(): 'if_known' does the same
1239 //
1240 // Revision 1.114  2007/02/17 22:39:44  rurban
1241 // format=rss overhaul
1242 //
1243 // Revision 1.113  2007/02/17 14:15:52  rurban
1244 // new argument owner=[] for RecentChangesMyPages
1245 //
1246 // Revision 1.112  2007/01/28 20:32:07  rurban
1247 // silence empty warning
1248 //
1249 // Revision 1.111  2007/01/25 21:48:52  rurban
1250 // new argument author=[]
1251 //
1252 // Revision 1.110  2007/01/22 23:51:36  rurban
1253 // new arg: only_new
1254 //
1255 // Revision 1.109  2006/03/19 14:26:29  rurban
1256 // sf.net patch by Matt Brown: Add rel=nofollow to more actions
1257 //
1258 // Revision 1.108  2005/04/01 16:09:35  rurban
1259 // fix defaults in RecentChanges plugins: e.g. invalid pagenames for PageHistory
1260 //
1261 // Revision 1.107  2005/02/04 13:45:28  rurban
1262 // improve box layout a bit
1263 //
1264 // Revision 1.106  2005/02/02 19:39:10  rurban
1265 // honor show_all=false
1266 //
1267 // Revision 1.105  2005/01/25 03:50:54  uckelman
1268 // pre_description is a member function, so call with $this->.
1269 //
1270 // Revision 1.104  2005/01/24 23:15:16  uckelman
1271 // The extra description for RelatedChanges was appearing in RecentChanges
1272 // and PageHistory due to a bad test in _RecentChanges_HtmlFormatter. Fixed.
1273 //
1274 // Revision 1.103  2004/12/15 17:45:09  rurban
1275 // fix box method
1276 //
1277 // Revision 1.102  2004/12/06 19:29:24  rurban
1278 // simplify RSS: add RSS2 link (rss tag only, new content-type)
1279 //
1280 // Revision 1.101  2004/11/10 19:32:24  rurban
1281 // * optimize increaseHitCount, esp. for mysql.
1282 // * prepend dirs to the include_path (phpwiki_dir for faster searches)
1283 // * Pear_DB version logic (awful but needed)
1284 // * fix broken ADODB quote
1285 // * _extract_page_data simplification
1286 //
1287 // Revision 1.100  2004/06/28 16:35:12  rurban
1288 // prevent from shell commands
1289 //
1290 // Revision 1.99  2004/06/20 14:42:54  rurban
1291 // various php5 fixes (still broken at blockparser)
1292 //
1293 // Revision 1.98  2004/06/14 11:31:39  rurban
1294 // renamed global $Theme to $WikiTheme (gforge nameclash)
1295 // inherit PageList default options from PageList
1296 //   default sortby=pagename
1297 // use options in PageList_Selectable (limit, sortby, ...)
1298 // added action revert, with button at action=diff
1299 // added option regex to WikiAdminSearchReplace
1300 //
1301 // Revision 1.97  2004/06/03 18:58:27  rurban
1302 // days links requires action=RelatedChanges arg
1303 //
1304 // Revision 1.96  2004/05/18 16:23:40  rurban
1305 // rename split_pagename to SplitPagename
1306 //
1307 // Revision 1.95  2004/05/16 22:07:35  rurban
1308 // check more config-default and predefined constants
1309 // various PagePerm fixes:
1310 //   fix default PagePerms, esp. edit and view for Bogo and Password users
1311 //   implemented Creator and Owner
1312 //   BOGOUSERS renamed to BOGOUSER
1313 // fixed syntax errors in signin.tmpl
1314 //
1315 // Revision 1.94  2004/05/14 20:55:03  rurban
1316 // simplified RecentComments
1317 //
1318 // Revision 1.93  2004/05/14 17:33:07  rurban
1319 // new plugin RecentChanges
1320 //
1321 // Revision 1.92  2004/04/21 04:29:10  rurban
1322 // Two convenient RecentChanges extensions
1323 //   RelatedChanges (only links from current page)
1324 //   RecentEdits (just change the default args)
1325 //
1326 // Revision 1.91  2004/04/19 18:27:46  rurban
1327 // Prevent from some PHP5 warnings (ref args, no :: object init)
1328 //   php5 runs now through, just one wrong XmlElement object init missing
1329 // Removed unneccesary UpgradeUser lines
1330 // Changed WikiLink to omit version if current (RecentChanges)
1331 //
1332 // Revision 1.90  2004/04/18 01:11:52  rurban
1333 // more numeric pagename fixes.
1334 // fixed action=upload with merge conflict warnings.
1335 // charset changed from constant to global (dynamic utf-8 switching)
1336 //
1337 // Revision 1.89  2004/04/10 02:30:49  rurban
1338 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
1339 // Fixed "cannot setlocale..." (sf.net problem)
1340 //
1341 // Revision 1.88  2004/04/01 15:57:10  rurban
1342 // simplified Sidebar theme: table, not absolute css positioning
1343 // added the new box methods.
1344 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1345 //
1346 // Revision 1.87  2004/03/30 02:14:03  rurban
1347 // fixed yet another Prefs bug
1348 // added generic PearDb_iter
1349 // $request->appendValidators no so strict as before
1350 // added some box plugin methods
1351 // PageList commalist for condensed output
1352 //
1353 // Revision 1.86  2004/03/12 13:31:43  rurban
1354 // enforce PagePermissions, errormsg if not Admin
1355 //
1356 // Revision 1.85  2004/02/17 12:11:36  rurban
1357 // 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, ...)
1358 //
1359 // Revision 1.84  2004/02/15 22:29:42  rurban
1360 // revert premature performance fix
1361 //
1362 // Revision 1.83  2004/02/15 21:34:37  rurban
1363 // PageList enhanced and improved.
1364 // fixed new WikiAdmin... plugins
1365 // editpage, Theme with exp. htmlarea framework
1366 //   (htmlarea yet committed, this is really questionable)
1367 // WikiUser... code with better session handling for prefs
1368 // enhanced UserPreferences (again)
1369 // RecentChanges for show_deleted: how should pages be deleted then?
1370 //
1371 // Revision 1.82  2004/01/25 03:58:43  rurban
1372 // use stdlib:isWikiWord()
1373 //
1374 // Revision 1.81  2003/11/28 21:06:31  carstenklapp
1375 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
1376 // instead of 1. Make diff buttons smaller with css. Added description
1377 // line back in at the top.
1378 //
1379 // Revision 1.80  2003/11/27 15:17:01  carstenklapp
1380 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
1381 // button, to allow an image button for it to be added to Themes. Output
1382 // RSS button in small text size when theme has no button image.
1383 //
1384 // Revision 1.79  2003/04/29 14:34:20  dairiki
1385 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
1386 //
1387 // Revision 1.78  2003/03/04 01:55:05  dairiki
1388 // Fix to ensure absolute URL for logo in RSS recent changes.
1389 //
1390 // Revision 1.77  2003/02/27 23:23:38  dairiki
1391 // Fix my breakage of CSS and sidebar RecentChanges output.
1392 //
1393 // Revision 1.76  2003/02/27 22:48:44  dairiki
1394 // Fixes invalid HTML generated by PageHistory plugin.
1395 //
1396 // (<noscript> is block-level and not allowed within <p>.)
1397 //
1398 // Revision 1.75  2003/02/22 21:39:05  dairiki
1399 // Hackish fix for SF bug #622784.
1400 //
1401 // (The root of the problem is clearly a PHP bug.)
1402 //
1403 // Revision 1.74  2003/02/21 22:52:21  dairiki
1404 // Make sure to interpret relative links (like [/Subpage]) in summary
1405 // relative to correct basepage.
1406 //
1407 // Revision 1.73  2003/02/21 04:12:06  dairiki
1408 // Minor fixes for new cached markup.
1409 //
1410 // Revision 1.72  2003/02/17 02:19:01  dairiki
1411 // Fix so that PageHistory will work when the current revision
1412 // of a page has been "deleted".
1413 //
1414 // Revision 1.71  2003/02/16 20:04:48  dairiki
1415 // Refactor the HTTP validator generation/checking code.
1416 //
1417 // This also fixes a number of bugs with yesterdays validator mods.
1418 //
1419 // Revision 1.70  2003/02/16 05:09:43  dairiki
1420 // Starting to fix handling of the HTTP validator headers, Last-Modified,
1421 // and ETag.
1422 //
1423 // Last-Modified was being set incorrectly (but only when DEBUG was not
1424 // defined!)  Setting a Last-Modified without setting an appropriate
1425 // Expires: and/or Cache-Control: header results in browsers caching
1426 // the page unconditionally (for a certain period of time).
1427 // This is generally bad, since it means people don't see updated
1428 // page contents right away --- this is particularly confusing to
1429 // the people who are editing pages since their edits don't show up
1430 // next time they browse the page.
1431 //
1432 // Now, we don't allow caching of pages without revalidation
1433 // (via the If-Modified-Since and/or If-None-Match request headers.)
1434 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
1435 // appropriate value in index.php, but I advise against it.)
1436 //
1437 // Problems:
1438 //
1439 //   o Even when request is aborted due to the content not being
1440 //     modified, we currently still do almost all the work involved
1441 //     in producing the page.  So the only real savings from all
1442 //     this logic is in network bandwidth.
1443 //
1444 //   o Plugins which produce "dynamic" output need to be inspected
1445 //     and made to call $request->addToETag() and
1446 //     $request->setModificationTime() appropriately, otherwise the
1447 //     page can change without the change being detected.
1448 //     This leads to stale pages in cache again...
1449 //
1450 // Revision 1.69  2003/01/18 22:01:43  carstenklapp
1451 // Code cleanup:
1452 // Reformatting & tabs to spaces;
1453 // Added copyleft, getVersion, getDescription, rcs_id.
1454 //
1455
1456 // (c-file-style: "gnu")
1457 // Local Variables:
1458 // mode: php
1459 // tab-width: 8
1460 // c-basic-offset: 4
1461 // c-hanging-comment-ender-p: nil
1462 // indent-tabs-mode: nil
1463 // End:
1464 ?>