· 8 years ago · Mar 09, 2018, 01:04 AM
1<?php
2/**
3 * H3K | Tiny File Manager
4 * CCP Programmers
5 * http://fb.com/ccpprogrammers
6 * https://github.com/prasathmani/tinyfilemanager
7 */
8
9// Default language
10$lang = 'en';
11
12// Auth with login/password (set true/false to enable/disable it)
13$use_auth = false;
14
15// Users: array('Username' => '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
74if (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
81if (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
101if (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);
111if (!@is_dir($root_path)) {
112 echo "<h1>Root path \"{$root_path}\" not found!</h1>";
113 exit;
114}
115
116// clean $root_url
117$root_url = fm_clean_path($root_url);
118
119// abs path for site
120defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files);
121defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path);
122defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : ''));
123defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']);
124
125// logout
126if (isset($_GET['logout'])) {
127 unset($_SESSION['logged']);
128 fm_redirect(FM_SELF_URL);
129}
130
131// Show image here
132if (isset($_GET['img'])) {
133 fm_show_image($_GET['img']);
134}
135
136// Auth
137if ($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 <div class="path login-form">
159 <img src="https://image.ibb.co/k92AFQ/h3k_logo_dark.png" alt="H3K File manager" style="margin:20px;">
160 <form action="" method="post">
161 <label for="fm_usr">Username</label><input type="text" id="fm_usr" name="fm_usr" value="" placeholder="Username" required><br>
162 <label for="fm_pwd">Password</label><input type="password" id="fm_pwd" name="fm_pwd" value="" placeholder="Password" required><br>
163 <input type="submit" value="Login">
164 </form>
165 </div>
166 <?php
167 fm_show_footer_login();
168 exit;
169 }
170}
171
172defined('FM_LANG') || define('FM_LANG', $lang);
173defined('FM_EXTENSION') || define('FM_EXTENSION', $upload_extensions);
174defined('FM_TREEVIEW') || define('FM_TREEVIEW', $show_tree_view);
175define('FM_READONLY', $use_auth && !empty($readonly_users) && isset($_SESSION['logged']) && in_array($_SESSION['logged'], $readonly_users));
176define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\');
177
178// always use ?p=
179if (!isset($_GET['p'])) {
180 fm_redirect(FM_SELF_URL . '?p=');
181}
182
183// get path
184$p = isset($_GET['p']) ? $_GET['p'] : (isset($_POST['p']) ? $_POST['p'] : '');
185
186// clean path
187$p = fm_clean_path($p);
188
189// instead globals vars
190define('FM_PATH', $p);
191define('FM_USE_AUTH', $use_auth);
192define('FM_EDIT_FILE', $edit_files);
193defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', $iconv_input_encoding);
194defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', $use_highlightjs);
195defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style);
196defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', $datetime_format);
197
198unset($p, $use_auth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style);
199
200/*************************** ACTIONS ***************************/
201
202//AJAX Request
203if (isset($_POST['ajax']) && !FM_READONLY) {
204
205 //search : get list of files from the current folder
206 if(isset($_POST['type']) && $_POST['type']=="search") {
207 $dir = $_POST['path'];
208 $response = scan($dir);
209 echo json_encode($response);
210 }
211
212 //Send file to mail
213 if (isset($_POST['type']) && $_POST['type']=="mail") {
214 //send mail Fn removed.
215 }
216
217 //backup files
218 if(isset($_POST['type']) && $_POST['type']=="backup") {
219 $file = $_POST['file'];
220 $path = $_POST['path'];
221 $date = date("dMy-His");
222 $newFile = $file.'-'.$date.'.bak';
223 copy($path.'/'.$file, $path.'/'.$newFile) or die("Unable to backup");
224 echo "Backup $newFile Created";
225 }
226
227 exit;
228}
229
230// Delete file / folder
231if (isset($_GET['del']) && !FM_READONLY) {
232 $del = $_GET['del'];
233 $del = fm_clean_path($del);
234 $del = str_replace('/', '', $del);
235 if ($del != '' && $del != '..' && $del != '.') {
236 $path = FM_ROOT_PATH;
237 if (FM_PATH != '') {
238 $path .= '/' . FM_PATH;
239 }
240 $is_dir = is_dir($path . '/' . $del);
241 if (fm_rdelete($path . '/' . $del)) {
242 $msg = $is_dir ? 'Folder <b>%s</b> deleted' : 'File <b>%s</b> deleted';
243 fm_set_msg(sprintf($msg, fm_enc($del)));
244 } else {
245 $msg = $is_dir ? 'Folder <b>%s</b> not deleted' : 'File <b>%s</b> 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
255if (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 <b>%s</b> created', fm_enc($new)));
269 } else {
270 fm_set_msg(sprintf('File <b>%s</b> already exists', fm_enc($new)), 'alert');
271 }
272 } else {
273 if (fm_mkdir($path . '/' . $new, false) === true) {
274 fm_set_msg(sprintf('Folder <b>%s</b> created', $new));
275 } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) {
276 fm_set_msg(sprintf('Folder <b>%s</b> already exists', fm_enc($new)), 'alert');
277 } else {
278 fm_set_msg(sprintf('Folder <b>%s</b> 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
288if (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 <b>%s</b> to <b>%s</b>', 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 <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
318 }
319 } else {
320 if (fm_rcopy($from, $dest)) {
321 fm_set_msg(sprintf('Copyied from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
322 } else {
323 fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', 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
333if (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
394if (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 <b>%s</b> to <b>%s</b>', fm_enc($old), fm_enc($new)));
412 } else {
413 fm_set_msg(sprintf('Error while renaming from <b>%s</b> to <b>%s</b>', 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
422if (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
449if (isset($_POST['upl']) && !FM_READONLY) {
450 $path = FM_ROOT_PATH;
451 if (FM_PATH != '') {
452 $path .= '/' . FM_PATH;
453 }
454
455 $errors = 0;
456 $uploads = 0;
457 $total = count($_FILES['upload']['name']);
458 $allowed = (FM_EXTENSION) ? explode(',', FM_EXTENSION) : false;
459
460 for ($i = 0; $i < $total; $i++) {
461 $filename = $_FILES['upload']['name'][$i];
462 $tmp_name = $_FILES['upload']['tmp_name'][$i];
463 $ext = pathinfo($filename, PATHINFO_EXTENSION);
464 $isFileAllowed = ($allowed) ? in_array($ext,$allowed) : true;
465 if (empty($_FILES['upload']['error'][$i]) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) {
466 if (move_uploaded_file($tmp_name, $path . '/' . $_FILES['upload']['name'][$i])) {
467 $uploads++;
468 } else {
469 $errors++;
470 }
471 }
472 }
473
474 if ($errors == 0 && $uploads > 0) {
475 fm_set_msg(sprintf('All files uploaded to <b>%s</b>', fm_enc($path)));
476 } elseif ($errors == 0 && $uploads == 0) {
477 fm_set_msg('Nothing uploaded', 'alert');
478 } else {
479 fm_set_msg(sprintf('Error while uploading files. Uploaded files: %s', $uploads), 'error');
480 }
481 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
482}
483
484// Mass deleting
485if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) {
486 $path = FM_ROOT_PATH;
487 if (FM_PATH != '') {
488 $path .= '/' . FM_PATH;
489 }
490
491 $errors = 0;
492 $files = $_POST['file'];
493 if (is_array($files) && count($files)) {
494 foreach ($files as $f) {
495 if ($f != '') {
496 $new_path = $path . '/' . $f;
497 if (!fm_rdelete($new_path)) {
498 $errors++;
499 }
500 }
501 }
502 if ($errors == 0) {
503 fm_set_msg('Selected files and folder deleted');
504 } else {
505 fm_set_msg('Error while deleting items', 'error');
506 }
507 } else {
508 fm_set_msg('Nothing selected', 'alert');
509 }
510
511 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
512}
513
514// Pack files
515if (isset($_POST['group'], $_POST['zip']) && !FM_READONLY) {
516 $path = FM_ROOT_PATH;
517 if (FM_PATH != '') {
518 $path .= '/' . FM_PATH;
519 }
520
521 if (!class_exists('ZipArchive')) {
522 fm_set_msg('Operations with archives are not available', 'error');
523 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
524 }
525
526 $files = $_POST['file'];
527 if (!empty($files)) {
528 chdir($path);
529
530 if (count($files) == 1) {
531 $one_file = reset($files);
532 $one_file = basename($one_file);
533 $zipname = $one_file . '_' . date('ymd_His') . '.zip';
534 } else {
535 $zipname = 'archive_' . date('ymd_His') . '.zip';
536 }
537
538 $zipper = new FM_Zipper();
539 $res = $zipper->create($zipname, $files);
540
541 if ($res) {
542 fm_set_msg(sprintf('Archive <b>%s</b> created', fm_enc($zipname)));
543 } else {
544 fm_set_msg('Archive not created', 'error');
545 }
546 } else {
547 fm_set_msg('Nothing selected', 'alert');
548 }
549
550 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
551}
552
553// Unpack
554if (isset($_GET['unzip']) && !FM_READONLY) {
555 $unzip = $_GET['unzip'];
556 $unzip = fm_clean_path($unzip);
557 $unzip = str_replace('/', '', $unzip);
558
559 $path = FM_ROOT_PATH;
560 if (FM_PATH != '') {
561 $path .= '/' . FM_PATH;
562 }
563
564 if (!class_exists('ZipArchive')) {
565 fm_set_msg('Operations with archives are not available', 'error');
566 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
567 }
568
569 if ($unzip != '' && is_file($path . '/' . $unzip)) {
570 $zip_path = $path . '/' . $unzip;
571
572 //to folder
573 $tofolder = '';
574 if (isset($_GET['tofolder'])) {
575 $tofolder = pathinfo($zip_path, PATHINFO_FILENAME);
576 if (fm_mkdir($path . '/' . $tofolder, true)) {
577 $path .= '/' . $tofolder;
578 }
579 }
580
581 $zipper = new FM_Zipper();
582 $res = $zipper->unzip($zip_path, $path);
583
584 if ($res) {
585 fm_set_msg('Archive unpacked');
586 } else {
587 fm_set_msg('Archive not unpacked', 'error');
588 }
589
590 } else {
591 fm_set_msg('File not found', 'error');
592 }
593 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
594}
595
596// Change Perms (not for Windows)
597if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
598 $path = FM_ROOT_PATH;
599 if (FM_PATH != '') {
600 $path .= '/' . FM_PATH;
601 }
602
603 $file = $_POST['chmod'];
604 $file = fm_clean_path($file);
605 $file = str_replace('/', '', $file);
606 if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
607 fm_set_msg('File not found', 'error');
608 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
609 }
610
611 $mode = 0;
612 if (!empty($_POST['ur'])) {
613 $mode |= 0400;
614 }
615 if (!empty($_POST['uw'])) {
616 $mode |= 0200;
617 }
618 if (!empty($_POST['ux'])) {
619 $mode |= 0100;
620 }
621 if (!empty($_POST['gr'])) {
622 $mode |= 0040;
623 }
624 if (!empty($_POST['gw'])) {
625 $mode |= 0020;
626 }
627 if (!empty($_POST['gx'])) {
628 $mode |= 0010;
629 }
630 if (!empty($_POST['or'])) {
631 $mode |= 0004;
632 }
633 if (!empty($_POST['ow'])) {
634 $mode |= 0002;
635 }
636 if (!empty($_POST['ox'])) {
637 $mode |= 0001;
638 }
639
640 if (@chmod($path . '/' . $file, $mode)) {
641 fm_set_msg('Permissions changed');
642 } else {
643 fm_set_msg('Permissions not changed', 'error');
644 }
645
646 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
647}
648
649/*************************** /ACTIONS ***************************/
650
651// get current path
652$path = FM_ROOT_PATH;
653if (FM_PATH != '') {
654 $path .= '/' . FM_PATH;
655}
656
657// check path
658if (!is_dir($path)) {
659 fm_redirect(FM_SELF_URL . '?p=');
660}
661
662// get parent folder
663$parent = fm_get_parent_path(FM_PATH);
664
665$objects = is_readable($path) ? scandir($path) : array();
666$folders = array();
667$files = array();
668if (is_array($objects)) {
669 foreach ($objects as $file) {
670 if ($file == '.' || $file == '..' && in_array($file, $GLOBALS['exclude_folders'])) {
671 continue;
672 }
673 if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') {
674 continue;
675 }
676 $new_path = $path . '/' . $file;
677 if (is_file($new_path)) {
678 $files[] = $file;
679 } elseif (is_dir($new_path) && $file != '.' && $file != '..' && !in_array($file, $GLOBALS['exclude_folders'])) {
680 $folders[] = $file;
681 }
682 }
683}
684
685if (!empty($files)) {
686 natcasesort($files);
687}
688if (!empty($folders)) {
689 natcasesort($folders);
690}
691
692// upload form
693if (isset($_GET['upload']) && !FM_READONLY) {
694 fm_show_header(); // HEADER
695 fm_show_nav_path(FM_PATH); // current path
696 ?>
697 <div class="path">
698 <p><b>Uploading files</b></p>
699 <p class="break-word">Destination folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?></p>
700 <form action="" method="post" enctype="multipart/form-data">
701 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
702 <input type="hidden" name="upl" value="1">
703 <input type="file" name="upload[]"><br>
704 <input type="file" name="upload[]"><br>
705 <input type="file" name="upload[]"><br>
706 <input type="file" name="upload[]"><br>
707 <input type="file" name="upload[]"><br>
708 <br>
709 <p>
710 <button type="submit" class="btn"><i class="fa fa-check-circle"></i> Upload</button>
711 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
712 </p>
713 </form>
714 </div>
715 <?php
716 fm_show_footer();
717 exit;
718}
719
720// copy form POST
721if (isset($_POST['copy']) && !FM_READONLY) {
722 $copy_files = $_POST['file'];
723 if (!is_array($copy_files) || empty($copy_files)) {
724 fm_set_msg('Nothing selected', 'alert');
725 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
726 }
727
728 fm_show_header(); // HEADER
729 fm_show_nav_path(FM_PATH); // current path
730 ?>
731 <div class="path">
732 <p><b>Copying</b></p>
733 <form action="" method="post">
734 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
735 <input type="hidden" name="finish" value="1">
736 <?php
737 foreach ($copy_files as $cf) {
738 echo '<input type="hidden" name="file[]" value="' . fm_enc($cf) . '">' . PHP_EOL;
739 }
740 ?>
741 <p class="break-word">Files: <b><?php echo implode('</b>, <b>', $copy_files) ?></b></p>
742 <p class="break-word">Source folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br>
743 <label for="inp_copy_to">Destination folder:</label>
744 <?php echo FM_ROOT_PATH ?>/<input type="text" name="copy_to" id="inp_copy_to" value="<?php echo fm_enc(FM_PATH) ?>">
745 </p>
746 <p><label><input type="checkbox" name="move" value="1"> Move'</label></p>
747 <p>
748 <button type="submit" class="btn"><i class="fa fa-check-circle"></i> Copy </button>
749 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
750 </p>
751 </form>
752 </div>
753 <?php
754 fm_show_footer();
755 exit;
756}
757
758// copy form
759if (isset($_GET['copy']) && !isset($_GET['finish']) && !FM_READONLY) {
760 $copy = $_GET['copy'];
761 $copy = fm_clean_path($copy);
762 if ($copy == '' || !file_exists(FM_ROOT_PATH . '/' . $copy)) {
763 fm_set_msg('File not found', 'error');
764 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
765 }
766
767 fm_show_header(); // HEADER
768 fm_show_nav_path(FM_PATH); // current path
769 ?>
770 <div class="path">
771 <p><b>Copying</b></p>
772 <p class="break-word">
773 Source path: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . $copy)) ?><br>
774 Destination folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?>
775 </p>
776 <p>
777 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&copy=<?php echo urlencode($copy) ?>&finish=1"><i class="fa fa-check-circle"></i> Copy</a></b>
778 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&copy=<?php echo urlencode($copy) ?>&finish=1&move=1"><i class="fa fa-check-circle"></i> Move</a></b>
779 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
780 </p>
781 <p><i>Select folder</i></p>
782 <ul class="folders break-word">
783 <?php
784 if ($parent !== false) {
785 ?>
786 <li><a href="?p=<?php echo urlencode($parent) ?>&copy=<?php echo urlencode($copy) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></li>
787 <?php
788 }
789 foreach ($folders as $f) {
790 ?>
791 <li><a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>&copy=<?php echo urlencode($copy) ?>"><i class="fa fa-folder-o"></i> <?php echo fm_convert_win($f) ?></a></li>
792 <?php
793 }
794 ?>
795 </ul>
796 </div>
797 <?php
798 fm_show_footer();
799 exit;
800}
801
802// file viewer
803if (isset($_GET['view'])) {
804 $file = $_GET['view'];
805 $file = fm_clean_path($file);
806 $file = str_replace('/', '', $file);
807 if ($file == '' || !is_file($path . '/' . $file)) {
808 fm_set_msg('File not found', 'error');
809 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
810 }
811
812 fm_show_header(); // HEADER
813 fm_show_nav_path(FM_PATH); // current path
814
815 $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
816 $file_path = $path . '/' . $file;
817
818 $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
819 $mime_type = fm_get_mime_type($file_path);
820 $filesize = filesize($file_path);
821
822 $is_zip = false;
823 $is_image = false;
824 $is_audio = false;
825 $is_video = false;
826 $is_text = false;
827
828 $view_title = 'File';
829 $filenames = false; // for zip
830 $content = ''; // for text
831
832 if ($ext == 'zip') {
833 $is_zip = true;
834 $view_title = 'Archive';
835 $filenames = fm_get_zif_info($file_path);
836 } elseif (in_array($ext, fm_get_image_exts())) {
837 $is_image = true;
838 $view_title = 'Image';
839 } elseif (in_array($ext, fm_get_audio_exts())) {
840 $is_audio = true;
841 $view_title = 'Audio';
842 } elseif (in_array($ext, fm_get_video_exts())) {
843 $is_video = true;
844 $view_title = 'Video';
845 } elseif (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
846 $is_text = true;
847 $content = file_get_contents($file_path);
848 }
849
850 ?>
851 <div class="path">
852 <p class="break-word"><b><?php echo $view_title ?> "<?php echo fm_enc(fm_convert_win($file)) ?>"</b></p>
853 <p class="break-word">
854 Full path: <?php echo fm_enc(fm_convert_win($file_path)) ?><br>
855 File size: <?php echo fm_get_filesize($filesize) ?><?php if ($filesize >= 1000): ?> (<?php echo sprintf('%s bytes', $filesize) ?>)<?php endif; ?><br>
856 MIME-type: <?php echo $mime_type ?><br>
857 <?php
858 // ZIP info
859 if ($is_zip && $filenames !== false) {
860 $total_files = 0;
861 $total_comp = 0;
862 $total_uncomp = 0;
863 foreach ($filenames as $fn) {
864 if (!$fn['folder']) {
865 $total_files++;
866 }
867 $total_comp += $fn['compressed_size'];
868 $total_uncomp += $fn['filesize'];
869 }
870 ?>
871 Files in archive: <?php echo $total_files ?><br>
872 Total size: <?php echo fm_get_filesize($total_uncomp) ?><br>
873 Size in archive: <?php echo fm_get_filesize($total_comp) ?><br>
874 Compression: <?php echo round(($total_comp / $total_uncomp) * 100) ?>%<br>
875 <?php
876 }
877 // Image info
878 if ($is_image) {
879 $image_size = getimagesize($file_path);
880 echo 'Image sizes: ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '<br>';
881 }
882 // Text info
883 if ($is_text) {
884 $is_utf8 = fm_is_utf8($content);
885 if (function_exists('iconv')) {
886 if (!$is_utf8) {
887 $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content);
888 }
889 }
890 echo 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '<br>';
891 }
892 ?>
893 </p>
894 <p>
895 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($file) ?>"><i class="fa fa-cloud-download"></i> Download</a></b>
896 <b><a href="<?php echo fm_enc($file_url) ?>" target="_blank"><i class="fa fa-external-link-square"></i> Open</a></b>
897 <?php
898 // ZIP actions
899 if (!FM_READONLY && $is_zip && $filenames !== false) {
900 $zip_name = pathinfo($file_path, PATHINFO_FILENAME);
901 ?>
902 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&unzip=<?php echo urlencode($file) ?>"><i class="fa fa-check-circle"></i> UnZip</a></b>
903 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&unzip=<?php echo urlencode($file) ?>&tofolder=1" title="UnZip to <?php echo fm_enc($zip_name) ?>"><i class="fa fa-check-circle"></i>
904 UnZip to folder</a></b>
905 <?php
906 }
907 if($is_text && !FM_READONLY) {
908 ?>
909 <b><a href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>" class="edit-file"><i class="fa fa-pencil-square"></i> Edit</a></b>
910 <b><a href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>&env=ace" class="edit-file"><i class="fa fa-pencil-square"></i> Advanced Edit</a></b>
911 <?php }
912 if($send_mail && !FM_READONLY) {
913 ?>
914 <b><a href="javascript:mailto('<?php echo urlencode(trim(FM_ROOT_PATH.'/'.FM_PATH)) ?>','<?php echo urlencode($file) ?>')"><i class="fa fa-pencil-square"></i> Mail</a></b>
915 <?php } ?>
916 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-chevron-circle-left"></i> Back</a></b>
917 </p>
918 <?php
919 if ($is_zip) {
920 // ZIP content
921 if ($filenames !== false) {
922 echo '<code class="maxheight">';
923 foreach ($filenames as $fn) {
924 if ($fn['folder']) {
925 echo '<b>' . fm_enc($fn['name']) . '</b><br>';
926 } else {
927 echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')<br>';
928 }
929 }
930 echo '</code>';
931 } else {
932 echo '<p>Error while fetching archive info</p>';
933 }
934 } elseif ($is_image) {
935 // Image content
936 if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico'))) {
937 echo '<p><img src="' . fm_enc($file_url) . '" alt="" class="preview-img"></p>';
938 }
939 } elseif ($is_audio) {
940 // Audio content
941 echo '<p><audio src="' . fm_enc($file_url) . '" controls preload="metadata"></audio></p>';
942 } elseif ($is_video) {
943 // Video content
944 echo '<div class="preview-video"><video src="' . fm_enc($file_url) . '" width="640" height="360" controls preload="metadata"></video></div>';
945 } elseif ($is_text) {
946 if (FM_USE_HIGHLIGHTJS) {
947 // highlight
948 $hljs_classes = array(
949 'shtml' => 'xml',
950 'htaccess' => 'apache',
951 'phtml' => 'php',
952 'lock' => 'json',
953 'svg' => 'xml',
954 );
955 $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext;
956 if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) {
957 $hljs_class = 'nohighlight';
958 }
959 $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . fm_enc($content) . '</code></pre>';
960 } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) {
961 // php highlight
962 $content = highlight_string($content, true);
963 } else {
964 $content = '<pre>' . fm_enc($content) . '</pre>';
965 }
966 echo $content;
967 }
968 ?>
969 </div>
970 <?php
971 fm_show_footer();
972 exit;
973}
974
975// file editor
976if (isset($_GET['edit'])) {
977 $file = $_GET['edit'];
978 $file = fm_clean_path($file);
979 $file = str_replace('/', '', $file);
980 if ($file == '' || !is_file($path . '/' . $file)) {
981 fm_set_msg('File not found', 'error');
982 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
983 }
984
985 fm_show_header(); // HEADER
986 fm_show_nav_path(FM_PATH); // current path
987
988 $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
989 $file_path = $path . '/' . $file;
990
991 //normal editer
992 $isNormalEditor = true;
993 if(isset($_GET['env'])) {
994 if($_GET['env'] == "ace") {
995 $isNormalEditor = false;
996 }
997 }
998
999 //Save File
1000 if(isset($_POST['savedata'])) {
1001 $writedata = $_POST['savedata'];
1002 $fd=fopen($file_path,"w");
1003 @fwrite($fd, $writedata);
1004 fclose($fd);
1005 fm_set_msg('File Saved Successfully', 'alert');
1006 }
1007
1008 $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
1009 $mime_type = fm_get_mime_type($file_path);
1010 $filesize = filesize($file_path);
1011 $is_text = false;
1012 $content = ''; // for text
1013
1014 if (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
1015 $is_text = true;
1016 $content = file_get_contents($file_path);
1017 }
1018
1019 ?>
1020 <div class="path">
1021 <div class="edit-file-actions">
1022 <a title="Cancel" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&view=<?php echo urlencode($file) ?>"><i class="fa fa-reply-all"></i> Cancel</a>
1023 <a title="Backup" href="javascript:backup('<?php echo urlencode($path) ?>','<?php echo urlencode($file) ?>')"><i class="fa fa-database"></i> Backup</a>
1024 <?php if($is_text) { ?>
1025 <?php if($isNormalEditor) { ?>
1026 <a title="Advanced" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>&env=ace"><i class="fa fa-paper-plane"></i> Advanced Editor</a>
1027 <button type="button" name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'nrl')"><i class="fa fa-floppy-o"></i> Save</button>
1028 <?php } else { ?>
1029 <a title="Plain Editor" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>"><i class="fa fa-text-height"></i> Plain Editor</a>
1030 <button type="button" name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'ace')"><i class="fa fa-floppy-o"></i> Save</button>
1031 <?php } ?>
1032 <?php } ?>
1033 </div>
1034 <?php
1035 if ($is_text && $isNormalEditor) {
1036 echo '<textarea id="normal-editor" rows="33" cols="120" style="width: 99.5%;">'. htmlspecialchars($content) .'</textarea>';
1037 } elseif ($is_text) {
1038 echo '<div id="editor" contenteditable="true">'. htmlspecialchars($content) .'</div>';
1039 } else {
1040 fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error');
1041 }
1042 ?>
1043 </div>
1044 <?php
1045 fm_show_footer();
1046 exit;
1047}
1048
1049// chmod (not for Windows)
1050if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {
1051 $file = $_GET['chmod'];
1052 $file = fm_clean_path($file);
1053 $file = str_replace('/', '', $file);
1054 if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
1055 fm_set_msg('File not found', 'error');
1056 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
1057 }
1058
1059 fm_show_header(); // HEADER
1060 fm_show_nav_path(FM_PATH); // current path
1061
1062 $file_url = FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file;
1063 $file_path = $path . '/' . $file;
1064
1065 $mode = fileperms($path . '/' . $file);
1066
1067 ?>
1068 <div class="path">
1069 <p><b><?php echo 'Change Permissions'; ?></b></p>
1070 <p>
1071 <?php echo 'Full path:'; ?> <?php echo $file_path ?><br>
1072 </p>
1073 <form action="" method="post">
1074 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
1075 <input type="hidden" name="chmod" value="<?php echo fm_enc($file) ?>">
1076
1077 <table class="compact-table">
1078 <tr>
1079 <td></td>
1080 <td><b>Owner</b></td>
1081 <td><b>Group</b></td>
1082 <td><b>Other</b></td>
1083 </tr>
1084 <tr>
1085 <td style="text-align: right"><b>Read</b></td>
1086 <td><label><input type="checkbox" name="ur" value="1"<?php echo ($mode & 00400) ? ' checked' : '' ?>></label></td>
1087 <td><label><input type="checkbox" name="gr" value="1"<?php echo ($mode & 00040) ? ' checked' : '' ?>></label></td>
1088 <td><label><input type="checkbox" name="or" value="1"<?php echo ($mode & 00004) ? ' checked' : '' ?>></label></td>
1089 </tr>
1090 <tr>
1091 <td style="text-align: right"><b>Write</b></td>
1092 <td><label><input type="checkbox" name="uw" value="1"<?php echo ($mode & 00200) ? ' checked' : '' ?>></label></td>
1093 <td><label><input type="checkbox" name="gw" value="1"<?php echo ($mode & 00020) ? ' checked' : '' ?>></label></td>
1094 <td><label><input type="checkbox" name="ow" value="1"<?php echo ($mode & 00002) ? ' checked' : '' ?>></label></td>
1095 </tr>
1096 <tr>
1097 <td style="text-align: right"><b>Execute</b></td>
1098 <td><label><input type="checkbox" name="ux" value="1"<?php echo ($mode & 00100) ? ' checked' : '' ?>></label></td>
1099 <td><label><input type="checkbox" name="gx" value="1"<?php echo ($mode & 00010) ? ' checked' : '' ?>></label></td>
1100 <td><label><input type="checkbox" name="ox" value="1"<?php echo ($mode & 00001) ? ' checked' : '' ?>></label></td>
1101 </tr>
1102 </table>
1103
1104 <p>
1105 <button type="submit" class="btn"><i class="fa fa-check-circle"></i> Change</button>
1106 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
1107 </p>
1108
1109 </form>
1110
1111 </div>
1112 <?php
1113 fm_show_footer();
1114 exit;
1115}
1116
1117//--- FILEMANAGER MAIN
1118fm_show_header(); // HEADER
1119fm_show_nav_path(FM_PATH); // current path
1120
1121// messages
1122fm_show_message();
1123
1124$num_files = count($files);
1125$num_folders = count($folders);
1126$all_files_size = 0;
1127?>
1128<form action="" method="post">
1129<input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
1130<input type="hidden" name="group" value="1">
1131<?php if(FM_TREEVIEW) { ?>
1132<div class="file-tree-view" id="file-tree-view">
1133 <div class="tree-title">Browse</div>
1134<?php
1135//file tre view
1136 echo php_file_tree($_SERVER['DOCUMENT_ROOT'], "javascript:alert('You clicked on [link]');");
1137?>
1138</div>
1139<?php } ?>
1140<table class="table" id="main-table"><thead><tr>
1141<?php if (!FM_READONLY): ?><th style="width:3%"><label><input type="checkbox" title="Invert selection" onclick="checkbox_toggle()"></label></th><?php endif; ?>
1142<th>Name</th><th style="width:10%">Size</th>
1143<th style="width:12%">Modified</th>
1144<?php if (!FM_IS_WIN): ?><th style="width:6%">Perms</th><th style="width:10%">Owner</th><?php endif; ?>
1145<th style="width:<?php if (!FM_READONLY): ?>13<?php else: ?>6.5<?php endif; ?>%">Actions</th></tr></thead>
1146<?php
1147// link to parent folder
1148if ($parent !== false) {
1149 ?>
1150<tr><?php if (!FM_READONLY): ?><td></td><?php endif; ?><td colspan="<?php echo !FM_IS_WIN ? '6' : '4' ?>"><a href="?p=<?php echo urlencode($parent) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></td></tr>
1151<?php
1152}
1153foreach ($folders as $f) {
1154 $is_link = is_link($path . '/' . $f);
1155 $img = $is_link ? 'icon-link_folder' : 'fa fa-folder-o';
1156 $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));
1157 $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
1158 if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
1159 $owner = posix_getpwuid(fileowner($path . '/' . $f));
1160 $group = posix_getgrgid(filegroup($path . '/' . $f));
1161 } else {
1162 $owner = array('name' => '?');
1163 $group = array('name' => '?');
1164 }
1165 ?>
1166<tr>
1167<?php if (!FM_READONLY): ?><td><label><input type="checkbox" name="file[]" value="<?php echo fm_enc($f) ?>"></label></td><?php endif; ?>
1168<td><div class="filename"><a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="<?php echo $img ?>"></i> <?php echo fm_convert_win($f) ?></a><?php echo ($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?></div></td>
1169<td>Folder</td><td><?php echo $modif ?></td>
1170<?php if (!FM_IS_WIN): ?>
1171<td><?php if (!FM_READONLY): ?><a title="Change Permissions" href="?p=<?php echo urlencode(FM_PATH) ?>&chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?></td>
1172<td><?php echo $owner['name'] . ':' . $group['name'] ?></td>
1173<?php endif; ?>
1174<td class="inline-actions"><?php if (!FM_READONLY): ?>
1175<a title="Delete" href="?p=<?php echo urlencode(FM_PATH) ?>&del=<?php echo urlencode($f) ?>" onclick="return confirm('Delete folder?');"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
1176<a title="Rename" href="#" onclick="rename('<?php echo fm_enc(FM_PATH) ?>', '<?php echo fm_enc($f) ?>');return false;"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
1177<a title="Copy to..." href="?p=&copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o" aria-hidden="true"></i></a>
1178<?php endif; ?>
1179<a title="Direct link" href="<?php echo fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f . '/') ?>" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a>
1180</td></tr>
1181 <?php
1182 flush();
1183}
1184
1185foreach ($files as $f) {
1186 $is_link = is_link($path . '/' . $f);
1187 $img = $is_link ? 'fa fa-file-text-o' : fm_get_file_icon_class($path . '/' . $f);
1188 $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));
1189 $filesize_raw = filesize($path . '/' . $f);
1190 $filesize = fm_get_filesize($filesize_raw);
1191 $filelink = '?p=' . urlencode(FM_PATH) . '&view=' . urlencode($f);
1192 $all_files_size += $filesize_raw;
1193 $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
1194 if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
1195 $owner = posix_getpwuid(fileowner($path . '/' . $f));
1196 $group = posix_getgrgid(filegroup($path . '/' . $f));
1197 } else {
1198 $owner = array('name' => '?');
1199 $group = array('name' => '?');
1200 }
1201 ?>
1202<tr>
1203<?php if (!FM_READONLY): ?><td><label><input type="checkbox" name="file[]" value="<?php echo fm_enc($f) ?>"></label></td><?php endif; ?>
1204<td><div class="filename"><a href="<?php echo $filelink ?>" title="File info"><i class="<?php echo $img ?>"></i> <?php echo fm_convert_win($f) ?></a><?php echo ($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?></div></td>
1205<td><span title="<?php printf('%s bytes', $filesize_raw) ?>"><?php echo $filesize ?></span></td>
1206<td><?php echo $modif ?></td>
1207<?php if (!FM_IS_WIN): ?>
1208<td><?php if (!FM_READONLY): ?><a title="<?php echo 'Change Permissions' ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?></td>
1209<td><?php echo fm_enc($owner['name'] . ':' . $group['name']) ?></td>
1210<?php endif; ?>
1211<td class="inline-actions">
1212<?php if (!FM_READONLY): ?>
1213<a title="Delete" href="?p=<?php echo urlencode(FM_PATH) ?>&del=<?php echo urlencode($f) ?>" onclick="return confirm('Delete file?');"><i class="fa fa-trash-o"></i></a>
1214<a title="Rename" href="#" onclick="rename('<?php echo fm_enc(FM_PATH) ?>', '<?php echo fm_enc($f) ?>');return false;"><i class="fa fa-pencil-square-o"></i></a>
1215<a title="Copy to..." href="?p=<?php echo urlencode(FM_PATH) ?>&copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o"></i></a>
1216<?php endif; ?>
1217<a title="Direct link" href="<?php echo fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f) ?>" target="_blank"><i class="fa fa-link"></i></a>
1218<a title="Download" href="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($f) ?>"><i class="fa fa-download"></i></a>
1219</td></tr>
1220 <?php
1221 flush();
1222}
1223
1224if (empty($folders) && empty($files)) {
1225 ?>
1226<tr><?php if (!FM_READONLY): ?><td></td><?php endif; ?><td colspan="<?php echo !FM_IS_WIN ? '6' : '4' ?>"><em><?php echo 'Folder is empty' ?></em></td></tr>
1227<?php
1228} else {
1229 ?>
1230<tr><?php if (!FM_READONLY): ?><td class="gray"></td><?php endif; ?><td class="gray" colspan="<?php echo !FM_IS_WIN ? '6' : '4' ?>">
1231Full size: <span title="<?php printf('%s bytes', $all_files_size) ?>"><?php echo fm_get_filesize($all_files_size) ?></span>,
1232files: <?php echo $num_files ?>,
1233folders: <?php echo $num_folders ?>
1234</td></tr>
1235<?php
1236}
1237?>
1238</table>
1239<?php if (!FM_READONLY): ?>
1240<p class="path footer-links"><a href="#/select-all" class="group-btn" onclick="select_all();return false;"><i class="fa fa-check-square"></i> Select all</a>
1241<a href="#/unselect-all" class="group-btn" onclick="unselect_all();return false;"><i class="fa fa-window-close"></i> Unselect all</a>
1242<a href="#/invert-all" class="group-btn" onclick="invert_all();return false;"><i class="fa fa-th-list"></i> Invert selection</a>
1243<input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('Delete selected files and folders?')">
1244<a href="javascript:document.getElementById('a-delete').click();" class="group-btn"><i class="fa fa-trash"></i> Delete </a>
1245<input type="submit" class="hidden" name="zip" id="a-zip" value="Zip" onclick="return confirm('Create archive?')">
1246<a href="javascript:document.getElementById('a-zip').click();" class="group-btn"><i class="fa fa-file-archive-o"></i> Zip </a>
1247<input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
1248<a href="javascript:document.getElementById('a-copy').click();" class="group-btn"><i class="fa fa-files-o"></i> Copy </a>
1249<a href="https://github.com/prasathmani/tinyfilemanager" target="_blank" class="float-right" style="color:silver">H3K | Tiny File Manager</a></p>
1250<?php endif; ?>
1251</form>
1252
1253<?php
1254fm_show_footer();
1255
1256//--- END
1257
1258// Functions
1259
1260/**
1261 * Delete file or folder (recursively)
1262 * @param string $path
1263 * @return bool
1264 */
1265function fm_rdelete($path)
1266{
1267 if (is_link($path)) {
1268 return unlink($path);
1269 } elseif (is_dir($path)) {
1270 $objects = scandir($path);
1271 $ok = true;
1272 if (is_array($objects)) {
1273 foreach ($objects as $file) {
1274 if ($file != '.' && $file != '..') {
1275 if (!fm_rdelete($path . '/' . $file)) {
1276 $ok = false;
1277 }
1278 }
1279 }
1280 }
1281 return ($ok) ? rmdir($path) : false;
1282 } elseif (is_file($path)) {
1283 return unlink($path);
1284 }
1285 return false;
1286}
1287
1288/**
1289 * Recursive chmod
1290 * @param string $path
1291 * @param int $filemode
1292 * @param int $dirmode
1293 * @return bool
1294 * @todo Will use in mass chmod
1295 */
1296function fm_rchmod($path, $filemode, $dirmode)
1297{
1298 if (is_dir($path)) {
1299 if (!chmod($path, $dirmode)) {
1300 return false;
1301 }
1302 $objects = scandir($path);
1303 if (is_array($objects)) {
1304 foreach ($objects as $file) {
1305 if ($file != '.' && $file != '..') {
1306 if (!fm_rchmod($path . '/' . $file, $filemode, $dirmode)) {
1307 return false;
1308 }
1309 }
1310 }
1311 }
1312 return true;
1313 } elseif (is_link($path)) {
1314 return true;
1315 } elseif (is_file($path)) {
1316 return chmod($path, $filemode);
1317 }
1318 return false;
1319}
1320
1321/**
1322 * Safely rename
1323 * @param string $old
1324 * @param string $new
1325 * @return bool|null
1326 */
1327function fm_rename($old, $new)
1328{
1329 return (!file_exists($new) && file_exists($old)) ? rename($old, $new) : null;
1330}
1331
1332/**
1333 * Copy file or folder (recursively).
1334 * @param string $path
1335 * @param string $dest
1336 * @param bool $upd Update files
1337 * @param bool $force Create folder with same names instead file
1338 * @return bool
1339 */
1340function fm_rcopy($path, $dest, $upd = true, $force = true)
1341{
1342 if (is_dir($path)) {
1343 if (!fm_mkdir($dest, $force)) {
1344 return false;
1345 }
1346 $objects = scandir($path);
1347 $ok = true;
1348 if (is_array($objects)) {
1349 foreach ($objects as $file) {
1350 if ($file != '.' && $file != '..') {
1351 if (!fm_rcopy($path . '/' . $file, $dest . '/' . $file)) {
1352 $ok = false;
1353 }
1354 }
1355 }
1356 }
1357 return $ok;
1358 } elseif (is_file($path)) {
1359 return fm_copy($path, $dest, $upd);
1360 }
1361 return false;
1362}
1363
1364/**
1365 * Safely create folder
1366 * @param string $dir
1367 * @param bool $force
1368 * @return bool
1369 */
1370function fm_mkdir($dir, $force)
1371{
1372 if (file_exists($dir)) {
1373 if (is_dir($dir)) {
1374 return $dir;
1375 } elseif (!$force) {
1376 return false;
1377 }
1378 unlink($dir);
1379 }
1380 return mkdir($dir, 0777, true);
1381}
1382
1383/**
1384 * Safely copy file
1385 * @param string $f1
1386 * @param string $f2
1387 * @param bool $upd
1388 * @return bool
1389 */
1390function fm_copy($f1, $f2, $upd)
1391{
1392 $time1 = filemtime($f1);
1393 if (file_exists($f2)) {
1394 $time2 = filemtime($f2);
1395 if ($time2 >= $time1 && $upd) {
1396 return false;
1397 }
1398 }
1399 $ok = copy($f1, $f2);
1400 if ($ok) {
1401 touch($f2, $time1);
1402 }
1403 return $ok;
1404}
1405
1406/**
1407 * Get mime type
1408 * @param string $file_path
1409 * @return mixed|string
1410 */
1411function fm_get_mime_type($file_path)
1412{
1413 if (function_exists('finfo_open')) {
1414 $finfo = finfo_open(FILEINFO_MIME_TYPE);
1415 $mime = finfo_file($finfo, $file_path);
1416 finfo_close($finfo);
1417 return $mime;
1418 } elseif (function_exists('mime_content_type')) {
1419 return mime_content_type($file_path);
1420 } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {
1421 $file = escapeshellarg($file_path);
1422 $mime = shell_exec('file -bi ' . $file);
1423 return $mime;
1424 } else {
1425 return '--';
1426 }
1427}
1428
1429/**
1430 * HTTP Redirect
1431 * @param string $url
1432 * @param int $code
1433 */
1434function fm_redirect($url, $code = 302)
1435{
1436 header('Location: ' . $url, true, $code);
1437 exit;
1438}
1439
1440/**
1441 * Clean path
1442 * @param string $path
1443 * @return string
1444 */
1445function fm_clean_path($path)
1446{
1447 $path = trim($path);
1448 $path = trim($path, '\\/');
1449 $path = str_replace(array('../', '..\\'), '', $path);
1450 if ($path == '..') {
1451 $path = '';
1452 }
1453 return str_replace('\\', '/', $path);
1454}
1455
1456/**
1457 * Get parent path
1458 * @param string $path
1459 * @return bool|string
1460 */
1461function fm_get_parent_path($path)
1462{
1463 $path = fm_clean_path($path);
1464 if ($path != '') {
1465 $array = explode('/', $path);
1466 if (count($array) > 1) {
1467 $array = array_slice($array, 0, -1);
1468 return implode('/', $array);
1469 }
1470 return '';
1471 }
1472 return false;
1473}
1474
1475/**
1476 * Get nice filesize
1477 * @param int $size
1478 * @return string
1479 */
1480function fm_get_filesize($size)
1481{
1482 if ($size < 1000) {
1483 return sprintf('%s B', $size);
1484 } elseif (($size / 1024) < 1000) {
1485 return sprintf('%s KiB', round(($size / 1024), 2));
1486 } elseif (($size / 1024 / 1024) < 1000) {
1487 return sprintf('%s MiB', round(($size / 1024 / 1024), 2));
1488 } elseif (($size / 1024 / 1024 / 1024) < 1000) {
1489 return sprintf('%s GiB', round(($size / 1024 / 1024 / 1024), 2));
1490 } else {
1491 return sprintf('%s TiB', round(($size / 1024 / 1024 / 1024 / 1024), 2));
1492 }
1493}
1494
1495/**
1496 * Get info about zip archive
1497 * @param string $path
1498 * @return array|bool
1499 */
1500function fm_get_zif_info($path)
1501{
1502 if (function_exists('zip_open')) {
1503 $arch = zip_open($path);
1504 if ($arch) {
1505 $filenames = array();
1506 while ($zip_entry = zip_read($arch)) {
1507 $zip_name = zip_entry_name($zip_entry);
1508 $zip_folder = substr($zip_name, -1) == '/';
1509 $filenames[] = array(
1510 'name' => $zip_name,
1511 'filesize' => zip_entry_filesize($zip_entry),
1512 'compressed_size' => zip_entry_compressedsize($zip_entry),
1513 'folder' => $zip_folder
1514 //'compression_method' => zip_entry_compressionmethod($zip_entry),
1515 );
1516 }
1517 zip_close($arch);
1518 return $filenames;
1519 }
1520 }
1521 return false;
1522}
1523
1524/**
1525 * Encode html entities
1526 * @param string $text
1527 * @return string
1528 */
1529function fm_enc($text)
1530{
1531 return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
1532}
1533
1534/**
1535 * This function scans the files folder recursively, and builds a large array
1536 * @param string $dir
1537 * @return json
1538 */
1539function scan($dir){
1540 $files = array();
1541 $_dir = $dir;
1542 $dir = FM_ROOT_PATH.'/'.$dir;
1543 // Is there actually such a folder/file?
1544 if(file_exists($dir)){
1545 foreach(scandir($dir) as $f) {
1546 if(!$f || $f[0] == '.') {
1547 continue; // Ignore hidden files
1548 }
1549
1550 if(is_dir($dir . '/' . $f)) {
1551 // The path is a folder
1552 $files[] = array(
1553 "name" => $f,
1554 "type" => "folder",
1555 "path" => $_dir.'/'.$f,
1556 "items" => scan($dir . '/' . $f), // Recursively get the contents of the folder
1557 );
1558 } else {
1559 // It is a file
1560 $files[] = array(
1561 "name" => $f,
1562 "type" => "file",
1563 "path" => $_dir,
1564 "size" => filesize($dir . '/' . $f) // Gets the size of this file
1565 );
1566 }
1567 }
1568 }
1569 return $files;
1570}
1571
1572/**
1573* Scan directory and return tree view
1574* @param string $directory
1575* @param boolean $first_call
1576*/
1577function php_file_tree_dir($directory, $first_call = true) {
1578 // Recursive function called by php_file_tree() to list directories/files
1579
1580 $php_file_tree = "";
1581 // Get and sort directories/files
1582 if( function_exists("scandir") ) $file = scandir($directory);
1583 natcasesort($file);
1584 // Make directories first
1585 $files = $dirs = array();
1586 foreach($file as $this_file) {
1587 if( is_dir("$directory/$this_file" ) ) {
1588 if(!in_array($this_file, $GLOBALS['exclude_folders'])){
1589 $dirs[] = $this_file;
1590 }
1591 } else {
1592 $files[] = $this_file;
1593 }
1594 }
1595 $file = array_merge($dirs, $files);
1596
1597 if( count($file) > 2 ) { // Use 2 instead of 0 to account for . and .. "directories"
1598 $php_file_tree = "<ul";
1599 if( $first_call ) { $php_file_tree .= " class=\"php-file-tree\""; $first_call = false; }
1600 $php_file_tree .= ">";
1601 foreach( $file as $this_file ) {
1602 if( $this_file != "." && $this_file != ".." ) {
1603 if( is_dir("$directory/$this_file") ) {
1604 // Directory
1605 $php_file_tree .= "<li class=\"pft-directory\"><i class=\"fa fa-folder-o\"></i><a href=\"#\">" . htmlspecialchars($this_file) . "</a>";
1606 $php_file_tree .= php_file_tree_dir("$directory/$this_file", false);
1607 $php_file_tree .= "</li>";
1608 } else {
1609 // File
1610 $ext = fm_get_file_icon_class($this_file);
1611 $path = str_replace($_SERVER['DOCUMENT_ROOT'],"",$directory);
1612 $link = "?p="."$path" ."&view=".urlencode($this_file);
1613 $php_file_tree .= "<li class=\"pft-file\"><a href=\"$link\"> <i class=\"$ext\"></i>" . htmlspecialchars($this_file) . "</a></li>";
1614 }
1615 }
1616 }
1617 $php_file_tree .= "</ul>";
1618 }
1619 return $php_file_tree;
1620}
1621
1622/**
1623 * Scan directory and render tree view
1624 * @param string $directory
1625 */
1626function php_file_tree($directory) {
1627 // Remove trailing slash
1628 $code = "";
1629 if( substr($directory, -1) == "/" ) $directory = substr($directory, 0, strlen($directory) - 1);
1630 if(function_exists('php_file_tree_dir')) {
1631 $code .= php_file_tree_dir($directory);
1632 return $code;
1633 }
1634}
1635
1636/**
1637 * Save message in session
1638 * @param string $msg
1639 * @param string $status
1640 */
1641function fm_set_msg($msg, $status = 'ok')
1642{
1643 $_SESSION['message'] = $msg;
1644 $_SESSION['status'] = $status;
1645}
1646
1647/**
1648 * Check if string is in UTF-8
1649 * @param string $string
1650 * @return int
1651 */
1652function fm_is_utf8($string)
1653{
1654 return preg_match('//u', $string);
1655}
1656
1657/**
1658 * Convert file name to UTF-8 in Windows
1659 * @param string $filename
1660 * @return string
1661 */
1662function fm_convert_win($filename)
1663{
1664 if (FM_IS_WIN && function_exists('iconv')) {
1665 $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename);
1666 }
1667 return $filename;
1668}
1669
1670/**
1671 * Get CSS classname for file
1672 * @param string $path
1673 * @return string
1674 */
1675function fm_get_file_icon_class($path)
1676{
1677 // get extension
1678 $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
1679
1680 switch ($ext) {
1681 case 'ico': case 'gif': case 'jpg': case 'jpeg': case 'jpc': case 'jp2':
1682 case 'jpx': case 'xbm': case 'wbmp': case 'png': case 'bmp': case 'tif':
1683 case 'tiff': case 'svg':
1684 $img = 'fa fa-picture-o';
1685 break;
1686 case 'passwd': case 'ftpquota': case 'sql': case 'js': case 'json': case 'sh':
1687 case 'config': case 'twig': case 'tpl': case 'md': case 'gitignore':
1688 case 'c': case 'cpp': case 'cs': case 'py': case 'map': case 'lock': case 'dtd':
1689 $img = 'fa fa-file-code-o';
1690 break;
1691 case 'txt': case 'ini': case 'conf': case 'log': case 'htaccess':
1692 $img = 'fa fa-file-text-o';
1693 break;
1694 case 'css': case 'less': case 'sass': case 'scss':
1695 $img = 'fa fa-css3';
1696 break;
1697 case 'zip': case 'rar': case 'gz': case 'tar': case '7z':
1698 $img = 'fa fa-file-archive-o';
1699 break;
1700 case 'php': case 'php4': case 'php5': case 'phps': case 'phtml':
1701 $img = 'fa fa-code';
1702 break;
1703 case 'htm': case 'html': case 'shtml': case 'xhtml':
1704 $img = 'fa fa-html5';
1705 break;
1706 case 'xml': case 'xsl':
1707 $img = 'fa fa-file-excel-o';
1708 break;
1709 case 'wav': case 'mp3': case 'mp2': case 'm4a': case 'aac': case 'ogg':
1710 case 'oga': case 'wma': case 'mka': case 'flac': case 'ac3': case 'tds':
1711 $img = 'fa fa-music';
1712 break;
1713 case 'm3u': case 'm3u8': case 'pls': case 'cue':
1714 $img = 'fa fa-headphones';
1715 break;
1716 case 'avi': case 'mpg': case 'mpeg': case 'mp4': case 'm4v': case 'flv':
1717 case 'f4v': case 'ogm': case 'ogv': case 'mov': case 'mkv': case '3gp':
1718 case 'asf': case 'wmv':
1719 $img = 'fa fa-file-video-o';
1720 break;
1721 case 'eml': case 'msg':
1722 $img = 'fa fa-envelope-o';
1723 break;
1724 case 'xls': case 'xlsx':
1725 $img = 'fa fa-file-excel-o';
1726 break;
1727 case 'csv':
1728 $img = 'fa fa-file-text-o';
1729 break;
1730 case 'bak':
1731 $img = 'fa fa-clipboard';
1732 break;
1733 case 'doc': case 'docx':
1734 $img = 'fa fa-file-word-o';
1735 break;
1736 case 'ppt': case 'pptx':
1737 $img = 'fa fa-file-powerpoint-o';
1738 break;
1739 case 'ttf': case 'ttc': case 'otf': case 'woff':case 'woff2': case 'eot': case 'fon':
1740 $img = 'fa fa-font';
1741 break;
1742 case 'pdf':
1743 $img = 'fa fa-file-pdf-o';
1744 break;
1745 case 'psd': case 'ai': case 'eps': case 'fla': case 'swf':
1746 $img = 'fa fa-file-image-o';
1747 break;
1748 case 'exe': case 'msi':
1749 $img = 'fa fa-file-o';
1750 break;
1751 case 'bat':
1752 $img = 'fa fa-terminal';
1753 break;
1754 default:
1755 $img = 'fa fa-info-circle';
1756 }
1757
1758 return $img;
1759}
1760
1761/**
1762 * Get image files extensions
1763 * @return array
1764 */
1765function fm_get_image_exts()
1766{
1767 return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd');
1768}
1769
1770/**
1771 * Get video files extensions
1772 * @return array
1773 */
1774function fm_get_video_exts()
1775{
1776 return array('webm', 'mp4', 'm4v', 'ogm', 'ogv', 'mov');
1777}
1778
1779/**
1780 * Get audio files extensions
1781 * @return array
1782 */
1783function fm_get_audio_exts()
1784{
1785 return array('wav', 'mp3', 'ogg', 'm4a');
1786}
1787
1788/**
1789 * Get text file extensions
1790 * @return array
1791 */
1792function fm_get_text_exts()
1793{
1794 return array(
1795 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',
1796 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',
1797 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',
1798 'map', 'lock', 'dtd', 'svg',
1799 );
1800}
1801
1802/**
1803 * Get mime types of text files
1804 * @return array
1805 */
1806function fm_get_text_mimes()
1807{
1808 return array(
1809 'application/xml',
1810 'application/javascript',
1811 'application/x-javascript',
1812 'image/svg+xml',
1813 'message/rfc822',
1814 );
1815}
1816
1817/**
1818 * Get file names of text files w/o extensions
1819 * @return array
1820 */
1821function fm_get_text_names()
1822{
1823 return array(
1824 'license',
1825 'readme',
1826 'authors',
1827 'contributors',
1828 'changelog',
1829 );
1830}
1831
1832/**
1833 * Class to work with zip files (using ZipArchive)
1834 */
1835class FM_Zipper
1836{
1837 private $zip;
1838
1839 public function __construct()
1840 {
1841 $this->zip = new ZipArchive();
1842 }
1843
1844 /**
1845 * Create archive with name $filename and files $files (RELATIVE PATHS!)
1846 * @param string $filename
1847 * @param array|string $files
1848 * @return bool
1849 */
1850 public function create($filename, $files)
1851 {
1852 $res = $this->zip->open($filename, ZipArchive::CREATE);
1853 if ($res !== true) {
1854 return false;
1855 }
1856 if (is_array($files)) {
1857 foreach ($files as $f) {
1858 if (!$this->addFileOrDir($f)) {
1859 $this->zip->close();
1860 return false;
1861 }
1862 }
1863 $this->zip->close();
1864 return true;
1865 } else {
1866 if ($this->addFileOrDir($files)) {
1867 $this->zip->close();
1868 return true;
1869 }
1870 return false;
1871 }
1872 }
1873
1874 /**
1875 * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
1876 * @param string $filename
1877 * @param string $path
1878 * @return bool
1879 */
1880 public function unzip($filename, $path)
1881 {
1882 $res = $this->zip->open($filename);
1883 if ($res !== true) {
1884 return false;
1885 }
1886 if ($this->zip->extractTo($path)) {
1887 $this->zip->close();
1888 return true;
1889 }
1890 return false;
1891 }
1892
1893 /**
1894 * Add file/folder to archive
1895 * @param string $filename
1896 * @return bool
1897 */
1898 private function addFileOrDir($filename)
1899 {
1900 if (is_file($filename)) {
1901 return $this->zip->addFile($filename);
1902 } elseif (is_dir($filename)) {
1903 return $this->addDir($filename);
1904 }
1905 return false;
1906 }
1907
1908 /**
1909 * Add folder recursively
1910 * @param string $path
1911 * @return bool
1912 */
1913 private function addDir($path)
1914 {
1915 if (!$this->zip->addEmptyDir($path)) {
1916 return false;
1917 }
1918 $objects = scandir($path);
1919 if (is_array($objects)) {
1920 foreach ($objects as $file) {
1921 if ($file != '.' && $file != '..') {
1922 if (is_dir($path . '/' . $file)) {
1923 if (!$this->addDir($path . '/' . $file)) {
1924 return false;
1925 }
1926 } elseif (is_file($path . '/' . $file)) {
1927 if (!$this->zip->addFile($path . '/' . $file)) {
1928 return false;
1929 }
1930 }
1931 }
1932 }
1933 return true;
1934 }
1935 return false;
1936 }
1937}
1938
1939//--- templates functions
1940
1941/**
1942 * Show nav block
1943 * @param string $path
1944 */
1945function fm_show_nav_path($path)
1946{
1947 global $lang;
1948 ?>
1949<div class="path main-nav">
1950
1951 <?php
1952 $path = fm_clean_path($path);
1953 $root_url = "<a href='?p='><i class='fa fa-home' aria-hidden='true' title='" . FM_ROOT_PATH . "'></i></a>";
1954 $sep = '<i class="fa fa-caret-right"></i>';
1955 if ($path != '') {
1956 $exploded = explode('/', $path);
1957 $count = count($exploded);
1958 $array = array();
1959 $parent = '';
1960 for ($i = 0; $i < $count; $i++) {
1961 $parent = trim($parent . '/' . $exploded[$i], '/');
1962 $parent_enc = urlencode($parent);
1963 $array[] = "<a href='?p={$parent_enc}'>" . fm_enc(fm_convert_win($exploded[$i])) . "</a>";
1964 }
1965 $root_url .= $sep . implode($sep, $array);
1966 }
1967 echo '<div class="break-word float-left">' . $root_url . '</div>';
1968 ?>
1969
1970 <div class="float-right">
1971 <?php if (!FM_READONLY): ?>
1972 <a title="Search" href="javascript:showSearch('<?php echo urlencode(FM_PATH) ?>')"><i class="fa fa-search"></i></a>
1973 <a title="Upload files" href="?p=<?php echo urlencode(FM_PATH) ?>&upload"><i class="fa fa-cloud-upload" aria-hidden="true"></i></a>
1974 <a title="New folder" href="#createNewItem" ><i class="fa fa-plus-square"></i></a>
1975 <?php endif; ?>
1976 <?php if (FM_USE_AUTH): ?><a title="Logout" href="?logout=1"><i class="fa fa-sign-out" aria-hidden="true"></i></a><?php endif; ?>
1977 </div>
1978</div>
1979<?php
1980}
1981
1982/**
1983 * Show message from session
1984 */
1985function fm_show_message()
1986{
1987 if (isset($_SESSION['message'])) {
1988 $class = isset($_SESSION['status']) ? $_SESSION['status'] : 'ok';
1989 echo '<p class="message ' . $class . '">' . $_SESSION['message'] . '</p>';
1990 unset($_SESSION['message']);
1991 unset($_SESSION['status']);
1992 }
1993}
1994
1995/**
1996 * Show page header in Login Form
1997 */
1998function fm_show_header_login()
1999{
2000 $sprites_ver = '20160315';
2001 header("Content-Type: text/html; charset=utf-8");
2002 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
2003 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
2004 header("Pragma: no-cache");
2005
2006 global $lang;
2007 ?>
2008<!DOCTYPE html>
2009<html>
2010<head>
2011<meta charset="utf-8">
2012<title>H3K | File Manager</title>
2013<meta name="Description" CONTENT="Author: CCP Programmers, H3K Tiny PHP File Manager">
2014<link rel="icon" href="<?php echo FM_SELF_URL ?>?img=favicon" type="image/png">
2015<link rel="shortcut icon" href="<?php echo FM_SELF_URL ?>?img=favicon" type="image/png">
2016<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
2017<style>
2018a img,img{border:none}.filename,td,th{white-space:nowrap}.close,.close:focus,.close:hover,.php-file-tree a,a{text-decoration:none}a,body,code,div,em,form,html,img,label,li,ol,p,pre,small,span,strong,table,td,th,tr,ul{margin:0;padding:0;vertical-align:baseline;outline:0;font-size:100%;background:0 0;border:none;text-decoration:none}p,table,ul{margin-bottom:10px}html{overflow-y:scroll}body{padding:0;font:13px/16px Tahoma,Arial,sans-serif;color:#222;background:#F7F7F7;margin:50px 30px 0}button,input,select,textarea{font-size:inherit;font-family:inherit}a{color:#296ea3}a:hover{color:#b00}img{vertical-align:middle}span{color:#777}small{font-size:11px;color:#999}ul{list-style-type:none;margin-left:0}ul li{padding:3px 0}table{border-collapse:collapse;border-spacing:0;width:100%}.file-tree-view+#main-table{width:75%!important;float:left}td,th{padding:4px 7px;text-align:left;vertical-align:top;border:1px solid #ddd;background:#fff}td.gray,th{background-color:#eee}td.gray span{color:#222}tr:hover td{background-color:#f5f5f5}tr:hover td.gray{background-color:#eee}.table{width:100%;max-width:100%;margin-bottom:1rem}.table td,.table th{padding:.55rem;vertical-align:top;border-top:1px solid #ddd}.table thead th{vertical-align:bottom;border-bottom:2px solid #eceeef}.table tbody+tbody{border-top:2px solid #eceeef}.table .table{background-color:#fff}code,pre{display:block;margin-bottom:10px;font:13px/16px Consolas,'Courier New',Courier,monospace;border:1px dashed #ccc;padding:5px;overflow:auto}.hidden,.modal{display:none}.btn,.close{font-weight:700}pre.with-hljs{padding:0}pre.with-hljs code{margin:0;border:0;overflow:visible}code.maxheight,pre.maxheight{max-height:512px}input[type=checkbox]{margin:0;padding:0}.message,.path{padding:4px 7px;border:1px solid #ddd;background-color:#fff}.fa.fa-caret-right{font-size:1.2em;margin:0 4px;vertical-align:middle;color:#ececec}.fa.fa-home{font-size:1.2em;vertical-align:bottom}#wrapper{min-width:400px;margin:0 auto}.path{margin-bottom:10px}.right{text-align:right}.center,.close,.login-form{text-align:center}.float-right{float:right}.float-left{float:left}.message.ok{border-color:green;color:green}.message.error{border-color:red;color:red}.message.alert{border-color:orange;color:orange}.btn{border:0;background:0 0;padding:0;margin:0;color:#296ea3;cursor:pointer}.btn:hover{color:#b00}.preview-img{max-width:100%;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)}.inline-actions>a>i{font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px;border-radius:3px}.preview-video{position:relative;max-width:100%;height:0;padding-bottom:62.5%;margin-bottom:10px}.preview-video video{position:absolute;width:100%;height:100%;left:0;top:0;background:#000}.compact-table{border:0;width:auto}.compact-table td,.compact-table th{width:100px;border:0;text-align:center}.compact-table tr:hover td{background-color:#fff}.filename{max-width:420px;overflow:hidden;text-overflow:ellipsis}.break-word{word-wrap:break-word;margin-left:30px}.break-word.float-left a{color:#7d7d7d}.break-word+.float-right{padding-right:30px;position:relative}.break-word+.float-right>a{color:#7d7d7d;font-size:1.2em;margin-right:4px}.modal{position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}#editor,.edit-file-actions{position:absolute;right:30px}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:80%}.close:focus,.close:hover{color:#000;cursor:pointer}#editor{top:50px;bottom:5px;left:30px}.edit-file-actions{top:0;background:#fff;margin-top:5px}.edit-file-actions>a,.edit-file-actions>button{background:#fff;padding:5px 15px;cursor:pointer;color:#296ea3;border:1px solid #296ea3}.group-btn{background:#fff;padding:2px 6px;border:1px solid;cursor:pointer;color:#296ea3}.main-nav{position:fixed;top:0;left:0;padding:10px 30px 10px 1px;width:100%;background:#fff;color:#000;border:0;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)}.login-form{width:320px;margin:0 auto;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)}.login-form label,.path.login-form input{padding:8px;margin:10px}.footer-links{background:0 0;border:0;clear:both}select[name=lang]{border:none;position:relative;text-transform:uppercase;left:-30%;top:12px;color:silver}input[type=search]{height:30px;margin:5px;width:80%;border:1px solid #ccc}.path.login-form input[type=submit]{background-color:#4285f4;color:#fff;border:1px solid;border-radius:2px;font-weight:700;cursor:pointer}.modalDialog{position:fixed;font-family:Arial,Helvetica,sans-serif;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.8);z-index:99999;opacity:0;-webkit-transition:opacity .4s ease-in;-moz-transition:opacity .4s ease-in;transition:opacity .4s ease-in;pointer-events:none}.modalDialog:target{opacity:1;pointer-events:auto}.modalDialog>.model-wrapper{max-width:400px;position:relative;margin:10% auto;padding:15px;border-radius:2px;background:#fff}.close{float:right;background:#fff;color:#000;line-height:25px;position:absolute;right:0;top:0;width:24px;border-radius:0 5px 0 0;font-size:18px}.close:hover{background:#e4e4e4}.modalDialog p{line-height:30px}div#searchresultWrapper{max-height:320px;overflow:auto}div#searchresultWrapper li{margin:8px 0;list-style:none}li.file:before,li.folder:before{font:normal normal normal 14px/1 FontAwesome;content:"\f016";margin-right:5px}li.folder:before{content:"\f114"}i.fa.fa-folder-o{color:#eeaf4b}i.fa.fa-picture-o{color:#26b99a}i.fa.fa-file-archive-o{color:#da7d7d}.footer-links i.fa.fa-file-archive-o{color:#296ea3}i.fa.fa-css3{color:#f36fa0}i.fa.fa-file-code-o{color:#ec6630}i.fa.fa-code{color:#cc4b4c}i.fa.fa-file-text-o{color:#0096e6}i.fa.fa-html5{color:#d75e72}i.fa.fa-file-excel-o{color:#09c55d}i.fa.fa-file-powerpoint-o{color:#f6712e}.file-tree-view{width:24%;float:left;overflow:auto;border:1px solid #ddd;border-right:0;background:#fff}.file-tree-view .tree-title{background:#eee;padding:9px 2px 9px 10px;font-weight:700}.file-tree-view ul{margin-left:15px;margin-bottom:0}.file-tree-view i{padding-right:3px}.php-file-tree{font-size:100%;letter-spacing:1px;line-height:1.5;margin-left:5px!important}.php-file-tree a{color:#296ea3}.php-file-tree A:hover{color:#b00}.php-file-tree .open{font-style:italic;color:#2183ce}.php-file-tree .closed{font-style:normal}#file-tree-view::-webkit-scrollbar{width:10px;background-color:#F5F5F5}#file-tree-view::-webkit-scrollbar-track{border-radius:10px;background:rgba(0,0,0,.1);border:1px solid #ccc}#file-tree-view::-webkit-scrollbar-thumb{border-radius:10px;background:linear-gradient(left,#fff,#e4e4e4);border:1px solid #aaa}#file-tree-view::-webkit-scrollbar-thumb:hover{background:#fff}#file-tree-view::-webkit-scrollbar-thumb:active{background:linear-gradient(left,#22ADD4,#1E98BA)}
2019</style>
2020</head>
2021<body>
2022<div id="wrapper">
2023
2024<?php
2025}
2026
2027/**
2028 * Show page footer in Login Form
2029 */
2030function fm_show_footer_login()
2031{
2032 ?>
2033</div>
2034</body>
2035</html>
2036<?php
2037}
2038
2039/**
2040 * Show page header
2041 */
2042function fm_show_header()
2043{
2044 $sprites_ver = '20160315';
2045 header("Content-Type: text/html; charset=utf-8");
2046 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
2047 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
2048 header("Pragma: no-cache");
2049
2050 global $lang;
2051 ?>
2052<!DOCTYPE html>
2053<html>
2054<head>
2055<meta charset="utf-8">
2056<title>H3K | File Manager</title>
2057<meta name="Description" CONTENT="Author: CCP Programmers, H3K Tiny PHP File Manager">
2058<link rel="icon" href="<?php echo FM_SELF_URL ?>?img=favicon" type="image/png">
2059<link rel="shortcut icon" href="<?php echo FM_SELF_URL ?>?img=favicon" type="image/png">
2060<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
2061<?php if (isset($_GET['view']) && FM_USE_HIGHLIGHTJS): ?>
2062<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>.min.css">
2063<?php endif; ?>
2064<style>
2065a img,img{border:none}.filename,td,th{white-space:nowrap}.close,.close:focus,.close:hover,.php-file-tree a,a{text-decoration:none}a,body,code,div,em,form,html,img,label,li,ol,p,pre,small,span,strong,table,td,th,tr,ul{margin:0;padding:0;vertical-align:baseline;outline:0;font-size:100%;background:0 0;border:none;text-decoration:none}p,table,ul{margin-bottom:10px}html{overflow-y:scroll}body{padding:0;font:13px/16px Tahoma,Arial,sans-serif;color:#222;background:#F7F7F7;margin:50px 30px 0}button,input,select,textarea{font-size:inherit;font-family:inherit}a{color:#296ea3}a:hover{color:#b00}img{vertical-align:middle}span{color:#777}small{font-size:11px;color:#999}ul{list-style-type:none;margin-left:0}ul li{padding:3px 0}table{border-collapse:collapse;border-spacing:0;width:100%}.file-tree-view+#main-table{width:75%!important;float:left}td,th{padding:4px 7px;text-align:left;vertical-align:top;border:1px solid #ddd;background:#fff}td.gray,th{background-color:#eee}td.gray span{color:#222}tr:hover td{background-color:#f5f5f5}tr:hover td.gray{background-color:#eee}.table{width:100%;max-width:100%;margin-bottom:1rem}.table td,.table th{padding:.55rem;vertical-align:top;border-top:1px solid #ddd}.table thead th{vertical-align:bottom;border-bottom:2px solid #eceeef}.table tbody+tbody{border-top:2px solid #eceeef}.table .table{background-color:#fff}code,pre{display:block;margin-bottom:10px;font:13px/16px Consolas,'Courier New',Courier,monospace;border:1px dashed #ccc;padding:5px;overflow:auto}.hidden,.modal{display:none}.btn,.close{font-weight:700}pre.with-hljs{padding:0}pre.with-hljs code{margin:0;border:0;overflow:visible}code.maxheight,pre.maxheight{max-height:512px}input[type=checkbox]{margin:0;padding:0}.message,.path{padding:4px 7px;border:1px solid #ddd;background-color:#fff}.fa.fa-caret-right{font-size:1.2em;margin:0 4px;vertical-align:middle;color:#ececec}.fa.fa-home{font-size:1.2em;vertical-align:bottom}#wrapper{min-width:400px;margin:0 auto}.path{margin-bottom:10px}.right{text-align:right}.center,.close,.login-form{text-align:center}.float-right{float:right}.float-left{float:left}.message.ok{border-color:green;color:green}.message.error{border-color:red;color:red}.message.alert{border-color:orange;color:orange}.btn{border:0;background:0 0;padding:0;margin:0;color:#296ea3;cursor:pointer}.btn:hover{color:#b00}.preview-img{max-width:100%;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)}.inline-actions>a>i{font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px;border-radius:3px}.preview-video{position:relative;max-width:100%;height:0;padding-bottom:62.5%;margin-bottom:10px}.preview-video video{position:absolute;width:100%;height:100%;left:0;top:0;background:#000}.compact-table{border:0;width:auto}.compact-table td,.compact-table th{width:100px;border:0;text-align:center}.compact-table tr:hover td{background-color:#fff}.filename{max-width:420px;overflow:hidden;text-overflow:ellipsis}.break-word{word-wrap:break-word;margin-left:30px}.break-word.float-left a{color:#7d7d7d}.break-word+.float-right{padding-right:30px;position:relative}.break-word+.float-right>a{color:#7d7d7d;font-size:1.2em;margin-right:4px}.modal{position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}#editor,.edit-file-actions{position:absolute;right:30px}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:80%}.close:focus,.close:hover{color:#000;cursor:pointer}#editor{top:50px;bottom:5px;left:30px}.edit-file-actions{top:0;background:#fff;margin-top:5px}.edit-file-actions>a,.edit-file-actions>button{background:#fff;padding:5px 15px;cursor:pointer;color:#296ea3;border:1px solid #296ea3}.group-btn{background:#fff;padding:2px 6px;border:1px solid;cursor:pointer;color:#296ea3}.main-nav{position:fixed;top:0;left:0;padding:10px 30px 10px 1px;width:100%;background:#fff;color:#000;border:0;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)}.login-form{width:320px;margin:0 auto;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)}.login-form label,.path.login-form input{padding:8px;margin:10px}.footer-links{background:0 0;border:0;clear:both}select[name=lang]{border:none;position:relative;text-transform:uppercase;left:-30%;top:12px;color:silver}input[type=search]{height:30px;margin:5px;width:80%;border:1px solid #ccc}.path.login-form input[type=submit]{background-color:#4285f4;color:#fff;border:1px solid;border-radius:2px;font-weight:700;cursor:pointer}.modalDialog{position:fixed;font-family:Arial,Helvetica,sans-serif;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.8);z-index:99999;opacity:0;-webkit-transition:opacity .4s ease-in;-moz-transition:opacity .4s ease-in;transition:opacity .4s ease-in;pointer-events:none}.modalDialog:target{opacity:1;pointer-events:auto}.modalDialog>.model-wrapper{max-width:400px;position:relative;margin:10% auto;padding:15px;border-radius:2px;background:#fff}.close{float:right;background:#fff;color:#000;line-height:25px;position:absolute;right:0;top:0;width:24px;border-radius:0 5px 0 0;font-size:18px}.close:hover{background:#e4e4e4}.modalDialog p{line-height:30px}div#searchresultWrapper{max-height:320px;overflow:auto}div#searchresultWrapper li{margin:8px 0;list-style:none}li.file:before,li.folder:before{font:normal normal normal 14px/1 FontAwesome;content:"\f016";margin-right:5px}li.folder:before{content:"\f114"}i.fa.fa-folder-o{color:#eeaf4b}i.fa.fa-picture-o{color:#26b99a}i.fa.fa-file-archive-o{color:#da7d7d}.footer-links i.fa.fa-file-archive-o{color:#296ea3}i.fa.fa-css3{color:#f36fa0}i.fa.fa-file-code-o{color:#ec6630}i.fa.fa-code{color:#cc4b4c}i.fa.fa-file-text-o{color:#0096e6}i.fa.fa-html5{color:#d75e72}i.fa.fa-file-excel-o{color:#09c55d}i.fa.fa-file-powerpoint-o{color:#f6712e}.file-tree-view{width:24%;float:left;overflow:auto;border:1px solid #ddd;border-right:0;background:#fff}.file-tree-view .tree-title{background:#eee;padding:9px 2px 9px 10px;font-weight:700}.file-tree-view ul{margin-left:15px;margin-bottom:0}.file-tree-view i{padding-right:3px}.php-file-tree{font-size:100%;letter-spacing:1px;line-height:1.5;margin-left:5px!important}.php-file-tree a{color:#296ea3}.php-file-tree A:hover{color:#b00}.php-file-tree .open{font-style:italic;color:#2183ce}.php-file-tree .closed{font-style:normal}#file-tree-view::-webkit-scrollbar{width:10px;background-color:#F5F5F5}#file-tree-view::-webkit-scrollbar-track{border-radius:10px;background:rgba(0,0,0,.1);border:1px solid #ccc}#file-tree-view::-webkit-scrollbar-thumb{border-radius:10px;background:linear-gradient(left,#fff,#e4e4e4);border:1px solid #aaa}#file-tree-view::-webkit-scrollbar-thumb:hover{background:#fff}#file-tree-view::-webkit-scrollbar-thumb:active{background:linear-gradient(left,#22ADD4,#1E98BA)}
2066</style>
2067</head>
2068<body>
2069<div id="wrapper">
2070 <div id="createNewItem" class="modalDialog"><div class="model-wrapper"><a href="#close" title="Close" class="close">X</a><h2>Create New Item</h2><p>
2071 <label for="newfile">Item Type : </label><input type="radio" name="newfile" id="newfile" value="file">File <input type="radio" name="newfile" value="folder" checked> Folder<br><label for="newfilename">Item Name : </label><input type="text" name="newfilename" id="newfilename" value=""><br>
2072 <input type="submit" name="submit" class="group-btn" value="Create Now" onclick="newfolder('<?php echo fm_enc(FM_PATH) ?>');return false;"></p></div></div>
2073 <div id="searchResult" class="modalDialog"><div class="model-wrapper"><a href="#close" title="Close" class="close">X</a>
2074 <input type="search" name="search" value="" placeholder="Find a item in current folder...">
2075 <h2>Search Results</h2>
2076 <div id="searchresultWrapper"></div>
2077 </div></div>
2078<?php
2079}
2080
2081/**
2082 * Show page footer
2083 */
2084function fm_show_footer()
2085{
2086 ?>
2087</div>
2088<script>
2089function newfolder(e){var t=document.getElementById("newfilename").value,n=document.querySelector('input[name="newfile"]:checked').value;null!==t&&""!==t&&n&&(window.location.hash="#",window.location.search="p="+encodeURIComponent(e)+"&new="+encodeURIComponent(t)+"&type="+encodeURIComponent(n))}function rename(e,t){var n=prompt("New name",t);null!==n&&""!==n&&n!=t&&(window.location.search="p="+encodeURIComponent(e)+"&ren="+encodeURIComponent(t)+"&to="+encodeURIComponent(n))}function change_checkboxes(e,t){for(var n=e.length-1;n>=0;n--)e[n].checked="boolean"==typeof t?t:!e[n].checked}function get_checkboxes(){for(var e=document.getElementsByName("file[]"),t=[],n=e.length-1;n>=0;n--)(e[n].type="checkbox")&&t.push(e[n]);return t}function select_all(){change_checkboxes(get_checkboxes(),!0)}function unselect_all(){change_checkboxes(get_checkboxes(),!1)}function invert_all(){change_checkboxes(get_checkboxes())}function mailto(e,t){var n=new XMLHttpRequest,a="path="+e+"&file="+t+"&type=mail&ajax=true";n.open("POST","",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&alert(n.responseText)},n.send(a)}function showSearch(e){var t=new XMLHttpRequest,n="path="+e+"&type=search&ajax=true";t.open("POST","",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){4==t.readyState&&200==t.status&&(window.searchObj=t.responseText,document.getElementById("searchresultWrapper").innerHTML="",window.location.hash="#searchResult")},t.send(n)}function getSearchResult(e,t){var n=[],a=[];return e.forEach(function(e){"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)}),{folders:n,files:a}}function checkbox_toggle(){var e=get_checkboxes();e.push(this),change_checkboxes(e)}function backup(e,t){var n=new XMLHttpRequest,a="path="+e+"&file="+t+"&type=backup&ajax=true";return n.open("POST","",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&alert(n.responseText)},n.send(a),!1}function edit_save(e,t){var n="ace"==t?editor.getSession().getValue():document.getElementById("normal-editor").value;if(n){var a=document.createElement("form");a.setAttribute("method","POST"),a.setAttribute("action","");var o=document.createElement("textarea");o.setAttribute("type","textarea"),o.setAttribute("name","savedata");var c=document.createTextNode(n);o.appendChild(c),a.appendChild(o),document.body.appendChild(a),a.submit()}}function init_php_file_tree(){if(document.getElementsByTagName){for(var e=document.getElementsByTagName("LI"),t=0;t<e.length;t++){var n=e[t].className;if(n.indexOf("pft-directory")>-1)for(var a=e[t].childNodes,o=0;o<a.length;o++)"A"==a[o].tagName&&(a[o].onclick=function(){for(var e=this.nextSibling;;){if(null==e)return!1;if("UL"==e.tagName){var t="none"==e.style.display;return e.style.display=t?"block":"none",this.className=t?"open":"closed",!1}e=e.nextSibling}return!1},a[o].className=n.indexOf("open")>-1?"open":"closed"),"UL"==a[o].tagName&&(a[o].style.display=n.indexOf("open")>-1?"block":"none")}return!1}}var searchEl=document.querySelector("input[type=search]"),timeout=null;searchEl.onkeyup=function(e){clearTimeout(timeout);var t=JSON.parse(window.searchObj),n=document.querySelector("input[type=search]").value;timeout=setTimeout(function(){if(n.length>=2){var e=getSearchResult(t,n),a="",o="";e.folders.forEach(function(e){a+='<li class="'+e.type+'"><a href="?p='+e.path+'">'+e.name+"</a></li>"}),e.files.forEach(function(e){o+='<li class="'+e.type+'"><a href="?p='+e.path+"&view="+e.name+'">'+e.name+"</a></li>"}),document.getElementById("searchresultWrapper").innerHTML='<div class="model-wrapper">'+a+o+"</div>"}},500)},window.onload=init_php_file_tree;if(document.getElementById("file-tree-view")){var tableViewHt=document.getElementById("main-table").offsetHeight-2;document.getElementById("file-tree-view").setAttribute("style","height:"+tableViewHt+"px")};
2090</script>
2091<?php if (isset($_GET['view']) && FM_USE_HIGHLIGHTJS): ?>
2092<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
2093<script>hljs.initHighlightingOnLoad();</script>
2094<?php endif; ?>
2095<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE): ?>
2096<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"></script>
2097<script>var editor = ace.edit("editor");editor.getSession().setMode("ace/mode/javascript");</script>
2098<?php endif; ?>
2099</body>
2100</html>
2101<?php
2102}
2103
2104/**
2105 * Show image
2106 * @param string $img
2107 */
2108function fm_show_image($img)
2109{
2110 $modified_time = gmdate('D, d M Y 00:00:00') . ' GMT';
2111 $expires_time = gmdate('D, d M Y 00:00:00', strtotime('+1 day')) . ' GMT';
2112
2113 $img = trim($img);
2114 $images = fm_get_images();
2115 $image = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42mL4//8/A0CAAQAI/AL+26JNFgAAAABJRU5ErkJggg==';
2116 if (isset($images[$img])) {
2117 $image = $images[$img];
2118 }
2119 $image = base64_decode($image);
2120 if (function_exists('mb_strlen')) {
2121 $size = mb_strlen($image, '8bit');
2122 } else {
2123 $size = strlen($image);
2124 }
2125
2126 if (function_exists('header_remove')) {
2127 header_remove('Cache-Control');
2128 header_remove('Pragma');
2129 } else {
2130 header('Cache-Control:');
2131 header('Pragma:');
2132 }
2133
2134 header('Last-Modified: ' . $modified_time, true, 200);
2135 header('Expires: ' . $expires_time);
2136 header('Content-Length: ' . $size);
2137 header('Content-Type: image/png');
2138 echo $image;
2139
2140 exit;
2141}
2142
2143/**
2144 * Get base64-encoded images
2145 * @return array
2146 */
2147function fm_get_images()
2148{
2149 return array(
2150 'favicon' => 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ
2151bWFnZVJlYWR5ccllPAAAAZVJREFUeNqkk79Lw0AUx1+uidTQim4Waxfpnl1BcHMR6uLkIF0cpYOI
2152f4KbOFcRwbGTc0HQSVQQXCqlFIXgFkhIyvWS870LaaPYH9CDy8vdfb+fey930aSUMEvT6VHVzw8x
2153rKUX3N3Hj/8M+cZ6GcOtBPl6KY5iAA7KJzfVWrfbhUKhALZtQ6myDf1+X5nsuzjLUmUOnpa+v5r1
2154Z4ZDDfsLiwER45xDEATgOI6KntfDd091GidzC8vZ4vH1QQ09+4MSMAMWRREKPMhmsyr6voYmrnb2
2155PKEizdEabUaeFCDKCCHAdV0wTVNFznMgpVqGlZ2cipzHGtKSZwCIZJgJwxB38KHT6Sjx21V75Jcn
2156LXmGAKTRpGVZUx2dAqQzSEqw9kqwuGqONTufPrw37D8lQFxCvjgPXIixANLEGfwuQacMOC4kZz+q
2157GdhJS550BjpRCdCbAJCMJRkMASEIg+4Bxz4JwAwDSEueAYDLIM+QrOk6GHiRxjXSkJY8KUCvdXZ6
2158kbuvNx+mOcbN9taGBlpLAWf9nX8EGADoCfqkKWV/cgAAAABJRU5ErkJggg==',
2159 'sprites' => 'iVBORw0KGgoAAAANSUhEUgAAAYAAAAAgCAMAAAAscl/XAAAC/VBMVEUAAABUfn4KKipIcXFSeXsx
2160VlZSUlNAZ2c4Xl4lSUkRDg7w8O/d3d3LhwAWFhYXODgMLCx8fHw9PT2TtdOOAACMXgE8lt+dmpq+
2161fgABS3RUpN+VUycuh9IgeMJUe4C5dUI6meKkAQEKCgoMWp5qtusJmxSUPgKudAAXCghQMieMAgIU
2162abNSUlJLe70VAQEsh85oaGjBEhIBOGxfAoyUbUQAkw8gui4LBgbOiFPHx8cZX6PMS1OqFha/MjIK
2163VKFGBABSAXovGAkrg86xAgIoS5Y7c6Nf7W1Hz1NmAQB3Hgx8fHyiTAAwp+eTz/JdDAJ0JwAAlxCQ
2164UAAvmeRiYp6ysrmIAABJr/ErmiKmcsATpRyfEBAOdQgOXahyAAAecr1JCwHMiABgfK92doQGBgZG
2165AGkqKiw0ldYuTHCYsF86gB05UlJmQSlra2tVWED////8/f3t9fX5/Pzi8/Px9vb2+/v0+fnn8vLf
21667OzZ6enV5+eTpKTo6Oj6/v765Z/U5eX4+Pjx+Pjv0ojWBASxw8O8vL52dnfR19CvAADR3PHr6+vi
21674uPDx8v/866nZDO7iNT335jtzIL+7aj86aTIztXDw8X13JOlpKJoaHDJAACltratrq3lAgKfAADb
21684vb76N2au9by2I9gYGVIRkhNTE90wfXq2sh8gL8QMZ3pyn27AADr+uu1traNiIh2olTTshifodQ4
2169ZM663PH97+YeRq2GqmRjmkGjnEDnfjLVVg6W4f7s6/p/0fr98+5UVF6wz+SjxNsmVb5RUVWMrc7d
2170zrrIpWI8PD3pkwhCltZFYbNZja82wPv05NPRdXzhvna4uFdIiibPegGQXankxyxe0P7PnOhTkDGA
2171gBrbhgR9fX9bW1u8nRFamcgvVrACJIvlXV06nvtdgON4mdn3og7AagBTufkucO7snJz4b28XEhIT
2172sflynsLEvIk55kr866aewo2YuYDrnFffOTk6Li6hgAn3y8XkusCHZQbt0NP571lqRDZyMw96lZXE
2173s6qcrMmJaTmVdRW2AAAAbnRSTlMAZodsJHZocHN7hP77gnaCZWdx/ki+RfqOd/7+zc9N/szMZlf8
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
2243RK5CYII=',
2244 );
2245}
2246?>