Mercurial > hg > mlmmj
changeset 732:b37f66e0852b
Ensure files written by php-admin have Unix EOL and sane permissions
author | Ben Schmidt |
---|---|
date | Sat, 31 Jul 2010 00:28:40 +1000 |
parents | e29893b9f581 |
children | d03fae037eb4 |
files | contrib/web/php-admin/htdocs/save.php |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/web/php-admin/htdocs/save.php Sat Jul 31 00:26:30 2010 +1000 +++ b/contrib/web/php-admin/htdocs/save.php Sat Jul 31 00:28:40 2010 +1000 @@ -39,6 +39,8 @@ { if(!touch($file)) die("Couldn't open ".$file." for writing"); + if (!chmod($file, 0644)) + die("Couldn't chmod ".$file); } else @unlink($file); @@ -60,8 +62,11 @@ if (!$fp = fopen($file, "w")) die("Couldn't open ".$file." for writing"); - fwrite($fp, $HTTP_POST_VARS[$name]); + fwrite($fp, preg_replace('/\\r\\n/',"\n",$HTTP_POST_VARS[$name])); fclose($fp); + + if (!chmod($file, 0644)) + die("Couldn't chmod ".$file); } else @unlink($file);