Commit c828fd54f820899a21fe41d4c21e3ddbba341cbc
1 parent
f4ef7e82
A straight comparison is case-sensitive. If the drive letter (windows) is displa…
…yed as a capital letter then it returns false on the comparison. This fix allows the drive letter to be lower or upper case. Committed by: Megan Watson Reviewed by: Tohir Solomons
Showing
1 changed file
with
32 additions
and
5 deletions
ktwebservice/KTUploadManager.inc.php
| @@ -76,13 +76,40 @@ class KTUploadManager | @@ -76,13 +76,40 @@ class KTUploadManager | ||
| 76 | return $tempfilename; | 76 | return $tempfilename; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | - function is_valid_temporary_file($tempfilename) | ||
| 80 | - { | ||
| 81 | - $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); | 79 | + function is_valid_temporary_file($tempfilename) |
| 80 | + { | ||
| 81 | + $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); | ||
| 82 | + $tempdir = str_replace('\\','/', $tempdir); | ||
| 83 | + | ||
| 84 | + $tempdir = preg_replace_callback( | ||
| 85 | + '/\A(.*?):/i', | ||
| 86 | + create_function( | ||
| 87 | + // single quotes are essential here, | ||
| 88 | + // or alternative escape all $ as \$ | ||
| 89 | + '$matches', | ||
| 90 | + 'return strtolower($matches[0]);' | ||
| 91 | + ), | ||
| 92 | + $tempdir | ||
| 93 | + ); | ||
| 94 | + | ||
| 95 | + $main_temp_dir = preg_replace_callback( | ||
| 96 | + '/\A(.*?):/i', | ||
| 97 | + create_function( | ||
| 98 | + // single quotes are essential here, | ||
| 99 | + // or alternative escape all $ as \$ | ||
| 100 | + '$matches', | ||
| 101 | + 'return strtolower($matches[0]);' | ||
| 102 | + ), | ||
| 103 | + $this->temp_dir | ||
| 104 | + ); | ||
| 105 | + | ||
| 106 | + return ($tempdir == $main_temp_dir); | ||
| 107 | + /* | ||
| 108 | + $tempdir = substr($tempfilename,0,strlen($this->temp_dir)); | ||
| 82 | $tempdir = str_replace('\\','/', $tempdir); | 109 | $tempdir = str_replace('\\','/', $tempdir); |
| 83 | return ($tempdir == $this->temp_dir); | 110 | return ($tempdir == $this->temp_dir); |
| 84 | - } | ||
| 85 | - | 111 | + */ |
| 112 | + } | ||
| 86 | function store_base64_file($base64, $prefix= 'sa_') | 113 | function store_base64_file($base64, $prefix= 'sa_') |
| 87 | { | 114 | { |
| 88 | $tempfilename = $this->get_temp_filename($prefix); | 115 | $tempfilename = $this->get_temp_filename($prefix); |