causefx 8 rokov pred
rodič
commit
2bfcbe80ef
1 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 8 2
      functions.php

+ 8 - 2
functions.php

@@ -1756,8 +1756,14 @@ function uploadAvatar($path, $ext_mask = null) {
 // Remove file
 // Remove file
 function removeFiles($path) {
 function removeFiles($path) {
     if(is_file($path)) {
     if(is_file($path)) {
-        writeLog("success", "file was removed");
-        unlink($path);
+	    $fileType = getExtension($path);
+	    if(in_arrayi($fileType, array('jpg','jpeg','png','json','db','gif'))){
+		    writeLog("success", "file was removed");
+		unlink($path);
+	    } else{
+		 writeLog("error", "file was not removed");
+		 echo json_encode('Invalid File Type');   
+	    }
     } else {
     } else {
   		writeLog("error", "file was not removed");
   		writeLog("error", "file was not removed");
 		echo json_encode('No file specified for removal!');
 		echo json_encode('No file specified for removal!');