2
2
session_start ();
3
3
ini_set ('display_errors ' , 1 );
4
4
ini_set ('display_startup_errors ' , 1 );
5
- // error_reporting(E_ALL);
6
- error_reporting (0 );
5
+ error_reporting (E_ALL );
6
+ // error_reporting(0);
7
7
// error_reporting(E_ALL & ~E_NOTICE);
8
8
ini_set ('output_buffering ' , 'off ' );
9
9
ini_set ('zlib.output_compression ' , 0 );
23
23
$ permissions = 0775 ;
24
24
$ today_date = date ("Y-m-d " );
25
25
26
- $ file_path = ' _settings.php ' ;
26
+ $ file_path = " _settings.php " ;
27
27
if (!file_exists ($ file_path )) {
28
28
// Create the file and write the PHP tags
29
29
$ file_content = "<?php \n\n?> " ;
30
30
// Write the content to the file
31
- if (my_file_put_contents ($ file_path , $ file_content ) == false ) {
32
- echo "Failed to create the file '_settings.php'. " ; die ();
31
+ if (my_file_put_contents ($ file_path , $ file_content ) == false ) {
32
+ echo "Failed to create the file '_settings.php'. " ;
33
+ die ();
33
34
}
34
35
else chmod ($ file_path ,$ permissions );
35
36
}
@@ -4965,14 +4966,26 @@ function recursive_strval($data) {
4965
4966
4966
4967
function my_file_put_contents ($ path ,$ content ) {
4967
4968
global $ dir , $ bad_settings ;
4969
+ $ bad_settings = FALSE ;
4970
+ $ result = @file_put_contents ($ path ,$ content );
4971
+ if ($ result === false ) {
4972
+ $ error = error_get_last ();
4973
+ echo "<p>Failed to write to the file: " .$ path ;
4974
+ echo "<br />Error: " .$ error ['message ' ]."</p> " ;
4975
+ $ thisfile = str_replace ($ dir ,'' ,$ path );
4976
+ $ type_of_file = type_of_file ($ thisfile );
4977
+ if ($ type_of_file ['type ' ] == "settings " ) {
4978
+ $ bad_settings = TRUE ;
4979
+ }
4980
+ }
4981
+ return ;
4982
+ /*
4968
4983
if(is_writable($path)) {
4969
4984
file_put_contents($path,$content);
4970
4985
return;
4971
4986
}
4972
4987
else {
4973
4988
@chmod($path,0777);
4974
- /* $userId = posix_geteuid();
4975
- $userInfo = posix_getpwuid($userId); */
4976
4989
if(is_writable($path)) {
4977
4990
file_put_contents($path,$content);
4978
4991
return OK;
@@ -4986,6 +4999,6 @@ function my_file_put_contents($path,$content) {
4986
4999
}
4987
5000
return;
4988
5001
}
4989
- return ;
5002
+ return; */
4990
5003
}
4991
5004
?>
0 commit comments