==== Move Handler==== >>See also: ~-RefactorWiki ~-PageAdminAction >> The [[Docs:HandlerInfo | handler]] **move.php** assumes that wikka is able to deal with [[RedirectingPages]], and doesn't adjust links pointing to the old page. It can be considered a rename handler. %%(php)
page) { if ($this->UserIsOwner() || $this->IsAdmin()) { if ($newtag = $_POST["newtag"]) { if ($this->LoadPage($newtag)) $error = "Tag ".$newtag." already exists"; if (!$error) { $this->Query("update ".$this->config["table_prefix"]."links set from_tag = '".$newtag."' where from_tag = '".$this->tag."'"); $this->Query("update ".$this->config["table_prefix"]."pages set comment_on = '".$newtag."' where comment_on = '".$this->tag."'"); $this->Query("update ".$this->config["table_prefix"]."pages set tag = '".$newtag."' where tag = '".$this->tag."'"); if ($_POST["forwarder"]) $this->SavePage($this->tag, "=>[[".$newtag."]]", $this->page["comment_on"], "moved to ".$newtag, $this->page["private"]); $this->SetMessage("Page has been moved!"); if ($_POST["forwarder"]) $this->Redirect($this->href()); else $this->Redirect($this->href("", $newtag)); } } if ($error) print "
".$error."
"; print $this->FormOpen("move"); print "Move page to - Keep old page as forwarder "; print $this->FormClose(); } else print "You're not the owner of this page."; } else print "Page ".$this->tag." doesn't exist."; ?>
%% ---- The above code didn't work for me as it uses ##comment_on## (not sure where that comes from...). The following code works in v1.1.5.3. I now have this integrated this with [[PageAdminAction | PageAdmin]]. %%(php)
page) { if ($this->UserIsOwner() || $this->IsAdmin()) { if ($newtag = $_POST["newtag"]) { if ($this->LoadPage($newtag)) $error = "Tag ".$newtag." already exists"; if (!$error) { $this->Query("update ".$this->config["table_prefix"]."links set from_tag = '".$newtag."' where from_tag = '".$this->tag."'"); //$this->Query("update ".$this->config["table_prefix"]."pages set comment_on = '".$newtag."' where comment_on = '".$this->tag."'"); $this->Query("update ".$this->config["table_prefix"]."comments set page_tag = '".$newtag."' where page_tag = '".$this->tag."'"); $this->Query("update ".$this->config["table_prefix"]."pages set tag = '".$newtag."' where tag = '".$this->tag."'"); if ($_POST["forwarder"]) $this->SavePage($this->tag, "=>[[".$newtag."]]", $this->page["comment_on"], "moved to ".$newtag, $this->page["private"]); $this->SetMessage("Page has been moved!"); if ($_POST["forwarder"]) $this->Redirect($this->href()); else $this->Redirect($this->href("", $newtag)); } } if ($error) print "
".$error."
"; print $this->FormOpen("move"); print "Move page to - Keep old page as forwarder "; print $this->FormClose(); } else print "You're not the owner of this page."; } else print "Page ".$this->tag." doesn't exist."; ?>
%% ---- CategoryDevelopmentHandlers