Unyson - Version 2.1.6

Version Description

  • Fixed the "Cannot create temporary directory" error that happened on some servers where the user have no permissions to access files outside the abspath or home directory.
Download this release

Release Info

Developer Unyson
Plugin Icon 128x128 Unyson
Version 2.1.6
Comparing to
See all releases

Code changes from version 2.1.5 to 2.1.6

framework/helpers/class-fw-wp-filesystem.php CHANGED
@@ -169,29 +169,28 @@ class FW_WP_Filesystem
169
 
170
  $wp_filesystem_dir_path = fw_fix_path($wp_filesystem_dir_path);
171
 
172
- $path = '';
173
- $check_if_exists = true;
174
- $loop_counter = 1;
175
- foreach (explode('/', $wp_filesystem_dir_path) as $dir_name) {
176
- if (empty($dir_name)) {
177
- if ($loop_counter === 1) {
178
- /**
179
- * It's a unix style path staring with '/' -> ''
180
- * On windows it starts with 'C:/' -> 'C:'
181
- */
182
- $path = '/';
183
- } else {
184
- trigger_error('Invalid path: '. $wp_filesystem_dir_path, E_USER_WARNING);
185
- return false;
186
- }
187
- } elseif ($loop_counter === 2 && $path === '/') {
188
- // prevent multiple slash prefix '//var/www'
189
- $path = '';
190
- }
191
 
192
- $path .= ($loop_counter === 1 ? '' : '/') . $dir_name;
193
 
194
- $loop_counter++;
 
 
195
 
196
  if ($check_if_exists) {
197
  if ($wp_filesystem->is_dir($path)) {
169
 
170
  $wp_filesystem_dir_path = fw_fix_path($wp_filesystem_dir_path);
171
 
172
+ /**
173
+ * Begin path verification starting with ABSPATH not the root '/' path.
174
+ * On servers where user has permissions only in his home directory.
175
+ * When you try to check a directory (outside home directory) that you have no permissions,
176
+ * the $wp_filesystem->is_dir($path) or $wp_filesystem->exists($path) will always return false.
177
+ */
178
+ $path = fw_fix_path($wp_filesystem->abspath());
179
+
180
+ if (
181
+ $wp_filesystem_dir_path === $path
182
+ ||
183
+ fw_strlen($wp_filesystem_dir_path) < fw_strlen($path)
184
+ ) {
185
+ trigger_error('Cannot create directory outside the abspath: '. $wp_filesystem_dir_path, E_USER_WARNING);
186
+ return false;
187
+ }
 
 
 
188
 
189
+ $abs_rel_path = preg_replace('/^'. preg_quote($path, '/') .'/', '', $wp_filesystem_dir_path);
190
 
191
+ $check_if_exists = true;
192
+ foreach (explode('/', ltrim($abs_rel_path, '/')) as $dir_name) {
193
+ $path .= '/' . $dir_name;
194
 
195
  if ($check_if_exists) {
196
  if ($wp_filesystem->is_dir($path)) {
framework/manifest.php CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
- $manifest['version'] = '2.1.5';
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
+ $manifest['version'] = '2.1.6';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: unyson, themefusecom
3
  Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio
4
  Requires at least: 4.0.0
5
  Tested up to: 4.0.1
6
- Stable tag: 2.1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,9 @@ Yes; Unyson will work with any theme.
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 2.1.5 =
88
  * Added `intval()` to all `wp_remote_retrieve_response_code()`. On some servers this function returns a string instead of int and the `$code === 200` verification fails.
89
 
3
  Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio
4
  Requires at least: 4.0.0
5
  Tested up to: 4.0.1
6
+ Stable tag: 2.1.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 2.1.6 =
88
+ * Fixed the "Cannot create temporary directory" error that happened on some servers where the user have no permissions to access files outside the abspath or home directory.
89
+
90
  = 2.1.5 =
91
  * Added `intval()` to all `wp_remote_retrieve_response_code()`. On some servers this function returns a string instead of int and the `$code === 200` verification fails.
92
 
unyson.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.themefuse.com/
5
  * Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
6
- * Version: 2.1.5
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.themefuse.com/
5
  * Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
6
+ * Version: 2.1.6
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+