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