# HG changeset patch # User Dan Fuhry # Date 1284882660 14400 # Node ID 740bbe1f4dd50e1142c83c0afbc4bebdf7844676 # Parent 17cfc3da0dcc4c6c772948a4b003ce340a611cfc So yeah, new uploader broke on everything but zip files. Fixed that. diff -r 17cfc3da0dcc -r 740bbe1f4dd5 plugins/gallery/functions.php --- a/plugins/gallery/functions.php Sat Aug 21 23:51:10 2010 -0400 +++ b/plugins/gallery/functions.php Sun Sep 19 03:51:00 2010 -0400 @@ -434,22 +434,29 @@ * @return int image ID */ -function snapr_insert_image($path, $folder_id = NULL) +function snapr_insert_image($path, $folder_id = NULL, $orig_filename = false) { global $db, $session, $paths, $template, $plugins; // Common objects - $ext = get_file_extension($path); + $usename = $orig_filename ? $orig_filename : $path; + $ext = get_file_extension($usename); $ourfilename = gallery_make_filename() . "." . strtolower($ext); if ( !snapr_extension_allowed($ext) ) + { + echo "Banned extension: $ext"; return false; + } // copy the file to the storage folder if ( !rename($path, ENANO_ROOT . "/files/$ourfilename") ) + { + echo "Rename failed: $path -> files/$ourfilename"; return false; + } // insert the image into the database $folder = $folder_id === NULL ? 'NULL' : strval(intval($folder_id)); - $title = ucwords(str_replace('_', ' ', basename($path))); + $title = ucwords(str_replace('_', ' ', $usename)); $title = preg_replace("/\.{$ext}\$/i", '', $title); $sz = serialize(array()); $now = time(); diff -r 17cfc3da0dcc -r 740bbe1f4dd5 plugins/gallery/upload.php --- a/plugins/gallery/upload.php Sat Aug 21 23:51:10 2010 -0400 +++ b/plugins/gallery/upload.php Sun Sep 19 03:51:00 2010 -0400 @@ -205,7 +205,7 @@ if ( snapr_extension_allowed($ext) ) { // normal image - $result = snapr_insert_image($files['tmp_name'][$i], $destfolder); + $result = snapr_insert_image($files['tmp_name'][$i], $destfolder, $files['name'][$i]); if ( $result !== false ) $idlist[] = $result; }