|
|
|
@ -10,6 +10,13 @@ redirectifnotloggedin();
|
|
|
|
|
if (!is_empty($VARS['arg'])) {
|
|
|
|
|
// Allow action.php to do a better redirect
|
|
|
|
|
$VARS['siteid'] = $VARS['arg'];
|
|
|
|
|
if (strpos($VARS['arg'], "|") !== FALSE) {
|
|
|
|
|
$arg = explode("|", $VARS['arg'], 2);
|
|
|
|
|
$VARS['siteid'] = $arg[0];
|
|
|
|
|
if ($database->has("pages", ["AND" => ["siteid" => $VARS['siteid'], "pageid" => $arg[1]]])) {
|
|
|
|
|
$VARS['slug'] = $database->get("pages", "slug", ["AND" => ["siteid" => $VARS['siteid'], "pageid" => $arg[1]]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_empty($VARS['siteid'])) {
|
|
|
|
@ -36,6 +43,14 @@ if (!is_empty($VARS['siteid'])) {
|
|
|
|
|
if (isset($VARS['slug']) && $database->has('pages', ["AND" => ['slug' => $VARS['slug'], 'siteid' => $VARS['siteid']]])) {
|
|
|
|
|
$slug = $VARS['slug'];
|
|
|
|
|
}
|
|
|
|
|
$thispage = $database->get(
|
|
|
|
|
'pages', [
|
|
|
|
|
"pageid",
|
|
|
|
|
"slug",
|
|
|
|
|
"title",
|
|
|
|
|
"template"
|
|
|
|
|
], ["AND" => ["siteid" => $VARS['siteid'], "slug" => $slug]]
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
header('Location: app.php?page=sites');
|
|
|
|
|
die();
|
|
|
|
@ -46,11 +61,54 @@ if (!is_empty($VARS['siteid'])) {
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="pageSettingsModal" tabindex="-1" role="dialog" aria-labelledby="pageSettingsLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<form class="modal-content" action="action.php" method="POST">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title" id="pageSettingsLabel"><i class="fas fa-cog"></i> <?php lang("page settings"); ?></h5>
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body" id="pageSettingsModalBody">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label><i class="fas fa-font"></i> <?php lang("title"); ?></label>
|
|
|
|
|
<input type="text" id="pageSettingsTitle" name="title" class="form-control" required="required" minlength="1" maxlength="200" value="<?php echo $thispage['title']; ?>" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label><i class="fas fa-paint-brush"></i> <?php lang("template"); ?></label>
|
|
|
|
|
<select id="pageSettingsTemplate" name="template" class="form-control" required="required">
|
|
|
|
|
<?php
|
|
|
|
|
$json = file_get_contents(__DIR__ . "/../public/themes/" . $sitedata['theme'] . "/theme.json");
|
|
|
|
|
$templates = json_decode($json, true)["templates"];
|
|
|
|
|
foreach ($templates as $name => $value) {
|
|
|
|
|
$selected = "";
|
|
|
|
|
if ($thispage['template'] == $name) {
|
|
|
|
|
$selected = " selected";
|
|
|
|
|
}
|
|
|
|
|
echo "<option value=\"" . $name . "\"$selected>" . $value['title'] . "</option>\n";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<input type="hidden" name="siteid" value="<?php echo $sitedata['siteid']; ?>" />
|
|
|
|
|
<input type="hidden" name="pageid" value="<?php echo $thispage['pageid']; ?>" />
|
|
|
|
|
<input type="hidden" name="action" value="pagesettings" />
|
|
|
|
|
<input type="hidden" name="source" value="editor" />
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php lang("cancel"); ?></button>
|
|
|
|
|
<button type="submit" class="btn btn-success" id="pageSettingsModalSave"><i class="fas fa-save"></i> <?php lang("save"); ?></button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="newPageModal" tabindex="-1" role="dialog" aria-labelledby="newPageLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<form class="modal-content" action="action.php" method="POST">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title" id="newPageLabel"><?php lang("new page"); ?></h5>
|
|
|
|
|
<h5 class="modal-title" id="newPageLabel"><i class="fas fa-plus"></i> <?php lang("new page"); ?></h5>
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
@ -133,11 +191,14 @@ if (!is_empty($VARS['siteid'])) {
|
|
|
|
|
<div class="btn btn-success" id="savebtn">
|
|
|
|
|
<i class="fas fa-save"></i> <?php lang("save"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btn btn-secondary" id="pagesettingsbtn">
|
|
|
|
|
<i class="fas fa-cog"></i> <?php lang("settings"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<a class="btn btn-info" id="viewbtn" target="_BLANK" href="public/index.php?id=<?php echo $slug; ?>&siteid=<?php echo $VARS['siteid']; ?>">
|
|
|
|
|
<i class="fas fa-eye"></i> <?php lang("view"); ?>
|
|
|
|
|
</a>
|
|
|
|
|
<div class="btn btn-primary" id="newpagebtn">
|
|
|
|
|
<i class="fas fa-plus"></i> <?php lang("new page"); ?>
|
|
|
|
|
<i class="fas fa-plus"></i> <?php lang("new"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span class="badge badge-success d-none" id="savedBadge"><i class="fas fa-check"></i> <?php lang("saved"); ?></span>
|
|
|
|
|