protected function renderMain() { $adminLoginName = Util::getStringParamDefault($_POST, "adminLoginName", ""); $adminDisplayName = Util::getStringParamDefault($_POST, "adminDisplayName", ""); $adminPassword1 = Util::getStringParamDefault($_POST, "adminPassword1", ""); $adminPassword2 = Util::getStringParamDefault($_POST, "adminPassword2", ""); $adminLoginNameField = new InputField("adminLoginName", "Login Name", "text", $adminLoginName, "This is the login name for the administrative account for your story. This " . "account will be created during installation. You will be able to log in to this " . "account using this name."); $adminDisplayNameField = new InputField("adminDisplayName", "Display Name", "text", $adminDisplayName, "This is the display name for the administrative account for your story. This " . "name will be publicly displayed on any moderation activity you perform in your " . "story."); $adminPassword1Field = new InputField("adminPassword1", "Pasword", "password", $adminPassword1, "This is the password for the administrative account for your story. This " . "account will be created during installation. You will be able to log in to this " . "account using this password."); $adminPassword2Field = new InputField("adminPassword2", "Pasword (Again)", "password", $adminPassword2, "Please enter the password a second time to guard against a mis-typed password."); $adminLoginNameField->render(); $adminDisplayNameField->render(); $adminPassword1Field->render(); $adminPassword2Field->render(); ?> <div class="submit"> <input type="hidden" name="pageName" value="AdminAccount" /> <input type="submit" name="backButton" value="Back" /> <input type="submit" name="continueButton" value="Continue" /> </div> <?php }
along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For information about Extend-A-Story and its authors, please visit the website: http://www.sir-toby.com/extend-a-story/ */ require __DIR__ . "/include/Extend-A-Story.php"; use Extend_A_Story\Pages\Install\AdminAccountPage; use Extend_A_Story\Pages\Install\ConfirmationPage; use Extend_A_Story\Pages\Install\DatabaseConnectionPage; use Extend_A_Story\Pages\Install\StartPage; use Extend_A_Story\Pages\Install\StorySettingsPage; use Extend_A_Story\HardStoryException; use Extend_A_Story\Util; $pageName = Util::getStringParamDefault($_POST, "pageName", null); $backButton = Util::getStringParamDefault($_POST, "backButton", null); $continueButton = Util::getStringParamDefault($_POST, "continueButton", null); if (isset($pageName)) { if ($pageName == "Start") { if (isset($continueButton)) { $page = new DatabaseConnectionPage(); } else { throw new HardStoryException("Unrecognized navigation from start page."); } } else { if ($pageName == "DatabaseConnection") { if (isset($backButton)) { $page = new StartPage(); } else { if (isset($continueButton)) { $page = new AdminAccountPage(); } else {
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For information about Extend-A-Story and its authors, please visit the website: http://www.sir-toby.com/extend-a-story/ */ require __DIR__ . "/include/Extend-A-Story.php"; use Extend_A_Story\Util; Util::getSessionAndUserIDs($sessionID, $userID); $storyName = Util::getStringValue("StoryName"); $siteName = Util::getStringValue("SiteName"); $storyHome = Util::getStringValue("StoryHome"); $siteHome = Util::getStringValue("SiteHome"); ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Search</TITLE> </HEAD><BODY> <CENTER> <H1><?php echo $storyName; ?> : Search</H1>
//$dbStatement = Util::getDbConnection()->prepare( "SELECT * FROM Episode WHERE 1=2" ); $dbStatement = Util::getDbConnection()->prepare("SELECT COUNT( * ) FROM Episode WHERE Status = 2 OR Status = 3"); $dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Problem fetching created episode count row from the database."); } $created = $row[0]; $dbStatement = Util::getDbConnection()->prepare("SELECT COUNT( * ) FROM Episode WHERE Status = 0 OR Status = 1"); $dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Problem fetching empty episode count row from the database."); } $empty = $row[0]; $dbStatement = Util::getDbConnection()->prepare("SELECT COUNT( * ) FROM Episode"); $dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Problem fetching episode count row from the database."); } $count = $row[0]; ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Statistics</TITLE> </HEAD><BODY>
if ($method == "author") { $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "AuthorName LIKE :text " . $queryPart2); $dbStatement->bindParam(":text", $text, PDO::PARAM_STR); } else { if ($method == "time") { $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "CreationDate LIKE :text " . $queryPart2); $dbStatement->bindParam(":text", $text, PDO::PARAM_STR); } else { if ($method == "extendable") { $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "IsExtendable = 'Y' " . $queryPart2); } else { if ($method == "linkable") { $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "IsLinkable = 'Y' " . $queryPart2); } else { if ($method == "days") { $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "CreationTimestamp > SUBDATE( NOW(), INTERVAL :days DAY ) " . $queryPart2); $dbStatement->bindParam(":days", $days, PDO::PARAM_INT); } else { throw new HardStoryException("The specified search method is not supported."); } } } } } } } $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); ?> <HTML><HEAD>
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For information about Extend-A-Story and its authors, please visit the website: http://www.sir-toby.com/extend-a-story/ */ require __DIR__ . "/include/Extend-A-Story.php"; use Extend_A_Story\Util; Util::getSessionAndUserIDs($sessionID, $userID); $storyName = Util::getStringValue("StoryName"); $siteName = Util::getStringValue("SiteName"); $storyHome = Util::getStringValue("StoryHome"); $siteHome = Util::getStringValue("SiteHome"); $episode = Util::getIntParam($_GET, "episode"); $dbStatement = Util::getDbConnection()->prepare("SELECT Link.SourceEpisodeID, " . "Episode.Title " . "FROM Link, " . "Episode " . "WHERE Link.SourceEpisodeID = Episode.EpisodeID " . "AND Link.TargetEpisodeID = :episode " . "ORDER BY Episode.EpisodeID"); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Back Link Trace for Episode <?php echo $episode; ?> </TITLE> </HEAD><BODY>
$dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Unable to fetch the max EpisodeEditLogID record from database."); } $maxEpisodeEditLogID = (int) $row[0]; $start = Util::getIntParamDefault($_GET, "start", 0); if ($start < 1 || $start > $maxEpisodeEditLogID) { $start = $maxEpisodeEditLogID; } $dbStatement = Util::getDbConnection()->prepare("SELECT EpisodeEditLogID, " . "EpisodeID, " . "EditDate, " . "EditLogEntry " . "FROM EpisodeEditLog " . "WHERE EpisodeEditLogID <= :start " . "ORDER BY EpisodeEditLogID DESC " . "LIMIT 20"); $dbStatement->bindParam(":start", $start, PDO::PARAM_INT); $dbStatement->execute(); $edits = $dbStatement->fetchAll(PDO::FETCH_NUM); } $dbStatement = Util::getDbConnection()->prepare("SELECT UserID, " . "LoginName " . "FROM User " . "ORDER BY LoginName"); $dbStatement->execute(); $users = $dbStatement->fetchAll(PDO::FETCH_NUM); if ($command == "listOrphans") { ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Administration</TITLE> </HEAD><BODY> <CENTER> <H1><?php
$row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Problem fetching scheme row from the database."); } $schemeName = $row[0]; $bgcolor = $row[1]; $text = $row[2]; $link = $row[3]; $vlink = $row[4]; $alink = $row[5]; $background = $row[6]; $uncreatedLink = $row[7]; $createdLink = $row[8]; $backLinkedLink = $row[9]; $body = "<BODY BGCOLOR=\"" . $bgcolor . "\" " . "TEXT=\"" . $text . "\" " . "LINK=\"" . $link . "\" " . "VLINK=\"" . $vlink . "\" " . "ALINK=\"" . $alink . "\"" . (empty($background) ? ">" : " BACKGROUND=\"" . $background . "\">"); $dbStatement = Util::getDbConnection()->prepare("SELECT SchemeID, SchemeName FROM Scheme"); $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Scheme Preview</TITLE> </HEAD><?php echo $body; ?> <CENTER> <H1><?php
"> </CENTER> <?php } ?> <P> <OL> <?php for ($i = 0; $i < count($links); $i++) { $row = $links[$i]; $description = $row[3]; $description = htmlentities($description); $description = strtr($description, Util::getOptionTranslation()); if ($row[2] == "Y") { $image = $backLinkedLink; } else { if ($row[1] == "Y") { $image = $createdLink; } else { $image = $uncreatedLink; } } ?> <LI> <IMG SRC="<?php echo $image; ?>
protected function renderMain() { $databaseHost = Util::getStringParamDefault($_POST, "databaseHost", ""); $databaseUsername = Util::getStringParamDefault($_POST, "databaseUsername", ""); $databasePassword = Util::getStringParamDefault($_POST, "databasePassword", ""); $databaseName = Util::getStringParamDefault($_POST, "databaseName", ""); $databaseHostField = new InputField("databaseHost", "Host", "text", $databaseHost, "This is the host name for your database server. If your database server and " . "your web server are running on the same machine, use \"localhost\". If you are " . "running Extend-A-Story in a shared hosting environment, your hosting provider " . "will provide you with the host name for your database server."); $databaseUsernameField = new InputField("databaseUsername", "Username", "text", $databaseUsername, "This is the username that will be used to connect to your database server " . "during the installation process. This user will need all permissions to your " . "Extend-A-Story database."); $databasePasswordField = new InputField("databasePassword", "Password", "password", $databasePassword, "This is the password that will be used to connect to your database server " . "during the installation process."); $databaseNameField = new InputField("databaseName", "Database", "text", $databaseName, "This is the name of your Extend-A-Story database. The tables needed by " . "Extend-A-Story will be created in this database."); $databaseHostField->render(); $databaseUsernameField->render(); $databasePasswordField->render(); $databaseNameField->render(); ?> <div class="submit"> <input type="hidden" name="pageName" value="DatabaseConnection" /> <input type="submit" name="backButton" value="Back" /> <input type="submit" name="continueButton" value="Continue" /> </div> <?php }
public static function canEditEpisode($sessionID, $userID, $episodeID) { if ($userID != 0) { return true; } $dbStatement = Util::getDbConnection()->prepare("SELECT AuthorSessionID, " . "CreationDate " . "FROM Episode " . "WHERE EpisodeID = :episodeID"); $dbStatement->bindParam(":episodeID", $episodeID, PDO::PARAM_INT); $dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Episode " . $episodeID . " not found."); } $authorSessionID = $row[0]; $creationDate = $row[1]; if ($sessionID == $authorSessionID) { $maxEditDays = Util::getIntValue("MaxEditDays"); $creationTime = strtotime($creationDate); $curTime = time(); $seconds = $curTime - $creationTime; $minutes = (int) ($seconds / 60); $hours = (int) ($minutes / 60); $days = (int) ($hours / 24); if ($days < $maxEditDays) { return true; } } return false; }
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For information about Extend-A-Story and its authors, please visit the website: http://www.sir-toby.com/extend-a-story/ */ require __DIR__ . "/include/Extend-A-Story.php"; use Extend_A_Story\Util; Util::getSessionAndUserIDs($sessionID, $userID); $storyName = Util::getStringValue("StoryName"); $siteName = Util::getStringValue("SiteName"); $storyHome = Util::getStringValue("StoryHome"); $siteHome = Util::getStringValue("SiteHome"); $dbStatement = Util::getDbConnection()->prepare("SELECT EpisodeID " . "FROM Episode " . "WHERE Status = 1 " . "ORDER BY EpisodeID"); $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); ?> <HTML><HEAD> <TITLE><?php echo $storyName; ?> : Locked Episodes</TITLE> </HEAD><BODY> <CENTER> <H1><?php echo $storyName; ?>
</TD> </TR> </TABLE> </CENTER> <?php require __DIR__ . "/include/config/Footer.php"; ?> </BODY></HTML> <?php exit; } $dbStatement = Util::getDbConnection()->prepare("SELECT EpisodeEditLogID, " . "EditDate, " . "EditLogEntry " . "FROM EpisodeEditLog " . "WHERE EpisodeID = :episode " . "ORDER BY EpisodeEditLogID"); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); ?> <HTML><HEAD> <TITLE>Viewing Edits for Episode <?php echo $episode; ?> </TITLE> </HEAD><BODY> <CENTER> <H1>Viewing Edits for Episode <?php echo $episode;
</TR> </TABLE> </CENTER> <?php require __DIR__ . "/include/config/Footer.php"; ?> </BODY></HTML> <?php exit; } $statusValue = $status == 1 ? 0 : 2; $dbStatement = Util::getDbConnection()->prepare("UPDATE Episode " . "SET " . ($status == 1 ? "AuthorSessionID" : "EditorSessionID") . " = 0, " . "Status = :statusValue, " . "LockDate = '-', " . "LockKey = 0 " . "WHERE EpisodeID = :episode"); $dbStatement->bindParam(":statusValue", $statusValue, PDO::PARAM_INT); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); if ($dbStatement->rowCount() != 1) { throw new HardStoryException("Unable to unlock the episode record."); } ?> <HTML><HEAD> <TITLE>Cleared Episode <?php echo $episode; ?> Lock</TITLE> </HEAD><BODY>
<?php sort($curEpisodes, SORT_NUMERIC); $nextEpisodes = array(); for ($i = 0; $i < count($curEpisodes); $i++) { $episode = $curEpisodes[$i]; $dbStatement = Util::getDbConnection()->prepare("SELECT Parent, " . "Title " . "FROM Episode " . "WHERE EpisodeID = :episode"); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); $row = $dbStatement->fetch(PDO::FETCH_NUM); if (!$row) { throw new HardStoryException("Problem fetching episode row from database."); } $parent = $row[0]; $title = $row[1]; $dbStatement = Util::getDbConnection()->prepare("SELECT TargetEpisodeID, " . "IsCreated, " . "IsBackLink " . "FROM Link " . "WHERE SourceEpisodeID = :episode " . "ORDER BY LinkID"); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); $rows = $dbStatement->fetchAll(PDO::FETCH_NUM); $children = ""; for ($j = 0; $j < count($rows); $j++) { $row = $rows[$j]; $target = $row[0]; $isCreated = $row[1]; $isBackLink = $row[2]; if ($isBackLink == "Y") { $color = "#0000FF"; } else { if ($isCreated == "Y") { $color = "#008000"; array_push($nextEpisodes, $target);
<TR> <TD> <?php echo $displayedText; ?> <P> <OL> <?php for ($i = 0; $i < $linkCount; $i++) { $var1 = "option" . $i; $var2 = "backlink" . $i; $var3 = "isBackLink" . $i; if (!empty(${$var1})) { $displayedOption = htmlentities(${$var1}); $displayedOption = strtr($displayedOption, Util::getOptionTranslation()); if (${$var2} != 0 && !$editing || ${$var3} == "Y") { $image = "blue.gif"; } else { $image = "red.gif"; } ?> <LI> <IMG SRC="images/<?php echo $image; ?> "> <A HREF="#"><?php echo $displayedOption; ?>
protected function renderMain() { $settingsStoryName = Util::getStringParamDefault($_POST, "settingsStoryName", ""); $settingsSiteName = Util::getStringParamDefault($_POST, "settingsSiteName", ""); $settingsStoryHome = Util::getStringParamDefault($_POST, "settingsStoryHome", ""); $settingsSiteHome = Util::getStringParamDefault($_POST, "settingsSiteHome", ""); $settingsReadEpisodeUrl = Util::getStringParamDefault($_POST, "settingsReadEpisodeUrl", ""); $settingsAdminEmail = Util::getStringParamDefault($_POST, "settingsAdminEmail", ""); $settingsMaxLinks = Util::getStringParamDefault($_POST, "settingsMaxLinks", ""); $settingsMaxEditDays = Util::getStringParamDefault($_POST, "settingsMaxEditDays", ""); $settingsStoryNameField = new InputField("settingsStoryName", "Story Name", "text", $settingsStoryName, "This is the name of your story. This name will be used in page titles and links " . "to the home page of your story."); $settingsSiteNameField = new InputField("settingsSiteName", "Site Name", "text", $settingsSiteName, "This is the name of your web site. This name will be used in links to the home " . "page of your web site."); $settingsStoryHomeField = new InputField("settingsStoryHome", "Story Home", "text", $settingsStoryHome, "This is the URL for the home page of your story. All story pages will provide a " . "link to this URL."); $settingsSiteHomeField = new InputField("settingsSiteHome", "Site Home", "text", $settingsSiteHome, "This is the URL for the home page of your web site. All story pages will " . "provide a link to this URL."); $settingsReadEpisodeUrlField = new InputField("settingsReadEpisodeUrl", "Read Episode URL", "text", $settingsReadEpisodeUrl, "This is the URL to the \"read.php\" script for this story on your web site. " . "Email notifications of newly created episodes will use this URL to provide a " . "link to the newly created episode."); $settingsAdminEmailField = new InputField("settingsAdminEmail", "Admin Email", "text", $settingsAdminEmail, "This is the email address from which email notifications of newly created " . "episodes will be sent. This email address will receive an email notification " . "for every episode that is created."); $settingsMaxLinksField = new InputField("settingsMaxLinks", "Max Links", "text", $settingsMaxLinks, "This is the maximum number of links an author is allowed to specify when " . "creating an episode."); $settingsMaxEditDaysField = new InputField("settingsMaxEditDays", "Max Edit Days", "text", $settingsMaxEditDays, "This is the number of days for which an author is allowed to edit an epiosde " . "that they created."); $settingsStoryNameField->render(); $settingsSiteNameField->render(); $settingsStoryHomeField->render(); $settingsSiteHomeField->render(); $settingsReadEpisodeUrlField->render(); $settingsAdminEmailField->render(); $settingsMaxLinksField->render(); $settingsMaxEditDaysField->render(); ?> <div class="submit"> <input type="hidden" name="pageName" value="StorySettings" /> <input type="submit" name="backButton" value="Back" /> <input type="submit" name="continueButton" value="Continue" /> </div> <?php }