diff --git a/wp-content/plugins/nextgen-gallery/changelog.txt b/wp-content/plugins/nextgen-gallery/changelog.txt
index 6afdf2a9cc88f57bf963812f24d035de57ad6340..244a836e2973b4786f06bf19e00e470cd7a3888a 100644
--- a/wp-content/plugins/nextgen-gallery/changelog.txt
+++ b/wp-content/plugins/nextgen-gallery/changelog.txt
@@ -1,6 +1,14 @@
 NextGEN Gallery
 by Photocrati Media
 
+= V2.0.66.29 - 09.17.2014 =
+* NEW:     Added skip_excluding_globally_excluded_images property to displayed gallery objects
+* Fixed:   SQL generation for random image selection
+* Fixed:   Adjust regex for replacing displayed gallery placeholder images
+* Fixed:   Removed filters to home_url needed previously for WMPL compatibility
+* Fixed:   Use canonical redirects when appropriate
+* Fixed:   Ability to override image files using XML-RPC
+
 = V2.0.66.27 - 08.18.2014 =
 * Fixed:   Missing class.frame_communication_option_handerl.php error
 
@@ -35,7 +43,7 @@ by Photocrati Media
 * NEW: 	   Spanish (es_ES) language thanks to Andrew Kurtis at WebHostingHub
 * Changed: Updated Czech language thanks to Separatista; additional thanks to Martin Krizek for the original translation who was mistakenly unaccredited
 * Changed: "Upgrade to Pro" page has new design, advertises for NextGEN Plus
-* Changed: Basic Albums templates now given the image counter <p> element the class 'ngg-album-gallery-image-counter' (by user request)
+* Changed: Basic Albums templates now given the image counter P element the class 'ngg-album-gallery-image-counter' (by user request)
 * Changed: Gallery widgets now apply height:auto to their element; fixes compatibility with some themes
 * Changed: Random galleries should be substantially faster now (1000% or more for large image tables)
 * Fixed:   Complete WPML compatibility
@@ -49,7 +57,7 @@ by Photocrati Media
 * Fixed:   Multisite gallery path tooltip gave a wrong default setting
 * Fixed:   Flush 'all' caches when pope_module_list setting changes
 * Fixed:   Don't enqueue related images css in the admin
-* Fixed:   Basic Slideshows fixes WP creating extraneous <p> element above the slideshow display
+* Fixed:   Basic Slideshows fixes WP creating extraneous P element above the slideshow display
 * Fixed:   Basic Singlepic will now display images marked 'excluded' in the admin
 * Fixed:   Admin pages can now update when the "Save" button text has been translated
 
@@ -831,7 +839,7 @@ Fixed:     Match legacy behaviour when changing gallery path, i.e. don't move fi
 * Added : New filter function to add custom columns
 * Bugfix : Fixed width for Thickbox in Manage gallery
 * Bugfix : fixed width for media upload select box
-* Bugfix : Remove <p> tag in singlepic regex
+* Bugfix : Remove P tag in singlepic regex
 * Bugfix : Correct format of shutter speed
 * Bugfix : Album name in Short code not useable
 
diff --git a/wp-content/plugins/nextgen-gallery/nggallery.php b/wp-content/plugins/nextgen-gallery/nggallery.php
index 6361842e04af73631f1e503c039a3c0a8cda9a45..66b33a18a5865cd5855ff2c17c2408171842bfbd 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.66.27
+ * Version: 2.0.66.29
  * Author: Photocrati Media
  * Plugin URI: http://www.nextgen-gallery.com
  * Author URI: http://www.photocrati.com
@@ -431,7 +431,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.66.27');
+		define('NGG_PLUGIN_VERSION', '2.0.66.29');
 
 		if (!defined('NGG_HIDE_STRICT_ERRORS')) {
 			define('NGG_HIDE_STRICT_ERRORS', TRUE);
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
index fa6df74435f6de861f60575576b29a05a8a5a10b..48d6dcedc6f15b152660fa8da9badc3ffef0ba34 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
@@ -167,27 +167,10 @@ class M_Attach_To_Post extends C_Base_Module
      */
     function substitute_placeholder_imgs($content)
     {
-		// Get some utilities
-		$mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Mapper');
-		$router	= $this->get_registry()->get_utility('I_Router');
-
-		// To match ATP entries we compare the stored url against a generic path
-		// We must check HTTP and HTTPS as well as permalink and non-permalink forms
-		$preview_url = parse_url($router->join_paths(
-			$router->remove_url_segment('index.php', $router->get_base_url('root')),
-			'/nextgen-attach_to_post/preview'
-		));
-        $router->debug = TRUE;
-		$preview_url = preg_quote($preview_url['host'] . $preview_url['path'], '#');
-
-		$alt_preview_url = parse_url($router->join_paths(
-			$router->remove_url_segment('index.php', $router->get_base_url('root')),
-			'index.php/nextgen-attach_to_post/preview'
-		));
-		$alt_preview_url = preg_quote($alt_preview_url['host'] . $alt_preview_url['path'], '#');
-
 		// The placeholder MUST have a gallery instance id
-		if (preg_match_all("#<img.*http(s)?://({$preview_url}|{$alt_preview_url})/id--(\\d+).*\\/>#mi", $content, $matches, PREG_SET_ORDER)) {
+        if (preg_match_all("#<img.*http(s)?://(.*)/" . NGG_ATTACH_TO_POST_SLUG . "/preview/id--(\\d+).*>#mi", $content, $matches, PREG_SET_ORDER))
+        {
+            $mapper = C_Displayed_Gallery_Mapper::get_instance();
 			foreach ($matches as $match) {
 				// Find the displayed gallery
 				$displayed_gallery_id = $match[3];
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php
index 0224642983825df24e86c5547d965d0d308188e0..1a0df1561c8aa12e639bab92d1c3e3f2a1f6a17f 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php
@@ -14,7 +14,8 @@ class A_NextGen_Basic_Singlepic_Controller extends Mixin
         $display_settings = $displayed_gallery->display_settings;
 
         // use this over get_included_entities() so we can display images marked 'excluded'
-        $image = array_shift($displayed_gallery->get_entities(1, FALSE, FALSE, 'both'));
+        $displayed_gallery->skip_excluding_globally_excluded_images = TRUE;
+        $image = array_shift($displayed_gallery->get_entities(1, FALSE, FALSE, 'included'));
 
         if (!$image)
             return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
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 0e49fe4cd4494bc546b72ae66c23981f21fb3a8d..b4d0d11d51784e26b3c4456a248296c5797515b4 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
@@ -626,7 +626,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
 	 * @param type $filename specifies the name of the file
 	 * @return C_Image
 	 */
-	function upload_base64_image($gallery, $data, $filename=FALSE, $image_id=FALSE)
+    function upload_base64_image($gallery, $data, $filename=FALSE, $image_id=FALSE, $override=FALSE)
 	{
         $settings = C_NextGen_Settings::get_instance();
         $memory_limit = intval(ini_get('memory_limit'));
@@ -663,7 +663,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
 
             // Prevent duplicate filenames: check if the filename exists and
             // begin appending '-i' until we find an open slot
-            if (!ini_get('safe_mode') && @file_exists($abs_filename))
+            if (!ini_get('safe_mode') && @file_exists($abs_filename) && !$override)
             {
                 $file_exists = TRUE;
                 $i = 0;
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php
index be163442faff5602f3a3caba88899629e194ad21..225013ee89e4aad6794a1a0be5be435428d2961d 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php
@@ -255,9 +255,9 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
 				$mapper->where(array("{$image_key} NOT IN %s", $this->object->exclusions));
 			}
 
-			// Ensure that no images marked as excluded at the gallery level are
-			// returned
-			$mapper->where(array("exclude = %d", 0));
+			// Ensure that no images marked as excluded at the gallery level are returned
+            if (empty($this->object->skip_excluding_globally_excluded_images))
+			    $mapper->where(array("exclude = %d", 0));
 		}
 
 		// When returns is "excluded", it's a little more complicated as the
@@ -349,8 +349,15 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
         // gallery created by randomly selecting X image ids that are then set as the gallery entity_ids
 		elseif ($this->object->source == 'random_images' && empty($this->object->entity_ids)) {
             $table_name = $mapper->get_table_name();
-            $mapper->_where_clauses[] = " /*NGG_NO_EXTRAS_TABLE*/ `{$image_key}` IN (SELECT `{$image_key}` FROM (SELECT `{$image_key}` FROM `{$table_name}` i ORDER BY RAND() LIMIT {$this->object->maximum_entity_count}) o) /*NGG_NO_EXTRAS_TABLE*/";
-		}
+            $where_clauses = array();
+            $sub_where_sql = '';
+            foreach ($mapper->_where_clauses as $where) {
+                $where_clauses[] = '(' . $where . ')';
+            }
+            if ($where_clauses)
+                $sub_where_sql = 'WHERE ' . implode(' AND ', $where_clauses);
+            $mapper->_where_clauses = array(" /*NGG_NO_EXTRAS_TABLE*/ `{$image_key}` IN (SELECT `{$image_key}` FROM (SELECT `{$image_key}` FROM `{$table_name}` i {$sub_where_sql} ORDER BY RAND() LIMIT {$this->object->maximum_entity_count}) o) /*NGG_NO_EXTRAS_TABLE*/");
+        }
 
 		// Apply a sorting order
 		if ($sort_by)  $mapper->order_by($sort_by, $sort_direction);
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php
index 7bc8060cad228821ed0ebd76d389f561b2c8ad82..5b6cee7afc630ab27efa26c1efd15566fd0076bf 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php
@@ -238,6 +238,9 @@ class M_NextGen_XmlRpc extends C_Base_Module
 		$password   = strval($args[2]);
 		$data		= $args[3];
 		$gallery_id = isset($data['gallery_id']) ? $data['gallery_id'] : $data['gallery'];
+        if (!isset($data['override'])) $data['override'] = FALSE;
+        if (!isset($data['overwrite']))$data['overwrite']= FALSE;
+        $data['override'] = $data['overwrite'];
 
 		// Authenticate the user
 		if ($this->_login($username, $password, $blog_id)) {
@@ -251,7 +254,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
 
 					// Upload the image
 					$storage	= C_Gallery_Storage::get_instance();
-					$image		= $storage->upload_base64_image($gallery, $data['bits'], $data['name'], $data['image_id']);
+                    $image		= $storage->upload_base64_image($gallery, $data['bits'], $data['name'], $data['image_id'], $data['override']);
 					if ($image) {
 						$storage = C_Gallery_Storage::get_instance();
 						$image->imageURL	= $storage->get_image_url($image);
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php
index bd8315e69c97657bfbe9a00b8806383b67550de0..bf3ca546d63b806d306e2fcaf5b8abb9f69b4bf5 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php
@@ -83,7 +83,6 @@ class M_Third_Party_Compat extends C_Base_Module
         add_action('plugins_loaded', array(&$this, 'wpml'), PHP_INT_MAX);
         add_action('plugins_loaded', array(&$this, 'wpml_translation_management'), PHP_INT_MAX);
 
-        add_filter('home_url', array(&$this, 'wpml_home_url'), -1, 4);
         add_filter('headway_gzip', array(&$this, 'headway_gzip'), (PHP_INT_MAX - 1));
         add_filter('ckeditor_external_plugins', array(&$this, 'ckeditor_plugins'), 11);
         add_filter('bp_do_redirect_canonical', array(&$this, 'fix_buddypress_routing'));
@@ -114,38 +113,6 @@ class M_Third_Party_Compat extends C_Base_Module
         M_WordPress_Routing::$_use_old_slugs = FALSE;
     }
 
-    /**
-     * WPML's home_url filter causes a conflict with NextGEN's url generation, but doesn't appear to be necessary for
-     * WPML to function. This is necessary until we properly support WP_CONTENT_URL & WP_PLUGINS_URL.
-     *
-     * @param $url
-     * @param $path
-     * @param $orig_scheme
-     * @param $blog_id
-     * @return mixed
-     */
-    function wpml_home_url($url, $path, $orig_scheme, $blog_id)
-    {
-        if (!class_exists('SitePress'))
-            return $url;
-
-        global $wp_filter;
-
-        if (empty($wp_filter['home_url'][1]))
-            return $url;
-
-        foreach ($wp_filter['home_url'][1] as $id => $filter) {
-            if (!strpos($id, 'home_url'))
-                continue;
-            $object = $filter['function'][0];
-            if (is_object($object) && get_class($object) != 'SitePress')
-                continue;
-            remove_filter('home_url', array($object, 'home_url'), 1);
-        }
-
-        return $url;
-    }
-
     /**
      * CKEditor features a custom NextGEN shortcode generator that unfortunately relies on parts of the NextGEN
      * 1.9x API that has been deprecated in NextGEN 2.0
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php
index eef10b74c2ce1165a1bcfa4783a84caa1f8f9c75..7f906ae9ba47574316bcb2e1784a474ea23ea19a 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php
@@ -8,8 +8,8 @@
  ***/
 class M_WordPress_Routing extends C_Base_Module
 {
-    static $_use_canonical_redirect = NULL;
-    static $_use_old_slugs          = NULL;
+    static $_use_canonical_redirect = TRUE;
+    static $_use_old_slugs          = TRUE;
 
     function define()
 	{
@@ -39,11 +39,9 @@ class M_WordPress_Routing extends C_Base_Module
         // in the restore_request_uri() method
         if (has_action('template_redirect', 'wp_old_slug_redirect')) {
             remove_action( 'template_redirect', 'wp_old_slug_redirect');
-            if (!is_null(self::$_use_canonical_redirect)) self::$_use_old_slugs = TRUE;
         }
         if (has_action('template_redirect', 'redirect_canonical')) {
             remove_action( 'template_redirect', 'redirect_canonical');
-            if (!is_null(self::$_use_canonical_redirect)) self::$_use_canonical_redirect = TRUE;
         }
     }
 
diff --git a/wp-content/plugins/nextgen-gallery/readme.txt b/wp-content/plugins/nextgen-gallery/readme.txt
index 030d1908217e7acabb3cb406acba845584c036a4..7c591bc1954211605da12badf597ba17ef836657 100644
--- a/wp-content/plugins/nextgen-gallery/readme.txt
+++ b/wp-content/plugins/nextgen-gallery/readme.txt
@@ -2,7 +2,7 @@
 Contributors: photocrati
 Tags:gallery,image,images,photo,photos,picture,pictures,slideshow,flash,media,thumbnails,photo-albums,nextgen-gallery,nextgen
 Requires at least: 3.6.1
-Tested up to: 3.9.1
+Tested up to: 4.0
 Stable tag: trunk
 License: GPLv2
 
@@ -60,7 +60,7 @@ NextGEN has been the dominant WordPress gallery plugin for years. As a result, t
 *See <a href="http://www.nextgen-gallery.com/help/" target="_blank">NextGEN Gallery Documentation</a><br>
 *Get <a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10" target="_blank">NextGEN Support</a> via the WordPress.org forums<br>
 *Get <a href="http://www.nextgen-gallery.com/languages/" target="_blank">Translations</a> for your own language<br>
-*See <a href="http://www.photocrati.com/photography-wordpress-themes" target="_blank">WordPress Photography Themes</a> by the same author<br>
+*See <a href="http://www.photocrati.com/wordpress-photography-themes" target="_blank">WordPress Photography Themes</a> by the same author<br>
 *Follow NextGEN Gallery on <a title="Follow NextGEN Gallery on Facebook" href="http://www.facebook.com/NextGENGallery" target="_blank">Facebook</a>, <a title="Follow NextGEN Gallery on Twitter" href="http://twitter.com/NextGENGallery" target="_blank">Twitter</a>, and <a title="Follow NextGEN Gallery on Google +" href="http://plus.google.com/101643895780935290171" target="_blank">Google +</a><br>
 
 
@@ -199,6 +199,14 @@ For more information, feel free to visit the official website for the NextGEN Ga
 
 == Changelog ==
 
+= V2.0.66.29 - 09.17.2014 =
+* NEW:     Added skip_excluding_globally_excluded_images property to displayed gallery objects
+* Fixed:   SQL generation for random image selection
+* Fixed:   Adjust regex for replacing displayed gallery placeholder images
+* Fixed:   Removed filters to home_url needed previously for WMPL compatibility
+* Fixed:   Use canonical redirects when appropriate
+* Fixed:   Ability to override image files using XML-RPC
+
 = V2.0.66.27 - 08.18.2014 =
 * Fixed:   Missing class.frame_communication_option_handerl.php error
 
@@ -233,7 +241,7 @@ For more information, feel free to visit the official website for the NextGEN Ga
 * NEW: 	   Spanish (es_ES) language thanks to Andrew Kurtis at WebHostingHub
 * Changed: Updated Czech language thanks to Separatista; additional thanks to Martin Krizek for the original translation who was mistakenly unaccredited
 * Changed: "Upgrade to Pro" page has new design, advertises for NextGEN Plus
-* Changed: Basic Albums templates now given the image counter <p> element the class 'ngg-album-gallery-image-counter' (by user request)
+* Changed: Basic Albums templates now given the image counter P element the class 'ngg-album-gallery-image-counter' (by user request)
 * Changed: Gallery widgets now apply height:auto to their element; fixes compatibility with some themes
 * Changed: Random galleries should be substantially faster now (1000% or more for large image tables)
 * Fixed:   Complete WPML compatibility
@@ -247,7 +255,7 @@ For more information, feel free to visit the official website for the NextGEN Ga
 * Fixed:   Multisite gallery path tooltip gave a wrong default setting
 * Fixed:   Flush 'all' caches when pope_module_list setting changes
 * Fixed:   Don't enqueue related images css in the admin
-* Fixed:   Basic Slideshows fixes WP creating extraneous <p> element above the slideshow display
+* Fixed:   Basic Slideshows fixes WP creating extraneous P element above the slideshow display
 * Fixed:   Basic Singlepic will now display images marked 'excluded' in the admin
 * Fixed:   Admin pages can now update when the "Save" button text has been translated