Revision [16763]

This is an old revision of Mod031fSmarterLinking made by KtfBdp on 2007-05-31 10:45:17.

 

Wikka Mod 031

Type: Feature Addition

Credit:

NickK -- Credit for the idea. http://wakka.netdome.biz/WakkaChangelog
Jason Tourtelotte -- Credit for the coding.


Don't link to pages that the viewing user is not allowed to read in PageIndex and RecentChanges.

actions/pageindex.php
<?php

if ($pages = $this->LoadAllPages())
{
    foreach ($pages as $page)
    {
        if (!preg_match("/^Comment/", $page["tag"])) {
            $firstChar = strtoupper($page["tag"][0]);
            if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
                $firstChar = "#";
            }

            if ($firstChar != $curChar) {
                if ($curChar) print("<br />\n");
                print("<strong>$firstChar</strong><br />\n");
                $curChar = $firstChar;
            }

            if ($this->HasAccess("read", $page["tag"])) {
                print($this->Link($page["tag"]));
                }
            else {
                print($page["tag"]);
            }
            if ($page['owner'] != '')
                {                      
                if ($this->UserName() == $page['owner'])
                    print(" . . . . one of your pages.");
                    else {
                    if ($this->HasAccess("read", $page["owner"])) {
                            print(" . . . . Owner: ".$this->Format($page['owner']));
                        }
                    else {
                        print(" . . . . Owner: ".$page['owner']);
                    }
                }
                }

                print("<br />\n"); 
        }
    }
}
else
{
    print("<em>No pages found.</em>");
}

?>


actions/recentchanges.php
%%(php)
<?php
if ($pages = $this->LoadRecentlyChanged())
{
print("<p><a href=\.$this->href(, "xml/recentchanges_".preg_replace("/[^a-zA-Z0-9]/", , strtolower($this->GetConfigValue("wakka_name"))).".xml")."\">.$this->href(, "images/xml.png")."\" width=\"36\" height=\"14\" alt=\"XML\" />\n"); if ($user = $this->GetUser()) { $max = $user["changescount"]; } else { $max = 50; } foreach ($pages as $i => $page) { if (($i < $max) || !$max) { // day header list($day, $time) = explode(" ", $page["time"]); if ($day != $curday) { if ($curday) print("\n"); print("

$day:

\n

"); $curday = $day; } // print entry if ($page[note]) $note=" [".$page["note"]."]"; else $note =

;
if ($this->HasAccess("read", $page["tag"])) {
if ($this->HasAccess("read", $page["user"])) {
print("(".$page["time"].")(".$this->Link($page["tag"], "revisions", "history", 0).") ".$this->Link($page["tag"], , , 0)."
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki