Ticket #5984: get_temp_dir.diff
File get_temp_dir.diff, 1.0 KB (added by , 17 years ago) |
---|
-
wp-admin/includes/file.php
42 42 return $real_file; 43 43 } 44 44 45 function get_temp_dir() { 46 if ( defined('WP_TEMP_DIR') ) 47 return trailingslashit(WP_TEMP_DIR); 48 49 $temp = ABSPATH . 'wp-content/'; 50 if ( is_dir($temp) && is_writable($temp) ) 51 return $temp; 52 53 if ( function_exists('sys_get_temp_dir') ) 54 return trailingslashit(sys_get_temp_dir()); 55 56 return '/tmp/'; 57 } 58 45 59 function validate_file( $file, $allowed_files = '' ) { 46 60 if ( false !== strpos( $file, '..' )) 47 61 return 1; … … 182 196 if( ! $url ) 183 197 return false; 184 198 185 $tmpfname = tempnam( '/tmp', 'wpupdate');199 $tmpfname = tempnam(get_temp_dir(), 'wpupdate'); 186 200 if( ! $tmpfname ) 187 201 return false; 188 202 … … 288 302 } 289 303 290 304 function get_filesystem_method() { 291 $tempFile = tempnam( '/tmp', 'WPU');305 $tempFile = tempnam(get_temp_dir(), 'WPU'); 292 306 293 307 if ( getmyuid() == fileowner($tempFile) ) { 294 308 unlink($tempFile);