add module verification
This commit is contained in:
parent
5f8bff123b
commit
2cb3e260f7
@ -62,7 +62,7 @@ $flowTotalSize = GETPOST('flowTotalSize', 'alpha');
|
|||||||
top_httphead();
|
top_httphead();
|
||||||
dol_syslog(join(',', $_GET));
|
dol_syslog(join(',', $_GET));
|
||||||
|
|
||||||
$result = true;
|
$result = false;
|
||||||
|
|
||||||
if (!empty($upload_dir)) {
|
if (!empty($upload_dir)) {
|
||||||
$temp_dir = $upload_dir.'/'.$flowIdentifier;
|
$temp_dir = $upload_dir.'/'.$flowIdentifier;
|
||||||
@ -71,6 +71,12 @@ if (!empty($upload_dir)) {
|
|||||||
$upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/';
|
$upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($module != "test" && !isModEnabled($module)) {
|
||||||
|
echo json_encode("The module ".$module." is not enabled");
|
||||||
|
header("HTTP/1.0 400");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
$chunk_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber;
|
$chunk_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber;
|
||||||
if (file_exists($chunk_file)) {
|
if (file_exists($chunk_file)) {
|
||||||
@ -83,6 +89,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||||||
if (file_exists($upload_dir.'/'.$flowFilename)) {
|
if (file_exists($upload_dir.'/'.$flowFilename)) {
|
||||||
echo json_encode('File '.$flowIdentifier.' was already uploaded');
|
echo json_encode('File '.$flowIdentifier.' was already uploaded');
|
||||||
header("HTTP/1.0 200 Ok");
|
header("HTTP/1.0 200 Ok");
|
||||||
|
die();
|
||||||
} elseif (!empty($_FILES)) foreach ($_FILES as $file) {
|
} elseif (!empty($_FILES)) foreach ($_FILES as $file) {
|
||||||
// check the error status
|
// check the error status
|
||||||
if ($file['error'] != 0) {
|
if ($file['error'] != 0) {
|
||||||
|
|||||||
@ -161,6 +161,11 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) {
|
|||||||
$("#filespan").text("No file selected.");
|
$("#filespan").text("No file selected.");
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
})
|
})
|
||||||
|
flow.on("fileError", function(file, message){
|
||||||
|
console.log("Error on file upload",file, message);
|
||||||
|
$("#"+file.uniqueIdentifier+"pgbar").width(20+"%");
|
||||||
|
$("#"+file.uniqueIdentifier+"pgbar").children("span").text("ERROR UPLOAD");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
';
|
';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user