From b27e4451ee2ae65581f3245971155927c75d6ec7 Mon Sep 17 00:00:00 2001 From: Zach Ploskey Date: Mon, 13 Feb 2017 16:21:37 -0800 Subject: Don't duplicate is_file and filesize checks Move duplicate is_file and file_size checks out of if/else branches. Signed-off-by: Zach Ploskey --- system/helpers/download_helper.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index ea3da1bf4..7500bc827 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -84,23 +84,18 @@ if ( ! function_exists('force_download')) { return; } - - if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) - { - return; - } } else { - if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) - { - return; - } - $filepath = $filename; $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); $filename = end($filename); } + + if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) + { + return; + } } else { -- cgit v1.2.3-24-g4f1b