From c828fd54f820899a21fe41d4c21e3ddbba341cbc Mon Sep 17 00:00:00 2001 From: Megan Date: Tue, 14 Apr 2009 15:59:45 +0200 Subject: [PATCH] A straight comparison is case-sensitive. If the drive letter (windows) is displayed as a capital letter then it returns false on the comparison. This fix allows the drive letter to be lower or upper case. --- ktwebservice/KTUploadManager.inc.php | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/ktwebservice/KTUploadManager.inc.php b/ktwebservice/KTUploadManager.inc.php index 0e6f664..83a4942 100644 --- a/ktwebservice/KTUploadManager.inc.php +++ b/ktwebservice/KTUploadManager.inc.php @@ -76,13 +76,40 @@ class KTUploadManager return $tempfilename; } - function is_valid_temporary_file($tempfilename) - { - $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); + function is_valid_temporary_file($tempfilename) + { + $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); + $tempdir = str_replace('\\','/', $tempdir); + + $tempdir = preg_replace_callback( + '/\A(.*?):/i', + create_function( + // single quotes are essential here, + // or alternative escape all $ as \$ + '$matches', + 'return strtolower($matches[0]);' + ), + $tempdir + ); + + $main_temp_dir = preg_replace_callback( + '/\A(.*?):/i', + create_function( + // single quotes are essential here, + // or alternative escape all $ as \$ + '$matches', + 'return strtolower($matches[0]);' + ), + $this->temp_dir + ); + + return ($tempdir == $main_temp_dir); + /* + $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); $tempdir = str_replace('\\','/', $tempdir); return ($tempdir == $this->temp_dir); - } - + */ + } function store_base64_file($base64, $prefix= 'sa_') { $tempfilename = $this->get_temp_filename($prefix); -- libgit2 0.21.4