From b7769e62034f31bd636d4b3eaf5f2de6d1161c56 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 8 May 2012 18:29:03 +0100 Subject: [PATCH] Dealing with fileMDT for new files Don't tack fileMDT onto query string if it's undefined (ie, new files) New file saves then possible if we don't have a fileMDT on query string --- lib/file-control.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index bfd6b3c..b4bf4c6 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -138,8 +138,8 @@ if ($_GET['action']=="save") { $saveFile = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']).$file; $saveFile = str_replace("//","/",$saveFile); if ((file_exists($saveFile) && is_writable($saveFile)) || $_POST['newFileName']!="") { - if (filemtime($saveFile)==$_GET['fileMDT']) { - $fh = fopen($saveFile, 'w') or die("can't open file"); + if (filemtime($saveFile)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) { + $fh = fopen($saveFile, 'w') or die("Sorry, cannot save"); fwrite($fh, $_POST['contents']); fclose($fh); clearstatcache(); @@ -214,7 +214,7 @@ if (action=="load") { } -
+