2 rcs_id('$Id: RecentChanges.php,v 1.110 2007-01-22 23:51:36 rurban Exp $');
4 Copyright 1999,2000,2001,2002,2007 $ThePhpWikiProgrammingTeam
6 This file is part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 class _RecentChanges_Formatter
27 var $_absurls = false;
29 function _RecentChanges_Formatter ($rc_args) {
30 $this->_args = $rc_args;
31 $this->_diffargs = array('action' => 'diff');
33 if ($rc_args['show_minor'] || !$rc_args['show_major'])
34 $this->_diffargs['previous'] = 'minor';
36 // PageHistoryPlugin doesn't have a 'daylist' arg.
37 if (!isset($this->_args['daylist']))
38 $this->_args['daylist'] = false;
41 function include_versions_in_URLs() {
42 return (bool) $this->_args['show_all'];
45 function date ($rev) {
47 return $WikiTheme->getDay($rev->get('mtime'));
50 function time ($rev) {
52 return $WikiTheme->formatTime($rev->get('mtime'));
55 function diffURL ($rev) {
56 $args = $this->_diffargs;
57 if ($this->include_versions_in_URLs())
58 $args['version'] = $rev->getVersion();
59 $page = $rev->getPage();
60 return WikiURL($page->getName(), $args, $this->_absurls);
63 function historyURL ($rev) {
64 $page = $rev->getPage();
65 return WikiURL($page, array('action' => _("PageHistory")),
69 function pageURL ($rev) {
70 return WikiURL($this->include_versions_in_URLs() ? $rev : $rev->getPage(),
74 function authorHasPage ($author) {
75 global $WikiNameRegexp, $request;
76 $dbi = $request->getDbh();
77 return isWikiWord($author) && $dbi->isWikiPage($author);
80 function authorURL ($author) {
81 return $this->authorHasPage() ? WikiURL($author) : false;
85 function status ($rev) {
86 if ($rev->hasDefaultContents())
88 $page = $rev->getPage();
89 $prev = $page->getRevisionBefore($rev->getVersion());
90 if ($prev->hasDefaultContents())
95 function importance ($rev) {
96 return $rev->get('is_minor_edit') ? 'minor' : 'major';
99 function summary($rev) {
100 if ( ($summary = $rev->get('summary')) )
103 switch ($this->status($rev)) {
107 return _("New page");
113 function setValidators($most_recent_rev) {
114 $rev = $most_recent_rev;
115 $validators = array('RecentChanges-top' =>
116 array($rev->getPageName(), $rev->getVersion()),
117 '%mtime' => $rev->get('mtime'));
119 $request->appendValidators($validators);
123 class _RecentChanges_HtmlFormatter
124 extends _RecentChanges_Formatter
126 function diffLink ($rev) {
128 $button = $WikiTheme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action');
129 $button->setAttr('rel', 'nofollow');
133 function historyLink ($rev) {
135 return $WikiTheme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action');
138 function pageLink ($rev, $link_text=false) {
140 return WikiLink($this->include_versions_in_URLs() ? $rev : $rev->getPage(),'auto',$link_text);
142 $page = $rev->getPage();
144 if ($this->include_versions_in_URLs()) {
145 $version = $rev->getVersion();
146 if ($rev->isCurrent())
148 $exists = !$rev->hasDefaultContents();
152 $cur = $page->getCurrentRevision();
153 $exists = !$cur->hasDefaultContents();
156 return $WikiTheme->linkExistingWikiWord($page->getName(), $link_text, $version);
158 return $WikiTheme->linkUnknownWikiWord($page->getName(), $link_text);
162 function authorLink ($rev) {
163 $author = $rev->get('author');
164 if ( $this->authorHasPage($author) ) {
165 return WikiLink($author);
170 function summaryAsHTML ($rev) {
171 if ( !($summary = $this->summary($rev)) )
173 return HTML::strong( array('class' => 'wiki-summary'),
175 TransformLinks($summary, $rev->get('markup'), $rev->getPageName()),
179 function rss_icon () {
180 global $request, $WikiTheme;
182 $rss_url = $request->getURLtoSelf(array('format' => 'rss'));
183 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
184 $WikiTheme->makeButton("RSS", $rss_url, 'rssicon'));
186 function rss2_icon () {
187 global $request, $WikiTheme;
189 $rss_url = $request->getURLtoSelf(array('format' => 'rss2'));
190 return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'),
191 $WikiTheme->makeButton("RSS2", $rss_url, 'rssicon'));
194 function pre_description () {
195 extract($this->_args);
196 // FIXME: say something about show_all.
197 if ($show_major && $show_minor)
200 $edits = _("major edits");
202 $edits = _("minor edits");
203 if (isset($caption) and $caption == _("Recent Comments"))
204 $edits = _("comments");
206 $edits = _("created new pages");
208 if ($timespan = $days > 0) {
209 if (intval($days) != $days)
210 $days = sprintf("%.1f", $days);
214 * Depending how this text is split up it can be tricky or
215 * impossible to translate with good grammar. So the seperate
216 * strings for 1 day and %s days are necessary in this case
217 * for translating to multiple languages, due to differing
218 * overlapping ideal word cutting points.
220 * en: day/days "The %d most recent %s [during (the past] day) are listed below."
221 * de: 1 Tag "Die %d jüngste %s [innerhalb (von des letzten] Tages) sind unten aufgelistet."
222 * de: %s days "Die %d jüngste %s [innerhalb (von] %s Tagen) sind unten aufgelistet."
224 * en: day/days "The %d most recent %s during [the past] (day) are listed below."
225 * fr: 1 jour "Les %d %s les plus récentes pendant [le dernier (d'une] jour) sont énumérées ci-dessous."
226 * fr: %s jours "Les %d %s les plus récentes pendant [les derniers (%s] jours) sont énumérées ci-dessous."
230 if (intval($days) == 1)
231 $desc = fmt("The %d most recent %s during the past day are listed below.",
234 $desc = fmt("The %d most recent %s during the past %s days are listed below.",
235 $limit, $edits, $days);
237 $desc = fmt("The %d most recent %s are listed below.",
240 elseif ($limit < 0) { //$limit < 0 means we want oldest pages
242 if (intval($days) == 1)
243 $desc = fmt("The %d oldest %s during the past day are listed below.",
246 $desc = fmt("The %d oldest %s during the past %s days are listed below.",
247 $lmt, $edits, $days);
249 $desc = fmt("The %d oldest %s are listed below.",
255 if (intval($days) == 1)
256 $desc = fmt("The most recent %s during the past day are listed below.",
259 $desc = fmt("The most recent %s during the past %s days are listed below.",
262 $desc = fmt("All %s are listed below.", $edits);
267 function description() {
268 return HTML::p(false, $this->pre_description());
273 extract($this->_args);
274 return array($show_minor ? _("RecentEdits") : _("RecentChanges"),
276 $this->rss_icon(), HTML::raw(' '), $this->rss2_icon(),
277 $this->sidebar_link());
280 function empty_message () {
281 if (isset($this->_args['caption']) and $this->_args['caption'] == _("Recent Comments"))
282 return _("No comments found");
284 return _("No changes found");
287 function sidebar_link() {
288 extract($this->_args);
289 $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
292 $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
295 "function addPanel() {\n"
296 ." window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n"
297 ." \"$sidebarurl\",\"\");\n"
299 $jsf = JavaScript($addsidebarjsfunc);
302 $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
303 $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
304 $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n"
305 ." (typeof window.sidebar.addPanel == 'function'))\n"
307 ." document.write('$addsidebarjsclick');\n"
310 return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
313 function format ($changes) {
314 include_once('lib/InlineParser.php');
316 $html = HTML(HTML::h2(false, $this->title()));
317 if (($desc = $this->description()))
318 $html->pushContent($desc);
320 if ($this->_args['daylist'])
321 $html->pushContent(new DayButtonBar($this->_args));
327 while ($rev = $changes->next()) {
328 if (($date = $this->date($rev)) != $last_date) {
330 $html->pushContent($lines);
331 $html->pushContent(HTML::h3($date));
336 // enforce view permission
337 if (mayAccessPage('view', $rev->_pagename)) {
338 $lines->pushContent($this->format_revision($rev));
341 $this->setValidators($rev);
346 $html->pushContent($lines);
348 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
349 $this->empty_message()));
354 function format_revision ($rev) {
355 $args = &$this->_args;
357 $class = 'rc-' . $this->importance($rev);
359 $time = $this->time($rev);
360 if (! $rev->get('is_minor_edit'))
361 $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
363 $line = HTML::li(array('class' => $class));
366 if ($args['difflinks'])
367 $line->pushContent($this->diffLink($rev), ' ');
369 if ($args['historylinks'])
370 $line->pushContent($this->historyLink($rev), ' ');
372 $line->pushContent($this->pageLink($rev), ' ',
374 $this->summaryAsHTML($rev),
376 $this->authorLink($rev));
382 class _RecentChanges_SideBarFormatter
383 extends _RecentChanges_HtmlFormatter
385 function rss_icon () {
388 function rss2_icon () { }
390 //title click opens the normal RC or RE page in the main browser frame
391 extract($this->_args);
392 $titlelink = WikiLink($show_minor ? _("RecentEdits") : _("RecentChanges"));
393 $titlelink->setAttr('target', '_content');
394 return HTML($this->logo(), $titlelink);
397 //logo click opens the HomePage in the main browser frame
399 $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'),
402 'style' => 'height:2.5ex'
404 $linkurl = WikiLink(HOME_PAGE, false, $img);
405 $linkurl->setAttr('target', '_content');
409 function authorLink ($rev) {
410 $author = $rev->get('author');
411 if ( $this->authorHasPage($author) ) {
412 $linkurl = WikiLink($author);
413 $linkurl->setAttr('target', '_content'); // way to do this using parent::authorLink ??
419 function diffLink ($rev) {
420 $linkurl = parent::diffLink($rev);
421 $linkurl->setAttr('target', '_content');
422 $linkurl->setAttr('rel', 'nofollow');
423 // FIXME: Smelly hack to get smaller diff buttons in sidebar
424 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
427 function historyLink ($rev) {
428 $linkurl = parent::historyLink($rev);
429 $linkurl->setAttr('target', '_content');
430 // FIXME: Smelly hack to get smaller history buttons in sidebar
431 $linkurl = new RawXML(str_replace('<img ', '<img style="height:2ex" ', asXML($linkurl)));
434 function pageLink ($rev) {
435 $linkurl = parent::pageLink($rev);
436 $linkurl->setAttr('target', '_content');
439 // Overriding summaryAsHTML, because there is no way yet to
440 // return summary as transformed text with
441 // links setAttr('target', '_content') in Mozilla sidebar.
442 // So for now don't create clickable links inside summary
443 // in the sidebar, or else they target the sidebar and not the
444 // main content window.
445 function summaryAsHTML ($rev) {
446 if ( !($summary = $this->summary($rev)) )
448 return HTML::strong(array('class' => 'wiki-summary'),
450 /*TransformLinks(*/$summary,/* $rev->get('markup')),*/
455 function format ($changes) {
456 $this->_args['daylist'] = false; //don't show day buttons in Mozilla sidebar
457 $html = _RecentChanges_HtmlFormatter::format ($changes);
458 $html = HTML::div(array('class' => 'wikitext'), $html);
460 $request->discardOutput();
462 printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", $GLOBALS['charset']);
463 printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
464 printf(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
465 printf('<html xmlns="http://www.w3.org/1999/xhtml">');
468 extract($this->_args);
469 $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges");
470 printf("<title>" . $title . "</title>\n");
472 $css = $WikiTheme->getCSS();
476 printf("<body class=\"sidebar\">\n");
478 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>';
479 printf("\n</body>\n");
482 $request->finish(); // cut rest of page processing short
486 class _RecentChanges_BoxFormatter
487 extends _RecentChanges_HtmlFormatter
489 function rss_icon () {
491 function rss2_icon () {
495 function authorLink ($rev) {
497 function diffLink ($rev) {
499 function historyLink ($rev) {
501 function summaryAsHTML ($rev) {
503 function description () {
505 function format ($changes) {
506 include_once('lib/InlineParser.php');
511 $sp = HTML::Raw("\n · ");
512 while ($rev = $changes->next()) {
513 // enforce view permission
514 if (mayAccessPage('view',$rev->_pagename)) {
515 if ($link = $this->pageLink($rev)) // some entries may be empty
516 // (/Blog/.. interim pages)
517 $html->pushContent($sp, $link, HTML::br());
519 $this->setValidators($rev);
524 $html->pushContent(HTML::p(array('class' => 'rc-empty'),
525 $this->empty_message()));
530 class _RecentChanges_RssFormatter
531 extends _RecentChanges_Formatter
533 var $_absurls = true;
535 function time ($rev) {
536 return Iso8601DateTime($rev->get('mtime'));
539 function pageURI ($rev) {
540 return WikiURL($rev, '', 'absurl');
543 function format ($changes) {
545 include_once('lib/RssWriter.php');
546 $rss = new RssWriter;
548 $rss->channel($this->channel_properties());
550 if (($props = $this->image_properties()))
552 if (($props = $this->textinput_properties()))
553 $rss->textinput($props);
556 while ($rev = $changes->next()) {
557 // enforce view permission
558 if (mayAccessPage('view', $rev->_pagename)) {
559 $rss->addItem($this->item_properties($rev),
560 $this->pageURI($rev));
562 $this->setValidators($rev);
568 $request->discardOutput();
570 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
572 // Flush errors in comment, otherwise it's invalid XML.
573 global $ErrorManager;
574 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
575 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
577 $request->finish(); // NORETURN!!!!
580 function image_properties () {
583 $img_url = AbsoluteURL($WikiTheme->getImageURL('logo'));
587 return array('title' => WIKI_NAME,
588 'link' => WikiURL(HOME_PAGE, false, 'absurl'),
592 function textinput_properties () {
593 return array('title' => _("Search"),
594 'description' => _("Title Search"),
596 'link' => WikiURL(_("TitleSearch"), false, 'absurl'));
599 function channel_properties () {
602 $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
603 return array('title' => WIKI_NAME,
605 'description' => _("RecentChanges"),
606 'dc:date' => Iso8601DateTime(time()),
607 'dc:language' => $GLOBALS['LANG']);
609 /* FIXME: other things one might like in <channel>:
618 * rss091:managingEditor
620 * rss091:lastBuildDate
625 function item_properties ($rev) {
626 $page = $rev->getPage();
627 $pagename = $page->getName();
629 return array( 'title' => SplitPagename($pagename),
630 'description' => $this->summary($rev),
631 'link' => $this->pageURL($rev),
632 'dc:date' => $this->time($rev),
633 'dc:contributor' => $rev->get('author'),
634 'wiki:version' => $rev->getVersion(),
635 'wiki:importance' => $this->importance($rev),
636 'wiki:status' => $this->status($rev),
637 'wiki:diff' => $this->diffURL($rev),
638 'wiki:history' => $this->historyURL($rev)
643 /** explicit application/rss+xml Content-Type,
644 * simplified xml structure (no namespace),
645 * support for xml-rpc cloud registerProcedure (not yet)
647 class _RecentChanges_Rss2Formatter
648 extends _RecentChanges_RssFormatter {
650 function format ($changes) {
651 include_once('lib/RssWriter2.php');
652 $rss = new RssWriter2;
654 $rss->channel($this->channel_properties());
655 if (($props = $this->cloud_properties()))
657 if (($props = $this->image_properties()))
659 if (($props = $this->textinput_properties()))
660 $rss->textinput($props);
662 while ($rev = $changes->next()) {
663 // enforce view permission
664 if (mayAccessPage('view', $rev->_pagename)) {
665 $rss->addItem($this->item_properties($rev),
666 $this->pageURI($rev));
668 $this->setValidators($rev);
674 $request->discardOutput();
676 printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
677 // Flush errors in comment, otherwise it's invalid XML.
678 global $ErrorManager;
679 if (($errors = $ErrorManager->getPostponedErrorsAsHTML()))
680 printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
682 $request->finish(); // NORETURN!!!!
685 function channel_properties () {
686 $chann_10 = parent::channel_properties();
687 return array_merge($chann_10,
688 array('generator' => 'PhpWiki-'.PHPWIKI_VERSION,
689 //<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
690 //<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
691 //<docs>http://blogs.law.harvard.edu/tech/rss</docs>
692 'copyright' => COPYRIGHTPAGE_URL
696 function cloud_properties () { return false; } // xml-rpc registerProcedure not yet implemented
697 function cloud_properties_test () {
698 return array('protocol' => 'xml-rpc', // xml-rpc or soap or http-post
699 'registerProcedure' => 'wiki.rssPleaseNotify',
700 'path' => DATA_PATH.'/RPC2.php',
701 'port' => !SERVER_PORT ? '80' : (SERVER_PROTOCOL == 'https' ? '443' : '80'),
702 'domain' => SERVER_NAME);
706 class NonDeletedRevisionIterator extends WikiDB_PageRevisionIterator
710 * @param $revisions object a WikiDB_PageRevisionIterator.
712 function NonDeletedRevisionIterator ($revisions, $check_current_revision = true) {
713 $this->_revisions = $revisions;
714 $this->_check_current_revision = $check_current_revision;
718 while (($rev = $this->_revisions->next())) {
719 if ($this->_check_current_revision) {
720 $page = $rev->getPage();
721 $check_rev = $page->getCurrentRevision();
726 if (! $check_rev->hasDefaultContents())
736 * only_new: Only new created pages
738 class NewPageRevisionIterator extends WikiDB_PageRevisionIterator
742 * @param $revisions object a WikiDB_PageRevisionIterator.
744 function NewPageRevisionIterator ($revisions) {
745 $this->_revisions = $revisions;
749 while (($rev = $this->_revisions->next())) {
750 if ($rev->getVersion() == 1)
759 class WikiPlugin_RecentChanges
762 function getName () {
763 return _("RecentChanges");
766 function getVersion() {
767 return preg_replace("/[Revision: $]/", '',
768 "\$Revision: 1.110 $");
771 function managesValidators() {
772 // Note that this is a bit of a fig.
773 // We set validators based on the most recently changed page,
774 // but this fails when the most-recent page is deleted.
775 // (Consider that the Last-Modified time will decrease
776 // when this happens.)
778 // We might be better off, leaving this as false (and junking
779 // the validator logic above) and just falling back to the
780 // default behavior (handled by WikiPlugin) of just using
781 // the WikiDB global timestamp as the mtime.
783 // Nevertheless, for now, I leave this here, mostly as an
784 // example for how to use appendValidators() and managesValidators().
789 function getDefaultArguments() {
790 return array('days' => 2,
791 'show_minor' => false,
792 'show_major' => true,
794 'show_deleted' => 'sometimes',
800 'historylinks' => false,
805 function getArgs ($argstr, $request, $defaults = false) {
806 if (!$defaults) $defaults = $this->getDefaultArguments();
807 $args = WikiPlugin::getArgs($argstr, $request, $defaults);
809 $action = $request->getArg('action');
810 if ($action != 'browse' && ! $request->isActionPage($action))
811 $args['format'] = false; // default -> HTML
813 if ($args['format'] == 'rss' && empty($args['limit']))
814 $args['limit'] = 15; // Fix default value for RSS.
815 if ($args['format'] == 'rss2' && empty($args['limit']))
816 $args['limit'] = 15; // Fix default value for RSS2.
818 if ($args['format'] == 'sidebar' && empty($args['limit']))
819 $args['limit'] = 10; // Fix default value for sidebar.
824 function getMostRecentParams ($args) {
827 $params = array('include_minor_revisions' => $show_minor,
828 'exclude_major_revisions' => !$show_major,
829 'include_all_revisions' => !empty($show_all));
831 $params['limit'] = $limit;
834 $params['since'] = time() - 24 * 3600 * $days;
836 $params['since'] = 24 * 3600 * $days - time();
841 function getChanges ($dbi, $args) {
842 $changes = $dbi->mostRecent($this->getMostRecentParams($args));
844 $show_deleted = $args['show_deleted'];
845 if ($show_deleted == 'sometimes')
846 $show_deleted = $args['show_minor'];
848 if ($args['only_new'])
849 $changes = new NewPageRevisionIterator($changes);
850 elseif (!$show_deleted)
851 $changes = new NonDeletedRevisionIterator($changes, !$args['show_all']);
856 function format ($changes, $args) {
858 $format = $args['format'];
860 $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format);
862 if ($format == 'rss')
863 $fmt_class = '_RecentChanges_RssFormatter';
864 elseif ($format == 'rss2')
865 $fmt_class = '_RecentChanges_Rss2Formatter';
866 elseif ($format == 'rss091') {
867 include_once "lib/RSSWriter091.php";
868 $fmt_class = '_RecentChanges_RssFormatter091';
870 elseif ($format == 'sidebar')
871 $fmt_class = '_RecentChanges_SideBarFormatter';
872 elseif ($format == 'box')
873 $fmt_class = '_RecentChanges_BoxFormatter';
875 $fmt_class = '_RecentChanges_HtmlFormatter';
878 $fmt = new $fmt_class($args);
879 return $fmt->format($changes);
882 function run($dbi, $argstr, &$request, $basepage) {
883 $args = $this->getArgs($argstr, $request);
885 // HACKish: fix for SF bug #622784 (1000 years of RecentChanges ought
886 // to be enough for anyone.)
887 $args['days'] = min($args['days'], 365000);
889 // Hack alert: format() is a NORETURN for rss formatters.
890 return $this->format($this->getChanges($dbi, $args), $args);
893 // box is used to display a fixed-width, narrow version with common header.
894 // just a numbered list of limit pagenames, without date.
895 function box($args = false, $request = false, $basepage = false) {
896 if (!$request) $request =& $GLOBALS['request'];
897 if (!isset($args['limit'])) $args['limit'] = 15;
898 $args['format'] = 'box';
899 $args['show_minor'] = false;
900 $args['show_major'] = true;
901 $args['show_deleted'] = 'sometimes';
902 $args['show_all'] = false;
904 return $this->makeBox(WikiLink($this->getName(),'',SplitPagename($this->getName())),
905 $this->format($this->getChanges($request->_dbi, $args), $args));
911 class DayButtonBar extends HtmlElement {
913 function DayButtonBar ($plugin_args) {
914 $this->__construct('p', array('class' => 'wiki-rc-action'));
916 // Display days selection buttons
917 extract($plugin_args);
922 $caption = _("Show minor edits for:");
924 $caption = _("Show all changes for:");
926 $caption = _("Show changes for:");
928 $caption = _("All new pages since:");
931 $this->pushContent($caption, ' ');
934 $sep = $WikiTheme->getButtonSeparator();
937 foreach (explode(",", $daylist) as $days) {
939 $this->pushContent($sep);
940 $this->pushContent($this->_makeDayButton($days));
944 function _makeDayButton ($days) {
945 global $WikiTheme, $request;
950 $label = "..."; //alldays
952 $label = sprintf(_("%s days"), abs($days));
954 $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days));
956 return $WikiTheme->makeButton($label, $url, 'wiki-rc-action');
960 // $Log: not supported by cvs2svn $
961 // Revision 1.109 2006/03/19 14:26:29 rurban
962 // sf.net patch by Matt Brown: Add rel=nofollow to more actions
964 // Revision 1.108 2005/04/01 16:09:35 rurban
965 // fix defaults in RecentChanges plugins: e.g. invalid pagenames for PageHistory
967 // Revision 1.107 2005/02/04 13:45:28 rurban
968 // improve box layout a bit
970 // Revision 1.106 2005/02/02 19:39:10 rurban
971 // honor show_all=false
973 // Revision 1.105 2005/01/25 03:50:54 uckelman
974 // pre_description is a member function, so call with $this->.
976 // Revision 1.104 2005/01/24 23:15:16 uckelman
977 // The extra description for RelatedChanges was appearing in RecentChanges
978 // and PageHistory due to a bad test in _RecentChanges_HtmlFormatter. Fixed.
980 // Revision 1.103 2004/12/15 17:45:09 rurban
983 // Revision 1.102 2004/12/06 19:29:24 rurban
984 // simplify RSS: add RSS2 link (rss tag only, new content-type)
986 // Revision 1.101 2004/11/10 19:32:24 rurban
987 // * optimize increaseHitCount, esp. for mysql.
988 // * prepend dirs to the include_path (phpwiki_dir for faster searches)
989 // * Pear_DB version logic (awful but needed)
990 // * fix broken ADODB quote
991 // * _extract_page_data simplification
993 // Revision 1.100 2004/06/28 16:35:12 rurban
994 // prevent from shell commands
996 // Revision 1.99 2004/06/20 14:42:54 rurban
997 // various php5 fixes (still broken at blockparser)
999 // Revision 1.98 2004/06/14 11:31:39 rurban
1000 // renamed global $Theme to $WikiTheme (gforge nameclash)
1001 // inherit PageList default options from PageList
1002 // default sortby=pagename
1003 // use options in PageList_Selectable (limit, sortby, ...)
1004 // added action revert, with button at action=diff
1005 // added option regex to WikiAdminSearchReplace
1007 // Revision 1.97 2004/06/03 18:58:27 rurban
1008 // days links requires action=RelatedChanges arg
1010 // Revision 1.96 2004/05/18 16:23:40 rurban
1011 // rename split_pagename to SplitPagename
1013 // Revision 1.95 2004/05/16 22:07:35 rurban
1014 // check more config-default and predefined constants
1015 // various PagePerm fixes:
1016 // fix default PagePerms, esp. edit and view for Bogo and Password users
1017 // implemented Creator and Owner
1018 // BOGOUSERS renamed to BOGOUSER
1019 // fixed syntax errors in signin.tmpl
1021 // Revision 1.94 2004/05/14 20:55:03 rurban
1022 // simplified RecentComments
1024 // Revision 1.93 2004/05/14 17:33:07 rurban
1025 // new plugin RecentChanges
1027 // Revision 1.92 2004/04/21 04:29:10 rurban
1028 // Two convenient RecentChanges extensions
1029 // RelatedChanges (only links from current page)
1030 // RecentEdits (just change the default args)
1032 // Revision 1.91 2004/04/19 18:27:46 rurban
1033 // Prevent from some PHP5 warnings (ref args, no :: object init)
1034 // php5 runs now through, just one wrong XmlElement object init missing
1035 // Removed unneccesary UpgradeUser lines
1036 // Changed WikiLink to omit version if current (RecentChanges)
1038 // Revision 1.90 2004/04/18 01:11:52 rurban
1039 // more numeric pagename fixes.
1040 // fixed action=upload with merge conflict warnings.
1041 // charset changed from constant to global (dynamic utf-8 switching)
1043 // Revision 1.89 2004/04/10 02:30:49 rurban
1044 // Fixed gettext problem with VIRTUAL_PATH scripts (Windows only probably)
1045 // Fixed "cannot setlocale..." (sf.net problem)
1047 // Revision 1.88 2004/04/01 15:57:10 rurban
1048 // simplified Sidebar theme: table, not absolute css positioning
1049 // added the new box methods.
1050 // remaining problems: large left margin, how to override _autosplitWikiWords in Template only
1052 // Revision 1.87 2004/03/30 02:14:03 rurban
1053 // fixed yet another Prefs bug
1054 // added generic PearDb_iter
1055 // $request->appendValidators no so strict as before
1056 // added some box plugin methods
1057 // PageList commalist for condensed output
1059 // Revision 1.86 2004/03/12 13:31:43 rurban
1060 // enforce PagePermissions, errormsg if not Admin
1062 // Revision 1.85 2004/02/17 12:11:36 rurban
1063 // 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, ...)
1065 // Revision 1.84 2004/02/15 22:29:42 rurban
1066 // revert premature performance fix
1068 // Revision 1.83 2004/02/15 21:34:37 rurban
1069 // PageList enhanced and improved.
1070 // fixed new WikiAdmin... plugins
1071 // editpage, Theme with exp. htmlarea framework
1072 // (htmlarea yet committed, this is really questionable)
1073 // WikiUser... code with better session handling for prefs
1074 // enhanced UserPreferences (again)
1075 // RecentChanges for show_deleted: how should pages be deleted then?
1077 // Revision 1.82 2004/01/25 03:58:43 rurban
1078 // use stdlib:isWikiWord()
1080 // Revision 1.81 2003/11/28 21:06:31 carstenklapp
1081 // Enhancement: Mozilla RecentChanges sidebar now defaults to 10 changes
1082 // instead of 1. Make diff buttons smaller with css. Added description
1083 // line back in at the top.
1085 // Revision 1.80 2003/11/27 15:17:01 carstenklapp
1086 // Theme & appearance tweaks: Converted Mozilla sidebar link into a Theme
1087 // button, to allow an image button for it to be added to Themes. Output
1088 // RSS button in small text size when theme has no button image.
1090 // Revision 1.79 2003/04/29 14:34:20 dairiki
1091 // Bug fix: "add sidebar" link didn't work when USE_PATH_INFO was false.
1093 // Revision 1.78 2003/03/04 01:55:05 dairiki
1094 // Fix to ensure absolute URL for logo in RSS recent changes.
1096 // Revision 1.77 2003/02/27 23:23:38 dairiki
1097 // Fix my breakage of CSS and sidebar RecentChanges output.
1099 // Revision 1.76 2003/02/27 22:48:44 dairiki
1100 // Fixes invalid HTML generated by PageHistory plugin.
1102 // (<noscript> is block-level and not allowed within <p>.)
1104 // Revision 1.75 2003/02/22 21:39:05 dairiki
1105 // Hackish fix for SF bug #622784.
1107 // (The root of the problem is clearly a PHP bug.)
1109 // Revision 1.74 2003/02/21 22:52:21 dairiki
1110 // Make sure to interpret relative links (like [/Subpage]) in summary
1111 // relative to correct basepage.
1113 // Revision 1.73 2003/02/21 04:12:06 dairiki
1114 // Minor fixes for new cached markup.
1116 // Revision 1.72 2003/02/17 02:19:01 dairiki
1117 // Fix so that PageHistory will work when the current revision
1118 // of a page has been "deleted".
1120 // Revision 1.71 2003/02/16 20:04:48 dairiki
1121 // Refactor the HTTP validator generation/checking code.
1123 // This also fixes a number of bugs with yesterdays validator mods.
1125 // Revision 1.70 2003/02/16 05:09:43 dairiki
1126 // Starting to fix handling of the HTTP validator headers, Last-Modified,
1129 // Last-Modified was being set incorrectly (but only when DEBUG was not
1130 // defined!) Setting a Last-Modified without setting an appropriate
1131 // Expires: and/or Cache-Control: header results in browsers caching
1132 // the page unconditionally (for a certain period of time).
1133 // This is generally bad, since it means people don't see updated
1134 // page contents right away --- this is particularly confusing to
1135 // the people who are editing pages since their edits don't show up
1136 // next time they browse the page.
1138 // Now, we don't allow caching of pages without revalidation
1139 // (via the If-Modified-Since and/or If-None-Match request headers.)
1140 // (You can allow caching by defining CACHE_CONTROL_MAX_AGE to an
1141 // appropriate value in index.php, but I advise against it.)
1145 // o Even when request is aborted due to the content not being
1146 // modified, we currently still do almost all the work involved
1147 // in producing the page. So the only real savings from all
1148 // this logic is in network bandwidth.
1150 // o Plugins which produce "dynamic" output need to be inspected
1151 // and made to call $request->addToETag() and
1152 // $request->setModificationTime() appropriately, otherwise the
1153 // page can change without the change being detected.
1154 // This leads to stale pages in cache again...
1156 // Revision 1.69 2003/01/18 22:01:43 carstenklapp
1158 // Reformatting & tabs to spaces;
1159 // Added copyleft, getVersion, getDescription, rcs_id.
1162 // (c-file-style: "gnu")
1166 // c-basic-offset: 4
1167 // c-hanging-comment-ender-p: nil
1168 // indent-tabs-mode: nil