Revision [8804]
This is an old revision of RecentChangesAction made by NilsLindenberg on 2005-06-03 17:58:13.
Development page for the Recentchanges action
The action which is (with wikka 1.1.6.0) named "recentchanges" is infact the "recently changed" action (as stated on ImprovedRecentChanges by JavaWoman)
To make a real recentchanges action, I have just copied the code from the "recently changed" action and made the necessary (small) modification. Since all pages are loaded into "a sort of cache", this action definitely needs improvement!
The code
don't forget to rename the old recentchanges.php into recentlychanged.php!actions/recentchanges.php
- <?php
- if ($pages = $this->LoadRecentChanges())
- {
- $curday = "";
- print('<p><link rel="alternate" type="application/rss+xml" title="RSS" href="'.$this->href("recentchanges.xml", $this->page["tag"]).'" ><img src="images/xml.png" width="36" height="14" alt="XML" /></link></p>\n');
- //<a href=\"".$this->href("recentchanges.xml", $this->page["tag"])."\">
- if ($user = $this->GetUser()) {
- $max = $user["changescount"];
- } else {
- $max = 50;
- }
- foreach ($pages as $i => $page)
- {
- if (($i < $max) || !$max)
- {
- // day header
- if ($day != $curday)
- {
- if ($curday) print("</span><br />\n");
- print("<strong>$dateformatted:</strong><br />\n<span class=\"recentchanges\">");
- $curday = $day;
- }
- $page_edited_by = $page["user"];
- if (!$this->LoadUser($page_edited_by)) $page_edited_by .= " (unregistered user)";
- // print entry
- if ($page["note"]) $note=" <span class=\"pagenote\">[".$page["note"]."]</span>"; else $note ="";
- $pagetag = $page["tag"];
- if ($this->HasAccess("read", $pagetag)) {
- print(" (".$this->Link($pagetag, "revisions", $timeformatted, 0, 1, "View recent revisions list for ".$pagetag).") [".$this->Link($pagetag, "history", "history", 0, 1, "View edit history of ".$pagetag)."] - ".$this->Link($pagetag, "", "", 0)." ⇒ $page_edited_by ".$note."<br />");
- } else {
- print(" ($timeformatted) [history] - ".$page["tag"]." ⇒ $page_edited_by ".$note."<br />");
- }
- }
- }
- print "</span>\n";
- $wikipingserver = $this->config["wikiping_server"];
- if ($wikipingserver) {
- $wikipingserver_host = $wikipingserver_url_parsed["host"];
- echo "<br /><br />[WikiPing enabled: Changes on this wiki are broadcast to <a href=\"http://$wikipingserver_host\">http://$wikipingserver_host</a>]";
- }
- }
- ?>
addition to wikka.php (right behind LoadRecentlyChanged)
function LoadRecentChanges()
{
if ($pages = $this->LoadAll("select * from ".$this->config["table_prefix"]."pages order by time desc"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
{
if ($pages = $this->LoadAll("select * from ".$this->config["table_prefix"]."pages order by time desc"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
CategoryDevelopmentActions CategoryDevelopmentCore