Changes in trunk/vb3 [6:17]


Ignore:
Location:
trunk/vb3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/vb3/upload/includes/bad-behavior/screener.inc.php

    r6 r17  
    66{ 
    77        // FIXME: Set the real cookie 
    8         setcookie($cookie_name, $cookie_value, 0, bb2_relative_path()); 
     8        @setcookie($cookie_name, $cookie_value, 0, bb2_relative_path()); 
    99} 
    1010 
  • trunk/vb3/upload/includes/functions_vb_badbehavior.php

    r6 r17  
    330330} 
    331331 
     332// Helper function for bb2_log_userid() 
     333function __walker($var) 
     334{ 
     335        return (strpos($var, 'Cookie') !== false); 
     336} 
     337 
     338// Determines if vB Bad Behavior has blocked a user request 
     339// Checks to see of userid is present in the Cookie header 
     340function bb2_log_userid($headers) 
     341{ 
     342        if (!empty($headers)) 
     343        { 
     344                $_tmp = explode("\n", $headers); 
     345                $_tmp = implode('', array_filter($_tmp, '__walker')); 
     346                $_tmp = str_replace(';', '&', $_tmp); 
     347 
     348                if (empty($_tmp)) 
     349                { 
     350                        return false; 
     351                } 
     352                parse_str($_tmp); 
     353 
     354                $userid = COOKIE_PREFIX . 'userid'; 
     355                return $$userid; 
     356        } 
     357        return false; 
     358} 
     359 
    332360// Calls inward to Bad Behavor itself. 
    333361require_once(BB2_CWD . '/bad-behavior/core.inc.php'); 
  • trunk/vb3/upload/admincp/vb_badbehavior.php

    r6 r17  
    9494        } 
    9595 
     96        // Need to filter out any keys? 
     97        $filterkeysql = ''; 
     98 
     99        if (!empty($vbulletin->options['vb_badbehavior_log_filter'])) 
     100        { 
     101                $filterkeys = explode("\n", trim($vbulletin->options['vb_badbehavior_log_filter'])); 
     102 
     103                foreach ($filterkeys AS $filterkey) 
     104                { 
     105                        $filterkeysql .= "'" . $db->escape_string($filterkey) . "',"; 
     106                } 
     107                unset($filterkeys); 
     108 
     109                $filterkeysql = trim($filterkeysql, ','); 
     110        } 
     111 
     112        // 
    96113        $counter = $db->query_first(" 
    97114                SELECT COUNT(*) AS total 
    98115                FROM " . TABLE_PREFIX . "vb_badbehavior 
     116                " . iif($filterkeysql, "WHERE `key` NOT IN($filterkeysql)") . " 
    99117        "); 
    100118 
     
    128146                SELECT *  
    129147                FROM " . TABLE_PREFIX . "vb_badbehavior 
     148                " . iif($filterkeysql, "WHERE `key` NOT IN($filterkeysql)") . " 
    130149                ORDER BY $order 
    131150                LIMIT $startat, {$vbulletin->GPC['perpage']} 
     
    175194                while ($log = $db->fetch_array($logs)) 
    176195                { 
     196                        $userid = bb2_log_userid($log['http_headers']); 
     197 
    177198                        print_cells_row(array( 
    178                                 $log['ip'], 
     199                                $log['ip'] . iif($userid !== false, "<br />UserID:<a href=\"member.php?{$vbulletin->session->vars['sessionurl']}u=$userid\" target=\"_blank\">$userid</a>"), 
    179200                                $log['date'], 
    180201                                "<a href=\"#\" onclick=\"window.open('vb_badbehavior.php?{$vbulletin->session->vars['sessionurl']}do=keycheck&key=$log[key]', 'keycheck', 'width=200,height=200');return false;\">$log[key]</a>", 
     
    203224        )); 
    204225 
     226        $datecut = TIMENOW - (86400 * $vbulletin->GPC['daysprune']); 
     227 
    205228        $logs = $db->query_first(" 
    206229                SELECT COUNT(*) AS total  
    207230                FROM " . TABLE_PREFIX . "vb_badbehavior  
    208                 WHERE date < DATE_SUB(NOW(), INTERVAL {$vbulletin->GPC['daysprune']} DAY) 
     231                WHERE UNIX_TIMESTAMP(date) < $datecut 
    209232        "); 
    210233 
     
    212235        { 
    213236                print_form_header('vb_badbehavior', 'doprunelog'); 
    214                 construct_hidden_code('daysprune', $vbulletin->GPC['daysprune']); 
     237                construct_hidden_code('daysprune', $datecut); 
    215238                print_table_header($vbphrase['prune_vb_badbehavior_logs']); 
    216239                print_description_row(construct_phrase( 
     
    235258        $db->query_write(" 
    236259                DELETE FROM " . TABLE_PREFIX . "vb_badbehavior  
    237                 WHERE date < DATE_SUB(NOW(), INTERVAL {$vbulletin->GPC['daysprune']} DAY) 
     260                WHERE UNIX_TIMESTAMP(date) < {$vbulletin->GPC['daysprune']} 
    238261        "); 
    239262 
  • trunk/vb3/product-vb_badbehavior.xml

    r6 r17  
    8787                        <phrase name="setting_vb_badbehavior_verbose_desc" date="1301856755" username="Eric" version="1.0.0"><![CDATA[Turning on verbose mode causes all HTTP requests to be logged. When verbose mode is off, only blocked requests and a few suspicious (but permitted) requests are blocked.<br /><br />Verbose mode is off by default. Using verbose mode is not recommended as it can significantly slow down your site; it exists to capture data from live spammers which are not being blocked.]]></phrase> 
    8888                        <phrase name="setting_vb_badbehavior_httpbl_key_title" date="1301856755" username="Eric" version="1.0.0"><![CDATA[http:BL API Key]]></phrase> 
    89                         <phrase name="setting_vb_badbehavior_httpbl_key_desc" date="1301856755" username="Eric" version="1.0.0"><![CDATA[Bad Behavior is capable of using data from the <a href="http://www.projecthoneypot.org/faq.php#g" target="_blank">http:BL</a> service provided by <a href="http://www.projecthoneypot.org/" target="_blank">Project Honey Pot</a> to screen requests.<br /><br />This is purely optional; however if you wish to use it, you must <a href="http://www.projecthoneypot.org/account_login.php" target="_blank">sign up for the service</a> and obtain an API key. To disable http:BL use, remove the API key from your settings.]]></phrase> 
     89                        <phrase name="setting_vb_badbehavior_httpbl_key_desc" date="1302825836" username="Eric" version="1.0.3-dev"><![CDATA[Bad Behavior is capable of using data from the <a href="http://www.projecthoneypot.org/faq.php#g" target="_blank">http:BL</a> service provided by <a href="http://www.projecthoneypot.org/" target="_blank">Project Honey Pot</a> to screen requests.<br /><br />This is purely optional; however if you wish to use it, you must <a href="http://www.projecthoneypot.org/httpbl_configure.php" target="_blank">sign up for the service</a> and obtain an API key. To disable http:BL use, remove the API key from your settings.]]></phrase> 
    9090                        <phrase name="setting_vb_badbehavior_httpbl_threat_title" date="1301856755" username="Eric" version="1.0.0"><![CDATA[http:BL Threat Level]]></phrase> 
    9191                        <phrase name="setting_vb_badbehavior_httpbl_threat_desc" date="1301856755" username="Eric" version="1.0.0"><![CDATA[This number provides a measure of how suspicious an IP address is, based on activity observed at Project Honey Pot. Bad Behavior will block requests with a threat level equal or higher to this setting. Project Honey Pot has <a href="http://www.projecthoneypot.org/threat_info.php" target="_blank">more information on this parameter</a>.]]></phrase> 
     
    9898                        <phrase name="setting_vb_badbehavior_reverse_proxy_addresses_title" date="1301856755" username="Eric" version="1.0.0"><![CDATA[Reverse Proxy Addresses]]></phrase> 
    9999                        <phrase name="setting_vb_badbehavior_reverse_proxy_addresses_desc" date="1301856755" username="Eric" version="1.0.0"><![CDATA[IP address or CIDR netblocks which Bad Behavior trusts to provide reliable information in the HTTP header given above. If no addresses are given, Bad Behavior will assume that the HTTP header given is always trustworthy and that the right-most IP address appearing in the header is correct.<br /><br />If you have a chain of two or more proxies this is probably not what you want; in this scenario you should either set this option and provide all proxy server IP addresses (or ranges) which could conceivably handle the request, or have your edge servers set a unique HTTP header with the client's IP address.<br /><br />For instance, when using CloudFlare, it is impossible to provide a list of IP addresses, so you would set the HTTP header to CloudFlare's provided "CF-Connecting-IP" header instead.<br /><br /><strong style="color: #ff0000;">NOTE: Enter one ip address/CIDR netblock per line.</strong>]]></phrase> 
     100                        <phrase name="setting_vb_badbehavior_log_filter_title" date="1303159579" username="Eric" version="1.0.3-dev"><![CDATA[Log Filter Keys]]></phrase> 
     101                        <phrase name="setting_vb_badbehavior_log_filter_desc" date="1303159579" username="Eric" version="1.0.3-dev"><![CDATA[Enter a list of keys you want filtered out of the log results. Please make sure you place each key on a separate line.]]></phrase> 
    100102                        <phrase name="settinggroup_vb_badbehavior" date="1301856755" username="Eric" version="1.0.0"><![CDATA[vB Bad Behavior Options]]></phrase> 
    101103                </phrasetype> 
     
    148150                                <optioncode>textarea</optioncode> 
    149151                        </setting> 
     152                        <setting varname="vb_badbehavior_log_filter" displayorder="110"> 
     153                                <datatype>free</datatype> 
     154                                <optioncode>textarea</optioncode> 
     155                                <defaultvalue>00000000</defaultvalue> 
     156                        </setting> 
    150157                </settinggroup> 
    151158        </options> 
Note: See TracChangeset for help on using the changeset viewer.