Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Trevor Slocum | 33a548bdda |
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 Trevor Slocum <trevor@rocketnine.space>
|
||||
Copyright (c) 2020 Trevor Slocum <trevor@rocketnine.space>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
33
imgboard.php
33
imgboard.php
|
@ -1,7 +1,29 @@
|
|||
<?php
|
||||
# TinyIB
|
||||
#
|
||||
# https://gitlab.com/tslocum/tinyib
|
||||
/*
|
||||
TinyIB <https://gitlab.com/tslocum/tinyib>
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Trevor Slocum <trevor@rocketnine.space>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set("display_errors", 1);
|
||||
|
@ -57,6 +79,9 @@ foreach ($writedirs as $dir) {
|
|||
}
|
||||
|
||||
$includes = array("inc/defines.php", "inc/functions.php", "inc/html.php");
|
||||
if (TINYIB_JSON) {
|
||||
$includes[] = 'inc/json.php';
|
||||
}
|
||||
if (in_array(TINYIB_DBMODE, array('flatfile', 'mysql', 'mysqli', 'sqlite', 'sqlite3', 'pdo'))) {
|
||||
$includes[] = 'inc/database_' . TINYIB_DBMODE . '.php';
|
||||
} else {
|
||||
|
@ -71,6 +96,8 @@ if (TINYIB_TIMEZONE != '') {
|
|||
date_default_timezone_set(TINYIB_TIMEZONE);
|
||||
}
|
||||
|
||||
writePage('threads.json', buildThreadsJSON());
|
||||
|
||||
$redirect = true;
|
||||
// Check if the request is to make a post
|
||||
if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) || isset($_POST['email']) || isset($_POST['subject']) || isset($_POST['message']) || isset($_POST['file']) || isset($_POST['embed']) || isset($_POST['password']))) {
|
||||
|
|
|
@ -43,6 +43,9 @@ if (!defined('TINYIB_WORDBREAK')) {
|
|||
if (!defined('TINYIB_TIMEZONE')) {
|
||||
define('TINYIB_TIMEZONE', '');
|
||||
}
|
||||
if (!defined('TINYIB_JSON')) {
|
||||
define('TINYIB_JSON', true);
|
||||
}
|
||||
if (!defined('TINYIB_DBMIGRATE')) {
|
||||
define('TINYIB_DBMIGRATE', false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
function buildThreadsJSON() {
|
||||
$output = '';
|
||||
|
||||
$threads = allThreads();
|
||||
$pages = ceil(count($threads) / TINYIB_THREADSPERPAGE) - 1;
|
||||
|
||||
foreach ($threads as $thread) {
|
||||
$replies = postsInThreadByID($thread['id']);
|
||||
|
||||
$output .= $thread['id'] . "\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
|
@ -27,6 +27,7 @@ define('TINYIB_PREVIEWREPLIES', 3); // Amount of replies previewed on index pa
|
|||
define('TINYIB_TRUNCATE', 15); // Messages are truncated to this many lines on board index pages [0 to disable]
|
||||
define('TINYIB_WORDBREAK', 80); // Words longer than this many characters will be broken apart [0 to disable]
|
||||
define('TINYIB_TIMEZONE', 'UTC'); // See https://secure.php.net/manual/en/timezones.php - e.g. America/Los_Angeles
|
||||
define('TINYIB_JSON', true); // Write JSON files (threads.json, catalog.json, etc.)
|
||||
$tinyib_hidefieldsop = array(); // Fields to hide when creating a new thread - e.g. array('name', 'email', 'subject', 'message', 'file', 'embed', 'password')
|
||||
$tinyib_hidefields = array(); // Fields to hide when replying
|
||||
|
||||
|
|
Loading…
Reference in New Issue