Bugfix: Must be able to run from CLI

pull/22/head
Frode Petterson 2016-05-12 15:52:37 +02:00
parent cbfa2913bc
commit 417af36c81
1 changed files with 3 additions and 1 deletions

View File

@ -2469,7 +2469,9 @@ class H5PCore {
// Determine remote/visitor origin // Determine remote/visitor origin
if ($type === 'network' || if ($type === 'network' ||
($type === 'local' && !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) { ($type === 'local' &&
isset($_SERVER['REMOTE_ADDR']) &&
!preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) {
if (isset($_SERVER['REMOTE_ADDR']) && 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 // Internet
$this->h5pF->setOption('site_type', 'internet'); $this->h5pF->setOption('site_type', 'internet');