From e88cf15c86bbb1db8ad8bac5bb222e579e3d4ace Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 9 Jun 2014 08:37:32 +0000 Subject: [PATCH] Fix use of option RunWithEndFile --- fileSend.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fileSend.php b/fileSend.php index d3d3eeb..80c4f15 100644 --- a/fileSend.php +++ b/fileSend.php @@ -121,8 +121,15 @@ if ( isset($opts->file) ) } } - if ( $OptionsRunWithEndFile && !in_array( $extension, $runExtensions) ) { - exit; + //Get the realname of file IN or exit + if ( $OptionsRunWithEndFile ) { + if ( in_array( $extension, $runExtensions) ) { + $extensionLength = strlen($extension)+1; + $filenameIn = substr($filenameIn, 0, strlen($filenameIn) - $extensionLength); + $extension = ''; + } else { + exit; + } } $lines = file($fluxBasePath . '/' . $filenameIn); @@ -136,7 +143,7 @@ if ( isset($opts->file) ) $extensionLength = 0; if ( $extension != '' ) { $extensionLength = strlen($extension)+1; - $filenameOut = substr($filenameIn, 0, strlen($filenameIn)-$extensionLength); + $filenameOut = substr($filenameIn, 0, strlen($filenameIn) - $extensionLength); $filenameOut = $filenameOut . '_' . date('YmdHis') . '.' . $extension; } else { $filenameOut = $filenameIn . '_' . date('YmdHis');