Moving settings to constants rather than variables
This commit is contained in:
parent
9b999c3d2c
commit
f0540cd221
6 changed files with 74 additions and 88 deletions
14
imgboard.php
14
imgboard.php
|
@ -24,7 +24,7 @@ require 'settings.php';
|
|||
|
||||
// Check directories are writable by the script
|
||||
$writedirs = array("res", "src", "thumb");
|
||||
if ($tinyib['databasemode'] == 'flatfile') { $writedirs[] = "inc/flatfile"; }
|
||||
if (TINYIB_DBMODE == 'flatfile') { $writedirs[] = "inc/flatfile"; }
|
||||
foreach ($writedirs as $dir) {
|
||||
if (!is_writable($dir)) {
|
||||
fancyDie("Directory '" . $dir . "' can not be written to! Please modify its permissions.");
|
||||
|
@ -32,9 +32,9 @@ foreach ($writedirs as $dir) {
|
|||
}
|
||||
|
||||
$includes = array("inc/functions.php", "inc/html.php");
|
||||
if ($tinyib['databasemode'] == 'flatfile') {
|
||||
if (TINYIB_DBMODE == 'flatfile') {
|
||||
$includes[] = 'inc/database_flatfile.php';
|
||||
} elseif ($tinyib['databasemode'] == 'mysql') {
|
||||
} elseif (TINYIB_DBMODE == 'mysql') {
|
||||
$includes[] = 'inc/database_mysql.php';
|
||||
} else {
|
||||
fancyDie("Unknown database mode specificed");
|
||||
|
@ -44,8 +44,8 @@ foreach ($includes as $include) {
|
|||
include $include;
|
||||
}
|
||||
|
||||
if ($tinyib['tripseed'] == '' || $tinyib['adminpassword'] == '') {
|
||||
fancyDie('$tinyib[\'tripseed\'] and $tinyib[\'adminpassword\'] still need to be configured!');
|
||||
if (TINYIB_TRIPSEED == '' || TINYIB_ADMINPASS == '') {
|
||||
fancyDie('TINYIB_TRIPSEED and TINYIB_ADMINPASS must be configured!');
|
||||
}
|
||||
|
||||
$redirect = true;
|
||||
|
@ -96,9 +96,7 @@ if (isset($_POST["message"]) || isset($_POST["file"])) {
|
|||
$post['parent'] = $parent;
|
||||
$post['ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$nt = nameAndTripcode($_POST["name"]);
|
||||
$post['name'] = $nt[0];
|
||||
$post['tripcode'] = $nt[1];
|
||||
list($post['name'], $post['tripcode']) = nameAndTripcode($_POST["name"]);
|
||||
|
||||
$post['name'] = cleanString(substr($post['name'], 0, 75));
|
||||
$post['email'] = cleanString(str_replace('"', '"', substr($_POST["email"], 0, 75)));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if (!isset($tinyib)) { die(''); }
|
||||
if (!defined('TINYIB_BOARD')) { die(''); }
|
||||
|
||||
# Post Structure
|
||||
define('POSTS_FILE', '.posts');
|
||||
|
@ -181,12 +181,11 @@ function deletePostByID($id) {
|
|||
}
|
||||
|
||||
function trimThreads() {
|
||||
global $tinyib;
|
||||
if ($tinyib['maxthreads'] > 0) {
|
||||
if (TINYIB_MAXTHREADS > 0) {
|
||||
$numthreads = countThreads();
|
||||
if ($numthreads > $tinyib['maxthreads']) {
|
||||
if ($numthreads > TINYIB_MAXTHREADS) {
|
||||
$allthreads = allThreads();
|
||||
for ($i=$tinyib['maxthreads'];$i<$numthreads;$i++) {
|
||||
for ($i=TINYIB_MAXTHREADS;$i<$numthreads;$i++) {
|
||||
deletePostByID($allthreads[$i]['id']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if (!isset($tinyib)) { die(''); }
|
||||
if (!defined('TINYIB_BOARD')) { die(''); }
|
||||
|
||||
$link = mysql_connect($mysql_host, $mysql_username, $mysql_password);
|
||||
if (!$link) {
|
||||
|
@ -11,8 +11,8 @@ if (!$db_selected) {
|
|||
}
|
||||
|
||||
// Create the posts table if it does not exist
|
||||
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $mysql_posts_table . "'")) == 0) {
|
||||
mysql_query("CREATE TABLE `" . $mysql_posts_table . "` (
|
||||
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
|
||||
mysql_query("CREATE TABLE `" . TINYIB_DBPOSTS . "` (
|
||||
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
||||
`parent` mediumint(7) unsigned NOT NULL,
|
||||
`timestamp` int(20) NOT NULL,
|
||||
|
@ -42,8 +42,8 @@ if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $mysql_posts_table . "'"))
|
|||
}
|
||||
|
||||
// Create the bans table if it does not exist
|
||||
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $mysql_bans_table . "'")) == 0) {
|
||||
mysql_query("CREATE TABLE `" . $mysql_bans_table . "` (
|
||||
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBBANS . "'")) == 0) {
|
||||
mysql_query("CREATE TABLE `" . TINYIB_DBBANS . "` (
|
||||
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
||||
`ip` varchar(15) NOT NULL,
|
||||
`timestamp` int(20) NOT NULL,
|
||||
|
@ -56,37 +56,37 @@ if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $mysql_bans_table . "'"))
|
|||
|
||||
# Post Functions
|
||||
function uniquePosts() {
|
||||
$row = mysql_fetch_row(mysql_query("SELECT COUNT(DISTINCT(`ip`)) FROM " . $GLOBALS['mysql_posts_table']));
|
||||
$row = mysql_fetch_row(mysql_query("SELECT COUNT(DISTINCT(`ip`)) FROM " . TINYIB_DBPOSTS));
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
function postByID($id) {
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
|
||||
while ($post = mysql_fetch_assoc($result)) {
|
||||
return $post;
|
||||
}
|
||||
}
|
||||
|
||||
function threadExistsByID($id) {
|
||||
return mysql_result(mysql_query("SELECT COUNT(*) FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' AND `parent` = 0 LIMIT 1"), 0, 0) > 0;
|
||||
return mysql_result(mysql_query("SELECT COUNT(*) FROM `" . TINYIB_DBPOSTS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' AND `parent` = 0 LIMIT 1"), 0, 0) > 0;
|
||||
}
|
||||
|
||||
function insertPost($post) {
|
||||
mysql_query("INSERT INTO `" . $GLOBALS['mysql_posts_table'] . "` (`parent`, `timestamp`, `bumped`, `ip`, `name`, `tripcode`, `email`, `nameblock`, `subject`, `message`, `password`, `file`, `file_hex`, `file_original`, `file_size`, `file_size_formatted`, `image_width`, `image_height`, `thumb`, `thumb_width`, `thumb_height`) VALUES (" . $post['parent'] . ", " . time() . ", " . time() . ", '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysql_real_escape_string($post['name']) . "', '" . mysql_real_escape_string($post['tripcode']) . "', '" . mysql_real_escape_string($post['email']) . "', '" . mysql_real_escape_string($post['nameblock']) . "', '" . mysql_real_escape_string($post['subject']) . "', '" . mysql_real_escape_string($post['message']) . "', '" . mysql_real_escape_string($post['password']) . "', '" . $post['file'] . "', '" . $post['file_hex'] . "', '" . mysql_real_escape_string($post['file_original']) . "', " . $post['file_size'] . ", '" . $post['file_size_formatted'] . "', " . $post['image_width'] . ", " . $post['image_height'] . ", '" . $post['thumb'] . "', " . $post['thumb_width'] . ", " . $post['thumb_height'] . ")");
|
||||
mysql_query("INSERT INTO `" . TINYIB_DBPOSTS . "` (`parent`, `timestamp`, `bumped`, `ip`, `name`, `tripcode`, `email`, `nameblock`, `subject`, `message`, `password`, `file`, `file_hex`, `file_original`, `file_size`, `file_size_formatted`, `image_width`, `image_height`, `thumb`, `thumb_width`, `thumb_height`) VALUES (" . $post['parent'] . ", " . time() . ", " . time() . ", '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysql_real_escape_string($post['name']) . "', '" . mysql_real_escape_string($post['tripcode']) . "', '" . mysql_real_escape_string($post['email']) . "', '" . mysql_real_escape_string($post['nameblock']) . "', '" . mysql_real_escape_string($post['subject']) . "', '" . mysql_real_escape_string($post['message']) . "', '" . mysql_real_escape_string($post['password']) . "', '" . $post['file'] . "', '" . $post['file_hex'] . "', '" . mysql_real_escape_string($post['file_original']) . "', " . $post['file_size'] . ", '" . $post['file_size_formatted'] . "', " . $post['image_width'] . ", " . $post['image_height'] . ", '" . $post['thumb'] . "', " . $post['thumb_width'] . ", " . $post['thumb_height'] . ")");
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
function bumpThreadByID($id) {
|
||||
mysql_query("UPDATE `" . $GLOBALS['mysql_posts_table'] . "` SET `bumped` = " . time() . " WHERE `id` = " . $id . " LIMIT 1");
|
||||
mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `bumped` = " . time() . " WHERE `id` = " . $id . " LIMIT 1");
|
||||
}
|
||||
|
||||
function countThreads() {
|
||||
return mysql_result(mysql_query("SELECT COUNT(*) FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `parent` = 0"), 0, 0);
|
||||
return mysql_result(mysql_query("SELECT COUNT(*) FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0"), 0, 0);
|
||||
}
|
||||
|
||||
function allThreads() {
|
||||
$threads = array();
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `parent` = 0 ORDER BY `bumped` DESC");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 ORDER BY `bumped` DESC");
|
||||
while ($thread = mysql_fetch_assoc($result)) {
|
||||
$threads[] = $thread;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ function allThreads() {
|
|||
|
||||
function postsInThreadByID($id) {
|
||||
$posts = array();
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $id . " OR `parent` = " . $id . " ORDER BY `id` ASC");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `id` = " . $id . " OR `parent` = " . $id . " ORDER BY `id` ASC");
|
||||
while ($post = mysql_fetch_assoc($result)) {
|
||||
$posts[] = $post;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ function postsInThreadByID($id) {
|
|||
|
||||
function latestRepliesInThreadByID($id) {
|
||||
$posts = array();
|
||||
$replies = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `parent` = " . $id . " ORDER BY `id` DESC LIMIT 3");
|
||||
$replies = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = " . $id . " ORDER BY `id` DESC LIMIT 3");
|
||||
while ($post = mysql_fetch_assoc($replies)) {
|
||||
$posts[] = $post;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ function latestRepliesInThreadByID($id) {
|
|||
|
||||
function postsByHex($hex) {
|
||||
$posts = array();
|
||||
$result = mysql_query("SELECT `id`, `parent` FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `file_hex` = '" . mysql_real_escape_string($hex) . "' LIMIT 1");
|
||||
$result = mysql_query("SELECT `id`, `parent` FROM `" . TINYIB_DBPOSTS . "` WHERE `file_hex` = '" . mysql_real_escape_string($hex) . "' LIMIT 1");
|
||||
while ($post = mysql_fetch_assoc($result)) {
|
||||
$posts[] = $post;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ function deletePostByID($id) {
|
|||
foreach ($posts as $post) {
|
||||
if ($post['id'] != $id) {
|
||||
deletePostImages($post);
|
||||
mysql_query("DELETE FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $post['id'] . " LIMIT 1");
|
||||
mysql_query("DELETE FROM `" . TINYIB_DBPOSTS . "` WHERE `id` = " . $post['id'] . " LIMIT 1");
|
||||
} else {
|
||||
$thispost = $post;
|
||||
}
|
||||
|
@ -135,14 +135,13 @@ function deletePostByID($id) {
|
|||
@unlink('res/' . $thispost['id'] . '.html');
|
||||
}
|
||||
deletePostImages($thispost);
|
||||
mysql_query("DELETE FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $thispost['id'] . " LIMIT 1");
|
||||
mysql_query("DELETE FROM `" . TINYIB_DBPOSTS . "` WHERE `id` = " . $thispost['id'] . " LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
function trimThreads() {
|
||||
global $tinyib;
|
||||
if ($tinyib['maxthreads'] > 0) {
|
||||
$result = mysql_query("SELECT `id` FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `parent` = 0 ORDER BY `bumped` DESC LIMIT " . $tinyib['maxthreads']. ", 10");
|
||||
if (TINYIB_MAXTHREADS > 0) {
|
||||
$result = mysql_query("SELECT `id` FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 ORDER BY `bumped` DESC LIMIT " . TINYIB_MAXTHREADS. ", 10");
|
||||
while ($post = mysql_fetch_assoc($result)) {
|
||||
deletePostByID($post['id']);
|
||||
}
|
||||
|
@ -150,7 +149,7 @@ function trimThreads() {
|
|||
}
|
||||
|
||||
function lastPostByIP() {
|
||||
$replies = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `ip` = '" . $_SERVER['REMOTE_ADDR'] . "' ORDER BY `id` DESC LIMIT 1");
|
||||
$replies = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `ip` = '" . $_SERVER['REMOTE_ADDR'] . "' ORDER BY `id` DESC LIMIT 1");
|
||||
while ($post = mysql_fetch_assoc($replies)) {
|
||||
return $post;
|
||||
}
|
||||
|
@ -158,14 +157,14 @@ function lastPostByIP() {
|
|||
|
||||
# Ban Functions
|
||||
function banByID($id) {
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_bans_table'] . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
|
||||
while ($ban = mysql_fetch_assoc($result)) {
|
||||
return $ban;
|
||||
}
|
||||
}
|
||||
|
||||
function banByIP($ip) {
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_bans_table'] . "` WHERE `ip` = '" . mysql_real_escape_string($ip) . "' LIMIT 1");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `ip` = '" . mysql_real_escape_string($ip) . "' LIMIT 1");
|
||||
while ($ban = mysql_fetch_assoc($result)) {
|
||||
return $ban;
|
||||
}
|
||||
|
@ -173,7 +172,7 @@ function banByIP($ip) {
|
|||
|
||||
function allBans() {
|
||||
$bans = array();
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_bans_table'] . "` ORDER BY `timestamp` DESC");
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` ORDER BY `timestamp` DESC");
|
||||
while ($ban = mysql_fetch_assoc($result)) {
|
||||
$bans[] = $ban;
|
||||
}
|
||||
|
@ -181,19 +180,19 @@ function allBans() {
|
|||
}
|
||||
|
||||
function insertBan($ban) {
|
||||
mysql_query("INSERT INTO `" . $GLOBALS['mysql_bans_table'] . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysql_real_escape_string($ban['ip']) . "', " . time() . ", '" . mysql_real_escape_string($ban['expire']) . "', '" . mysql_real_escape_string($ban['reason']) . "')");
|
||||
mysql_query("INSERT INTO `" . TINYIB_DBBANS . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysql_real_escape_string($ban['ip']) . "', " . time() . ", '" . mysql_real_escape_string($ban['expire']) . "', '" . mysql_real_escape_string($ban['reason']) . "')");
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
function clearExpiredBans() {
|
||||
$result = mysql_query("SELECT * FROM `" . $GLOBALS['mysql_bans_table'] . "` WHERE `expire` > 0 AND `expire` <= " . time());
|
||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `expire` > 0 AND `expire` <= " . time());
|
||||
while ($ban = mysql_fetch_assoc($result)) {
|
||||
mysql_query("DELETE FROM `" . $GLOBALS['mysql_bans_table'] . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
|
||||
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
function deleteBanByID($id) {
|
||||
mysql_query("DELETE FROM `" . $GLOBALS['mysql_bans_table'] . "` WHERE `id` = " . mysql_real_escape_string($id) . " LIMIT 1");
|
||||
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . mysql_real_escape_string($id) . " LIMIT 1");
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if (!isset($tinyib)) { die(''); }
|
||||
if (!defined('TINYIB_BOARD')) { die(''); }
|
||||
|
||||
function cleanString($string) {
|
||||
$search = array("<", ">");
|
||||
|
@ -58,8 +58,6 @@ function convertBytes($number) {
|
|||
}
|
||||
|
||||
function nameAndTripcode($name) {
|
||||
global $tinyib;
|
||||
|
||||
if (preg_match("/(#|!)(.*)/", $name, $regs)) {
|
||||
$cap = $regs[2];
|
||||
$cap_full = '#' . $regs[2];
|
||||
|
@ -103,7 +101,7 @@ function nameAndTripcode($name) {
|
|||
$tripcode .= "!";
|
||||
}
|
||||
|
||||
$tripcode .= "!" . substr(md5($cap_secure . $tinyib['tripseed']), 2, 10);
|
||||
$tripcode .= "!" . substr(md5($cap_secure . TINYIB_TRIPSEED), 2, 10);
|
||||
}
|
||||
|
||||
return array(preg_replace("/(" . $cap_delimiter . ")(.*)/", "", $name), $tripcode);
|
||||
|
@ -135,9 +133,7 @@ function nameBlock($name, $tripcode, $email, $timestamp, $modposttext) {
|
|||
}
|
||||
|
||||
function writePage($filename, $contents) {
|
||||
global $tinyib;
|
||||
|
||||
$tempfile = tempnam('res/', $tinyib['board'] . 'tmp'); /* Create the temporary file */
|
||||
$tempfile = tempnam('res/', TINYIB_BOARD . 'tmp'); /* Create the temporary file */
|
||||
$fp = fopen($tempfile, 'w');
|
||||
fwrite($fp, $contents);
|
||||
fclose($fp);
|
||||
|
@ -168,21 +164,20 @@ function deletePostImages($post) {
|
|||
}
|
||||
|
||||
function manageCheckLogIn() {
|
||||
global $tinyib;
|
||||
$loggedin = false; $isadmin = false;
|
||||
if (isset($_POST['password'])) {
|
||||
if ($_POST['password'] == $tinyib['adminpassword']) {
|
||||
$_SESSION['tinyib'] = $tinyib['adminpassword'];
|
||||
} elseif ($tinyib['modpassword'] != '' && $_POST['password'] == $tinyib['modpassword']) {
|
||||
$_SESSION['tinyib'] = $tinyib['modpassword'];
|
||||
if ($_POST['password'] == TINYIB_ADMINPASS) {
|
||||
$_SESSION['tinyib'] = TINYIB_ADMINPASS;
|
||||
} elseif (TINYIB_MODPASS != '' && $_POST['password'] == TINYIB_MODPASS) {
|
||||
$_SESSION['tinyib'] = TINYIB_MODPASS;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['tinyib'])) {
|
||||
if ($_SESSION['tinyib'] == $tinyib['adminpassword']) {
|
||||
if ($_SESSION['tinyib'] == TINYIB_ADMINPASS) {
|
||||
$loggedin = true;
|
||||
$isadmin = true;
|
||||
} elseif ($tinyib['modpassword'] != '' && $_SESSION['tinyib'] == $tinyib['modpassword']) {
|
||||
} elseif (TINYIB_MODPASS != '' && $_SESSION['tinyib'] == TINYIB_MODPASS) {
|
||||
$loggedin = true;
|
||||
}
|
||||
}
|
||||
|
|
30
inc/html.php
30
inc/html.php
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
if (!isset($tinyib)) { die(''); }
|
||||
if (!defined('TINYIB_BOARD')) { die(''); }
|
||||
|
||||
function pageHeader() {
|
||||
global $tinyib;
|
||||
return <<<EOF
|
||||
$return = <<<EOF
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
${tinyib['boarddescription']}
|
||||
EOF;
|
||||
$return .= TINYIB_BOARDDESC . <<<EOF
|
||||
</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="css/global.css">
|
||||
|
@ -19,6 +19,7 @@ function pageHeader() {
|
|||
<meta http-equiv="expires" content="-1">
|
||||
</head>
|
||||
EOF;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function pageFooter() {
|
||||
|
@ -112,7 +113,6 @@ EOF;
|
|||
}
|
||||
|
||||
function buildPage($htmlposts, $parent, $pages=0, $thispage=0) {
|
||||
global $tinyib;
|
||||
$managelink = basename($_SERVER['PHP_SELF']) . "?manage";
|
||||
|
||||
$postingmode = "";
|
||||
|
@ -162,8 +162,8 @@ EOF;
|
|||
[<a href="$managelink">Manage</a>]
|
||||
</div>
|
||||
<div class="logo">
|
||||
${tinyib['logo']}
|
||||
${tinyib['boarddescription']}
|
||||
EOF;
|
||||
$body .= TINYIB_LOGO . TINYIB_BOARDDESC . <<<EOF
|
||||
</div>
|
||||
<hr width="90%" size="1">
|
||||
$postingmode
|
||||
|
@ -238,7 +238,9 @@ EOF;
|
|||
</div>
|
||||
<hr>
|
||||
<form id="delform" action="imgboard.php?delete" method="post">
|
||||
<input type="hidden" name="board" value="${tinyib['board']}">
|
||||
<input type="hidden" name="board"
|
||||
EOF;
|
||||
$body .= 'value="' . TINYIB_BOARD . '">' . <<<EOF
|
||||
$htmlposts
|
||||
<table class="userdelete">
|
||||
<tbody>
|
||||
|
@ -256,9 +258,7 @@ EOF;
|
|||
return pageHeader() . $body . pageFooter();
|
||||
}
|
||||
|
||||
function rebuildIndexes() {
|
||||
global $mysql_posts_table;
|
||||
|
||||
function rebuildIndexes() {
|
||||
$htmlposts = "";
|
||||
$page = 0;
|
||||
$i = 0;
|
||||
|
@ -300,8 +300,6 @@ function rebuildIndexes() {
|
|||
}
|
||||
|
||||
function rebuildThread($id) {
|
||||
global $mysql_posts_table;
|
||||
|
||||
$htmlposts = "";
|
||||
$posts = postsInThreadByID($id);
|
||||
foreach ($posts as $post) {
|
||||
|
@ -326,8 +324,6 @@ function adminBar() {
|
|||
}
|
||||
|
||||
function managePage($text, $onload='') {
|
||||
global $tinyib;
|
||||
|
||||
$adminbar = adminBar();
|
||||
$body = <<<EOF
|
||||
<body$onload>
|
||||
|
@ -335,8 +331,8 @@ function managePage($text, $onload='') {
|
|||
$adminbar
|
||||
</div>
|
||||
<div class="logo">
|
||||
${tinyib['logo']}
|
||||
${tinyib['boarddescription']}
|
||||
EOF;
|
||||
$body .= TINYIB_LOGO . TINYIB_BOARDDESC . <<<EOF
|
||||
</div>
|
||||
<hr width="90%" size="1">
|
||||
<div class="replymode">Manage mode</div>
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
<?php
|
||||
$tinyib = array();
|
||||
$tinyib['board'] = "b"; // Unique identifier for this board using only letters and numbers
|
||||
$tinyib['boarddescription'] = "TinyIB"; // Displayed in the logo area
|
||||
$tinyib['maxthreads'] = 100; // Set this to limit the number of threads allowed before discarding older threads. 0 to disable
|
||||
$tinyib['logo'] = ""; // Logo HTML
|
||||
$tinyib['tripseed'] = ""; // Text to use when generating secure tripcodes
|
||||
$tinyib['adminpassword'] = ""; // Text entered at the manage prompt to gain administrator access
|
||||
$tinyib['modpassword'] = ""; // Same as above, but only has access to delete posts. Blank ("") to disable
|
||||
$tinyib['databasemode'] = "flatfile"; // flatfile or mysql
|
||||
define('TINYIB_BOARD', "b"); // Unique identifier for this board using only letters and numbers
|
||||
define('TINYIB_BOARDDESC', "TinyIB"); // Displayed in the logo area
|
||||
define('TINYIB_MAXTHREADS', 100); // Set this to limit the number of threads allowed before discarding older threads. 0 to disable
|
||||
define('TINYIB_LOGO', ""); // Logo HTML
|
||||
define('TINYIB_TRIPSEED', ""); // Text to use when generating secure tripcodes
|
||||
define('TINYIB_ADMINPASS', ""); // Text entered at the manage prompt to gain administrator access
|
||||
define('TINYIB_MODPASS', ""); // Same as above, but only has access to delete posts. Blank ("") to disable
|
||||
define('TINYIB_DBMODE', "flatfile"); // flatfile or mysql
|
||||
|
||||
// mysql settings
|
||||
$mysql_host = "localhost";
|
||||
$mysql_username = "";
|
||||
$mysql_password = "";
|
||||
$mysql_database = "";
|
||||
$mysql_posts_table = $tinyib['board'] . "_posts";
|
||||
$mysql_bans_table = "bans";
|
||||
// mysql settings - only edit if not using flatfile
|
||||
define('TINYIB_DBHOST', "localhost");
|
||||
define('TINYIB_DBUSERNAME', "");
|
||||
define('TINYIB_DBPASSWORD', "");
|
||||
define('TINYIB_DBNAME', "");
|
||||
define('TINYIB_DBPOSTS', TINYIB_BOARD . "_posts");
|
||||
define('TINYIB_DBBANS', "bans");
|
||||
?>
|
Loading…
Reference in a new issue