Check fopen return value. Props Otto42 and pishmishy. fixes #4448
git-svn-id: https://develop.svn.wordpress.org/trunk@8208 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
203257fd4d
commit
c7afa63283
|
@ -43,13 +43,18 @@ case 'update':
|
|||
$newcontent = stripslashes($_POST['newcontent']);
|
||||
$theme = urlencode($theme);
|
||||
if (is_writeable($real_file)) {
|
||||
//is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
|
||||
$f = fopen($real_file, 'w+');
|
||||
if ($f !== FALSE) {
|
||||
fwrite($f, $newcontent);
|
||||
fclose($f);
|
||||
$location = "theme-editor.php?file=$file&theme=$theme&a=te";
|
||||
} else {
|
||||
$location = "theme-editor.php?file=$file&theme=$theme";
|
||||
}
|
||||
} else {
|
||||
$location = "theme-editor.php?file=$file&theme=$theme";
|
||||
}
|
||||
|
||||
$location = wp_kses_no_null($location);
|
||||
$strip = array('%0d', '%0a');
|
||||
|
|
Loading…
Reference in New Issue