habari-extras/simpleblacklist — pull request #1 by coderforlife (2012-11-01 21:18:24+00:00)
Title: Added support for Habari v0.8+ by allowing IPs to be already in dotted notation

Still supports v0.7 style with IPs in integer form.

After updating to v0.8+, the v0.7 form still remains in all comments posted before the conversion. To convert those run this SQL query:

UPDATE `habari_comments` SET `ip` = CONCAT(
CAST(CONV(SUBSTRING(LPAD(HEX(CAST(`ip` AS UNSIGNED)), 8, '0'), 1, 2), 16, 10) AS CHAR), '.',
CAST(CONV(SUBSTRING(LPAD(HEX(CAST(`ip` AS UNSIGNED)), 8, '0'), 3, 2), 16, 10) AS CHAR), '.',
CAST(CONV(SUBSTRING(LPAD(HEX(CAST(`ip` AS UNSIGNED)), 8, '0'), 5, 2), 16, 10) AS CHAR), '.',
CAST(CONV(SUBSTRING(LPAD(HEX(CAST(`ip` AS UNSIGNED)), 8, '0'), 7, 2), 16, 10) AS CHAR))
WHERE `ip` NOT LIKE '%.%'