summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/index.php b/index.php
index 3c8ed4a..2a5456f 100644
--- a/index.php
+++ b/index.php
@@ -140,12 +140,18 @@ function do_htaccess( $oldfilename, $newfilename, $realpath, $base, $url )
$htaccess = str_replace( "REALPATH", $realpath, $htaccess );
$htaccess = str_replace( "BASE", $base, $htaccess );
$htaccess = str_replace( "HOST", $url, $htaccess );
- $fp = fopen( $newfilename, "w" );
- if( $fp ) {
- fwrite( $fp, $htaccess );
- fclose( $fp );
+ if( touch( $newfilename ) ) {
+ chmod( $newfilename, 0666 );
+ $fp = fopen( $newfilename, "w" );
+ if( $fp ) {
+ fwrite( $fp, $htaccess );
+ fclose( $fp );
+ } else {
+ $err = "could not open $newfilename for writing";
+ }
+ chmod( $newfilename, 0644 );
} else {
- $err = "could not open $newfilename for writing";
+ $err = "could not open $newfilename for writing";
}
} else {
$err = "could not open $oldfilename for reading";