From 971e0356263c4ef5bb38c5696e01ad7ead28db17 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 4 Feb 2016 15:15:35 +0100 Subject: [PATCH] Skip local check if network HFJ-1610 --- h5p.classes.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index c8662a1..57b5243 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2390,10 +2390,8 @@ class H5PCore { $type = $this->h5pF->getOption('site_type', 'local'); // Determine remote/visitor origin - $localhostPattern = '/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i'; - - // localhost - if ($type !== 'internet' && !preg_match($localhostPattern, $_SERVER['REMOTE_ADDR'])) { + if ($type === 'network' || + ($type === 'local' && !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) { if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) { // Internet $this->h5pF->setOption('site_type', 'internet');