From 51cdaaccd1489e7f62d90058d12aa6bceafb2d3f Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 23 Nov 2011 16:12:19 +1100 Subject: Use template instead of inline HTML for ban messages. --- inc/functions.php | 82 ++++++++----------------------------------------------- 1 file changed, 11 insertions(+), 71 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 7934a53a..ef3a7ef9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -453,81 +453,21 @@ } } - function formatDate($timestamp) { - return date('jS F, Y', $timestamp); - } - function displayBan($ban) { global $config; - $body = '
-

You are banned! ;_;

-

You have been banned from ' . - (!isset($ban['uri']) ? - 'all boards': - '' . sprintf($config['board_abbreviation'], $ban['uri']) . '' - ) . - ' ' . - ($ban['reason'] ? 'for the following reason:' : 'for an unspecified reason.') . - '

' . - ($ban['reason'] ? - '

' . - $ban['reason'] . - '

' - : '') . - '

Your ban was filed on ' . - formatDate($ban['set']) . - ', and ' . - ($ban['expires'] ? - 'expires ' . until($ban['expires']) . ' from now, which is on ' . - formatDate($ban['expires']) . - ' - ' - : 'will not expire.' ) . - '

-

Your IP address is ' . $_SERVER['REMOTE_ADDR'] . '.

-
'; - + $ban['ip'] = $_SERVER['REMOTE_ADDR']; + // Show banned page and exit - die(Element('page.html', Array( + die( + Element('page.html', Array( + 'title' => 'Banned!', 'config' => $config, - 'title' => 'Banned', - 'subtitle' => 'You are banned!', - 'body' => $body - ) + 'body' => Element('banned.html', Array( + 'config' => $config, + 'ban' => $ban + ) + )) )); } @@ -549,7 +489,7 @@ $query->bindValue(':board', $board); $query->execute() or error(db_error($query)); } - if($query->rowCount() < 1 && $config['ban_cidr']) { + if($query->rowCount() < 1 && $config['ban_cidr'] && !isIPv6()) { // my most insane SQL query yet $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `uri`, `bans`.`id` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` WHERE (`board` IS NULL OR `uri` = :board) AND ( -- cgit v1.3