diff --git a/wp-content/plugins/nextgen-gallery/changelog.txt b/wp-content/plugins/nextgen-gallery/changelog.txt index c40fcbcc0702b2a4335ee33e1044aa7a92b15d6a..cebf969e7d44956a9ef2af7d52b000217b054cbf 100644 --- a/wp-content/plugins/nextgen-gallery/changelog.txt +++ b/wp-content/plugins/nextgen-gallery/changelog.txt @@ -1,6 +1,9 @@ NextGEN Gallery by Photocrati Media += V2.0.65 - 05.04.2014 = +* Secured: Limit uploads to images and zips + = V2.0.63 - 04.29.2014 = * NEW: Translation ready * NEW: Including German translation by Roland Stumpp diff --git a/wp-content/plugins/nextgen-gallery/nggallery.php b/wp-content/plugins/nextgen-gallery/nggallery.php index c34ae6c09e507c47a47582aa3a9dd95105770ea9..f55e3770fb1758220371a19398a4c2c91280f924 100755 --- a/wp-content/plugins/nextgen-gallery/nggallery.php +++ b/wp-content/plugins/nextgen-gallery/nggallery.php @@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You /** * Plugin Name: NextGEN Gallery by Photocrati * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 9 million downloads. - * Version: 2.0.63 + * Version: 2.0.65 * Author: Photocrati Media * Plugin URI: http://www.nextgen-gallery.com * Author URI: http://www.photocrati.com @@ -430,7 +430,7 @@ class C_NextGEN_Bootstrap define('NGG_PRODUCT_URL', path_join(str_replace("\\", '/', NGG_PLUGIN_URL), 'products')); define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules')); define('NGG_PLUGIN_STARTED_AT', microtime()); - define('NGG_PLUGIN_VERSION', '2.0.63'); + define('NGG_PLUGIN_VERSION', '2.0.65'); if (!defined('NGG_HIDE_STRICT_ERRORS')) { define('NGG_HIDE_STRICT_ERRORS', TRUE); diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php index 1234ac79dce2510ac766d2924a1094aa2851c71f..f2a288cc3961071d7f5b3db99911d5b7b7b71360 100644 --- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php +++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php @@ -15,16 +15,17 @@ class A_NextGen_AddGallery_Ajax extends Mixin { $retval = array(); - $gallery_id = intval($this->param('gallery_id')); - $gallery_name = urldecode($this->param('gallery_name')); - $error = FALSE; + $created_gallery = FALSE; + $gallery_id = intval($this->param('gallery_id')); + $gallery_name = urldecode($this->param('gallery_name')); + $gallery_mapper = $this->object->get_registry()->get_utility('I_Gallery_Mapper'); + $error = FALSE; if ($this->validate_ajax_request('nextgen_upload_image')) { // We need to create a gallery if ($gallery_id == 0) { if (strlen($gallery_name) > 0) { - $gallery_mapper = $this->object->get_registry()->get_utility('I_Gallery_Mapper'); $gallery = $gallery_mapper->create(array( 'title' => $gallery_name )); @@ -33,7 +34,8 @@ class A_NextGen_AddGallery_Ajax extends Mixin $error = TRUE; } else { - $gallery_id = $gallery->id(); + $created_gallery = TRUE; + $gallery_id = $gallery->id(); } } else { @@ -65,6 +67,7 @@ class A_NextGen_AddGallery_Ajax extends Mixin catch (E_NggErrorException $ex) { $retval['error'] = $ex->getMessage(); $error = TRUE; + if ($created_gallery) $gallery_mapper->destroy($gallery_id); } catch (Exception $ex) { $retval['error'] = __("An unexpected error occured.", 'nggallery'); diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php index 952ec39b0e9de02b74f1f9387f650ce39328f96c..cc658cd38cf8057053b1428a9ff60dd9e2370c01 100644 --- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php +++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php @@ -80,7 +80,7 @@ $this->start_element('nextgen_gallery.gallery_container', 'container', $displaye ?> - <?php if ($number_of_columns > 0): ?> + <?php if ($number_of_columns > 0 && empty($show_all_in_lightbox)): ?> <?php if ((($i + 1) % $number_of_columns) == 0 ): ?> <br style="clear: both" /> <?php endif; ?> diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php index 5f7f92da23246481772bfd403414fa4a3a066ce4..8081f0995dc98dffde6305f8f6bdfb2704ea03ec 100644 --- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php +++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php @@ -462,6 +462,38 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin return $this->object->copy_images($images, $gallery, $db, TRUE); } + function is_image_file() + { + $retval = FALSE; + + if ((isset($_FILES['file']) && $_FILES['file']['error'] == 0)) { + $file_info = $_FILES['file']; + + if (isset($file_info['type'])) { + $type = strtolower($file_info['type']); + error_log("Attempted to upload {$type}."); + $valid_types = array( + 'image/gif', + 'image/jpg', + 'image/jpeg', + 'image/pjpeg', + 'image/png', + ); + $valid_regex = '/\.(jpg|jpeg|gif|png)$/'; + + // Is this a valid type? + if (in_array($type, $valid_types)) $retval = TRUE; + + // Is this a valid extension? + else if (strpos($type, 'octem-stream') !== FALSE && preg_match($valid_regex, $type)) { + $retval = TRUE; + } + } + } + + return $retval; + } + function is_zip() { diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php index bf799a33920ef6671250bb3826db8a1907023db4..77149dc79f711f6b1decb92237057745a80825d3 100644 --- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php +++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php @@ -207,12 +207,15 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin if ($this->object->is_zip()) { $retval = $this->object->upload_zip($gallery); } - else { + else if ($this->is_image_file()) { $retval = $this->object->upload_base64_image( $gallery, file_get_contents($file['tmp_name']), $filename ? $filename : (isset($file['name']) ? $file['name'] : FALSE) ); + } + else { + throw new E_UploadException(__('Invalid image file. Acceptable formats: JPG, GIF, and PNG.', 'nggallery')); } } elseif ($data) { diff --git a/wp-content/plugins/nextgen-gallery/readme.txt b/wp-content/plugins/nextgen-gallery/readme.txt index c3458c90ca64fee1d489a37915c0a291062b96ef..2851121dc66407e05c94aa37735cae444e1a2459 100644 --- a/wp-content/plugins/nextgen-gallery/readme.txt +++ b/wp-content/plugins/nextgen-gallery/readme.txt @@ -199,6 +199,9 @@ For more information, feel free to visit the official website for the NextGEN Ga == Changelog == += V2.0.65 - 05.04.2014 = +* Secured: Limit uploads to images and zips + = V2.0.63 - 04.29.2014 = * NEW: Translation ready * NEW: Including German translation by Roland Stumpp