Changeset 2019
- Timestamp:
- 12/30/2004 06:05:46 PM (18 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r2006 r2019 761 761 } 762 762 763 function validate_file($file, $allowed_files = '') { 764 if ( false !== strpos($file, './')) 765 return 1; 766 767 if (':' == substr($file,1,1)) 768 return 2; 769 770 if ( !empty($allowed_files) && (! in_array($file, $allowed_files)) ) 771 return 3; 772 773 return 0; 774 } 775 763 776 function validate_file_to_edit($file, $allowed_files = '') { 764 if ('..' == substr($file,0,2)) 777 $file = stripslashes($file); 778 779 $code = validate_file($file, $allowed_files); 780 781 if (! $code) 782 return $file; 783 784 switch ($code) { 785 case 1: 765 786 die (__('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.')); 766 787 767 if (':' == substr($file,1,1))788 case 2: 768 789 die (__('Sorry, can’t call files with their real path.')); 769 790 770 if ( !empty($allowed_files) && (! in_array($file, $allowed_files)) ) {791 case 3: 771 792 die (__('Sorry, that file cannot be edited.')); 772 793 } 773 774 $file = stripslashes($file);775 776 return $file;777 794 } 778 795 -
trunk/wp-admin/admin.php
r1983 r2019 43 43 if (isset($_GET['page'])) { 44 44 $plugin_page = plugin_basename($_GET['page']); 45 if ( ! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) {46 die( sprintf(__('Cannot load %s.'), $plugin_page));45 if ( validate_file($plugin_page) ) { 46 die(__('Invalid plugin page')); 47 47 } 48 48 49 if (! isset($_GET['noheader'])) { 49 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) 50 die(sprintf(__('Cannot load %s.'), $plugin_page)); 51 52 if (! isset($_GET['noheader'])) 50 53 require_once(ABSPATH . '/wp-admin/admin-header.php'); 51 }52 54 53 55 include(ABSPATH . "wp-content/plugins/$plugin_page");
Note: See TracChangeset
for help on using the changeset viewer.