summaryrefslogtreecommitdiff
path: root/handler
diff options
context:
space:
mode:
Diffstat (limited to 'handler')
-rw-r--r--handler/Auto.php4
-rw-r--r--handler/admin/AutoAddOrEdit.php2
-rw-r--r--handler/admin/AutoEdit.php15
-rw-r--r--handler/admin/PageAdd.php4
4 files changed, 17 insertions, 8 deletions
diff --git a/handler/Auto.php b/handler/Auto.php
index 361cc17..0656c44 100644
--- a/handler/Auto.php
+++ b/handler/Auto.php
@@ -65,10 +65,14 @@ class Auto extends RequestHandler {
$s->title = $post->title;
+ if ($post->toc)
+ $s->setOptions(['wide' => true]);
+
return $s->renderPage('main/post',
title: $post->title,
id: $post->id,
unsafe_html: $post->getHtml($this->isRetina(), \themes::getUserTheme()),
+ unsafe_toc_html: $post->getToc(),
date: $post->getFullDate(),
tags: $tags,
visible: $post->visible,
diff --git a/handler/admin/AutoAddOrEdit.php b/handler/admin/AutoAddOrEdit.php
index 027c827..1627642 100644
--- a/handler/admin/AutoAddOrEdit.php
+++ b/handler/admin/AutoAddOrEdit.php
@@ -39,6 +39,7 @@ abstract class AutoAddOrEdit extends AdminRequestHandler {
string $text = '',
?array $tags = null,
bool $visible = false,
+ bool $toc = false,
string $short_name = '',
?string $error_code = null,
bool $saved = false,
@@ -53,6 +54,7 @@ abstract class AutoAddOrEdit extends AdminRequestHandler {
text: $text,
tags: $tags ? implode(', ', $tags) : '',
visible: $visible,
+ toc: $toc,
saved: $saved,
short_name: $short_name,
error_code: $error_code
diff --git a/handler/admin/AutoEdit.php b/handler/admin/AutoEdit.php
index 9d70c5b..ba6a7d8 100644
--- a/handler/admin/AutoEdit.php
+++ b/handler/admin/AutoEdit.php
@@ -16,12 +16,13 @@ class AutoEdit extends AutoAddOrEdit {
if ($post) {
$tags = $post->getTags();
return $this->_get_postEdit($post,
- tags: $post->getTags(),
- saved: $saved,
title: $post->title,
text: $post->md,
+ tags: $post->getTags(),
visible: $post->visible,
+ toc: $post->toc,
short_name: $post->shortName,
+ saved: $saved,
);
}
@@ -30,8 +31,8 @@ class AutoEdit extends AutoAddOrEdit {
return $this->_get_pageEdit($page,
title: $page->title,
text: $page->md,
- visible: $page->visible,
saved: $saved,
+ visible: $page->visible,
);
}
@@ -45,8 +46,8 @@ class AutoEdit extends AutoAddOrEdit {
if ($post) {
csrf::check('editpost'.$post->id);
- list($text, $title, $tags, $visible, $short_name)
- = $this->input('text, title, tags, b:visible, new_short_name');
+ list($text, $title, $tags, $visible, $toc, $short_name)
+ = $this->input('text, title, tags, b:visible, b:toc, new_short_name');
$tags = posts::splitStringToTags($tags);
$error_code = null;
@@ -63,10 +64,11 @@ class AutoEdit extends AutoAddOrEdit {
if ($error_code)
$this->_get_postEdit($post,
- text: $text,
title: $title,
+ text: $text,
tags: $tags,
visible: $visible,
+ toc: $toc,
short_name: $short_name,
error_code: $error_code
);
@@ -75,6 +77,7 @@ class AutoEdit extends AutoAddOrEdit {
'title' => $title,
'md' => $text,
'visible' => (int)$visible,
+ 'toc' => (int)$toc,
'short_name' => $short_name
]);
$tag_ids = posts::getTagIds($tags);
diff --git a/handler/admin/PageAdd.php b/handler/admin/PageAdd.php
index 8754f0f..42a9911 100644
--- a/handler/admin/PageAdd.php
+++ b/handler/admin/PageAdd.php
@@ -40,8 +40,8 @@ class PageAdd extends AutoAddOrEdit {
if ($error_code) {
return $this->_get_pageAdd(
name: $name,
- text: $text,
title: $title,
+ text: $text,
error_code: $error_code
);
}
@@ -53,8 +53,8 @@ class PageAdd extends AutoAddOrEdit {
])) {
return $this->_get_pageAdd(
name: $name,
- text: $text,
title: $title,
+ text: $text,
error_code: 'db_err'
);
}