#9713 ent Problems with the copy button fixed
This commit is contained in:
parent
6654327a1c
commit
b3ca6c78bf
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Images File Manager functions.
|
||||
*
|
||||
|
@ -139,25 +140,8 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
|
||||
try {
|
||||
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
|
||||
$fileExtension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$validFileExtension = true;
|
||||
|
||||
if (empty($fileExtension) === false) {
|
||||
$filtered_types = array_filter(
|
||||
$filterFilesType,
|
||||
function ($value) use ($fileExtension) {
|
||||
$mimeTypeExtensionName = explode('/', $value)[1];
|
||||
return $mimeTypeExtensionName === $fileExtension;
|
||||
}
|
||||
);
|
||||
|
||||
if (empty($filtered_types) === true) {
|
||||
$validFileExtension = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($validFileExtension === true && (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true)) {
|
||||
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
|
||||
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
|
||||
} else {
|
||||
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
|
||||
|
@ -522,6 +506,7 @@ function filemanager_file_explorer(
|
|||
check_opened_dialog('create_text_file');
|
||||
}
|
||||
<?php endif ?>
|
||||
|
||||
function show_upload_file() {
|
||||
actions_dialog('upload_file');
|
||||
$("#upload_file").css("display", "block");
|
||||
|
@ -590,6 +575,8 @@ function filemanager_file_explorer(
|
|||
}
|
||||
|
||||
function show_modal_real_path(path) {
|
||||
if (navigator.clipboard && window.isSecureContext) <?php $secure_con = true; ?>;
|
||||
else <?php $secure_con = false; ?>;
|
||||
$('#modal_real_path').addClass('file_table_modal_active');
|
||||
$('#real_path').empty();
|
||||
$('#real_path').html(path);
|
||||
|
@ -618,10 +605,12 @@ function filemanager_file_explorer(
|
|||
}
|
||||
|
||||
function copyToClipboard() {
|
||||
navigator.clipboard.writeText($("#real_path").text()).then(function (){
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
window.navigator.clipboard.writeText($("#real_path").text()).then(function() {
|
||||
$('#modal_real_path').dialog('close');
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
// List files.
|
||||
|
@ -985,8 +974,12 @@ function filemanager_file_explorer(
|
|||
|
||||
// Show Modal Real Path
|
||||
$modal_real_path = "<div><b>Real path to plugin execution is:</b></div>
|
||||
<div id='real_path'></div>
|
||||
<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'</div>';
|
||||
<div id='real_path'></div>";
|
||||
|
||||
if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
|
||||
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'</div>';
|
||||
}
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'modal_real_path',
|
||||
|
|
Loading…
Reference in New Issue