From 3e57bb04d7b8fc62761c0fa50b4d062701b1a82a Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 17 Sep 2013 09:15:24 +1000 Subject: Begin upgrade to much better bans table. DO NOT PULL YET; It won't work. --- install.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'install.php') diff --git a/install.php b/install.php index 639a90c9..69be6300 100644 --- a/install.php +++ b/install.php @@ -1,7 +1,7 @@ fetch(PDO::FETCH_ASSOC)) { + $query = prepare("INSERT INTO ``bans_new_temp`` VALUES + (NULL, :ipstart, :ipend, :created, :expires, :board, :creator, :reason, :seen, NULL)"); + + $range = Bans::parse_range($ban['ip']); + if ($range === false) { + // Invalid retard ban; just skip it. + continue; + } + + $query->bindValue(':ipstart', $range[0]); + if ($range[1] !== false && $range[1] != $range[0]) + $query->bindValue(':ipend', $range[1]); + else + $query->bindValue(':ipend', null, PDO::PARAM_NULL); + + $query->bindValue(':created', $ban['set']); + + if ($ban['expires']) + $query->bindValue(':expires', $ban['expires']); + else + $query->bindValue(':expires', null, PDO::PARAM_NULL); + + if ($ban['board']) + $query->bindValue(':board', $ban['board']); + else + $query->bindValue(':board', null, PDO::PARAM_NULL); + + $query->bindValue(':creator', $ban['mod']); + + if ($ban['reason']) + $query->bindValue(':reason', $ban['reason']); + else + $query->bindValue(':reason', null, PDO::PARAM_NULL); + + $query->bindValue(':seen', $ban['seen']); + $query->execute() or error(db_error($query)); + } case false: // Update version number file_write($config['has_installed'], VERSION); -- cgit v1.3