]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/tools/class_HubTools.php
Used str_pad() instead of prependStringToString()
[hub.git] / application / hub / main / tools / class_HubTools.php
index 95198e7a6aac5c1ef0effe67628cc183fb9247e6..0d8b4f0d9ce5c9e4ed3a56ba274143def0e7d2dd 100644 (file)
@@ -211,6 +211,28 @@ class HubTools extends BaseHubSystem {
                // Return it
                return $ip;
        }
+
+       /**
+        * Determine IP or 'internal_ip' if set
+        *
+        * @return      $ip             The determined external ip of this node
+        */
+       public static function determineOwnInternalIp () {
+               // Is the internal_ip config entry set?
+               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_ip') == 'N') {
+                       // Not allowed to publish internal IP, so use external
+                       $ip = self::determineOwnExternalIp();
+               } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip') != '') {
+                       // Use it as internal ip
+                       $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip');
+               } else {
+                       // Determine own internal ip by connecting to my (coder) server at 188.138.90.169
+                       $ip = ConsoleTools::acquireSelfIPAddress();
+               }
+
+               // Return it
+               return $ip;
+       }
 }
 
 // [EOF]