Commit 5866efac authored by lucha's avatar lucha

[auto] Plugin: nextgen-gallery 2.0.66.27

parent 0736fefa
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)
......
......@@ -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);
......
......@@ -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
......@@ -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)
{
......
......@@ -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');
......
......@@ -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');
......
<?php
class C_Frame_Communication_Option_Handler
{
function get($key, $default='X-Frame-Events')
{
return 'X-Frame-Events';
}
}
\ No newline at end of file
......@@ -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;
}
/**
......
......@@ -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'
);
}
}
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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
......@@ -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
......@@ -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
);
......
......@@ -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()
......
......@@ -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'
));
}
/**
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -203,13 +203,13 @@ p#ngg-inlinebutton {
#ngg-listimages .column-1,
#ngg-listimages .column-2 {