فهرست منبع

fix image delete if image has up-dir in path

causefx 7 سال پیش
والد
کامیت
89ca0e4d92
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      api/functions/organizr-functions.php

+ 1 - 1
api/functions/organizr-functions.php

@@ -1543,7 +1543,7 @@ function editImages()
 	$filesCheck = array_filter($_FILES);
 	$approvedPath = 'plugins/images/tabs';
 	if (!empty($postCheck)) {
-		if ($_POST['data']['action'] == 'deleteImage' && approvedFileExtension($_POST['data']['imagePath']) && strpos($_POST['data']['imagePath'], $approvedPath) !== false) {
+		if ($_POST['data']['action'] == 'deleteImage' && approvedFileExtension($_POST['data']['imagePath']) && strpos(str_replace('../', '', $_POST['data']['imagePath']), $approvedPath) !== false) {
 			if (file_exists(dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . $_POST['data']['imagePath'])) {
 				writeLog('success', 'Image Manager Function -  Deleted Image [' . $_POST['data']['imageName'] . ']', $GLOBALS['organizrUser']['username']);
 				return (unlink(dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . $_POST['data']['imagePath'])) ? true : false;