mirror of
https://github.com/netfun2000/pheditor.git
synced 2026-02-27 09:45:14 +08:00
Add writable file/dir checking
This commit is contained in:
+5
-3
@@ -69,9 +69,11 @@ if (isset($_POST['action'])) {
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
if (isset($_POST['file']) && isset($_POST['data'])) {
|
||||
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . $_POST['file'], $_POST['data']);
|
||||
echo br2nl(highlight_string(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $_POST['file']), true));
|
||||
$file = __DIR__ . DIRECTORY_SEPARATOR . $_POST['file'];
|
||||
|
||||
if (isset($_POST['file']) && isset($_POST['data']) && is_writable($file)) {
|
||||
file_put_contents($file, $_POST['data']);
|
||||
echo br2nl(highlight_string(file_get_contents($file), true));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user