diff --git a/src/asktheoracle.php b/src/asktheoracle.php
index d3a85fa..c7bf8d8 100644
--- a/src/asktheoracle.php
+++ b/src/asktheoracle.php
@@ -77,16 +77,23 @@ if ( $content['oracle_type'] == "ip" )
{
$content['oracle_type_readable'] = "ip";
$content['oracle_kb_type'] = "ip";
+
+ if ( IsInternalIP($content['oracle_query']) )
+ $content['showonlinesearches'] = false;
+ else
+ $content['showonlinesearches'] = true;
}
else if ( $content['oracle_type'] == "domain" )
{
$content['oracle_type_readable'] = "domain";
$content['oracle_kb_type'] = "name";
+ $content['showonlinesearches'] = true;
}
else
{
$content['oracle_type_readable'] = "unknown type";
$content['oracle_kb_type'] = "";
+ $content['showonlinesearches'] = false;
}
$content['ORACLE_HELP_DETAIL'] = GetAndReplaceLangStr( $content['LN_ORACLE_HELP_DETAIL'], $content['oracle_type_readable'], $content['oracle_query'] ) ;
diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index 4a05fdc..99302a6 100644
--- a/src/include/functions_common.php
+++ b/src/include/functions_common.php
@@ -1032,7 +1032,7 @@ function AddContextLinks(&$sourceTxt)
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/e', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', ' {', '} ')", $sourceTxt );
+ $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', ' {', '} ')", $sourceTxt );
}
// Create if not set!
@@ -1042,8 +1042,8 @@ function AddContextLinks(&$sourceTxt)
// Create Search Array
$search = array
(
- '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e',
-/* (?: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',
+ '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/ie',
+/* (?: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]?)/ie',
);
// Create Replace Array
@@ -1079,9 +1079,8 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append )
// check if it is an IP or domain
if ( strlen($szIP) > 0 )
{
- // Split IP into array
+/* // Split IP into array
$IPArray = explode(".", $szIP);
-
if (
(intval($IPArray[0]) == 10 ) ||
(intval($IPArray[0]) == 127 ) ||
@@ -1089,6 +1088,8 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append )
(intval($IPArray[0]) == 192 && intval($IPArray[1]) == 168) ||
(intval($IPArray[0]) == 255 )
)
+*/
+ if ( IsInternalIP($szIP) )
// Do not create a LINK in this case!
$szReturn .= '' . $szIP . '';
else
@@ -1114,6 +1115,29 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append )
return $szReturn;
}
+/*
+* Helper function to check, if an IP Address is within private address space!
+*/
+function IsInternalIP($szIPAddress)
+{
+ // Split IP into array
+ $IPArray = explode(".", $szIPAddress);
+
+ if (
+ (intval($IPArray[0]) == 10 ) ||
+ (intval($IPArray[0]) == 127 ) ||
+ (intval($IPArray[0]) == 172 && intval($IPArray[1]) >= 16 && intval($IPArray[1]) <= 31) ||
+ (intval($IPArray[0]) == 192 && intval($IPArray[1]) == 168) ||
+ (intval($IPArray[0]) == 255 )
+ )
+
+ // return true in this case
+ return true;
+ else
+ // This is an external IP
+ return false;
+}
+
/*
* Reserve Resolve IP Address!
*/
diff --git a/src/templates/asktheoracle.html b/src/templates/asktheoracle.html
index d0e00f9..a1b00d9 100644
--- a/src/templates/asktheoracle.html
+++ b/src/templates/asktheoracle.html
@@ -39,6 +39,7 @@
+
{LN_ORACLE_ONLINESEARCH} |
@@ -50,6 +51,7 @@
+
diff --git a/src/templates/index.html b/src/templates/index.html
index 16c6b41..1e05ac3 100644
--- a/src/templates/index.html
+++ b/src/templates/index.html
@@ -245,7 +245,7 @@
-
+ |
| |