|
|
@ -101,8 +101,9 @@ class DashControl
|
|
|
|
if (Session::active()) {
|
|
|
|
if (Session::active()) {
|
|
|
|
$template = "dash/page-edit.twig";
|
|
|
|
$template = "dash/page-edit.twig";
|
|
|
|
$mode = $args["third"];
|
|
|
|
$mode = $args["third"];
|
|
|
|
if ($mode == "edit") {
|
|
|
|
|
|
|
|
$uuid = $args["fourth"];
|
|
|
|
$uuid = $args["fourth"];
|
|
|
|
|
|
|
|
switch ($mode) {
|
|
|
|
|
|
|
|
case "edit":
|
|
|
|
$customPages = (new Themes())->getCustomViews();
|
|
|
|
$customPages = (new Themes())->getCustomViews();
|
|
|
|
$pageOptions = [
|
|
|
|
$pageOptions = [
|
|
|
|
"title" => "Fipamo | Edit Page",
|
|
|
|
"title" => "Fipamo | Edit Page",
|
|
|
@ -112,13 +113,35 @@ class DashControl
|
|
|
|
"status" => Session::active(),
|
|
|
|
"status" => Session::active(),
|
|
|
|
"views" => $customPages,
|
|
|
|
"views" => $customPages,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "preview":
|
|
|
|
|
|
|
|
$config = new Settings();
|
|
|
|
|
|
|
|
$settings = $config->getSettings();
|
|
|
|
|
|
|
|
$loader = new \Twig\Loader\FilesystemLoader(
|
|
|
|
|
|
|
|
"../content/themes"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$display = new \Twig\Environment($loader, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$book = new Book("../content/pages");
|
|
|
|
|
|
|
|
$page = $book->findPageById($uuid);
|
|
|
|
|
|
|
|
$pageOptions = Sorting::page($page);
|
|
|
|
|
|
|
|
$preview =
|
|
|
|
|
|
|
|
$settings["global"]["theme"] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$page["layout"] .
|
|
|
|
|
|
|
|
".twig";
|
|
|
|
|
|
|
|
$html = $display->render($preview, $pageOptions);
|
|
|
|
|
|
|
|
$response->getBody()->write($html);
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$pageOptions = [
|
|
|
|
$pageOptions = [
|
|
|
|
"title" => "Fipamo | Create Page",
|
|
|
|
"title" => "Fipamo | Create Page",
|
|
|
|
"token" => Session::get("form_token"),
|
|
|
|
"token" => Session::get("form_token"),
|
|
|
|
"mode" => $mode,
|
|
|
|
"mode" => $mode,
|
|
|
|
"status" => Session::active(),
|
|
|
|
"status" => Session::active(),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
header("Location: /dashboard");
|
|
|
|
header("Location: /dashboard");
|
|
|
|