TightURL

TightURL Git Source Tree

Root/bad-behavior/bad-behavior/whitelist.inc.php

1<?php if (!defined('BB2_CORE')) die('I said no cheating!');
2
3function bb2_whitelist($package)
4{
5    // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
6
7    // Inappropriate whitelisting WILL expose you to spam, or cause Bad
8    // Behavior to stop functioning entirely! DO NOT WHITELIST unless you
9    // are 100% CERTAIN that you should.
10
11    // IP address ranges use the CIDR format.
12
13    // Includes four examples of whitelisting by IP address and netblock.
14    $bb2_whitelist_ip_ranges = array(
15        "64.191.203.34", // Digg whitelisted as of 2.0.12
16        "208.67.217.130", // Digg whitelisted as of 2.0.12
17        "10.0.0.0/8",
18        "172.16.0.0/12",
19        "192.168.0.0/16",
20// "127.0.0.1",
21    );
22
23    // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
24
25    // Inappropriate whitelisting WILL expose you to spam, or cause Bad
26    // Behavior to stop functioning entirely! DO NOT WHITELIST unless you
27    // are 100% CERTAIN that you should.
28
29    // You should not whitelist search engines by user agent. Use the IP
30    // netblock for the search engine instead. See http://whois.arin.net/
31    // to locate the netblocks for an IP.
32
33    // User agents are matched by exact match only.
34
35    // Includes one example of whitelisting by user agent.
36    // All are commented out.
37    $bb2_whitelist_user_agents = array(
38    // "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) It's me, let me in",
39    );
40
41    // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
42
43    // Do not edit below this line
44
45    if (!empty($bb2_whitelist_ip_ranges)) {
46        foreach ($bb2_whitelist_ip_ranges as $range) {
47            if (match_cidr($package['ip'], $range)) return true;
48        }
49    }
50    if (!empty($bb2_whitelist_user_agents)) {
51        foreach ($bb2_whitelist_user_agents as $user_agent) {
52            if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) return true;
53        }
54    }
55    return false;
56}
57
58?>
59

Archive Download this file

Branches