diff --git a/ext/comment/theme.php b/ext/comment/theme.php index d0e8abeaa..6c42b4b3d 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -190,7 +190,7 @@ public function display_all_user_comments(array $comments, int $page_number, int $h_index = "Index"; $h_next = ($page_number >= $total_pages) ? "Next" : "Next"; - $page->set_title(html_escape($user->name)."'s comments"); + $page->set_title("{$user->name}'s comments"); $page->add_block(new Block("Navigation", rawHTML($h_prev.' | '.$h_index.' | '.$h_next), "left", 0)); $this->display_paginator($page, "comment/beta-search/{$user->name}", null, $page_number, $total_pages); } diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php index 3dcfff171..07e07682d 100644 --- a/ext/ext_manager/theme.php +++ b/ext/ext_manager/theme.php @@ -151,8 +151,8 @@ public function display_doc(Page $page, ExtensionInfo $info): void P(A(["href" => make_link("ext_manager")], "Back to the list")) ); - $page->set_title("Documentation for " . html_escape($info->name)); - $page->set_heading(html_escape($info->name)); + $page->set_title("Documentation for {$info->name}"); + $page->set_heading($info->name); $page->add_block(new NavBlock()); $page->add_block(new Block("Documentation", $html)); } diff --git a/ext/forum/theme.php b/ext/forum/theme.php index 3fc363075..bf0048e15 100644 --- a/ext/forum/theme.php +++ b/ext/forum/theme.php @@ -74,7 +74,7 @@ public function display_new_thread_composer(Page $page, ?string $threadText = nu ); $blockTitle = "Write a new thread"; - $page->set_title(html_escape($blockTitle)); + $page->set_title($blockTitle); $page->add_block(new Block($blockTitle, $html, "main", 120)); } @@ -156,7 +156,7 @@ public function display_thread(array $posts, bool $showAdminOptions, string $thr DIV(["class" => "postDate"], SMALL(rawHTML(autodate($post['date'])))), DIV(["class" => "postNumber"], " #".$post_number), BR(), - DIV(["class" => "postMessage"], rawHTML(send_event(new TextFormattingEvent($post["message"]))->formatted)) + DIV(["class" => "postMessage"], rawHTML(format_text($post["message"]))) ) ), TR( @@ -189,7 +189,7 @@ public function display_thread(array $posts, bool $showAdminOptions, string $thr $this->display_paginator($page, "forum/view/".$threadID, null, $pageNumber, $totalPages); - $page->set_title(html_escape($threadTitle)); + $page->set_title($threadTitle); $page->add_block(new Block($threadTitle, $html, "main", 20)); } diff --git a/ext/index/theme.php b/ext/index/theme.php index 05761305b..27f8dc031 100644 --- a/ext/index/theme.php +++ b/ext/index/theme.php @@ -124,10 +124,7 @@ protected function display_shortwiki(Page $page): void $short_wiki_description = ''; if ($wikiPage->id != -1) { // only show first line of wiki - $short_wiki_description = explode("\n", $wikiPage->body, 2)[0]; - - $tfe = send_event(new TextFormattingEvent($short_wiki_description)); - $short_wiki_description = $tfe->formatted; + $short_wiki_description = format_text(explode("\n", $wikiPage->body, 2)[0]); } $wikiLink = make_link("wiki/$st"); if (Extension::is_enabled(TagCategoriesInfo::KEY)) { diff --git a/ext/pm/theme.php b/ext/pm/theme.php index 03525195c..6de27f1e6 100644 --- a/ext/pm/theme.php +++ b/ext/pm/theme.php @@ -85,7 +85,7 @@ public function display_composer(Page $page, User $from, User $to, string $subje public function display_message(Page $page, User $from, User $to, PM $pm): void { $page->set_title("Private Message"); - $page->set_heading(html_escape($pm->subject)); + $page->set_heading($pm->subject); $page->add_block(new NavBlock()); $page->add_block(new Block("Message from {$from->name}", rawHTML(format_text($pm->message)), "main", 10)); } diff --git a/ext/pools/theme.php b/ext/pools/theme.php index 6371bedf0..9d77d7828 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -134,8 +134,7 @@ private function display_top(?Pool $pool, string $heading, bool $check_all = fal $this->sidebar_options($page, $pool, $check_all); } } - $tfe = send_event(new TextFormattingEvent($pool->description)); - $page->add_block(new Block(html_escape($pool->title), rawHTML($tfe->formatted), "main", 10)); + $page->add_block(new Block($pool->title, rawHTML(format_text($pool->description)), "main", 10)); } } diff --git a/ext/user/theme.php b/ext/user/theme.php index 1ae1dc8b3..21bc473ab 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -64,7 +64,7 @@ public function display_signup_page(Page $page): void $tac = $config->get_string("login_tac", ""); if ($config->get_bool("login_tac_bbcode")) { - $tac = send_event(new TextFormattingEvent($tac))->formatted; + $tac = format_text($tac); } $email_required = ( @@ -246,7 +246,7 @@ public function display_user_page(User $duser, array $stats): void global $page; $stats[] = 'User ID: '.$duser->id; - $page->set_title(html_escape($duser->name)."'s Page"); + $page->set_title("{$duser->name}'s Page"); $page->add_block(new NavBlock()); $page->add_block(new Block("Stats", rawHTML(join("
", $stats)), "main", 10)); } diff --git a/ext/view/theme.php b/ext/view/theme.php index 1f8ebd58e..d2c1286c7 100644 --- a/ext/view/theme.php +++ b/ext/view/theme.php @@ -36,7 +36,7 @@ public function display_page(Image $image, array $editor_parts): void { global $page; $page->set_title("Post {$image->id}: ".$image->get_tag_list()); - $page->set_heading(html_escape($image->get_tag_list())); + $page->set_heading($image->get_tag_list()); $page->add_block(new Block("Post {$image->id}", $this->build_navigation($image), "left", 0, "Navigationleft")); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 20, "ImageInfo")); //$page->add_block(new Block(null, $this->build_pin($image), "main", 11)); diff --git a/ext/wiki/theme.php b/ext/wiki/theme.php index e0d79d8b5..792a6311b 100644 --- a/ext/wiki/theme.php +++ b/ext/wiki/theme.php @@ -25,29 +25,21 @@ public function display_page(Page $page, WikiPage $wiki_page, ?WikiPage $nav_pag $nav_page->body = ""; } - $tfe = send_event(new TextFormattingEvent($nav_page->body)); + $body_html = format_text($nav_page->body); // only the admin can edit the sidebar if ($user->can(Permissions::WIKI_ADMIN)) { - $tfe->formatted .= "

(Edit)"; - } - - // see if title is a category'd tag - $title_html = html_escape($wiki_page->title); - if (Extension::is_enabled(TagCategoriesInfo::KEY)) { - $tagcategories = new TagCategories(); - $tag_category_dict = $tagcategories->getKeyedDict(); - $title_html = $tagcategories->getTagHtml($title_html, $tag_category_dict); + $body_html .= "

(Edit)"; } if (!$wiki_page->exists) { $page->set_code(404); } - $page->set_title(html_escape($wiki_page->title)); + $page->set_title($wiki_page->title); $page->add_block(new NavBlock()); - $page->add_block(new Block("Wiki Index", rawHTML($tfe->formatted), "left", 20)); - $page->add_block(new Block($title_html, $this->create_display_html($wiki_page))); + $page->add_block(new Block("Wiki Index", rawHTML($body_html), "left", 20)); + $page->add_block(new Block($wiki_page->title, $this->create_display_html($wiki_page))); } /** @@ -62,14 +54,14 @@ public function display_page_history(Page $page, string $title, array $history): $html .= "{$rev}{$row['date']}"; } $html .= ""; - $page->set_title(html_escape($title)); + $page->set_title($title); $page->add_block(new NavBlock()); - $page->add_block(new Block(html_escape($title), rawHTML($html))); + $page->add_block(new Block($title, rawHTML($html))); } public function display_page_editor(Page $page, WikiPage $wiki_page): void { - $page->set_title(html_escape($wiki_page->title)); + $page->set_title($wiki_page->title); $page->add_block(new NavBlock()); $page->add_block(new Block("Editor", $this->create_edit_html($wiki_page))); } diff --git a/themes/danbooru/user.theme.php b/themes/danbooru/user.theme.php index 492e98e04..30ba30bfd 100644 --- a/themes/danbooru/user.theme.php +++ b/themes/danbooru/user.theme.php @@ -67,12 +67,10 @@ public function display_user_block(Page $page, User $user, array $parts): void public function display_signup_page(Page $page): void { global $config; - $tac = $config->get_string("login_tac", ""); - - $tac = send_event(new TextFormattingEvent($tac))->formatted; $reca = "".captcha_get_html().""; + $tac = format_text($config->get_string("login_tac", "")); if (empty($tac)) { $html = ""; } else { diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index 27cdd131a..ed4f26e4d 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -16,7 +16,7 @@ class DanbooruViewPostTheme extends ViewPostTheme public function display_page(Image $image, array $editor_parts): void { global $page; - $page->set_heading(html_escape($image->get_tag_list())); + $page->set_heading($image->get_tag_list()); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15)); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10)); diff --git a/themes/danbooru2/user.theme.php b/themes/danbooru2/user.theme.php index dee81721a..346866803 100644 --- a/themes/danbooru2/user.theme.php +++ b/themes/danbooru2/user.theme.php @@ -67,9 +67,6 @@ public function display_user_block(Page $page, User $user, array $parts): void public function display_signup_page(Page $page): void { global $config, $user; - $tac = $config->get_string("login_tac", ""); - - $tac = send_event(new TextFormattingEvent($tac))->formatted; $reca = "".captcha_get_html().""; @@ -79,6 +76,7 @@ public function display_signup_page(Page $page): void ); $email_text = $email_required ? "Email" : "Email (Optional)"; + $tac = format_text($config->get_string("login_tac", "")); if (empty($tac)) { $html = ""; } else { diff --git a/themes/danbooru2/view.theme.php b/themes/danbooru2/view.theme.php index 18c3bd07d..b1e7ae7d3 100644 --- a/themes/danbooru2/view.theme.php +++ b/themes/danbooru2/view.theme.php @@ -16,7 +16,7 @@ class Danbooru2ViewPostTheme extends ViewPostTheme public function display_page(Image $image, array $editor_parts): void { global $page; - $page->set_heading(html_escape($image->get_tag_list())); + $page->set_heading($image->get_tag_list()); $page->add_block(new Block("Search", $this->build_navigation($image), "left", 0)); $page->add_block(new Block("Information", $this->build_information($image), "left", 15)); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 15)); diff --git a/themes/futaba/view.theme.php b/themes/futaba/view.theme.php index f2e1b18c1..41fe79611 100644 --- a/themes/futaba/view.theme.php +++ b/themes/futaba/view.theme.php @@ -14,7 +14,7 @@ class FutabaViewPostTheme extends ViewPostTheme public function display_page(Image $image, array $editor_parts): void { global $page; - $page->set_heading(html_escape($image->get_tag_list())); + $page->set_heading($image->get_tag_list()); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10)); } } diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index c4da12af3..fc3f577dc 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -17,7 +17,7 @@ public function display_page(Image $image, array $editor_parts): void { global $page; $page->set_title("Post {$image->id}: ".$image->get_tag_list()); - $page->set_heading(html_escape($image->get_tag_list())); + $page->set_heading($image->get_tag_list()); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15)); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 11));