2 rcs_id('$Id: RecentChanges.php,v 1.88 2004-04-01 15:57:10 rurban Exp $');
4 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
6 This file is part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 class _RecentChanges_Formatter
27 var $_absurls = false;
29 function _RecentChanges_Formatter ($rc_args) {
30 $this->_args = $rc_args;
31 $this->_diffargs = array('action' => 'diff');
33 if ($rc_args['show_minor'] || !$rc_args['show_major'])
34 $this->_diffargs['previous'] = 'minor';
36 // PageHistoryPlugin doesn't have a 'daylist' arg.
37 if (!isset($this->_args['daylist']))
38 $this->_args['daylist'] = false;
41 function include_versions_in_URLs() {
42 return (bool) $this->_args['show_all'];
45 function date ($rev) {
47 return $Theme->getDay($rev->get('mtime'));
50 function time ($rev) {
52 return $Theme->formatTime($rev->get('mtime'));
55 function diffURL ($rev) {
56 $args = $this->_diffargs;
57 if ($this->include_versions_in_URLs())
58 $args['version'] = $rev->getVersion();
59 $page = $rev->getPage();
60 return WikiURL($page->getName(), $args, $this->_absurls);
63 function historyURL ($rev) {
64 $page = $rev->getPage();
65 return WikiURL($page, array('action' => _("PageHistory")),
69 function pageURL ($rev) {
70 return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
74 function authorHasPage ($author) {
75 global $WikiNameRegexp, $request;
76 $dbi = $request->getDbh();
77 return isWikiWord($author) && $dbi->isWikiPage($author);
80 function authorURL ($author) {
81 return $this->authorHasPage() ? WikiURL($author) : false;
85 function status ($rev) {
86 if ($rev->hasDefaultContents())
88 $page = $rev->getPage();
89 $prev = $page->getRevisionBefore($rev->getVersion());
90 if ($prev->hasDefaultContents())
95 function importance ($rev) {
96 return $rev->get('is_minor_edit') ? 'minor' : 'major';
99 function summary($rev) {
100 if ( ($summary = $rev->get('summary')) )
103 switch ($this->status($rev)) {
105 return _("Deleted.");
107 return _("New page.");
113 function setValidators($most_recent_rev) {
114 $rev = $most_recent_rev;
115 $validators = array('RecentChanges-top' =>
116 array($rev->getPageName(), $rev->getVersion()),
117 '%mtime' => $rev->get('mtime'));
119 $request->appendValidators($validators);
123 class _RecentChanges_HtmlFormatter
124 extends _RecentChanges_Formatter
126 function diffLink ($rev) {
128 return $Theme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action');
131 function historyLink ($rev) {
133 return $Theme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action');
136 function pageLink ($rev, $link_text=false) {
137 $page = $rev->getPage();
139 if ($this->include_versions_in_URLs()) {
140 $version = $rev->getVersion();
141 $exists = !$rev->hasDefaultContents();
145 $cur = $page->getCurrentRevision();
146 $exists = !$cur->hasDefaultContents();
149 return $Theme->linkExistingWikiWord($page->getName(), $link_text, $version);
151 return $Theme->linkUnknownWikiWord($page->getName(), $link_text);
154 function authorLink ($rev) {
155 $author = $rev->get('author');
156 if ( $this->authorHasPage($author) ) {
157 return WikiLink($author);
162 function summaryAsHTML ($rev) {
163 if ( !($summary = $this->summary($rev)) )
165 return HTML::strong( array('class' => 'wiki-summary'),
167 TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
171 function rss_icon () {
172 global $request, $Theme;
174 $rss_url = $request->getURLtoSelf(array('format' => 'rss'));
175 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $Theme->makeButton("RSS", $rss_url, 'rssicon'));
178 function description () {
179 extract($this->_args);
180 // FIXME: say something about show_all.
181 if ($show_major && $show_minor)
184 $edits = _("major edits");
186 $edits = _("minor edits");
188 if ($timespan = $days > 0) {
189 if (intval($days) != $days)
190 $days = sprintf("%.1f", $days);
194 * Depending how this text is split up it can be tricky or
195 * impossible to translate with good grammar. So the seperate
196 * strings for 1 day and %s days are necessary in this case
197 * for translating to multiple languages, due to differing
198 * overlapping ideal word cutting points.
200 * en: day/days "The %d most recent %s [during (the past] day) are listed below."
201 * de: 1 Tag "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
202 * de: %s days "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
204 * en: day/days "The %d most recent %s during [the past] (day) are listed below."
205 * fr: 1 jour "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont énumérées ci-dessous."
206 * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont énumérées ci-dessous."
210 if (intval($days) == 1)
211 $desc = fmt("The %d most recent %s during the past day are listed below.",
214 $desc = fmt("The %d most recent %s during the past %s days are listed below.",
215 $limit, $edits, $days);
217 $desc = fmt("The %d most recent %s are listed below.",
220 elseif ($limit < 0) { //$limit < 0 means we want oldest pages
222 if (intval($days) == 1)
223 $desc = fmt("The %d oldest %s during the past day are listed below.",
226 $desc = fmt("The %d oldest %s during the past %s days are listed below.",
227 $lmt, $edits, $days);
229 $desc = fmt("The %d oldest %s are listed below.",
235 if (intval($days) == 1)
236 $desc = fmt("The most recent %s during the past day are listed below.",
239 $desc = fmt("The most recent %s during the past %s days are listed below.",
242 $desc = fmt("All %s are listed below.", $edits);
244 return HTML::p(false, $desc);
249 extract($this->_args);
250 return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
253 $this->sidebar_link());
256 function empty_message () {
257 return _("No changes found");
260 function sidebar_link() {
261 extract($this->_args);
262 $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
265 $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
268 "function addPanel() {\n"
269 ." window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
270 ." \"$sidebarurl\",\"\");\n"
272 $jsf = JavaScript($addsidebarjsfunc);
275 $sidebar_button = $Theme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
276 $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
277 $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
278 ." (typeof window.sidebar.addPanel == 'function'))\n"
280 ." document.write('$addsidebarjsclick');\n"
283 return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
286 function format ($changes) {
287 include_once('lib/InlineParser.php');
289 $html = HTML(HTML::h2(false, $this->title()));
290 if (($desc = $this->description()))
291 $html->pushContent($desc);
293 if ($this->_args['daylist'])
294 $html->pushContent(new DayButtonBar($this->_args));
300 while ($rev = $changes->next()) {
301 if (($date = $this->date($rev)) != $last_date) {
303 $html->pushContent($lines);
304 $html->pushContent(HTML::h3($date));
309 // enforce view permission
310 if (mayAccessPage('view',$rev->_pagename)) {
311 $lines->pushContent($this->format_revision($rev));
314 $this->setValidators($rev);
319 $html->pushContent($lines);
321 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
322 $this->empty_message()));
327 function format_revision ($rev) {
328 $args = &$this->_args;
330 $class = 'rc-' . $this->importance($rev);
332 $time = $this->time($rev);
333 if (! $rev->get('is_minor_edit'))
334 $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
336 $line = HTML::li(array('class' => $class));
339 if ($args['difflinks'])
340 $line->pushContent($this->diffLink($rev), ' ');
342 if ($args['historylinks'])
343 $line->pushContent($this->historyLink($rev), ' ');
345 $line->pushContent($this->pageLink($rev), ' ',
347 $this->summaryAsHTML($rev),
349 $this->authorLink($rev));
355 class _RecentChanges_SideBarFormatter
356 extends _RecentChanges_HtmlFormatter
358 function rss_icon () {
362 //title click opens the normal RC or RE page in the main browser frame
363 extract($this->_args);
364 $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
365 $titlelink->setAttr('target', '_content');
366 return HTML($this->logo(), $titlelink);
369 //logo click opens the HomePage in the main browser frame
371 $img = HTML::img(array('src' => $Theme->getImageURL('logo'),
374 'style' => 'height:2.5ex'
376 $linkurl = WikiLink(HOME_PAGE, false, $img);
377 $linkurl->setAttr('target', '_content');
381 function authorLink ($rev) {
382 $author = $rev->get('author');
383 if ( $this->authorHasPage($author) ) {
384 $linkurl = WikiLink($author);
385 $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
391 function diffLink ($rev) {
392 $linkurl = parent::diffLink($rev);
393 $linkurl->setAttr('target', '_content');
394 // FIXME: Smelly hack to get smaller diff buttons in sidebar
395 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
398 function historyLink ($rev) {
399 $linkurl = parent::historyLink($rev);
400 $linkurl->setAttr('target', '_content');
401 // FIXME: Smelly hack to get smaller history buttons in sidebar
402 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
405 function pageLink ($rev) {
406 $linkurl = parent::pageLink($rev);
407 $linkurl->setAttr('target', '_content');
410 // Overriding summaryAsHTML, because there is no way yet to
411 // return summary as transformed text with
412 // links setAttr('target', '_content') in Mozilla sidebar.
413 // So for now don't create clickable links inside summary
414 // in the sidebar, or else they target the sidebar and not the
415 // main content window.
416 function summaryAsHTML ($rev) {
417 if ( !($summary = $this->summary($rev)) )
419 return HTML::strong(array('class' => 'wiki-summary'),
421 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
426 function format ($changes) {
427 $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
428 $html = _RecentChanges_HtmlFormatter::format ($changes);
429 $html = HTML::div(array('class' => 'wikitext'), $html);
431 $request->discardOutput();
433 printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", CHARSET);
434 printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
435 printf(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
436 printf('<html xmlns="http://www.w3.org/1999/xhtml">');
439 extract($this->_args);
440 $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
441 printf("<title>" . $title . "</title>\n");
443 $css = $Theme->getCSS();
447 printf("<body class=\"sidebar\">\n");
449 printf("\n</body>\n");
452 $request->finish(); // cut rest of page processing short
456 class _RecentChanges_BoxFormatter
457 extends _RecentChanges_HtmlFormatter
459 function rss_icon () {
463 function authorLink ($rev) {
465 function diffLink ($rev) {
467 function historyLink ($rev) {
469 function summaryAsHTML ($rev) {
471 function description () {
473 function format ($changes) {
474 include_once('lib/InlineParser.php');
479 $sp = HTML::Raw('· ');
480 while ($rev = $changes->next()) {
481 // enforce view permission
482 if (mayAccessPage('view',$rev->_pagename)) {
483 $html->pushContent($sp,$this->pageLink($rev),HTML::br());
485 $this->setValidators($rev);
490 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
491 $this->empty_message()));
496 class _RecentChanges_RssFormatter
497 extends _RecentChanges_Formatter
499 var $_absurls = true;
501 function time ($rev) {
502 return Iso8601DateTime($rev->get('mtime'));
505 function pageURI ($rev) {
506 return WikiURL($rev, '', 'absurl');
509 function format ($changes) {
511 include_once('lib/RssWriter.php');
512 $rss = new RssWriter;
515 $rss->channel($this->channel_properties());
517 if (($props = $this->image_properties()))
519 if (($props = $this->textinput_properties()))
520 $rss->textinput($props);
523 while ($rev = $changes->next()) {
524 // enforce view permission
525 if (mayAccessPage('view',$rev->_pagename)) {
526 $rss->addItem($this->item_properties($rev),
527 $this->pageURI($rev));
529 $this->setValidators($rev);
535 $request->discardOutput();
537 printf("\n<!-- Generated by PhpWiki:\n%s-->\n", $GLOBALS['RCS_IDS']);
539 // Flush errors in comment, otherwise it's invalid XML.
540 global $ErrorManager;
541 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
542 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
544 $request->finish(); // NORETURN!!!!
547 function image_properties () {
550 $img_url = AbsoluteURL($Theme->getImageURL('logo'));
554 return array('title' => WIKI_NAME,
555 'link' => WikiURL(HOME_PAGE, false, 'absurl'),
559 function textinput_properties () {
560 return array('title' => _("Search"),
561 'description' => _("Title Search"),
563 'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
566 function channel_properties () {
569 $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
571 return array('title' => WIKI_NAME,
573 'description' => _("RecentChanges"),
574 'dc:date' => Iso8601DateTime(time()));
576 /* FIXME: other things one might like in <channel>:
585 * rss091:managingEditor
587 * rss091:lastBuildDate
595 function item_properties ($rev) {
596 $page = $rev->getPage();
597 $pagename = $page->getName();
599 return array( 'title' => split_pagename($pagename),
600 'description' => $this->summary($rev),
601 'link' => $this->pageURL($rev),
602 'dc:date' => $this->time($rev),
603 'dc:contributor' => $rev->get('author'),
604 'wiki:version' => $rev->getVersion(),
605 'wiki:importance' => $this->importance($rev),
606 'wiki:status' => $this->status($rev),
607 'wiki:diff' => $this->diffURL($rev),
608 'wiki:history' => $this->historyURL($rev)
613 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
617 * @param $revisions object a WikiDB_PageRevisionIterator.
619 function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
620 $this->_revisions = $revisions;
621 $this->_check_current_revision = $check_current_revision;
625 while (($rev = $this->_revisions->next())) {
626 if ($this->_check_current_revision) {
627 $page = $rev->getPage();
628 $check_rev = $page->getCurrentRevision();
633 if (! $check_rev->hasDefaultContents())
641 $this->_revisions->free();
645 class WikiPlugin_RecentChanges
648 function getName () {
649 return _("RecentChanges");
652 function getVersion() {
653 return preg_replace("/[Revision: $]/", '',
654 "\$Revision: 1.88 $");
657 function managesValidators() {
658 // Note that this is a bit of a fig.
659 // We set validators based on the most recently changed page,
660 // but this fails when the most-recent page is deleted.
661 // (Consider that the Last-Modified time will decrease
662 // when this happens.)
664 // We might be better off, leaving this as false (and junking
665 // the validator logic above) and just falling back to the
666 // default behavior (handled by WikiPlugin) of just using
667 // the WikiDB global timestamp as the mtime.
669 // Nevertheless, for now, I leave this here, mostly as an
670 // example for how to use appendValidators() and managesValidators().
675 function getDefaultArguments() {
676 return array('days' => 2,
677 'show_minor' => false,
678 'show_major' => true,
680 'show_deleted' => 'sometimes',
685 'historylinks' => false,
690 function getArgs ($argstr, $request, $defaults = false) {
691 $args = WikiPlugin::getArgs($argstr, $request, $defaults);
693 $action = $request->getArg('action');
694 if ($action != 'browse' && ! $request->isActionPage($action))
695 $args['format'] = false; // default -> HTML
697 if ($args['format'] == 'rss' && empty($args['limit']))
698 $args['limit'] = 15; // Fix default value for RSS.
700 if ($args['format'] == 'sidebar' && empty($args['limit']))
701 $args['limit'] = 10; // Fix default value for sidebar.
706 function getMostRecentParams ($args) {
709 $params = array('include_minor_revisions' => $show_minor,
710 'exclude_major_revisions' => !$show_major,
711 'include_all_revisions' => !empty($show_all));
714 $params['limit'] = $limit;
717 $params['since'] = time() - 24 * 3600 * $days;
719 $params['since'] = 24 * 3600 * $days - time();
725 function getChanges ($dbi, $args) {
726 $changes = $dbi->mostRecent($this->getMostRecentParams($args));
728 $show_deleted = $args['show_deleted'];
729 if ($show_deleted == 'sometimes')
730 $show_deleted = $args['show_minor'];
733 $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
738 function format ($changes, $args) {
740 $format = $args['format'];
742 $fmt_class = $Theme->getFormatter('RecentChanges', $format);
744 if ($format == 'rss')
745 $fmt_class = '_RecentChanges_RssFormatter';
746 elseif ($format == 'rss091') {
747 include_once "lib/RSSWriter091.php";
748 $fmt_class = '_RecentChanges_RssFormatter091';
750 elseif ($format == 'sidebar')
751 $fmt_class = '_RecentChanges_SideBarFormatter';
752 elseif ($format == 'box')
753 $fmt_class = '_RecentChanges_BoxFormatter';
755 $fmt_class = '_RecentChanges_HtmlFormatter';
758 $fmt = new $fmt_class($args);
759 return $fmt->format($changes);
762 function run($dbi, $argstr, &$request, $basepage) {
763 $args = $this->getArgs($argstr, $request);
765 // HACKish: fix for SF bug #622784 (1000 years of RecentChanges ought
766 // to be enough for anyone.)
767 $args['days'] = min($args['days'], 365000);
769 // Hack alert: format() is a NORETURN for rss formatters.
770 return $this->format($this->getChanges($dbi, $args), $args);
773 // box is used to display a fixed-width, narrow version with common header.
774 // just a numbered list of limit pagenames, without date.
775 function box($args = false, $request = false, $basepage = false) {
776 if (!$request) $request =& $GLOBALS['request'];
777 if (!isset($args['limit'])) $args['limit'] = 15;
778 $args['format'] = 'box';
779 $args['show_minor'] = false;
780 $args['show_major'] = true;
781 $args['show_deleted'] = false;
782 $args['show_all'] = false;
784 return $this->makeBox(WikiLink(_("RecentChanges"),'',_("Recent Changes")),
785 $this->format($this->getChanges($request->_dbi, $args), $args));
791 class DayButtonBar extends HtmlElement {
793 function DayButtonBar ($plugin_args) {
794 $this->HtmlElement('p', array('class' => 'wiki-rc-action'));
796 // Display days selection buttons
797 extract($plugin_args);
802 $caption = _("Show minor edits for:");
804 $caption = _("Show all changes for:");
806 $caption = _("Show changes for:");
809 $this->pushContent($caption, ' ');
812 $sep = $Theme->getButtonSeparator();
815 foreach (explode(",", $daylist) as $days) {
817 $this->pushContent($sep);
818 $this->pushContent($this->_makeDayButton($days));
822 function _makeDayButton ($days) {
823 global $Theme, $request;
828 $label = "..."; //alldays
830 $label = sprintf(_("%s days"), abs($days));
832 $url = $request->getURLtoSelf(array('action' => 'browse', 'days' => $days));
834 return $Theme->makeButton($label, $url, 'wiki-rc-action');
838 // $Log: not supported by cvs2svn $
839 // Revision 1.87 2004/03/30 02:14:03 rurban
840 // fixed yet another Prefs bug
841 // added generic PearDb_iter
842 // $request->appendValidators no so strict as before
843 // added some box plugin methods
844 // PageList commalist for condensed output
846 // Revision 1.86 2004/03/12 13:31:43 rurban
847 // enforce PagePermissions, errormsg if not Admin
849 // Revision 1.85 2004/02/17 12:11:36 rurban
850 // 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, ...)
852 // Revision 1.84 2004/02/15 22:29:42 rurban
853 // revert premature performance fix
855 // Revision 1.83 2004/02/15 21:34:37 rurban
856 // PageList enhanced and improved.
857 // fixed new WikiAdmin... plugins
858 // editpage, Theme with exp. htmlarea framework
859 // (htmlarea yet committed, this is really questionable)
860 // WikiUser... code with better session handling for prefs
861 // enhanced UserPreferences (again)
862 // RecentChanges for show_deleted: how should pages be deleted then?
864 // Revision 1.82 2004/01/25 03:58:43 rurban
865 // use stdlib:isWikiWord()
867 // Revision 1.81 2003/11/28 21:06:31 carstenklapp
868 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
869 // instead of 1. Make diff buttons smaller with css. Added description
870 // line back in at the top.
872 // Revision 1.80 2003/11/27 15:17:01 carstenklapp
873 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
874 // button, to allow an image button for it to be added to Themes. Output
875 // RSS button in small text size when theme has no button image.
877 // Revision 1.79 2003/04/29 14:34:20 dairiki
878 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
880 // Revision 1.78 2003/03/04 01:55:05 dairiki
881 // Fix to ensure absolute URL for logo in RSS recent changes.
883 // Revision 1.77 2003/02/27 23:23:38 dairiki
884 // Fix my breakage of CSS and sidebar RecentChanges output.
886 // Revision 1.76 2003/02/27 22:48:44 dairiki
887 // Fixes invalid HTML generated by PageHistory plugin.
889 // (<noscript> is block-level and not allowed within <p>.)
891 // Revision 1.75 2003/02/22 21:39:05 dairiki
892 // Hackish fix for SF bug #622784.
894 // (The root of the problem is clearly a PHP bug.)
896 // Revision 1.74 2003/02/21 22:52:21 dairiki
897 // Make sure to interpret relative links (like [/Subpage]) in summary
898 // relative to correct basepage.
900 // Revision 1.73 2003/02/21 04:12:06 dairiki
901 // Minor fixes for new cached markup.
903 // Revision 1.72 2003/02/17 02:19:01 dairiki
904 // Fix so that PageHistory will work when the current revision
905 // of a page has been "deleted".
907 // Revision 1.71 2003/02/16 20:04:48 dairiki
908 // Refactor the HTTP validator generation/checking code.
910 // This also fixes a number of bugs with yesterdays validator mods.
912 // Revision 1.70 2003/02/16 05:09:43 dairiki
913 // Starting to fix handling of the HTTP validator headers, Last-Modified,
916 // Last-Modified was being set incorrectly (but only when DEBUG was not
917 // defined!) Setting a Last-Modified without setting an appropriate
918 // Expires: and/or Cache-Control: header results in browsers caching
919 // the page unconditionally (for a certain period of time).
920 // This is generally bad, since it means people don't see updated
921 // page contents right away --- this is particularly confusing to
922 // the people who are editing pages since their edits don't show up
923 // next time they browse the page.
925 // Now, we don't allow caching of pages without revalidation
926 // (via the If-Modified-Since and/or If-None-Match request headers.)
927 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
928 // appropriate value in index.php, but I advise against it.)
932 // o Even when request is aborted due to the content not being
933 // modified, we currently still do almost all the work involved
934 // in producing the page. So the only real savings from all
935 // this logic is in network bandwidth.
937 // o Plugins which produce "dynamic" output need to be inspected
938 // and made to call $request->addToETag() and
939 // $request->setModificationTime() appropriately, otherwise the
940 // page can change without the change being detected.
941 // This leads to stale pages in cache again...
943 // Revision 1.69 2003/01/18 22:01:43 carstenklapp
945 // Reformatting & tabs to spaces;
946 // Added copyleft, getVersion, getDescription, rcs_id.
949 // (c-file-style: "gnu")
954 // c-hanging-comment-ender-p: nil
955 // indent-tabs-mode: nil