From 5ff3e953a1179dd8d9d3ab6c765c58d8a219d824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=BF=97=E4=BC=9F?= <89636889+ZhiweiWu0425@users.noreply.github.com> Date: Fri, 2 Dec 2022 09:36:35 +0800 Subject: [PATCH] Solved the serious bug in 2.5.1 1. The root directory file cannot pop up the rename window 2. The problem that the "confirmDailog" window does not refresh when clicking the delete and download buttons for many times 3. In "FM_EMBED" mode. Failure problems such as SESSION (CSRF token) and TIMEZONE --- tinyfilemanager.php | 59 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 66f41da..4685417 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -186,33 +186,32 @@ if ($report_errors == true) { if (defined('FM_EMBED')) { $use_auth = false; $sticky_navbar = false; -} else { - @set_time_limit(600); - - date_default_timezone_set($default_timezone); - - ini_set('default_charset', 'UTF-8'); - if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) { - mb_internal_encoding('UTF-8'); - } - if (function_exists('mb_regex_encoding')) { - mb_regex_encoding('UTF-8'); - } - - session_cache_limiter(''); - session_name(FM_SESSION_ID ); - function session_error_handling_function($code, $msg, $file, $line) { - // Permission denied for default session, try to create a new one - if ($code == 2) { - session_abort(); - session_id(session_create_id()); - @session_start(); - } - } - set_error_handler('session_error_handling_function'); - session_start(); - restore_error_handler(); } +@set_time_limit(600); + +date_default_timezone_set($default_timezone); + +ini_set('default_charset', 'UTF-8'); +if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) { + mb_internal_encoding('UTF-8'); +} +if (function_exists('mb_regex_encoding')) { + mb_regex_encoding('UTF-8'); +} + +session_cache_limiter(''); +session_name(FM_SESSION_ID ); +function session_error_handling_function($code, $msg, $file, $line) { + // Permission denied for default session, try to create a new one + if ($code == 2) { + session_abort(); + session_id(session_create_id()); + @session_start(); + } +} +set_error_handler('session_error_handling_function'); +session_start(); +restore_error_handler(); //Genrating CSRF Token if (empty($_SESSION['token'])) { @@ -3884,7 +3883,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; while(match=re.exec(html)){add(html.slice(cursor,match.index))(match[1],!0);cursor=match.index+match[0].length} add(html.substr(cursor,html.length-cursor));code+='return r.join("");';return new Function(code.replace(/[\r\t\n]/g,'')).apply(options) } - function rename(e, t) { if(e && t) { $("#js-rename-from").val(t);$("#js-rename-to").val(t); $("#renameDailog").modal('show'); } } + function rename(e, t) { if(t) { $("#js-rename-from").val(t);$("#js-rename-to").val(t); $("#renameDailog").modal('show'); } } function change_checkboxes(e, t) { for (var n = e.length - 1; n >= 0; n--) e[n].checked = "boolean" == typeof t ? t : !e[n].checked } function get_checkboxes() { for (var e = document.getElementsByName("file[]"), t = [], n = e.length - 1; n >= 0; n--) (e[n].type = "checkbox") && t.push(e[n]); return t } function select_all() { change_checkboxes(get_checkboxes(), !0) } @@ -4006,6 +4005,12 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; let tpl = $("#js-tpl-confirm").html(); $('#wrapper').append(template(tpl,tplObj)); $("#confirmDailog-"+tplObj.id).modal('show'); + $("#confirmDailog-"+tplObj.id).on('hidden.bs.modal',function(){ + var md = $(this) + setTimeout(function() { + md.remove() + }, 10); + }) return false; }