diff --git a/ifm.php b/ifm.php
index e7f0d75..d8456b9 100644
--- a/ifm.php
+++ b/ifm.php
@@ -32,21 +32,17 @@ $config = array( // 0 = no/not allowed;; 1 = yes/allowed;; default: no/forbidden
"showhtdocs" => 1, // show .htaccess and .htpasswd
"showhiddenfiles" => 1, // show files beginning with a dot (e.g. ".bashrc")
// general config
- "codemirror" => 1, // implement codemirror
"defaulttimezone" => "Europe/Berlin", // set default timezone
);
+/****************************************************************************************
-$curVersion = '0.2.2 (alpha)';
+DONT CHANGE ANYTHING BELOW!
+****************************************************************************************/
+$curVersion = '0.2.5 (alpha)';
/****************************************************************************************
PHP API - SECTION
****************************************************************************************/
-// provide pictures, which are static (other pictures are provided in the IFM JavaScript object)
-// the picture function is located at the end of the script (PHP Misc - Section)
-if(isset($_GET["pic"])) {
- header('Content-type: image/png'); header('Cache-Control: public, store, cache'); echo picture($_GET["pic"]);
- die();
-}
// API Switch
// decides if the script should work as an API which returns JSON
if(isset($_POST["api"])) {
@@ -207,7 +203,9 @@ function getContent(array $d) {
else {
chDirIfNecessary($d['dir']);
if(file_exists($d['filename'])) {
- echo json_encode(array("status"=>"OK", "data"=>array("filename"=>$d['filename'], "content"=>htmlspecialchars(@file_get_contents($d['filename']), ENT_QUOTES))));
+ $content = @file_get_contents($d['filename']);
+ $utf8content = mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
+ echo json_encode(array("status"=>"OK", "data"=>array("filename"=>$d['filename'], "content"=>$utf8content)));
} else echo json_encode(array("status"=>"ERROR", "message"=>"File not found"));
}
}
@@ -342,7 +340,7 @@ function uploadFile(array $d) {
if($_FILES['file']['tmp_name']) {
if(is_writable(getcwd())) {
if(move_uploaded_file($_FILES['file']['tmp_name'], $newfilename))
- echo json_encode(array("status"=>"OK", "message"=>"The file ".$_FILES['file']['name']." was uploaded successfully"));
+ echo json_encode(array("status"=>"OK", "message"=>"The file ".$_FILES['file']['name']." was uploaded successfully", "cd"=>$d['dir']));
else echo json_encode(array("status"=>"ERROR", "message"=>"File could not be uploaded"));
}
else echo json_encode(array("status"=>"ERROR", "message"=>"File could not be uploaded since it has no permissions to write in this directory"));
@@ -458,89 +456,55 @@ INTERFACE - SECTION
-
- ';
- ?>
+