Esempio n. 1
0
 public static function getStringParam($array, $name)
 {
     $value = Util::getStringParamDefault($array, $name, null);
     if (!isset($value)) {
         throw new HardStoryException("Parameter \"" . $name . "\" is not set.");
     }
     return $value;
 }
    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 
    }
Esempio n. 3
0
        ${$var5} = $command == "EditPreview" || $command == "EditSave" ? Util::getIntParamDefault($_POST, $var5, 0) : ${$var2};
    }
} else {
    $linkCount = $maxLinks;
    for ($i = 0; $i < $linkCount; $i++) {
        $var1 = "linkID" . $i;
        $var2 = "targetEpisodeID" . $i;
        $var3 = "isBackLink" . $i;
        $var4 = "option" . $i;
        $var5 = "backlink" . $i;
        ${$var1} = 0;
        ${$var2} = 0;
        ${$var3} = "N";
        ${$var4} = "";
        ${$var5} = 0;
        ${$var4} = Util::getStringParamDefault($_POST, $var4, "");
        ${$var5} = Util::getIntParamDefault($_POST, $var5, 0);
    }
}
for ($i = 0; $i < $linkCount; $i++) {
    $var1 = "option" . $i;
    $var2 = "backlink" . $i;
    $var3 = "isBackLink" . $i;
    if (!empty(${$var1})) {
        $linkFound = true;
    }
    if ($editing && empty(${$var1})) {
        $warning .= "You must provide a description for option " . ($i + 1) . ".<BR>";
    }
    if (strlen(${$var1}) > 255) {
        $warning .= "The description for option " . ($i + 1) . " cannot be longer then 255 characters.<BR>";
Esempio n. 4
0
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 {
Esempio n. 5
0
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\HardStoryException;
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");
$method = Util::getStringParam($_POST, "method");
$text = Util::getStringParamDefault($_POST, "text", "");
$days = Util::getIntParamDefault($_POST, "days", 0);
$text = "%" . $text . "%";
$dbStatement;
$queryPart1 = "SELECT EpisodeID, " . "Title, " . "AuthorName " . "FROM Episode " . "WHERE ";
$queryPart2 = "AND ( Status = 2 OR Status = 3 ) " . "ORDER BY EpisodeID";
if ($method == "title") {
    $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "Title LIKE :text " . $queryPart2);
    $dbStatement->bindParam(":text", $text, PDO::PARAM_STR);
} else {
    if ($method == "text") {
        $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "Text LIKE :text " . $queryPart2);
        $dbStatement->bindParam(":text", $text, PDO::PARAM_STR);
    } else {
        if ($method == "author") {
            $dbStatement = Util::getDbConnection()->prepare($queryPart1 . "AuthorName LIKE :text " . $queryPart2);
Esempio n. 6
0
*/
require __DIR__ . "/include/Extend-A-Story.php";
use Extend_A_Story\HardStoryException;
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");
$readEpisodeURL = Util::getStringValue("ReadEpisodeURL");
$adminEmail = Util::getStringValue("AdminEmail");
$isWriteable = Util::getStringValue("IsWriteable");
$maxLinks = Util::getIntValue("MaxLinks");
$maxEditDays = Util::getIntValue("MaxEditDays");
$message = "";
$command = Util::getStringParamDefault($_REQUEST, "command", "");
if ($command != "" && $command != "addUser" && $command != "addUserSave" && $command != "changePassword" && $command != "changePasswordSave" && $command != "deleteUser" && $command != "deleteUserSave" && $command != "editUser" && $command != "editUserSave" && $command != "configure" && $command != "configureSave" && $command != "listDeadEnds" && $command != "listOrphans" && $command != "listRecentEdits" && $command != "login" && $command != "logout") {
    $message = "Invalid Command";
    $command = "";
}
if ($command == "login") {
    $loginName = Util::getStringParam($_POST, "loginName");
    $password = Util::getStringParam($_POST, "password");
    $dbStatement = Util::getDbConnection()->prepare("SELECT UserID " . "FROM User " . "WHERE LoginName = :loginName " . "AND Password = PASSWORD( :password )");
    $dbStatement->bindParam(":loginName", $loginName, PDO::PARAM_STR);
    $dbStatement->bindParam(":password", $password, PDO::PARAM_STR);
    $dbStatement->execute();
    $row = $dbStatement->fetch(PDO::FETCH_NUM);
    if (!$row) {
        $message = "Invalid login name and/or password.";
    } else {
    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 
    }
    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 
    }