Support blocking keywords

Resolves #122.
This commit is contained in:
Trevor Slocum 2020-11-23 12:44:02 -08:00
parent bce5c8fc30
commit 67483c3774
18 changed files with 810 additions and 165 deletions

View File

@ -20,6 +20,7 @@ See [TinyIB Installations](https://gitlab.com/tslocum/tinyib/wikis/Home) for dem
- Reference links. `>>###` - Reference links. `>>###`
- Delete posts via password. - Delete posts via password.
- Report posts. - Report posts.
- Block keywords.
- Management panel: - Management panel:
- Administrators and moderators use separate passwords. - Administrators and moderators use separate passwords.
- Moderators are only able to sticky threads, lock threads, delete posts, and approve posts when necessary. (See ``TINYIB_REQMOD``) - Moderators are only able to sticky threads, lock threads, delete posts, and approve posts when necessary. (See ``TINYIB_REQMOD``)

View File

@ -122,6 +122,13 @@ if (TINYIB_DBMODE == 'pdo' && TINYIB_DBDRIVER == 'pgsql') {
"post" integer NOT NULL, "post" integer NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
);'; );';
$keywords_sql = 'CREATE TABLE "' . TINYIB_DBKEYWORDS . '" (
"id" bigserial NOT NULL,
"text" varchar(255) NOT NULL,
"action" varchar(255) NOT NULL,
PRIMARY KEY ("id")
);';
} else { } else {
$posts_sql = "CREATE TABLE `" . TINYIB_DBPOSTS . "` ( $posts_sql = "CREATE TABLE `" . TINYIB_DBPOSTS . "` (
`id` mediumint(7) unsigned NOT NULL auto_increment, `id` mediumint(7) unsigned NOT NULL auto_increment,
@ -171,6 +178,13 @@ if (TINYIB_DBMODE == 'pdo' && TINYIB_DBDRIVER == 'pgsql') {
`post` int(20) NOT NULL, `post` int(20) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
)"; )";
$keywords_sql = "CREATE TABLE `" . TINYIB_DBKEYWORDS . "` (
`id` mediumint(7) unsigned NOT NULL auto_increment,
`text` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`action` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
)";
} }
// Check directories are writable by the script // Check directories are writable by the script
@ -261,6 +275,57 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
if ($rawpost || !in_array('password', $hide_fields)) { if ($rawpost || !in_array('password', $hide_fields)) {
$post['password'] = ($_POST['password'] != '') ? hashData($_POST['password']) : ''; $post['password'] = ($_POST['password'] != '') ? hashData($_POST['password']) : '';
} }
$report_post = false;
foreach (array($post['name'], $post['email'], $post['subject'], $post['message']) as $field) {
$keyword = checkKeywords($field);
if (empty($keyword)) {
continue;
}
$expire = -1;
switch ($keyword['action']) {
case 'report':
$report_post = true;
break;
case 'delete':
fancyDie(__('Your post contains a blocked keyword.'));
case 'ban0':
$expire = 0;
break;
case 'ban1h':
$expire = 3600;
break;
case 'ban1d':
$expire = 86400;
break;
case 'ban2d':
$expire = 172800;
break;
case 'ban1w':
$expire = 604800;
break;
case 'ban2w':
$expire = 1209600;
break;
case 'ban1m':
$expire = 2592000;
break;
}
if ($expire >= 0) {
$ban = array();
$ban['ip'] = $post['ip'];
$ban['expire'] = $expire > 0 ? (time() + $expire) : 0;
$ban['reason'] = 'Keyword: ' . $keyword['text'];
insertBan($ban);
$expire_txt = ($ban['expire'] > 0) ? ('<br>This ban will expire ' . strftime(TINYIB_DATEFMT, $ban['expire'])) : '<br>This ban is permanent and will not expire.';
$reason_txt = ($ban['reason'] == '') ? '' : ('<br>Reason: ' . $ban['reason']);
fancyDie('Your IP address ' . $_SERVER['REMOTE_ADDR'] . ' has been banned from posting on this image board. ' . $expire_txt . $reason_txt);
}
break;
}
$post['nameblock'] = nameBlock($post['name'], $post['tripcode'], $post['email'], time(), $rawposttext); $post['nameblock'] = nameBlock($post['name'], $post['tripcode'], $post['email'], time(), $rawposttext);
if (isset($_POST['embed']) && trim($_POST['embed']) != '' && ($rawpost || !in_array('embed', $hide_fields))) { if (isset($_POST['embed']) && trim($_POST['embed']) != '' && ($rawpost || !in_array('embed', $hide_fields))) {
@ -369,6 +434,11 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
$post['id'] = insertPost($post); $post['id'] = insertPost($post);
if ($report_post) {
$report = array('ip' => $post['ip'], 'post' => $post['id']);
insertReport($report);
}
if ($post['moderated'] == '1') { if ($post['moderated'] == '1') {
if (TINYIB_ALWAYSNOKO || strtolower($post['email']) == 'noko') { if (TINYIB_ALWAYSNOKO || strtolower($post['email']) == 'noko') {
$redirect = 'res/' . ($post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent']) . '.html#' . $post['id']; $redirect = 'res/' . ($post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent']) . '.html#' . $post['id'];
@ -495,6 +565,40 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
$onload = manageOnLoad('bans'); $onload = manageOnLoad('bans');
$text .= manageBanForm(); $text .= manageBanForm();
$text .= manageBansTable(); $text .= manageBansTable();
} elseif (isset($_GET['keywords'])) {
if (isset($_POST['text']) && $_POST['text'] != '') {
if ($_GET['keywords'] > 0) {
deleteKeyword($_GET['keywords']);
}
$keyword_exists = keywordByText($_POST['text']);
if ($keyword_exists) {
fancyDie(__('Sorry, that keyword has already been added.'));
}
$keyword = array();
$keyword['text'] = $_POST['text'];
$keyword['action'] = $_POST['action'];
insertKeyword($keyword);
if ($_GET['keywords'] > 0) {
$text .= manageInfo(__('Keyword updated.'));
$_GET['keywords'] = 0;
} else {
$text .= manageInfo(__('Keyword added.'));
}
} elseif (isset($_GET['deletekeyword'])) {
deleteKeyword($_GET['deletekeyword']);
$text .= manageInfo(__('Keyword deleted.'));
}
$onload = manageOnLoad('keywords');
if ($_GET['keywords'] > 0) {
$text .= manageEditKeyword($_GET['keywords']);
} else {
$text .= manageEditKeyword(0);
$text .= manageKeywordsTable();
}
} else if (isset($_GET['update'])) { } else if (isset($_GET['update'])) {
if (is_dir('.git')) { if (is_dir('.git')) {
$git_output = shell_exec('git pull 2>&1'); $git_output = shell_exec('git pull 2>&1');

View File

@ -320,3 +320,50 @@ function deleteReportsByIP($ip) {
$GLOBALS['db']->deleteWhere(REPORTS_FILE, $ipClause); $GLOBALS['db']->deleteWhere(REPORTS_FILE, $ipClause);
} }
// Keyword functions
function keywordByID($id) {
$clause = new SimpleWhereClause(KEYWORD_ID, '=', $id, INTEGER_COMPARISON);
return convertKeywordsToSQLStyle($GLOBALS['db']->selectWhere(KEYWORDS_FILE, $clause, 1), true);
}
function keywordByText($text) {
$text = strtolower($text);
$clause = new SimpleWhereClause(KEYWORD_TEXT, '=', $text, STRING_COMPARISON);
return convertKeywordsToSQLStyle($GLOBALS['db']->selectWhere(KEYWORDS_FILE, $clause, 1), true);
}
function allKeywords() {
$rows = $GLOBALS['db']->selectWhere(KEYWORDS_FILE, NULL, -1, new OrderBy(KEYWORD_TEXT, ASCENDING, INTEGER_COMPARISON));
return convertKeywordsToSQLStyle($rows);
}
function convertKeywordsToSQLStyle($keywords, $singlekeyword = false) {
$newkeywords = array();
foreach ($keywords as $oldkeyword) {
$keyword = array();
$keyword['id'] = $oldkeyword[KEYWORD_ID];
$keyword['text'] = $oldkeyword[KEYWORD_TEXT];
$keyword['action'] = $oldkeyword[KEYWORD_ACTION];
if ($singlekeyword) {
return $keyword;
}
$newkeywords[] = $keyword;
}
return $newkeywords;
}
function insertKeyword($newkeyword) {
$newkeyword['text'] = strtolower($newkeyword['text']);
$keyword = array();
$keyword[KEYWORD_ID] = '0';
$keyword[KEYWORD_TEXT] = $newkeyword['text'];
$keyword[KEYWORD_ACTION] = $newkeyword['action'];
$GLOBALS['db']->insertWithAutoId(KEYWORDS_FILE, KEYWORD_ID, $keyword);
}
function deleteKeyword($id) {
$GLOBALS['db']->deleteWhere(KEYWORDS_FILE, new SimpleWhereClause(KEYWORD_ID, '=', $id, INTEGER_COMPARISON));
}

View File

@ -45,6 +45,12 @@ define('REPORT_ID', 0);
define('REPORT_IP', 1); define('REPORT_IP', 1);
define('REPORT_POST', 2); define('REPORT_POST', 2);
// Keywords table
define('KEYWORDS_FILE', '.keywords');
define('KEYWORD_ID', 0);
define('KEYWORD_TEXT', 1);
define('KEYWORD_ACTION', 2);
require_once 'flatfile/flatfile.php'; require_once 'flatfile/flatfile.php';
$db = new Flatfile(); $db = new Flatfile();
$db->datadir = 'inc/database/flatfile/'; $db->datadir = 'inc/database/flatfile/';
@ -101,4 +107,12 @@ if (function_exists('insertPost')) {
$report[REPORT_POST] = $newreport['post']; $report[REPORT_POST] = $newreport['post'];
$GLOBALS['db']->insertWithAutoId(REPORTS_FILE, REPORT_ID, $report); $GLOBALS['db']->insertWithAutoId(REPORTS_FILE, REPORT_ID, $report);
} }
function migrateKeyword($newkeyword) {
$keyword = array();
$keyword[KEYWORD_ID] = $newkeyword['id'];
$keyword[KEYWORD_TEXT] = $newkeyword['text'];
$keyword[KEYWORD_ACTION] = $newkeyword['action'];
$GLOBALS['db']->insertWithAutoId(KEYWORDS_FILE, KEYWORD_ID, $keyword);
}
} }

View File

@ -221,3 +221,44 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($ip) { function deleteReportsByIP($ip) {
mysql_query("DELETE FROM `" . TINYIB_DBREPORTS . "` WHERE `ip` = " . mysql_real_escape_string($ip) . " OR `ip` = " . mysql_real_escape_string(hashData($ip))); mysql_query("DELETE FROM `" . TINYIB_DBREPORTS . "` WHERE `ip` = " . mysql_real_escape_string($ip) . " OR `ip` = " . mysql_real_escape_string(hashData($ip)));
} }
// Keyword functions
function keywordByID($id) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
if ($result) {
while ($keyword = mysql_fetch_assoc($result)) {
return $keyword;
}
}
}
function keywordByText($text) {
$text = strtolower($text);
$result = mysql_query("SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysql_real_escape_string($text) . "'");
if ($result) {
while ($keyword = mysql_fetch_assoc($result)) {
return $keyword;
}
}
return array();
}
function allKeywords() {
$keywords = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBKEYWORDS . "` ORDER BY `text` ASC");
if ($result) {
while ($keyword = mysql_fetch_assoc($result)) {
$keywords[] = $keyword;
}
}
return $keywords;
}
function insertKeyword($keyword) {
$keyword['text'] = strtolower($keyword['text']);
mysql_query("INSERT INTO `" . TINYIB_DBKEYWORDS . "` (`text`, `action`) VALUES ('" . mysql_real_escape_string($keyword['text']) . "', '" . mysql_real_escape_string($keyword['action']) . "')");
}
function deleteKeyword($id) {
mysql_query("DELETE FROM `" . TINYIB_DBKEYWORDS . "` WHERE `id` = " . mysql_real_escape_string($id));
}

View File

@ -32,6 +32,11 @@ if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBREPORTS . "'")) =
mysql_query($reports_sql); mysql_query($reports_sql);
} }
// Create the keywords table if it does not exist
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBKEYWORDS . "'")) == 0) {
mysql_query($keywords_sql);
}
if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `" . TINYIB_DBPOSTS . "` LIKE 'stickied'")) == 0) { if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `" . TINYIB_DBPOSTS . "` LIKE 'stickied'")) == 0) {
mysql_query("ALTER TABLE `" . TINYIB_DBPOSTS . "` ADD COLUMN stickied TINYINT(1) NOT NULL DEFAULT '0'"); mysql_query("ALTER TABLE `" . TINYIB_DBPOSTS . "` ADD COLUMN stickied TINYINT(1) NOT NULL DEFAULT '0'");
} }
@ -55,4 +60,8 @@ if (function_exists('insertPost')) {
function migrateReport($report) { function migrateReport($report) {
mysql_query("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . mysql_real_escape_string($report['id']) . "', '" . mysql_real_escape_string($report['ip']) . "', '" . mysql_real_escape_string($report['post']) . "')"); mysql_query("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . mysql_real_escape_string($report['id']) . "', '" . mysql_real_escape_string($report['ip']) . "', '" . mysql_real_escape_string($report['post']) . "')");
} }
function migrateKeyword($keyword) {
mysql_query("INSERT INTO " . TINYIB_DBKEYWORDS . " (id, text, action) VALUES ('" . mysql_real_escape_string($keyword['id']) . "', '" . mysql_real_escape_string($keyword['text']) . "', '" . mysql_real_escape_string($keyword['action']) . "')");
}
} }

View File

@ -251,6 +251,53 @@ function deleteReportsByIP($ip) {
mysqli_query($link, "DELETE FROM `" . TINYIB_DBREPORTS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $ip) . "' OR `ip` = '" . mysqli_real_escape_string($link, hashData($ip)) . "'"); mysqli_query($link, "DELETE FROM `" . TINYIB_DBREPORTS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $ip) . "' OR `ip` = '" . mysqli_real_escape_string($link, hashData($ip)) . "'");
} }
// Keyword functions
function keywordByID($id) {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `id` = '" . mysqli_real_escape_string($link, $id) . "' LIMIT 1");
if ($result) {
while ($keyword = mysqli_fetch_assoc($result)) {
return $keyword;
}
}
return array();
}
function keywordByText($text) {
global $link;
$text = strtolower($text);
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysqli_real_escape_string($link, $text) . "'");
if ($result) {
while ($keyword = mysqli_fetch_assoc($result)) {
return $keyword;
}
}
return array();
}
function allKeywords() {
global $link;
$keywords = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBKEYWORDS . "` ORDER BY `text` ASC");
if ($result) {
while ($keyword = mysqli_fetch_assoc($result)) {
$keywords[] = $keyword;
}
}
return $keywords;
}
function insertKeyword($keyword) {
global $link;
$keyword['text'] = strtolower($keyword['text']);
mysqli_query($link, "INSERT INTO `" . TINYIB_DBKEYWORDS . "` (`text`, `action`) VALUES ('" . mysqli_real_escape_string($link, $keyword['text']) . "', '" . mysqli_real_escape_string($link, $keyword['action']) . "')");
}
function deleteKeyword($id) {
global $link;
mysqli_query($link, "DELETE FROM `" . TINYIB_DBKEYWORDS . "` WHERE `id` = '" . mysqli_real_escape_string($link, $id) . "'");
}
// Utility functions // Utility functions
function mysqli_result($res, $row, $field = 0) { function mysqli_result($res, $row, $field = 0) {
$res->data_seek($row); $res->data_seek($row);

View File

@ -32,6 +32,11 @@ if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBREPORTS
mysqli_query($link, $reports_sql); mysqli_query($link, $reports_sql);
} }
// Create the keywords table if it does not exist
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBKEYWORDS . "'")) == 0) {
mysqli_query($link, $keywords_sql);
}
if (mysqli_num_rows(mysqli_query($link, "SHOW COLUMNS FROM `" . TINYIB_DBPOSTS . "` LIKE 'stickied'")) == 0) { if (mysqli_num_rows(mysqli_query($link, "SHOW COLUMNS FROM `" . TINYIB_DBPOSTS . "` LIKE 'stickied'")) == 0) {
mysqli_query($link, "ALTER TABLE `" . TINYIB_DBPOSTS . "` ADD COLUMN stickied TINYINT(1) NOT NULL DEFAULT '0'"); mysqli_query($link, "ALTER TABLE `" . TINYIB_DBPOSTS . "` ADD COLUMN stickied TINYINT(1) NOT NULL DEFAULT '0'");
} }
@ -58,4 +63,9 @@ if (function_exists('insertPost')) {
global $link; global $link;
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . mysqli_real_escape_string($link, $report['id']) . "', '" . mysqli_real_escape_string($link, $report['ip']) . "', '" . mysqli_real_escape_string($link, $report['post']) . "')"); sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . mysqli_real_escape_string($link, $report['id']) . "', '" . mysqli_real_escape_string($link, $report['ip']) . "', '" . mysqli_real_escape_string($link, $report['post']) . "')");
} }
function migrateKeyword($keyword) {
global $link;
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBKEYWORDS . " (id, text, action) VALUES ('" . mysqli_real_escape_string($link, $keyword['id']) . "', '" . mysqli_real_escape_string($link, $keyword['text']) . "', '" . mysqli_real_escape_string($link, $keyword['action']) . "')");
}
} }

View File

@ -206,3 +206,39 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($ip) { function deleteReportsByIP($ip) {
pdoQuery("DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = ? OR ip = ?", array($ip, hashData($ip))); pdoQuery("DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = ? OR ip = ?", array($ip, hashData($ip)));
} }
// Keyword functions
function keywordByID($id) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE id = ? LIMIT 1", array($id));
return $result->fetch(PDO::FETCH_ASSOC);
}
function keywordByText($text) {
$text = strtolower($text);
$keywords = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = ?", array($text));
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$keywords[] = $row;
}
return $keywords;
}
function allKeywords() {
$keywords = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBKEYWORDS . " ORDER BY text ASC");
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$keywords[] = $row;
}
return $keywords;
}
function insertKeyword($keyword) {
global $dbh;
$keyword['text'] = strtolower($keyword['text']);
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBKEYWORDS . " (text, action) VALUES (?, ?)");
$stm->execute(array($keyword['text'], $keyword['action']));
}
function deleteKeyword($id) {
pdoQuery("DELETE FROM " . TINYIB_DBKEYWORDS . " WHERE id = ?", array($id));
}

View File

@ -64,6 +64,18 @@ if (!$reports_exists) {
$dbh->exec($reports_sql); $dbh->exec($reports_sql);
} }
// Create the keywords table if it does not exist
if (TINYIB_DBDRIVER === 'pgsql') {
$query = "SELECT COUNT(*) FROM pg_catalog.pg_tables WHERE tablename LIKE " . $dbh->quote(TINYIB_DBKEYWORDS);
$keywords_exists = $dbh->query($query)->fetchColumn() != 0;
} else {
$dbh->query("SHOW TABLES LIKE " . $dbh->quote(TINYIB_DBKEYWORDS));
$keywords_exists = $dbh->query("SELECT FOUND_ROWS()")->fetchColumn() != 0;
}
if (!$keywords_exists) {
$dbh->exec($keywords_sql);
}
if (TINYIB_DBDRIVER === 'pgsql') { if (TINYIB_DBDRIVER === 'pgsql') {
$query = "SELECT column_name FROM information_schema.columns WHERE table_name='" . TINYIB_DBPOSTS . "' and column_name='moderated'"; $query = "SELECT column_name FROM information_schema.columns WHERE table_name='" . TINYIB_DBPOSTS . "' and column_name='moderated'";
$moderated_exists = $dbh->query($query)->fetchColumn() != 0; $moderated_exists = $dbh->query($query)->fetchColumn() != 0;
@ -142,4 +154,10 @@ if (function_exists('insertPost')) {
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES (?, ?, ?)"); $stm = $dbh->prepare("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES (?, ?, ?)");
$stm->execute(array($report['id'], $report['ip'], $report['post'])); $stm->execute(array($report['id'], $report['ip'], $report['post']));
} }
function migrateKeyword($keyword) {
global $dbh;
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBKEYWORDS . " (id, text, action) VALUES (?, ?, ?)");
$stm->execute(array($keyword['id'], $keyword['text'], $keyword['action']));
}
} }

View File

@ -192,3 +192,39 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($ip) { function deleteReportsByIP($ip) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = '" . sqlite_escape_string($ip) . "' OR ip = '" . sqlite_escape_string(hashData($ip)) . "'"); sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = '" . sqlite_escape_string($ip) . "' OR ip = '" . sqlite_escape_string(hashData($ip)) . "'");
} }
// Keyword functions
function keywordByID($id) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE id = '" . sqlite_escape_string($id) . "' LIMIT 1"), SQLITE_ASSOC);
foreach ($result as $keyword) {
return $keyword;
}
return array();
}
function keywordByText($text) {
$text = strtolower($text);
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . sqlite_escape_string($text) . "'"), SQLITE_ASSOC);
foreach ($result as $keyword) {
return $keyword;
}
return array();
}
function allKeywords() {
$keywords = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBKEYWORDS . " ORDER BY text ASC"), SQLITE_ASSOC);
foreach ($result as $keyword) {
$keywords[] = $keyword;
}
return $keywords;
}
function insertKeyword($keyword) {
$keyword['text'] = strtolower($keyword['text']);
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBKEYWORDS . " (text, action) VALUES ('" . sqlite_escape_string($keyword['text']) . "', '" . sqlite_escape_string($keyword['action']) . "')");
}
function deleteKeyword($id) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBKEYWORDS . " WHERE id = " . sqlite_escape_string($id));
}

View File

@ -221,3 +221,44 @@ function deleteReportsByIP($ip) {
global $db; global $db;
$db->exec("DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = '" . $db->escapeString($ip) . "' OR ip = '" . $db->escapeString(hashData($ip)) . "'"); $db->exec("DELETE FROM " . TINYIB_DBREPORTS . " WHERE ip = '" . $db->escapeString($ip) . "' OR ip = '" . $db->escapeString(hashData($ip)) . "'");
} }
// Keyword functions
function keywordByID($id) {
global $db;
$result = $db->query("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE id = '" . $db->escapeString($id) . "' LIMIT 1");
while ($keyword = $result->fetchArray()) {
return $keyword;
}
return array();
}
function keywordByText($text) {
global $db;
$text = strtolower($text);
$result = $db->query("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . $db->escapeString($text) . "'");
while ($keyword = $result->fetchArray()) {
return $keyword;
}
return array();
}
function allKeywords() {
global $db;
$keywords = array();
$result = $db->query("SELECT * FROM " . TINYIB_DBKEYWORDS . " ORDER BY text ASC");
while ($keyword = $result->fetchArray()) {
$keywords[] = $keyword;
}
return $keywords;
}
function insertKeyword($keyword) {
global $db;
$keyword['text'] = strtolower($keyword['text']);
$db->exec("INSERT INTO " . TINYIB_DBKEYWORDS . " (text, action) VALUES ('" . $db->escapeString($keyword['text']) . "', '" . $db->escapeString($keyword['action']) . "')");
}
function deleteKeyword($id) {
global $db;
$db->exec("DELETE FROM " . TINYIB_DBKEYWORDS . " WHERE id = " . $db->escapeString($id));
}

View File

@ -66,6 +66,16 @@ if (!$result->fetchArray()) {
)"); )");
} }
// Create the keywords table if it does not exist
$result = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBKEYWORDS . "'");
if (!$result->fetchArray()) {
$db->exec("CREATE TABLE " . TINYIB_DBKEYWORDS . " (
id INTEGER PRIMARY KEY,
text TEXT NOT NULL,
action TEXT NOT NULL
)");
}
// Add moderated column if it isn't present // Add moderated column if it isn't present
@$db->exec("ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN moderated INTEGER NOT NULL DEFAULT '0'"); @$db->exec("ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN moderated INTEGER NOT NULL DEFAULT '0'");
@ -93,4 +103,9 @@ if (function_exists('insertPost')) {
global $db; global $db;
$db->exec("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . $db->escapeString($report['id']) . "', '" . $db->escapeString($report['ip']) . "', '" . $db->escapeString($report['post']) . "')"); $db->exec("INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . $db->escapeString($report['id']) . "', '" . $db->escapeString($report['ip']) . "', '" . $db->escapeString($report['post']) . "')");
} }
function migrateKeyword($keyword) {
global $db;
$db->exec("INSERT INTO " . TINYIB_DBKEYWORDS . " (id, text, action) VALUES ('" . $db->escapeString($keyword['id']) . "', '" . $db->escapeString($keyword['text']) . "', '" . $db->escapeString($keyword['action']) . "')");
}
} }

View File

@ -65,6 +65,16 @@ if (sqlite_num_rows($result) == 0) {
)"); )");
} }
// Create the keywords table if it does not exist
$result = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBKEYWORDS . "'");
if (sqlite_num_rows($result) == 0) {
sqlite_query($db, "CREATE TABLE " . TINYIB_DBKEYWORDS . " (
id INTEGER PRIMARY KEY,
text TEXT NOT NULL,
action TEXT NOT NULL
)");
}
// Add moderated column if it isn't present // Add moderated column if it isn't present
sqlite_query($db, "ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN moderated INTEGER NOT NULL DEFAULT '0'"); sqlite_query($db, "ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN moderated INTEGER NOT NULL DEFAULT '0'");
@ -89,4 +99,8 @@ if (function_exists('insertPost')) {
function migrateReport($report) { function migrateReport($report) {
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . sqlite_escape_string($report['id']) . "', '" . sqlite_escape_string($report['ip']) . "', '" . sqlite_escape_string($report['post']) . "')"); sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBREPORTS . " (id, ip, post) VALUES ('" . sqlite_escape_string($report['id']) . "', '" . sqlite_escape_string($report['ip']) . "', '" . sqlite_escape_string($report['post']) . "')");
} }
function migrateKeyword($keyword) {
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBKEYWORDS . " (id, text, action) VALUES ('" . sqlite_escape_string($keyword['id']) . "', '" . sqlite_escape_string($keyword['text']) . "', '" . sqlite_escape_string($keyword['action']) . "')");
}
} }

View File

@ -285,6 +285,16 @@ function checkBanned() {
} }
} }
function checkKeywords($text) {
$keywords = allKeywords();
foreach ($keywords as $keyword) {
if (stripos($text, $keyword['text']) !== false) {
return $keyword;
}
}
return array();
}
function checkFlood() { function checkFlood() {
if (TINYIB_DELAY > 0) { if (TINYIB_DELAY > 0) {
$lastpost = lastPostByIP(); $lastpost = lastPostByIP();

View File

@ -716,6 +716,7 @@ function adminBar() {
$output = '[<a href="?manage">' . __('Status') . '</a>] ['; $output = '[<a href="?manage">' . __('Status') . '</a>] [';
if ($isadmin) { if ($isadmin) {
$output .= '<a href="?manage&bans">' . __('Bans') . '</a>] ['; $output .= '<a href="?manage&bans">' . __('Bans') . '</a>] [';
$output .= '<a href="?manage&keywords">' . __('Keywords') . '</a>] [';
} }
$output .= '<a href="?manage&moderate">' . __('Moderate Post') . '</a>] [<a href="?manage&rawpost">' . __('Raw Post') . '</a>] ['; $output .= '<a href="?manage&moderate">' . __('Moderate Post') . '</a>] [<a href="?manage&rawpost">' . __('Raw Post') . '</a>] [';
if ($isadmin) { if ($isadmin) {
@ -757,6 +758,8 @@ function manageOnLoad($page) {
return ' onload="document.tinyib.managepassword.focus();"'; return ' onload="document.tinyib.managepassword.focus();"';
case 'moderate': case 'moderate':
return ' onload="document.tinyib.moderate.focus();"'; return ' onload="document.tinyib.moderate.focus();"';
case 'keywords':
return ' onload="document.tinyib.text.focus();"';
case 'rawpost': case 'rawpost':
return ' onload="document.tinyib.message.focus();"'; return ' onload="document.tinyib.message.focus();"';
case 'bans': case 'bans':
@ -999,6 +1002,95 @@ EOF;
EOF; EOF;
} }
function manageEditKeyword($id) {
$id = intval($id);
$v_text = '';
$v_action = '';
if ($id > 0) {
$keyword = keywordByID($id);
if (empty($keyword)) {
fancyDie(__("Sorry, there doesn't appear to be a keyword with that ID."));
}
$v_text = htmlentities($keyword['text'], ENT_QUOTES);
$v_action = $keyword['action'];
}
$txt_keyword = __('Keyword');
$txt_keywords = __('Keywords');
$txt_action = __('Action:');
$txt_submit = $id > 0 ? __('Update') : __('Add');
$return = <<<EOF
<form id="tinyib" name="tinyib" method="post" action="?manage&keywords=$id">
<fieldset>
<legend>$txt_keywords</legend>
<div valign="top"><label for="keyword">$txt_keyword</label> <input type="text" name="text" id="text" value="$v_text"><br>
<label for="action">$txt_action</label>
<select name="action">
EOF;
if (TINYIB_REPORT) {
$return .= '<option value="report"' . ($v_action == 'report' ? ' selected' : '') . '>' . __('Report') . '</option>';
}
$return .= '<option value="delete"' . ($v_action == 'delete' ? ' selected' : '') . '>' . __('Delete') . '</option>';
$return .= '<option value="ban1h"' . ($v_action == 'ban1h' ? ' selected' : '') . '>' . __('Delete and ban for 1 hour') . '</option>';
$return .= '<option value="ban1d"' . ($v_action == 'ban1d' ? ' selected' : '') . '>' . __('Delete and ban for 1 day') . '</option>';
$return .= '<option value="ban2d"' . ($v_action == 'ban2d' ? ' selected' : '') . '>' . __('Delete and ban for 2 days') . '</option>';
$return .= '<option value="ban1w"' . ($v_action == 'ban1w' ? ' selected' : '') . '>' . __('Delete and ban for 1 week') . '</option>';
$return .= '<option value="ban2w"' . ($v_action == 'ban2w' ? ' selected' : '') . '>' . __('Delete and ban for 2 weeks') . '</option>';
$return .= '<option value="ban1m"' . ($v_action == 'ban1m' ? ' selected' : '') . '>' . __('Delete and ban for 1 month') . '</option>';
$return .= '<option value="ban0"' . ($v_action == 'ban0' ? ' selected' : '') . '>' . __('Delete and ban permanently') . '</option>';
return $return . <<<EOF
</select><br><br>
<input type="submit" value="$txt_submit" class="managebutton"></div>
</fieldset>
</form><br>
EOF;
}
function manageKeywordsTable() {
$text = '';
$keywords = allKeywords();
if (count($keywords) > 0) {
$text .= '<table border="1"><tr><th>' . __('Keyword') . '</th><th>' . __('Action') . '</th><th>&nbsp;</th></tr>';
foreach ($keywords as $keyword) {
$action = '';
switch ($keyword['action']) {
case 'report':
$action = __('Report');
break;
case 'delete':
$action = __('Delete');
break;
case 'ban0':
$action = __('Delete and ban permanently');
break;
case 'ban1h':
$action = __('Delete and ban for 1 hour');
break;
case 'ban1d':
$action = __('Delete and ban for 1 day');
break;
case 'ban2d':
$action = __('Delete and ban for 2 days');
break;
case 'ban1w':
$action = __('Delete and ban for 1 week');
break;
case 'ban2w':
$action = __('Delete and ban for 2 weeks');
break;
case 'ban1m':
$action = __('Delete and ban for 1 month');
break;
}
$text .= '<tr><td>' . htmlentities($keyword['text']) . '</td><td>' . $action . '</td><td><a href="?manage&keywords=' . $keyword['id'] . '">' . __('Edit') . '</a> <a href="?manage&keywords&deletekeyword=' . $keyword['id'] . '">' . __('Delete') . '</a></td></tr>';
}
$text .= '</table>';
}
return $text;
}
function manageStatus() { function manageStatus() {
global $isadmin; global $isadmin;
$threads = countThreads(); $threads = countThreads();
@ -1007,7 +1099,7 @@ function manageStatus() {
$info = $threads . ' ' . plural($threads, __('thread'), __('threads')); $info = $threads . ' ' . plural($threads, __('thread'), __('threads'));
if (TINYIB_REPORT) { if (TINYIB_REPORT) {
$info .= ', ' . count($reports). ' ' . plural(count($reports), __('report'), __('reports')); $info .= ', ' . count($reports) . ' ' . plural(count($reports), __('report'), __('reports'));
} }
$info .= ', ' . $bans . ' ' . plural($bans, __('ban'), __('bans')); $info .= ', ' . $bans . ' ' . plural($bans, __('ban'), __('bans'));

View File

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2020-10-22 09:12-0700\n" "POT-Creation-Date: 2020-11-23 12:37-0800\n"
"PO-Revision-Date: 2020-10-22 09:12-0700\n" "PO-Revision-Date: 2020-11-23 12:37-0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: en\n" "Language: en\n"
@ -17,254 +17,290 @@ msgstr ""
"X-Poedit-SearchPath-1: inc/functions.php\n" "X-Poedit-SearchPath-1: inc/functions.php\n"
"X-Poedit-SearchPath-2: inc/html.php\n" "X-Poedit-SearchPath-2: inc/html.php\n"
#: imgboard.php:60 #: imgboard.php:46
msgid "Click here to go back" msgid "Click here to go back"
msgstr "" msgstr ""
#: imgboard.php:84 #: imgboard.php:72 imgboard.php:614
msgid "TINYIB_TRIPSEED and TINYIB_ADMINPASS must be configured."
msgstr ""
#: imgboard.php:88
msgid "TINYIB_RECAPTCHA_SITE and TINYIB_RECAPTCHA_SECRET must be configured."
msgstr ""
#: imgboard.php:93 imgboard.php:501
msgid "Unknown database mode specified." msgid "Unknown database mode specified."
msgstr "" msgstr ""
#: imgboard.php:190 #: imgboard.php:183
#, php-format #, php-format
msgid "Directory '%s' can not be written to. Please modify its permissions." msgid "Directory '%s' can not be written to. Please modify its permissions."
msgstr "" msgstr ""
#: imgboard.php:207 #: imgboard.php:193
msgid "TINYIB_TRIPSEED and TINYIB_ADMINPASS must be configured."
msgstr ""
#: imgboard.php:197
msgid "TINYIB_RECAPTCHA_SITE and TINYIB_RECAPTCHA_SECRET must be configured."
msgstr ""
#: imgboard.php:210
msgid "Posting is currently disabled.<br>Please try again in a few moments." msgid "Posting is currently disabled.<br>Please try again in a few moments."
msgstr "" msgstr ""
#: imgboard.php:226 inc/functions.php:300 #: imgboard.php:229 inc/functions.php:346
msgid "Invalid parent thread ID supplied, unable to create post." msgid "Invalid parent thread ID supplied, unable to create post."
msgstr "" msgstr ""
#: imgboard.php:228 #: imgboard.php:231
msgid "Replies are not allowed to locked threads." msgid "Replies are not allowed to locked threads."
msgstr "" msgstr ""
#: imgboard.php:265 #: imgboard.php:278
msgid "Your post contains a blocked keyword."
msgstr ""
#: imgboard.php:319
msgid "Embedding a URL and uploading a file at the same time is not supported." msgid "Embedding a URL and uploading a file at the same time is not supported."
msgstr "" msgstr ""
#: imgboard.php:271 #: imgboard.php:325
#, php-format #, php-format
msgid "Invalid embed URL. Only %s URLs are supported." msgid "Invalid embed URL. Only %s URLs are supported."
msgstr "" msgstr ""
#: imgboard.php:275 inc/functions.php:326 inc/functions.php:566 #: imgboard.php:329 inc/functions.php:372 inc/functions.php:612
#, php-format #, php-format
msgid "That file is larger than %s." msgid "That file is larger than %s."
msgstr "" msgstr ""
#: imgboard.php:280 imgboard.php:286 #: imgboard.php:334 imgboard.php:340
msgid "Failed to download file at specified URL." msgid "Failed to download file at specified URL."
msgstr "" msgstr ""
#: imgboard.php:308 #: imgboard.php:362
msgid "Error while processing audio/video." msgid "Error while processing audio/video."
msgstr "" msgstr ""
#: imgboard.php:315 inc/functions.php:651 inc/functions.php:662 #: imgboard.php:369 inc/functions.php:697 inc/functions.php:708
msgid "Could not create thumbnail." msgid "Could not create thumbnail."
msgstr "" msgstr ""
#: imgboard.php:338 #: imgboard.php:392
msgid "upload a file or embed a URL" msgid "upload a file or embed a URL"
msgstr "" msgstr ""
#: imgboard.php:340 #: imgboard.php:394
msgid "upload a file" msgid "upload a file"
msgstr "" msgstr ""
#: imgboard.php:342 #: imgboard.php:396
msgid "embed a URL" msgid "embed a URL"
msgstr "" msgstr ""
#: imgboard.php:345 #: imgboard.php:399
#, php-format #, php-format
msgid "Please %s to start a new thread." msgid "Please %s to start a new thread."
msgstr "" msgstr ""
#: imgboard.php:351 #: imgboard.php:405
#, php-format #, php-format
msgid "Please enter a message and/or %s." msgid "Please enter a message and/or %s."
msgstr "" msgstr ""
#: imgboard.php:353 #: imgboard.php:407
msgid "Please enter a message." msgid "Please enter a message."
msgstr "" msgstr ""
#: imgboard.php:355 #: imgboard.php:409
#, php-format #, php-format
msgid "Please %s." msgid "Please %s."
msgstr "" msgstr ""
#: imgboard.php:358 #: imgboard.php:412
#, php-format #, php-format
msgid "%s uploaded." msgid "%s uploaded."
msgstr "" msgstr ""
#: imgboard.php:363 #: imgboard.php:417
#, php-format #, php-format
msgid "Your %s will be shown <b>once it has been approved</b>." msgid "Your %s will be shown <b>once it has been approved</b>."
msgstr "" msgstr ""
#: imgboard.php:376 #: imgboard.php:435
msgid "Updating thread..." msgid "Updating thread..."
msgstr "" msgstr ""
#: imgboard.php:389 #: imgboard.php:448
msgid "Updating index..." msgid "Updating index..."
msgstr "" msgstr ""
#: imgboard.php:395 #: imgboard.php:454
msgid "Tick the box next to a post and click \"Delete\" to delete it." msgid "Reporting is disabled."
msgstr "" msgstr ""
#: imgboard.php:399 #: imgboard.php:459 imgboard.php:500
msgid ""
"Post deletion is currently disabled.<br>Please try again in a few moments."
msgstr ""
#: imgboard.php:416
msgid "Post deleted."
msgstr ""
#: imgboard.php:418
msgid "Invalid password."
msgstr ""
#: imgboard.php:421
msgid "" msgid ""
"Sorry, an invalid post identifier was sent. Please go back, refresh the " "Sorry, an invalid post identifier was sent. Please go back, refresh the "
"page, and try again." "page, and try again."
msgstr "" msgstr ""
#: imgboard.php:445 #: imgboard.php:464
msgid "You have already submitted a report for that post."
msgstr ""
#: imgboard.php:470
msgid "Post reported."
msgstr ""
#: imgboard.php:474
msgid "Tick the box next to a post and click \"Delete\" to delete it."
msgstr ""
#: imgboard.php:478
msgid ""
"Post deletion is currently disabled.<br>Please try again in a few moments."
msgstr ""
#: imgboard.php:495
msgid "Post deleted."
msgstr ""
#: imgboard.php:497 inc/functions.php:326
msgid "Invalid password."
msgstr ""
#: imgboard.php:524
msgid "Rebuilt board." msgid "Rebuilt board."
msgstr "" msgstr ""
#: imgboard.php:453 #: imgboard.php:532
msgid "Sorry, there is already a ban on record for that IP address." msgid "Sorry, there is already a ban on record for that IP address."
msgstr "" msgstr ""
#: imgboard.php:462 #: imgboard.php:541
#, php-format #, php-format
msgid "Ban record added for %s" msgid "Ban record added for %s"
msgstr "" msgstr ""
#: imgboard.php:468 #: imgboard.php:547
#, php-format #, php-format
msgid "Ban record lifted for %s" msgid "Ban record lifted for %s"
msgstr "" msgstr ""
#: imgboard.php:536 #: imgboard.php:562
msgid "Sorry, that keyword has already been added."
msgstr ""
#: imgboard.php:571
msgid "Keyword updated."
msgstr ""
#: imgboard.php:574
msgid "Keyword added."
msgstr ""
#: imgboard.php:578
msgid "Keyword deleted."
msgstr ""
#: imgboard.php:650
#, php-format #, php-format
msgid "Post No.%d deleted." msgid "Post No.%d deleted."
msgstr "" msgstr ""
#: imgboard.php:538 imgboard.php:554 imgboard.php:563 imgboard.php:578 #: imgboard.php:652 imgboard.php:668 imgboard.php:677 imgboard.php:692
#: imgboard.php:592 #: imgboard.php:706 imgboard.php:719
msgid "Sorry, there doesn't appear to be a post with that ID." msgid "Sorry, there doesn't appear to be a post with that ID."
msgstr "" msgstr ""
#: imgboard.php:552 #: imgboard.php:666
#, php-format #, php-format
msgid "Post No.%d approved." msgid "Post No.%d approved."
msgstr "" msgstr ""
#: imgboard.php:581 imgboard.php:595 #: imgboard.php:695 imgboard.php:709
msgid "Form data was lost. Please go back and try again." msgid "Form data was lost. Please go back and try again."
msgstr "" msgstr ""
#: inc/functions.php:127 inc/html.php:1055 #: imgboard.php:717
msgid "Reports cleared."
msgstr ""
#: inc/functions.php:135 inc/html.php:1217
msgid "Anonymous" msgid "Anonymous"
msgstr "" msgstr ""
#: inc/functions.php:236 #: inc/functions.php:268
msgid "Please enter the CAPTCHA text." msgid "Please enter the CAPTCHA text."
msgstr "" msgstr ""
#: inc/functions.php:238 #: inc/functions.php:270
msgid "" msgid ""
"Incorrect CAPTCHA text entered. Please try again.<br>Click the image to " "Incorrect CAPTCHA text entered. Please try again.<br>Click the image to "
"retrieve a new CAPTCHA." "retrieve a new CAPTCHA."
msgstr "" msgstr ""
#: inc/functions.php:269 #: inc/functions.php:311
#, php-format #, php-format
msgid "" msgid ""
"Please shorten your message, or post it in multiple parts. Your message is " "Please shorten your message, or post it in multiple parts. Your message is "
"%1$d characters long, and the maximum allowed is %2$d." "%1$d characters long, and the maximum allowed is %2$d."
msgstr "" msgstr ""
#: inc/functions.php:329 #: inc/functions.php:375
#, php-format #, php-format
msgid "" msgid ""
"The uploaded file exceeds the upload_max_filesize directive (%s) in php.ini." "The uploaded file exceeds the upload_max_filesize directive (%s) in php.ini."
msgstr "" msgstr ""
#: inc/functions.php:332 #: inc/functions.php:378
msgid "The uploaded file was only partially uploaded." msgid "The uploaded file was only partially uploaded."
msgstr "" msgstr ""
#: inc/functions.php:335 #: inc/functions.php:381
msgid "No file was uploaded." msgid "No file was uploaded."
msgstr "" msgstr ""
#: inc/functions.php:338 #: inc/functions.php:384
msgid "Missing a temporary folder." msgid "Missing a temporary folder."
msgstr "" msgstr ""
#: inc/functions.php:341 #: inc/functions.php:387
msgid "Failed to write file to disk" msgid "Failed to write file to disk"
msgstr "" msgstr ""
#: inc/functions.php:344 #: inc/functions.php:390
msgid "Unable to save the uploaded file." msgid "Unable to save the uploaded file."
msgstr "" msgstr ""
#: inc/functions.php:352 #: inc/functions.php:398
#, php-format #, php-format
msgid "" msgid ""
"Duplicate file uploaded. That file has already been posted <a href=\"%s" "Duplicate file uploaded. That file has already been posted <a href=\"%s"
"\">here</a>." "\">here</a>."
msgstr "" msgstr ""
#: inc/functions.php:383 #: inc/functions.php:429
msgid "" msgid ""
"Unable to read the uploaded file while creating its thumbnail. A common " "Unable to read the uploaded file while creating its thumbnail. A common "
"cause for this is an incorrect extension when the file is actually of a " "cause for this is an incorrect extension when the file is actually of a "
"different type." "different type."
msgstr "" msgstr ""
#: inc/functions.php:560 #: inc/functions.php:606
msgid "File transfer failure. Please retry the submission." msgid "File transfer failure. Please retry the submission."
msgstr "" msgstr ""
#: inc/functions.php:582 #: inc/functions.php:628
msgid "" msgid ""
"Failed to read the MIME type and size of the uploaded file. Please retry the " "Failed to read the MIME type and size of the uploaded file. Please retry the "
"submission." "submission."
msgstr "" msgstr ""
#: inc/functions.php:596 inc/functions.php:601 #: inc/functions.php:642 inc/functions.php:647
msgid "Could not copy uploaded file." msgid "Could not copy uploaded file."
msgstr "" msgstr ""
#: inc/functions.php:607 #: inc/functions.php:653
msgid "File transfer failure. Please go back and try again." msgid "File transfer failure. Please go back and try again."
msgstr "" msgstr ""
#: inc/functions.php:626 #: inc/functions.php:672
msgid "Sorry, your video appears to be corrupt." msgid "Sorry, your video appears to be corrupt."
msgstr "" msgstr ""
@ -278,7 +314,7 @@ msgstr ""
msgid "Supported file types are %1$s and %2$s." msgid "Supported file types are %1$s and %2$s."
msgstr "" msgstr ""
#: inc/html.php:77 inc/html.php:781 inc/html.php:819 #: inc/html.php:77 inc/html.php:820 inc/html.php:858
msgid "Submit" msgid "Submit"
msgstr "" msgstr ""
@ -300,7 +336,7 @@ msgstr ""
msgid "Line-breaks must be specified with \"&lt;br&gt;\"." msgid "Line-breaks must be specified with \"&lt;br&gt;\"."
msgstr "" msgstr ""
#: inc/html.php:149 #: inc/html.php:149 inc/html.php:795
msgid "(enter the text below)" msgid "(enter the text below)"
msgstr "" msgstr ""
@ -359,7 +395,7 @@ msgstr ""
msgid "Message" msgid "Message"
msgstr "" msgstr ""
#: inc/html.php:298 inc/html.php:564 #: inc/html.php:298 inc/html.php:570
msgid "Password" msgid "Password"
msgstr "" msgstr ""
@ -367,326 +403,399 @@ msgstr ""
msgid "(for post and file deletion)" msgid "(for post and file deletion)"
msgstr "" msgstr ""
#: inc/html.php:356 #: inc/html.php:350 inc/html.php:1033 inc/html.php:1060
msgid "Report"
msgstr ""
#: inc/html.php:362
msgid "Stickied" msgid "Stickied"
msgstr "" msgstr ""
#: inc/html.php:360 #: inc/html.php:366
msgid "Locked" msgid "Locked"
msgstr "" msgstr ""
#: inc/html.php:373 #: inc/html.php:379
msgid "Embed:" msgid "Embed:"
msgstr "" msgstr ""
#: inc/html.php:373 #: inc/html.php:379
msgid "File:" msgid "File:"
msgstr "" msgstr ""
#: inc/html.php:470 #: inc/html.php:476
msgid "Reply" msgid "Reply"
msgstr "" msgstr ""
#: inc/html.php:476 #: inc/html.php:482
msgid "Post truncated. Click Reply to view." msgid "Post truncated. Click Reply to view."
msgstr "" msgstr ""
#: inc/html.php:487 #: inc/html.php:493
msgid "1 post omitted. Click Reply to view." msgid "1 post omitted. Click Reply to view."
msgstr "" msgstr ""
#: inc/html.php:489 #: inc/html.php:495
#, php-format #, php-format
msgid "%d posts omitted. Click Reply to view." msgid "%d posts omitted. Click Reply to view."
msgstr "" msgstr ""
#: inc/html.php:505 inc/html.php:540 inc/html.php:552 #: inc/html.php:511 inc/html.php:546 inc/html.php:558
msgid "Catalog" msgid "Catalog"
msgstr "" msgstr ""
#: inc/html.php:515 #: inc/html.php:521
msgid "Previous" msgid "Previous"
msgstr "" msgstr ""
#: inc/html.php:528 #: inc/html.php:534
msgid "Next" msgid "Next"
msgstr "" msgstr ""
#: inc/html.php:552 inc/html.php:554 inc/html.php:701 #: inc/html.php:558 inc/html.php:560 inc/html.php:711
msgid "Return" msgid "Return"
msgstr "" msgstr ""
#: inc/html.php:554 #: inc/html.php:560
msgid "Posting mode: Reply" msgid "Posting mode: Reply"
msgstr "" msgstr ""
#: inc/html.php:562 #: inc/html.php:568
msgid "Manage" msgid "Manage"
msgstr "" msgstr ""
#: inc/html.php:563 #: inc/html.php:569
msgid "Style" msgid "Style"
msgstr "" msgstr ""
#: inc/html.php:565 inc/html.php:979 #: inc/html.php:571 inc/html.php:1035 inc/html.php:1063 inc/html.php:1087
#: inc/html.php:1132
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: inc/html.php:566 #: inc/html.php:572
msgid "Delete Post" msgid "Delete Post"
msgstr "" msgstr ""
#: inc/html.php:706 inc/html.php:1006 #: inc/html.php:716 inc/html.php:1172
msgid "Status" msgid "Status"
msgstr "" msgstr ""
#: inc/html.php:708 #: inc/html.php:718
msgid "Bans" msgid "Bans"
msgstr "" msgstr ""
#: inc/html.php:710 #: inc/html.php:719 inc/html.php:1020
msgid "Keywords"
msgstr ""
#: inc/html.php:721
msgid "Moderate Post" msgid "Moderate Post"
msgstr "" msgstr ""
#: inc/html.php:710 #: inc/html.php:721
msgid "Raw Post" msgid "Raw Post"
msgstr "" msgstr ""
#: inc/html.php:712 #: inc/html.php:723
msgid "Rebuild All" msgid "Rebuild All"
msgstr "" msgstr ""
#: inc/html.php:715 #: inc/html.php:726 inc/html.php:1022
msgid "Update" msgid "Update"
msgstr "" msgstr ""
#: inc/html.php:718 #: inc/html.php:729
msgid "Migrate Database" msgid "Migrate Database"
msgstr "" msgstr ""
#: inc/html.php:720 #: inc/html.php:731
msgid "Log Out" msgid "Log Out"
msgstr "" msgstr ""
#: inc/html.php:726 #: inc/html.php:737
msgid "Manage mode" msgid "Manage mode"
msgstr "" msgstr ""
#: inc/html.php:758 #: inc/html.php:771
msgid "Log In" msgid "Log In"
msgstr "" msgstr ""
#: inc/html.php:759 #: inc/html.php:772
msgid "Enter an administrator or moderator password" msgid "Enter an administrator or moderator password"
msgstr "" msgstr ""
#: inc/html.php:775 #: inc/html.php:814
msgid "Add a ban" msgid "Add a ban"
msgstr "" msgstr ""
#: inc/html.php:776 inc/html.php:805 #: inc/html.php:815 inc/html.php:844
msgid "IP Address" msgid "IP Address"
msgstr "" msgstr ""
#: inc/html.php:777 #: inc/html.php:816
msgid "Expire(sec)" msgid "Expire(sec)"
msgstr "" msgstr ""
#: inc/html.php:778 inc/html.php:805 #: inc/html.php:817 inc/html.php:844
msgid "Reason" msgid "Reason"
msgstr "" msgstr ""
#: inc/html.php:779 #: inc/html.php:818
msgid "never" msgid "never"
msgstr "" msgstr ""
#: inc/html.php:780 #: inc/html.php:819
msgid "optional" msgid "optional"
msgstr "" msgstr ""
#: inc/html.php:782 #: inc/html.php:821
msgid "1 hour" msgid "1 hour"
msgstr "" msgstr ""
#: inc/html.php:783 #: inc/html.php:822
msgid "1 day" msgid "1 day"
msgstr "" msgstr ""
#: inc/html.php:784 #: inc/html.php:823
msgid "2 days" msgid "2 days"
msgstr "" msgstr ""
#: inc/html.php:785 #: inc/html.php:824
msgid "1 week" msgid "1 week"
msgstr "" msgstr ""
#: inc/html.php:786 #: inc/html.php:825
msgid "2 weeks" msgid "2 weeks"
msgstr "" msgstr ""
#: inc/html.php:787 #: inc/html.php:826
msgid "1 month" msgid "1 month"
msgstr "" msgstr ""
#: inc/html.php:805 #: inc/html.php:844
msgid "Set At" msgid "Set At"
msgstr "" msgstr ""
#: inc/html.php:805 #: inc/html.php:844
msgid "Expires" msgid "Expires"
msgstr "" msgstr ""
#: inc/html.php:807 #: inc/html.php:846
msgid "Does not expire" msgid "Does not expire"
msgstr "" msgstr ""
#: inc/html.php:809 #: inc/html.php:848
msgid "lift" msgid "lift"
msgstr "" msgstr ""
#: inc/html.php:817 #: inc/html.php:856
msgid "Moderate a post" msgid "Moderate a post"
msgstr "" msgstr ""
#: inc/html.php:818 #: inc/html.php:857
msgid "Post ID" msgid "Post ID"
msgstr "" msgstr ""
#: inc/html.php:820 #: inc/html.php:859
msgid "Tip:" msgid "Tip:"
msgstr "" msgstr ""
#: inc/html.php:821 #: inc/html.php:860
msgid "" msgid ""
"While browsing the image board, you can easily moderate a post if you are " "While browsing the image board, you can easily moderate a post if you are "
"logged in." "logged in."
msgstr "" msgstr ""
#: inc/html.php:822 #: inc/html.php:861
msgid "" msgid ""
"Tick the box next to a post and click \"Delete\" at the bottom of the page " "Tick the box next to a post and click \"Delete\" at the bottom of the page "
"with a blank password." "with a blank password."
msgstr "" msgstr ""
#: inc/html.php:841 #: inc/html.php:880
#, php-format #, php-format
msgid " A ban record already exists for %s" msgid " A ban record already exists for %s"
msgstr "" msgstr ""
#: inc/html.php:844 #: inc/html.php:883
msgid "Only an administrator may ban an IP address." msgid "Only an administrator may ban an IP address."
msgstr "" msgstr ""
#: inc/html.php:846 #: inc/html.php:885
#, php-format #, php-format
msgid "IP address: %s" msgid "IP address: %s"
msgstr "" msgstr ""
#: inc/html.php:849 #: inc/html.php:888
msgid "This will delete the entire thread below." msgid "This will delete the entire thread below."
msgstr "" msgstr ""
#: inc/html.php:849 #: inc/html.php:888
msgid "This will delete the post below." msgid "This will delete the post below."
msgstr "" msgstr ""
#: inc/html.php:850 #: inc/html.php:889
msgid "Thread" msgid "Thread"
msgstr "" msgstr ""
#: inc/html.php:850 #: inc/html.php:889
msgid "Post" msgid "Post"
msgstr "" msgstr ""
#: inc/html.php:856 #: inc/html.php:895
msgid "Un-sticky" msgid "Un-sticky"
msgstr "" msgstr ""
#: inc/html.php:856 #: inc/html.php:895
msgid "Sticky" msgid "Sticky"
msgstr "" msgstr ""
#: inc/html.php:857 #: inc/html.php:896
msgid "Return this thread to a normal state." msgid "Return this thread to a normal state."
msgstr "" msgstr ""
#: inc/html.php:857 #: inc/html.php:896
msgid "Keep this thread at the top of the board." msgid "Keep this thread at the top of the board."
msgstr "" msgstr ""
#: inc/html.php:871 #: inc/html.php:910
msgid "Unlock" msgid "Unlock"
msgstr "" msgstr ""
#: inc/html.php:871 #: inc/html.php:910
msgid "Lock" msgid "Lock"
msgstr "" msgstr ""
#: inc/html.php:872 #: inc/html.php:911
msgid "Allow replying to this thread." msgid "Allow replying to this thread."
msgstr "" msgstr ""
#: inc/html.php:872 #: inc/html.php:911
msgid "Disallow replying to this thread." msgid "Disallow replying to this thread."
msgstr "" msgstr ""
#: inc/html.php:893 #: inc/html.php:932
#, php-format #, php-format
msgid "Moderating No.%d" msgid "Moderating No.%d"
msgstr "" msgstr ""
#: inc/html.php:894 #: inc/html.php:933 inc/html.php:1055
msgid "Action" msgid "Action"
msgstr "" msgstr ""
#: inc/html.php:896 #: inc/html.php:935
msgid "Delete thread" msgid "Delete thread"
msgstr "" msgstr ""
#: inc/html.php:898 #: inc/html.php:937
msgid "Delete post" msgid "Delete post"
msgstr "" msgstr ""
#: inc/html.php:900 #: inc/html.php:939
msgid "Ban poster" msgid "Ban poster"
msgstr "" msgstr ""
#: inc/html.php:951 #: inc/html.php:944
msgid "Clear reports"
msgstr ""
#: inc/html.php:945 inc/html.php:1102
msgid "report"
msgstr ""
#: inc/html.php:945 inc/html.php:1102
msgid "reports"
msgstr ""
#: inc/html.php:1013
msgid "Sorry, there doesn't appear to be a keyword with that ID."
msgstr ""
#: inc/html.php:1019 inc/html.php:1055
msgid "Keyword"
msgstr ""
#: inc/html.php:1021
msgid "Action:"
msgstr ""
#: inc/html.php:1022
msgid "Add"
msgstr ""
#: inc/html.php:1036 inc/html.php:1069
msgid "Delete and ban for 1 hour"
msgstr ""
#: inc/html.php:1037 inc/html.php:1072
msgid "Delete and ban for 1 day"
msgstr ""
#: inc/html.php:1038 inc/html.php:1075
msgid "Delete and ban for 2 days"
msgstr ""
#: inc/html.php:1039 inc/html.php:1078
msgid "Delete and ban for 1 week"
msgstr ""
#: inc/html.php:1040 inc/html.php:1081
msgid "Delete and ban for 2 weeks"
msgstr ""
#: inc/html.php:1041 inc/html.php:1084
msgid "Delete and ban for 1 month"
msgstr ""
#: inc/html.php:1042 inc/html.php:1066
msgid "Delete and ban permanently"
msgstr ""
#: inc/html.php:1087
msgid "Edit"
msgstr ""
#: inc/html.php:1100
msgid "thread" msgid "thread"
msgstr "" msgstr ""
#: inc/html.php:951 #: inc/html.php:1100
msgid "threads" msgid "threads"
msgstr "" msgstr ""
#: inc/html.php:951 #: inc/html.php:1104
msgid "ban" msgid "ban"
msgstr "" msgstr ""
#: inc/html.php:951 #: inc/html.php:1104
msgid "bans" msgid "bans"
msgstr "" msgstr ""
#: inc/html.php:975 #: inc/html.php:1128
msgid "Approve" msgid "Approve"
msgstr "" msgstr ""
#: inc/html.php:977 #: inc/html.php:1130
msgid "More Info" msgid "More Info"
msgstr "" msgstr ""
#: inc/html.php:985 #: inc/html.php:1138
msgid "Pending posts" msgid "Pending posts"
msgstr "" msgstr ""
#: inc/html.php:1003 #: inc/html.php:1159
msgid "Reported posts"
msgstr ""
#: inc/html.php:1162
msgid "Recent posts"
msgstr ""
#: inc/html.php:1169
msgid "Moderate" msgid "Moderate"
msgstr "" msgstr ""
#: inc/html.php:1007 #: inc/html.php:1173
msgid "Info" msgid "Info"
msgstr "" msgstr ""
#: inc/html.php:1008
msgid "Recent posts"
msgstr ""

View File

@ -101,10 +101,11 @@ define('TINYIB_RECAPTCHA_SECRET', '');// Secret key
// Database // Database
// Recommended database modes from best to worst: // Recommended database modes from best to worst:
// pdo, mysqli, mysql, sqlite3, sqlite (deprecated), flatfile (only useful if you need portability or lack any kind of database) // pdo, mysqli, mysql, sqlite3, sqlite (deprecated), flatfile (only useful if you need portability or lack any kind of database)
define('TINYIB_DBMODE', 'flatfile'); // Mode define('TINYIB_DBMODE', 'flatfile'); // Mode
define('TINYIB_DBMIGRATE', false); // Enable database migration tool (see README for instructions) define('TINYIB_DBMIGRATE', false); // Enable database migration tool (see README for instructions)
define('TINYIB_DBBANS', 'bans'); // Bans table name (use the same bans table across boards for global bans) define('TINYIB_DBBANS', 'bans'); // Bans table name (use the same table across boards for global bans)
define('TINYIB_DBPOSTS', TINYIB_BOARD . '_posts'); // Posts table name define('TINYIB_DBKEYWORDS', 'keywords'); // Keywords table name (use the same table across boards for global keywords)
define('TINYIB_DBPOSTS', TINYIB_BOARD . '_posts'); // Posts table name
define('TINYIB_DBREPORTS', TINYIB_BOARD . '_reports'); // Reports table name define('TINYIB_DBREPORTS', TINYIB_BOARD . '_reports'); // Reports table name
// Database configuration - MySQL / pgSQL // Database configuration - MySQL / pgSQL