From 12ae8b180e042028b45273b4bd55b0911ee84598 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sat, 9 Aug 2014 00:33:11 +0200 Subject: [PATCH] add IPv6 support --- core/Logger.inc | 13 ++++++++++++- www/index.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/Logger.inc b/core/Logger.inc index b5ac7dc9..be2ce757 100644 --- a/core/Logger.inc +++ b/core/Logger.inc @@ -124,7 +124,18 @@ */ private function getAutoLogMode() { - return ($_SERVER['SERVER_ADDR'] == '127.0.0.1' && !$this->autoLogToScreenDisabled) ? self::LOGMODE_SCREEN : self::LOGMODE_PHP; + return ($this->isLocalhost() && !$this->autoLogToScreenDisabled) ? self::LOGMODE_SCREEN : self::LOGMODE_PHP; + } + + + /** + * Detect if the server is running as localhost without domain. + * + * @return boolean Wheather server is running as localhost or not + */ + private function isLocalhost() + { + return ($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_ADDR'] = '::1'); } } diff --git a/www/index.php b/www/index.php index 2faa32fd..46301a31 100644 --- a/www/index.php +++ b/www/index.php @@ -25,7 +25,7 @@ /** * De-/Activate error messages */ - if($_SERVER['SERVER_ADDR'] == '127.0.0.1') { + if($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_ADDR'] == '::1') { error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('log_errors', 0);