Development page for the Recentchanges action


The action which is (with wikka 1.1.6.0) named "recentchanges" is in fact a "recently changed" action (as stated on ImprovedRecentChanges by JavaWoman)

Last edited by JavaWoman:
Replaces old-style internal links with new pipe-split links.
Fri, 20 May 2016 07:38 UTC [diff]


To make a real recentchanges action, I have just copied the code from the "recently changed" action and made the necessary (small) modification.


The code

don't forget to rename the old recentchanges.php into recentlychanged.php first!

actions/recentchanges.php
  1. <?php
  2.  
  3. if ($user = $this->GetUser()) {
  4.     $max = $user["changescount"];
  5. } else {
  6.     $max = 50;
  7. }
  8.  
  9. if ($pages = $this->LoadRecentChanges($max))
  10. {
  11.     $curday = "";
  12.     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');
  13.     //<a href=\"".$this->href("recentchanges.xml", $this->page["tag"])."\">
  14.  
  15.     foreach ($pages as $i => $page)
  16.     {
  17.             // day header
  18.             list($day, $time) = explode(" ", $page["time"]);
  19.             if ($day != $curday)
  20.             {
  21.                 $dateformatted = date("D, d M Y", strtotime($day));
  22.  
  23.                 if ($curday) print("</span><br />\n");
  24.                 print("<strong>$dateformatted:</strong><br />\n<span class=\"recentchanges\">");
  25.                 $curday = $day;
  26.             }
  27.  
  28.             $timeformatted = date("H:i T", strtotime($page["time"]));
  29.             $page_edited_by = $page["user"];   
  30.             if (!$this->LoadUser($page_edited_by)) $page_edited_by .= " (unregistered user)";
  31.  
  32.             // print entry
  33.             if ($page["note"]) $note=" <span class=\"pagenote\">[".$page["note"]."]</span>"; else $note ="";
  34.             $pagetag = $page["tag"];
  35.             if ($this->HasAccess("read", $pagetag)) {
  36.                     print("&nbsp;&nbsp;&nbsp;&nbsp;(".$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)."] - &nbsp;".$this->Link($pagetag, "", "", 0)." &rArr; $page_edited_by ".$note."<br />");
  37.             } else {
  38.                     print("&nbsp;&nbsp;&nbsp;&nbsp;($timeformatted) [history] - &nbsp;".$page["tag"]." &rArr; $page_edited_by ".$note."<br />");
  39.             }
  40.     }
  41.     print "</span>\n";
  42.  
  43.     $wikipingserver = $this->config["wikiping_server"];
  44.     if ($wikipingserver) {
  45.         $wikipingserver_url_parsed = parse_url($wikipingserver);
  46.         $wikipingserver_host = $wikipingserver_url_parsed["host"];
  47.         echo "<br /><br />[WikiPing enabled: Changes on this wiki are broadcast to <a href=\"http://$wikipingserver_host\">http://$wikipingserver_host</a>]";
  48.     }
  49. }
  50. ?>


addition to wikka.php (right behind LoadRecentlyChanged())

    function LoadRecentChanges($max=50)
    {
        if ($pages = $this->LoadAll("select tag, time, user, note  from ".$this->config["table_prefix"]."pages order by time desc limit ".$max))
        {
            foreach ($pages as $page)
            {
                $this->CachePage($page);
            }
            return $pages;
        }
    }



CategoryDevelopmentActions CategoryDevelopmentCore
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki