# HG changeset patch # User Ben Schmidt # Date 1280500120 -36000 # Node ID b37f66e0852bb811b6a5857e0ce20fca2723dcdc # Parent e29893b9f5810275da91bd67bd091858f283f995 Ensure files written by php-admin have Unix EOL and sane permissions diff -r e29893b9f581 -r b37f66e0852b contrib/web/php-admin/htdocs/save.php --- 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);