summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@tinyboard.org>2011-08-04 15:47:34 +1000
committerSavetheinternet <savetheinternet@tinyboard.org>2011-08-04 15:47:34 +1000
commitc4c6a9839645c49a981de6f9dcf82fe0c7a0c739 (patch)
tree08ca02da3f80f2830bd8aba1937a77ee0a6eda43 /inc
parent1fe672fed203c30772b7959050648ed9d75a4c42 (diff)
various bug fixed, introduced ban ID, temporarily broke caching bans with memcached
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php18
-rw-r--r--inc/functions.php9
-rw-r--r--inc/mod.php17
3 files changed, 24 insertions, 20 deletions
diff --git a/inc/config.php b/inc/config.php
index 4b03c3b7..b4bbc60e 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -736,16 +736,14 @@
// Remote servers
// http://tinyboard.org/wiki/index.php?title=Multiple_Servers
- //$config['remote'] = Array(
- // 'static' => Array(
- // 'host' => 'static.example.org',
- // 'auth' => Array(
- // 'method' => 'plain',
- // 'username' => 'username',
- // 'password' => 'password!123'
- // ),
- // 'type' => 'scp'
- // )
+ //$config['remote']['static'] = Array(
+ // 'host' => 'static.example.org',
+ // 'auth' => Array(
+ // 'method' => 'plain',
+ // 'username' => 'username',
+ // 'password' => 'password!123'
+ // ),
+ // 'type' => 'scp'
//);
// Enable reCaptcha to make spam even harder
diff --git a/inc/functions.php b/inc/functions.php
index 523d82f5..b461fe99 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -477,13 +477,6 @@
return;
}
- if($config['memcached']['enabled']) {
- // Cached ban?
- if($ban = $memcached->get("ban_${board}_${_SERVER['REMOTE_ADDR']}")) {
- displayBan($ban);
- }
- }
-
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `uri` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` WHERE (`board` IS NULL OR `uri` = :board) AND `ip` = :ip ORDER BY `expires` IS NULL DESC, `expires` DESC, `expires` DESC LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board);
@@ -512,8 +505,6 @@
return;
}
- if($config['memcached']['enabled'])
- $memcached->set("ban_${board}_${_SERVER['REMOTE_ADDR']}", $ban, $ban['expires']);
displayBan($ban);
}
}
diff --git a/inc/mod.php b/inc/mod.php
index ff89ecf5..a6c2c9cc 100644
--- a/inc/mod.php
+++ b/inc/mod.php
@@ -273,5 +273,20 @@
'</form>' .
'</fieldset>';
}
-
+
+
+ function removeBan($id) {
+ global $config;
+
+ $query = prepare("DELETE FROM `bans` WHERE `id` = :id");
+ $query->bindValue(':id', $id, PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+
+ if($config['memcached']['enabled']) {
+ // Remove cached ban
+ // TODO
+ $memcached->delete("ban_{$id}");
+ }
+ }
+
?>