<?php if (isset($_POST['submit'])) { $output = $_POST['output']; $tagline = $_POST['tagline']; $theme = isset($_POST['theme']) ? $_POST['theme'] : ""; if ($output != "" && $theme != "") { if (!file_exists($output) || !is_writable($output)) { \Lobby::ser("Output Path problem", "The path you gave as output doesn't exist or permission is not acceptable. Make sure it's an existing directory with Read & Write permission", false); } else { if (array_search($theme, $this->themes) === false) { \Lobby::ser("Invalid Theme", "The theme you selected doesn't exist", false); } else { // Everything's great $this->addSite($name, $tagline, $output, $theme, isset($_POST['empty']) ? 1 : 0, isset($_POST['titleTag']) ? 1 : 0); /* Generate the site */ $gSite = new sigeSite($this->getSite($name)); $gSite->generate($this->getPages($name)); \Lobby::sss("Site updated", "The site was updated and generated successfully"); } } } else { \Lobby::ser("Fill Up", "Please fill the form completely", false); } } ?> <form action="<?php echo \Lobby::u(); ?> " method="POST" clear> <?php $site = $this->getSite($name);
$data = $this->getPages($name, $_GET['id']); $valid = $data['title'] == "" ? false : true; } if (isset($_POST['submit'])) { $pname = $valid === true ? $_GET['id'] : $_POST['name']; $title = $_POST['title']; $body = $_POST['content']; $slug = $_POST['slug']; if ($pname == "" || $body == "" || $title == "" || $slug == "") { \Lobby::ser("Fill Up", "Please fill up all the fields"); } else { if (!ctype_alnum(str_replace(" ", "", $pname))) { \Lobby::ser("Invalid Name", "The page name should only contain alphanumeric characters"); } else { $layout = \Lobby\FS::get("/src/Data/themes/{$site['theme']}/layout.html"); $gSite = new sigeSite($site); $page = $gSite->page($slug, array("{{page-title}}" => $title, "{{page-content}}" => $body)); if ($page === true) { $this->addPage($name, $pname, array("title" => $title, "slug" => $slug, "body" => $body)); \Lobby::sss("Page Updated", "The page was successfully " . ($valid ? "updated" : "created")); } else { \Lobby::ser("Error", "Some error was occured while creating the page. Try again."); } $data = $this->getPages($name, $pname); } } } ?> <form method="POST" action="<?php echo \Lobby::u(); ?>