[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.
This commit is contained in:
Sanpaku 2021-09-05 07:54:44 +02:00
parent 85517ed9fe
commit 15c8e6b6cd
5 changed files with 74 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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 '<html data-stylesheet="'. $current_theme .'">';
echo '<head>';
echo '<title>Error!</title>';
echo '<script>';
if (isset($_POST['board'])) {
if ($config['boards'][$_POST['board']]['type'] == 'txt') {
echo 'var board_type = "txt";';
} else {
echo 'var board_type = "img";';
}
} else {
echo 'var board_type = "img";';
}
echo '</script>';
echo '<link rel="icon" type="image/png" href="' . $prefix_folder . '/assets/img/favicon.png"/>';
foreach ($config['css'] as $css) {
echo '<link rel="stylesheet" type="text/css" href="' . $prefix_folder . '/assets/css/' . $css . '.css">';
@ -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 '<html data-stylesheet="'. $current_theme .'">';
echo '<head>';
echo '<script>';
if ($config['boards'][$_POST['board']]['type'] == 'txt') {
echo 'var board_type = "txt";';
} else {
echo 'var board_type = "img";';
}
echo '</script>';
echo '<title>Success!</title>';
echo '<link rel="icon" type="image/png" href="' . $prefix_folder . '/assets/img/favicon.png"/>';
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('/\\\\/','&#92;', $string); //replace backslash
$string = preg_replace('/\$/','&#36;', $string); //replace $
return $string;

View File

@ -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*&gt;.*$/m", "<span class='quote'>$0</span>", $post_body);
//add replyquotes
$post_body = preg_replace("/^\s*&lt;.*$/m", "<span class='rquote'>$0</span>", $post_body);
//AsciiArt [aa]
$post_body = preg_replace("/\[aa\](.+?)\[\/aa\]/ms", "<span class='aa'>$0</span>", $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", "<div class='code'>$0</div>", $post_body);
$post_body = preg_replace("/\[code\]/", "", $post_body);
$post_body = preg_replace("/\[\/code\]/", "", $post_body);
//Spoilers
$post_body = preg_replace("/\[spoiler\](.+?)\[\/spoiler\]/ms", "<span class='spoiler'>$0</span>", $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