• Resolved Mad Max

    (@mad_max)


    Dear Smart Slider staff,
    I’m on WP 4.9.6 and SL 3.2.14-free and I’m trying to import a slider template from your library, but the import stops immediatly, complaining about WP cache folder permissions.
    The real problem here is that library/smarslider/libraries/import.php, on line 25, uses sys_get_temp_dir() to retrieve the path of the temp folder, but this is not reliable because this function does not account for virtualhost-specific modifications to the temp path and/or open_basedir restrictions, tipical of shared host services.

    You should use instead ini_get('upload_tmp_dir') or at least try to use it BEFORE fallback to sys_get_temp_dir():

    
    // attempt to define temp dir as something flexible but reliable
            	
       	$folder = ini_get('upload_tmp_dir');
           	if ($folder && (!is_dir($folder) || !is_readable($folder))) {
           		$folder = '';
           	}
           	if (!$folder && function_exists('sys_get_temp_dir')) {
           		// PHP v5.2.1+
           		// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
           		$folder = sys_get_temp_dir();
           	}
           	
    • This topic was modified 6 years, 5 months ago by Mad Max.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Import templates and tmp folder’ is closed to new replies.