Skip to content

Commit 47f59b1

Browse files
committed
v3.2.0
1 parent cef9c85 commit 47f59b1

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

php/_basic_tasks.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
session_start();
33
ini_set('display_errors', 1);
44
ini_set('display_startup_errors', 1);
5-
// error_reporting(E_ALL);
6-
error_reporting(0);
5+
error_reporting(E_ALL);
6+
// error_reporting(0);
77
// error_reporting(E_ALL & ~E_NOTICE);
88
ini_set('output_buffering', 'off');
99
ini_set('zlib.output_compression', 0);
@@ -23,13 +23,14 @@
2323
$permissions = 0775;
2424
$today_date = date("Y-m-d");
2525

26-
$file_path = '_settings.php';
26+
$file_path = "_settings.php";
2727
if (!file_exists($file_path)) {
2828
// Create the file and write the PHP tags
2929
$file_content = "<?php\n\n?>";
3030
// 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();
3334
}
3435
else chmod($file_path,$permissions);
3536
}
@@ -4965,14 +4966,26 @@ function recursive_strval($data) {
49654966

49664967
function my_file_put_contents($path,$content) {
49674968
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+
/*
49684983
if(is_writable($path)) {
49694984
file_put_contents($path,$content);
49704985
return;
49714986
}
49724987
else {
49734988
@chmod($path,0777);
4974-
/* $userId = posix_geteuid();
4975-
$userInfo = posix_getpwuid($userId); */
49764989
if(is_writable($path)) {
49774990
file_put_contents($path,$content);
49784991
return OK;
@@ -4986,6 +4999,6 @@ function my_file_put_contents($path,$content) {
49864999
}
49875000
return;
49885001
}
4989-
return;
5002+
return; */
49905003
}
49915004
?>

0 commit comments

Comments
 (0)