From 5866eface73b0b7c592c58cb44f159dcac6a9a41 Mon Sep 17 00:00:00 2001
From: lucha <lucha@paranoici.org>
Date: Fri, 5 Sep 2014 18:51:03 +0200
Subject: [PATCH] [auto] Plugin: nextgen-gallery 2.0.66.27

---
 .../plugins/nextgen-gallery/changelog.txt     | 12 +++
 .../plugins/nextgen-gallery/nggallery.php     | 32 +++---
 .../non_pope/class.nextgen_settings.php       | 29 +++---
 .../class.photocrati_settings_manager.php     | 41 ++++----
 .../modules/ajax/module.ajax.php              |  7 +-
 .../attach_to_post/module.attach_to_post.php  |  7 +-
 ...ass.frame_communication_option_handler.php |  9 ++
 .../class.frame_event_publisher.php           |  2 +-
 .../module.frame_communication.php            | 17 ++--
 .../modules/fs/class.fs.php                   | 56 +++++++----
 .../modules/mvc/adapter.mvc_fs.php            | 13 ++-
 .../modules/mvc/adapter.mvc_router.php        | 32 +++++-
 .../modules/mvc/class.mvc_option_handler.php  | 17 +++-
 .../modules/mvc/class.mvc_view.php            |  3 +-
 .../modules/mvc/module.mvc.php                | 18 +++-
 .../nextgen_admin/module.nextgen_admin.php    |  7 +-
 .../module.nextgen_basic_album.php            |  2 +-
 .../module.nextgen_basic_gallery.php          |  2 +-
 .../module.nextgen_basic_imagebrowser.php     |  2 +-
 .../module.nextgen_basic_singlepic.php        |  2 +-
 .../module.nextgen_basic_tagcloud.php         |  2 +-
 .../module.nextgen_settings.php               |  2 +-
 .../modules/ngglegacy/admin/css/nggadmin.css  |  6 +-
 .../modules/ngglegacy/admin/js/ngg.ajax.js    | 65 +++++++++----
 .../ngglegacy/admin/js/ngg.progressbar.js     |  1 +
 .../module.third_party_compat.php             | 22 ++++-
 .../adapter.wordpress_router.php              | 97 +++++++++++--------
 .../module.wordpress_routing.php              | 34 +++++--
 wp-content/plugins/nextgen-gallery/readme.txt | 12 +++
 29 files changed, 379 insertions(+), 172 deletions(-)
 create mode 100644 wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_communication_option_handler.php

diff --git a/wp-content/plugins/nextgen-gallery/changelog.txt b/wp-content/plugins/nextgen-gallery/changelog.txt
index ba92a66c5..6afdf2a9c 100644
--- a/wp-content/plugins/nextgen-gallery/changelog.txt
+++ b/wp-content/plugins/nextgen-gallery/changelog.txt
@@ -1,6 +1,18 @@
 NextGEN Gallery
 by Photocrati Media
 
+= V2.0.66.27 - 08.18.2014 =
+* Fixed:   Missing class.frame_communication_option_handerl.php error
+
+= V2.0.66.26 - 08.18.2014 =
+* NEW:     Added fault tolerance to bulk action AJAX requests
+* Changed: Moved some settings from DB to in-memory
+* Fixed:   Compatibility with BuddyPress plugin in multisite environments
+* Fixed:   Ability to find static resources outside of WP_PLUGIN_DIR
+* Fixed:   Autoupdate conflict with Photocrati Theme
+* Fixed:   Workaround GoDaddy's throttling of consecutive AJAX requests
+* Fixed:   Issue with settings manager in multisite enviroments
+
 = V2.0.66.17 - 08.08.2014 =
 * NEW:	   Added french translations
 * Secured: XSS vulnerability in jQuery Plupload Queue (thanks Codevigilant Team)
diff --git a/wp-content/plugins/nextgen-gallery/nggallery.php b/wp-content/plugins/nextgen-gallery/nggallery.php
index df92fdfd0..6361842e0 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.17
+ * Version: 2.0.66.27
  * Author: Photocrati Media
  * Plugin URI: http://www.nextgen-gallery.com
  * Author URI: http://www.photocrati.com
@@ -255,9 +255,7 @@ class C_NextGEN_Bootstrap
         }
 
 		// If the selected stylesheet is using an unsafe path, then notify the user
-		if (C_NextGen_Style_Manager::get_instance()->is_directory_unsafe()) {
-			add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
-		}
+        add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
 
 		// Delete displayed gallery transients periodically
 		add_filter('cron_schedules', array(&$this, 'add_ngg_schedule'));
@@ -358,17 +356,19 @@ class C_NextGEN_Bootstrap
 	 */
 	function display_stylesheet_notice()
 	{
-		$styles		= C_NextGen_Style_Manager::get_instance();
-		$filename	= $styles->get_selected_stylesheet();
-		$abspath	= $styles->find_selected_stylesheet_abspath();
-		$newpath	= $styles->new_dir;
-
-		echo "<div class='updated error'>
-			<h3>WARNING: NextGEN Gallery Stylesheet NOT Upgrade-safe</h3>
-			<p>
-			<strong>{$filename}</strong> is currently stored in <strong>{$abspath}</strong>, which isn't upgrade-safe. Please move the stylesheet to
-			<strong>{$newpath}</strong> to ensure that your customizations persist after updates.
-		</p></div>";
+        if (C_NextGen_Style_Manager::get_instance()->is_directory_unsafe()) {
+            $styles		= C_NextGen_Style_Manager::get_instance();
+            $filename	= $styles->get_selected_stylesheet();
+            $abspath	= $styles->find_selected_stylesheet_abspath();
+            $newpath	= $styles->new_dir;
+
+            echo "<div class='updated error'>
+                <h3>WARNING: NextGEN Gallery Stylesheet NOT Upgrade-safe</h3>
+                <p>
+                <strong>{$filename}</strong> is currently stored in <strong>{$abspath}</strong>, which isn't upgrade-safe. Please move the stylesheet to
+                <strong>{$newpath}</strong> to ensure that your customizations persist after updates.
+            </p></div>";
+        }
 	}
 
 	/**
@@ -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.17');
+		define('NGG_PLUGIN_VERSION', '2.0.66.27');
 
 		if (!defined('NGG_HIDE_STRICT_ERRORS')) {
 			define('NGG_HIDE_STRICT_ERRORS', TRUE);
diff --git a/wp-content/plugins/nextgen-gallery/non_pope/class.nextgen_settings.php b/wp-content/plugins/nextgen-gallery/non_pope/class.nextgen_settings.php
index bb84062b5..42a9be7a2 100644
--- a/wp-content/plugins/nextgen-gallery/non_pope/class.nextgen_settings.php
+++ b/wp-content/plugins/nextgen-gallery/non_pope/class.nextgen_settings.php
@@ -2,28 +2,23 @@
 
 
 if (!class_exists('C_NextGen_Settings')) {
-	class C_NextGen_Settings {
-		static function get_instance()
-		{
+    class C_NextGen_Settings {
+        static function get_instance()
+        {
             return C_Photocrati_Settings_Manager::get_instance();
-		}
-
-		static function add_option_handler($klass, $options=array())
-		{
-			$instance = self::get_instance();
-			return $instance->add_option_handler($klass, $options);
-		}
-	}
+        }
+    }
 }
 
 if (!class_exists('C_NextGen_Global_Settings')) {
-	class C_NextGen_Global_Settings extends C_NextGen_Settings {
-		static function get_instance()
-		{
+    class C_NextGen_Global_Settings extends C_NextGen_Settings {
+        static function get_instance()
+        {
             if (is_multisite())
                 return C_Photocrati_Global_Settings_Manager::get_instance();
-            else
+            else {
                 return C_Photocrati_Settings_Manager::get_instance();
-		}
-	}
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_settings_manager.php b/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_settings_manager.php
index fb90931c7..d2c3e4ed4 100644
--- a/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_settings_manager.php
+++ b/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_settings_manager.php
@@ -64,11 +64,12 @@ if (!class_exists('C_Photocrati_Settings_Manager_Base')) {
 		{
 			$retval = $default;
 
-			if (isset($this->_options[$key]))
-				$retval =  $this->_options[$key];
-			elseif (($handler = $this->_get_option_handler($key, 'get'))) {
-				$retval = $handler->get($key, $default);
-			}
+            if (($handler = $this->_get_option_handler($key, 'get'))) {
+                $retval = $handler->get($key, $default);
+            }
+            else if (isset($this->_options[$key])) {
+                $retval =  $this->_options[$key];
+            }
 
 			// In case a stdObject has been passed in as a value, we
 			// want to only return scalar values or arrays
@@ -224,14 +225,14 @@ if (!class_exists('C_Photocrati_Settings_Manager_Base')) {
 if (!class_exists('C_Photocrati_Global_Settings_Manager')) {
 	class C_Photocrati_Global_Settings_Manager extends C_Photocrati_Settings_Manager_Base
 	{
+        static $_instance = NULL;
 		public static function get_instance()
 		{
-			static $_instance = NULL;
-			if (is_null($_instance)) {
-				$klass = get_class();
-				$_instance = new $klass();
-			}
-			return $_instance;
+            if (is_null(self::$_instance)) {
+                $klass = get_class();
+                self::$_instance = new $klass();
+            }
+            return self::$_instance;
 		}
 
 		function save()
@@ -257,15 +258,15 @@ if (!class_exists('C_Photocrati_Global_Settings_Manager')) {
 if (!class_exists('C_Photocrati_Settings_Manager')) {
 	class C_Photocrati_Settings_Manager extends C_Photocrati_Settings_Manager_Base
 	{
-		public static function get_instance()
-		{
-			static $_instance = NULL;
-			if (is_null($_instance)) {
-				$klass = get_class();
-				$_instance = new $klass();
-			}
-			return $_instance;
-		}
+        static $_instance = NULL;
+        public static function get_instance()
+        {
+            if (is_null(self::$_instance)) {
+                $klass = get_class();
+                self::$_instance = new $klass();
+            }
+            return self::$_instance;
+        }
 
 		function get($key, $default=NULL)
 		{
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/module.ajax.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/module.ajax.php
index a9c6589bf..263716933 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/module.ajax.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/module.ajax.php
@@ -21,11 +21,16 @@ class M_Ajax extends C_Base_Module
 		);
 
 		include_once('class.ajax_option_handler.php');
-		C_NextGen_Settings::add_option_handler('C_Ajax_Option_Handler', array(
+		C_NextGen_Settings::get_instance()->add_option_handler('C_Ajax_Option_Handler', array(
 			'ajax_slug',
 			'ajax_url',
 			'ajax_js_url'
 		));
+        if (is_multisite()) C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Ajax_Option_Handler', array(
+            'ajax_slug',
+            'ajax_url',
+            'ajax_js_url'
+        ));
 
 		include_once('class.ajax_installer.php');
 		C_Photocrati_Installer::add_handler($this->module_id, 'C_Ajax_Installer');
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 dcf335945..fa6df7443 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
@@ -31,11 +31,16 @@ class M_Attach_To_Post extends C_Base_Module
 		);
 
 		include_once('class.attach_to_post_option_handler.php');
-		C_NextGen_Settings::add_option_handler('C_Attach_To_Post_Option_Handler', array(
+		C_NextGen_Settings::get_instance()->add_option_handler('C_Attach_To_Post_Option_Handler', array(
 			'attach_to_post_url',
 			'gallery_preview_url',
 			'attach_to_post_display_tab_js_url'
 		));
+        if (is_multisite()) C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Attach_To_Post_Option_Handler', array(
+            'attach_to_post_url',
+            'gallery_preview_url',
+            'attach_to_post_display_tab_js_url'
+        ));
 
 		include_once('class.attach_to_post_installer.php');
 		C_Photocrati_Installer::add_handler($this->module_id, 'C_Attach_To_Post_Installer');
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_communication_option_handler.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_communication_option_handler.php
new file mode 100644
index 000000000..150c8fae9
--- /dev/null
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_communication_option_handler.php
@@ -0,0 +1,9 @@
+<?php
+
+class C_Frame_Communication_Option_Handler
+{
+    function get($key, $default='X-Frame-Events')
+    {
+        return 'X-Frame-Events';
+    }
+}
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php
index 63a15508d..d798fd00f 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php
@@ -15,7 +15,7 @@ class C_Frame_Event_Publisher extends C_Component
 	function initialize()
 	{
 		parent::initialize();
-		$this->setting_name = C_NextGen_Settings::get_instance()->frame_communication_option_name;
+		$this->setting_name = C_NextGen_Settings::get_instance()->frame_event_cookie_name;
 	}
 
 	/**
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php
index 16421bf38..6d736f977 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php
@@ -15,15 +15,20 @@ class M_Frame_Communication extends C_Base_Module
 			'photocrati-frame_communication',
 			'Frame/iFrame Inter-Communication',
 			'Provides a means for HTML frames to share server-side events with each other',
-			'0.3',
+			'0.4',
 			'http://www.nextgen-gallery.com',
 			'Photocrati Media',
 			'http://www.photocrati.com',
 			$context
 		);
 
-		include_once('class.frame_communication_installer.php');
-		C_Photocrati_Installer::add_handler($this->module_id, 'C_Frame_Communication_Installer');
+        include_once('class.frame_communication_option_handler.php');
+        C_NextGen_Settings::get_instance()->add_option_handler('C_Frame_Communication_Option_Handler', array(
+           'frame_event_cookie_name',
+        ));
+        C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Frame_Communication_Option_Handler', array(
+            'frame_event_cookie_name',
+        ));
 	}
 
 	function _register_utilities()
@@ -56,9 +61,9 @@ class M_Frame_Communication extends C_Base_Module
     function get_type_list()
     {
         return array(
-            'C_Frame_Communication_Installer'	=> 'class.frame_communication_installer.php',
-            'C_Frame_Event_Publisher' 			=> 'class.frame_event_publisher.php',
-            'I_Frame_Event_Publisher' 			=> 'interface.frame_event_publisher.php'
+            'C_Frame_Communication_Option_Handler'	=> 'class.frame_communication_option_handler.php',
+            'C_Frame_Event_Publisher' 			    => 'class.frame_event_publisher.php',
+            'I_Frame_Event_Publisher' 			    => 'interface.frame_event_publisher.php'
         );
     }
 }
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/class.fs.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/class.fs.php
index fa92d28e4..c2c1464ce 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/class.fs.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/class.fs.php
@@ -336,33 +336,51 @@ class Mixin_Fs_Instance_Methods extends Mixin
 	 * Gets the document root for this application
 	 * @return string
 	 */
-	function get_document_root($type = 'root')
-	{
-        if ($type == 'plugins') {
-            $retval = WP_PLUGIN_DIR;
-        }
-        else if ($type == 'content') {
-            $retval = WP_CONTENT_DIR;
-        }
-        else if ($type == 'gallery') {
-            $root_type = defined('NGG_GALLERY_ROOT_TYPE') ? NGG_GALLERY_ROOT_TYPE : 'site';
-            if ($root_type == 'content')
+    function get_document_root($type = 'root')
+    {
+        $retval = NULL;
+
+        switch ($type) {
+            case 'plugins':
+            case 'plugin':
+                $retval = WP_PLUGIN_DIR;
+                break;
+            case 'plugins_mu':
+            case 'plugin_mu':
+                $retval = WPMU_PLUGIN_DIR;
+                break;
+            case 'templates':
+            case 'template':
+            case 'themes':
+            case 'theme':
+                $retval = get_template_directory();
+                break;
+            case 'styles':
+            case 'style':
+            case 'stylesheets':
+            case 'stylesheet':
+                $retval = get_stylesheet_directory();
+                break;
+            case 'content':
                 $retval = WP_CONTENT_DIR;
-            else
+                break;
+            case 'gallery':
+            case 'galleries':
+                $root_type = defined('NGG_GALLERY_ROOT_TYPE') ? NGG_GALLERY_ROOT_TYPE : 'site';
+                if ($root_type == 'content')
+                    $retval = WP_CONTENT_DIR;
+                else
+                    $retval = $this->_document_root;
+                break;
+            default:
                 $retval = $this->_document_root;
         }
-        else if (empty($type) || $type == 'root') {
-            $retval = $this->_document_root;
-        }
-        else {
-            $retval = $this->_document_root;
-        }
 
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
             $retval = str_replace('/', DIRECTORY_SEPARATOR, $retval);
 
         return $retval;
-	}
+    }
 
 	/**
 	 * Sets the document root for this application
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php
index 628084059..208379694 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php
@@ -26,7 +26,18 @@ class A_MVC_Fs extends Mixin
 
 		// Get the relative path, if asked. Skip when docroot=/ lest we generate url like
         // wp-contentpluginsnextgen-galleryproducts..
-		if ($relative) $path = str_replace($fs->get_document_root('plugins'), '', $path);
+		if ($relative) {
+            $original_length = strlen($path);
+            $roots = array('plugins', 'plugins_mu', 'templates', 'stylesheets');
+            $found_root = FALSE;
+            foreach ($roots as $root) {
+                $path = str_replace($this->object->get_document_root($root), '', $path);
+                if (strlen($path) != $original_length) {
+                    $found_root = $root;
+                    break;
+                }
+            }
+        }
 
 		return $path;
 	}
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_router.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_router.php
index 59a488215..58d0e2a6f 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_router.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/adapter.mvc_router.php
@@ -10,16 +10,40 @@ class A_MVC_Router extends Mixin
 	 */
 	function get_static_url($path, $module=FALSE)
 	{
+        $retval = '';
+
 		// Determine the base url
 		$base_url = $this->object->get_base_url('plugins');
 		$base_url = $this->object->remove_url_segment('/index.php', $base_url);
 
 		// Find the module directory
 		$fs = $this->object->get_registry()->get_utility('I_Fs');
+        $path = $fs->find_static_abspath($path, $module);
+
+
+        // Convert the path to a relative path
+        $original_length = strlen($path);
+        $roots = array('plugins', 'plugins_mu', 'templates', 'stylesheets');
+        $found_root = FALSE;
+        foreach ($roots as $root) {
+            $path = str_replace($fs->get_document_root($root), '', $path);
+            if (strlen($path) != $original_length) {
+                $found_root = $root;
+                break;
+            }
+        }
+
+        if ($found_root) {
+            $retval = $this->object->join_paths(
+                $this->object->get_base_url($found_root),
+                str_replace("\\", '/', $path)
+            );
+        }
+
+        else {
+            //TODO: What do we do here?
+        }
 
-        return $this->join_paths(
-            $base_url,
-            str_replace("\\", '/', $fs->find_static_abspath($path, $module, TRUE))
-        );
+        return $retval;
 	}
 }
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_option_handler.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_option_handler.php
index e87b1f7c7..7acd567df 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_option_handler.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_option_handler.php
@@ -3,7 +3,20 @@
 class C_Mvc_Option_Handler
 {
 	function get($option, $default=NULL)
-	{
-        return implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'templates'));
+    {
+        $retval = $default;
+
+        switch ($option) {
+            case 'mvc_template_dir':
+            case 'mvc_template_dirname':
+                $retval = '/templates';
+                break;
+            case 'mvc_static_dirname':
+            case 'mvc_static_dir':
+                $retval = '/static';
+                break;
+        }
+
+        return $retval;
 	}
 }
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_view.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_view.php
index 6276d068c..674dbe838 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_view.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/class.mvc_view.php
@@ -240,8 +240,7 @@ class Mixin_Mvc_View_Instance_Methods extends Mixin
        $path = $path . '.php';
 
 	   $retval = $fs->join_paths(
-		 $fs->get_document_root('plugins'),
-		 $this->object->get_registry()->get_module_dir($module),
+         $this->object->get_registry()->get_module_dir($module),
 		 $settings->mvc_template_dirname,
 		 $path
 	   );
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/module.mvc.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/module.mvc.php
index 1106f7199..65884e5af 100755
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/module.mvc.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/module.mvc.php
@@ -27,13 +27,21 @@ class M_MVC extends C_Base_Module
             "http://www.photocrati.com"
         );
 
-		include_once('class.mvc_installer.php');
-		C_Photocrati_Installer::add_handler($this->module_id, 'C_Mvc_Installer');
-
 		include_once('class.mvc_option_handler.php');
-		C_NextGen_Settings::add_option_handler('C_Mvc_Option_Handler', array(
-			'mvc_template_dir'
+		C_NextGen_Settings::get_instance()->add_option_handler('C_Mvc_Option_Handler', array(
+            'mvc_template_dir',
+            'mvc_template_dirname',
+            'mvc_static_dir',
+            'mvc_static_dirname'
 		));
+
+        if (is_multisite()) C_NextGen_Global_Settings::get_instance()->add_option_handler('C_Mvc_Option_Handler', array(
+            'mvc_template_dir',
+            'mvc_template_dirname',
+            'mvc_static_dir',
+            'mvc_static_dirname'
+        ));
+
     }
 
     function _register_utilities()
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php
index cc4dd594e..0e1cbd186 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php
@@ -29,11 +29,16 @@ class M_NextGen_Admin extends C_Base_Module
 		C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Admin_Installer');
 
 		include_once('class.nextgen_admin_option_handler.php');
-		C_NextGen_Settings::add_option_handler('C_NextGen_Admin_Option_Handler', array(
+		C_NextGen_Settings::get_instance()->add_option_handler('C_NextGen_Admin_Option_Handler', array(
 			'jquery_ui_theme',
 			'jquery_ui_theme_version',
 			'jquery_ui_theme_url'
 		));
+        if (is_multisite()) C_NextGen_Global_Settings::get_instance()->add_option_handler('C_NextGen_Admin_Option_Handler', array(
+            'jquery_ui_theme',
+            'jquery_ui_theme_version',
+            'jquery_ui_theme_url'
+        ));
 	}
 
 	/**
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php
index f84838fa5..56f075725 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php
@@ -18,7 +18,7 @@ class M_NextGen_Basic_Album extends C_Base_Module
             'photocrati-nextgen_basic_album',
             'NextGEN Basic Album',
             "Provides support for NextGEN's Basic Album",
-            '0.7',
+            '0.9',
             'http://nextgen-gallery.com',
             'Photocrati Media',
             'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php
index c7a97273d..409f8d474 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php
@@ -25,7 +25,7 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
             'photocrati-nextgen_basic_gallery',
             'NextGEN Basic Gallery',
             "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
-            '0.9',
+            '0.11',
             'http://www.nextgen-gallery.com',
             'Photocrati Media',
             'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php
index fa4f8998a..03e9fdeaa 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php
@@ -19,7 +19,7 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
 			'photocrati-nextgen_basic_imagebrowser',
 			'NextGEN Basic ImageBrowser',
 			'Provides the NextGEN Basic ImageBrowser Display Type',
-            '0.7',
+            '0.9',
 			'http://www.nextgen-gallery.com',
 			'Photocrati Media',
 			'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php
index 68ef02375..e7e8f7801 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php
@@ -17,7 +17,7 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
             NGG_BASIC_SINGLEPIC,
             'NextGen Basic Singlepic',
             'Provides a singlepic gallery for NextGEN Gallery',
-            '0.7',
+            '0.9',
             'http://www.photocrati.com',
             'Photocrati Media',
             'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php
index 9a6bb2b43..9b7aa58eb 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php
@@ -17,7 +17,7 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
 			NGG_BASIC_TAGCLOUD,
             'NextGen Basic Tagcloud',
             'Provides a tagcloud for NextGEN Gallery',
-            '0.7',
+            '0.9',
             'http://www.photocrati.com',
             'Photocrati Media',
             'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php
index a73a78725..a6256b1a8 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php
@@ -17,7 +17,7 @@ class M_NextGen_Settings extends C_Base_Module
 			'photocrati-nextgen_settings',
 			'NextGEN Gallery Settings',
 			'Provides central management for NextGEN Gallery settings',
-			'0.5',
+			'0.8',
 			'http://www.nextgen-gallery.com',
 			'Photocrati Media',
 			'http://www.photocrati.com'
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/css/nggadmin.css b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/css/nggadmin.css
index cb0202fad..5bc71c37f 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/css/nggadmin.css
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/css/nggadmin.css
@@ -203,13 +203,13 @@ p#ngg-inlinebutton {
 
 #ngg-listimages .column-1,
 #ngg-listimages .column-2 {
-	width: 3%;
-	min-width: 33px;
+	width: 4%;
+    min-width: 33px;
 }
 
 #ngg-listimages .column-3 {
 	min-width: 80px;
-	width: 8%;
+	width: 10%;
 }
 
 #ngg-listimages .column-3 .thumb {
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js
index 42ba93f67..cd7c2e2f2 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js
@@ -16,7 +16,10 @@ nggAjax = {
 			permission: nggAjaxSetup.permission,
 			error: nggAjaxSetup.error,
 			failure: nggAjaxSetup.failure,
-			timeout: 10000
+			timeout: 20000,
+            retries: 0,
+            max_retries: 5,
+            retry_delay: 30000
 		},
 	
 		run: function( index ) {
@@ -24,7 +27,7 @@ nggAjax = {
 			var req = $.ajax({
 				type: "POST",
 			   	url: s.url,
-			   	data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
+			   	data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index] + "&retries="+nggAjax.settings.retries,
 			   	cache: false,
 			   	timeout: 30000,
 			   	success: function(msg){
@@ -45,22 +48,48 @@ nggAjax = {
 			   		}
 
 			    },
-			    error: function (jqXHR, textStatus, errorThrown) {
-			    	var msg = jqXHR.responseText;
-			    	
-			    	if (msg == '') {
-			    		msg = '( ' + errorThrown + ' )';
-			    	}
-					nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg);
-				},
-				complete: function () {
-					index++;
-					nggProgressBar.increase( index );
-					// parse the whole array
-					if (index < nggAjax.settings.ids.length)
-						nggAjax.run( index );
-					else 
-						nggProgressBar.finished();
+                error: function(jqXHR, textStatus, errorThrown) {
+                    nggAjax.settings.errorThrown = errorThrown;
+                },
+				complete: function (jqXHR, textStatus) {
+                    index++;
+
+                    if (index < nggAjax.settings.ids.length) {
+                        var run = true;
+
+                        if (textStatus == 'error' || textStatus == 'abort') {
+                            nggAjax.settings.retries += 1;
+                            if (nggAjax.settings.retries <= nggAjax.settings.max_retries) {
+                                var seconds = nggAjax.settings.retry_delay / 1000;
+                                index--;
+                                run = false;
+                                nggProgressBar.addNote("<strong>ID " + nggAjax.settings.ids[length] + ":</strong> " + "Retrying in " + seconds + " seconds; host might be throttling.");
+                                setTimeout(function(){
+                                    nggAjax.run( index );
+                                }, nggAjax.settings.retry_delay);
+                            }
+                            else {
+                                var msg = jqXHR.responseText;
+                                if (msg == '') {
+                                    msg = '( ' + nggAjax.settings.errorThrown + ' )';
+                                }
+                                nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg);
+                                nggProgressBar.increase(index);
+                            }
+
+                        }
+                        else {
+                            nggAjax.settings.retries = 0;
+                            nggProgressBar.increase(index);
+                        }
+
+                        if (run) nggAjax.run( index );
+                    }
+
+                    // Done processing
+                    else {
+                        nggProgressBar.finished();
+                    }
 				} 
 			});
 		},
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.progressbar.js b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.progressbar.js
index 14f0838ed..b965e6d1d 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.progressbar.js
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.progressbar.js
@@ -108,6 +108,7 @@
 			var progressBar = this;
 			if (s.wait) {
                 $("#" + s.id).delay(1000).hide("slow");
+                progressBar.addNote("Done!");
 				div.click(function () {
 					progressBar.remove_dialog(false, 0);
 	    		});
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 ab7ba4793..bd8315e69 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
@@ -86,14 +86,34 @@ class M_Third_Party_Compat extends C_Base_Module
         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', '__return_false');
+        add_filter('bp_do_redirect_canonical', array(&$this, 'fix_buddypress_routing'));
         add_filter('the_content', array(&$this, 'check_weaverii'), -(PHP_INT_MAX-2));
         add_action('wp', array(&$this, 'check_for_jquery_lightbox'));
 
+        // WPML fix
+        if (class_exists('SitePress')) {
+            M_WordPress_Routing::$_use_canonical_redirect = FALSE;
+            M_WordPress_Routing::$_use_old_slugs = FALSE;
+            add_action('template_redirect', array(&$this, 'fix_wpml_canonical_redirect'), 1);
+        }
+
         // TODO: Only needed for NGG Pro 1.0.10 and lower
         add_action('the_post', array(&$this, 'add_ngg_pro_page_parameter'));
     }
 
+    function fix_buddypress_routing()
+    {
+        M_WordPress_Routing::$_use_canonical_redirect = FALSE;
+
+        return FALSE;
+    }
+
+    function fix_wpml_canonical_redirect()
+    {
+        M_WordPress_Routing::$_use_canonical_redirect = FALSE;
+        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.
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php
index 4c2c69718..4ecec9e3a 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php
@@ -71,51 +71,72 @@ class A_WordPress_Router extends Mixin
 
     function get_base_url($site_url = FALSE)
     {
-        $retval    = NULL;
-        $add_index = TRUE;
+        $retval             = NULL;
+        $add_index_dot_php  = TRUE;
 
-        if ($site_url === TRUE || $site_url === 'site')
-        {
-            $retval = site_url();
-        }
-        else if ($site_url === FALSE || $site_url === 'home') {
-            $retval = home_url();
-        }
-        else if ($site_url === 'plugins') {
-            $retval = plugins_url();
-            $add_index = FALSE;
-        }
-        else if ($site_url === 'content') {
-            $retval = content_url();
-            $add_index = FALSE;
-        }
-        else if ($site_url === 'root') {
-            $retval = get_option('home');
-            if (is_ssl())
-                $scheme = 'https';
-            else
-                $scheme = parse_url($retval, PHP_URL_SCHEME);
-            $retval = set_url_scheme($retval, $scheme);
-        }
-        else if ($site_url === 'gallery') {
-            $add_index = FALSE;
-            $root_type = defined('NGG_GALLERY_ROOT_TYPE') ? NGG_GALLERY_ROOT_TYPE : 'site';
-            if ($root_type === 'content')
+        switch ($site_url) {
+            case $site_url === TRUE:
+            case 'site':
+                $retval = site_url();
+                break;
+            case $site_url === FALSE:
+            case 'home':
+                $retval = home_url();
+                break;
+            case 'plugins':
+            case 'plugin':
+                $retval = plugins_url();
+                $add_index_dot_php = FALSE;
+                break;
+            case 'plugins_mu':
+            case 'plugin_mu':
+                $retval = WPMU_PLUGIN_URL;
+                $retval = set_url_scheme($retval);
+                $retval = apply_filters( 'plugins_url', $retval, '', '');
+                $add_index_dot_php = FALSE;
+                break;
+            case 'templates':
+            case 'template':
+            case 'themes':
+            case 'theme':
+                $retval = get_template_directory_uri();
+                $add_index_dot_php = FALSE;
+                break;
+            case 'styles':
+            case 'style':
+            case 'stylesheets':
+            case 'stylesheet':
+                $retval = get_stylesheet_directory_uri();
+                $add_index_dot_php = FALSE;
+                break;
+            case 'content':
                 $retval = content_url();
-            else
+                $add_index_dot_php = FALSE;
+                break;
+            case 'root':
+                $retval = get_option('home');
+                if (is_ssl())
+                    $scheme = 'https';
+                else
+                    $scheme = parse_url($retval, PHP_URL_SCHEME);
+                $retval = set_url_scheme($retval, $scheme);
+                break;
+            case 'gallery':
+            case 'galleries':
+                $root_type = defined('NGG_GALLERY_ROOT_TYPE') ? NGG_GALLERY_ROOT_TYPE : 'site';
+                $add_index_dot_php = FALSE;
+                if ($root_type === 'content')
+                    $retval = content_url();
+                else
+                    $retval = site_url();
+                break;
+            default:
                 $retval = site_url();
         }
-        else {
-            $retval = home_url();
-        }
 
-        if ($add_index)
+        if ($add_index_dot_php)
             $retval = $this->_add_index_dot_php_to_url($retval);
 
-        // in case the user's home/site/content/plugins_url constant does not contain their domain
-        if (!parse_url($retval, PHP_URL_HOST))
-            $retval = 'http://' . $_SERVER['SERVER_NAME'] . $retval;
-
         if ($this->object->is_https())
             $retval = preg_replace('/^http:\\/\\//i', 'https://', $retval, 1);
 
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 1082afe53..eef10b74c 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,7 +8,10 @@
  ***/
 class M_WordPress_Routing extends C_Base_Module
 {
-	function define()
+    static $_use_canonical_redirect = NULL;
+    static $_use_old_slugs          = NULL;
+
+    function define()
 	{
 		parent::define(
 			'photocrati-wordpress_routing',
@@ -27,12 +30,23 @@ class M_WordPress_Routing extends C_Base_Module
         $this->get_registry()->add_adapter('I_Routing_App', 'A_WordPress_Routing_App');
 	}
 
-	function _register_hooks()
-	{
-        remove_action( 'template_redirect', 'wp_old_slug_redirect');
-        remove_action( 'template_redirect', 'redirect_canonical');
-		add_action('template_redirect', array(&$this, 'restore_request_uri'), 1);
-	}
+    function _register_hooks()
+    {
+        add_action('template_redirect', array(&$this, 'restore_request_uri'), 1);
+
+        // These two things cause conflicts in NGG. So we temporarily
+        // disable them and then reactivate them, if they were used,
+        // 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;
+        }
+    }
+
 
     /**
      * When WordPress sees a url like http://foobar.com/nggallery/page/2/, it thinks that it is an
@@ -46,9 +60,9 @@ class M_WordPress_Routing extends C_Base_Module
             $_SERVER['UNENCODED_URL'] = $_SERVER['HTTP_X_ORIGINAL_URL'] = $_SERVER['REQUEST_URI'] = $request_uri;
 		}
         // this is the proper behavior but it causes problems with WPML
-        else if (!class_exists('SitePress')) {
-            wp_old_slug_redirect();
-            redirect_canonical();
+        else {
+            if (self::$_use_old_slugs) wp_old_slug_redirect();
+            if (self::$_use_canonical_redirect) redirect_canonical();
         }
 	}
 
diff --git a/wp-content/plugins/nextgen-gallery/readme.txt b/wp-content/plugins/nextgen-gallery/readme.txt
index 731960d84..030d19082 100644
--- a/wp-content/plugins/nextgen-gallery/readme.txt
+++ b/wp-content/plugins/nextgen-gallery/readme.txt
@@ -199,6 +199,18 @@ For more information, feel free to visit the official website for the NextGEN Ga
 
 == Changelog ==
 
+= V2.0.66.27 - 08.18.2014 =
+* Fixed:   Missing class.frame_communication_option_handerl.php error
+
+= V2.0.66.26 - 08.18.2014 =
+* NEW:     Added fault tolerance to bulk action AJAX requests
+* Changed: Moved some settings from DB to in-memory
+* Fixed:   Compatibility with BuddyPress plugin in multisite environments
+* Fixed:   Ability to find static resources outside of WP_PLUGIN_DIR
+* Fixed:   Autoupdate conflict with Photocrati Theme
+* Fixed:   Workaround GoDaddy's throttling of consecutive AJAX requests
+* Fixed:   Issue with settings manager in multisite enviroments
+
 = V2.0.66.17 - 08.08.2014 =
 * NEW:	   Added french translations
 * Secured: XSS vulnerability in jQuery Plupload Queue (thanks Codevigilant Team)
-- 
GitLab