function AddContextLinks(&$sourceTxt)
{
    global $szTLDDomains;
    // Return if not enabled!
    if (GetConfigSetting("EnableIPAddressResolve", 0, CFGLEVEL_USER) == 1) {
        // Search for IP's and Add Reverse Lookup first!
        $sourceTxt = preg_replace('/([^\\[])\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/ie', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', '<font class=\"highlighted\"> {', '} </font>')", $sourceTxt);
    }
    // check if user disabled Context Links.
    if (GetConfigSetting("EnableContextLinks", 1, CFGLEVEL_USER) == 0) {
        return;
    }
    // Create if not set!
    if (!isset($szTLDDomains)) {
        CreateTopLevelDomainSearch();
    }
    // Create Search Array
    $search = array('/\\.([\\w\\d\\_\\-]+)\\.(' . $szTLDDomains . ')([^a-zA-Z0-9\\.])/ie', '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ie');
    // Create Replace Array
    $replace = array("'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")", "InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")");
    // Replace and return!
    $sourceTxt = preg_replace($search, $replace, $sourceTxt);
    //echo $outTxt . " <br>" ;
    //return $outTxt;
}
Ejemplo n.º 2
0
function AddContextLinks(&$sourceTxt)
{
    global $szTLDDomains;
    // Return if not enabled!
    if (GetConfigSetting("EnableIPAddressResolve", 0, CFGLEVEL_USER) == 1) {
        // Search for IP's and Add Reverse Lookup first!
        // $sourceTxt = preg_replace( '/([^\[])\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/ie', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', '<font class=\"highlighted\"> {', '} </font>')", $sourceTxt );
        $sourceTxt = preg_replace_callback('/([^\\[])\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/i', "ReverseResolveIP", $sourceTxt);
    }
    // check if user disabled Context Links.
    if (GetConfigSetting("EnableContextLinks", 1, CFGLEVEL_USER) == 0) {
        return;
    }
    // Create if not set!
    if (!isset($szTLDDomains)) {
        CreateTopLevelDomainSearch();
    }
    // Replace and return!
    $sourceTxt = preg_replace_callback('/\\.([\\w\\d\\_\\-]+)\\.(' . $szTLDDomains . ')([^a-zA-Z0-9\\.])/i', "InsertLookupLinkDomain", $sourceTxt);
    $sourceTxt = preg_replace_callback('/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/i', "InsertLookupLinkIP", $sourceTxt);
}