From e071b2372ce48b40407690b24ea515786fe25d60 Mon Sep 17 00:00:00 2001 From: Prasath Mani Date: Wed, 22 Feb 2023 07:16:25 +0530 Subject: [PATCH] Add External CDN resources configurable --- README.md | 1 + tinyfilemanager.php | 37 +++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3c6ca9d..aebeb2b 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Default username/password: **admin/admin@123** and **user/12345**. To enable/disable authentication set `$use_auth` to true or false. :information_source: Add your own configuration file [config.php](https://tinyfilemanager.github.io/config-sample.txt) in the same folder to use as additional configuration file. +:information_source: To work offline without CDN resources, use [https://github.com/prasathmani/tinyfilemanager/tree/offline](offline) branch ### :loudspeaker: Features diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 68703d8..6a26d30 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -3,7 +3,7 @@ $CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"theme":"light"}'; /** - * H3K | Tiny File Manager V2.5.2 + * H3K | Tiny File Manager V2.5.3 * @author Prasath Mani | CCP Programmers * @email ccpprogrammers@gmail.com * @github https://github.com/prasathmani/tinyfilemanager @@ -11,7 +11,7 @@ $CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols": */ //TFM version -define('VERSION', '2.5.2'); +define('VERSION', '2.5.3'); //Application Title define('APP_TITLE', 'Tiny File Manager'); @@ -136,7 +136,7 @@ $ip_blacklist = array( '::' // non-routable meta ipv6 ); -// External scripts (replace for GDPR compliance) +// External CDN resources that can be used in the HTML (replace for GDPR compliance) $external = array( 'css-bootstrap' => '', 'css-dropzone' => '', @@ -146,7 +146,7 @@ $external = array( 'js-bootstrap' => '', 'js-dropzone' => '', 'js-jquery' => '', - 'js-jquery-datables' => '', + 'js-jquery-datatables' => '', 'js-highlightjs' => '', 'pre-jsdelivr' => '', 'pre-cloudflare' => '' @@ -161,18 +161,6 @@ if (is_readable($config_file)) { // --- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL --- -function print_external($key) { - global $external; - - if(!array_key_exists($key, $external)) { - // throw new Exception('Key missing in external: ' . key); - echo ""; - return; - } - - echo "$external[$key]"; -} - // max upload file size define('MAX_UPLOAD_SIZE', $max_upload_size_bytes); @@ -2221,6 +2209,23 @@ fm_show_footer(); // Functions +/** + * It prints the css/js files into html + * @param key The key of the external file to print. + * @return The value of the key in the array. + */ +function print_external($key) { + global $external; + + if(!array_key_exists($key, $external)) { + // throw new Exception('Key missing in external: ' . key); + echo ""; + return; + } + + echo "$external[$key]"; +} + /** * Verify CSRF TOKEN and remove after cerify * @param string $token