Revision [5966]

This is an old revision of MovePages made by PolVazo on 2005-02-14 14:57:09.

 

The 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.

<div class="page">
<?php
if ($this->page) {
    if ($this->UserIsOwner() || $this->IsAdmin()) {
        if ($newtag = $_POST["newtag"]) {
            if ($this->LoadPage($newtag)) $error = "Tag <b>".$newtag."</b> 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 "<div class='error'>".$error."</div>";
        print $this->FormOpen("move");
        print "Move page to <input name='newtag' value='".$newtag."' size='40' maxlength='50'> - Keep old page as forwarder <input type='checkbox' name='forwarder' value='1' checked><input type='submit' value='move'>";
        print $this->FormClose();
    } else print "<em>You're not the owner of this page.</em>";
} else print "Page ".$this->tag." doesn't exist.";

?>
</div>
There are 8 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki