From 5c6905607e5f12d8d9c44587f4e4aee2869e89f1 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Thu, 15 Mar 2018 15:28:53 +0100 Subject: [PATCH] Avoid 'undefined index' notice when downloading a file --- build/libifm.php | 3 ++- ifm.php | 3 ++- src/main.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/libifm.php b/build/libifm.php index 07aa90d..ff72e41 100644 --- a/build/libifm.php +++ b/build/libifm.php @@ -70,6 +70,7 @@ class IFM { $this->config['defaulttimezone'] = getenv('IFM_DEFAULTTIMEZONE') !== false ? getenv('IFM_DEFAULTTIMEZONE') : $this->config['defaulttimezone'] ; $this->config['forbiddenChars'] = getenv('IFM_FORBIDDENCHARS') !== false ? str_split( getenv('IFM_FORBIDDENCHARS') ) : $this->config['forbiddenChars'] ; $this->config['language'] = getenv('IFM_LANGUAGE') !== false ? getenv('IFM_LANGUAGE') : $this->config['language'] ; + $this->config['selfoverwrite'] = getenv('IFM_SELFOVERWRITE') !== false ? getenv('IFM_SELFOVERWRITE') : $this->config['selfoverwrite'] ; $this->config['ajaxrequest'] = getenv('IFM_API_AJAXREQUEST') !== false ? intval( getenv('IFM_API_AJAXREQUEST') ) : $this->config['ajaxrequest'] ; $this->config['chmod'] = getenv('IFM_API_CHMOD') !== false ? intval( getenv('IFM_API_CHMOD') ) : $this->config['chmod'] ; $this->config['copymove'] = getenv('IFM_API_COPYMOVE') !== false ? intval( getenv('IFM_API_COPYMOVE') ) : $this->config['copymove'] ; @@ -4277,7 +4278,7 @@ function IFM( params ) { } private function fileDownload( array $options ) { - if( $options['forceDL'] ) + if( isset( $options['forceDL'] ) && $options['forceDL'] ) $content_type = "application/octet-stream"; else $content_type = mime_content_type( $options['file'] ); diff --git a/ifm.php b/ifm.php index 63411ea..3b55911 100644 --- a/ifm.php +++ b/ifm.php @@ -70,6 +70,7 @@ class IFM { $this->config['defaulttimezone'] = getenv('IFM_DEFAULTTIMEZONE') !== false ? getenv('IFM_DEFAULTTIMEZONE') : $this->config['defaulttimezone'] ; $this->config['forbiddenChars'] = getenv('IFM_FORBIDDENCHARS') !== false ? str_split( getenv('IFM_FORBIDDENCHARS') ) : $this->config['forbiddenChars'] ; $this->config['language'] = getenv('IFM_LANGUAGE') !== false ? getenv('IFM_LANGUAGE') : $this->config['language'] ; + $this->config['selfoverwrite'] = getenv('IFM_SELFOVERWRITE') !== false ? getenv('IFM_SELFOVERWRITE') : $this->config['selfoverwrite'] ; $this->config['ajaxrequest'] = getenv('IFM_API_AJAXREQUEST') !== false ? intval( getenv('IFM_API_AJAXREQUEST') ) : $this->config['ajaxrequest'] ; $this->config['chmod'] = getenv('IFM_API_CHMOD') !== false ? intval( getenv('IFM_API_CHMOD') ) : $this->config['chmod'] ; $this->config['copymove'] = getenv('IFM_API_COPYMOVE') !== false ? intval( getenv('IFM_API_COPYMOVE') ) : $this->config['copymove'] ; @@ -4277,7 +4278,7 @@ function IFM( params ) { } private function fileDownload( array $options ) { - if( $options['forceDL'] ) + if( isset( $options['forceDL'] ) && $options['forceDL'] ) $content_type = "application/octet-stream"; else $content_type = mime_content_type( $options['file'] ); diff --git a/src/main.php b/src/main.php index f61c834..4d93f23 100644 --- a/src/main.php +++ b/src/main.php @@ -1260,7 +1260,7 @@ f00bar; } private function fileDownload( array $options ) { - if( $options['forceDL'] ) + if( isset( $options['forceDL'] ) && $options['forceDL'] ) $content_type = "application/octet-stream"; else $content_type = mime_content_type( $options['file'] );