4 Gives a more standard RecentChanges (besides the ewiki built-in
5 "UpdatedPages") in two different variants.
9 $ewiki_plugins["rc"][0] = "ewiki_page_rc_usemod";
10 //$ewiki_plugins["rc"][0] = "ewiki_page_rc_moin";
12 define("EWIKI_PAGE_RECENTCHANGES", "RecentChanges");
14 $ewiki_t["en"]["DAY"] = "%a, %d %b %G";
15 $ewiki_t["en"]["CLOCK"] = "%H:%M";
16 $ewiki_t["de"]["show last"] = "zeige letzte";
17 $ewiki_t["de"]["days"] = "Tage";
21 $ewiki_plugins["page"][EWIKI_PAGE_RECENTCHANGES] = "ewiki_page_recentchanges";
22 function ewiki_page_recentchanges($recentchanges, $data, $action) {
24 global $ewiki_plugins, $ewiki_links;
29 $o .= ewiki_make_title($recentchanges, $recentchanges, 2);
32 $minor_edits = $_GET["minor"]?1:0;
35 if (($days = $_REQUEST["days"]) < 1) {
38 $timeframe = time() - $days * 24 * 3600;
40 #-- fetch pages modified in given timeframe
41 $result = ewiki_db::GETALL(array("meta", "lastmodified", "author"));
44 while ($row = $result->get(0, 0x0137, EWIKI_DB_F_TEXT)) {
46 if ($row["lastmodified"] >= $timeframe) {
50 $changes[$id] = $row["lastmodified"];
52 #-- collect also info for previous changes of current page
54 ewiki_page_rc_more($row, $meta[$id], $timeframe, $minor_edits);
58 #-- sort results into date catalogue
61 $datestr = ewiki_t("DAY");
63 foreach ($changes as $id=>$date) {
65 $date = strftime($datestr, $date);
66 if ($date != $last_date) {
76 $o .= $ewiki_plugins["rc"][0]($e, $meta);
83 $url = ewiki_script("", $recentchanges);
86 <form action="$url" method="GET">
87 <input type="hidden" name="id" value="$recentchanges">
88 _{show last} <input type="text" name="days" value="$days" size="5">
89 <input type="submit" value="_{days}">
100 UseMod like list output
102 function ewiki_page_rc_usemod(&$e, &$meta) {
104 $clockstr = ewiki_t("CLOCK");
106 foreach ($e as $datestr => $pages) {
108 $o .= "\n<h4 class=\"date\">$datestr</h4>\n";
110 foreach ($pages as $id) {
112 $diff = '<a href="'.ewiki_script("diff",$id).'">(diff)</a>';
113 $page = '<a href="'.ewiki_script("",$id).'">'.htmlentities($id).'</a>';
114 $time = strftime($clockstr, $meta[$id][0][2]);
115 $author = ewiki_author_html($meta[$id][0][0], 0);
116 $log = htmlentities($meta[$id][0][1]);
118 if (($n = count($meta[$id])) > 1) {
119 $changes = "($n ".'<a href="'.ewiki_script("info", $id).'">changes</a>)';
127 . ($log ? '<b class="log">[' . $log . ']</b>' : '')
128 . ' . . . . . ' . $author
138 MoinMoin table style changelog output
140 function ewiki_page_rc_moin(&$e, &$meta) {
142 $clockstr = ewiki_t("CLOCK");
144 $o .= '<table class="changes" border="0" width="100%">'
145 . '<colgroup><col width="35%"><col width="5%"><col width="25%"><col width="35%"></colgroup>';
147 foreach ($e as $datestr => $pages) {
148 $o .= "\n<tr><td colspan=\"3\"><br /><h4 class=\"date\">$datestr</h4></td></tr>\n";
149 foreach ($pages as $id) {
151 $link = '<a href="' . ewiki_script("", $id) . '">' . htmlentities($id) . '</a>';
152 $time = strftime($clockstr, $meta[$id][0][2]);
153 $changes = $meta[$id];
154 if (count($changes) >= 2) {
156 #-- enum unique author names
158 foreach ($changes as $i=>$str) {
159 $str = strtok($str[0], " <(");
163 foreach ($a as $author=>$i) {
164 $author = ewiki_author_html($author, 0);
165 $str .= $author. "[".implode(",",$i)."]<br /> ";
171 foreach ($meta[$id] as $i=>$str) {
172 if ($str = $str[1]) {
173 $log .= "#".($i+1)." " . htmlentities($str) . "<br />\n";
178 $author = ewiki_author_html($meta[$id][0][0]);
179 $log = htmlentities($meta[$id][0][1]);
182 $o .= '<tr><td class="page"> · ' . $link . '</td>'
183 . '<td class="time"> [' . $time . '] </td>'
184 . '<td class="author">' . $author . '</td>'
185 . '<td class="log">' . $log . '</td></tr>' . "\n";
194 fills $list with changeLOG entries of previous page ($row) versions
196 function ewiki_page_rc_more(&$row, &$list, $timeframe, $minor_edits) {
199 $ver = $row["version"];
202 if ($row["lastmodified"] >= $timeframe) {
203 if ($minor_edits || !($row["flags"] & EWIKI_DB_F_MINOR)) {
206 1 => $row["meta"]["log"],
207 2 => $row["lastmodified"],
216 if (!$ver || !($row = ewiki_db::GET($id, $ver))) {
217 return; // stops at revision holes