Plugin needs fixes
-
Plugin uses file_exists to check if a directory exists, but it should use is_dir. Additionally, plugin does not cover all scenarios. Here is the fixed code:
function create_tmp_dir() {
$this->tmp_dir = $this->get_plugin_path() . ‘/tmp/’;
if ( ! is_writable( dirname( $this->tmp_dir ) ) ) {
$this->tmp_dir = sys_get_temp_dir() . ‘/’;
if ( ! is_dir( $this->tmp_dir ) ) wp_mkdir_p( $this->tmp_dir );
$this->tmp_dir .= self::nspace . ‘/’;
}
if ( ! is_dir( $this->tmp_dir ) ) wp_mkdir_p( $this->tmp_dir );
}// this file is the interface to the combined CSS file that is written in the WP upload directories
$tmp_dir = ‘tmp/’;
if ( ! is_writable( dirname( $tmp_dir ) ) ) $tmp_dir = sys_get_temp_dir() . ‘/’;$filename = $_SERVER[‘HTTP_HOST’] . ‘-settings.dat’;
$settings_path = $tmp_dir . $filename;if ( ! file_exists( $settings_path ) ) {
$settings_path = $tmp_dir . ‘combine-css/’ . $filename;
}if ( file_exists( $settings_path ) && strlen( $_GET[‘token’] ) == 32 ) {
$settings = file_get_contents( $settings_path );
$settings = unserialize( $settings );
$css_file = $settings[‘upload_path’] . $_GET[‘token’] . ‘.css’;
if ( file_exists( $css_file ) ) {
if ( $settings[‘compress’] == ‘Yes’ && extension_loaded( ‘zlib’ ) ) ob_start( ‘ob_gzhandler’ );
header( “Content-type: text/css” );
readfile( $css_file );
if ( $settings[‘compress’] == ‘Yes’ && extension_loaded( ‘zlib’ ) ) ob_end_flush();
}
}
- The topic ‘Plugin needs fixes’ is closed to new replies.