equal
deleted
inserted
replaced
1783 $target = '/'; |
1783 $target = '/'; |
1784 } |
1784 } |
1785 |
1785 |
1786 if ( file_exists( $target ) ) { |
1786 if ( file_exists( $target ) ) { |
1787 return @is_dir( $target ); |
1787 return @is_dir( $target ); |
|
1788 } |
|
1789 |
|
1790 // Do not allow path traversals. |
|
1791 if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) { |
|
1792 return false; |
1788 } |
1793 } |
1789 |
1794 |
1790 // We need to find the permissions of the parent folder that exists and inherit that. |
1795 // We need to find the permissions of the parent folder that exists and inherit that. |
1791 $target_parent = dirname( $target ); |
1796 $target_parent = dirname( $target ); |
1792 while ( '.' != $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { |
1797 while ( '.' != $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { |