equal
deleted
inserted
replaced
194 function page_Special_DownloadFile() |
194 function page_Special_DownloadFile() |
195 { |
195 { |
196 global $db, $session, $paths, $template, $plugins; // Common objects |
196 global $db, $session, $paths, $template, $plugins; // Common objects |
197 global $lang; |
197 global $lang; |
198 global $do_gzip; |
198 global $do_gzip; |
199 $filename = rawurldecode($paths->getParam(0)); |
199 $filename = $paths->getParam(0); |
200 $timeid = $paths->getParam(1); |
200 $timeid = $paths->getParam(1); |
201 if ( $timeid && preg_match('#^([0-9]+)$#', (string)$timeid) ) |
201 if ( $timeid && ctype_digit((string)$timeid) ) |
202 { |
202 { |
203 $tid = ' AND time_id='.$timeid; |
203 $tid = ' AND time_id='.$timeid; |
204 } |
204 } |
205 else |
205 else |
206 { |
206 { |
241 if ( isset($_GET['preview']) && substr($row['mimetype'], 0, 6) == 'image/' ) |
241 if ( isset($_GET['preview']) && substr($row['mimetype'], 0, 6) == 'image/' ) |
242 { |
242 { |
243 // Determine appropriate width and height |
243 // Determine appropriate width and height |
244 $width = ( isset($_GET['width']) ) ? intval($_GET['width'] ) : 320; |
244 $width = ( isset($_GET['width']) ) ? intval($_GET['width'] ) : 320; |
245 $height = ( isset($_GET['height']) ) ? intval($_GET['height']) : 320; |
245 $height = ( isset($_GET['height']) ) ? intval($_GET['height']) : 320; |
246 $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}{$row['file_extension']}"; |
246 |
|
247 // 1.1.7: allow different format output |
|
248 $extension = $row['file_extension']; |
|
249 if ( isset($_GET['fmt']) && in_array($_GET['fmt'], array('png', 'jpg')) ) |
|
250 $extension = ".{$_GET['fmt']}"; |
|
251 |
|
252 $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}$extension"; |
247 if ( file_exists($cache_filename) ) |
253 if ( file_exists($cache_filename) ) |
248 { |
254 { |
249 $fname = $cache_filename; |
255 $fname = $cache_filename; |
250 } |
256 } |
251 else |
257 else |