Browse Source

Add moderation log

shortcut
Trevor Slocum 1 year ago
parent
commit
496447e965
  1. 52
      imgboard.php
  2. 8
      inc/database/flatfile.php
  3. 194
      inc/database/mysql.php
  4. 220
      inc/database/mysqli.php
  5. 162
      inc/database/pdo.php
  6. 166
      inc/database/sqlite.php
  7. 98
      inc/database/sqlite3.php
  8. 14
      inc/functions.php
  9. 68
      inc/html.php

52
imgboard.php

@ -529,6 +529,10 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
echo __('Updating index...') . '<br>';
rebuildIndexes();
}
if ($rawpost) {
manageLogAction(__('Created raw post') . ' ' . postLink('&gt;&gt;' . $post['id']));
}
// Check if the request is to auto-refresh a thread
} elseif (isset($_GET['posts']) && !isset($_GET['manage'])) {
if (TINYIB_AUTOREFRESH <= 0) {
@ -635,6 +639,8 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
}
rebuildIndexes();
$text .= manageInfo(__('Rebuilt board.'));
} else if (isset($_GET['modlog'])) {
$text .= manageModerationLog($_GET['modlog']);
} else if (isset($_GET['reports'])) {
if (!TINYIB_REPORT) {
fancyDie(__('Reporting is disabled.'));
@ -668,6 +674,8 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
fancyDie(__('A password is required.'));
}
$prev = $a;
$a['username'] = $_POST['username'];
if ($_POST['password'] != '') {
$a['password'] = $_POST['password'];
@ -679,9 +687,34 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
if ($id == 0) {
insertAccount($a);
manageLogAction(sprintf(__('Added account %s'), $a['username']));
$text .= manageInfo(__('Added account'));
} else {
updateAccount($a);
if ($a['username'] != $prev['username']) {
manageLogAction(sprintf(__('Renamed account %1$s as %2$s'), $prev['username'], $a['username']));
}
if ($a['password'] != $prev['password']) {
manageLogAction(sprintf(__('Changed password of account %s'), $a['username']));
}
if ($a['role'] != $prev['role']) {
$r = '';
switch ($a['role']) {
case TINYIB_SUPER_ADMINISTRATOR:
$r = __('Super-administrator');
break;
case TINYIB_ADMINISTRATOR:
$r = __('Administrator');
break;
case TINYIB_MODERATOR:
$r = __('Moderator');
break;
case TINYIB_DISABLED:
$r = __('Disabled');
break;
}
manageLogAction(sprintf(__('Changed role of account %s to %s'), $a['username'], $r));
}
$text .= manageInfo(__('Updated account'));
}
}
@ -710,13 +743,24 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
$ban['expire'] = ($_POST['expire'] > 0) ? (time() + $_POST['expire']) : 0;
$ban['reason'] = $_POST['reason'];
$until = __('permanently');
if ($ban['expire'] > 0) {
$until = sprintf(__('until %s'), strftime(TINYIB_DATEFMT, $ban['expire']));
}
$action = sprintf(__('Banned %s %s'), htmlentities($ban['ip']), $until);
if ($ban['reason'] != '') {
$action = sprintf(__('Banned %s %s: %s'), htmlentities($ban['ip']), $until, htmlentities($ban['reason']));
}
insertBan($ban);
manageLogAction($action);
$text .= manageInfo(sprintf(__('Ban record added for %s'), $ban['ip']));
}
} elseif (isset($_GET['lift'])) {
$ban = banByID($_GET['lift']);
if ($ban) {
deleteBanByID($_GET['lift']);
manageLogAction(sprintf(__('Lifted ban on %s'), htmlentities($ban['ip'])));
$text .= manageInfo(sprintf(__('Ban record lifted for %s'), $ban['ip']));
}
}
@ -741,9 +785,11 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
insertKeyword($keyword);
if ($_GET['keywords'] > 0) {
manageLogAction(sprintf(__('Updated keyword %s'), htmlentities($keyword['text'])));
$text .= manageInfo(__('Keyword updated.'));
$_GET['keywords'] = 0;
} else {
manageLogAction(sprintf(__('Updated keyword %s'), htmlentities($keyword['text'])));
$text .= manageInfo(__('Keyword added.'));
}
} elseif (isset($_GET['deletekeyword'])) {
@ -848,6 +894,8 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
} else {
threadUpdated($post['parent']);
}
manageLogAction(__('Deleted') . ' >>' . $post['id']);
$text .= manageInfo(sprintf(__('Post No.%d deleted.'), $post['id']));
} else {
fancyDie(__("Sorry, there doesn't appear to be a post with that ID."));
@ -864,6 +912,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
}
threadUpdated($thread_id);
manageLogAction(__('Approved') . ' ' . postLink('&gt;&gt;' . $post['id']));
$text .= manageInfo(sprintf(__('Post No.%d approved.'), $post['id']));
} else {
fancyDie(__("Sorry, there doesn't appear to be a post with that ID."));
@ -888,6 +937,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
stickyThreadByID($post['id'], intval($_GET['setsticky']));
threadUpdated($post['id']);
manageLogAction(intval($_GET['setsticky']) == 1 ? __('Stickied') : __('Unstickied') . ' ' . postLink('&gt;&gt;' . $post['id']));
$text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setsticky']) == 1 ? 'stickied' : 'un-stickied') . '.');
} else {
fancyDie(__("Sorry, there doesn't appear to be a post with that ID."));
@ -902,6 +952,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
lockThreadByID($post['id'], intval($_GET['setlock']));
threadUpdated($post['id']);
manageLogAction(intval($_GET['setlock']) == 1 ? __('Locked') : __('Unlocked') . ' ' . postLink('&gt;&gt;' . $post['id']));
$text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setlock']) == 1 ? 'locked' : 'unlocked') . '.');
} else {
fancyDie(__("Sorry, there doesn't appear to be a post with that ID."));
@ -915,6 +966,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
if ($post) {
deleteReportsByPost($post['id']);
manageLogAction(sprintf(__('Cleared reports for post %s'), postLink('&gt;&gt;' . $post['id'])));
$text .= manageInfo(__('Reports cleared.'));
} else {
fancyDie(__("Sorry, there doesn't appear to be a post with that ID."));

8
inc/database/flatfile.php

@ -179,8 +179,8 @@ function deleteKeyword($id) {
}
// Log functions
function allLogs() {
$rows = $GLOBALS['db']->selectWhere(LOGS_FILE, NULL, -1, new OrderBy(LOG_ID, DESCENDING, INTEGER_COMPARISON));
function getLogs($offset, $limit) {
$rows = $GLOBALS['db']->selectWhere(LOGS_FILE, NULL, array(intval($offset), intval($offset)+intval($limit)), new OrderBy(LOG_TIMESTAMP, DESCENDING, INTEGER_COMPARISON));
return convertLogsToSQLStyle($rows);
}
@ -211,10 +211,6 @@ function insertLog($l) {
$GLOBALS['db']->insertWithAutoId(LOGS_FILE, LOG_ID, $log);
}
function deleteLog($id) {
$GLOBALS['db']->deleteWhere(LOGS_FILE, new SimpleWhereClause(LOG_ID, '=', $id, INTEGER_COMPARISON));
}
// Post functions
function uniquePosts() {
return 0; // Unsupported by this database option

194
inc/database/mysql.php

@ -44,6 +44,111 @@ function deleteAccountByID($id) {
mysql_query("DELETE FROM `" . TINYIB_DBACCOUNTS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "'");
}
// Ban functions
function banByID($id) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
return $ban;
}
}
}
function banByIP($ip) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `ip` = '" . mysql_real_escape_string($ip) . "' OR `ip` = '" . mysql_real_escape_string(hashData($ip)) . "' LIMIT 1");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
return $ban;
}
}
}
function allBans() {
$bans = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` ORDER BY `timestamp` DESC");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
$bans[] = $ban;
}
}
return $bans;
}
function insertBan($ban) {
mysql_query("INSERT INTO `" . TINYIB_DBBANS . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysql_real_escape_string(hashData($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 `" . TINYIB_DBBANS . "` WHERE `expire` > 0 AND `expire` <= " . time());
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
}
}
}
function deleteBanByID($id) {
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . mysql_real_escape_string($id) . " LIMIT 1");
}
// 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));
}
// Log functions
function getLogs($offset, $limit) {
$logs = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBLOGS . "` ORDER BY `timestamp` DESC LIMIT " . intval($offset) . ", " . intval($limit));
if ($result) {
while ($log = mysql_fetch_assoc($result)) {
$logs[] = $log;
}
}
return $logs;
}
function insertLog($log) {
mysql_query("INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysql_real_escape_string($log['timestamp']) . "', '" . mysql_real_escape_string($log['account']) . "', '" . mysql_real_escape_string($log['message']) . "')");
}
// Post functions
function uniquePosts() {
$row = mysql_fetch_row(mysql_query("SELECT COUNT(DISTINCT(`ip`)) FROM " . TINYIB_DBPOSTS));
@ -171,54 +276,6 @@ function lastPostByIP() {
}
}
// Ban functions
function banByID($id) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
return $ban;
}
}
}
function banByIP($ip) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `ip` = '" . mysql_real_escape_string($ip) . "' OR `ip` = '" . mysql_real_escape_string(hashData($ip)) . "' LIMIT 1");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
return $ban;
}
}
}
function allBans() {
$bans = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBBANS . "` ORDER BY `timestamp` DESC");
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
$bans[] = $ban;
}
}
return $bans;
}
function insertBan($ban) {
mysql_query("INSERT INTO `" . TINYIB_DBBANS . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysql_real_escape_string(hashData($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 `" . TINYIB_DBBANS . "` WHERE `expire` > 0 AND `expire` <= " . time());
if ($result) {
while ($ban = mysql_fetch_assoc($result)) {
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
}
}
}
function deleteBanByID($id) {
mysql_query("DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . mysql_real_escape_string($id) . " LIMIT 1");
}
// Report functions
function reportByIP($post, $ip) {
$result = mysql_query("SELECT * FROM `" . TINYIB_DBREPORTS . "` WHERE `post` = '" . mysql_real_escape_string($post) . "' AND (`ip` = '" . mysql_real_escape_string($ip) . "' OR `ip` = '" . mysql_real_escape_string(hashData($ip)) . "') LIMIT 1");
@ -262,44 +319,3 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($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));
}

220
inc/database/mysqli.php

@ -52,6 +52,125 @@ function deleteAccountByID($id) {
mysqli_query($link, "DELETE FROM `" . TINYIB_DBACCOUNTS . "` WHERE `id` = " . mysqli_real_escape_string($link, $id) . " LIMIT 1");
}
// Ban functions
function banByID($id) {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `id` = '" . mysqli_real_escape_string($link, $id) . "' LIMIT 1");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
return $ban;
}
}
}
function banByIP($ip) {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $ip) . "' OR `ip` = '" . mysqli_real_escape_string($link, hashData($ip)) . "' LIMIT 1");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
return $ban;
}
}
}
function allBans() {
global $link;
$bans = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` ORDER BY `timestamp` DESC");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
$bans[] = $ban;
}
}
return $bans;
}
function insertBan($ban) {
global $link;
mysqli_query($link, "INSERT INTO `" . TINYIB_DBBANS . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysqli_real_escape_string($link, hashData($ban['ip'])) . "', '" . time() . "', '" . mysqli_real_escape_string($link, $ban['expire']) . "', '" . mysqli_real_escape_string($link, $ban['reason']) . "')");
return mysqli_insert_id($link);
}
function clearExpiredBans() {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `expire` > 0 AND `expire` <= " . time());
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
mysqli_query($link, "DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
}
}
}
function deleteBanByID($id) {
global $link;
mysqli_query($link, "DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . mysqli_real_escape_string($link, $id) . " LIMIT 1");
}
// 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) . "'");
}
// Log functions
function getLogs($offset, $limit) {
global $link;
$logs = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBLOGS . "` ORDER BY `timestamp` DESC LIMIT " . intval($offset) . ", " . intval($limit));
if ($result) {
while ($log = mysqli_fetch_assoc($result)) {
$logs[] = $log;
}
}
return $logs;
}
function insertLog($log) {
global $link;
mysqli_query($link, "INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysqli_real_escape_string($link, $log['timestamp']) . "', '" . mysqli_real_escape_string($link, $log['account']) . "', '" . mysqli_real_escape_string($link, $log['message']) . "')");
}
// Post functions
function uniquePosts() {
global $link;
@ -196,60 +315,6 @@ function lastPostByIP() {
}
}
// Ban functions
function banByID($id) {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `id` = '" . mysqli_real_escape_string($link, $id) . "' LIMIT 1");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
return $ban;
}
}
}
function banByIP($ip) {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $ip) . "' OR `ip` = '" . mysqli_real_escape_string($link, hashData($ip)) . "' LIMIT 1");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
return $ban;
}
}
}
function allBans() {
global $link;
$bans = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` ORDER BY `timestamp` DESC");
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
$bans[] = $ban;
}
}
return $bans;
}
function insertBan($ban) {
global $link;
mysqli_query($link, "INSERT INTO `" . TINYIB_DBBANS . "` (`ip`, `timestamp`, `expire`, `reason`) VALUES ('" . mysqli_real_escape_string($link, hashData($ban['ip'])) . "', '" . time() . "', '" . mysqli_real_escape_string($link, $ban['expire']) . "', '" . mysqli_real_escape_string($link, $ban['reason']) . "')");
return mysqli_insert_id($link);
}
function clearExpiredBans() {
global $link;
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBBANS . "` WHERE `expire` > 0 AND `expire` <= " . time());
if ($result) {
while ($ban = mysqli_fetch_assoc($result)) {
mysqli_query($link, "DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . $ban['id'] . " LIMIT 1");
}
}
}
function deleteBanByID($id) {
global $link;
mysqli_query($link, "DELETE FROM `" . TINYIB_DBBANS . "` WHERE `id` = " . mysqli_real_escape_string($link, $id) . " LIMIT 1");
}
// Report functions
function reportByIP($post, $ip) {
global $link;
@ -300,53 +365,6 @@ 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)) . "'");
}
// 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
function mysqli_result($res, $row, $field = 0) {
$res->data_seek($row);

162
inc/database/pdo.php

@ -40,6 +40,95 @@ function deleteAccountByID($id) {
pdoQuery("DELETE FROM " . TINYIB_DBACCOUNTS . " WHERE id = ?", array($id));
}
// Ban functions
function banByID($id) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " WHERE id = ?", array($id));
return $result->fetch(PDO::FETCH_ASSOC);
}
function banByIP($ip) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " WHERE ip = ? OR ip = ? LIMIT 1", array($ip, hashData($ip)));
return $result->fetch(PDO::FETCH_ASSOC);
}
function allBans() {
$bans = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " ORDER BY timestamp DESC");
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$bans[] = $row;
}
return $bans;
}
function insertBan($ban) {
global $dbh;
$now = time();
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBBANS . " (ip, timestamp, expire, reason) VALUES (?, ?, ?, ?)");
$stm->execute(array(hashData($ban['ip']), $now, $ban['expire'], $ban['reason']));
return $dbh->lastInsertId();
}
function clearExpiredBans() {
$now = time();
pdoQuery("DELETE FROM " . TINYIB_DBBANS . " WHERE expire > 0 AND expire <= ?", array($now));
}
function deleteBanByID($id) {
pdoQuery("DELETE FROM " . TINYIB_DBBANS . " WHERE id = ?", array($id));
}
// 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));
}
// Log functions
function getLogs($offset, $limit) {
$logs = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp DESC LIMIT " . intval($offset) . ", " . intval($limit));
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$logs[] = $row;
}
return $logs;
}
function insertLog($log) {
global $dbh;
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES (?, ?, ?)");
$stm->execute(array($log['timestamp'], $log['account'], $log['message']));
}
// Post functions
function uniquePosts() {
$result = pdoQuery("SELECT COUNT(DISTINCT(ip)) FROM " . TINYIB_DBPOSTS);
@ -169,43 +258,6 @@ function lastPostByIP() {
return $result->fetch(PDO::FETCH_ASSOC);
}
// Ban functions
function banByID($id) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " WHERE id = ?", array($id));
return $result->fetch(PDO::FETCH_ASSOC);
}
function banByIP($ip) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " WHERE ip = ? OR ip = ? LIMIT 1", array($ip, hashData($ip)));
return $result->fetch(PDO::FETCH_ASSOC);
}
function allBans() {
$bans = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBBANS . " ORDER BY timestamp DESC");
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$bans[] = $row;
}
return $bans;
}
function insertBan($ban) {
global $dbh;
$now = time();
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBBANS . " (ip, timestamp, expire, reason) VALUES (?, ?, ?, ?)");
$stm->execute(array(hashData($ban['ip']), $now, $ban['expire'], $ban['reason']));
return $dbh->lastInsertId();
}
function clearExpiredBans() {
$now = time();
pdoQuery("DELETE FROM " . TINYIB_DBBANS . " WHERE expire > 0 AND expire <= ?", array($now));
}
function deleteBanByID($id) {
pdoQuery("DELETE FROM " . TINYIB_DBBANS . " WHERE id = ?", array($id));
}
// Report functions
function reportByIP($post, $ip) {
$result = pdoQuery("SELECT * FROM " . TINYIB_DBREPORTS . " WHERE post = ? AND (ip = ? OR ip = ?) LIMIT 1", array($post, $ip, hashData($ip)));
@ -243,39 +295,3 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($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));
}

166
inc/database/sqlite.php

@ -40,6 +40,96 @@ function deleteAccountByID($id) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBACCOUNTS . " WHERE id = " . sqlite_escape_string($id));
}
// Ban functions
function banByID($id) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE id = '" . sqlite_escape_string($id) . "' LIMIT 1"), SQLITE_ASSOC);
foreach ($result as $ban) {
return $ban;
}
}
function banByIP($ip) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE ip = '" . sqlite_escape_string($ip) . "' OR ip = '" . sqlite_escape_string(hashData($ip)) . "' LIMIT 1"), SQLITE_ASSOC);
foreach ($result as $ban) {
return $ban;
}
}
function allBans() {
$bans = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " ORDER BY timestamp DESC"), SQLITE_ASSOC);
foreach ($result as $ban) {
$bans[] = $ban;
}
return $bans;
}
function insertBan($ban) {
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBBANS . " (ip, timestamp, expire, reason) VALUES ('" . sqlite_escape_string(hashData($ban['ip'])) . "', " . time() . ", '" . sqlite_escape_string($ban['expire']) . "', '" . sqlite_escape_string($ban['reason']) . "')");
return sqlite_last_insert_rowid($GLOBALS["db"]);
}
function clearExpiredBans() {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE expire > 0 AND expire <= " . time()), SQLITE_ASSOC);
foreach ($result as $ban) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBBANS . " WHERE id = " . $ban['id']);
}
}
function deleteBanByID($id) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBBANS . " WHERE id = " . sqlite_escape_string($id));
}
// 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));
}
// Log functions
function getLogs($offset, $limit) {
$logs = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp DESC LIMIT " . intval($offset) . ", " . intval($limit)), SQLITE_ASSOC);
foreach ($result as $log) {
$logs[] = $log;
}
return $logs;
}
function insertLog($log) {
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . sqlite_escape_string($log['timestamp']) . "', '" . sqlite_escape_string($log['account']) . "', '" . sqlite_escape_string($log['message']) . "')");
}
// Post functions
function uniquePosts() {
return sqlite_fetch_single(sqlite_query($GLOBALS["db"], "SELECT COUNT(ip) FROM (SELECT DISTINCT ip FROM " . TINYIB_DBPOSTS . ")"));
@ -152,46 +242,6 @@ function lastPostByIP() {
}
}
// Ban functions
function banByID($id) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE id = '" . sqlite_escape_string($id) . "' LIMIT 1"), SQLITE_ASSOC);
foreach ($result as $ban) {
return $ban;
}
}
function banByIP($ip) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE ip = '" . sqlite_escape_string($ip) . "' OR ip = '" . sqlite_escape_string(hashData($ip)) . "' LIMIT 1"), SQLITE_ASSOC);
foreach ($result as $ban) {
return $ban;
}
}
function allBans() {
$bans = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " ORDER BY timestamp DESC"), SQLITE_ASSOC);
foreach ($result as $ban) {
$bans[] = $ban;
}
return $bans;
}
function insertBan($ban) {
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBBANS . " (ip, timestamp, expire, reason) VALUES ('" . sqlite_escape_string(hashData($ban['ip'])) . "', " . time() . ", '" . sqlite_escape_string($ban['expire']) . "', '" . sqlite_escape_string($ban['reason']) . "')");
return sqlite_last_insert_rowid($GLOBALS["db"]);
}
function clearExpiredBans() {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBBANS . " WHERE expire > 0 AND expire <= " . time()), SQLITE_ASSOC);
foreach ($result as $ban) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBBANS . " WHERE id = " . $ban['id']);
}
}
function deleteBanByID($id) {
sqlite_query($GLOBALS["db"], "DELETE FROM " . TINYIB_DBBANS . " WHERE id = " . sqlite_escape_string($id));
}
// Report functions
function reportByIP($post, $ip) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBREPORTS . " WHERE post = '" . sqlite_escape_string($post) . "' AND (ip = '" . sqlite_escape_string($ip) . "' OR ip = '" . sqlite_escape_string(hashData($ip)) . "') LIMIT 1"), SQLITE_ASSOC);
@ -229,39 +279,3 @@ function deleteReportsByPost($post) {
function deleteReportsByIP($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));
}

98
inc/database/sqlite3.php

@ -93,6 +93,63 @@ function deleteBanByID($id) {
$db->exec("DELETE FROM " . TINYIB_DBBANS . " WHERE id = " . $db->escapeString($id));
}
// 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));
}
// Log functions
function getLogs($offset, $limit) {
global $db;
$logs = array();
$result = $db->query("SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp DESC LIMIT " . intval($offset) . ", " . intval($limit));
while ($log = $result->fetchArray()) {
$logs[] = $log;
}
return $logs;
}
function insertLog($log) {
global $db;
$db->exec("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . $db->escapeString($log['timestamp']) . "', '" . $db->escapeString($log['account']) . "', '" . $db->escapeString($log['message']) . "')");
}
// Post functions
function uniquePosts() {
global $db;
@ -265,44 +322,3 @@ function deleteReportsByIP($ip) {
global $db;
$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));
}

14
inc/functions.php

@ -385,6 +385,20 @@ function manageCheckLogIn($requireKey) {
return array($account, $loggedin, $isadmin);
}
function manageLogAction($action) {
global $account;
$account_id = 0;
if (isset($account['id'])) {
$account_id = $account['id'];
}
$log = array(
'timestamp' => time(),
'account' => $account_id,
'message' => $action,
);
insertLog($log);
}
function setParent() {
if (isset($_POST["parent"])) {
if ($_POST["parent"] != TINYIB_NEWTHREAD) {

68
inc/html.php

@ -770,18 +770,20 @@ function adminBar() {
$output = '[<a href="?manage">' . __('Status') . '</a>] [';
if ($isadmin) {
if (TINYIB_REPORT) {
$output .= '<a href="?manage&reports">' . __('Reports') . '</a>] [';
}
if ($account['role'] == TINYIB_SUPER_ADMINISTRATOR) {
$output .= '<a href="?manage&accounts">' . __('Accounts') . '</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>] [';
if ($isadmin) {
$output .= '<a href="?manage&modlog">' . __('Moderation Log') . '</a>] [';
}
$output .= '<a href="?manage&rawpost">' . __('Raw Post') . '</a>] [';
if ($isadmin) {
$output .= '<a href="?manage&rebuildall">' . __('Rebuild All') . '</a>] [';
$output .= '<a href="?manage&reports">' . __('Reports') . '</a>] [';
}
if ($isadmin && installedViaGit()) {
$output .= '<a href="?manage&update">' . __('Update') . '</a>] [';
@ -882,6 +884,60 @@ function manageLogInForm() {
EOF;
}
function manageModerationLog($offset) {
$offset = intval($offset);
$limit = 50;
$logs = getLogs($offset, $limit);
$u = array();
$text = '';
foreach ($logs as $log) {
if (!isset($u[$log['account']])) {
$username = '';
if ($log['account'] > 0) {
$a = accountByID($log['account']);
if (!empty($a)) {
$username = $a['username'];
}
}
$u[$log['account']] = $username;
}
$text .= '<tr><td>' . strftime(TINYIB_DATEFMT, $log['timestamp']) . '</td><td>' . htmlentities($u[$log['account']]) . '</td><td>' . $log['message'] . '</td></tr>';
}
if ($text == '') {
$text = '<i>' . __('No logs.') . '</i>';
}
$txt_moderation_log = __('Moderation log');
$nav = '';
if ($offset > 0) {
$nav .= '<a href="?manage&modlog=' . $offset . '=' . ($offset - 50) . '">Previous 50</a> ';
}
if (count($logs) == $limit) {
$nav .= '<a href="?manage&modlog=' . $offset . '=' . ($offset + $limit) . '">Next 50</a> ';
}
$nav_top = '';
$nav_bottom = '';
if ($nav != '') {
$nav_top = $nav . '<br><br>';
$nav_bottom = '<br><br>' . $nav;
}
return <<<EOF
$nav_top
<fieldset>
<legend>$txt_moderation_log</legend>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><th align="left">Date/time</th><th align="left">Account</th><th align="left">Action</th></tr>
$text
</table>
</fieldset>
$nav_bottom
EOF;
}
function manageReportsPage($ip) {
$reports = allReports();
$report_counts = array();
@ -965,7 +1021,7 @@ function manageChangePasswordForm() {
EOF;
}
function manageAccountForm($id=0) {
function manageAccountForm($id = 0) {
$a = array(
'id' => 0,
'username' => '',
@ -974,7 +1030,7 @@ function manageAccountForm($id=0) {
);
$txt_header = __('Add an account');
$txt_password_hint = '';
if ($id > 0){
if ($id > 0) {
$txt_header = __('Update an account');
$txt_password_hint = '(' . __('Leave blank to maintain current password') . ')';
$a = accountByID($id);

Loading…
Cancel
Save