├── CHANGELOG.md ├── boot.php ├── pages ├── index.php ├── explorer.php └── config.php ├── package.yml ├── LICENSE ├── README.md ├── lang ├── en_gb.lang ├── sv_se.lang ├── de_de.lang └── es_es.lang ├── assets ├── js │ └── tinyfilemanager.js └── css │ └── tinyfilemanager.css ├── functions └── functions.php ├── fragments └── tiny.php └── vendor └── tinyfilemanager.php /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | be_explorer - Changelog 2 | ========================== 3 | 4 | ### Version 1.0.1 - 10. Januar 2020 5 | 6 | * Fix für Container Umgebungen (Docker, etc.) 7 | -------------------------------------------------------------------------------- /boot.php: -------------------------------------------------------------------------------- 1 | getAssetsUrl('css/tinyfilemanager.css') ); 6 | 7 | rex_view::addJsFile( $this->getAssetsUrl('js/tinyfilemanager.js') ); 8 | 9 | } 10 | 11 | ?> -------------------------------------------------------------------------------- /pages/index.php: -------------------------------------------------------------------------------- 1 | setVar('title', $this->i18n('be_explorer_subpage_explorer'), false); 6 | // $fragment->setVar('body', $tiny, false); 7 | // $fragment->setVar('footer', $footer, false); 8 | // $content = $fragment->parse('core/page/section.php'); 9 | 10 | 11 | 12 | // echo $content; 13 | ?> 14 |
15 |
16 | 17 |
18 |
i18n('be_explorer_explorer')?>
19 |
20 |
21 | getPath(); 23 | $fm = $path . 'fragments/tiny.php'; 24 | include $fm; 25 | ?> 26 |
27 |
28 |
-------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Friends Of REDAXO 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | REDAXO-AddOn: Backend Explorer 2 | ================================================================================ 3 | 4 | ⚠️ Entwicklung eingestellt und wird an dieser Stelle nicht länger gepflegt. / Deprecated: This AddOn won’t be maintained any longer. 5 | A suitable substitute addon could be the icecoder: https://github.com/FriendsOfREDAXO/icecoder 6 | 7 | Dateiexplorer für REDAXO. 8 | Dateien direkt auf dem Server über die Weboberfläche erstellen, bearbeiten, kopieren, etc. Farbliche Quellcode-Hervorhebung im Editiermodus. 9 | 10 | 11 | ## Allgemein 12 | 13 | 14 | ### Changelog 15 | 16 | siehe CHANGELOG.md des AddOns 17 | 18 | 19 | ### Bug-Meldungen, Hilfe und Links 20 | 21 | * Auf Github: https://github.com/FriendsOfREDAXO/be_explorer/issues 22 | * im Forum: https://www.redaxo.org/forum/ 23 | * im Slack-Channel: https://friendsofredaxo.slack.com/ 24 | 25 | ### Lizenz 26 | 27 | siehe [LICENSE](https://github.com/FriendsOfREDAXO/be_explorer/blob/master/LICENSE) 28 | 29 | ### Autor 30 | 31 | **Friends Of REDAXO** 32 | 33 | * http://www.redaxo.org 34 | * https://github.com/FriendsOfREDAXO 35 | 36 | **Projekt-Lead** 37 | * [Ronny Kemmereit](https://github.com/rkemmere) 38 | 39 | **Development-Team / Autoren** 40 | * [Ronny Kemmereit](https://github.com/rkemmere) 41 | * [Pascal Schuchmann](https://github.com/pschuchmann) 42 | -------------------------------------------------------------------------------- /lang/en_gb.lang: -------------------------------------------------------------------------------- 1 | be_explorer_title = Backend Explorer 2 | 3 | #subpage explorer 4 | be_explorer_explorer = Explorer 5 | be_explorer_explorer_select_all = Select all 6 | be_explorer_explorer_unselect_all = Deselect all 7 | be_explorer_explorer_select_invert = Invert selection 8 | be_explorer_explorer_delete = Delete 9 | be_explorer_explorer_zip = Zip 10 | be_explorer_explorer_copy = Copy to 11 | be_explorer_explorer_tree_title = Structure 12 | 13 | be_explorer_explorer_name = Name 14 | be_explorer_explorer_size = Size 15 | be_explorer_explorer_modified = Modified 16 | be_explorer_explorer_perms = Rights 17 | be_explorer_explorer_owner = Owner 18 | be_explorer_explorer_actions = Actions 19 | 20 | be_explorer_explorer_delete = Delete 21 | be_explorer_explorer_rename = Rename 22 | be_explorer_explorer_copy = Copy to 23 | be_explorer_explorer_direct_link = Direct link 24 | be_explorer_explorer_download = Download 25 | be_explorer_explorer_open = Open 26 | be_explorer_explorer_edit = Editor 27 | be_explorer_explorer_advanced_edit = Advanced editor 28 | be_explorer_explorer_back = Back 29 | 30 | be_explorer_explorer_save = Save 31 | be_explorer_explorer_backup = Save 32 | be_explorer_explorer_cancel = Cancel 33 | 34 | be_explorer_explorer_upload_files = Upload files 35 | be_explorer_explorer_destination_folder = Target folder 36 | 37 | be_explorer_explorer_new_item = New file 38 | be_explorer_explorer_item_type = Type 39 | be_explorer_explorer_item_type_file = File 40 | be_explorer_explorer_item_type_folder = Folder 41 | be_explorer_explorer_item_create = Create 42 | 43 | be_explorer_explorer_full_path = Path 44 | be_explorer_explorer_full_size = File size 45 | be_explorer_explorer_charset = Charset 46 | 47 | 48 | #subpage config 49 | be_explorer_config = Configuration 50 | be_explorer_config_show_tree_view = Show folder structure 51 | be_explorer_config_show_hidden_files = Show hidden files 52 | 53 | #permissions 54 | perm_general_be_explorer[] = Rights for be_explorer addon 55 | perm_general_be_explorer[sets] = Rights for 'Sets' page be_explorer addon 56 | -------------------------------------------------------------------------------- /lang/sv_se.lang: -------------------------------------------------------------------------------- 1 | be_explorer_title = Backend Explorer 2 | 3 | #subpage explorer 4 | be_explorer_explorer = Explorer 5 | be_explorer_explorer_select_all = Välj ut allt 6 | be_explorer_explorer_unselect_all = Kasta urvalet 7 | be_explorer_explorer_select_invert = Invertera urvalet 8 | be_explorer_explorer_delete = Radera 9 | be_explorer_explorer_zip = Zip 10 | be_explorer_explorer_copy = Kopiera till ... 11 | be_explorer_explorer_tree_title = Struktur 12 | 13 | be_explorer_explorer_name = Namn 14 | be_explorer_explorer_size = Storlek 15 | be_explorer_explorer_modified = Modificierad 16 | be_explorer_explorer_perms = Rättigheter 17 | be_explorer_explorer_owner = Ägare 18 | be_explorer_explorer_actions = Aktioner 19 | 20 | be_explorer_explorer_delete = Radera 21 | be_explorer_explorer_rename = Byta namn 22 | be_explorer_explorer_copy = Kopiera till ... 23 | be_explorer_explorer_direct_link = Direkt länk 24 | be_explorer_explorer_download = Download 25 | be_explorer_explorer_open = Öppna 26 | be_explorer_explorer_edit = Editor 27 | be_explorer_explorer_advanced_edit = Utvidgad editor 28 | be_explorer_explorer_back = Tillbaka 29 | 30 | be_explorer_explorer_save = Spara 31 | be_explorer_explorer_backup = Spara 32 | be_explorer_explorer_cancel = Avbryt 33 | 34 | be_explorer_explorer_upload_files = Ladda upp filer 35 | be_explorer_explorer_destination_folder = Målmapp 36 | 37 | be_explorer_explorer_new_item = Ny fil 38 | be_explorer_explorer_item_type = Typ 39 | be_explorer_explorer_item_type_file = Fil 40 | be_explorer_explorer_item_type_folder = Mapp 41 | be_explorer_explorer_item_create = Skapa 42 | 43 | be_explorer_explorer_full_path = Led 44 | be_explorer_explorer_full_size = Filstorlek 45 | be_explorer_explorer_charset = Charset 46 | 47 | 48 | #subpage config 49 | be_explorer_config = Konfiguration 50 | be_explorer_config_show_tree_view = Visa mappstrukturen 51 | be_explorer_config_show_hidden_files = Visa gömda filer 52 | 53 | #permissions 54 | perm_general_be_explorer[] = Rättigheter till be_explorer-addon 55 | perm_general_be_explorer[sets] = be_explorer-addons rättigheter till sida "sets" 56 | -------------------------------------------------------------------------------- /lang/de_de.lang: -------------------------------------------------------------------------------- 1 | be_explorer_title = Backend Explorer 2 | 3 | #subpage explorer 4 | be_explorer_explorer = Explorer 5 | be_explorer_explorer_select_all = Alles auswählen 6 | be_explorer_explorer_unselect_all = Auswahl aufheben 7 | be_explorer_explorer_select_invert = Auswahl umkehren 8 | be_explorer_explorer_delete = Löschen 9 | be_explorer_explorer_zip = Zip 10 | be_explorer_explorer_copy = Kopieren 11 | be_explorer_explorer_tree_title = Struktur 12 | 13 | be_explorer_explorer_name = Name 14 | be_explorer_explorer_size = Größe 15 | be_explorer_explorer_modified = Modifiziert 16 | be_explorer_explorer_perms = Rechte 17 | be_explorer_explorer_owner = Besitzer 18 | be_explorer_explorer_actions = Aktionen 19 | 20 | be_explorer_explorer_delete = Löschen 21 | be_explorer_explorer_rename = Umbenennen 22 | be_explorer_explorer_copy = Kopieren nach... 23 | be_explorer_explorer_direct_link = Direkter Link 24 | be_explorer_explorer_download = Download 25 | be_explorer_explorer_open = Öffnen 26 | be_explorer_explorer_edit = Editor 27 | be_explorer_explorer_advanced_edit = Erweiterter Editor 28 | be_explorer_explorer_back = Zurück 29 | 30 | be_explorer_explorer_save = Speichern 31 | be_explorer_explorer_backup = Sichern 32 | be_explorer_explorer_cancel = Abbrechen 33 | 34 | be_explorer_explorer_upload_files = Dateien hochladen 35 | be_explorer_explorer_destination_folder = Zielverzeichnis 36 | 37 | be_explorer_explorer_new_item = Neue Datei 38 | be_explorer_explorer_item_type = Typ 39 | be_explorer_explorer_item_type_file = Datei 40 | be_explorer_explorer_item_type_folder = Ordner 41 | be_explorer_explorer_item_create = Anlegen 42 | 43 | be_explorer_explorer_full_path = Pfad 44 | be_explorer_explorer_full_size = Dateigröße 45 | be_explorer_explorer_charset = Charset 46 | 47 | 48 | #subpage config 49 | be_explorer_config = Konfiguration 50 | be_explorer_config_show_tree_view = Ordner-Struktur anzeigen 51 | be_explorer_config_show_hidden_files = Versteckte Dateien anzeigen 52 | 53 | #permissions 54 | perm_general_be_explorer[] = Rechte für be_explorer-Addon 55 | perm_general_be_explorer[sets] = Rechte für die Seite 'Sets' des be_explorer-Addons 56 | -------------------------------------------------------------------------------- /lang/es_es.lang: -------------------------------------------------------------------------------- 1 | be_explorer_title = Backend Explorer 2 | 3 | #subpage explorer 4 | be_explorer_explorer = Explorador 5 | be_explorer_explorer_select_all = Seleccionar todo 6 | be_explorer_explorer_unselect_all = Deseleccionar todo 7 | be_explorer_explorer_select_invert = Invertir selección 8 | be_explorer_explorer_delete = Eliminar 9 | be_explorer_explorer_zip = Zip 10 | be_explorer_explorer_copy = Copiar a 11 | be_explorer_explorer_tree_title = Estructura 12 | 13 | be_explorer_explorer_name = Nombre 14 | be_explorer_explorer_size = Tamaño 15 | be_explorer_explorer_modified = Modificado 16 | be_explorer_explorer_perms = Derechos 17 | be_explorer_explorer_owner = Propietario 18 | be_explorer_explorer_actions = Acciones 19 | 20 | be_explorer_explorer_delete = Eliminar 21 | be_explorer_explorer_rename = Cambiar nombre 22 | be_explorer_explorer_copy = Copiar a 23 | be_explorer_explorer_direct_link = Enlace directo 24 | be_explorer_explorer_download = Descargar 25 | be_explorer_explorer_open = Abrir 26 | be_explorer_explorer_edit = Editor 27 | be_explorer_explorer_advanced_edit = Editor avanzado 28 | be_explorer_explorer_back = Volver 29 | 30 | be_explorer_explorer_save = Guardar 31 | be_explorer_explorer_backup = Guardar 32 | be_explorer_explorer_cancel = Cancelar 33 | 34 | be_explorer_explorer_upload_files = Subir archivos 35 | be_explorer_explorer_destination_folder = Carpeta de destino 36 | 37 | be_explorer_explorer_new_item = Nuevo archivo 38 | be_explorer_explorer_item_type = Tipo 39 | be_explorer_explorer_item_type_file = Archivo 40 | be_explorer_explorer_item_type_folder = Carpeta 41 | be_explorer_explorer_item_create = Crear 42 | 43 | be_explorer_explorer_full_path = Ruta 44 | be_explorer_explorer_full_size = Tamaño del archivo 45 | be_explorer_explorer_charset = Caracteres 46 | 47 | 48 | #subpage config 49 | be_explorer_config = Configuración 50 | be_explorer_config_show_tree_view = Mostrar estructura de carpetas 51 | be_explorer_config_show_hidden_files = Mostrar archivos ocultos 52 | 53 | # permisos 54 | perm_general_be_explorer[] = Derechos para el complemento be_explorer 55 | perm_general_be_explorer[sets] = Derechos para la página 'Conjuntos' be_explorer addon 56 | -------------------------------------------------------------------------------- /pages/config.php: -------------------------------------------------------------------------------- 1 | setConfig(rex_post('config', [ 8 | ['show_tree_view', 'bool'], 9 | ['show_hidden_files', 'bool'], 10 | ])); 11 | 12 | echo rex_view::success($this->i18n('be_explorer-saved')); 13 | } 14 | 15 | $content = '
'; 16 | 17 | $formElements = []; 18 | 19 | $n = []; 20 | $n['label'] = ''; 21 | $n['field'] = 'getConfig('show_tree_view') ? ' checked="checked"' : '') . ' />'; 22 | $formElements[] = $n; 23 | 24 | $n = []; 25 | $n['label'] = ''; 26 | $n['field'] = 'getConfig('show_hidden_files') ? ' checked="checked"' : '') . ' />'; 27 | $formElements[] = $n; 28 | 29 | $fragment = new rex_fragment(); 30 | $fragment->setVar('elements', $formElements, false); 31 | $content .= $fragment->parse('core/form/checkbox.php'); 32 | 33 | $formElements = []; 34 | 35 | $n = []; 36 | $n['field'] = ''; 37 | $formElements[] = $n; 38 | 39 | $fragment = new rex_fragment(); 40 | $fragment->setVar('flush', true); 41 | $fragment->setVar('elements', $formElements, false); 42 | $buttons = $fragment->parse('core/form/submit.php'); 43 | 44 | $fragment = new rex_fragment(); 45 | $fragment->setVar('class', 'edit'); 46 | $fragment->setVar('title', $this->i18n('be_explorer_config')); 47 | $fragment->setVar('body', $content, false); 48 | $fragment->setVar('buttons', $buttons, false); 49 | $content = $fragment->parse('core/page/section.php'); 50 | 51 | echo ' 52 |
53 | ' . $content . ' 54 |
'; 55 | -------------------------------------------------------------------------------- /assets/js/tinyfilemanager.js: -------------------------------------------------------------------------------- 1 | function newfolder(e) { 2 | var t = document.getElementById("newfilename").value, 3 | n = document.querySelector('input[name="newfile"]:checked').value; 4 | null !== t && "" !== t && n && (window.location.hash = "#", window.location.search = "page=be_explorer/explorer&p=" + encodeURIComponent(e) + "&new=" + encodeURIComponent(t) + "&type=" + encodeURIComponent(n)) 5 | } 6 | 7 | function rename(e, t) { 8 | var n = prompt("New name", t); 9 | null !== n && "" !== n && n != t && (window.location.search = "page=be_explorer/explorer&p=" + encodeURIComponent(e) + "&ren=" + encodeURIComponent(t) + "&to=" + encodeURIComponent(n)) 10 | } 11 | 12 | function change_checkboxes(e, t) { 13 | for (var n = e.length - 1; n >= 0; n--) e[n].checked = "boolean" == typeof t ? t : !e[n].checked 14 | } 15 | 16 | function get_checkboxes() { 17 | for (var e = document.getElementsByName("file[]"), t = [], n = e.length - 1; n >= 0; n--)(e[n].type = "checkbox") && t.push(e[n]); 18 | return t 19 | } 20 | 21 | function select_all() { 22 | change_checkboxes(get_checkboxes(), !0) 23 | } 24 | 25 | function unselect_all() { 26 | change_checkboxes(get_checkboxes(), !1) 27 | } 28 | 29 | function invert_all() { 30 | change_checkboxes(get_checkboxes()) 31 | } 32 | 33 | function mailto(e, t) { 34 | var n = new XMLHttpRequest, 35 | a = "path=" + e + "&file=" + t + "&type=mail&ajax=true"; 36 | n.open("POST", "", !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), n.onreadystatechange = function() { 37 | 4 == n.readyState && 200 == n.status && alert(n.responseText) 38 | }, n.send(a) 39 | } 40 | 41 | function showSearch(e) { 42 | var t = new XMLHttpRequest, 43 | n = "path=" + e + "&type=search&ajax=true"; 44 | t.open("POST", "", !0), t.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), t.onreadystatechange = function() { 45 | 4 == t.readyState && 200 == t.status && (window.searchObj = t.responseText, document.getElementById("searchresultWrapper").innerHTML = "", window.location.hash = "#searchResult") 46 | }, t.send(n) 47 | } 48 | 49 | function getSearchResult(e, t) { 50 | var n = [], 51 | a = []; 52 | return e.forEach(function(e) { 53 | "folder" === e.type ? (getSearchResult(e.items, t), e.name.toLowerCase().match(t) && n.push(e)) : "file" === e.type && e.name.toLowerCase().match(t) && a.push(e) 54 | }), { 55 | folders: n, 56 | files: a 57 | } 58 | } 59 | 60 | function checkbox_toggle() { 61 | var e = get_checkboxes(); 62 | e.push(this), change_checkboxes(e) 63 | } 64 | 65 | function backup(e, t) { 66 | var n = new XMLHttpRequest, 67 | a = "path=" + e + "&file=" + t + "&type=backup&ajax=true"; 68 | return n.open("POST", "", !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), n.onreadystatechange = function() { 69 | 4 == n.readyState && 200 == n.status && alert(n.responseText) 70 | }, n.send(a), !1 71 | } 72 | 73 | 74 | 75 | // $(document).ready(function() { 76 | // var codemirror = $(document.getElementById('codemirror-id-1')).next().find('CodeMirror'); 77 | // // var codemirror = $('.CodeMirror')[0]; 78 | // alert(codemirror); 79 | // }); 80 | 81 | 82 | function edit_save(e, t) { 83 | if( t == "codemirror" ) { 84 | var codemirror = $('.CodeMirror')[0].CodeMirror; 85 | var n = codemirror.getValue(); 86 | } else if (t == "nrl") { 87 | var n = document.getElementById("normal-editor").value; 88 | } 89 | if (n) { 90 | var a = document.createElement("form"); 91 | a.setAttribute("method", "POST"), a.setAttribute("action", ""); 92 | var o = document.createElement("textarea"); 93 | o.setAttribute("type", "textarea"), o.setAttribute("name", "savedata"); 94 | var c = document.createTextNode(n); 95 | o.appendChild(c), a.appendChild(o), document.body.appendChild(a), a.submit() 96 | } 97 | } 98 | 99 | 100 | 101 | function init_php_file_tree() { 102 | if (document.getElementsByTagName) { 103 | for (var e = document.getElementsByTagName("LI"), t = 0; t < e.length; t++) { 104 | var n = e[t].className; 105 | if (n.indexOf("pft-directory") > -1) 106 | for (var a = e[t].childNodes, o = 0; o < a.length; o++) "A" == a[o].tagName && (a[o].onclick = function() { 107 | for (var e = this.nextSibling;;) { 108 | if (null == e) return !1; 109 | if ("UL" == e.tagName) { 110 | var t = "none" == e.style.display; 111 | return e.style.display = t ? "block" : "none", this.className = t ? "open" : "closed", !1 112 | } 113 | e = e.nextSibling 114 | } 115 | return !1 116 | }, a[o].className = n.indexOf("open") > -1 ? "open" : "closed"), "UL" == a[o].tagName && (a[o].style.display = n.indexOf("open") > -1 ? "block" : "none") 117 | } 118 | return !1 119 | } 120 | } 121 | $( document ).ready(function() { 122 | var searchEl = document.querySelector("input[name=be_explorer_search]"), timeout = null; 123 | // console.log(searchEl); 124 | searchEl.onkeyup = function(e) { 125 | clearTimeout(timeout); 126 | var t = JSON.parse(window.searchObj), n = document.querySelector("input[name=be_explorer_search]").value; 127 | timeout = setTimeout(function() { 128 | if (n.length >= 2) { 129 | var e = getSearchResult(t, n), a = "", o = ""; 130 | e.folders.forEach(function(e) { 131 | a += '
  • ' + e.name + "
  • " 132 | }) 133 | e.files.forEach(function(e) { 134 | o += '
  • ' + e.name + "
  • " 135 | }) 136 | document.getElementById("searchresultWrapper").innerHTML = '
    ' + a + o + "
    " 137 | } 138 | }, 500) 139 | } 140 | }); 141 | 142 | 143 | window.onload = init_php_file_tree; 144 | if (document.getElementById("file-tree-view")) { 145 | var tableViewHt = document.getElementById("main-table").offsetHeight - 2; 146 | document.getElementById("file-tree-view").setAttribute("style", "height:" + tableViewHt + "px") 147 | }; -------------------------------------------------------------------------------- /assets/css/tinyfilemanager.css: -------------------------------------------------------------------------------- 1 | a img, 2 | img { 3 | border: none 4 | } 5 | 6 | .filename, 7 | td, 8 | th { 9 | white-space: nowrap 10 | } 11 | 12 | .close, 13 | .close:focus, 14 | .close:hover, 15 | .php-file-tree a, 16 | .panel-body a { 17 | text-decoration: none 18 | } 19 | 20 | p, 21 | table, 22 | ul { 23 | margin-bottom: 10px 24 | } 25 | 26 | button, 27 | input, 28 | select, 29 | textarea { 30 | font-size: inherit; 31 | font-family: inherit 32 | } 33 | 34 | .panel-body a { 35 | color: #296ea3 36 | } 37 | 38 | .panel-body a:hover { 39 | color: #b00 40 | } 41 | 42 | .panel-body img { 43 | vertical-align: middle 44 | } 45 | 46 | .panel-body span { 47 | color: #777 48 | } 49 | 50 | .panel-body small { 51 | font-size: 11px; 52 | color: #999 53 | } 54 | 55 | .panel-body ul { 56 | list-style-type: none; 57 | margin-left: 0 58 | } 59 | 60 | .panel-body ul li { 61 | padding: 3px 0 62 | } 63 | 64 | .panel-body table { 65 | border-collapse: collapse; 66 | border-spacing: 0; 67 | width: 100% 68 | } 69 | 70 | .file-tree-view+#main-table { 71 | /* width: 75%!important; 72 | float: left*/ 73 | } 74 | 75 | #main-table label { 76 | margin: 0; 77 | } 78 | 79 | #main-table tbody tr td:first-child { 80 | text-align: center; 81 | } 82 | 83 | td, 84 | th { 85 | padding: 4px 7px; 86 | text-align: left; 87 | vertical-align: top; 88 | border: 1px solid #ddd; 89 | background: #fff 90 | } 91 | 92 | td.gray, 93 | th { 94 | background-color: #eee 95 | } 96 | 97 | td.gray span { 98 | color: #222 99 | } 100 | 101 | tr:hover td { 102 | background-color: #f5f5f5 103 | } 104 | 105 | tr:hover td.gray { 106 | background-color: #eee 107 | } 108 | 109 | /*.table { 110 | width: 100%; 111 | max-width: 100%; 112 | margin-bottom: 1rem 113 | } 114 | 115 | .table td, 116 | .table th { 117 | padding: .55rem; 118 | vertical-align: top; 119 | border-top: 1px solid #ddd 120 | } 121 | 122 | .table thead th { 123 | vertical-align: bottom; 124 | border-bottom: 1px solid #ddd 125 | } 126 | 127 | .table tbody+tbody { 128 | border-top: 2px solid #eceeef 129 | } 130 | 131 | .table .table { 132 | background-color: #fff 133 | }*/ 134 | 135 | code, 136 | pre { 137 | display: block; 138 | margin-bottom: 10px; 139 | /*font: 13px/16px Consolas, 'Courier New', Courier, monospace;*/ 140 | border: 1px dashed #ccc; 141 | padding: 5px; 142 | overflow: auto 143 | } 144 | 145 | .hidden, 146 | .modal { 147 | display: none 148 | } 149 | 150 | /*.btn, 151 | .close { 152 | font-weight: 700 153 | }*/ 154 | 155 | pre.with-hljs { 156 | padding: 0 157 | } 158 | 159 | pre.with-hljs code { 160 | margin: 0; 161 | border: 0; 162 | overflow: visible 163 | } 164 | 165 | code.maxheight, 166 | pre.maxheight { 167 | max-height: 512px 168 | } 169 | 170 | input[type=checkbox] { 171 | margin: 0; 172 | padding: 0; 173 | vertical-align: middle; 174 | } 175 | 176 | /*.message, 177 | .path { 178 | padding: 4px 7px; 179 | border: 1px solid #ddd; 180 | background-color: #fff 181 | } 182 | */ 183 | 184 | .fa.fa-caret-right { 185 | font-size: 1.2em; 186 | margin: 0 0.5rem; 187 | vertical-align: middle; 188 | } 189 | 190 | .fa.fa-home { 191 | font-size: 1.2em; 192 | vertical-align: bottom 193 | } 194 | 195 | .path { 196 | margin-bottom: 10px 197 | } 198 | 199 | .right { 200 | text-align: right 201 | } 202 | 203 | .center, 204 | .close, 205 | .login-form { 206 | text-align: center 207 | } 208 | 209 | .message.ok { 210 | border-color: green; 211 | color: green 212 | } 213 | 214 | .message.error { 215 | border-color: red; 216 | color: red 217 | } 218 | 219 | .message.alert { 220 | border-color: orange; 221 | color: orange 222 | } 223 | 224 | .btn { 225 | /* border: 0; 226 | background: 0 0; 227 | padding: 0; 228 | margin: 0; 229 | color: #296ea3; 230 | cursor: pointer*/ 231 | } 232 | 233 | .btn:hover { 234 | /*color: #b00*/ 235 | } 236 | 237 | .preview-img { 238 | max-width: 100%; 239 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC) 240 | } 241 | 242 | .inline-actions>a>i { 243 | /*font-size: 1em;*/ 244 | margin-left: 5px; 245 | /*background: #3785c1;*/ 246 | padding: 3px; 247 | /*color: #fff;*/ 248 | /*border-radius: 3px*/ 249 | } 250 | 251 | .preview-video { 252 | position: relative; 253 | max-width: 100%; 254 | height: 0; 255 | padding-bottom: 62.5%; 256 | margin-bottom: 10px 257 | } 258 | 259 | .preview-video video { 260 | position: absolute; 261 | width: 100%; 262 | height: 100%; 263 | left: 0; 264 | top: 0; 265 | background: #000 266 | } 267 | 268 | .compact-table { 269 | border: 0; 270 | width: auto 271 | } 272 | 273 | .compact-table td, 274 | .compact-table th { 275 | width: 100px; 276 | border: 0; 277 | text-align: center 278 | } 279 | 280 | .compact-table tr:hover td { 281 | background-color: #fff 282 | } 283 | 284 | .filename { 285 | max-width: 420px; 286 | overflow: hidden; 287 | text-overflow: ellipsis 288 | } 289 | 290 | .break-word { 291 | word-wrap: break-word; 292 | /*margin-left: 30px*/ 293 | } 294 | 295 | .break-word+.col-xs-1>a { 296 | /*color: #7d7d7d;*/ 297 | /*font-size: 1.2em;*/ 298 | margin-right: 4px; 299 | } 300 | 301 | .modal { 302 | position: fixed; 303 | z-index: 1; 304 | padding-top: 100px; 305 | left: 0; 306 | top: 0; 307 | width: 100%; 308 | height: 100%; 309 | overflow: auto; 310 | background-color: #000; 311 | background-color: rgba(0, 0, 0, .4) 312 | } 313 | 314 | .modal-content { 315 | background-color: #fefefe; 316 | margin: auto; 317 | padding: 20px; 318 | border: 1px solid #888; 319 | width: 80% 320 | } 321 | 322 | .close:focus, 323 | .close:hover { 324 | color: #000; 325 | cursor: pointer 326 | } 327 | 328 | .edit-file-actions { 329 | top: 0; 330 | background: #fff; 331 | margin-top: 5px 332 | } 333 | 334 | .edit-file-actions>a, 335 | .edit-file-actions>button { 336 | /*background: #fff;*/ 337 | padding: 5px 15px; 338 | cursor: pointer; 339 | /*color: #296ea3;*/ 340 | /*border: 1px solid #296ea3*/ 341 | } 342 | 343 | /*.group-btn { 344 | background: #fff; 345 | padding: 2px 6px; 346 | border: 1px solid; 347 | cursor: pointer; 348 | color: #296ea3 349 | }*/ 350 | 351 | .main-nav { 352 | position: relative; 353 | /* top: 0; 354 | left: 0; 355 | padding: 10px 30px 10px 1px; 356 | width: 100%; 357 | background: #fff; 358 | color: #000; 359 | border: 0; 360 | box-shadow: 0 4px 5px 0 rgba(0, 0, 0, .14), 0 1px 10px 0 rgba(0, 0, 0, .12), 0 2px 4px -1px rgba(0, 0, 0, .2)*/ 361 | /*display: inline-block;*/ 362 | } 363 | 364 | .pos-right { 365 | position: absolute; 366 | right: 0; 367 | } 368 | 369 | .login-form { 370 | width: 320px; 371 | margin: 0 auto; 372 | box-shadow: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .2) 373 | } 374 | 375 | .login-form label, 376 | .path.login-form input { 377 | padding: 8px; 378 | margin: 10px 379 | } 380 | 381 | .footer-links { 382 | background: 0 0; 383 | border: 0; 384 | clear: both 385 | } 386 | 387 | select[name=lang] { 388 | border: none; 389 | position: relative; 390 | text-transform: uppercase; 391 | left: -30%; 392 | top: 12px; 393 | color: silver 394 | } 395 | 396 | input[type=search] { 397 | height: 30px; 398 | margin: 5px; 399 | width: 80%; 400 | border: 1px solid #ccc 401 | } 402 | 403 | .path.login-form input[type=submit] { 404 | background-color: #4285f4; 405 | color: #fff; 406 | border: 1px solid; 407 | border-radius: 2px; 408 | font-weight: 700; 409 | cursor: pointer 410 | } 411 | 412 | .modalDialog { 413 | position: fixed; 414 | font-family: Arial, Helvetica, sans-serif; 415 | top: 0; 416 | right: 0; 417 | bottom: 0; 418 | left: 0; 419 | background: rgba(0, 0, 0, .8); 420 | z-index: 99999; 421 | opacity: 0; 422 | -webkit-transition: opacity .4s ease-in; 423 | -moz-transition: opacity .4s ease-in; 424 | transition: opacity .4s ease-in; 425 | pointer-events: none 426 | } 427 | 428 | .modalDialog:target { 429 | opacity: 1; 430 | pointer-events: auto 431 | } 432 | 433 | .modalDialog>.model-wrapper { 434 | max-width: 400px; 435 | position: relative; 436 | margin: 10% auto; 437 | padding: 15px; 438 | border-radius: 2px; 439 | background: #fff 440 | } 441 | 442 | .close { 443 | float: right; 444 | background: #fff; 445 | color: #000; 446 | line-height: 25px; 447 | position: absolute; 448 | right: 0; 449 | top: 0; 450 | width: 24px; 451 | border-radius: 0 5px 0 0; 452 | font-size: 18px 453 | } 454 | 455 | .close:hover { 456 | background: #e4e4e4 457 | } 458 | 459 | .modalDialog p { 460 | line-height: 30px 461 | } 462 | 463 | div#searchresultWrapper { 464 | max-height: 320px; 465 | overflow: auto 466 | } 467 | 468 | div#searchresultWrapper li { 469 | margin: 8px 0; 470 | list-style: none 471 | } 472 | 473 | li.file:before, 474 | li.folder:before { 475 | font: normal normal normal 14px/1 FontAwesome; 476 | content: "\f016"; 477 | margin-right: 5px 478 | } 479 | 480 | li.folder:before { 481 | content: "\f114" 482 | } 483 | 484 | i.fa.fa-folder-o { 485 | color: #eeaf4b 486 | } 487 | 488 | i.fa.fa-picture-o { 489 | color: #26b99a 490 | } 491 | 492 | i.fa.fa-file-archive-o { 493 | color: #da7d7d 494 | } 495 | 496 | .footer-links i.fa.fa-file-archive-o { 497 | color: #296ea3 498 | } 499 | 500 | i.fa.fa-css3 { 501 | color: #f36fa0 502 | } 503 | 504 | i.fa.fa-file-code-o { 505 | color: #ec6630 506 | } 507 | 508 | i.fa.fa-code { 509 | color: #cc4b4c 510 | } 511 | 512 | i.fa.fa-file-text-o { 513 | color: #0096e6 514 | } 515 | 516 | i.fa.fa-html5 { 517 | color: #d75e72 518 | } 519 | 520 | i.fa.fa-file-excel-o { 521 | color: #09c55d 522 | } 523 | 524 | i.fa.fa-file-powerpoint-o { 525 | color: #f6712e 526 | } 527 | 528 | .file-tree-view .tree-title { 529 | background: #eee; 530 | padding: 9px 2px 9px 10px; 531 | font-weight: 700; 532 | border-bottom: 2px solid #dfe3e9; 533 | } 534 | 535 | .file-tree-view ul { 536 | margin-left: 15px; 537 | } 538 | 539 | .file-tree-view i { 540 | padding-right: 3px 541 | } 542 | 543 | .php-file-tree { 544 | font-size: 100%; 545 | letter-spacing: 1px; 546 | line-height: 1.5; 547 | margin-left: 5px!important 548 | } 549 | 550 | .php-file-tree .open { 551 | font-style: italic; 552 | color: #2183ce 553 | } 554 | 555 | .php-file-tree .closed { 556 | font-style: normal 557 | } 558 | 559 | #file-tree-view::-webkit-scrollbar { 560 | width: 10px; 561 | background-color: #F5F5F5 562 | } 563 | 564 | #file-tree-view::-webkit-scrollbar-track { 565 | border-radius: 10px; 566 | background: rgba(0, 0, 0, .1); 567 | border: 1px solid #ccc 568 | } 569 | 570 | #file-tree-view::-webkit-scrollbar-thumb { 571 | border-radius: 10px; 572 | background: linear-gradient(left, #fff, #e4e4e4); 573 | border: 1px solid #aaa 574 | } 575 | 576 | #file-tree-view::-webkit-scrollbar-thumb:hover { 577 | background: #fff 578 | } 579 | 580 | #file-tree-view::-webkit-scrollbar-thumb:active { 581 | background: linear-gradient(left, #22ADD4, #1E98BA) 582 | } 583 | -------------------------------------------------------------------------------- /functions/functions.php: -------------------------------------------------------------------------------- 1 | = $time1 && $upd) { 141 | return false; 142 | } 143 | } 144 | $ok = copy($f1, $f2); 145 | if ($ok) { 146 | touch($f2, $time1); 147 | } 148 | return $ok; 149 | } 150 | 151 | /** 152 | * Get mime type 153 | * @param string $file_path 154 | * @return mixed|string 155 | */ 156 | function fm_get_mime_type($file_path) 157 | { 158 | if (function_exists('finfo_open')) { 159 | $finfo = finfo_open(FILEINFO_MIME_TYPE); 160 | $mime = finfo_file($finfo, $file_path); 161 | finfo_close($finfo); 162 | return $mime; 163 | } elseif (function_exists('mime_content_type')) { 164 | return mime_content_type($file_path); 165 | } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) { 166 | $file = escapeshellarg($file_path); 167 | $mime = shell_exec('file -bi ' . $file); 168 | return $mime; 169 | } else { 170 | return '--'; 171 | } 172 | } 173 | 174 | /** 175 | * HTTP Redirect 176 | * @param string $url 177 | * @param int $code 178 | */ 179 | function fm_redirect($url, $code = 302) 180 | { 181 | header('Location: ' . $url, true, $code); 182 | exit; 183 | } 184 | 185 | /** 186 | * Clean path 187 | * @param string $path 188 | * @return string 189 | */ 190 | function fm_clean_path($path) 191 | { 192 | $path = trim($path); 193 | $path = trim($path, '\\/'); 194 | $path = str_replace(array('../', '..\\'), '', $path); 195 | if ($path == '..') { 196 | $path = ''; 197 | } 198 | return str_replace('\\', '/', $path); 199 | } 200 | 201 | /** 202 | * Get parent path 203 | * @param string $path 204 | * @return bool|string 205 | */ 206 | function fm_get_parent_path($path) 207 | { 208 | $path = fm_clean_path($path); 209 | if ($path != '') { 210 | $array = explode('/', $path); 211 | if (count($array) > 1) { 212 | $array = array_slice($array, 0, -1); 213 | return implode('/', $array); 214 | } 215 | return ''; 216 | } 217 | return false; 218 | } 219 | 220 | /** 221 | * Get nice filesize 222 | * @param int $size 223 | * @return string 224 | */ 225 | function fm_get_filesize($size) 226 | { 227 | if ($size < 1000) { 228 | return sprintf('%s B', $size); 229 | } elseif (($size / 1024) < 1000) { 230 | return sprintf('%s KiB', round(($size / 1024), 2)); 231 | } elseif (($size / 1024 / 1024) < 1000) { 232 | return sprintf('%s MiB', round(($size / 1024 / 1024), 2)); 233 | } elseif (($size / 1024 / 1024 / 1024) < 1000) { 234 | return sprintf('%s GiB', round(($size / 1024 / 1024 / 1024), 2)); 235 | } else { 236 | return sprintf('%s TiB', round(($size / 1024 / 1024 / 1024 / 1024), 2)); 237 | } 238 | } 239 | 240 | /** 241 | * Get info about zip archive 242 | * @param string $path 243 | * @return array|bool 244 | */ 245 | function fm_get_zif_info($path) 246 | { 247 | if (function_exists('zip_open')) { 248 | $arch = zip_open($path); 249 | if ($arch) { 250 | $filenames = array(); 251 | while ($zip_entry = zip_read($arch)) { 252 | $zip_name = zip_entry_name($zip_entry); 253 | $zip_folder = substr($zip_name, -1) == '/'; 254 | $filenames[] = array( 255 | 'name' => $zip_name, 256 | 'filesize' => zip_entry_filesize($zip_entry), 257 | 'compressed_size' => zip_entry_compressedsize($zip_entry), 258 | 'folder' => $zip_folder 259 | //'compression_method' => zip_entry_compressionmethod($zip_entry), 260 | ); 261 | } 262 | zip_close($arch); 263 | return $filenames; 264 | } 265 | } 266 | return false; 267 | } 268 | 269 | /** 270 | * Encode html entities 271 | * @param string $text 272 | * @return string 273 | */ 274 | function fm_enc($text) 275 | { 276 | return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); 277 | } 278 | 279 | /** 280 | * This function scans the files folder recursively, and builds a large array 281 | * @param string $dir 282 | * @return json 283 | */ 284 | function scan($dir){ 285 | $files = array(); 286 | $_dir = $dir; 287 | $dir = FM_ROOT_PATH.'/'.$dir; 288 | // Is there actually such a folder/file? 289 | if(file_exists($dir)){ 290 | foreach(scandir($dir) as $f) { 291 | if(!$f || $f[0] == '.') { 292 | continue; // Ignore hidden files 293 | } 294 | 295 | if(is_dir($dir . '/' . $f)) { 296 | // The path is a folder 297 | $files[] = array( 298 | "name" => $f, 299 | "type" => "folder", 300 | "path" => $_dir.'/'.$f, 301 | "items" => scan($dir . '/' . $f), // Recursively get the contents of the folder 302 | ); 303 | } else { 304 | // It is a file 305 | $files[] = array( 306 | "name" => $f, 307 | "type" => "file", 308 | "path" => $_dir, 309 | "size" => filesize($dir . '/' . $f) // Gets the size of this file 310 | ); 311 | } 312 | } 313 | } 314 | return $files; 315 | } 316 | 317 | /** 318 | * Scan directory and return tree view 319 | * @param string $directory 320 | * @param boolean $first_call 321 | */ 322 | function php_file_tree_dir($directory, $first_call = true) { 323 | // Recursive function called by php_file_tree() to list directories/files 324 | 325 | $php_file_tree = ""; 326 | // Get and sort directories/files 327 | if( function_exists("scandir") ) $file = scandir($directory); 328 | natcasesort($file); 329 | // Make directories first 330 | $files = $dirs = array(); 331 | foreach($file as $this_file) { 332 | if( is_dir("$directory/$this_file" ) ) { 333 | if(!in_array($this_file, $GLOBALS['exclude_folders'])){ 334 | $dirs[] = $this_file; 335 | } 336 | } else { 337 | $files[] = $this_file; 338 | } 339 | } 340 | $file = array_merge($dirs, $files); 341 | 342 | if( count($file) > 2 ) { // Use 2 instead of 0 to account for . and .. "directories" 343 | $php_file_tree = "" . htmlspecialchars($this_file) . ""; 351 | $php_file_tree .= php_file_tree_dir("$directory/$this_file", false); 352 | $php_file_tree .= ""; 353 | } else { 354 | // File 355 | $ext = fm_get_file_icon_class($this_file); 356 | $path = str_replace($_SERVER['DOCUMENT_ROOT'],"",$directory); 357 | $link = "?page=be_explorer/explorer&p="."$path" ."&view=".urlencode($this_file); 358 | $php_file_tree .= "
  • " . htmlspecialchars($this_file) . "
  • "; 359 | } 360 | } 361 | } 362 | $php_file_tree .= ""; 363 | } 364 | return $php_file_tree; 365 | } 366 | 367 | /** 368 | * Scan directory and render tree view 369 | * @param string $directory 370 | */ 371 | function php_file_tree($directory) { 372 | // Remove trailing slash 373 | $code = ""; 374 | if( substr($directory, -1) == "/" ) $directory = substr($directory, 0, strlen($directory) - 1); 375 | if(function_exists('php_file_tree_dir')) { 376 | $code .= php_file_tree_dir($directory); 377 | return $code; 378 | } 379 | } 380 | 381 | /** 382 | * Save message in session 383 | * @param string $msg 384 | * @param string $status 385 | */ 386 | function fm_set_msg($msg, $status = 'ok') 387 | { 388 | $_SESSION['message'] = $msg; 389 | $_SESSION['status'] = $status; 390 | } 391 | 392 | /** 393 | * Check if string is in UTF-8 394 | * @param string $string 395 | * @return int 396 | */ 397 | function fm_is_utf8($string) 398 | { 399 | return preg_match('//u', $string); 400 | } 401 | 402 | /** 403 | * Convert file name to UTF-8 in Windows 404 | * @param string $filename 405 | * @return string 406 | */ 407 | function fm_convert_win($filename) 408 | { 409 | if (FM_IS_WIN && function_exists('iconv')) { 410 | $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename); 411 | } 412 | return $filename; 413 | } 414 | 415 | /** 416 | * Get CSS classname for file 417 | * @param string $path 418 | * @return string 419 | */ 420 | function fm_get_file_icon_class($path) 421 | { 422 | // get extension 423 | $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); 424 | 425 | switch ($ext) { 426 | case 'ico': case 'gif': case 'jpg': case 'jpeg': case 'jpc': case 'jp2': 427 | case 'jpx': case 'xbm': case 'wbmp': case 'png': case 'bmp': case 'tif': 428 | case 'tiff': case 'svg': 429 | $img = 'fa fa-picture-o'; 430 | break; 431 | case 'passwd': case 'ftpquota': case 'sql': case 'js': case 'json': case 'sh': 432 | case 'config': case 'twig': case 'tpl': case 'md': case 'gitignore': 433 | case 'c': case 'cpp': case 'cs': case 'py': case 'map': case 'lock': case 'dtd': 434 | $img = 'fa fa-file-code-o'; 435 | break; 436 | case 'txt': case 'ini': case 'conf': case 'log': case 'htaccess': 437 | $img = 'fa fa-file-text-o'; 438 | break; 439 | case 'css': case 'less': case 'sass': case 'scss': 440 | $img = 'fa fa-css3'; 441 | break; 442 | case 'zip': case 'rar': case 'gz': case 'tar': case '7z': 443 | $img = 'fa fa-file-archive-o'; 444 | break; 445 | case 'php': case 'php4': case 'php5': case 'phps': case 'phtml': 446 | $img = 'fa fa-code'; 447 | break; 448 | case 'htm': case 'html': case 'shtml': case 'xhtml': 449 | $img = 'fa fa-html5'; 450 | break; 451 | case 'xml': case 'xsl': 452 | $img = 'fa fa-file-excel-o'; 453 | break; 454 | case 'wav': case 'mp3': case 'mp2': case 'm4a': case 'aac': case 'ogg': 455 | case 'oga': case 'wma': case 'mka': case 'flac': case 'ac3': case 'tds': 456 | $img = 'fa fa-music'; 457 | break; 458 | case 'm3u': case 'm3u8': case 'pls': case 'cue': 459 | $img = 'fa fa-headphones'; 460 | break; 461 | case 'avi': case 'mpg': case 'mpeg': case 'mp4': case 'm4v': case 'flv': 462 | case 'f4v': case 'ogm': case 'ogv': case 'mov': case 'mkv': case '3gp': 463 | case 'asf': case 'wmv': 464 | $img = 'fa fa-file-video-o'; 465 | break; 466 | case 'eml': case 'msg': 467 | $img = 'fa fa-envelope-o'; 468 | break; 469 | case 'xls': case 'xlsx': 470 | $img = 'fa fa-file-excel-o'; 471 | break; 472 | case 'csv': 473 | $img = 'fa fa-file-text-o'; 474 | break; 475 | case 'bak': 476 | $img = 'fa fa-clipboard'; 477 | break; 478 | case 'doc': case 'docx': 479 | $img = 'fa fa-file-word-o'; 480 | break; 481 | case 'ppt': case 'pptx': 482 | $img = 'fa fa-file-powerpoint-o'; 483 | break; 484 | case 'ttf': case 'ttc': case 'otf': case 'woff':case 'woff2': case 'eot': case 'fon': 485 | $img = 'fa fa-font'; 486 | break; 487 | case 'pdf': 488 | $img = 'fa fa-file-pdf-o'; 489 | break; 490 | case 'psd': case 'ai': case 'eps': case 'fla': case 'swf': 491 | $img = 'fa fa-file-image-o'; 492 | break; 493 | case 'exe': case 'msi': 494 | $img = 'fa fa-file-o'; 495 | break; 496 | case 'bat': 497 | $img = 'fa fa-terminal'; 498 | break; 499 | default: 500 | $img = 'fa fa-info-circle'; 501 | } 502 | 503 | return $img; 504 | } 505 | 506 | /** 507 | * Get image files extensions 508 | * @return array 509 | */ 510 | function fm_get_image_exts() 511 | { 512 | return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd'); 513 | } 514 | 515 | /** 516 | * Get video files extensions 517 | * @return array 518 | */ 519 | function fm_get_video_exts() 520 | { 521 | return array('webm', 'mp4', 'm4v', 'ogm', 'ogv', 'mov'); 522 | } 523 | 524 | /** 525 | * Get audio files extensions 526 | * @return array 527 | */ 528 | function fm_get_audio_exts() 529 | { 530 | return array('wav', 'mp3', 'ogg', 'm4a'); 531 | } 532 | 533 | /** 534 | * Get text file extensions 535 | * @return array 536 | */ 537 | function fm_get_text_exts() 538 | { 539 | return array( 540 | 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config', 541 | 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue', 542 | 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py', 543 | 'map', 'lock', 'dtd', 'svg', 544 | ); 545 | } 546 | 547 | /** 548 | * Get mime types of text files 549 | * @return array 550 | */ 551 | function fm_get_text_mimes() 552 | { 553 | return array( 554 | 'application/xml', 555 | 'application/javascript', 556 | 'application/x-javascript', 557 | 'image/svg+xml', 558 | 'message/rfc822', 559 | ); 560 | } 561 | 562 | /** 563 | * Get file names of text files w/o extensions 564 | * @return array 565 | */ 566 | function fm_get_text_names() 567 | { 568 | return array( 569 | 'license', 570 | 'readme', 571 | 'authors', 572 | 'contributors', 573 | 'changelog', 574 | ); 575 | } 576 | 577 | /** 578 | * Class to work with zip files (using ZipArchive) 579 | */ 580 | class FM_Zipper 581 | { 582 | private $zip; 583 | 584 | public function __construct() 585 | { 586 | $this->zip = new ZipArchive(); 587 | } 588 | 589 | /** 590 | * Create archive with name $filename and files $files (RELATIVE PATHS!) 591 | * @param string $filename 592 | * @param array|string $files 593 | * @return bool 594 | */ 595 | public function create($filename, $files) 596 | { 597 | $res = $this->zip->open($filename, ZipArchive::CREATE); 598 | if ($res !== true) { 599 | return false; 600 | } 601 | if (is_array($files)) { 602 | foreach ($files as $f) { 603 | if (!$this->addFileOrDir($f)) { 604 | $this->zip->close(); 605 | return false; 606 | } 607 | } 608 | $this->zip->close(); 609 | return true; 610 | } else { 611 | if ($this->addFileOrDir($files)) { 612 | $this->zip->close(); 613 | return true; 614 | } 615 | return false; 616 | } 617 | } 618 | 619 | /** 620 | * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS) 621 | * @param string $filename 622 | * @param string $path 623 | * @return bool 624 | */ 625 | public function unzip($filename, $path) 626 | { 627 | $res = $this->zip->open($filename); 628 | if ($res !== true) { 629 | return false; 630 | } 631 | if ($this->zip->extractTo($path)) { 632 | $this->zip->close(); 633 | return true; 634 | } 635 | return false; 636 | } 637 | 638 | /** 639 | * Add file/folder to archive 640 | * @param string $filename 641 | * @return bool 642 | */ 643 | private function addFileOrDir($filename) 644 | { 645 | if (is_file($filename)) { 646 | return $this->zip->addFile($filename); 647 | } elseif (is_dir($filename)) { 648 | return $this->addDir($filename); 649 | } 650 | return false; 651 | } 652 | 653 | /** 654 | * Add folder recursively 655 | * @param string $path 656 | * @return bool 657 | */ 658 | private function addDir($path) 659 | { 660 | if (!$this->zip->addEmptyDir($path)) { 661 | return false; 662 | } 663 | $objects = scandir($path); 664 | if (is_array($objects)) { 665 | foreach ($objects as $file) { 666 | if ($file != '.' && $file != '..') { 667 | if (is_dir($path . '/' . $file)) { 668 | if (!$this->addDir($path . '/' . $file)) { 669 | return false; 670 | } 671 | } elseif (is_file($path . '/' . $file)) { 672 | if (!$this->zip->addFile($path . '/' . $file)) { 673 | return false; 674 | } 675 | } 676 | } 677 | } 678 | return true; 679 | } 680 | return false; 681 | } 682 | } 683 | 684 | //--- templates functions 685 | 686 | /** 687 | * Show nav block 688 | * @param string $path 689 | */ 690 | function fm_show_nav_path($path) 691 | { 692 | global $lang; 693 | ?> 694 |
    724 | ' . $_SESSION['message'] . '

    '; 735 | unset($_SESSION['message']); 736 | unset($_SESSION['status']); 737 | } 738 | } 739 | 740 | /** 741 | * Show page header in Login Form 742 | */ 743 | function fm_show_header_login() 744 | { 745 | 746 | // echo '
    '; 747 | 748 | } 749 | 750 | /** 751 | * Show page footer in Login Form 752 | */ 753 | function fm_show_footer_login() 754 | { 755 | 756 | echo '
    '; 757 | 758 | } 759 | 760 | /** 761 | * Show page header 762 | */ 763 | function fm_show_header() 764 | { 765 | 766 | ?> 767 | 768 |
    769 |
    X

    Create New Item

    770 | File Folder

    771 |

    772 |
    X 773 | 774 |

    Search Results

    775 |
    776 |
    777 |
    778 | 787 | 788 | 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ 838 | bWFnZVJlYWR5ccllPAAAAZVJREFUeNqkk79Lw0AUx1+uidTQim4Waxfpnl1BcHMR6uLkIF0cpYOI 839 | f4KbOFcRwbGTc0HQSVQQXCqlFIXgFkhIyvWS870LaaP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Z6enV5+eTpKTo6Oj6/v765Z/U5eX4+Pjx+Pjv0ojWBASxw8O8vL52dnfR19CvAADR3PHr6+vi 854 | 4uPDx8v/866nZDO7iNT335jtzIL+7aj86aTIztXDw8X13JOlpKJoaHDJAACltratrq3lAgKfAADb 855 | 4vb76N2au9by2I9gYGVIRkhNTE90wfXq2sh8gL8QMZ3pyn27AADr+uu1traNiIh2olTTshifodQ4 856 | ZM663PH97+YeRq2GqmRjmkGjnEDnfjLVVg6W4f7s6/p/0fr98+5UVF6wz+SjxNsmVb5RUVWMrc7d 857 | zrrIpWI8PD3pkwhCltZFYbNZja82wPv05NPRdXzhvna4uFdIiibPegGQXankxyxe0P7PnOhTkDGA 858 | gBrbhgR9fX9bW1u8nRFamcgvVrACJIvlXV06nvtdgON4mdn3og7AagBTufkucO7snJz4b28XEhIT 859 | sflynsLEvIk55kr866aewo2YuYDrnFffOTk6Li6hgAn3y8XkusCHZQbt0NP571lqRDZyMw96lZXE 860 | s6qcrMmJaTmVdRW2AAAAbnRSTlMAZodsJHZocHN7hP77gnaCZWdx/ki+RfqOd/7+zc9N/szMZlf8 861 | z8yeQybOzlv+tP5q/qKRbk78i/vZmf798s3MojiYjTj+/vqKbFc2/vvMzJiPXPzbs4z9++bj1XbN 862 | uJxhyMBWwJbp28C9tJ6L1xTnMfMAAA79SURBVGje7Jn5b8thHMcfzLDWULXq2upqHT2kbrVSrJYx 863 | NzHmviWOrCudqxhbNdZqHauKJTZHm0j0ByYkVBCTiC1+EH6YRBY/EJnjD3D84PMc3++39Z1rjp+8 864 | Kn189rT5Pt/363k+3YHEDOrCSKP16t48q8U1IysLAUKZk1obLBYDKjAUoB8ziLv4vyQLQD+Lcf4Q 865 | jvno90kfDaQTRhcioIv7QPk2oJqF0PsIT29RzQdOEhfKG6QW8lcoLIYxjWPQD2GXr/63BhYsWrQA 866 | fYc0JSaNxa8dH4zUEYag32f009DTkNTnC4WkpcRAl4ryHTt37d5/ugxCIIEfZ0Dg4poFThIXygSp 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L/0YLwv5tu7dAXCYJfthtg22tPA8yrUicFHlfDCATKYD+o/a 921 | 74QBoPVHjuJnAOIwAAy/JD9Fk37K/auif0L6LRc38IfjNQRO8AOoYRthhuxJCyTY/wwjaKZpCS/4 922 | BaBnG+NDQ/FGFvEt5zGSRNz4fSPgu8D1XTqdblCnR3zxW4yHhP7j2M/fT09dTgnr8w1DfFEfRhj0 923 | SvXWvMTwYa7gb8yA97/unQ59F5oBJnsUI6KcDz0B0H/+7S8MwG6DR8Bhd6D4Jj9GQlqPogk/JZs9 924 | K/gn5H40e7aL7oToUYAfYMvUnMw40Gkw4Q80O6XcLMRZFgYwxrKl4saJjabqjRMCf6QDdOkeldJ/ 925 | BfSnrvWLcWgYxGX6KfPswEKLZVL6yrgXvv6g9uMBoDic3B/9e36KLvDNS7TZ7K3sGdE/wfoqDQD9 926 | NGG+9AmYL/MDRM5iLo9nqDEYAJWRx5U5o+3SaHRaplS8H+Faf78Yh4bJ8k2Vz24qgJldXj8/DkCf 927 | wDy8fH/sdpujTD2KxhxM/ueA249E/wTru/Dfl05bPkeC5TI/QOAvbJjL47TnI8BDy+KlOJPV6bJM 928 | yfg3wNf+r99KxafOibNu5IQvKKsv2x9lTtEFvmGlXq9/rFeL/gnWD2kB6KcwcpB+wP/IyeP2svqp 929 | 9oeiCT9Fr1cL/gmp125aUc4P+B85iX+qJ/la0k/Ze0D0T0j93jXTpv0BYUGhQhdSooYAAAAASUVO 930 | RK5CYII=', 931 | ); 932 | } -------------------------------------------------------------------------------- /fragments/tiny.php: -------------------------------------------------------------------------------- 1 | getPath(); 4 | $functions = $path . 'functions/functions.php'; 5 | include_once $functions; 6 | /** 7 | * H3K | Tiny File Manager 8 | * CCP Programmers 9 | * http://fb.com/ccpprogrammers 10 | * https://github.com/prasathmani/tinyfilemanager 11 | */ 12 | 13 | // Default language 14 | $lang = 'de'; 15 | 16 | // Auth with login/password (set true/false to enable/disable it) 17 | $use_auth = false; 18 | 19 | // Users: array('Username' => 'Password', 'Username2' => 'Password2', ...), Password has to encripted into MD5 20 | $auth_users = array( 21 | 'admin' => '21232f297a57a5a743894a0e4a801fc3', //admin 22 | 'user' => '827ccb0eea8a706c4c34a16891f84e7b', //12345 23 | ); 24 | 25 | // Readonly users (usernames array) 26 | $readonly_users = array( 27 | 'user' 28 | ); 29 | 30 | // Show or hide files and folders that starts with a dot 31 | $show_hidden_files = $this->getConfig('show_hidden_files');; 32 | 33 | // Enable highlight.js (https://highlightjs.org/) on view's page 34 | $use_highlightjs = true; 35 | 36 | // highlight.js style 37 | $highlightjs_style = 'vs'; 38 | 39 | // Enable ace.js (https://ace.c9.io/) on view's page 40 | $edit_files = true; 41 | 42 | // Send files though mail 43 | $send_mail = false; 44 | 45 | // Send files though mail 46 | $toMailId = ""; //yourmailid@mail.com 47 | 48 | // Default timezone for date() and time() - http://php.net/manual/en/timezones.php 49 | $default_timezone = 'Etc/UTC'; // UTC 50 | 51 | // Root path for file manager 52 | $root_path = rex_path::base(); 53 | // dump($root_path); 54 | 55 | // Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder' 56 | // Will not working if $root_path will be outside of server document root 57 | $root_url = ''; 58 | 59 | 60 | // Server hostname. Can set manually if wrong 61 | $http_host = $_SERVER['HTTP_HOST']; 62 | 63 | // input encoding for iconv 64 | $iconv_input_encoding = 'UTF-8'; 65 | 66 | // date() format for file modification date 67 | $datetime_format = 'd.m.y H:i'; 68 | 69 | // allowed upload file extensions 70 | $upload_extensions = ''; // 'gif,png,jpg' 71 | 72 | // show or hide the left side tree view 73 | $show_tree_view = $this->getConfig('show_tree_view'); 74 | 75 | //Array of folders excluded from listing 76 | $GLOBALS['exclude_folders'] = array( 77 | ); 78 | 79 | // include user config php file 80 | if (defined('FM_CONFIG') && is_file(FM_CONFIG) ) { 81 | include(FM_CONFIG); 82 | } 83 | 84 | //--- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL 85 | 86 | // if fm included 87 | if (defined('FM_EMBED')) { 88 | $use_auth = false; 89 | } else { 90 | @set_time_limit(600); 91 | 92 | date_default_timezone_set($default_timezone); 93 | 94 | ini_set('default_charset', 'UTF-8'); 95 | if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) { 96 | mb_internal_encoding('UTF-8'); 97 | } 98 | if (function_exists('mb_regex_encoding')) { 99 | mb_regex_encoding('UTF-8'); 100 | } 101 | 102 | // session_cache_limiter(''); 103 | // session_id('filemanager'); 104 | // session_start(); 105 | } 106 | 107 | if (empty($auth_users)) { 108 | $use_auth = false; 109 | } 110 | 111 | $is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) 112 | || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'; 113 | 114 | // clean and check $root_path 115 | $root_path = rtrim($root_path, '\\/'); 116 | $root_path = str_replace('\\', '/', $root_path); 117 | if (!@is_dir($root_path)) { 118 | echo "

    Root path \"{$root_path}\" not found!

    "; 119 | exit; 120 | } 121 | 122 | // clean $root_url 123 | $root_url = fm_clean_path($root_url); 124 | 125 | // abs path for site 126 | defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files); 127 | defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path); 128 | defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : '')); 129 | defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']); 130 | 131 | // logout 132 | if (isset($_GET['logout'])) { 133 | unset($_SESSION['logged']); 134 | fm_redirect(FM_SELF_URL); 135 | } 136 | 137 | // Show image here 138 | if (isset($_GET['img'])) { 139 | fm_show_image($_GET['img']); 140 | } 141 | 142 | // Auth 143 | if ($use_auth) { 144 | if (isset($_SESSION['logged'], $auth_users[$_SESSION['logged']])) { 145 | // Logged 146 | } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'])) { 147 | // Logging In 148 | sleep(1); 149 | if (isset($auth_users[$_POST['fm_usr']]) && md5($_POST['fm_pwd']) === $auth_users[$_POST['fm_usr']]) { 150 | $_SESSION['logged'] = $_POST['fm_usr']; 151 | fm_set_msg('You are logged in'); 152 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p='); 153 | } else { 154 | unset($_SESSION['logged']); 155 | fm_set_msg('Wrong password', 'error'); 156 | fm_redirect(FM_SELF_URL); 157 | } 158 | } else { 159 | // Form 160 | unset($_SESSION['logged']); 161 | fm_show_header_login(); 162 | fm_show_message(); 163 | ?> 164 | 172 | %s deleted' : 'File %s deleted'; 249 | fm_set_msg(sprintf($msg, fm_enc($del))); 250 | } else { 251 | $msg = $is_dir ? 'Folder %s not deleted' : 'File %s not deleted'; 252 | fm_set_msg(sprintf($msg, fm_enc($del)), 'error'); 253 | } 254 | } else { 255 | fm_set_msg('Wrong file or folder name', 'error'); 256 | } 257 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 258 | } 259 | 260 | // Create folder 261 | if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) { 262 | $new = strip_tags($_GET['new']); 263 | $type = $_GET['type']; 264 | $new = fm_clean_path($new); 265 | $new = str_replace('/', '', $new); 266 | if ($new != '' && $new != '..' && $new != '.') { 267 | $path = FM_ROOT_PATH; 268 | if (FM_PATH != '') { 269 | $path .= '/' . FM_PATH; 270 | } 271 | if($_GET['type']=="file") { 272 | if(!file_exists($path . '/' . $new)) { 273 | @fopen($path . '/' . $new, 'w') or die('Cannot open file: '.$new); 274 | fm_set_msg(sprintf('File %s created', fm_enc($new))); 275 | } else { 276 | fm_set_msg(sprintf('File %s already exists', fm_enc($new)), 'alert'); 277 | } 278 | } else { 279 | if (fm_mkdir($path . '/' . $new, false) === true) { 280 | fm_set_msg(sprintf('Folder %s created', $new)); 281 | } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) { 282 | fm_set_msg(sprintf('Folder %s already exists', fm_enc($new)), 'alert'); 283 | } else { 284 | fm_set_msg(sprintf('Folder %s not created', fm_enc($new)), 'error'); 285 | } 286 | } 287 | } else { 288 | fm_set_msg('Wrong folder name', 'error'); 289 | } 290 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 291 | } 292 | 293 | // Copy folder / file 294 | if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) { 295 | // from 296 | $copy = $_GET['copy']; 297 | $copy = fm_clean_path($copy); 298 | // empty path 299 | if ($copy == '') { 300 | fm_set_msg('Source path not defined', 'error'); 301 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 302 | } 303 | // abs path from 304 | $from = FM_ROOT_PATH . '/' . $copy; 305 | // abs path to 306 | $dest = FM_ROOT_PATH; 307 | if (FM_PATH != '') { 308 | $dest .= '/' . FM_PATH; 309 | } 310 | $dest .= '/' . basename($from); 311 | // move? 312 | $move = isset($_GET['move']); 313 | // copy/move 314 | if ($from != $dest) { 315 | $msg_from = trim(FM_PATH . '/' . basename($from), '/'); 316 | if ($move) { 317 | $rename = fm_rename($from, $dest); 318 | if ($rename) { 319 | fm_set_msg(sprintf('Moved from %s to %s', fm_enc($copy), fm_enc($msg_from))); 320 | } elseif ($rename === null) { 321 | fm_set_msg('File or folder with this path already exists', 'alert'); 322 | } else { 323 | fm_set_msg(sprintf('Error while moving from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error'); 324 | } 325 | } else { 326 | if (fm_rcopy($from, $dest)) { 327 | fm_set_msg(sprintf('Copyied from %s to %s', fm_enc($copy), fm_enc($msg_from))); 328 | } else { 329 | fm_set_msg(sprintf('Error while copying from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error'); 330 | } 331 | } 332 | } else { 333 | fm_set_msg('Paths must be not equal', 'alert'); 334 | } 335 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 336 | } 337 | 338 | // Mass copy files/ folders 339 | if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) { 340 | // from 341 | $path = FM_ROOT_PATH; 342 | if (FM_PATH != '') { 343 | $path .= '/' . FM_PATH; 344 | } 345 | // to 346 | $copy_to_path = FM_ROOT_PATH; 347 | $copy_to = fm_clean_path($_POST['copy_to']); 348 | if ($copy_to != '') { 349 | $copy_to_path .= '/' . $copy_to; 350 | } 351 | if ($path == $copy_to_path) { 352 | fm_set_msg('Paths must be not equal', 'alert'); 353 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 354 | } 355 | if (!is_dir($copy_to_path)) { 356 | if (!fm_mkdir($copy_to_path, true)) { 357 | fm_set_msg('Unable to create destination folder', 'error'); 358 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 359 | } 360 | } 361 | // move? 362 | $move = isset($_POST['move']); 363 | // copy/move 364 | $errors = 0; 365 | $files = $_POST['file']; 366 | if (is_array($files) && count($files)) { 367 | foreach ($files as $f) { 368 | if ($f != '') { 369 | // abs path from 370 | $from = $path . '/' . $f; 371 | // abs path to 372 | $dest = $copy_to_path . '/' . $f; 373 | // do 374 | if ($move) { 375 | $rename = fm_rename($from, $dest); 376 | if ($rename === false) { 377 | $errors++; 378 | } 379 | } else { 380 | if (!fm_rcopy($from, $dest)) { 381 | $errors++; 382 | } 383 | } 384 | } 385 | } 386 | if ($errors == 0) { 387 | $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied'; 388 | fm_set_msg($msg); 389 | } else { 390 | $msg = $move ? 'Error while moving items' : 'Error while copying items'; 391 | fm_set_msg($msg, 'error'); 392 | } 393 | } else { 394 | fm_set_msg('Nothing selected', 'alert'); 395 | } 396 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 397 | } 398 | 399 | // Rename 400 | if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) { 401 | // old name 402 | $old = $_GET['ren']; 403 | $old = fm_clean_path($old); 404 | $old = str_replace('/', '', $old); 405 | // new name 406 | $new = $_GET['to']; 407 | $new = fm_clean_path($new); 408 | $new = str_replace('/', '', $new); 409 | // path 410 | $path = FM_ROOT_PATH; 411 | if (FM_PATH != '') { 412 | $path .= '/' . FM_PATH; 413 | } 414 | // rename 415 | if ($old != '' && $new != '') { 416 | if (fm_rename($path . '/' . $old, $path . '/' . $new)) { 417 | fm_set_msg(sprintf('Renamed from %s to %s', fm_enc($old), fm_enc($new))); 418 | } else { 419 | fm_set_msg(sprintf('Error while renaming from %s to %s', fm_enc($old), fm_enc($new)), 'error'); 420 | } 421 | } else { 422 | fm_set_msg('Names not set', 'error'); 423 | } 424 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 425 | } 426 | 427 | // Download 428 | if (isset($_GET['dl'])) { 429 | $dl = $_GET['dl']; 430 | $dl = fm_clean_path($dl); 431 | $dl = str_replace('/', '', $dl); 432 | $path = FM_ROOT_PATH; 433 | if (FM_PATH != '') { 434 | $path .= '/' . FM_PATH; 435 | } 436 | if ($dl != '' && is_file($path . '/' . $dl)) { 437 | header('Content-Description: File Transfer'); 438 | header('Content-Type: application/octet-stream'); 439 | header('Content-Disposition: attachment; filename="' . basename($path . '/' . $dl) . '"'); 440 | header('Content-Transfer-Encoding: binary'); 441 | header('Connection: Keep-Alive'); 442 | header('Expires: 0'); 443 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 444 | header('Pragma: public'); 445 | header('Content-Length: ' . filesize($path . '/' . $dl)); 446 | readfile($path . '/' . $dl); 447 | exit; 448 | } else { 449 | fm_set_msg('File not found', 'error'); 450 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 451 | } 452 | } 453 | 454 | // Upload 455 | if (!empty($_FILES) && !FM_READONLY) { 456 | $f = $_FILES; 457 | $path = FM_ROOT_PATH; 458 | if (FM_PATH != '') { 459 | $path .= '/' . FM_PATH; 460 | } 461 | 462 | $errors = 0; 463 | $uploads = 0; 464 | $total = count($f['file']['name']); 465 | $allowed = (FM_EXTENSION) ? explode(',', FM_EXTENSION) : false; 466 | 467 | $filename = $f['file']['name']; 468 | $tmp_name = $f['file']['tmp_name']; 469 | $ext = pathinfo($filename, PATHINFO_EXTENSION); 470 | $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; 471 | 472 | if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) { 473 | if (move_uploaded_file($tmp_name, $path . '/' . $f['file']['name'])) { 474 | die('Successfully uploaded'); 475 | } else { 476 | die(sprintf('Error while uploading files. Uploaded files: %s', $uploads)); 477 | } 478 | } 479 | exit(); 480 | } 481 | 482 | // Mass deleting 483 | if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) { 484 | $path = FM_ROOT_PATH; 485 | if (FM_PATH != '') { 486 | $path .= '/' . FM_PATH; 487 | } 488 | 489 | $errors = 0; 490 | $files = $_POST['file']; 491 | if (is_array($files) && count($files)) { 492 | foreach ($files as $f) { 493 | if ($f != '') { 494 | $new_path = $path . '/' . $f; 495 | if (!fm_rdelete($new_path)) { 496 | $errors++; 497 | } 498 | } 499 | } 500 | if ($errors == 0) { 501 | fm_set_msg('Selected files and folder deleted'); 502 | } else { 503 | fm_set_msg('Error while deleting items', 'error'); 504 | } 505 | } else { 506 | fm_set_msg('Nothing selected', 'alert'); 507 | } 508 | 509 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 510 | } 511 | 512 | // Pack files 513 | if (isset($_POST['group'], $_POST['zip']) && !FM_READONLY) { 514 | $path = FM_ROOT_PATH; 515 | if (FM_PATH != '') { 516 | $path .= '/' . FM_PATH; 517 | } 518 | 519 | if (!class_exists('ZipArchive')) { 520 | fm_set_msg('Operations with archives are not available', 'error'); 521 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 522 | } 523 | 524 | $files = $_POST['file']; 525 | if (!empty($files)) { 526 | chdir($path); 527 | 528 | if (count($files) == 1) { 529 | $one_file = reset($files); 530 | $one_file = basename($one_file); 531 | $zipname = $one_file . '_' . date('ymd_His') . '.zip'; 532 | } else { 533 | $zipname = 'archive_' . date('ymd_His') . '.zip'; 534 | } 535 | 536 | $zipper = new FM_Zipper(); 537 | $res = $zipper->create($zipname, $files); 538 | 539 | if ($res) { 540 | fm_set_msg(sprintf('Archive %s created', fm_enc($zipname))); 541 | } else { 542 | fm_set_msg('Archive not created', 'error'); 543 | } 544 | } else { 545 | fm_set_msg('Nothing selected', 'alert'); 546 | } 547 | 548 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 549 | } 550 | 551 | // Unpack 552 | if (isset($_GET['unzip']) && !FM_READONLY) { 553 | $unzip = $_GET['unzip']; 554 | $unzip = fm_clean_path($unzip); 555 | $unzip = str_replace('/', '', $unzip); 556 | 557 | $path = FM_ROOT_PATH; 558 | if (FM_PATH != '') { 559 | $path .= '/' . FM_PATH; 560 | } 561 | 562 | if (!class_exists('ZipArchive')) { 563 | fm_set_msg('Operations with archives are not available', 'error'); 564 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 565 | } 566 | 567 | if ($unzip != '' && is_file($path . '/' . $unzip)) { 568 | $zip_path = $path . '/' . $unzip; 569 | 570 | //to folder 571 | $tofolder = ''; 572 | if (isset($_GET['tofolder'])) { 573 | $tofolder = pathinfo($zip_path, PATHINFO_FILENAME); 574 | if (fm_mkdir($path . '/' . $tofolder, true)) { 575 | $path .= '/' . $tofolder; 576 | } 577 | } 578 | 579 | $zipper = new FM_Zipper(); 580 | $res = $zipper->unzip($zip_path, $path); 581 | 582 | if ($res) { 583 | fm_set_msg('Archive unpacked'); 584 | } else { 585 | fm_set_msg('Archive not unpacked', 'error'); 586 | } 587 | 588 | } else { 589 | fm_set_msg('File not found', 'error'); 590 | } 591 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 592 | } 593 | 594 | // Change Perms (not for Windows) 595 | if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) { 596 | $path = FM_ROOT_PATH; 597 | if (FM_PATH != '') { 598 | $path .= '/' . FM_PATH; 599 | } 600 | 601 | $file = $_POST['chmod']; 602 | $file = fm_clean_path($file); 603 | $file = str_replace('/', '', $file); 604 | if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) { 605 | fm_set_msg('File not found', 'error'); 606 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 607 | } 608 | 609 | $mode = 0; 610 | if (!empty($_POST['ur'])) { 611 | $mode |= 0400; 612 | } 613 | if (!empty($_POST['uw'])) { 614 | $mode |= 0200; 615 | } 616 | if (!empty($_POST['ux'])) { 617 | $mode |= 0100; 618 | } 619 | if (!empty($_POST['gr'])) { 620 | $mode |= 0040; 621 | } 622 | if (!empty($_POST['gw'])) { 623 | $mode |= 0020; 624 | } 625 | if (!empty($_POST['gx'])) { 626 | $mode |= 0010; 627 | } 628 | if (!empty($_POST['or'])) { 629 | $mode |= 0004; 630 | } 631 | if (!empty($_POST['ow'])) { 632 | $mode |= 0002; 633 | } 634 | if (!empty($_POST['ox'])) { 635 | $mode |= 0001; 636 | } 637 | 638 | if (@chmod($path . '/' . $file, $mode)) { 639 | fm_set_msg('Permissions changed'); 640 | } else { 641 | fm_set_msg('Permissions not changed', 'error'); 642 | } 643 | 644 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p=' . urlencode(FM_PATH)); 645 | } 646 | 647 | /*************************** /ACTIONS ***************************/ 648 | 649 | // get current path 650 | $path = FM_ROOT_PATH; 651 | if (FM_PATH != '') { 652 | $path .= '/' . FM_PATH; 653 | } 654 | 655 | // check path 656 | if (!is_dir($path)) { 657 | fm_redirect(FM_SELF_URL . '?page=be_explorer/explorer&p='); 658 | } 659 | 660 | // get parent folder 661 | $parent = fm_get_parent_path(FM_PATH); 662 | 663 | $objects = is_readable($path) ? scandir($path) : array(); 664 | $folders = array(); 665 | $files = array(); 666 | if (is_array($objects)) { 667 | foreach ($objects as $file) { 668 | if ($file == '.' || $file == '..' && in_array($file, $GLOBALS['exclude_folders'])) { 669 | continue; 670 | } 671 | if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') { 672 | continue; 673 | } 674 | $new_path = $path . '/' . $file; 675 | if (is_file($new_path)) { 676 | $files[] = $file; 677 | } elseif (is_dir($new_path) && $file != '.' && $file != '..' && !in_array($file, $GLOBALS['exclude_folders'])) { 678 | $folders[] = $file; 679 | } 680 | } 681 | } 682 | 683 | if (!empty($files)) { 684 | natcasesort($files); 685 | } 686 | if (!empty($folders)) { 687 | natcasesort($folders); 688 | } 689 | 690 | // upload form 691 | if (isset($_GET['upload']) && !FM_READONLY) { 692 | fm_show_header(); // HEADER 693 | fm_show_nav_path(FM_PATH); // current path 694 | ?> 695 | 696 | 697 | 698 | 699 |
    700 |

    i18n('be_explorer_explorer_upload_files');?>

    701 |

    i18n('be_explorer_explorer_destination_folder');?>:

    702 |
    " class="dropzone" id="fileuploader" enctype="multipart/form-data"> 703 | 704 |
    705 | 706 |
    707 |
    708 | 709 |
    710 | 726 |
    727 |

    Copying

    728 |
    729 | 730 | 731 | ' . PHP_EOL; 734 | } 735 | ?> 736 |

    Files: , ', $copy_files) ?>

    737 |

    Source folder:
    738 | 739 | / 740 |

    741 |

    742 |

    743 |   744 | Cancel 745 |

    746 | 747 |
    748 | 765 |
    766 |

    Copying

    767 |

    768 | Source path:
    769 | Destination folder: 770 |

    771 |

    772 | Copy   773 | Move   774 | Cancel 775 |

    776 |

    Select folder

    777 |
      778 | 781 |
    • ..
    • 782 | 786 |
    • 787 | 790 |
    791 |
    792 | 846 |
    847 |

    ""

    848 |

    849 | i18n('be_explorer_explorer_full_path');?>:
    850 | i18n('be_explorer_explorer_full_size');?>: = 1000): ?> ()
    851 | MIME-type:
    852 | 866 | Files in archive:
    867 | Total size:
    868 | Size in archive:
    869 | Compression: %
    870 | '; 876 | } 877 | // Text info 878 | if ($is_text) { 879 | $is_utf8 = fm_is_utf8($content); 880 | if (function_exists('iconv')) { 881 | if (!$is_utf8) { 882 | $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content); 883 | } 884 | } 885 | echo 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '
    '; 886 | } 887 | ?> 888 |

    889 |

    890 | i18n('be_explorer_explorer_download');?>   891 | i18n('be_explorer_explorer_open');?>   892 | 897 | UnZip   898 | 899 | UnZip to folder   900 | 904 | i18n('be_explorer_explorer_edit');?>   905 | i18n('be_explorer_explorer_advanced_edit');?>   906 | 909 | i18n('be_explorer_explorer_mail');?>   910 | 911 | i18n('be_explorer_explorer_back');?> 912 |

    913 | '; 918 | foreach ($filenames as $fn) { 919 | if ($fn['folder']) { 920 | echo '' . fm_enc($fn['name']) . '
    '; 921 | } else { 922 | echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')
    '; 923 | } 924 | } 925 | echo ''; 926 | } else { 927 | echo '

    Error while fetching archive info

    '; 928 | } 929 | } elseif ($is_image) { 930 | // Image content 931 | if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico'))) { 932 | echo '

    '; 933 | } 934 | } elseif ($is_audio) { 935 | // Audio content 936 | echo '

    '; 937 | } elseif ($is_video) { 938 | // Video content 939 | echo '
    '; 940 | } elseif ($is_text) { 941 | if (FM_USE_HIGHLIGHTJS) { 942 | // highlight 943 | $hljs_classes = array( 944 | 'shtml' => 'xml', 945 | 'htaccess' => 'apache', 946 | 'phtml' => 'php', 947 | 'lock' => 'json', 948 | 'svg' => 'xml', 949 | ); 950 | $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext; 951 | if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) { 952 | $hljs_class = 'nohighlight'; 953 | } 954 | $content = '
    ' . fm_enc($content) . '
    '; 955 | } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) { 956 | // php highlight 957 | $content = highlight_string($content, true); 958 | } else { 959 | $content = '
    ' . fm_enc($content) . '
    '; 960 | } 961 | echo $content; 962 | } 963 | ?> 964 |
    965 | 1015 |
    1016 | '. htmlspecialchars($content) .''; 1019 | } elseif ($is_text) { 1020 | echo ''; 1021 | } else { 1022 | fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error'); 1023 | } 1024 | ?> 1025 |
    1026 |
    1027 | 1028 | 1029 | 1030 | i18n('be_explorer_explorer_advanced_edit');?> 1031 | 1032 | 1033 | 1034 | i18n('be_explorer_explorer_edit');?> 1035 | 1036 | 1037 | 1038 | i18n('be_explorer_explorer_backup');?> 1039 | i18n('be_explorer_explorer_cancel');?> 1040 |
    1041 | 1065 |
    1066 |

    1067 |

    1068 |
    1069 |

    1070 |
    1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 |
    OwnerGroupOther
    Read
    Write
    Execute
    1100 | 1101 |

    1102 |   1103 | Cancel 1104 |

    1105 | 1106 |
    1107 | 1108 |
    1109 | 1125 |
    1126 | 1127 | 1128 | 1129 |
    1130 |
    i18n('be_explorer_explorer_tree_title')?>
    1131 | 1135 |
    1136 |
    1137 | 1138 |
    1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1150 | 1151 | '?'); 1163 | $group = array('name' => '?'); 1164 | } 1165 | ?> 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1181 | '?'); 1199 | $group = array('name' => '?'); 1200 | } 1201 | ?> 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1220 | 1226 | 1227 | 1230 | 1235 | 1238 |
    i18n('be_explorer_explorer_name')?>i18n('be_explorer_explorer_size')?>i18n('be_explorer_explorer_modified')?>i18n('be_explorer_explorer_perms')?>i18n('be_explorer_explorer_owner')?>i18n('be_explorer_explorer_actions')?>
    ..
    ' . readlink($path . '/' . $f) . '' : '') ?>
    Folder 1175 | 1176 | 1177 | 1178 | 1179 | 1180 |
    ' . readlink($path . '/' . $f) . '' : '') ?>
    1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 |
    1231 | i18n('be_explorer_explorer_full_size');?>: , 1232 | files: , 1233 | folders: 1234 |
    1239 |
    1240 | 1241 | 1252 | 1253 | 1254 | 1255 | 'Password', 'Username2' => 'Password2', ...), Password has to encripted into MD5 16 | $auth_users = array( 17 | 'admin' => '21232f297a57a5a743894a0e4a801fc3', //admin 18 | 'user' => '827ccb0eea8a706c4c34a16891f84e7b', //12345 19 | ); 20 | 21 | // Readonly users (usernames array) 22 | $readonly_users = array( 23 | 'user' 24 | ); 25 | 26 | // Show or hide files and folders that starts with a dot 27 | $show_hidden_files = true; 28 | 29 | // Enable highlight.js (https://highlightjs.org/) on view's page 30 | $use_highlightjs = true; 31 | 32 | // highlight.js style 33 | $highlightjs_style = 'vs'; 34 | 35 | // Enable ace.js (https://ace.c9.io/) on view's page 36 | $edit_files = true; 37 | 38 | // Send files though mail 39 | $send_mail = false; 40 | 41 | // Send files though mail 42 | $toMailId = ""; //yourmailid@mail.com 43 | 44 | // Default timezone for date() and time() - http://php.net/manual/en/timezones.php 45 | $default_timezone = 'Etc/UTC'; // UTC 46 | 47 | // Root path for file manager 48 | $root_path = $_SERVER['DOCUMENT_ROOT']; 49 | 50 | // Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder' 51 | // Will not working if $root_path will be outside of server document root 52 | $root_url = ''; 53 | 54 | // Server hostname. Can set manually if wrong 55 | $http_host = $_SERVER['HTTP_HOST']; 56 | 57 | // input encoding for iconv 58 | $iconv_input_encoding = 'UTF-8'; 59 | 60 | // date() format for file modification date 61 | $datetime_format = 'd.m.y H:i'; 62 | 63 | // allowed upload file extensions 64 | $upload_extensions = ''; // 'gif,png,jpg' 65 | 66 | // show or hide the left side tree view 67 | $show_tree_view = false; 68 | 69 | //Array of folders excluded from listing 70 | $GLOBALS['exclude_folders'] = array( 71 | ); 72 | 73 | // include user config php file 74 | if (defined('FM_CONFIG') && is_file(FM_CONFIG) ) { 75 | include(FM_CONFIG); 76 | } 77 | 78 | //--- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL 79 | 80 | // if fm included 81 | if (defined('FM_EMBED')) { 82 | $use_auth = false; 83 | } else { 84 | @set_time_limit(600); 85 | 86 | date_default_timezone_set($default_timezone); 87 | 88 | ini_set('default_charset', 'UTF-8'); 89 | if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) { 90 | mb_internal_encoding('UTF-8'); 91 | } 92 | if (function_exists('mb_regex_encoding')) { 93 | mb_regex_encoding('UTF-8'); 94 | } 95 | 96 | session_cache_limiter(''); 97 | session_name('filemanager'); 98 | session_start(); 99 | } 100 | 101 | if (empty($auth_users)) { 102 | $use_auth = false; 103 | } 104 | 105 | $is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) 106 | || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'; 107 | 108 | // clean and check $root_path 109 | $root_path = rtrim($root_path, '\\/'); 110 | $root_path = str_replace('\\', '/', $root_path); 111 | if (!@is_dir($root_path)) { 112 | echo "

    Root path \"{$root_path}\" not found!

    "; 113 | exit; 114 | } 115 | 116 | // clean $root_url 117 | $root_url = fm_clean_path($root_url); 118 | 119 | // abs path for site 120 | defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files); 121 | defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path); 122 | defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : '')); 123 | defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']); 124 | 125 | // logout 126 | if (isset($_GET['logout'])) { 127 | unset($_SESSION['logged']); 128 | fm_redirect(FM_SELF_URL); 129 | } 130 | 131 | // Show image here 132 | if (isset($_GET['img'])) { 133 | fm_show_image($_GET['img']); 134 | } 135 | 136 | // Auth 137 | if ($use_auth) { 138 | if (isset($_SESSION['logged'], $auth_users[$_SESSION['logged']])) { 139 | // Logged 140 | } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'])) { 141 | // Logging In 142 | sleep(1); 143 | if (isset($auth_users[$_POST['fm_usr']]) && md5($_POST['fm_pwd']) === $auth_users[$_POST['fm_usr']]) { 144 | $_SESSION['logged'] = $_POST['fm_usr']; 145 | fm_set_msg('You are logged in'); 146 | fm_redirect(FM_SELF_URL . '?p='); 147 | } else { 148 | unset($_SESSION['logged']); 149 | fm_set_msg('Wrong password', 'error'); 150 | fm_redirect(FM_SELF_URL); 151 | } 152 | } else { 153 | // Form 154 | unset($_SESSION['logged']); 155 | fm_show_header_login(); 156 | fm_show_message(); 157 | ?> 158 | 166 | %s
    deleted' : 'File %s deleted'; 243 | fm_set_msg(sprintf($msg, fm_enc($del))); 244 | } else { 245 | $msg = $is_dir ? 'Folder %s not deleted' : 'File %s not deleted'; 246 | fm_set_msg(sprintf($msg, fm_enc($del)), 'error'); 247 | } 248 | } else { 249 | fm_set_msg('Wrong file or folder name', 'error'); 250 | } 251 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 252 | } 253 | 254 | // Create folder 255 | if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) { 256 | $new = strip_tags($_GET['new']); 257 | $type = $_GET['type']; 258 | $new = fm_clean_path($new); 259 | $new = str_replace('/', '', $new); 260 | if ($new != '' && $new != '..' && $new != '.') { 261 | $path = FM_ROOT_PATH; 262 | if (FM_PATH != '') { 263 | $path .= '/' . FM_PATH; 264 | } 265 | if($_GET['type']=="file") { 266 | if(!file_exists($path . '/' . $new)) { 267 | @fopen($path . '/' . $new, 'w') or die('Cannot open file: '.$new); 268 | fm_set_msg(sprintf('File %s created', fm_enc($new))); 269 | } else { 270 | fm_set_msg(sprintf('File %s already exists', fm_enc($new)), 'alert'); 271 | } 272 | } else { 273 | if (fm_mkdir($path . '/' . $new, false) === true) { 274 | fm_set_msg(sprintf('Folder %s created', $new)); 275 | } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) { 276 | fm_set_msg(sprintf('Folder %s already exists', fm_enc($new)), 'alert'); 277 | } else { 278 | fm_set_msg(sprintf('Folder %s not created', fm_enc($new)), 'error'); 279 | } 280 | } 281 | } else { 282 | fm_set_msg('Wrong folder name', 'error'); 283 | } 284 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 285 | } 286 | 287 | // Copy folder / file 288 | if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) { 289 | // from 290 | $copy = $_GET['copy']; 291 | $copy = fm_clean_path($copy); 292 | // empty path 293 | if ($copy == '') { 294 | fm_set_msg('Source path not defined', 'error'); 295 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 296 | } 297 | // abs path from 298 | $from = FM_ROOT_PATH . '/' . $copy; 299 | // abs path to 300 | $dest = FM_ROOT_PATH; 301 | if (FM_PATH != '') { 302 | $dest .= '/' . FM_PATH; 303 | } 304 | $dest .= '/' . basename($from); 305 | // move? 306 | $move = isset($_GET['move']); 307 | // copy/move 308 | if ($from != $dest) { 309 | $msg_from = trim(FM_PATH . '/' . basename($from), '/'); 310 | if ($move) { 311 | $rename = fm_rename($from, $dest); 312 | if ($rename) { 313 | fm_set_msg(sprintf('Moved from %s to %s', fm_enc($copy), fm_enc($msg_from))); 314 | } elseif ($rename === null) { 315 | fm_set_msg('File or folder with this path already exists', 'alert'); 316 | } else { 317 | fm_set_msg(sprintf('Error while moving from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error'); 318 | } 319 | } else { 320 | if (fm_rcopy($from, $dest)) { 321 | fm_set_msg(sprintf('Copyied from %s to %s', fm_enc($copy), fm_enc($msg_from))); 322 | } else { 323 | fm_set_msg(sprintf('Error while copying from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error'); 324 | } 325 | } 326 | } else { 327 | fm_set_msg('Paths must be not equal', 'alert'); 328 | } 329 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 330 | } 331 | 332 | // Mass copy files/ folders 333 | if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) { 334 | // from 335 | $path = FM_ROOT_PATH; 336 | if (FM_PATH != '') { 337 | $path .= '/' . FM_PATH; 338 | } 339 | // to 340 | $copy_to_path = FM_ROOT_PATH; 341 | $copy_to = fm_clean_path($_POST['copy_to']); 342 | if ($copy_to != '') { 343 | $copy_to_path .= '/' . $copy_to; 344 | } 345 | if ($path == $copy_to_path) { 346 | fm_set_msg('Paths must be not equal', 'alert'); 347 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 348 | } 349 | if (!is_dir($copy_to_path)) { 350 | if (!fm_mkdir($copy_to_path, true)) { 351 | fm_set_msg('Unable to create destination folder', 'error'); 352 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 353 | } 354 | } 355 | // move? 356 | $move = isset($_POST['move']); 357 | // copy/move 358 | $errors = 0; 359 | $files = $_POST['file']; 360 | if (is_array($files) && count($files)) { 361 | foreach ($files as $f) { 362 | if ($f != '') { 363 | // abs path from 364 | $from = $path . '/' . $f; 365 | // abs path to 366 | $dest = $copy_to_path . '/' . $f; 367 | // do 368 | if ($move) { 369 | $rename = fm_rename($from, $dest); 370 | if ($rename === false) { 371 | $errors++; 372 | } 373 | } else { 374 | if (!fm_rcopy($from, $dest)) { 375 | $errors++; 376 | } 377 | } 378 | } 379 | } 380 | if ($errors == 0) { 381 | $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied'; 382 | fm_set_msg($msg); 383 | } else { 384 | $msg = $move ? 'Error while moving items' : 'Error while copying items'; 385 | fm_set_msg($msg, 'error'); 386 | } 387 | } else { 388 | fm_set_msg('Nothing selected', 'alert'); 389 | } 390 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 391 | } 392 | 393 | // Rename 394 | if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) { 395 | // old name 396 | $old = $_GET['ren']; 397 | $old = fm_clean_path($old); 398 | $old = str_replace('/', '', $old); 399 | // new name 400 | $new = $_GET['to']; 401 | $new = fm_clean_path($new); 402 | $new = str_replace('/', '', $new); 403 | // path 404 | $path = FM_ROOT_PATH; 405 | if (FM_PATH != '') { 406 | $path .= '/' . FM_PATH; 407 | } 408 | // rename 409 | if ($old != '' && $new != '') { 410 | if (fm_rename($path . '/' . $old, $path . '/' . $new)) { 411 | fm_set_msg(sprintf('Renamed from %s to %s', fm_enc($old), fm_enc($new))); 412 | } else { 413 | fm_set_msg(sprintf('Error while renaming from %s to %s', fm_enc($old), fm_enc($new)), 'error'); 414 | } 415 | } else { 416 | fm_set_msg('Names not set', 'error'); 417 | } 418 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 419 | } 420 | 421 | // Download 422 | if (isset($_GET['dl'])) { 423 | $dl = $_GET['dl']; 424 | $dl = fm_clean_path($dl); 425 | $dl = str_replace('/', '', $dl); 426 | $path = FM_ROOT_PATH; 427 | if (FM_PATH != '') { 428 | $path .= '/' . FM_PATH; 429 | } 430 | if ($dl != '' && is_file($path . '/' . $dl)) { 431 | header('Content-Description: File Transfer'); 432 | header('Content-Type: application/octet-stream'); 433 | header('Content-Disposition: attachment; filename="' . basename($path . '/' . $dl) . '"'); 434 | header('Content-Transfer-Encoding: binary'); 435 | header('Connection: Keep-Alive'); 436 | header('Expires: 0'); 437 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 438 | header('Pragma: public'); 439 | header('Content-Length: ' . filesize($path . '/' . $dl)); 440 | readfile($path . '/' . $dl); 441 | exit; 442 | } else { 443 | fm_set_msg('File not found', 'error'); 444 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 445 | } 446 | } 447 | 448 | // Upload 449 | if (!empty($_FILES) && !FM_READONLY) { 450 | $f = $_FILES; 451 | $path = FM_ROOT_PATH; 452 | if (FM_PATH != '') { 453 | $path .= '/' . FM_PATH; 454 | } 455 | 456 | $errors = 0; 457 | $uploads = 0; 458 | $total = count($f['file']['name']); 459 | $allowed = (FM_EXTENSION) ? explode(',', FM_EXTENSION) : false; 460 | 461 | $filename = $f['file']['name']; 462 | $tmp_name = $f['file']['tmp_name']; 463 | $ext = pathinfo($filename, PATHINFO_EXTENSION); 464 | $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; 465 | 466 | if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) { 467 | if (move_uploaded_file($tmp_name, $path . '/' . $f['file']['name'])) { 468 | die('Successfully uploaded'); 469 | } else { 470 | die(sprintf('Error while uploading files. Uploaded files: %s', $uploads)); 471 | } 472 | } 473 | exit(); 474 | } 475 | 476 | // Mass deleting 477 | if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) { 478 | $path = FM_ROOT_PATH; 479 | if (FM_PATH != '') { 480 | $path .= '/' . FM_PATH; 481 | } 482 | 483 | $errors = 0; 484 | $files = $_POST['file']; 485 | if (is_array($files) && count($files)) { 486 | foreach ($files as $f) { 487 | if ($f != '') { 488 | $new_path = $path . '/' . $f; 489 | if (!fm_rdelete($new_path)) { 490 | $errors++; 491 | } 492 | } 493 | } 494 | if ($errors == 0) { 495 | fm_set_msg('Selected files and folder deleted'); 496 | } else { 497 | fm_set_msg('Error while deleting items', 'error'); 498 | } 499 | } else { 500 | fm_set_msg('Nothing selected', 'alert'); 501 | } 502 | 503 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 504 | } 505 | 506 | // Pack files 507 | if (isset($_POST['group'], $_POST['zip']) && !FM_READONLY) { 508 | $path = FM_ROOT_PATH; 509 | if (FM_PATH != '') { 510 | $path .= '/' . FM_PATH; 511 | } 512 | 513 | if (!class_exists('ZipArchive')) { 514 | fm_set_msg('Operations with archives are not available', 'error'); 515 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 516 | } 517 | 518 | $files = $_POST['file']; 519 | if (!empty($files)) { 520 | chdir($path); 521 | 522 | if (count($files) == 1) { 523 | $one_file = reset($files); 524 | $one_file = basename($one_file); 525 | $zipname = $one_file . '_' . date('ymd_His') . '.zip'; 526 | } else { 527 | $zipname = 'archive_' . date('ymd_His') . '.zip'; 528 | } 529 | 530 | $zipper = new FM_Zipper(); 531 | $res = $zipper->create($zipname, $files); 532 | 533 | if ($res) { 534 | fm_set_msg(sprintf('Archive %s created', fm_enc($zipname))); 535 | } else { 536 | fm_set_msg('Archive not created', 'error'); 537 | } 538 | } else { 539 | fm_set_msg('Nothing selected', 'alert'); 540 | } 541 | 542 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 543 | } 544 | 545 | // Unpack 546 | if (isset($_GET['unzip']) && !FM_READONLY) { 547 | $unzip = $_GET['unzip']; 548 | $unzip = fm_clean_path($unzip); 549 | $unzip = str_replace('/', '', $unzip); 550 | 551 | $path = FM_ROOT_PATH; 552 | if (FM_PATH != '') { 553 | $path .= '/' . FM_PATH; 554 | } 555 | 556 | if (!class_exists('ZipArchive')) { 557 | fm_set_msg('Operations with archives are not available', 'error'); 558 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 559 | } 560 | 561 | if ($unzip != '' && is_file($path . '/' . $unzip)) { 562 | $zip_path = $path . '/' . $unzip; 563 | 564 | //to folder 565 | $tofolder = ''; 566 | if (isset($_GET['tofolder'])) { 567 | $tofolder = pathinfo($zip_path, PATHINFO_FILENAME); 568 | if (fm_mkdir($path . '/' . $tofolder, true)) { 569 | $path .= '/' . $tofolder; 570 | } 571 | } 572 | 573 | $zipper = new FM_Zipper(); 574 | $res = $zipper->unzip($zip_path, $path); 575 | 576 | if ($res) { 577 | fm_set_msg('Archive unpacked'); 578 | } else { 579 | fm_set_msg('Archive not unpacked', 'error'); 580 | } 581 | 582 | } else { 583 | fm_set_msg('File not found', 'error'); 584 | } 585 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 586 | } 587 | 588 | // Change Perms (not for Windows) 589 | if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) { 590 | $path = FM_ROOT_PATH; 591 | if (FM_PATH != '') { 592 | $path .= '/' . FM_PATH; 593 | } 594 | 595 | $file = $_POST['chmod']; 596 | $file = fm_clean_path($file); 597 | $file = str_replace('/', '', $file); 598 | if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) { 599 | fm_set_msg('File not found', 'error'); 600 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 601 | } 602 | 603 | $mode = 0; 604 | if (!empty($_POST['ur'])) { 605 | $mode |= 0400; 606 | } 607 | if (!empty($_POST['uw'])) { 608 | $mode |= 0200; 609 | } 610 | if (!empty($_POST['ux'])) { 611 | $mode |= 0100; 612 | } 613 | if (!empty($_POST['gr'])) { 614 | $mode |= 0040; 615 | } 616 | if (!empty($_POST['gw'])) { 617 | $mode |= 0020; 618 | } 619 | if (!empty($_POST['gx'])) { 620 | $mode |= 0010; 621 | } 622 | if (!empty($_POST['or'])) { 623 | $mode |= 0004; 624 | } 625 | if (!empty($_POST['ow'])) { 626 | $mode |= 0002; 627 | } 628 | if (!empty($_POST['ox'])) { 629 | $mode |= 0001; 630 | } 631 | 632 | if (@chmod($path . '/' . $file, $mode)) { 633 | fm_set_msg('Permissions changed'); 634 | } else { 635 | fm_set_msg('Permissions not changed', 'error'); 636 | } 637 | 638 | fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); 639 | } 640 | 641 | /*************************** /ACTIONS ***************************/ 642 | 643 | // get current path 644 | $path = FM_ROOT_PATH; 645 | if (FM_PATH != '') { 646 | $path .= '/' . FM_PATH; 647 | } 648 | 649 | // check path 650 | if (!is_dir($path)) { 651 | fm_redirect(FM_SELF_URL . '?p='); 652 | } 653 | 654 | // get parent folder 655 | $parent = fm_get_parent_path(FM_PATH); 656 | 657 | $objects = is_readable($path) ? scandir($path) : array(); 658 | $folders = array(); 659 | $files = array(); 660 | if (is_array($objects)) { 661 | foreach ($objects as $file) { 662 | if ($file == '.' || $file == '..' && in_array($file, $GLOBALS['exclude_folders'])) { 663 | continue; 664 | } 665 | if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') { 666 | continue; 667 | } 668 | $new_path = $path . '/' . $file; 669 | if (is_file($new_path)) { 670 | $files[] = $file; 671 | } elseif (is_dir($new_path) && $file != '.' && $file != '..' && !in_array($file, $GLOBALS['exclude_folders'])) { 672 | $folders[] = $file; 673 | } 674 | } 675 | } 676 | 677 | if (!empty($files)) { 678 | natcasesort($files); 679 | } 680 | if (!empty($folders)) { 681 | natcasesort($folders); 682 | } 683 | 684 | // upload form 685 | if (isset($_GET['upload']) && !FM_READONLY) { 686 | fm_show_header(); // HEADER 687 | fm_show_nav_path(FM_PATH); // current path 688 | ?> 689 | 690 | 691 | 692 | 693 |
    694 |

    Uploading files

    695 |

    Destination folder:

    696 |
    ' . PHP_EOL; 728 | } 729 | ?> 730 |

    Files: , ', $copy_files) ?>

    731 |

    Source folder:
    732 | 733 | / 734 |

    735 |

    736 |

    737 |   738 | Cancel 739 |

    740 | 741 |
    742 | 759 |
    760 |

    Copying

    761 |

    762 | Source path:
    763 | Destination folder: 764 |

    765 |

    766 | Copy   767 | Move   768 | Cancel 769 |

    770 |

    Select folder

    771 |
      772 | 775 |
    • ..
    • 776 | 780 |
    • 781 | 784 |
    785 |
    786 | 840 |
    841 |

    ""

    842 |

    843 | Full path:
    844 | File size: = 1000): ?> ()
    845 | MIME-type:
    846 | 860 | Files in archive:
    861 | Total size:
    862 | Size in archive:
    863 | Compression: %
    864 | '; 870 | } 871 | // Text info 872 | if ($is_text) { 873 | $is_utf8 = fm_is_utf8($content); 874 | if (function_exists('iconv')) { 875 | if (!$is_utf8) { 876 | $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content); 877 | } 878 | } 879 | echo 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '
    '; 880 | } 881 | ?> 882 |

    883 |

    884 | Download   885 | Open   886 | 891 | UnZip   892 | 893 | UnZip to folder   894 | 898 | Edit   899 | Advanced Edit   900 | 903 | Mail   904 | 905 | Back 906 |

    907 | '; 912 | foreach ($filenames as $fn) { 913 | if ($fn['folder']) { 914 | echo '' . fm_enc($fn['name']) . '
    '; 915 | } else { 916 | echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')
    '; 917 | } 918 | } 919 | echo ''; 920 | } else { 921 | echo '

    Error while fetching archive info

    '; 922 | } 923 | } elseif ($is_image) { 924 | // Image content 925 | if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico'))) { 926 | echo '

    '; 927 | } 928 | } elseif ($is_audio) { 929 | // Audio content 930 | echo '

    '; 931 | } elseif ($is_video) { 932 | // Video content 933 | echo '
    '; 934 | } elseif ($is_text) { 935 | if (FM_USE_HIGHLIGHTJS) { 936 | // highlight 937 | $hljs_classes = array( 938 | 'shtml' => 'xml', 939 | 'htaccess' => 'apache', 940 | 'phtml' => 'php', 941 | 'lock' => 'json', 942 | 'svg' => 'xml', 943 | ); 944 | $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext; 945 | if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) { 946 | $hljs_class = 'nohighlight'; 947 | } 948 | $content = '
    ' . fm_enc($content) . '
    '; 949 | } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) { 950 | // php highlight 951 | $content = highlight_string($content, true); 952 | } else { 953 | $content = '
    ' . fm_enc($content) . '
    '; 954 | } 955 | echo $content; 956 | } 957 | ?> 958 |
    959 | 1009 |
    1010 |
    1011 | Cancel 1012 | Backup 1013 | 1014 | 1015 | Advanced Editor 1016 | 1017 | 1018 | Plain Editor 1019 | 1020 | 1021 | 1022 |
    1023 | '. htmlspecialchars($content) .''; 1026 | } elseif ($is_text) { 1027 | echo '
    '. htmlspecialchars($content) .'
    '; 1028 | } else { 1029 | fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error'); 1030 | } 1031 | ?> 1032 |
    1033 | 1057 |
    1058 |

    1059 |

    1060 |
    1061 |

    1062 |
    1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 |
    OwnerGroupOther
    Read
    Write
    Execute
    1092 | 1093 |

    1094 |   1095 | Cancel 1096 |

    1097 | 1098 |
    1099 | 1100 |
    1101 | 1117 |
    1118 | 1119 | 1120 | 1121 |
    1122 |
    Browse
    1123 | 1127 |
    1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1139 | 1140 | '?'); 1152 | $group = array('name' => '?'); 1153 | } 1154 | ?> 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1170 | '?'); 1188 | $group = array('name' => '?'); 1189 | } 1190 | ?> 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1209 | 1215 | 1216 | 1219 | 1224 | 1227 |
    NameSizeModifiedPermsOwnerActions
    ..
    ' . readlink($path . '/' . $f) . '' : '') ?>
    Folder 1164 | 1165 | 1166 | 1167 | 1168 | 1169 |
    ' . readlink($path . '/' . $f) . '' : '') ?>
    1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 |
    1220 | Full size: , 1221 | files: , 1222 | folders: 1223 |
    1228 | 1229 | 1239 | 1240 |
    1241 | 1242 | = $time1 && $upd) { 1385 | return false; 1386 | } 1387 | } 1388 | $ok = copy($f1, $f2); 1389 | if ($ok) { 1390 | touch($f2, $time1); 1391 | } 1392 | return $ok; 1393 | } 1394 | 1395 | /** 1396 | * Get mime type 1397 | * @param string $file_path 1398 | * @return mixed|string 1399 | */ 1400 | function fm_get_mime_type($file_path) 1401 | { 1402 | if (function_exists('finfo_open')) { 1403 | $finfo = finfo_open(FILEINFO_MIME_TYPE); 1404 | $mime = finfo_file($finfo, $file_path); 1405 | finfo_close($finfo); 1406 | return $mime; 1407 | } elseif (function_exists('mime_content_type')) { 1408 | return mime_content_type($file_path); 1409 | } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) { 1410 | $file = escapeshellarg($file_path); 1411 | $mime = shell_exec('file -bi ' . $file); 1412 | return $mime; 1413 | } else { 1414 | return '--'; 1415 | } 1416 | } 1417 | 1418 | /** 1419 | * HTTP Redirect 1420 | * @param string $url 1421 | * @param int $code 1422 | */ 1423 | function fm_redirect($url, $code = 302) 1424 | { 1425 | header('Location: ' . $url, true, $code); 1426 | exit; 1427 | } 1428 | 1429 | /** 1430 | * Clean path 1431 | * @param string $path 1432 | * @return string 1433 | */ 1434 | function fm_clean_path($path) 1435 | { 1436 | $path = trim($path); 1437 | $path = trim($path, '\\/'); 1438 | $path = str_replace(array('../', '..\\'), '', $path); 1439 | if ($path == '..') { 1440 | $path = ''; 1441 | } 1442 | return str_replace('\\', '/', $path); 1443 | } 1444 | 1445 | /** 1446 | * Get parent path 1447 | * @param string $path 1448 | * @return bool|string 1449 | */ 1450 | function fm_get_parent_path($path) 1451 | { 1452 | $path = fm_clean_path($path); 1453 | if ($path != '') { 1454 | $array = explode('/', $path); 1455 | if (count($array) > 1) { 1456 | $array = array_slice($array, 0, -1); 1457 | return implode('/', $array); 1458 | } 1459 | return ''; 1460 | } 1461 | return false; 1462 | } 1463 | 1464 | /** 1465 | * Get nice filesize 1466 | * @param int $size 1467 | * @return string 1468 | */ 1469 | function fm_get_filesize($size) 1470 | { 1471 | if ($size < 1000) { 1472 | return sprintf('%s B', $size); 1473 | } elseif (($size / 1024) < 1000) { 1474 | return sprintf('%s KiB', round(($size / 1024), 2)); 1475 | } elseif (($size / 1024 / 1024) < 1000) { 1476 | return sprintf('%s MiB', round(($size / 1024 / 1024), 2)); 1477 | } elseif (($size / 1024 / 1024 / 1024) < 1000) { 1478 | return sprintf('%s GiB', round(($size / 1024 / 1024 / 1024), 2)); 1479 | } else { 1480 | return sprintf('%s TiB', round(($size / 1024 / 1024 / 1024 / 1024), 2)); 1481 | } 1482 | } 1483 | 1484 | /** 1485 | * Get info about zip archive 1486 | * @param string $path 1487 | * @return array|bool 1488 | */ 1489 | function fm_get_zif_info($path) 1490 | { 1491 | if (function_exists('zip_open')) { 1492 | $arch = zip_open($path); 1493 | if ($arch) { 1494 | $filenames = array(); 1495 | while ($zip_entry = zip_read($arch)) { 1496 | $zip_name = zip_entry_name($zip_entry); 1497 | $zip_folder = substr($zip_name, -1) == '/'; 1498 | $filenames[] = array( 1499 | 'name' => $zip_name, 1500 | 'filesize' => zip_entry_filesize($zip_entry), 1501 | 'compressed_size' => zip_entry_compressedsize($zip_entry), 1502 | 'folder' => $zip_folder 1503 | //'compression_method' => zip_entry_compressionmethod($zip_entry), 1504 | ); 1505 | } 1506 | zip_close($arch); 1507 | return $filenames; 1508 | } 1509 | } 1510 | return false; 1511 | } 1512 | 1513 | /** 1514 | * Encode html entities 1515 | * @param string $text 1516 | * @return string 1517 | */ 1518 | function fm_enc($text) 1519 | { 1520 | return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); 1521 | } 1522 | 1523 | /** 1524 | * This function scans the files folder recursively, and builds a large array 1525 | * @param string $dir 1526 | * @return json 1527 | */ 1528 | function scan($dir){ 1529 | $files = array(); 1530 | $_dir = $dir; 1531 | $dir = FM_ROOT_PATH.'/'.$dir; 1532 | // Is there actually such a folder/file? 1533 | if(file_exists($dir)){ 1534 | foreach(scandir($dir) as $f) { 1535 | if(!$f || $f[0] == '.') { 1536 | continue; // Ignore hidden files 1537 | } 1538 | 1539 | if(is_dir($dir . '/' . $f)) { 1540 | // The path is a folder 1541 | $files[] = array( 1542 | "name" => $f, 1543 | "type" => "folder", 1544 | "path" => $_dir.'/'.$f, 1545 | "items" => scan($dir . '/' . $f), // Recursively get the contents of the folder 1546 | ); 1547 | } else { 1548 | // It is a file 1549 | $files[] = array( 1550 | "name" => $f, 1551 | "type" => "file", 1552 | "path" => $_dir, 1553 | "size" => filesize($dir . '/' . $f) // Gets the size of this file 1554 | ); 1555 | } 1556 | } 1557 | } 1558 | return $files; 1559 | } 1560 | 1561 | /** 1562 | * Scan directory and return tree view 1563 | * @param string $directory 1564 | * @param boolean $first_call 1565 | */ 1566 | function php_file_tree_dir($directory, $first_call = true) { 1567 | // Recursive function called by php_file_tree() to list directories/files 1568 | 1569 | $php_file_tree = ""; 1570 | // Get and sort directories/files 1571 | if( function_exists("scandir") ) $file = scandir($directory); 1572 | natcasesort($file); 1573 | // Make directories first 1574 | $files = $dirs = array(); 1575 | foreach($file as $this_file) { 1576 | if( is_dir("$directory/$this_file" ) ) { 1577 | if(!in_array($this_file, $GLOBALS['exclude_folders'])){ 1578 | $dirs[] = $this_file; 1579 | } 1580 | } else { 1581 | $files[] = $this_file; 1582 | } 1583 | } 1584 | $file = array_merge($dirs, $files); 1585 | 1586 | if( count($file) > 2 ) { // Use 2 instead of 0 to account for . and .. "directories" 1587 | $php_file_tree = "" . htmlspecialchars($this_file) . ""; 1595 | $php_file_tree .= php_file_tree_dir("$directory/$this_file", false); 1596 | $php_file_tree .= ""; 1597 | } else { 1598 | // File 1599 | $ext = fm_get_file_icon_class($this_file); 1600 | $path = str_replace($_SERVER['DOCUMENT_ROOT'],"",$directory); 1601 | $link = "?p="."$path" ."&view=".urlencode($this_file); 1602 | $php_file_tree .= "
  • " . htmlspecialchars($this_file) . "
  • "; 1603 | } 1604 | } 1605 | } 1606 | $php_file_tree .= ""; 1607 | } 1608 | return $php_file_tree; 1609 | } 1610 | 1611 | /** 1612 | * Scan directory and render tree view 1613 | * @param string $directory 1614 | */ 1615 | function php_file_tree($directory) { 1616 | // Remove trailing slash 1617 | $code = ""; 1618 | if( substr($directory, -1) == "/" ) $directory = substr($directory, 0, strlen($directory) - 1); 1619 | if(function_exists('php_file_tree_dir')) { 1620 | $code .= php_file_tree_dir($directory); 1621 | return $code; 1622 | } 1623 | } 1624 | 1625 | /** 1626 | * Save message in session 1627 | * @param string $msg 1628 | * @param string $status 1629 | */ 1630 | function fm_set_msg($msg, $status = 'ok') 1631 | { 1632 | $_SESSION['message'] = $msg; 1633 | $_SESSION['status'] = $status; 1634 | } 1635 | 1636 | /** 1637 | * Check if string is in UTF-8 1638 | * @param string $string 1639 | * @return int 1640 | */ 1641 | function fm_is_utf8($string) 1642 | { 1643 | return preg_match('//u', $string); 1644 | } 1645 | 1646 | /** 1647 | * Convert file name to UTF-8 in Windows 1648 | * @param string $filename 1649 | * @return string 1650 | */ 1651 | function fm_convert_win($filename) 1652 | { 1653 | if (FM_IS_WIN && function_exists('iconv')) { 1654 | $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename); 1655 | } 1656 | return $filename; 1657 | } 1658 | 1659 | /** 1660 | * Get CSS classname for file 1661 | * @param string $path 1662 | * @return string 1663 | */ 1664 | function fm_get_file_icon_class($path) 1665 | { 1666 | // get extension 1667 | $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); 1668 | 1669 | switch ($ext) { 1670 | case 'ico': case 'gif': case 'jpg': case 'jpeg': case 'jpc': case 'jp2': 1671 | case 'jpx': case 'xbm': case 'wbmp': case 'png': case 'bmp': case 'tif': 1672 | case 'tiff': case 'svg': 1673 | $img = 'fa fa-picture-o'; 1674 | break; 1675 | case 'passwd': case 'ftpquota': case 'sql': case 'js': case 'json': case 'sh': 1676 | case 'config': case 'twig': case 'tpl': case 'md': case 'gitignore': 1677 | case 'c': case 'cpp': case 'cs': case 'py': case 'map': case 'lock': case 'dtd': 1678 | $img = 'fa fa-file-code-o'; 1679 | break; 1680 | case 'txt': case 'ini': case 'conf': case 'log': case 'htaccess': 1681 | $img = 'fa fa-file-text-o'; 1682 | break; 1683 | case 'css': case 'less': case 'sass': case 'scss': 1684 | $img = 'fa fa-css3'; 1685 | break; 1686 | case 'zip': case 'rar': case 'gz': case 'tar': case '7z': 1687 | $img = 'fa fa-file-archive-o'; 1688 | break; 1689 | case 'php': case 'php4': case 'php5': case 'phps': case 'phtml': 1690 | $img = 'fa fa-code'; 1691 | break; 1692 | case 'htm': case 'html': case 'shtml': case 'xhtml': 1693 | $img = 'fa fa-html5'; 1694 | break; 1695 | case 'xml': case 'xsl': 1696 | $img = 'fa fa-file-excel-o'; 1697 | break; 1698 | case 'wav': case 'mp3': case 'mp2': case 'm4a': case 'aac': case 'ogg': 1699 | case 'oga': case 'wma': case 'mka': case 'flac': case 'ac3': case 'tds': 1700 | $img = 'fa fa-music'; 1701 | break; 1702 | case 'm3u': case 'm3u8': case 'pls': case 'cue': 1703 | $img = 'fa fa-headphones'; 1704 | break; 1705 | case 'avi': case 'mpg': case 'mpeg': case 'mp4': case 'm4v': case 'flv': 1706 | case 'f4v': case 'ogm': case 'ogv': case 'mov': case 'mkv': case '3gp': 1707 | case 'asf': case 'wmv': 1708 | $img = 'fa fa-file-video-o'; 1709 | break; 1710 | case 'eml': case 'msg': 1711 | $img = 'fa fa-envelope-o'; 1712 | break; 1713 | case 'xls': case 'xlsx': 1714 | $img = 'fa fa-file-excel-o'; 1715 | break; 1716 | case 'csv': 1717 | $img = 'fa fa-file-text-o'; 1718 | break; 1719 | case 'bak': 1720 | $img = 'fa fa-clipboard'; 1721 | break; 1722 | case 'doc': case 'docx': 1723 | $img = 'fa fa-file-word-o'; 1724 | break; 1725 | case 'ppt': case 'pptx': 1726 | $img = 'fa fa-file-powerpoint-o'; 1727 | break; 1728 | case 'ttf': case 'ttc': case 'otf': case 'woff':case 'woff2': case 'eot': case 'fon': 1729 | $img = 'fa fa-font'; 1730 | break; 1731 | case 'pdf': 1732 | $img = 'fa fa-file-pdf-o'; 1733 | break; 1734 | case 'psd': case 'ai': case 'eps': case 'fla': case 'swf': 1735 | $img = 'fa fa-file-image-o'; 1736 | break; 1737 | case 'exe': case 'msi': 1738 | $img = 'fa fa-file-o'; 1739 | break; 1740 | case 'bat': 1741 | $img = 'fa fa-terminal'; 1742 | break; 1743 | default: 1744 | $img = 'fa fa-info-circle'; 1745 | } 1746 | 1747 | return $img; 1748 | } 1749 | 1750 | /** 1751 | * Get image files extensions 1752 | * @return array 1753 | */ 1754 | function fm_get_image_exts() 1755 | { 1756 | return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd'); 1757 | } 1758 | 1759 | /** 1760 | * Get video files extensions 1761 | * @return array 1762 | */ 1763 | function fm_get_video_exts() 1764 | { 1765 | return array('webm', 'mp4', 'm4v', 'ogm', 'ogv', 'mov'); 1766 | } 1767 | 1768 | /** 1769 | * Get audio files extensions 1770 | * @return array 1771 | */ 1772 | function fm_get_audio_exts() 1773 | { 1774 | return array('wav', 'mp3', 'ogg', 'm4a'); 1775 | } 1776 | 1777 | /** 1778 | * Get text file extensions 1779 | * @return array 1780 | */ 1781 | function fm_get_text_exts() 1782 | { 1783 | return array( 1784 | 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config', 1785 | 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue', 1786 | 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py', 1787 | 'map', 'lock', 'dtd', 'svg', 1788 | ); 1789 | } 1790 | 1791 | /** 1792 | * Get mime types of text files 1793 | * @return array 1794 | */ 1795 | function fm_get_text_mimes() 1796 | { 1797 | return array( 1798 | 'application/xml', 1799 | 'application/javascript', 1800 | 'application/x-javascript', 1801 | 'image/svg+xml', 1802 | 'message/rfc822', 1803 | ); 1804 | } 1805 | 1806 | /** 1807 | * Get file names of text files w/o extensions 1808 | * @return array 1809 | */ 1810 | function fm_get_text_names() 1811 | { 1812 | return array( 1813 | 'license', 1814 | 'readme', 1815 | 'authors', 1816 | 'contributors', 1817 | 'changelog', 1818 | ); 1819 | } 1820 | 1821 | /** 1822 | * Class to work with zip files (using ZipArchive) 1823 | */ 1824 | class FM_Zipper 1825 | { 1826 | private $zip; 1827 | 1828 | public function __construct() 1829 | { 1830 | $this->zip = new ZipArchive(); 1831 | } 1832 | 1833 | /** 1834 | * Create archive with name $filename and files $files (RELATIVE PATHS!) 1835 | * @param string $filename 1836 | * @param array|string $files 1837 | * @return bool 1838 | */ 1839 | public function create($filename, $files) 1840 | { 1841 | $res = $this->zip->open($filename, ZipArchive::CREATE); 1842 | if ($res !== true) { 1843 | return false; 1844 | } 1845 | if (is_array($files)) { 1846 | foreach ($files as $f) { 1847 | if (!$this->addFileOrDir($f)) { 1848 | $this->zip->close(); 1849 | return false; 1850 | } 1851 | } 1852 | $this->zip->close(); 1853 | return true; 1854 | } else { 1855 | if ($this->addFileOrDir($files)) { 1856 | $this->zip->close(); 1857 | return true; 1858 | } 1859 | return false; 1860 | } 1861 | } 1862 | 1863 | /** 1864 | * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS) 1865 | * @param string $filename 1866 | * @param string $path 1867 | * @return bool 1868 | */ 1869 | public function unzip($filename, $path) 1870 | { 1871 | $res = $this->zip->open($filename); 1872 | if ($res !== true) { 1873 | return false; 1874 | } 1875 | if ($this->zip->extractTo($path)) { 1876 | $this->zip->close(); 1877 | return true; 1878 | } 1879 | return false; 1880 | } 1881 | 1882 | /** 1883 | * Add file/folder to archive 1884 | * @param string $filename 1885 | * @return bool 1886 | */ 1887 | private function addFileOrDir($filename) 1888 | { 1889 | if (is_file($filename)) { 1890 | return $this->zip->addFile($filename); 1891 | } elseif (is_dir($filename)) { 1892 | return $this->addDir($filename); 1893 | } 1894 | return false; 1895 | } 1896 | 1897 | /** 1898 | * Add folder recursively 1899 | * @param string $path 1900 | * @return bool 1901 | */ 1902 | private function addDir($path) 1903 | { 1904 | if (!$this->zip->addEmptyDir($path)) { 1905 | return false; 1906 | } 1907 | $objects = scandir($path); 1908 | if (is_array($objects)) { 1909 | foreach ($objects as $file) { 1910 | if ($file != '.' && $file != '..') { 1911 | if (is_dir($path . '/' . $file)) { 1912 | if (!$this->addDir($path . '/' . $file)) { 1913 | return false; 1914 | } 1915 | } elseif (is_file($path . '/' . $file)) { 1916 | if (!$this->zip->addFile($path . '/' . $file)) { 1917 | return false; 1918 | } 1919 | } 1920 | } 1921 | } 1922 | return true; 1923 | } 1924 | return false; 1925 | } 1926 | } 1927 | 1928 | //--- templates functions 1929 | 1930 | /** 1931 | * Show nav block 1932 | * @param string $path 1933 | */ 1934 | function fm_show_nav_path($path) 1935 | { 1936 | global $lang; 1937 | ?> 1938 | 1968 | ' . $_SESSION['message'] . '

    '; 1979 | unset($_SESSION['message']); 1980 | unset($_SESSION['status']); 1981 | } 1982 | } 1983 | 1984 | /** 1985 | * Show page header in Login Form 1986 | */ 1987 | function fm_show_header_login() 1988 | { 1989 | $sprites_ver = '20160315'; 1990 | header("Content-Type: text/html; charset=utf-8"); 1991 | header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 1992 | header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 1993 | header("Pragma: no-cache"); 1994 | 1995 | global $lang; 1996 | ?> 1997 | 1998 | 1999 | 2000 | 2001 | H3K | File Manager 2002 | 2003 | 2004 | 2005 | 2006 | 2009 | 2010 | 2011 |
    2012 | 2013 | 2022 |
    2023 | 2024 | 2025 | 2041 | 2042 | 2043 | 2044 | 2045 | H3K | File Manager 2046 | 2047 | 2048 | 2049 | 2050 | 2051 | 2052 | 2053 | 2056 | 2057 | 2058 |
    2059 |
    X

    Create New Item

    2060 | File Folder

    2061 |

    2062 |
    X 2063 | 2064 |

    Search Results

    2065 |
    2066 |
    2067 | 2076 |
    2077 | 2080 | 2081 | 2082 | 2083 | 2084 | 2085 | 2086 | 2087 | 2088 | 2089 | 2090 | 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ 2140 | bWFnZVJlYWR5ccllPAAAAZVJREFUeNqkk79Lw0AUx1+uidTQim4Waxfpnl1BcHMR6uLkIF0cpYOI 2141 | f4KbOFcRwbGTc0HQSVQQXCqlFIXgFkhIyvWS870LaaPYH9CDy8vdfb+fey930aSUMEvT6VHVzw8x 2142 | rKUX3N3Hj/8M+cZ6GcOtBPl6KY5iAA7KJzfVWrfbhUKhALZtQ6myDf1+X5nsuzjLUmUOnpa+v5r1 2143 | Z4ZDDfsLiwER45xDEATgOI6KntfDd091GidzC8vZ4vH1QQ09+4MSMAMWRREKPMhmsyr6voYmrnb2 2144 | PKEizdEabUaeFCDKCCHAdV0wTVNFznMgpVqGlZ2cipzHGtKSZwCIZJgJwxB38KHT6Sjx21V75Jcn 2145 | LXmGAKTRpGVZUx2dAqQzSEqw9kqwuGqONTufPrw37D8lQFxCvjgPXIixANLEGfwuQacMOC4kZz+q 2146 | GdhJS550BjpRCdCbAJCMJRkMASEIg+4Bxz4JwAwDSEueAYDLIM+QrOk6GHiRxjXSkJY8KUCvdXZ6 2147 | kbuvNx+mOcbN9taGBlpLAWf9nX8EGADoCfqkKWV/cgAAAABJRU5ErkJggg==', 2148 | 'sprites' => 'iVBORw0KGgoAAAANSUhEUgAAAYAAAAAgCAMAAAAscl/XAAAC/VBMVEUAAABUfn4KKipIcXFSeXsx 2149 | VlZSUlNAZ2c4Xl4lSUkRDg7w8O/d3d3LhwAWFhYXODgMLCx8fHw9PT2TtdOOAACMXgE8lt+dmpq+ 2150 | fgABS3RUpN+VUycuh9IgeMJUe4C5dUI6meKkAQEKCgoMWp5qtusJmxSUPgKudAAXCghQMieMAgIU 2151 | abNSUlJLe70VAQEsh85oaGjBEhIBOGxfAoyUbUQAkw8gui4LBgbOiFPHx8cZX6PMS1OqFha/MjIK 2152 | VKFGBABSAXovGAkrg86xAgIoS5Y7c6Nf7W1Hz1NmAQB3Hgx8fHyiTAAwp+eTz/JdDAJ0JwAAlxCQ 2153 | UAAvmeRiYp6ysrmIAABJr/ErmiKmcsATpRyfEBAOdQgOXahyAAAecr1JCwHMiABgfK92doQGBgZG 2154 | AGkqKiw0ldYuTHCYsF86gB05UlJmQSlra2tVWED////8/f3t9fX5/Pzi8/Px9vb2+/v0+fnn8vLf 2155 | 7OzZ6enV5+eTpKTo6Oj6/v765Z/U5eX4+Pjx+Pjv0ojWBASxw8O8vL52dnfR19CvAADR3PHr6+vi 2156 | 4uPDx8v/866nZDO7iNT335jtzIL+7aj86aTIztXDw8X13JOlpKJoaHDJAACltratrq3lAgKfAADb 2157 | 4vb76N2au9by2I9gYGVIRkhNTE90wfXq2sh8gL8QMZ3pyn27AADr+uu1traNiIh2olTTshifodQ4 2158 | ZM663PH97+YeRq2GqmRjmkGjnEDnfjLVVg6W4f7s6/p/0fr98+5UVF6wz+SjxNsmVb5RUVWMrc7d 2159 | zrrIpWI8PD3pkwhCltZFYbNZja82wPv05NPRdXzhvna4uFdIiibPegGQXankxyxe0P7PnOhTkDGA 2160 | gBrbhgR9fX9bW1u8nRFamcgvVrACJIvlXV06nvtdgON4mdn3og7AagBTufkucO7snJz4b28XEhIT 2161 | sflynsLEvIk55kr866aewo2YuYDrnFffOTk6Li6hgAn3y8XkusCHZQbt0NP571lqRDZyMw96lZXE 2162 | s6qcrMmJaTmVdRW2AAAAbnRSTlMAZodsJHZocHN7hP77gnaCZWdx/ki+RfqOd/7+zc9N/szMZlf8 2163 | z8yeQybOzlv+tP5q/qKRbk78i/vZmf798s3MojiYjTj+/vqKbFc2/vvMzJiPXPzbs4z9++bj1XbN 2164 | uJxhyMBWwJbp28C9tJ6L1xTnMfMAAA79SURBVGje7Jn5b8thHMcfzLDWULXq2upqHT2kbrVSrJYx 2165 | NzHmviWOrCudqxhbNdZqHauKJTZHm0j0ByYkVBCTiC1+EH6YRBY/EJnjD3D84PMc3++39Z1rjp+8 2166 | Kn189rT5Pt/363k+3YHEDOrCSKP16t48q8U1IysLAUKZk1obLBYDKjAUoB8ziLv4vyQLQD+Lcf4Q 2167 | jvno90kfDaQTRhcioIv7QPk2oJqF0PsIT29RzQdOEhfKG6QW8lcoLIYxjWPQD2GXr/63BhYsWrQA 2168 | fYc0JSaNxa8dH4zUEYag32f009DTkNTnC4WkpcRAl4ryHTt37d5/ugxCIIEfZ0Dg4poFThIXygSp 2169 | hfybmhSWLS0dCpDrdFMRZubUkmJ2+d344qIU8sayN8iFQaBgMDy+FWA/wjelOmbrHUKVtQgxFqFc 2170 | JeE2RpmLEIlfFazzer3hcOAPCQiFasNheAo9HQ1f6FZRTgzs2bOnFwn8+AnG8d6impClTkSjCXWW 2171 | kH80GmUGWP6A4kKkQwG616/tOhin6kii3dzl5YHqT58+bf5KQdq8IjCAg3+tk3NDCoPZC2fQuGcI 2172 | 7+8nKQMk/b41r048UKOk48zln4MgesydOw0NDbeVCA2B+FVaEIDz/0MCSkOlAa+3tDRQSgW4t1MD 2173 | +7d1Q8DA9/sY7weKapZ/Qp+tzwYDtLyRiOrBANQ0/3hTMBIJNsXPb0GM5ANfrLO3telmTrWXGBG7 2174 | fHVHb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4saJjabqjRMCf6QDdOkeldJ/ 2227 | BfSnrvWLcWgYxGX6KfPswEKLZVL6yrgXvv6g9uMBoDic3B/9e36KLvDNS7TZ7K3sGdE/wfoqDQD9 2228 | NGG+9AmYL/MDRM5iLo9nqDEYAJWRx5U5o+3SaHRaplS8H+Faf78Yh4bJ8k2Vz24qgJldXj8/DkCf 2229 | wDy8fH/sdpujTD2KxhxM/ueA249E/wTru/Dfl05bPkeC5TI/QOAvbJjL47TnI8BDy+KlOJPV6bJM 2230 | yfg3wNf+r99KxafOibNu5IQvKKsv2x9lTtEFvmGlXq9/rFeL/gnWD2kB6KcwcpB+wP/IyeP2svqp 2231 | 9oeiCT9Fr1cL/gmp125aUc4P+B85iX+qJ/la0k/Ze0D0T0j93jXTpv0BYUGhQhdSooYAAAAASUVO 2232 | RK5CYII=', 2233 | ); 2234 | } 2235 | ?> 2236 | --------------------------------------------------------------------------------