diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index 836dcd9..364ee07 100644
--- a/src/include/functions_common.php
+++ b/src/include/functions_common.php
@@ -866,16 +866,16 @@ function AddContextLinks(&$sourceTxt)
// Create Search Array
$search = array
(
- '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/x',
+ '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e',
// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|',
-/* (?:127)| */ '/(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]?)/x',
+/* (?:127)| */ '/(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]?)/e',
);
// Create Replace Array
$replace = array
(
- '.$1.$2$3',
- '$1.$2.$3.$4',
+ "'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")",
+ "'.' . InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")",
);
// Replace and return!
@@ -885,6 +885,35 @@ function AddContextLinks(&$sourceTxt)
//return $outTxt;
}
+/*
+* Helper to create a Lookup Link!
+*/
+function InsertLookupLink( $szIP, $szDomain, $prepend, $append )
+{
+ // Create string
+ $szReturn = $prepend;
+ if ( strlen($szIP) > 0 )
+ {
+ if (
+ (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) ||
+ (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) ||
+ (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) ||
+ (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0)
+ )
+ // Do not create a LINK in this case!
+ $szReturn .= '' . $szIP . '';
+ else
+ // Normal LINK!
+ $szReturn .= '' . $szIP . '';
+ }
+ else if ( strlen($szDomain) > 0 )
+ $szReturn .= '' . $szDomain . '';
+ $szReturn .= $append;
+
+ // return result
+ return $szReturn;
+}
+
/*
* Reserve Resolve IP Address!
*/