forked from leftypol/leftypol
Merge pull request #165 from dedushka1/log-ip-privacy
Hide IPs in Moderation Logs
This commit is contained in:
commit
662b02a336
3 changed files with 629 additions and 591 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -61,9 +61,9 @@ tf/
|
||||||
[._]s[a-w][a-z]
|
[._]s[a-w][a-z]
|
||||||
|
|
||||||
# special boards
|
# special boards
|
||||||
all/
|
/all/
|
||||||
mod/
|
/mod/
|
||||||
random/
|
/random/
|
||||||
|
|
||||||
# Banners
|
# Banners
|
||||||
banners/*
|
banners/*
|
||||||
|
|
1182
inc/mod/pages.php
1182
inc/mod/pages.php
File diff suppressed because it is too large
Load diff
32
tests/ProtectIPTest.php
Normal file
32
tests/ProtectIPTest.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
define('TINYBOARD', true);
|
||||||
|
require_once "inc/mod/pages.php";
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
// This is probably best done with property testing library, but let's
|
||||||
|
// wait add another dependency
|
||||||
|
|
||||||
|
final class ProtectIPTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testProtectsIpv4Address(){
|
||||||
|
$expected = 'Some ban message: xxxx';
|
||||||
|
|
||||||
|
// Random IP, hope it's not yours
|
||||||
|
$input = 'Some ban message: <a href="?/IP/33.57.252.246">33.57.252.246</a>';
|
||||||
|
$output = protect_ip($input);
|
||||||
|
$this->assertEquals($output, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testProtectsIpv6Address(){
|
||||||
|
$expected = 'Some ban message: xxxx';
|
||||||
|
|
||||||
|
// Random IP, hope it's not yours
|
||||||
|
$input = 'Some ban message: <a href="?/IP/5e85:f252:9baf:2131:8984:6ab2:3db0:fa48">5e85:f252:9baf:2131:8984:6ab2:3db0:fa48</a>';
|
||||||
|
$output = protect_ip($input);
|
||||||
|
|
||||||
|
$this->assertEquals($output, $expected);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue