Initial Commit
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*error_log
|
||||
uploads/*
|
||||
database/boards/*
|
||||
.gitattributes
|
9
LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
# License of ImoutoIB
|
||||
|
||||
Copyright 2021 ithrts
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
All copyright notices and permission notices (including this file) shall be included and remain unedited in all copies or substantial portions of the Software. This explicitly includes but is not limited to the vichan copyright notices found in the footers of some template files.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
60
README.md
Normal file
@ -0,0 +1,60 @@
|
||||
ImoutoIB - Terrible imageboard software.
|
||||
========================================================
|
||||
|
||||
But anon-san — if it's so terrible, Why should I use it?
|
||||
------------
|
||||
|
||||
Well for starters it has:
|
||||
|
||||
- No support...
|
||||
- No database?
|
||||
- No glowies!
|
||||
- Lacks so much in features that it will work on just about anything. Uwah!
|
||||
- Will probably break at random — oh well!
|
||||
- but most important of all!! It has soul...
|
||||
|
||||
I think that last one is a selling point!
|
||||
|
||||

|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
If even your shared hosting can't run this, you're being scammed or you messed up.
|
||||
|
||||
Anyways, use PHP 7. Might work on 5 or 8, I don't know!!! QA is for people getting paid...
|
||||
|
||||
No database needed.
|
||||
|
||||
Installation
|
||||
-------------
|
||||
|
||||
Just put it somewhere, it *should* work.
|
||||
|
||||
By default the configuration assumes that you have the imageboard in name.domain/ib/ and that you use apache.
|
||||
|
||||
If hosted in root directory, go to includes/custom.php change $prefix_folder from '/ib' to ''. Or whatever folder you put it in.
|
||||
|
||||
If not using apache with included htaccess to remove main.php, add 'main.php' to $main_file.
|
||||
|
||||
Edit /database/boards.php to create/edit/delete boards and /database/users.php to create/edit/delete users. (I guess I could have a mod.php default username+pw to allow this to be unnecessary later?)
|
||||
|
||||
Upgrade
|
||||
-------
|
||||
|
||||
\>Implying I'm gonna upgrade this soykaf software.
|
||||
|
||||
Just replace everything except database folder and your custom.php file.
|
||||
|
||||
You didn't change any of the templates, RIGHT?!
|
||||
|
||||
Support
|
||||
--------
|
||||
|
||||
Gambare!!!
|
||||
|
||||
I basically reinvented the wheel except instead of making it nice and round I made it a square.
|
||||
|
||||
License
|
||||
--------
|
||||
See [LICENSE.md](http://github.com/ithrts/ImoutoIB/master/README.md).
|
90
assets/css/Tomorrow.css
Normal file
@ -0,0 +1,90 @@
|
||||
html[data-stylesheet="Tomorrow"] body {
|
||||
background: #1d1f21;
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div#post-form th {
|
||||
background-color: #282a2e;
|
||||
color: #c5c8c6;
|
||||
font-weight: 700;
|
||||
border: 1px solid #111;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] span.subject {
|
||||
color: #b294bb;
|
||||
}
|
||||
html[data-stylesheet="Tomorrow"] span.name {
|
||||
color: #00c36a;
|
||||
}
|
||||
html[data-stylesheet="Tomorrow"] a, html[data-stylesheet="Tomorrow"] a:visited {
|
||||
color: #81a2be;
|
||||
}
|
||||
html[data-stylesheet="Tomorrow"] span.link.name {
|
||||
color: #81a2be;
|
||||
}
|
||||
html[data-stylesheet="Tomorrow"] a:hover, html[data-stylesheet="Tomorrow"] a span.link.name:hover, html[data-stylesheet="Tomorrow"] span.post-number a:hover {
|
||||
color: #5f89ac;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main {
|
||||
border-color: #000;
|
||||
background: #282a2e;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main h2 {
|
||||
background: #1d1d21;
|
||||
color: #c5c8c6;
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main a {
|
||||
color: #81a2be;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main a:hover {
|
||||
color: #5f89ac;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main.first h2 {
|
||||
background: #1d1d21;
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.main.first {
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] hr {
|
||||
border-color: #282a2e;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] input[type="text"]:focus, html[data-stylesheet="Tomorrow"] input[type="password"]:focus, html[data-stylesheet="Tomorrow"] input:not([type]):focus, html[data-stylesheet="Tomorrow"] textarea:focus {
|
||||
border-color: #515151;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] input[type="text"], html[data-stylesheet="Tomorrow"] input[type="password"], html[data-stylesheet="Tomorrow"] textarea {
|
||||
background: #282a2e;
|
||||
border-color: #000;
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] input[type="checkbox"], html[data-stylesheet="Tomorrow"] input[type="submit"], html[data-stylesheet="Tomorrow"] input[type="file"], html[data-stylesheet="Tomorrow"] button, html[data-stylesheet="Tomorrow"] select {
|
||||
filter: brightness(80%);
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] .page-info {
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] .post-number a {
|
||||
color: #c5c8c6;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] .post.reply {
|
||||
background: #282a2e;
|
||||
border-color: #282a2e;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Tomorrow"] div.post-arrows {
|
||||
color: #c5c8c6;
|
||||
}
|
278
assets/css/Yotsuba B.css
Normal file
@ -0,0 +1,278 @@
|
||||
body {
|
||||
font-family: arial,helvetica,sans-serif;
|
||||
background: #eef2ff;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
|
||||
.small {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
span.name {
|
||||
color: #117743;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
span.link.name {
|
||||
color: #0f0c5d;
|
||||
font-weight: 700;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
span.subject {
|
||||
color: #0f0c5d;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
text-decoration: none;
|
||||
color: #34345c;
|
||||
}
|
||||
|
||||
a:hover, .post-number a:hover {
|
||||
color: #d00;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: none;
|
||||
border-top: 1px solid #b7c5d9;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.banner {
|
||||
width: 240px;
|
||||
height: 60px;
|
||||
border: 1px solid #000;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
div.page-info {
|
||||
text-align: center;
|
||||
color: #af0a0f;
|
||||
}
|
||||
|
||||
div.page-info h1 {
|
||||
margin: 0;
|
||||
letter-spacing: -2px;
|
||||
font-weight: 700;
|
||||
font-family: Tahoma,sans-serif;
|
||||
}
|
||||
|
||||
div#boardlist {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.main {
|
||||
width: 750px;
|
||||
margin: auto;
|
||||
background: white;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.main h2 {
|
||||
background: #98e;
|
||||
padding-left: 4px;
|
||||
font-size: 16px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.main p {
|
||||
font-size: 10pt;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
table#boards {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table#boards tr th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table#boards thead th {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#post-form {
|
||||
width: 450px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#post-form th {
|
||||
background-color: #98e;
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
border: 1px solid #000;
|
||||
padding: 0 5px;
|
||||
font-size: 10pt;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="password"], textarea {
|
||||
appearance: none;
|
||||
border-radius: 0;
|
||||
outline: none;
|
||||
border: 1px solid #aaa;
|
||||
width: 200px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, input[type="password"]:focus, input:not([type]):focus, textarea:focus {
|
||||
border: 1px solid #98e;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 275px;
|
||||
}
|
||||
|
||||
div.footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.footer p {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
input[name="captcha"] {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.message {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
margin-top: 25%;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.abovefooter {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.float-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.stats div {
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
#boards, .main.first p, .stats {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.post-number a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
img#captcha {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
div.postingmode {
|
||||
text-align: center;
|
||||
background: #e04000;
|
||||
color: white;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
[data-tooltip] {
|
||||
position: relative;
|
||||
white-space: pre;
|
||||
cursor: default;
|
||||
}
|
||||
[data-tooltip]::after, [data-tooltip]::before {
|
||||
visibility: hidden;
|
||||
transition: all linear 0.001s;
|
||||
transition-delay: 0.3s;
|
||||
white-space: pre;
|
||||
}
|
||||
[data-tooltip]:hover::before, [data-tooltip]:hover::after {
|
||||
visibility: visible;
|
||||
}
|
||||
[data-tooltip]:hover {
|
||||
position: relative;
|
||||
}
|
||||
[data-tooltip]::after {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
border-top: 5px solid #1a1a1a;
|
||||
position: absolute;
|
||||
bottom: 55%;
|
||||
content: '';
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
[data-tooltip]::before {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
display: inline-block;
|
||||
border-radius: 0px;
|
||||
padding: 2px 5px 2px 5px;
|
||||
background-color: #1a1a1a;
|
||||
content: attr(data-tooltip);
|
||||
color: #f9f9f9;
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
margin-bottom: 2px;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
font-style: initial;
|
||||
font-weight: initial;
|
||||
}
|
||||
|
||||
div.blotter {
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.post.reply {
|
||||
display: table;
|
||||
background: #d6daf0;
|
||||
margin: 4px;
|
||||
padding: 2px;
|
||||
border: 1px solid #b7c5d9;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
div.omitted {
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
div.post-arrows {
|
||||
float: left;
|
||||
margin-right: 2px;
|
||||
color: #b7c5d9;
|
||||
}
|
||||
|
||||
details summary {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
label {
|
||||
user-select: none;
|
||||
font-size: 10pt;
|
||||
}
|
72
assets/css/Yotsuba.css
Normal file
@ -0,0 +1,72 @@
|
||||
html[data-stylesheet="Yotsuba"] body {
|
||||
background: #ffe;
|
||||
color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div#post-form th {
|
||||
background-color: #ea8;
|
||||
color: #800;
|
||||
font-weight: 700;
|
||||
border: 1px solid #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] span.subject {
|
||||
color: red;
|
||||
}
|
||||
html[data-stylesheet="Yotsuba"] a, html[data-stylesheet="Yotsuba"] a:visited {
|
||||
color: #00e;
|
||||
}
|
||||
html[data-stylesheet="Yotsuba"] span.link.name {
|
||||
color: #00e;
|
||||
}
|
||||
html[data-stylesheet="Yotsuba"] a:hover, html[data-stylesheet="Yotsuba"] a span.link.name:hover, html[data-stylesheet="Yotsuba"] .post-number a:hover {
|
||||
color: #d00;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main {
|
||||
border-color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main h2 {
|
||||
background: #fca;
|
||||
color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main a {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main a:hover {
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main.first h2 {
|
||||
background: #800;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.main.first {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] hr {
|
||||
border-color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] input[type="text"]:focus, html[data-stylesheet="Yotsuba"] input[type="password"]:focus, html[data-stylesheet="Yotsuba"] input:not([type]):focus, html[data-stylesheet="Yotsuba"] textarea:focus {
|
||||
border-color: #ea8;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] .post-number a {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] .post.reply {
|
||||
background: #f0e0d6;
|
||||
border-color: #d9bfb7;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Yotsuba"] div.post-arrows {
|
||||
color: #e0bfb7;
|
||||
}
|
BIN
assets/fonts/captcha0.ttf
Normal file
BIN
assets/img/404.png
Normal file
After Width: | Height: | Size: 149 KiB |
BIN
assets/img/audio.png
Normal file
After Width: | Height: | Size: 11 KiB |
26
assets/img/banner.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
//function load banners in banner
|
||||
|
||||
|
||||
|
||||
function getRandomImage($dir_path = NULL){
|
||||
$files = scandir($dir_path);
|
||||
$count = count($files);
|
||||
if($count > 2){
|
||||
$index = rand(2, ($count-1));
|
||||
$filename = $files[$index];
|
||||
return $filename;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$banner = getRandomImage(__dir__ . '/banners');
|
||||
|
||||
echo ' <div class="banner">
|
||||
<img class="banner" src="'. $prefix_folder . '/assets/img/banners/' . $banner . '"/>
|
||||
</div>';
|
||||
|
||||
|
||||
?>
|
BIN
assets/img/banners/banner.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
assets/img/banners/banner2.jpg
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
assets/img/download.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
assets/img/favicon.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
assets/img/favicono.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
assets/img/spoiler.png
Normal file
After Width: | Height: | Size: 37 KiB |
44
assets/js/main.js
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
|
||||
//captcha refresh code
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (captcha_required = true) {
|
||||
if (document.getElementById("captcha")) {
|
||||
var refreshButton = document.querySelector("#captcha");
|
||||
refreshButton.onclick = function() {
|
||||
document.querySelector("#captcha").src = install_location + '/includes/captcha.php?' + Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//theme selector
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (localStorage.theme == undefined) {
|
||||
localStorage.theme = default_theme;
|
||||
}
|
||||
if (document.getElementById("themes") != undefined) {
|
||||
document.getElementById("themes").onchange = function() {
|
||||
localStorage.theme = document.getElementById("themes").value;
|
||||
document.documentElement.setAttribute("data-stylesheet", document.getElementById("themes").value);
|
||||
}
|
||||
document.getElementById("themes").value = localStorage.theme;
|
||||
}
|
||||
document.documentElement.setAttribute("data-stylesheet", localStorage.theme);
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (document.getElementById("upload")) {
|
||||
document.getElementById("upload").setAttribute("title", "Shift + Left Click to remove file.");
|
||||
document.getElementById("upload").addEventListener("click",
|
||||
function(event) {
|
||||
if (event.shiftKey) {
|
||||
document.getElementById("upload").value = '';
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
});
|
36
database/boards.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
|
||||
//just copy paste one and edit it
|
||||
|
||||
$config['boards']['test'] = array(
|
||||
'url' => 'test',
|
||||
'title' => 'Test',
|
||||
'description' => 'QA? I\'m not getting paid!!',
|
||||
'locked' => 0,
|
||||
'hidden' => 0
|
||||
);
|
||||
|
||||
$config['boards']['d'] = array(
|
||||
'url' => 'd',
|
||||
'title' => 'Demo',
|
||||
'description' => 'Just a second test board...',
|
||||
'locked' => 0,
|
||||
'hidden' => 0
|
||||
);
|
||||
|
||||
$config['boards']['2d'] = array(
|
||||
'url' => '2d',
|
||||
'title' => '2D Girls',
|
||||
'description' => 'We don\'t need hurtful 3DPD.',
|
||||
'locked' => 0,
|
||||
'hidden' => 0
|
||||
);
|
||||
|
||||
|
||||
foreach ($config['boards'] as $boards) {
|
||||
$config['boardlist'][] = $boards['url'];
|
||||
}
|
||||
|
||||
|
||||
?>
|
0
database/users.php
Normal file
60
includes/captcha.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$permitted_chars = '3456ABCDEFGHJKLMNPQRSRUVWXY';
|
||||
|
||||
function generate_string($input, $strength = 10) {
|
||||
$input_length = strlen($input);
|
||||
$random_string = '';
|
||||
for($i = 0; $i < $strength; $i++) {
|
||||
$random_character = $input[mt_rand(0, $input_length - 1)];
|
||||
$random_string .= $random_character;
|
||||
}
|
||||
$random_string = strtolower($random_string);
|
||||
return $random_string;
|
||||
}
|
||||
|
||||
$image = imagecreatetruecolor(200, 50);
|
||||
|
||||
imageantialias($image, true);
|
||||
|
||||
$colors = [];
|
||||
|
||||
$red = rand(125, 175);
|
||||
$green = rand(125, 175);
|
||||
$blue = rand(125, 175);
|
||||
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
$colors[] = imagecolorallocate($image, $red - 20*$i, $green - 20*$i, $blue - 20*$i);
|
||||
}
|
||||
|
||||
imagefill($image, 0, 0, $colors[0]);
|
||||
|
||||
for($i = 0; $i < 10; $i++) {
|
||||
imagesetthickness($image, rand(2, 10));
|
||||
$line_color = $colors[rand(1, 4)];
|
||||
imagerectangle($image, rand(-10, 190), rand(-10, 10), rand(-10, 190), rand(40, 60), $line_color);
|
||||
}
|
||||
|
||||
$black = imagecolorallocate($image, 0, 0, 0);
|
||||
$white = imagecolorallocate($image, 255, 255, 255);
|
||||
$textcolors = [$white, $white];
|
||||
|
||||
$fonts = [__dir__ .'/../assets/fonts/captcha0.ttf', __dir__ .'/../assets/fonts/captcha0.ttf', __dir__ .'/../assets/fonts/captcha0.ttf', __dir__ .'/../assets/fonts/captcha0.ttf'];
|
||||
|
||||
$string_length = 6;
|
||||
$captcha_string = generate_string($permitted_chars, $string_length);
|
||||
|
||||
$_SESSION['captcha_text'] = $captcha_string;
|
||||
|
||||
for($i = 0; $i < $string_length; $i++) {
|
||||
$letter_space = 170/$string_length;
|
||||
$initial = 15;
|
||||
|
||||
imagettftext($image, 24, rand(-15, 15), $initial + $i*$letter_space, rand(25, 45), $textcolors[rand(0, 1)], $fonts[array_rand($fonts)], $captcha_string[$i]);
|
||||
}
|
||||
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
9
includes/custom.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
//ONLY MAKE CONFIGURATIONS IN THIS FILE
|
||||
$prefix_folder = '/ib'; // empty for root dir
|
||||
$main_file = ''; //empty with handler using main.php as index
|
||||
|
||||
$site_name = 'ImoutoIB';
|
||||
|
||||
?>
|
42
includes/default.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
$config['debug'] = true; // enables error logging, soykaf code, you'll want this enabled until you're sure everything works as should lol
|
||||
$config['generated_in'] = true; //enables time spend generating in page footer
|
||||
$prefix_folder = ''; // leave empty if in directory root, example 'ib' if in /ib/
|
||||
$database_folder = 'database'; //no need to change this really
|
||||
$main_file = 'main.php'; //leave empty if using handlers like apache to hide filename example: /ib/?boards= vs /ib/main.php?boards=
|
||||
$post_file = 'post.php'; //i cant imagine any reason to change this, but i suppose it could be in a different folder if you want to
|
||||
|
||||
$site_name = 'ImoutoIB';
|
||||
|
||||
$captcha_required = false;
|
||||
|
||||
$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
|
||||
|
||||
|
||||
$config['display_banner'] = true;
|
||||
//$config['banner'][] = true;
|
||||
|
||||
// STYLESHEETS
|
||||
$config['css'][] = 'Yotsuba B'; //mandatory
|
||||
$config['css'][] = 'Yotsuba';
|
||||
$config['css'][] = 'Tomorrow';
|
||||
|
||||
$default_theme = 'Yotsuba';
|
||||
|
||||
// JAVASCRIPTS
|
||||
$config['js'][] = 'main.js'; //mandatory
|
||||
//$config['js'][] = 'extensions.js';
|
||||
|
||||
//POST SETTINGS
|
||||
$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_body_max'] = 4000; //maximum characters
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
106
includes/functions.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
|
||||
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.
|
||||
echo '<html data-stylesheet="'. $current_theme .'">';
|
||||
echo '<head>';
|
||||
echo '<title>Error!</title>';
|
||||
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">';
|
||||
}
|
||||
foreach ($config['js'] as $js) {
|
||||
echo '<script type="text/javascript" src="' . $prefix_folder . '/assets/js/' . $js . '"></script>';
|
||||
}
|
||||
|
||||
echo '</head>';
|
||||
echo '<body current_page="message">';
|
||||
echo '<div class="message">Gomen nasai... An error occurred: ' . $error . '</div>';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
function dir_is_empty($dir) {
|
||||
$dir = opendir($dir);
|
||||
while (false !== ($entry = readdir($dir))) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
closedir($dir); // <= I added this
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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");
|
||||
$length = array("60","60","24","30","12","10");
|
||||
$currentTime = time();
|
||||
if($currentTime >= $timestamp) {
|
||||
$diff = time()- $timestamp;
|
||||
for($i = 0; $diff >= $length[$i] && $i < count($length)-1; $i++) {
|
||||
$diff = $diff / $length[$i];
|
||||
}
|
||||
$diff = round($diff);
|
||||
if ($diff > 1) {
|
||||
return $diff . " " . $strTime[$i] . "s ago";
|
||||
} else {
|
||||
return $diff . ' ' . $strTime[$i] . ' ago';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function timeConvert($unix, $method = false) {
|
||||
if ($method === 'iso') {
|
||||
return date('Y-m-d\TH:i:sO', $unix);
|
||||
}
|
||||
elseif ($method === 'human') {
|
||||
return date('jS F (D), Y, G:i', $unix);
|
||||
}
|
||||
elseif ($method === 'since') {
|
||||
return timeago($unix);
|
||||
}
|
||||
elseif ($method === false) {
|
||||
return $unix;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function PostSuccess($redirect = false, $auto = true) {
|
||||
|
||||
//TO DO: redirect to $post_board+thread parameter
|
||||
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.
|
||||
|
||||
echo '<html data-stylesheet="'. $current_theme .'">';
|
||||
echo '<head>';
|
||||
echo '<title>Success!</title>';
|
||||
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">';
|
||||
}
|
||||
foreach ($config['js'] as $js) {
|
||||
echo '<script type="text/javascript" src="' . $prefix_folder . '/assets/js/' . $js . '"></script>';
|
||||
}
|
||||
|
||||
if (($redirect !== false) && $auto == true) {
|
||||
echo '<meta http-equiv="refresh" content="2; URL=' . $redirect . '" />';
|
||||
}
|
||||
|
||||
echo '</head>';
|
||||
echo '<body current_page="message">';
|
||||
echo '<div class="message">Sugoi!! Post success!!</div>';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
44
includes/inits.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
if ($config['debug'] === true) {
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
$title = '$title';
|
||||
$current_page = '$current_page';
|
||||
$current_board = '';
|
||||
$current_thread = '';
|
||||
$board_title = '$board_title';
|
||||
$board_description = '$board_title';
|
||||
$post_number_op = '';
|
||||
|
||||
if ($config['generated_in'] === true) {
|
||||
$start_time = microtime(true);
|
||||
}
|
||||
|
||||
//params
|
||||
if (!isset($_GET["thread"])) {
|
||||
$_GET["thread"] = '';
|
||||
}
|
||||
if (!isset($_GET["page"])) {
|
||||
$_GET["page"] = '';
|
||||
}
|
||||
if (!isset($_GET["board"])) {
|
||||
$_GET["board"] = '';
|
||||
}
|
||||
// SET THEME COOKIE FOR NO-JS USERS (CUZ IM COOL LIKE DAT)
|
||||
if (!isset($_COOKIE["theme"])) {
|
||||
setcookie("theme", $config['css'][0], time() + (60 * 60 * 24 * 365 )); // 1 year expiry, default to first theme in default.php.
|
||||
}
|
||||
if (isset($_GET["theme"])) {
|
||||
unset($_COOKIE["theme"]);
|
||||
setcookie("theme", htmlspecialchars($_GET["theme"]), time() + (60 * 60 * 24 * 365 ));
|
||||
}
|
||||
$current_theme = ''; //prevent some cookie blockers throwing notice errors
|
||||
if (isset($_COOKIE["theme"])) {
|
||||
$current_theme = $_COOKIE["theme"];
|
||||
}
|
||||
|
||||
?>
|
222
main.php
Normal file
@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/require.php';
|
||||
|
||||
|
||||
//IF NO BOARD PARAMETER (FRONT PAGE)
|
||||
if ((!isset($_GET["board"])) || ($_GET["board"] == '')) {
|
||||
|
||||
$title = $site_name;
|
||||
|
||||
$total_posts = 0;
|
||||
foreach ($config['boards'] as $boards) {
|
||||
//prevent error on new board with 0 posts. you need to visit frontpage at least once otherwise board throws an error, but its not fatal or anything....
|
||||
if (!file_exists(__dir__ . '/' . $database_folder . '/boards/' . $boards['url'] . '/counter.php')) {
|
||||
@mkdir(__dir__ . '/' . $database_folder . '/boards/' . $boards['url']);
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $boards['url'] . '/counter.php', 1);
|
||||
}
|
||||
//
|
||||
$total_posts += file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $boards['url'] . '/counter.php');
|
||||
$total_posts -= 1; //idk how i fucked up the counter.php in post.php this badly.
|
||||
}
|
||||
|
||||
if (isset($_GET["theme"])) {
|
||||
echo '<html data-stylesheet="'. htmlspecialchars($_GET["theme"]) .'">';
|
||||
} else {
|
||||
echo '<html data-stylesheet="'. $current_theme .'">';
|
||||
}
|
||||
echo '<head>';
|
||||
include $path . '/templates/header.html';
|
||||
echo '</head>';
|
||||
echo '<body class="frontpage">';
|
||||
include $path . '/templates/boardlist.html';
|
||||
include $path . '/templates/frontpage.html';
|
||||
include $path . '/templates/footer.html';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
}
|
||||
|
||||
// IF BOARD EXISTS
|
||||
if (in_Array(htmlspecialchars($_GET["board"]), $config['boardlist'])) {
|
||||
|
||||
$current_board = htmlspecialchars($_GET["board"]);
|
||||
$board_description = $config['boards'][$current_board]['description'];
|
||||
$board_title = $config['boards'][$current_board]['title'];
|
||||
|
||||
|
||||
// IF NOT THREAD (if index)
|
||||
if (htmlspecialchars($_GET["thread"]) === "") {
|
||||
$current_page = "index";
|
||||
$title = '/' . $current_board . '/ - ' . $config['boards'][$current_board]['title'] . ' - ' . $site_name;
|
||||
}
|
||||
|
||||
// TO DO: CHECK WHAT INDEX PAGE (starting with 1 infinite index for now)
|
||||
|
||||
// IF THREAD
|
||||
if ((htmlspecialchars($_GET["thread"]) != '') && (file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"])))) {
|
||||
$current_page = "thread";
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"]) . '/OP.php';
|
||||
$post_number_op = htmlspecialchars($_GET["thread"]);
|
||||
if ($op_subject == '') {
|
||||
$title = '/' . $current_board . '/' . ' - ' . substr($op_body,0,30) . ' - ' . $config['boards'][$current_board]['title'] . ' - ' . $site_name;
|
||||
} else {
|
||||
$title = '/' . $current_board . '/' . ' - ' . $op_subject . ' - ' . $config['boards'][$current_board]['title'] . ' - ' . $site_name;
|
||||
}
|
||||
}
|
||||
|
||||
if ((htmlspecialchars($_GET["thread"]) != '') && (!file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"])))) {
|
||||
$title = "Oh no!! A 404...";
|
||||
//the error is in a different castle actually, look further down
|
||||
}
|
||||
|
||||
if (isset($_GET["theme"])) {
|
||||
echo '<html data-stylesheet="'. htmlspecialchars($_GET["theme"]) .'">';
|
||||
} else {
|
||||
echo '<html data-stylesheet="'. $current_theme .'">';
|
||||
}
|
||||
echo '<head>';
|
||||
include $path . '/templates/header.html';
|
||||
echo '</head>';
|
||||
echo '<body current_page="' . $current_page . '">';
|
||||
include $path . '/templates/boardlist.html';
|
||||
include $path . '/templates/page-info.html';
|
||||
include $path . '/templates/post-form.html';
|
||||
|
||||
if (htmlspecialchars($_GET["thread"]) != '') {
|
||||
echo '[<a href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '">Return</a>] ';
|
||||
echo '<hr>';
|
||||
}
|
||||
|
||||
//if index
|
||||
//foreach folder in current_board
|
||||
if (htmlspecialchars($_GET["thread"]) === "") {
|
||||
|
||||
//if zero threads aka new board
|
||||
if (file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/counter.php') === "1") {
|
||||
echo 'This board has no threads yet.';
|
||||
include $path . '/templates/footer.html';
|
||||
exit();
|
||||
}
|
||||
|
||||
//FIND THREADS
|
||||
$threads_full = [];
|
||||
$threads_full = glob(__dir__ . '/' . $database_folder . '/boards/' . $current_board . "/*", GLOB_ONLYDIR);
|
||||
|
||||
//SORTING
|
||||
foreach ($threads_full as $key => $thread) {
|
||||
$threadz= basename($thread);
|
||||
if (!file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . basename($thread) . '/bumped.php')) {
|
||||
$bumped = basename($thread);
|
||||
}
|
||||
if (file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . basename($thread) . '/bumped.php')) {
|
||||
$bumped = file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . basename($thread) . '/bumped.php');
|
||||
}
|
||||
$threads[$key] = [];
|
||||
$threads[$key]['id'] = $threadz;
|
||||
$threads[$key]['bumped'] = $bumped;
|
||||
}
|
||||
$keys_ = array_column($threads, 'bumped');
|
||||
array_multisort($keys_, SORT_DESC, $threads);
|
||||
|
||||
////// to do: use post/mod.php to allow for a sticky 0/1, locked 0/1, if sticky show 0-1 replies max
|
||||
|
||||
//SHOW THEM
|
||||
foreach (array_keys($threads) as $key => $value) {
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . $threads[$key]['id'] . '/OP.php';
|
||||
$post_number_op = $threads[$key]['id'];
|
||||
|
||||
//SHOW REPLIES TO THREADS ON INDEX (im gonna need a lot of changes here later for sorting and maximum, configurable recents.php updated by post.php for performance?)
|
||||
//ADD ALL REPLIES HERE
|
||||
//FIND REPLIES
|
||||
$replies_full = [];
|
||||
$replies_full = glob(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . $post_number_op . "/*");
|
||||
//SORTING
|
||||
$replies = [];
|
||||
foreach ($replies_full as $reply) {
|
||||
if ((basename($reply) != ('OP.php') && basename($reply) != ('bumped.php'))) {
|
||||
$replies[] = basename($reply, '.php');
|
||||
}
|
||||
}
|
||||
$total_replies = count($replies);
|
||||
rsort($replies); //sort by biggest to lowest
|
||||
$replies = array_slice($replies, 0, 5); //remove everything except biggest
|
||||
sort($replies); //sort back to show from low to high
|
||||
|
||||
if ($total_replies > 5) {
|
||||
$replies_omitted = $total_replies - count($replies);
|
||||
} else {
|
||||
$replies_omitted = 0;
|
||||
}
|
||||
|
||||
//SHOW THREADS
|
||||
include $path . '/templates/thread.html';
|
||||
//SHOW SHOW REPLIES
|
||||
foreach (array_keys($replies) as $rkey => $value) {
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . $post_number_op . '/' . $replies[$value] . '.php';
|
||||
$post_number_reply = $replies[$value];
|
||||
include $path . '/templates/reply.html';
|
||||
}
|
||||
|
||||
if ($key != array_key_last($threads)) {
|
||||
echo '<hr>';
|
||||
}
|
||||
}
|
||||
include $path . '/templates/footer.html';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
exit();
|
||||
}
|
||||
|
||||
//IF THREAD
|
||||
if ((htmlspecialchars($_GET["thread"]) !== '') && (file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"])))) {
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"]) . '/OP.php';
|
||||
$post_number_op = htmlspecialchars($_GET["thread"]);
|
||||
include $path . '/templates/thread.html';
|
||||
}
|
||||
//set current_thread
|
||||
if ($current_page === 'thread') {
|
||||
$current_thread = $post_number_op;
|
||||
}
|
||||
//else does not exist
|
||||
if ((htmlspecialchars($_GET["thread"]) !== '') && (!file_exists(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . htmlspecialchars($_GET["thread"])))) {
|
||||
echo '<div class="message">This thread doesn\'t exist.. Did the glowies get it — or worse, a janny??<br><img style="height: 500px;width: 500px;margin-top: 5px;" src="'. $prefix_folder . '/assets/img/404.png" width="" height=""></div><style>.message { margin-top: 0!important }</style>';
|
||||
echo '<div class="message">[<a href="' . $prefix_folder . $main_file . '?board=' . $current_board . '">Return</a>]</div>';
|
||||
include $path . '/templates/footer.html';
|
||||
exit();
|
||||
}
|
||||
|
||||
//ADD ALL REPLIES HERE
|
||||
//FIND REPLIES
|
||||
$replies_full = [];
|
||||
$replies_full = glob(__dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . $post_number_op . "/*");
|
||||
//SORTING
|
||||
$replies = [];
|
||||
foreach ($replies_full as $reply) {
|
||||
if ((basename($reply) != ('OP.php') && basename($reply) != ('bumped.php'))) {
|
||||
$replies[] = basename($reply, '.php');
|
||||
}
|
||||
}
|
||||
sort($replies);
|
||||
//SHOW THEM
|
||||
foreach (array_keys($replies) as $key => $value) {
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/' . $post_number_op . '/' . $replies[$value] . '.php';
|
||||
$post_number_reply = $replies[$value];
|
||||
include $path . '/templates/reply.html';
|
||||
}
|
||||
|
||||
|
||||
//footer for thread+index
|
||||
if (htmlspecialchars($_GET["thread"]) != '') {
|
||||
echo '<hr>';
|
||||
echo '[<a href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '">Return</a>] ';
|
||||
}
|
||||
include $path . '/templates/footer.html';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
}
|
||||
|
||||
if ((htmlspecialchars($_GET["board"]) !== '') && (!in_Array(htmlspecialchars($_GET["board"]), $config['boardlist']))) {
|
||||
error('This board doesn\'t exist.. You\'re not trying anything funny — are you, Anon-san??');
|
||||
}
|
||||
|
||||
?>
|
146
post.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/require.php';
|
||||
|
||||
|
||||
//CLEANUP
|
||||
$post_board = htmlspecialchars($_POST['board']);
|
||||
|
||||
$post_name = htmlspecialchars($_POST['name']);
|
||||
$post_email = htmlspecialchars($_POST['email']);
|
||||
$post_subject = htmlspecialchars($_POST['subject']);
|
||||
$post_body = htmlspecialchars($_POST['body']);
|
||||
|
||||
//Requirements met?
|
||||
|
||||
if ($captcha_required == true) {
|
||||
if(isset($_POST['captcha'])){
|
||||
session_start();
|
||||
if (($captcha_required == true) && ($_SESSION['captcha_text'] != strtolower($_POST['captcha']))) {
|
||||
error('Wrong captcha!! How annoying...');
|
||||
} else {
|
||||
session_destroy();
|
||||
}
|
||||
} else {
|
||||
error('No captcha entered.');
|
||||
}
|
||||
}
|
||||
|
||||
if ($post_name === '') {
|
||||
$post_name = 'Anonymous';
|
||||
}
|
||||
if (strlen($post_name) > 256) {
|
||||
error('Name too long. Max 256.');
|
||||
}
|
||||
if (strlen($post_email) > 256) {
|
||||
error('Email too long. Max 256.');
|
||||
}
|
||||
if (strlen($post_subject) > 256) {
|
||||
error('Subject too long. Max 256.');
|
||||
}
|
||||
|
||||
//IF NEW THREAD
|
||||
if (isset($_POST['index'])) {
|
||||
if (strlen($post_body) > $config['post_body_max']) {
|
||||
error('Post too long. Max: 4000.');
|
||||
}
|
||||
if (strlen($post_body) < $config['post_body_min']) {
|
||||
error('Comment too short. Min: 10.');
|
||||
}
|
||||
}
|
||||
|
||||
//IF NEW REPLY
|
||||
if (isset($_POST['thread'])) {
|
||||
if ($config['reply_body_min'] !== 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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ARE WE POSTING?
|
||||
if ((isset($post_board)) && (isset($_POST['index']))) {
|
||||
//SHOULD IT EXIST?
|
||||
if (!isset($config['boards'][$post_board])) {
|
||||
error('This board shouldn\'t exist...');
|
||||
}
|
||||
//IF NOT EXIST, CREATE DIRECTORY
|
||||
if ((!file_exists(__dir__ . '/' . $database_folder . '/boards/' . $post_board) && (isset($config['boards'][$post_board])) === true)) {
|
||||
mkdir(__dir__ . '/' . $database_folder . '/boards/' . $post_board, 0755, true);
|
||||
}
|
||||
//IS THIS OUR FIRST THREAD?
|
||||
|
||||
|
||||
// if no file in folder
|
||||
if (dir_is_empty(__dir__ . '/' . $database_folder . '/boards/' . $post_board)) {
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php', 1); //create post count
|
||||
}
|
||||
//CREATE THREAD FOLDER
|
||||
$counter = file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php');
|
||||
$current_count = $counter;
|
||||
mkdir(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $current_count, 0755, true); //create thread folder
|
||||
|
||||
//COLLECT POST INFORMATION
|
||||
$create_OP = '<?php $op_name = "' . $post_name . '";';
|
||||
$create_OP .= '$op_email = "' . $post_email . '";';
|
||||
$create_OP .= '$op_subject = "' . $post_subject . '";';
|
||||
$create_OP .= '$op_body = "' . $post_body . '";';
|
||||
$create_OP .= '$op_time = "' . time() . '"; ?>';
|
||||
|
||||
//SAVE POST INFORMATION
|
||||
$current_count = $counter;
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $current_count . '/OP.php', $create_OP);
|
||||
|
||||
//INCREMENT COUNTER
|
||||
$counter = file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php');
|
||||
$newcount = $counter + 1;
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php', $newcount);
|
||||
|
||||
PostSuccess($prefix_folder . $main_file . '/?board=' . $post_board . '&thread=' . $counter . '#' . $counter, true);
|
||||
}
|
||||
|
||||
if ((isset($post_board)) && (isset($_POST['thread']))) {
|
||||
$post_is_thread = htmlspecialchars($_POST['thread']);
|
||||
$post_thread_number = htmlspecialchars($_POST['thread_number']);
|
||||
//board exists?
|
||||
if (!isset($config['boards'][$post_board])) {
|
||||
error('This board shouldn\'t exist...');
|
||||
}
|
||||
//thread exists?
|
||||
if (($post_is_thread == 'thread') && (file_exists(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $post_thread_number . '/OP.php'))) {
|
||||
//THREAD EXISTS
|
||||
//CREATE/INCREASE COUNTER+LAST BUMPED. to do: (reset bump on post deletion by user or mod, do elsewhere)
|
||||
$counter = file_get_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php');
|
||||
$newcount = $counter + 1;
|
||||
//save it as last bumped if not sage tho
|
||||
if ($post_email != 'sage') {
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $post_thread_number . '/bumped.php', $counter);
|
||||
}
|
||||
//save it as last post number
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/counter.php', $newcount);
|
||||
//counter handled... moving on:
|
||||
|
||||
//POST STUFF
|
||||
//COLLECT POST INFORMATION
|
||||
$create_reply = '<?php $reply_name = "' . $post_name . '";';
|
||||
$create_reply .= '$reply_email = "' . $post_email . '";';
|
||||
$create_reply .= '$reply_subject = "' . $post_subject . '";';
|
||||
$create_reply .= '$reply_body = "' . $post_body . '";';
|
||||
$create_reply .= '$reply_time = "' . time() . '"; ?>';
|
||||
|
||||
//SAVE POST INFORMATION
|
||||
$current_count = $counter;
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $post_thread_number . '/' . $current_count . '.php', $create_reply);
|
||||
//i guess maybe saving the new counter here would make more sense, but it wont break, RIGHT?????
|
||||
//redirect
|
||||
PostSuccess($prefix_folder . $main_file . '/?board=' . $post_board . '&thread=' . $post_thread_number . '#' . $current_count, true);
|
||||
}
|
||||
}
|
||||
|
||||
error('No existing Board or Thread selected to post in.<br>For now this will show up if you try to post a reply as I haven\'t written the handler for replies.');
|
||||
?>
|
18
require.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
// INSTALL LOCATION
|
||||
$path = dirname(__FILE__);
|
||||
|
||||
// CONFIGURATIONS
|
||||
|
||||
require $path . '/includes/default.php'; //sets defaults
|
||||
require $path . '/includes/inits.php'; //defines possibly unused variables
|
||||
require $path . '/includes/custom.php'; // only change this, it will replace the default initialized settings.
|
||||
require $path . '/includes/functions.php'; //defines functions
|
||||
// require per board setting?
|
||||
|
||||
// DATABASE
|
||||
require $path . '/database/boards.php'; //boardlist
|
||||
require $path . '/database/users.php'; //moderators
|
||||
|
||||
?>
|
22
templates/boardlist.html
Normal file
@ -0,0 +1,22 @@
|
||||
<div id="boardlist">
|
||||
[<?php
|
||||
echo '<a href="' . $prefix_folder . '/' . $main_file . '">';
|
||||
echo 'Home</a>';
|
||||
?>
|
||||
]
|
||||
|
||||
[<?php
|
||||
foreach ($config['boards'] as $boards) {
|
||||
if ($boards['hidden'] === 0) {
|
||||
if ($boards['url'] != array_key_first($config['boards'])) {
|
||||
echo ' / ';
|
||||
}
|
||||
echo '<a href="' . $prefix_folder . '/' . $main_file . '?board=';
|
||||
echo $boards['url'];
|
||||
echo '">' . $boards["title"] . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
]
|
||||
</div>
|
35
templates/footer.html
Normal file
@ -0,0 +1,35 @@
|
||||
<hr>
|
||||
|
||||
<div class="abovefooter">
|
||||
|
||||
<div class="float-right">
|
||||
<select id="themes">
|
||||
<?php
|
||||
foreach($config['css'] as $theme) {
|
||||
echo '<option value="' . $theme . '">' . $theme . '</option>';
|
||||
}
|
||||
?>
|
||||
<select>
|
||||
<noscript>
|
||||
<style>select#themes { display: none; }</style>
|
||||
<?php
|
||||
foreach($config['css'] as $theme) {
|
||||
echo ' [<a href="' . $prefix_folder . $main_file . '/?board=' . $current_board . '&thread=' . $current_thread . '&theme=' . $theme . '">' . $theme . '</a>]';
|
||||
}
|
||||
?>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>ImoutoIB</p>
|
||||
<?php
|
||||
if ($config['generated_in'] === true) {
|
||||
$end_time = microtime(true);
|
||||
$generation_time = round($end_time - $start_time, 5);
|
||||
echo '<p class="small">Page generated in ' . $generation_time . ' seconds.</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
55
templates/frontpage.html
Normal file
@ -0,0 +1,55 @@
|
||||
<?php if ($config['display_banner'] === true) {
|
||||
include __DIR__ . '/../assets/img/banner.php';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="page-info">
|
||||
<h1>ImoutoIB</h1>
|
||||
<span class="small">Just a soykaf IB.</span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="main first">
|
||||
<h2>Main Features</h2>
|
||||
<p> No support...<br>
|
||||
No database?<br>
|
||||
No glowies!<br>
|
||||
Lacks so much in features that it will work on just about anything. Uwah!<br>
|
||||
Will probably break at random — oh well!<br>
|
||||
but most important of all!! It has soul...
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="main">
|
||||
<h2>Boards</h2>
|
||||
<?php
|
||||
echo '<table id="boards">';
|
||||
echo '<thead><th>Board</th><th>Description</th><th>Posts</th></thead>';
|
||||
|
||||
foreach ($config['boards'] as $boards) {
|
||||
if ($boards['hidden'] === 0) {
|
||||
echo '<tr><th><a href="' . $prefix_folder . '/' . $main_file . '?board=';
|
||||
echo $boards['url'];
|
||||
echo '">';
|
||||
echo '/' . $boards['url'] . '/' . ' - ' . $boards['title'];
|
||||
echo '</a></th><th>' . $boards['description'] . '</td></th>';
|
||||
echo '<th>' . file_get_contents($path . '/' . $database_folder . '/boards/' . $boards['url'] . '/counter.php') . '</th>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="main">
|
||||
<h2>Stats</h2>
|
||||
<div class="stats">
|
||||
<div><b>Total Posts:</b> <?php echo $total_posts; ?></div>
|
||||
<div><b>Unique Posters:</b> I'm not a fed!!</div>
|
||||
<div><b>Active Content:</b> 0...</div>
|
||||
</div>
|
||||
</div>
|
32
templates/header.html
Normal file
@ -0,0 +1,32 @@
|
||||
<title><?php echo $title; ?></title>
|
||||
|
||||
<!--- LOAD THEME IMMEDIATELY --->
|
||||
<script>
|
||||
if (localStorage.theme !== undefined) {
|
||||
document.documentElement.setAttribute("data-stylesheet", localStorage.theme);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--- SETTINGS --->
|
||||
<script>
|
||||
<?php if ($captcha_requires = true) { echo 'var captcha_required = true;'; } ?>
|
||||
var install_location = '<?php echo $prefix_folder; ?>';
|
||||
var default_theme = '<?php echo $default_theme ?>';
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo '<link rel="icon" type="image/png" href="' . $prefix_folder . '/assets/img/favicon.png"/>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
foreach ($config['css'] as $css) {
|
||||
echo '<link rel="stylesheet" type="text/css" href="' . $prefix_folder . '/assets/css/' . $css . '.css">';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
foreach ($config['js'] as $js) {
|
||||
echo '<script type="text/javascript" src="' . $prefix_folder . '/assets/js/' . $js . '"></script>';
|
||||
}
|
||||
?>
|
||||
|
0
templates/mod/dashboard.html
Normal file
0
templates/mod/login.html
Normal file
10
templates/page-info.html
Normal file
@ -0,0 +1,10 @@
|
||||
<?php if ($config['display_banner'] === true) {
|
||||
include __DIR__ . '/../assets/img/banner.php';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="page-info">
|
||||
<h1><?php echo '/' . $current_board . '/ - ' . $board_title; ?></h1>
|
||||
<span class="small"><?php echo $board_description; ?></span>
|
||||
</div>
|
||||
<hr>
|
56
templates/post-form.html
Normal file
@ -0,0 +1,56 @@
|
||||
<?php if ($current_page === 'thread') { echo '<div class="postingmode">Posting mode: Reply</div>'; } ?>
|
||||
<?php if ($current_page != ('thread') && $current_page != ('index')) { echo '<style>#post-form { display: none; }</style><div class="blotter">(Locked!)</div>'; } ?>
|
||||
<div id="post-form">
|
||||
<form name="post" action="<?php echo $prefix_folder; ?>/post.php" method="post">
|
||||
<table>
|
||||
|
||||
<!-- Hidden Inputs --->
|
||||
<?php echo '<input type="hidden" id="board" name="board" value="' . $current_board .'">';?>
|
||||
<?php if ($current_page === 'thread') { echo '<input type="hidden" id="thread" name="thread" value="thread">'; } ?>
|
||||
<?php if ($current_page === 'thread') { echo '<input type="hidden" id="thread_number" name="thread_number" value="' . $post_number_op . '">'; } ?>
|
||||
<?php if ($current_page === 'index') { echo '<input type="hidden" id="index" name="index" value="index">'; } ?>
|
||||
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><input type="text" name="name" size="25" maxlength="256" autocomplete="off"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><input type="text" name="email" size="25" maxlength="256" autocomplete="off"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<td><input type="text" name="subject" size="25" maxlength="256" autocomplete="off"> <?php echo '<input type="submit" name="post" value="'; if ($current_page == 'index') { echo 'Submit'; } if ($current_page == 'thread') { echo 'Reply'; } if ($current_page != 'thread' && $current_page != 'index') { echo 'Locked'; } if ($current_page != 'thread' && $current_page != 'index') { echo '" disabled>';} else { echo '">';}?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Comment</th>
|
||||
<td><textarea name="body" id="body" rows="5" cols="30"></textarea></td>
|
||||
</tr>
|
||||
<?php if ($captcha_required == (true) && ($current_page == ('thread') || $current_page == ('index'))) {
|
||||
echo '<tr><th>Verification</th><td><img height="50" width="198" id="captcha" src="' . $prefix_folder . '/includes/captcha.php' .'"/><br><input type="text" name="captcha" size="" maxlength="6" autocomplete="off"></td>
|
||||
';
|
||||
}?>
|
||||
|
||||
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<td><input type="file" name="file" id="upload"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<details>
|
||||
<summary>More</summary>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Password</th>
|
||||
<td><input type="password" name="password" size="25" maxlength="256" autocomplete="off" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Options</th>
|
||||
<td><label for="checkbox1"><input type="checkbox" id="checkbox1" name="checkbox1"> Spoiler Image</label> <label for="checkbox2"><input type="checkbox" id="checkbox2" name="checkbox2"> No Bump</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</details>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr>
|
11
templates/reply.html
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="post-arrows">>></div>
|
||||
<div class="post reply">
|
||||
<div class="post-info">
|
||||
<input type="checkbox" name="<?php echo $post_number_reply; ?>" value="delete">
|
||||
<?php if ($reply_subject != '') { echo '<span class="subject">' . $reply_subject . ' </span>'; }?>
|
||||
<?php if ($reply_email != '') { echo '<a href="mailto:' . $reply_email . '">';}?><span class="<?php if($reply_email != '') { echo 'link '; } ?>name"><?php echo $reply_name; ?></span> <?php if ($reply_email != '') { 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); ?> </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> </span>
|
||||
</div>
|
||||
<blockquote class="post-content"><?php echo $reply_body; ?></blockquote>
|
||||
</div>
|
28
templates/thread.html
Normal file
@ -0,0 +1,28 @@
|
||||
<div class="thread <?php echo $post_number_op ?>">
|
||||
|
||||
<div class="post op <?php echo $post_number_op ?>">
|
||||
<div class="post-info">
|
||||
<input type="checkbox" name="<?php echo $post_number_op; ?>" value="delete">
|
||||
<?php if ($op_subject != '') { echo '<span class="subject">' . $op_subject . ' </span>'; }?>
|
||||
<?php if ($op_email != '') { echo '<a href="mailto:' . $op_email . '">';}?><span class="<?php if($op_email != '') { echo 'link '; } ?>name"><?php echo $op_name; ?></span> <?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); ?> </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> </span>
|
||||
<?php
|
||||
if ($current_page === 'index') {
|
||||
echo ' <span>[<a href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '">Reply</a>]</span>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<blockquote class="post-content">
|
||||
<?php echo $op_body; ?>
|
||||
<?php
|
||||
if (($current_page == 'index') && ($replies_omitted > 1)) {
|
||||
echo '<br><br><div class="omitted"> ' . $replies_omitted . ' Replies omitted. Click <a href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op . '">here</a> to view.</div>';
|
||||
} elseif (($current_page == 'index') && ($replies_omitted > 0)) {
|
||||
echo '<br><br><div class="omitted"> ' . $replies_omitted . ' Reply omitted. Click <a href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op . '">here</a> to view.</div>';
|
||||
}
|
||||
?>
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
</div>
|