Fix bug with host list import not working correctly.
This commit is contained in:
parent
e995c0e78e
commit
d43775b26f
@ -242,6 +242,9 @@ function FileDetection($filename)
|
||||
if (preg_match('/Checklist:|Unclassified|Secret|STIG[_| ]ID/i', $line)) {
|
||||
$name['type'] = ECHECKLIST_CSV;
|
||||
}
|
||||
elseif (preg_match("/host\-list/", $name['base_name'])) {
|
||||
$name['type'] = HOST_LIST;
|
||||
}
|
||||
elseif (preg_match('/^\"NetBIOSName|^\"JobName/', $line)) {
|
||||
$name['type'] = UNSUPPORTED_RETINA_CSV;
|
||||
}
|
||||
|
@ -326,6 +326,10 @@ include_once 'header.inc';
|
||||
#loading {
|
||||
display: none;
|
||||
}
|
||||
.dz-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='wrapper'>
|
||||
@ -561,11 +565,20 @@ include_once 'header.inc';
|
||||
<script type="text/javascript">
|
||||
Dropzone.options.dropzone = {
|
||||
maxFilesize: 10,
|
||||
maxFiles: 1,
|
||||
success: function (file, res) {
|
||||
res = JSON.parse(res);
|
||||
if (res.imageUrl) {
|
||||
this.emit('thumbnail', file, res.imageUrl);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr);
|
||||
console.error(error);
|
||||
if(!xhr.accepted) {
|
||||
alert("That file type is not allowed, CSV only files");
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
this.hiddenFileInput.removeAttribute('multiple');
|
||||
},
|
||||
acceptedFiles: ".csv"
|
||||
};
|
||||
@ -584,14 +597,15 @@ include_once 'header.inc';
|
||||
</script>
|
||||
|
||||
<form class="dropzone" action="/upload.php" id="dropzone">
|
||||
<div class="dz-message" data-dz-message><span>Click or Drop files here to upload</span></div>
|
||||
<div class="fallback">
|
||||
<input type="file" name="file" multiple />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method='post' action='#' style='margin-left: 20px;'
|
||||
onsubmit="$('#submit').attr('disabled', true);
|
||||
return true;">
|
||||
onsubmit="$('#submit').attr('disabled', true);return true;" id='host-list-form'>
|
||||
<div style='font-weight:400;color:red;'>Must keep 'host-list' as part of the filename</div>
|
||||
<input type='hidden' name='file' id='host-list-file' style='display:none;' />
|
||||
<input type='hidden' name='action' value='import_host_list' />
|
||||
<input type='hidden' name='ste' value='<?php print ($ste_id ? $ste_id : ''); ?>' />
|
||||
|
@ -58,6 +58,9 @@ if ($fn) {
|
||||
case TECH_ECHECKLIST_EXCEL:
|
||||
print header(JSON) . json_encode(['imageUrl' => '/img/scan_types/echecklist.png']);
|
||||
break;
|
||||
case HOST_LIST:
|
||||
print header(JSON) . json_encode(['imageUrl' => '/img/file.png']);
|
||||
break;
|
||||
default:
|
||||
print header(JSON) . json_encode(['imageUrl' => null]);
|
||||
unlink(TMP . "/" . basename($fn));
|
||||
|
Loading…
Reference in New Issue
Block a user