Пример #1
0
if ($command == "EditSave") {
    // if the editor is a user, look up their name for the edit log
    if ($userID != 0) {
        $dbStatement = Util::getDbConnection()->prepare("SELECT UserName FROM User WHERE UserID = :userID");
        $dbStatement->bindParam(":userID", $userID, PDO::PARAM_INT);
        $dbStatement->execute();
        $row = $dbStatement->fetch(PDO::FETCH_NUM);
        if (!$row) {
            throw new HardStoryException("Unable to fetch user row from the database.");
        }
        $userName = $row[0];
    } else {
        $userName = "******";
    }
    // save the previous episode into the edit log
    Util::createEpisodeEditLog($episode, "Edited by " . $userName . ".");
    $linkableValue = $linkable == 1 ? "Y" : "N";
    $extendableValue = $extendable == 1 ? "Y" : "N";
    $mailtoValue = $mailto == 1 ? "Y" : "N";
    $notifyValue = $notify == 1 ? "Y" : "N";
    $dbStatement = Util::getDbConnection()->prepare("UPDATE Episode " . "SET EditorSessionID   = :sessionID, " . "SchemeID          = :scheme, " . "Status            = 2, " . "IsLinkable        = :linkableValue, " . "IsExtendable      = :extendableValue, " . "AuthorMailto      = :mailtoValue, " . "AuthorNotify      = :notifyValue, " . "Title             = :title, " . "Text              = :text, " . "AuthorName        = :authorName, " . "AuthorEmail       = :authorEmail, " . "LockDate          = '', " . "LockKey           = 0, " . "CreationTimestamp = now() " . "WHERE EpisodeID = :episode");
    $dbStatement->bindParam(":sessionID", $sessionID, PDO::PARAM_INT);
    $dbStatement->bindParam(":scheme", $scheme, PDO::PARAM_INT);
    $dbStatement->bindParam(":linkableValue", $linkableValue, PDO::PARAM_STR);
    $dbStatement->bindParam(":extendableValue", $extendableValue, PDO::PARAM_STR);
    $dbStatement->bindParam(":mailtoValue", $mailtoValue, PDO::PARAM_STR);
    $dbStatement->bindParam(":notifyValue", $notifyValue, PDO::PARAM_STR);
    $dbStatement->bindParam(":title", $title, PDO::PARAM_STR);
    $dbStatement->bindParam(":text", $text, PDO::PARAM_STR);
    $dbStatement->bindParam(":authorName", $authorName, PDO::PARAM_STR);
    $dbStatement->bindParam(":authorEmail", $authorEmail, PDO::PARAM_STR);
Пример #2
0
            throw new HardStoryException("Problem deleting episode from database.");
        }
        $dbStatement = Util::getDbConnection()->prepare("UPDATE Link " . "SET IsCreated = 'N' " . "WHERE TargetEpisodeID = :episode");
        $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT);
        $dbStatement->execute();
        if ($dbStatement->rowCount() != 1) {
            throw new HardStoryException("Problem resetting link IsCreated status.");
        }
        $command = "Done";
        $message = "Episode Deleted";
    } else {
        $command = "DeleteEpisode";
    }
}
if ($command == "RevokeAuthorSave") {
    Util::createEpisodeEditLog($episode, "Author's edit permission revoked by " . $userName . ".");
    $dbStatement = Util::getDbConnection()->prepare("UPDATE Episode " . "SET AuthorSessionID   = 0, " . "EditorSessionID   = :sessionID, " . "Status            = 2, " . "LockDate          = '', " . "LockKey           = 0, " . "CreationTimestamp = now() " . "WHERE EpisodeID = :episode");
    $dbStatement->bindParam(":sessionID", $sessionID, PDO::PARAM_INT);
    $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT);
    $dbStatement->execute();
    if ($dbStatement->rowCount() != 1) {
        throw new HardStoryException("Unable to update the episode record.");
    }
    $message = "Author's Edit Permission Revoked";
    $command = "Done";
}
if ($command == "Done") {
    ?>

<HTML><HEAD>
<TITLE>Edit Completed</TITLE>