filenames, anchors

This commit is contained in:
Sanpaku 2021-09-01 23:55:28 +02:00
parent 30e55ac4cb
commit 23f4ff570d
13 changed files with 274 additions and 22 deletions

32
assets/css/Kind.css Normal file
View File

@ -0,0 +1,32 @@
html[data-stylesheet="Kind"] body {
background: linear-gradient(to bottom, white, rgba(195,225,255,100) 10%);
min-height: calc(99vh - 8px);
color: #000;
}
html[data-stylesheet="Kind"] div#post-form th {
background-color: #F5FFFC;
color: #000;
font-weight: 700;
border: 1px solid #F5FFFC;
}
html[data-stylesheet="Kind"] div.page-info .small {
color: 000;
}
html[data-stylesheet="Kind"] div.post.reply {
background: #D7F0F5 !important;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-top-right-radius: 6px;
}
html[data-stylesheet="Kind"] span.name {
color: #af0a0f;
}
html[data-stylesheet="Kind"] div.post details table {
background: #d7f0f5;
border: 1px solid #000;
}

103
assets/css/Late.css Normal file
View File

@ -0,0 +1,103 @@
html[data-stylesheet="Late"] body {
background: #000;
color: #ACACAC;
font-family: 'Hack', monospace, sans-serif;
}
html[data-stylesheet="Late"] div#post-form th {
background-color: #202020;
color: #c5c8c6;
font-weight: 700;
border: 1.5px solid #A0A0A0;
border-radius: 3px;
}
html[data-stylesheet="Late"] span.subject {
color: #90ac9b;
}
html[data-stylesheet="Late"] span.name {
color: #445876;
}
html[data-stylesheet="Late"] a, html[data-stylesheet="Late"] a:visited {
color: #fff;
}
html[data-stylesheet="Late"] span.link.name {
color: #81a2be;
}
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"] .postingmode {
background: #000;
}
html[data-stylesheet="Late"] div.main {
border-color: #000;
background: #282a2e;
}
html[data-stylesheet="Late"] div.main h2 {
background: #1d1d21;
color: #c5c8c6;
border-bottom: 1px solid #111;
}
html[data-stylesheet="Late"] div.main a {
color: #fff;
}
html[data-stylesheet="Late"] div.main a:hover {
color: red;
}
html[data-stylesheet="Late"] div.main.first h2 {
background: #1d1d21;
color: #c5c8c6;
}
html[data-stylesheet="Late"] div.main.first {
color: #c5c8c6;
}
html[data-stylesheet="Late"] hr {
border-color: #282a2e;
}
html[data-stylesheet="Late"] input[type="text"]:focus, html[data-stylesheet="Late"] input[type="password"]:focus, html[data-stylesheet="Late"] input:not([type]):focus, html[data-stylesheet="Late"] textarea:focus {
border-color: #515151;
}
html[data-stylesheet="Late"] input[type="text"], html[data-stylesheet="Late"] input[type="password"], html[data-stylesheet="Late"] textarea {
background: #202020;
border: 1.5px solid #a0a0a0;
color: #c5c8c6;
border-radius: 3px;
}
html[data-stylesheet="Late"] input[type="checkbox"], html[data-stylesheet="Late"] input[type="submit"], html[data-stylesheet="Late"] input[type="file"], html[data-stylesheet="Late"] button, html[data-stylesheet="Late"] select {
filter: brightness(80%);
}
html[data-stylesheet="Late"] .page-info {
color: #c5c8c6;
}
html[data-stylesheet="Late"] .post-number a {
color: #c5c8c6;
}
html[data-stylesheet="Late"] .post.reply {
background: #292929;
border: 2px solid rgba(110, 110, 110, 0.6);
border-radius: 3px;
}
html[data-stylesheet="Late"] .post-time, html[data-stylesheet="Late"] .post-number {
font-weight: 700;
}
html[data-stylesheet="Late"] div.post-arrows {
opacity: 0;
}

View File

@ -40,12 +40,19 @@ div.file-info a {
div.post-image {
float: left;
margin: 4px 10px 0px 15px;
margin: 4px 10px 10px 15px;
}
div.post-image img {
max-width: 250px; /* TEMPORARY UNTIL THUMBNAILS FIXED */
max-height: 250px; /* TEMPORARY UNTIL THUMBNAILS FIXED */
min-width: 16px;
min-height: 16px;
}
div.post.reply .post-image img {
max-width: 125px; /* TEMPORARY UNTIL THUMBNAILS FIXED */
max-height: 125px; /* TEMPORARY UNTIL THUMBNAILS FIXED */
}
p {

View File

@ -12,8 +12,8 @@ $captcha_required = false;
$secure_hash = "SQp3FaEgyMyHe3=Zc!-vS%ya6W!JAt+9fqwdbGk&ev!hbG!nSMgN_KUbLrmRpCQy"; //Will be used to hash your post passwords. You should change this.
$time_method = 'since'; //(iso:iso8601 unix:numberstamp since:howlongsince human:humanreadable
$time_method_hover = "human"; //unix will always be in data-timestamp for potential js use
$time_method = 'compactsince'; //(iso:iso8601 unix:numberstamp since:howlongsince human:easy readable without MDY DMY confusion, compact uses DMY because MDY is a sin.
$time_method_hover = "human"; //iso, human, compact, since, compactsince
$forced_anon = false;
$default_name = 'Anonymous';
@ -22,7 +22,7 @@ $disable_email = false; //Disables the email field. Checkboxes will still work.
$show_email = true; //shows email in post name
$max_filesize = 1024*1000*8; //default 8mb
$max_filename = 128; //longer than this will be trimmed
$max_filename = 28; //longer than this will be trimmed visually, absolute max is set to 512 at which point it is trimmed when saved as well. you can see untrimmed below 512 by hovering over name
$thumb_method = 'GD'; //i probably wont implement any others
$thumb_ext = '.jpg'; //add support for transparent png, would use webp if apple stops shilling HEIC already and enables webp+webm support
@ -68,6 +68,8 @@ $config['css'][] = 'Burichan';
$config['css'][] = 'Futaba';
$config['css'][] = 'Tomorrow';
$config['css'][] = 'Late';
$config['css'][] = 'Kind';
$default_theme = 'Yotsuba';
@ -79,7 +81,8 @@ $config['js'][] = 'main.js'; //mandatory
$config['post_body_min'] = 10; //minimum characters, 0 to allow
$config['post_body_max'] = 4000; //maximum characters
$config['reply_body_min'] = false; //allow replies with only images
$config['reply_file_only'] = true; //allows zero text if contains file
$config['reply_body_min'] = 10; //minimum characters
$config['reply_body_max'] = 4000; //maximum characters

View File

@ -88,10 +88,10 @@ function isAllowedFile($file_upload, $array) {
//MOVE AND RENAME FILE
if (strlen($filename_) < $max_filename) {
if (strlen($filename_) < 512) {
$original_filename = $filename_;
} else {
$original_filename = $substr($filename_, 0, 128) . $fileext_)); //cut to
$original_filename = substr($filename_, 0, 512) . '(...)' . $fileext_; //cut to 512 for saving purposes
}

View File

@ -37,6 +37,11 @@ function dir_is_empty($dir) {
return TRUE;
}
function getExt($name) {
$n = strrpos($name,".");
return ($n===false) ? "" : substr($name,$n+1);
}
function timeago($unix) { //blatantly taken and modified from https://phppot.com/php/php-time-ago-function/
$timestamp = $unix;
$strTime = array("second", "minute", "hour", "day", "month", "year");
@ -60,12 +65,18 @@ function timeConvert($unix, $method = false) {
if ($method === 'iso') {
return date('Y-m-d\TH:i:sO', $unix);
}
elseif ($method === 'human') {
return date('jS F H:i (D), Y', $unix);
elseif ($method === 'human') { //universally readable without DMY or MDY standard
return date('d F Y (D) H:i:s', $unix);
}
elseif ($method === 'compact') {
return date('d/m/Y (D) H:i:s', $unix);
}
elseif ($method === 'since') {
return timeago($unix);
}
elseif ($method === 'compactsince') {
return date('d/m/Y (D) H:i:s', $unix) . ' (' . timeago($unix) . ')';
}
elseif ($method === false) {
return $unix;
}
@ -125,4 +136,43 @@ function UpdateOP($database_folder, $board, $thread, $page, $replies, $bumped, $
}
//https://stackoverflow.com/a/18568222
function getTotalSize($dir)
{
$dir = rtrim(str_replace('\\', '/', $dir), '/');
if (is_dir($dir) === true) {
$totalSize = 0;
$os = strtoupper(substr(PHP_OS, 0, 3));
// If on a Unix Host (Linux, Mac OS)
if ($os !== 'WIN') {
$io = popen('/usr/bin/du -sb ' . $dir, 'r');
if ($io !== false) {
$totalSize = intval(fgets($io, 80));
pclose($io);
return $totalSize;
}
}
// If on a Windows Host (WIN32, WINNT, Windows)
if ($os === 'WIN' && extension_loaded('com_dotnet')) {
$obj = new \COM('scripting.filesystemobject');
if (is_object($obj)) {
$ref = $obj->getfolder($dir);
$totalSize = $ref->size;
$obj = null;
return $totalSize;
}
}
// If System calls did't work, use slower PHP 5
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
foreach ($files as $file) {
$totalSize += $file->getSize();
}
return $totalSize;
} else if (is_file($dir) === true) {
return filesize($dir);
}
}
?>

View File

@ -31,15 +31,16 @@ if (isset($post_board)) {
//count unique
$uniqueids_ = count(array_unique($all_ips_));
$active_content = getTotalSize($path . '/' . $uploads_folder);
$frontpage_ = '<?php ';
$frontpage_ .= '$frontpage_uniqueids' . '=' . $uniqueids_ . ';';
$frontpage_ .= '$frontpage_active' . '= 0;';
$frontpage_ .= '$frontpage_active' . '= ' . $active_content . ';';
$frontpage_ .= '?>';
file_put_contents(__dir__ . '/../' . $database_folder . '/frontpage.php', $frontpage_);
exit();
//exit();
}
?>

View File

@ -64,10 +64,17 @@ if (isset($_POST['index'])) {
//IF NEW REPLY
if (isset($_POST['thread'])) {
if ($config['reply_body_min'] !== false) {
if(!isset($_FILES['file']) || $_FILES['file']['error'] == UPLOAD_ERR_NO_FILE) {
if (strlen($post_body) < $config['reply_body_min']) {
error('Reply too short. Min: 10.');
}
} else {
if ($config['reply_file_only'] == false) {
if (strlen($post_body) < $config['reply_body_min']) {
error('Reply too short. Min: 10.');
}
}
}
if (strlen($post_body) > $config['reply_body_max']) {
error('Reply too long. Max: 4000.');
@ -128,6 +135,7 @@ if ((isset($post_board)) && (isset($_POST['index']))) {
//
UpdateOP($database_folder, $post_board, $current_count, 1, 0, $current_count, 1); //information about thread and replies
include __dir__ . '/includes/update-frontpage.php';
PostSuccess($prefix_folder . $main_file . '/?board=' . $post_board . '&thread=' . $counter . '#' . $counter, true);
}
@ -201,13 +209,12 @@ if ((isset($post_board)) && (isset($_POST['thread']))) {
UpdateOP($database_folder, $post_board, $post_thread_number, 0, $reply_counter, $current_count, $ip_counter);
include __dir__ . '/includes/update-frontpage.php';
PostSuccess($prefix_folder . $main_file . '/?board=' . $post_board . '&thread=' . $post_thread_number . '#' . $current_count, true);
}
}
include __dir__ . '/includes/update-frontpage.php';
error('This shouldn\'t happen..');
?>

View File

@ -1,3 +1,4 @@
<a name="top"/>
<div id="boardlist">
[<?php
echo '<a href="' . $prefix_folder . '/' . $main_file . '">';

View File

@ -31,5 +31,5 @@
}
?>
<br>
<a name="bottom"/>
</div>

View File

@ -55,6 +55,6 @@ echo '</table>';
@include __dir__ . '/../../' . $database_folder . '/frontpage.php';
echo $frontpage_uniqueids;
?></div>
<div><b>Active Content:</b> 0...</div>
<div><b>Active Content:</b> <?php echo formatBytes($frontpage_active); ?></div>
</div>
</div>

View File

@ -6,7 +6,7 @@
<?php if ($reply_subject != '') { echo '<span class="subject">' . $reply_subject . '&nbsp;</span>'; }?>
<?php if (($reply_email != '') && ($show_email != false)) { echo '<a href="mailto:' . $reply_email . '">';}?><span class="<?php if(($reply_email != '') && ($show_email != false)) { echo 'link '; } ?>name"><?php echo $reply_name; ?></span>&nbsp;<?php if (($reply_email != '') && ($show_email != false)) { echo '</a>'; }?>
<span class="post-time" data-timestamp="<?php echo $reply_time;?>" data-tooltip="<?php echo timeConvert($reply_time, $time_method_hover); ?>"><?php echo timeConvert($reply_time, $time_method); ?>&nbsp;</span>
<span class="post-number"><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>"><?php echo $post_number_reply; ?></a>&nbsp;</span>
<span class="post-number"><a name="<?php echo $post_number_reply; ?>" href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>"><?php echo $post_number_reply; ?></a>&nbsp;</span>
<?php if ($post_buttons == true) {
echo '
@ -35,5 +35,43 @@
}?>
</div>
<?php
if ($reply_file != '') {
if ($reply_file[0][0] == 'image') {
echo '<div class="post-file">';
echo '<div class="file-info">';
if ($original_filename == true && strlen($reply_file[0][2]) > $max_filename ) {
echo 'File: <a title="' . $reply_file[0][2] . '" href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '">';
echo substr($reply_file[0][2], 0, $max_filename) . '(...).' . getExt($reply_file[0][2]);
echo '</a>';
} elseif ($original_filename == true) {
echo 'File: <a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '">';
echo $reply_file[0][2];
echo '</a>';
} else {
echo 'File: <a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
echo $op_file[0][1];
echo '</a>';
}
echo ' (' . formatBytes($reply_file[0][4]) . ', ' . $reply_file[0][3] . ')';
echo '</div>';
echo '<div class="post-image">';
echo '<a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '">';
if ($reply_file[0][5] != "1") {
echo '<img src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '"/>';
} else {
echo '<img src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
}
echo '</a>';
echo '</div>';
echo '</div>';
//reset images
$reply_file = false;
}
}
?>
<blockquote class="post-content"><?php echo $reply_body; ?></blockquote>
</div>

View File

@ -6,19 +6,29 @@
if ($op_file[0][0] == 'image') {
echo '<div class="post-file">';
echo '<div class="file-info">';
echo 'File: <a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
if ($original_filename == true) {
if ($original_filename == true && strlen($op_file[0][2]) > $max_filename ) {
echo 'File: <a title="' . $op_file[0][2] . '" href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
echo substr($op_file[0][2], 0, $max_filename) . '(...).' . getExt($op_file[0][2]);
echo '</a>';
} elseif ($original_filename == true) {
echo 'File: <a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
echo $op_file[0][2];
echo '</a>';
} else {
echo 'File: <a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
echo $op_file[0][1];
echo '</a>';
}
echo '</a>';
echo ' (' . formatBytes($op_file[0][4]) . ', ' . $op_file[0][3] . ')';
echo '</div>';
echo '<div class="post-image">';
echo '<a href="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '">';
if ($op_file[0][5] != "1") {
echo '<img src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '"/>';
} else {
echo '<img src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
}
echo '</a>';
echo '</div>';
echo '</div>';
@ -33,7 +43,7 @@
<?php if ($op_subject != '') { echo '<span class="subject">' . $op_subject . '&nbsp;</span>'; }?>
<?php if (($op_email != '') && ($show_email != false)) { echo '<a href="mailto:' . $op_email . '">';}?><span class="<?php if(($op_email != '') && ($show_email != false)) { echo 'link '; } ?>name"><?php echo $op_name; ?></span>&nbsp;<?php if ($op_email != '') { echo '</a>'; }?>
<span class="post-time" data-timestamp="<?php echo $op_time;?>" data-tooltip="<?php echo timeConvert($op_time, $time_method_hover); ?>"><?php echo timeConvert($op_time, $time_method); ?>&nbsp;</span>
<span class="post-number"><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>"><?php echo $post_number_op; ?></a>&nbsp;</span>
<span class="post-number"><a name="<?php echo $post_number_op; ?>" href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>"><?php echo $post_number_op; ?></a>&nbsp;</span>
<?php if ($post_buttons == true) {
echo '