diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-19 12:37:31 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-19 12:37:31 +1100 |
| commit | c59f36f400eb718714154fa1ab125662bc7b89ea (patch) | |
| tree | bb4f8544cb351d897359fdc6ad79d48f8c9ee22b /inc/functions.php | |
| parent | 62bd2ee348f460b3d4cbbdbd8469a783b4c64c78 (diff) | |
a bunch of things
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php index 4f4a69bd..6193ab38 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -439,14 +439,43 @@ } } } + + function isDNSBL() { + $dns_black_lists = file('./dnsbl.txt', FILE_IGNORE_NEW_LINES); + + // Reverse the IP + $rev_ip = implode(array_reverse(explode('.', $_SERVER['REMOTE_ADDR'])), '.'); + $response = array(); + foreach ($dns_black_lists as $dns_black_list) { + $response = (gethostbynamel($rev_ip . '.' . $dns_black_list)); + if(!empty($response)) + return true; + } + + return false; + } + + function isTor() { + return gethostbyname( + ReverseIPOctets($_SERVER['REMOTE_ADDR']) . '.' . $_SERVER['SERVER_PORT'] . '.' . ReverseIPOctets($_SERVER['SERVER_ADDR']) . '.ip-port.exitlist.torproject.org' + ) == '127.0.0.2'; + } + + function ReverseIPOctets($inputip) { + $ipoc = explode('.', $inputip); + return $ipoc[3] . '.' . $ipoc[2] . '.' . $ipoc[1] . '.' . $ipoc[0]; + } function markup(&$body) { global $board; $body = utf8tohtml($body, true); - if(MARKUP_URLS) - $body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body); + if(MARKUP_URLS) { + $body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body, -1, $num_links); + if($num_links > MAX_LINKS) + error(ERROR_TOOMANYLINKS); + } if(AUTO_UNICODE) { $body = str_replace('...', '…', $body); @@ -602,7 +631,7 @@ $salt = strtr ( $salt, ':;<=>?@[\]^_`', 'ABCDEFGabcdef' ); if ( isset ( $t[2] ) ) { // secure - $trip = '!!' . substr ( crypt ( $trip, '@#$%^&*()' ), ( -1 * $length ) ); + $trip = '!!' . substr ( crypt ( $trip, SECURE_TRIP_SALT ), ( -1 * $length ) ); } else { // insecure $trip = '!' . substr ( crypt ( $trip, $salt ), ( -1 * $length ) ); |
