From 32ce0d3c6eb7873b3bdec424f9aefa9ec4ab3d40 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Mon, 3 Oct 2011 23:28:47 +0100 Subject: [PATCH] Fixed file saving issue. --- apps/files_texteditor/ajax/loadfile.php | 40 +++++++++++++++++++++++++ apps/files_texteditor/ajax/savefile.php | 21 +++++-------- apps/files_texteditor/js/editor.js | 12 +++++++- 3 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 apps/files_texteditor/ajax/loadfile.php diff --git a/apps/files_texteditor/ajax/loadfile.php b/apps/files_texteditor/ajax/loadfile.php new file mode 100644 index 00000000000..b06b0fa83d2 --- /dev/null +++ b/apps/files_texteditor/ajax/loadfile.php @@ -0,0 +1,40 @@ +. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + + +// Check if we are a user +OC_JSON::checkLoggedIn(); + +// Set the session key for the file we are about to edit. +$path = isset($_GET['path']) ? $_GET['path'] : false; + +if($path){ + $sessionname = md5('oc_file_hash_'.$path); + $filecontents = OC_Filesystem::file_get_contents($path); + OC_Filesystem::update_session_file_hash($sessionname,sha1(htmlspecialchars($filecontents))); + OC_JSON::success(); +} else { + OC_JSON::error(); +} \ No newline at end of file diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php index da3599b96c6..f1a2bafc12b 100644 --- a/apps/files_texteditor/ajax/savefile.php +++ b/apps/files_texteditor/ajax/savefile.php @@ -1,6 +1,6 @@