Exemplo n.º 1
0
    $page_edit = $data['slug'] === "" ? false : true;
    $pid = $_GET['id'];
}
if (isset($_POST['submit'])) {
    $pname = $page_edit === 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 {
            $gSite = new \Lobby\App\sige\Site($site, $this);
            $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 " . ($page_edit ? "Updated" : "Created"), "The page was successfully " . ($page_edit ? "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();
?>
" style="width: 700px;">