From 15c8e6b6cd8fc5ec7dddd15032fee55dac43b3cd Mon Sep 17 00:00:00 2001 From: Sanpaku <67713780+ithrts@users.noreply.github.com> Date: Sun, 5 Sep 2021 07:54:44 +0200 Subject: [PATCH] [code] [aa] [spoiler], fixed error theme for IB+BBS correct theme should now display on errors still need to fix a cookie init notice/warning on invalid GET board. --- assets/css/Late.css | 5 ++++- assets/css/Tomorrow.css | 4 ++++ assets/css/Yotsuba B.css | 18 ++++++++++++++++++ includes/functions.php | 32 ++++++++++++++++++++++++++++++-- post.php | 19 ++++++++++++++++++- 5 files changed, 74 insertions(+), 4 deletions(-) diff --git a/assets/css/Late.css b/assets/css/Late.css index dbc645a..a5177b4 100644 --- a/assets/css/Late.css +++ b/assets/css/Late.css @@ -27,7 +27,10 @@ html[data-stylesheet="Late"] span.link.name { html[data-stylesheet="Late"] a:hover, html[data-stylesheet="Late"] a span.link.name:hover, html[data-stylesheet="Late"] span.post-number a:hover { color: red; } - +html[data-stylesheet="Late"] .code { + background: #000; + color: #fff; +} html[data-stylesheet="Late"] .postingmode { background: #000; } diff --git a/assets/css/Tomorrow.css b/assets/css/Tomorrow.css index 3f7c240..e70dad5 100644 --- a/assets/css/Tomorrow.css +++ b/assets/css/Tomorrow.css @@ -22,6 +22,10 @@ html[data-stylesheet="Tomorrow"] span.quote { html[data-stylesheet="Tomorrow"] span.rquote { color: #bd6890; } +html[data-stylesheet="Tomorrow"] .code { + background: #000; + color: #fff; +} html[data-stylesheet="Tomorrow"] a, html[data-stylesheet="Tomorrow"] a:visited { color: #81a2be; } diff --git a/assets/css/Yotsuba B.css b/assets/css/Yotsuba B.css index c0a9bf4..54fe6d5 100644 --- a/assets/css/Yotsuba B.css +++ b/assets/css/Yotsuba B.css @@ -36,6 +36,24 @@ span.rquote { color: #e82389; } +.code { + font-family: 'Submona'; + background: #fff; + color: #000; +} +.aa { + font-family: 'Submona'; +} + +.spoiler { + background: #000; + color: #000; +} + +.spoiler:hover { + color: #fff; +} + a, a:visited { text-decoration: none; color: #34345c; diff --git a/includes/functions.php b/includes/functions.php index 2d022a0..1d901a5 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -5,9 +5,25 @@ function error($error) { require 'default.php'; //sets defaults require 'inits.php'; //defines possibly unused variables require 'custom.php'; // only change this, it will replace the default initialized settings. + + require __dir__ . '/../' . $database_folder . '/boards.php'; + echo ''; echo ''; echo 'Error!'; + + echo ''; + echo ''; foreach ($config['css'] as $css) { echo ''; @@ -99,9 +115,19 @@ function PostSuccess($redirect = false, $auto = true) { require 'default.php'; //sets defaults require 'inits.php'; //defines possibly unused variables require 'custom.php'; // only change this, it will replace the default initialized settings. + require __dir__ . '/../' . $database_folder . '/boards.php'; echo ''; echo ''; + + echo ''; + echo 'Success!'; echo ''; foreach ($config['css'] as $css) { @@ -175,8 +201,10 @@ function getTotalSize($dir) } } -function phpClean($string) { - $string = htmlspecialchars($string); +function phpClean($string, $special = true) { + if ($special == true) { + $string = htmlspecialchars($string); + } $string = preg_replace('/\\\\/','\', $string); //replace backslash $string = preg_replace('/\$/','$', $string); //replace $ return $string; diff --git a/post.php b/post.php index 4523ed6..ada543d 100644 --- a/post.php +++ b/post.php @@ -50,12 +50,29 @@ if (isset($_POST['thread'])) { //WORDFILTERS, CITATIONS, ETC. if ($post_body != '') { - //WHITESPACE (max lines adding?) + + //citations (probably gonna be a pain to fix dead links later?) + //todo + //add quotes $post_body = preg_replace("/^\s*>.*$/m", "$0", $post_body); //add replyquotes $post_body = preg_replace("/^\s*<.*$/m", "$0", $post_body); + //AsciiArt [aa] + $post_body = preg_replace("/\[aa\](.+?)\[\/aa\]/ms", "$0", $post_body); + $post_body = preg_replace("/\[aa\]/", "", $post_body); + $post_body = preg_replace("/\[\/aa\]/", "", $post_body); + //Code [code] + $post_body = preg_replace("/\[code\](.+?)\[\/code\]/ms", "
$0
", $post_body); + $post_body = preg_replace("/\[code\]/", "", $post_body); + $post_body = preg_replace("/\[\/code\]/", "", $post_body); + + //Spoilers + $post_body = preg_replace("/\[spoiler\](.+?)\[\/spoiler\]/ms", "$0", $post_body); + $post_body = preg_replace("/\[spoiler\]/", "", $post_body); + $post_body = preg_replace("/\[\/spoiler\]/", "", $post_body); + //remove newlines from start and end of string $post_body = ltrim($post_body); //start $post_body = rtrim($post_body); //end