plugins/SpecialUpdownload.php
changeset 1059 f5d2bca33bb8
parent 960 e74741b8360b
child 1081 745200a9cc2a
--- a/plugins/SpecialUpdownload.php	Fri Jul 17 09:07:50 2009 -0400
+++ b/plugins/SpecialUpdownload.php	Wed Jul 29 10:47:26 2009 -0400
@@ -196,9 +196,9 @@
   global $db, $session, $paths, $template, $plugins; // Common objects
   global $lang;
   global $do_gzip;
-  $filename = rawurldecode($paths->getParam(0));
+  $filename = $paths->getParam(0);
   $timeid = $paths->getParam(1);
-  if ( $timeid && preg_match('#^([0-9]+)$#', (string)$timeid) )
+  if ( $timeid && ctype_digit((string)$timeid) )
   {
     $tid = ' AND time_id='.$timeid;
   }
@@ -243,7 +243,13 @@
     // Determine appropriate width and height
     $width  = ( isset($_GET['width'])  ) ? intval($_GET['width'] ) : 320;
     $height = ( isset($_GET['height']) ) ? intval($_GET['height']) : 320;
-    $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}{$row['file_extension']}";
+    
+    // 1.1.7: allow different format output
+    $extension = $row['file_extension'];
+    if ( isset($_GET['fmt']) && in_array($_GET['fmt'], array('png', 'jpg')) )
+      $extension = ".{$_GET['fmt']}";
+    
+    $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}$extension";
     if ( file_exists($cache_filename) )
     {
       $fname = $cache_filename;