==== Wikka Mod 030 ====
Type: Feature Addition
----
===Credit:===
**[[JsnX | Jason Tourtelotte]]**
----
Added the ability to release ownership of a page, so that the ownership is set to nobody.
Completed code is shown below.
**handlers\page\acls.php**
%%(php)
UserIsOwner())
{
if ($_POST)
{
// store lists
$this->SaveAcl($this->GetPageTag(), "read", $_POST["read_acl"]);
$this->SaveAcl($this->GetPageTag(), "write", $_POST["write_acl"]);
$this->SaveAcl($this->GetPageTag(), "comment", $_POST["comment_acl"]);
$message = "Access control lists updated";
// change owner?
$newowner = $_POST["newowner"];
if (($newowner <> "same") and ($this->GetPageOwner($this->GetPageTag()) <> $newowner))
// if ($newowner = $_POST["newowner"])
{
$this->SetPageOwner($this->GetPageTag(), $newowner);
if ($newowner == "") { $newowner = "Nobody"; }
$message .= " and gave ownership to ".$newowner;
}
// redirect back to page
$this->SetMessage($message."!");
$this->Redirect($this->Href());
}
else
{
// load acls
$readACL = $this->LoadAcl($this->GetPageTag(), "read");
$writeACL = $this->LoadAcl($this->GetPageTag(), "write");
$commentACL = $this->LoadAcl($this->GetPageTag(), "comment");
// show form
?>
Access Control Lists for Link($this->GetPageTag()) ?>
FormOpen("acls") ?>
FormClose());
}
}
else
{
print("
You're not the owner of this page.");
}
?>
%%
Modifed the ""SetPageOwner()"" function in **wakka.php**
%%(php)
function SetPageOwner($tag, $user)
{
// check if user exists
if( $user <> '' && ! $this->LoadUser( $user ) ) return;
// updated latest revision with new owner
$this->Query("update ".$this->config["table_prefix"]."pages set owner = '".mysql_escape_string($user)."' where tag = '".mysql_escape_string($tag)."' and latest = 'Y' limit 1");
}
%%