mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Some improvements for Ban functionality (#1262)
* Some improvements for Ban functionality * Updated * Updated * Update functions.php * Updated * Update viewprofile.php * Update viewtopic.php * Updated * Updated * Updated * Updated * Update mysql.sql * Updated * Updated
This commit is contained in:
parent
d090678e14
commit
7beb4afa72
18 changed files with 83 additions and 272 deletions
|
@ -16,8 +16,6 @@ require __DIR__ . '/pagestart.php';
|
|||
|
||||
if (isset($_POST['submit'])) {
|
||||
$user_bansql = '';
|
||||
$email_bansql = '';
|
||||
$ip_bansql = '';
|
||||
|
||||
$user_list = [];
|
||||
if (!empty($_POST['username'])) {
|
||||
|
@ -29,28 +27,6 @@ if (isset($_POST['submit'])) {
|
|||
$user_list[] = $this_userdata['user_id'];
|
||||
}
|
||||
|
||||
$ip_list = [];
|
||||
if (isset($_POST['ban_ip'])) {
|
||||
$ip_list_temp = explode(',', $_POST['ban_ip']);
|
||||
|
||||
foreach ($ip_list_temp as $ip) {
|
||||
if (\TorrentPier\Helpers\IPHelper::isValid($ip)) {
|
||||
$ip_list[] = \TorrentPier\Helpers\IPHelper::ip2long($ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$email_list = [];
|
||||
if (isset($_POST['ban_email'])) {
|
||||
$email_list_temp = explode(',', $_POST['ban_email']);
|
||||
|
||||
foreach ($email_list_temp as $i => $iValue) {
|
||||
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i]))) {
|
||||
$email_list[] = trim($email_list_temp[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_BANLIST;
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain banlist information');
|
||||
|
@ -60,6 +36,7 @@ if (isset($_POST['submit'])) {
|
|||
DB()->sql_freeresult($result);
|
||||
|
||||
$kill_session_sql = '';
|
||||
|
||||
for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
|
||||
$in_banlist = false;
|
||||
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||
|
@ -78,30 +55,6 @@ if (isset($_POST['submit'])) {
|
|||
}
|
||||
}
|
||||
|
||||
for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
|
||||
$in_banlist = false;
|
||||
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||
if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) {
|
||||
$in_banlist = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$in_banlist) {
|
||||
if (preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.'))) {
|
||||
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, '.'))) . "'";
|
||||
} else {
|
||||
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
|
||||
}
|
||||
|
||||
$kill_session_sql .= (($kill_session_sql != '') ? ' OR ' : '') . $kill_ip_sql;
|
||||
|
||||
$sql = 'INSERT INTO ' . BB_BANLIST . " (ban_ip) VALUES ('" . $ip_list[$i] . "')";
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not insert ban_ip info into database');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now we'll delete all entries from the session table
|
||||
if ($kill_session_sql != '') {
|
||||
$sql = 'DELETE FROM ' . BB_SESSIONS . " WHERE $kill_session_sql";
|
||||
|
@ -110,22 +63,6 @@ if (isset($_POST['submit'])) {
|
|||
}
|
||||
}
|
||||
|
||||
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
|
||||
$in_banlist = false;
|
||||
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||
if ($email_list[$i] == $current_banlist[$j]['ban_email']) {
|
||||
$in_banlist = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$in_banlist) {
|
||||
$sql = 'INSERT INTO ' . BB_BANLIST . " (ban_email) VALUES ('" . DB()->escape($email_list[$i]) . "')";
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not insert ban_email info into database');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$where_sql = '';
|
||||
|
||||
if (isset($_POST['unban_user'])) {
|
||||
|
@ -138,26 +75,6 @@ if (isset($_POST['submit'])) {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['unban_ip'])) {
|
||||
$ip_list = $_POST['unban_ip'];
|
||||
|
||||
for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
|
||||
if ($ip_list[$i] != -1) {
|
||||
$where_sql .= (($where_sql != '') ? ', ' : '') . DB()->escape($ip_list[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['unban_email'])) {
|
||||
$email_list = $_POST['unban_email'];
|
||||
|
||||
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
|
||||
if ($email_list[$i] != -1) {
|
||||
$where_sql .= (($where_sql != '') ? ', ' : '') . DB()->escape($email_list[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($where_sql != '') {
|
||||
$sql = 'DELETE FROM ' . BB_BANLIST . " WHERE ban_id IN ($where_sql)";
|
||||
if (!DB()->sql_query($sql)) {
|
||||
|
@ -168,10 +85,7 @@ if (isset($_POST['submit'])) {
|
|||
bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
} else {
|
||||
$template->assign_vars(['S_BANLIST_ACTION' => 'admin_user_ban.php']);
|
||||
|
||||
$userban_count = 0;
|
||||
$ipban_count = 0;
|
||||
$emailban_count = 0;
|
||||
|
||||
$sql = 'SELECT b.ban_id, u.user_id, u.username
|
||||
FROM ' . BB_BANLIST . ' b, ' . BB_USERS . ' u
|
||||
|
@ -195,50 +109,11 @@ if (isset($_POST['submit'])) {
|
|||
if ($select_userlist == '') {
|
||||
$select_userlist = '<option value="-1">' . $lang['NO_BANNED_USERS'] . '</option>';
|
||||
}
|
||||
|
||||
$select_userlist = '<select name="unban_user[]" multiple size="5">' . $select_userlist . '</select>';
|
||||
|
||||
$sql = 'SELECT ban_id, ban_ip, ban_email FROM ' . BB_BANLIST . ' ORDER BY ban_ip';
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select current ip ban list');
|
||||
}
|
||||
|
||||
$banlist = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$select_iplist = '';
|
||||
$select_emaillist = '';
|
||||
|
||||
for ($i = 0, $iMax = count($banlist); $i < $iMax; $i++) {
|
||||
$ban_id = $banlist[$i]['ban_id'];
|
||||
|
||||
if (!empty($banlist[$i]['ban_ip'])) {
|
||||
$ban_ip = str_replace('255', '*', \TorrentPier\Helpers\IPHelper::long2ip_extended($banlist[$i]['ban_ip']));
|
||||
$select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
|
||||
$ipban_count++;
|
||||
} elseif (!empty($banlist[$i]['ban_email'])) {
|
||||
$ban_email = $banlist[$i]['ban_email'];
|
||||
$select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
|
||||
$emailban_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($select_iplist == '') {
|
||||
$select_iplist = '<option value="-1">' . $lang['NO_BANNED_IP'] . '</option>';
|
||||
}
|
||||
|
||||
if ($select_emaillist == '') {
|
||||
$select_emaillist = '<option value="-1">' . $lang['NO_BANNED_EMAIL'] . '</option>';
|
||||
}
|
||||
|
||||
$select_iplist = '<select name="unban_ip[]" multiple size="15">' . $select_iplist . '</select>';
|
||||
$select_emaillist = '<select name="unban_email[]" multiple size="10">' . $select_emaillist . '</select>';
|
||||
|
||||
$template->assign_vars([
|
||||
'U_SEARCH_USER' => './../search.php?mode=searchuser',
|
||||
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
|
||||
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
|
||||
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
|
||||
'S_BAN_ACTION' => 'admin_user_ban.php'
|
||||
]);
|
||||
}
|
||||
|
|
20
common.php
20
common.php
|
@ -164,26 +164,6 @@ switch ($bb_cfg['datastore_type']) {
|
|||
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
|
||||
}
|
||||
|
||||
if (CHECK_REQIREMENTS['status'] && !CACHE('bb_cache')->get('system_req')) {
|
||||
// [1] Check PHP Version
|
||||
if (!\TorrentPier\Helpers\IsHelper::isPHP(CHECK_REQIREMENTS['php_min_version'])) {
|
||||
die("TorrentPier requires PHP version " . CHECK_REQIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION);
|
||||
}
|
||||
|
||||
// [2] Check installed PHP Extensions on server
|
||||
$data = [];
|
||||
foreach (CHECK_REQIREMENTS['ext_list'] as $ext) {
|
||||
if (!extension_loaded($ext)) {
|
||||
$data[] = '<code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">' . $ext . '</code>';
|
||||
}
|
||||
}
|
||||
if (!empty($data)) {
|
||||
die(sprintf("TorrentPier requires %s extension(s) installed on server", implode(', ', $data)));
|
||||
}
|
||||
|
||||
CACHE('bb_cache')->set('system_req', true);
|
||||
}
|
||||
|
||||
// Functions
|
||||
function utime()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,14 @@
|
|||
},
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"ext-mysqli": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-json": "*",
|
||||
"ext-bcmath": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"ext-curl": "*",
|
||||
"arokettu/bencode": "^4.1.0",
|
||||
"bugsnag/bugsnag": "^v3.29.1",
|
||||
"claviska/simpleimage": "^4.0",
|
||||
|
|
|
@ -149,10 +149,8 @@ CREATE TABLE IF NOT EXISTS `bb_banlist`
|
|||
(
|
||||
`ban_id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`ban_userid` MEDIUMINT(8) NOT NULL DEFAULT '0',
|
||||
`ban_ip` VARCHAR(42) NOT NULL DEFAULT '0',
|
||||
`ban_email` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`ban_id`),
|
||||
KEY `ban_ip_user_id` (`ban_ip`, `ban_userid`)
|
||||
`ban_reason` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`ban_id`, `ban_userid`)
|
||||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
|
|
@ -14,24 +14,6 @@ if (!defined('BB_ROOT')) {
|
|||
// System
|
||||
define('APP_NAME', 'TorrentPier');
|
||||
|
||||
define('CHECK_REQIREMENTS', [
|
||||
'status' => true,
|
||||
'php_min_version' => '8.1.0',
|
||||
'ext_list' => [
|
||||
'json',
|
||||
// 'gd', (optional)
|
||||
// 'zlib', (optional)
|
||||
'curl',
|
||||
// 'tidy', (optional)
|
||||
'mysqli',
|
||||
'bcmath',
|
||||
'mbstring',
|
||||
'intl',
|
||||
'xml',
|
||||
'xmlwriter',
|
||||
],
|
||||
]);
|
||||
|
||||
// Path (trailing slash '/' at the end: XX_PATH - without, XX_DIR - with)
|
||||
define('ADMIN_DIR', BB_PATH . '/admin');
|
||||
define('DATA_DIR', BB_PATH . '/data');
|
||||
|
|
|
@ -2170,3 +2170,24 @@ function user_birthday_icon($user_birthday, $user_id): string
|
|||
|
||||
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="' . $lang['HAPPY_BIRTHDAY'] . '" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about user ban
|
||||
*
|
||||
* @param int $userId
|
||||
* @return array
|
||||
*/
|
||||
function getUserBanInfo(int $userId): array
|
||||
{
|
||||
return DB()->fetch_row("SELECT * FROM " . BB_BANLIST . " WHERE ban_userid = $userId LIMIT 1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about all bans
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getAllBans(): array
|
||||
{
|
||||
return DB()->fetch_rowset("SELECT * FROM " . BB_BANLIST);
|
||||
}
|
||||
|
|
|
@ -394,6 +394,20 @@ $user = new TorrentPier\Legacy\Common\User();
|
|||
|
||||
$userdata =& $user->data;
|
||||
|
||||
/**
|
||||
* Initial ban check
|
||||
*/
|
||||
if ($banInfo = getUserBanInfo($user->id)) {
|
||||
if (!IS_GUEST) {
|
||||
$user->session_end();
|
||||
}
|
||||
if (!empty($banInfo['ban_reason'])) {
|
||||
bb_die($lang['YOU_BEEN_BANNED'] . '<br><br>' . $banInfo['ban_reason']);
|
||||
} else {
|
||||
bb_die($lang['YOU_BEEN_BANNED']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cron
|
||||
*/
|
||||
|
|
|
@ -74,9 +74,12 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
|
|||
$signature = bbcode2html($signature);
|
||||
}
|
||||
|
||||
$user_banned = false;
|
||||
if (DB()->fetch_row('SELECT ban_userid FROM ' . BB_BANLIST . " WHERE ban_userid = {$profiledata['user_id']} LIMIT 1")) {
|
||||
$user_banned = true;
|
||||
// Ban information
|
||||
if ($banInfo = getUserBanInfo($profiledata['user_id'])) {
|
||||
$template->assign_block_vars('ban', [
|
||||
'IS_BANNED' => true,
|
||||
'BAN_REASON' => $banInfo['ban_reason']
|
||||
]);
|
||||
}
|
||||
|
||||
$template->assign_vars([
|
||||
|
@ -85,7 +88,6 @@ $template->assign_vars([
|
|||
'PROFILE_USER_ID' => $profiledata['user_id'],
|
||||
'PROFILE_USER' => $profile_user_id,
|
||||
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
|
||||
'BANNED' => $user_banned,
|
||||
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">" . $poster_rank . "</span>" : $lang['USER'],
|
||||
'RANK_IMAGE' => $rank_image,
|
||||
'RANK_SELECT' => $rank_select,
|
||||
|
|
|
@ -1740,35 +1740,12 @@ $lang['CLICK_RETURN_FORUMAUTH'] = 'Click %sHere%s to return to Forum Permissions
|
|||
|
||||
// Banning
|
||||
$lang['BAN_CONTROL'] = 'Ban Control';
|
||||
$lang['BAN_EXPLAIN'] = 'Here you can control the banning of users. You can achieve this by banning either or both of a specific user or an individual or range of IP addresses. These methods prevent a user from even reaching the index page of your board. To prevent a user from registering under a different username you can also specify a banned email address. Please note that banning an email address alone will not prevent that user from being able to log on or post to your board. You should use one of the first two methods to achieve this.';
|
||||
$lang['BAN_EXPLAIN_WARN'] = 'Please note that entering a range of IP addresses results in all the addresses between the start and end being added to the banlist. Attempts will be made to minimise the number of addresses added to the database by introducing wildcards automatically where appropriate. If you really must enter a range, try to keep it small or better yet state specific addresses.';
|
||||
|
||||
$lang['SELECT_IP'] = 'Select an IP address';
|
||||
$lang['SELECT_EMAIL'] = 'Select an Email address';
|
||||
|
||||
$lang['BAN_EXPLAIN'] = 'Here you can control the banning of users.';
|
||||
$lang['BAN_USERNAME'] = 'Ban one or more specific users';
|
||||
$lang['BAN_USERNAME_EXPLAIN'] = 'You can ban multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser';
|
||||
|
||||
$lang['BAN_IP'] = 'Ban one or more IP addresses';
|
||||
$lang['IP_HOSTNAME'] = 'IP addresses';
|
||||
$lang['BAN_IP_EXPLAIN'] = 'To specify several different IP addresses separate them with commas.';
|
||||
|
||||
$lang['BAN_EMAIL'] = 'Ban one or more email addresses';
|
||||
$lang['BAN_EMAIL_EXPLAIN'] = 'To specify more than one email address, separate them with commas. To specify a wildcard username, use * like *@hotmail.com';
|
||||
|
||||
$lang['UNBAN_USERNAME'] = 'Un-ban one more specific users';
|
||||
$lang['UNBAN_USERNAME'] = 'Unban one more specific users';
|
||||
$lang['UNBAN_USERNAME_EXPLAIN'] = 'You can unban multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser';
|
||||
|
||||
$lang['UNBAN_IP'] = 'Un-ban one or more IP addresses';
|
||||
$lang['UNBAN_IP_EXPLAIN'] = 'You can unban multiple IP addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser';
|
||||
|
||||
$lang['UNBAN_EMAIL'] = 'Un-ban one or more email addresses';
|
||||
$lang['UNBAN_EMAIL_EXPLAIN'] = 'You can unban multiple email addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser';
|
||||
|
||||
$lang['NO_BANNED_USERS'] = 'No banned usernames';
|
||||
$lang['NO_BANNED_IP'] = 'No banned IP addresses';
|
||||
$lang['NO_BANNED_EMAIL'] = 'No banned email addresses';
|
||||
|
||||
$lang['BAN_UPDATE_SUCESSFUL'] = 'The banlist has been updated successfully';
|
||||
$lang['CLICK_RETURN_BANADMIN'] = 'Click %sHere%s to return to Ban Control';
|
||||
|
||||
|
|
|
@ -15,17 +15,6 @@ namespace TorrentPier\Helpers;
|
|||
*/
|
||||
class IsHelper
|
||||
{
|
||||
/**
|
||||
* Determines if the current version of PHP is equal to or greater than the supplied value
|
||||
*
|
||||
* @param string $version
|
||||
* @return bool TRUE if the current version is $version or higher
|
||||
*/
|
||||
public static function isPHP(string $version): bool
|
||||
{
|
||||
return version_compare(PHP_VERSION, $version, '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if server have SSL
|
||||
*
|
||||
|
|
|
@ -240,16 +240,6 @@ class User
|
|||
$user_id = (int)$this->data['user_id'];
|
||||
$mod_admin_session = ((int)$this->data['user_level'] === ADMIN || (int)$this->data['user_level'] === MOD);
|
||||
|
||||
// Initial ban check against user_id or IP address
|
||||
if ($is_user) {
|
||||
$where_sql = 'ban_ip = ' . USER_IP;
|
||||
$where_sql .= $login ? " OR ban_userid = $user_id" : '';
|
||||
|
||||
if (DB()->fetch_row("SELECT ban_id FROM " . BB_BANLIST . " WHERE $where_sql LIMIT 1")) {
|
||||
bb_simple_die($lang['YOU_BEEN_BANNED']);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate passkey
|
||||
if (!\TorrentPier\Legacy\Torrent::getPasskey($this->data['user_id'])) {
|
||||
if (!\TorrentPier\Legacy\Torrent::generate_passkey($this->data['user_id'], true)) {
|
||||
|
|
|
@ -151,7 +151,7 @@ class Poll
|
|||
*/
|
||||
public static function userIsAlreadyVoted(int $topic_id, int $user_id): bool
|
||||
{
|
||||
return (bool)DB()->fetch_row("SELECT user_id FROM " . BB_POLL_USERS . " WHERE topic_id = $topic_id AND user_id = $user_id LIMIT 1");
|
||||
return (bool)DB()->fetch_row("SELECT 1 FROM " . BB_POLL_USERS . " WHERE topic_id = $topic_id AND user_id = $user_id LIMIT 1");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,10 +32,9 @@ class Validate
|
|||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function username(string $username, bool $check_ban_and_taken = true)
|
||||
public static function username(string $username, bool $check_ban_and_taken = true): bool|string
|
||||
{
|
||||
global $user, $lang;
|
||||
|
||||
static $name_chars = 'a-z0-9а-яё_@$%^&;(){}\#\-\'.:+ ';
|
||||
|
||||
// Check for empty
|
||||
|
@ -43,7 +42,6 @@ class Validate
|
|||
return $lang['CHOOSE_A_NAME'];
|
||||
}
|
||||
|
||||
$username = str_compact($username);
|
||||
$username = clean_username($username);
|
||||
|
||||
// Length
|
||||
|
|
|
@ -20,34 +20,6 @@
|
|||
<td class="row1">{L_USERNAME}: <br /><span class="small">{L_UNBAN_USERNAME_EXPLAIN}</span></td>
|
||||
<td class="row2">{S_UNBAN_USERLIST_SELECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_BAN_IP}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_IP_HOSTNAME}: <br /><span class="small">{L_BAN_IP_EXPLAIN}</span></td>
|
||||
<td class="row2"><input class="post" type="text" name="ban_ip" size="35" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_UNBAN_IP}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_IP_HOSTNAME}: <br /><span class="small">{L_UNBAN_IP_EXPLAIN}</span></td>
|
||||
<td class="row2">{S_UNBAN_IPLIST_SELECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_BAN_EMAIL}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_EMAIL_ADDRESS}: <br /><span class="small">{L_BAN_EMAIL_EXPLAIN}</span></td>
|
||||
<td class="row2"><input class="post" type="text" name="ban_email" size="35" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_UNBAN_EMAIL}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_EMAIL_ADDRESS}: <br /><span class="small">{L_UNBAN_EMAIL_EXPLAIN}</span></td>
|
||||
<td class="row2">{S_UNBAN_EMAILLIST_SELECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="catBottom" colspan="2"><input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" /> <input type="reset" value="{L_RESET}" class="liteoption" /></td>
|
||||
</tr>
|
||||
|
|
|
@ -150,7 +150,7 @@ table.forums {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.subforums+.moderators {
|
||||
.subforums + .moderators {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,8 @@ table.forums {
|
|||
margin-right: 1px;
|
||||
}
|
||||
|
||||
.sf_separator {}
|
||||
.sf_separator {
|
||||
}
|
||||
|
||||
.sf_title a {
|
||||
text-decoration: none;
|
||||
|
@ -218,7 +219,8 @@ table.forums {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.f_stat_topics {}
|
||||
.f_stat_topics {
|
||||
}
|
||||
|
||||
.f_stat_posts {
|
||||
padding-left: 3px;
|
||||
|
@ -490,14 +492,14 @@ a.postLink:visited {
|
|||
}
|
||||
|
||||
.poster-banned {
|
||||
background:#f6f6f6;
|
||||
border:1px solid #b71c1c;
|
||||
padding:4px;
|
||||
border-radius:2px;
|
||||
font-size:11px;
|
||||
font-weight:bold;
|
||||
letter-spacing:1px;
|
||||
text-align:center
|
||||
background: #f6f6f6;
|
||||
border: 1px solid #b71c1c;
|
||||
padding: 4px;
|
||||
border-radius: 2px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 1px;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.poster_info .avatar {
|
||||
|
@ -602,7 +604,8 @@ table.peers td {
|
|||
border: 1px #A5AFB4 solid;
|
||||
}
|
||||
|
||||
.dl_list {}
|
||||
.dl_list {
|
||||
}
|
||||
|
||||
.dl_list td {
|
||||
text-align: center;
|
||||
|
|
|
@ -295,7 +295,7 @@ ajax.callback.index_data = function(data) {
|
|||
<th>{L_USERNAME}:</th>
|
||||
<td id="username">
|
||||
<span class="editable bold">{USERNAME}</span>
|
||||
<!-- IF BANNED --><b title="{L_BANNED_USERS}" style="color: red;">{L_BANNED}</b><!-- ENDIF -->
|
||||
<!-- IF ban.IS_BANNED --><b title="{L_BANNED_USERS}" style="color: red;">{L_BANNED}</b><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- IF SHOW_ROLE -->
|
||||
|
|
|
@ -361,7 +361,7 @@ function build_poll_add_form (src_el)
|
|||
<p class="nick">{postrow.POSTER_NAME} <!-- IF postrow.POSTER_AUTHOR --><sup>®</sup><!-- ENDIF --></p>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF postrow.POSTER_BANNED --><p class="poster-banned" title="{L_BANNED_USERS}">{L_BANNED}</p><!-- ENDIF -->
|
||||
<!-- IF postrow.ban.IS_BANNED --><p class="poster-banned" title="{L_BANNED_USERS}">{L_BANNED}</p><!-- ENDIF -->
|
||||
<!-- IF postrow.POSTER_RANK --><p class="rank_txt">{postrow.POSTER_RANK}</p><!-- ENDIF -->
|
||||
<!-- IF postrow.RANK_IMAGE --><p class="rank_img">{postrow.RANK_IMAGE}</p><!-- ENDIF -->
|
||||
<!-- IF postrow.POSTER_AVATAR --><p class="avatar">{postrow.POSTER_AVATAR}</p><!-- ENDIF -->
|
||||
|
|
|
@ -317,15 +317,13 @@ if ($t_data['topic_show_first_post'] && $start) {
|
|||
u.user_opt, u.user_gender, u.user_birthday,
|
||||
p.*, g.group_name, g.group_description, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
|
||||
u2.username as mc_username, u2.user_rank as mc_user_rank,
|
||||
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
|
||||
ban.ban_userid
|
||||
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
|
||||
FROM " . BB_POSTS . " p
|
||||
LEFT JOIN " . BB_USERS . " u ON(u.user_id = p.poster_id)
|
||||
LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
|
||||
LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
|
||||
LEFT JOIN " . BB_USERS . " u2 ON(u2.user_id = p.mc_user_id)
|
||||
LEFT JOIN " . BB_GROUPS . " g ON(g.group_id = p.poster_rg_id)
|
||||
LEFT JOIN " . BB_BANLIST . " ban ON(ban.ban_userid = u.user_id)
|
||||
WHERE
|
||||
p.post_id = {$t_data['topic_first_post_id']}
|
||||
LIMIT 1
|
||||
|
@ -340,15 +338,13 @@ $sql = "
|
|||
u.user_opt, u.user_gender, u.user_birthday,
|
||||
p.*, g.group_name, g.group_description, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
|
||||
u2.username as mc_username, u2.user_rank as mc_user_rank,
|
||||
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
|
||||
ban.ban_userid
|
||||
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
|
||||
FROM " . BB_POSTS . " p
|
||||
LEFT JOIN " . BB_USERS . " u ON(u.user_id = p.poster_id)
|
||||
LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
|
||||
LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
|
||||
LEFT JOIN " . BB_USERS . " u2 ON(u2.user_id = p.mc_user_id)
|
||||
LEFT JOIN " . BB_GROUPS . " g ON(g.group_id = p.poster_rg_id)
|
||||
LEFT JOIN " . BB_BANLIST . " ban ON(ban.ban_userid = u.user_id)
|
||||
WHERE p.topic_id = $topic_id
|
||||
$limit_posts_time
|
||||
GROUP BY p.post_id
|
||||
|
@ -595,7 +591,6 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
|
||||
$poster_rank = $rank_image = '';
|
||||
$user_rank = $postrow[$i]['user_rank'];
|
||||
$user_ban_status = $postrow[$i]['ban_userid'];
|
||||
if (!$user->opt_js['h_rnk_i'] and isset($ranks[$user_rank])) {
|
||||
$rank_image = ($bb_cfg['show_rank_image'] && $ranks[$user_rank]['rank_image']) ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : '';
|
||||
$poster_rank = $bb_cfg['show_rank_text'] ? $ranks[$user_rank]['rank_title'] : '';
|
||||
|
@ -694,7 +689,6 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
'POSTER_NAME_JS' => addslashes($poster),
|
||||
'POSTER_RANK' => $poster_rank,
|
||||
'RANK_IMAGE' => $rank_image,
|
||||
'POSTER_BANNED' => $user_ban_status,
|
||||
'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '',
|
||||
|
||||
'POSTER_JOINED_DATE' => $poster_joined,
|
||||
|
@ -741,6 +735,14 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
'RG_SIG_ATTACH' => $postrow[$i]['attach_rg_sig']
|
||||
]);
|
||||
|
||||
// Ban information
|
||||
if ($banInfo = getUserBanInfo($poster_id)) {
|
||||
$template->assign_block_vars('postrow.ban', [
|
||||
'IS_BANNED' => true,
|
||||
'BAN_REASON' => $banInfo['ban_reason']
|
||||
]);
|
||||
}
|
||||
|
||||
if (isset($postrow[$i]['post_attachment']) && $is_auth['auth_download'] && function_exists('display_post_attachments')) {
|
||||
display_post_attachments($post_id, $postrow[$i]['post_attachment']);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue