Update h5p.classes.php

Prevents H5P From breaking console PHP commands
pull/21/head
Dave Richer 2016-04-23 23:40:46 -04:00
parent db6f18c984
commit 76e813a32e
1 changed files with 1 additions and 1 deletions

View File

@ -2470,7 +2470,7 @@ class H5PCore {
// Determine remote/visitor origin
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)) {
if (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
// Internet
$this->h5pF->setOption('site_type', 'internet');
}