· 7 years ago · Jan 05, 2019, 09:18 PM
1<?php
2/**
3 * H3K | Tiny File Manager
4 * CCP Programmers | ccpprogrammers@gmail.com
5 * http://fb.com/ccpprogrammers
6 * https://tinyfilemanager.github.io
7 */
8
9// Default language
10$lang = 'en';
11
12// Auth with login/password (set true/false to enable/disable it)
13$use_auth = true;
14
15// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
16// Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
17$auth_users = array(
18 'admin' => '$2y$10$1wXHgLfTggq4SUTkm5YGUuO771X106e.B0WgHXXkH72C0/LuY6ZSW', //admin
19 'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
20);
21
22// Readonly users (username array)
23$readonly_users = array(
24 'user'
25);
26
27// user specific directories
28// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
29$directories_users = array();
30
31// Show or hide files and folders that starts with a dot
32$show_hidden_files = true;
33
34// Enable highlight.js (https://highlightjs.org/) on view's page
35$use_highlightjs = true;
36
37// highlight.js style
38$highlightjs_style = 'vs';
39
40// Enable ace.js (https://ace.c9.io/) on view's page
41$edit_files = true;
42
43// Default timezone for date() and time() - http://php.net/manual/en/timezones.php
44$default_timezone = 'Etc/UTC'; // UTC
45
46// Root path for file manager
47$root_path = $_SERVER['DOCUMENT_ROOT'];
48
49// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
50// Will not working if $root_path will be outside of server document root
51$root_url = '';
52
53// Server hostname. Can set manually if wrong
54$http_host = $_SERVER['HTTP_HOST'];
55
56// input encoding for iconv
57$iconv_input_encoding = 'UTF-8';
58
59// date() format for file modification date
60$datetime_format = 'd.m.y H:i';
61
62// allowed file extensions for upload and rename
63$allowed_extensions = ''; // 'gif,png,jpg'
64
65// Array of files and folders excluded from listing
66$GLOBALS['exclude_items'] = array();
67
68// Google Docs Viewer
69$GLOBALS['online_viewer'] = true;
70
71// Turn on/off PHP error reporting
72$report_errors = true; // false = Turns off Errors, true = Turns on Errors
73
74// include user config php file
75if (defined('FM_CONFIG') && is_file(FM_CONFIG)) {
76 include(FM_CONFIG);
77}
78
79//--- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL
80
81if ($report_errors == true) {
82 @ini_set('error_reporting', E_ALL);
83 @ini_set('display_errors', 1);
84} else {
85 @ini_set('error_reporting', E_ALL);
86 @ini_set('display_errors', 0);
87}
88
89//Set Cookie
90$cache = isset($_COOKIE['fm_cache']) ? 1 : 0;
91setcookie('fm_cache', $cache, time() + 3600);
92
93// if fm included
94if (defined('FM_EMBED')) {
95 $use_auth = false;
96} else {
97 @set_time_limit(600);
98
99 date_default_timezone_set($default_timezone);
100
101 ini_set('default_charset', 'UTF-8');
102 if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) {
103 mb_internal_encoding('UTF-8');
104 }
105 if (function_exists('mb_regex_encoding')) {
106 mb_regex_encoding('UTF-8');
107 }
108
109 session_cache_limiter('');
110 session_name('filemanager');
111 session_start();
112}
113
114if (empty($auth_users)) {
115 $use_auth = false;
116}
117
118$is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
119 || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
120
121// clean $root_url
122$root_url = fm_clean_path($root_url);
123
124// abs path for site
125defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : ''));
126defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']);
127
128// logout
129if (isset($_GET['logout'])) {
130 unset($_SESSION['logged']);
131 fm_redirect(FM_SELF_URL);
132}
133
134// Show image here
135if (isset($_GET['img'])) {
136 fm_show_image($_GET['img']);
137}
138
139// Auth
140if ($use_auth) {
141 if (isset($_SESSION['logged'], $auth_users[$_SESSION['logged']])) {
142 // Logged
143 } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'])) {
144 // Logging In
145 sleep(1);
146 if (isset($auth_users[$_POST['fm_usr']]) && password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']])) {
147 $_SESSION['logged'] = $_POST['fm_usr'];
148 fm_set_msg('You are logged in');
149 fm_redirect(FM_SELF_URL . '?p=');
150 } else {
151 unset($_SESSION['logged']);
152 fm_set_msg('Wrong password', 'error');
153 fm_redirect(FM_SELF_URL);
154 }
155 } else {
156 // Form
157 unset($_SESSION['logged']);
158 fm_show_header_login();
159 fm_show_message();
160 ?>
161 <section class="h-100">
162 <div class="container h-100">
163 <div class="row justify-content-md-center h-100">
164 <div class="card-wrapper">
165 <div class="brand">
166 <img src="https://tinyfilemanager.herokuapp.com/logo.php?id=<?php echo (isset($_COOKIE['fm_cache']) ? 1 : 0).'&refer='.urlencode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>" alt="H3K File Manager">
167 </div>
168 <div class="text-center">
169 <h1 class="card-title">Tiny File Manager</h1>
170 </div>
171 <div class="card fat">
172 <div class="card-body">
173 <form class="form-signin" action="" method="post" autocomplete="off">
174 <div class="form-group">
175 <label for="fm_usr">Username</label>
176 <input type="text" class="form-control" id="fm_usr" name="fm_usr" required autofocus>
177 <div class="invalid-feedback">
178 Email is invalid
179 </div>
180 </div>
181
182 <div class="form-group">
183 <label for="fm_pwd">Password</label>
184 <input type="password" class="form-control" id="fm_pwd" name="fm_pwd" required>
185 </div>
186
187 <div class="form-group">
188 <div class="custom-checkbox custom-control">
189 <input type="checkbox" name="remember" id="remember" class="custom-control-input">
190 <label for="remember" class="custom-control-label">Remember Me</label>
191 </div>
192 </div>
193
194 <div class="form-group m-0">
195 <button type="submit" class="btn btn-success btn-block" role="button">
196 Sign in
197 </button>
198 </div>
199 </form>
200 </div>
201 </div>
202 <div class="footer text-center">
203 —— © <a href="mailto:ccpprogrammers@gmail.com" class="text-muted">CCP Programmers</a> ——
204 </div>
205 </div>
206 </div>
207 </div>
208 </section>
209
210 <?php
211 fm_show_footer_login();
212 exit;
213 }
214}
215
216// update root path
217if ($use_auth && isset($_SESSION['logged'])) {
218 $root_path = isset($directories_users[$_SESSION['logged']]) ? $directories_users[$_SESSION['logged']] : $root_path;
219}
220
221// clean and check $root_path
222$root_path = rtrim($root_path, '\\/');
223$root_path = str_replace('\\', '/', $root_path);
224if (!@is_dir($root_path)) {
225 echo "<h1>Root path \"{$root_path}\" not found!</h1>";
226 exit;
227}
228
229defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files);
230defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path);
231defined('FM_LANG') || define('FM_LANG', $lang);
232defined('FM_EXTENSION') || define('FM_EXTENSION', $allowed_extensions);
233define('FM_READONLY', $use_auth && !empty($readonly_users) && isset($_SESSION['logged']) && in_array($_SESSION['logged'], $readonly_users));
234define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\');
235
236// always use ?p=
237if (!isset($_GET['p']) && empty($_FILES)) {
238 fm_redirect(FM_SELF_URL . '?p=');
239}
240
241// get path
242$p = isset($_GET['p']) ? $_GET['p'] : (isset($_POST['p']) ? $_POST['p'] : '');
243
244// clean path
245$p = fm_clean_path($p);
246
247// instead globals vars
248define('FM_PATH', $p);
249define('FM_USE_AUTH', $use_auth);
250define('FM_EDIT_FILE', $edit_files);
251defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', $iconv_input_encoding);
252defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', $use_highlightjs);
253defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style);
254defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', $datetime_format);
255
256unset($p, $use_auth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style);
257
258/*************************** ACTIONS ***************************/
259
260// AJAX Request
261if (isset($_POST['ajax']) && !FM_READONLY) {
262
263 // backup files
264 if (isset($_POST['type']) && $_POST['type'] == "backup") {
265 $file = $_POST['file'];
266 $path = $_POST['path'];
267 $date = date("dMy-His");
268 $newFile = $file . '-' . $date . '.bak';
269 copy($path . '/' . $file, $path . '/' . $newFile) or die("Unable to backup");
270 echo "Backup $newFile Created";
271 }
272
273 exit();
274}
275
276// Delete file / folder
277if (isset($_GET['del']) && !FM_READONLY) {
278 $del = $_GET['del'];
279 $del = fm_clean_path($del);
280 $del = str_replace('/', '', $del);
281 if ($del != '' && $del != '..' && $del != '.') {
282 $path = FM_ROOT_PATH;
283 if (FM_PATH != '') {
284 $path .= '/' . FM_PATH;
285 }
286 $is_dir = is_dir($path . '/' . $del);
287 if (fm_rdelete($path . '/' . $del)) {
288 $msg = $is_dir ? 'Folder <b>%s</b> deleted' : 'File <b>%s</b> deleted';
289 fm_set_msg(sprintf($msg, fm_enc($del)));
290 } else {
291 $msg = $is_dir ? 'Folder <b>%s</b> not deleted' : 'File <b>%s</b> not deleted';
292 fm_set_msg(sprintf($msg, fm_enc($del)), 'error');
293 }
294 } else {
295 fm_set_msg('Wrong file or folder name', 'error');
296 }
297 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
298}
299
300// Create folder
301if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
302 $new = strip_tags($_GET['new']);
303 $type = $_GET['type'];
304 $new = fm_clean_path($new);
305 $new = str_replace('/', '', $new);
306 if ($new != '' && $new != '..' && $new != '.') {
307 $path = FM_ROOT_PATH;
308 if (FM_PATH != '') {
309 $path .= '/' . FM_PATH;
310 }
311 if ($_GET['type'] == "file") {
312 if (!file_exists($path . '/' . $new)) {
313 @fopen($path . '/' . $new, 'w') or die('Cannot open file: ' . $new);
314 fm_set_msg(sprintf('File <b>%s</b> created', fm_enc($new)));
315 } else {
316 fm_set_msg(sprintf('File <b>%s</b> already exists', fm_enc($new)), 'alert');
317 }
318 } else {
319 if (fm_mkdir($path . '/' . $new, false) === true) {
320 fm_set_msg(sprintf('Folder <b>%s</b> created', $new));
321 } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) {
322 fm_set_msg(sprintf('Folder <b>%s</b> already exists', fm_enc($new)), 'alert');
323 } else {
324 fm_set_msg(sprintf('Folder <b>%s</b> not created', fm_enc($new)), 'error');
325 }
326 }
327 } else {
328 fm_set_msg('Wrong folder name', 'error');
329 }
330 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
331}
332
333// Copy folder / file
334if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
335 // from
336 $copy = $_GET['copy'];
337 $copy = fm_clean_path($copy);
338 // empty path
339 if ($copy == '') {
340 fm_set_msg('Source path not defined', 'error');
341 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
342 }
343 // abs path from
344 $from = FM_ROOT_PATH . '/' . $copy;
345 // abs path to
346 $dest = FM_ROOT_PATH;
347 if (FM_PATH != '') {
348 $dest .= '/' . FM_PATH;
349 }
350 $dest .= '/' . basename($from);
351 // move?
352 $move = isset($_GET['move']);
353 // copy/move
354 if ($from != $dest) {
355 $msg_from = trim(FM_PATH . '/' . basename($from), '/');
356 if ($move) {
357 $rename = fm_rename($from, $dest);
358 if ($rename) {
359 fm_set_msg(sprintf('Moved from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
360 } elseif ($rename === null) {
361 fm_set_msg('File or folder with this path already exists', 'alert');
362 } else {
363 fm_set_msg(sprintf('Error while moving from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
364 }
365 } else {
366 if (fm_rcopy($from, $dest)) {
367 fm_set_msg(sprintf('Copyied from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
368 } else {
369 fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
370 }
371 }
372 } else {
373 fm_set_msg('Paths must be not equal', 'alert');
374 }
375 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
376}
377
378// Mass copy files/ folders
379if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) {
380 // from
381 $path = FM_ROOT_PATH;
382 if (FM_PATH != '') {
383 $path .= '/' . FM_PATH;
384 }
385 // to
386 $copy_to_path = FM_ROOT_PATH;
387 $copy_to = fm_clean_path($_POST['copy_to']);
388 if ($copy_to != '') {
389 $copy_to_path .= '/' . $copy_to;
390 }
391 if ($path == $copy_to_path) {
392 fm_set_msg('Paths must be not equal', 'alert');
393 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
394 }
395 if (!is_dir($copy_to_path)) {
396 if (!fm_mkdir($copy_to_path, true)) {
397 fm_set_msg('Unable to create destination folder', 'error');
398 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
399 }
400 }
401 // move?
402 $move = isset($_POST['move']);
403 // copy/move
404 $errors = 0;
405 $files = $_POST['file'];
406 if (is_array($files) && count($files)) {
407 foreach ($files as $f) {
408 if ($f != '') {
409 // abs path from
410 $from = $path . '/' . $f;
411 // abs path to
412 $dest = $copy_to_path . '/' . $f;
413 // do
414 if ($move) {
415 $rename = fm_rename($from, $dest);
416 if ($rename === false) {
417 $errors++;
418 }
419 } else {
420 if (!fm_rcopy($from, $dest)) {
421 $errors++;
422 }
423 }
424 }
425 }
426 if ($errors == 0) {
427 $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied';
428 fm_set_msg($msg);
429 } else {
430 $msg = $move ? 'Error while moving items' : 'Error while copying items';
431 fm_set_msg($msg, 'error');
432 }
433 } else {
434 fm_set_msg('Nothing selected', 'alert');
435 }
436 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
437}
438
439// Rename
440if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) {
441 // old name
442 $old = $_GET['ren'];
443 $old = fm_clean_path($old);
444 $old = str_replace('/', '', $old);
445 // new name
446 $new = $_GET['to'];
447 $new = fm_clean_path($new);
448 $new = str_replace('/', '', $new);
449 // path
450 $path = FM_ROOT_PATH;
451 if (FM_PATH != '') {
452 $path .= '/' . FM_PATH;
453 }
454 // rename
455 if ($old != '' && $new != '') {
456 if (fm_rename($path . '/' . $old, $path . '/' . $new)) {
457 fm_set_msg(sprintf('Renamed from <b>%s</b> to <b>%s</b>', fm_enc($old), fm_enc($new)));
458 } else {
459 fm_set_msg(sprintf('Error while renaming from <b>%s</b> to <b>%s</b>', fm_enc($old), fm_enc($new)), 'error');
460 }
461 } else {
462 fm_set_msg('Names not set', 'error');
463 }
464 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
465}
466
467// Download
468if (isset($_GET['dl'])) {
469 $dl = $_GET['dl'];
470 $dl = fm_clean_path($dl);
471 $dl = str_replace('/', '', $dl);
472 $path = FM_ROOT_PATH;
473 if (FM_PATH != '') {
474 $path .= '/' . FM_PATH;
475 }
476 if ($dl != '' && is_file($path . '/' . $dl)) {
477 header('Content-Description: File Transfer');
478 header('Content-Type: application/octet-stream');
479 header('Content-Disposition: attachment; filename="' . basename($path . '/' . $dl) . '"');
480 header('Content-Transfer-Encoding: binary');
481 header('Connection: Keep-Alive');
482 header('Expires: 0');
483 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
484 header('Pragma: public');
485 header('Content-Length: ' . filesize($path . '/' . $dl));
486 readfile($path . '/' . $dl);
487 exit;
488 } else {
489 fm_set_msg('File not found', 'error');
490 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
491 }
492}
493
494// Upload
495if (!empty($_FILES) && !FM_READONLY) {
496 $f = $_FILES;
497 $path = FM_ROOT_PATH;
498 $ds = DIRECTORY_SEPARATOR;
499 if (FM_PATH != '') {
500 $path .= '/' . FM_PATH;
501 }
502
503 $errors = 0;
504 $uploads = 0;
505 $total = count($f['file']['name']);
506 $allowed = (FM_EXTENSION) ? explode(',', FM_EXTENSION) : false;
507
508 $filename = $f['file']['name'];
509 $tmp_name = $f['file']['tmp_name'];
510 $ext = pathinfo($filename, PATHINFO_EXTENSION);
511 $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
512
513 $targetPath = $path . $ds;
514 $fullPath = $path . '/' . $_REQUEST['fullpath'];
515 $folder = substr($fullPath, 0, strrpos($fullPath, "/"));
516
517 if (!is_dir($folder)) {
518 $old = umask(0);
519 mkdir($folder, 0777, true);
520 umask($old);
521 }
522
523 if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) {
524 if (move_uploaded_file($tmp_name, $fullPath)) {
525 die('Successfully uploaded');
526 } else {
527 die(sprintf('Error while uploading files. Uploaded files: %s', $uploads));
528 }
529 }
530 exit();
531}
532
533// Mass deleting
534if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) {
535 $path = FM_ROOT_PATH;
536 if (FM_PATH != '') {
537 $path .= '/' . FM_PATH;
538 }
539
540 $errors = 0;
541 $files = $_POST['file'];
542 if (is_array($files) && count($files)) {
543 foreach ($files as $f) {
544 if ($f != '') {
545 $new_path = $path . '/' . $f;
546 if (!fm_rdelete($new_path)) {
547 $errors++;
548 }
549 }
550 }
551 if ($errors == 0) {
552 fm_set_msg('Selected files and folder deleted');
553 } else {
554 fm_set_msg('Error while deleting items', 'error');
555 }
556 } else {
557 fm_set_msg('Nothing selected', 'alert');
558 }
559
560 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
561}
562
563// Pack files
564if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) {
565 $path = FM_ROOT_PATH;
566 $ext = 'zip';
567 if (FM_PATH != '') {
568 $path .= '/' . FM_PATH;
569 }
570
571 //set pack type
572 $ext = isset($_POST['tar']) ? 'tar' : 'zip';
573
574
575 if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
576 fm_set_msg('Operations with archives are not available', 'error');
577 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
578 }
579
580 $files = $_POST['file'];
581 if (!empty($files)) {
582 chdir($path);
583
584 if (count($files) == 1) {
585 $one_file = reset($files);
586 $one_file = basename($one_file);
587 $zipname = $one_file . '_' . date('ymd_His') . '.'.$ext;
588 } else {
589 $zipname = 'archive_' . date('ymd_His') . '.'.$ext;
590 }
591
592 if($ext == 'zip') {
593 $zipper = new FM_Zipper();
594 $res = $zipper->create($zipname, $files);
595 } elseif ($ext == 'tar') {
596 $tar = new FM_Zipper_Tar();
597 $res = $tar->create($zipname, $files);
598 }
599
600 if ($res) {
601 fm_set_msg(sprintf('Archive <b>%s</b> created', fm_enc($zipname)));
602 } else {
603 fm_set_msg('Archive not created', 'error');
604 }
605 } else {
606 fm_set_msg('Nothing selected', 'alert');
607 }
608
609 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
610}
611
612// Unpack
613if (isset($_GET['unzip']) && !FM_READONLY) {
614 $unzip = $_GET['unzip'];
615 $unzip = fm_clean_path($unzip);
616 $unzip = str_replace('/', '', $unzip);
617 $isValid = false;
618
619 $path = FM_ROOT_PATH;
620 if (FM_PATH != '') {
621 $path .= '/' . FM_PATH;
622 }
623
624 if ($unzip != '' && is_file($path . '/' . $unzip)) {
625 $zip_path = $path . '/' . $unzip;
626 $ext = pathinfo($zip_path, PATHINFO_EXTENSION);
627 $isValid = true;
628 } else {
629 fm_set_msg('File not found', 'error');
630 }
631
632
633 if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
634 fm_set_msg('Operations with archives are not available', 'error');
635 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
636 }
637
638 if ($isValid) {
639 //to folder
640 $tofolder = '';
641 if (isset($_GET['tofolder'])) {
642 $tofolder = pathinfo($zip_path, PATHINFO_FILENAME);
643 if (fm_mkdir($path . '/' . $tofolder, true)) {
644 $path .= '/' . $tofolder;
645 }
646 }
647
648 if($ext == "zip") {
649 $zipper = new FM_Zipper();
650 $res = $zipper->unzip($zip_path, $path);
651 } elseif ($ext == "tar") {
652 $gzipper = new PharData($zip_path);
653 $res = $gzipper->extractTo($path);
654 }
655
656 if ($res) {
657 fm_set_msg('Archive unpacked');
658 } else {
659 fm_set_msg('Archive not unpacked', 'error');
660 }
661
662 } else {
663 fm_set_msg('File not found', 'error');
664 }
665 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
666}
667
668// Change Perms (not for Windows)
669if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
670 $path = FM_ROOT_PATH;
671 if (FM_PATH != '') {
672 $path .= '/' . FM_PATH;
673 }
674
675 $file = $_POST['chmod'];
676 $file = fm_clean_path($file);
677 $file = str_replace('/', '', $file);
678 if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
679 fm_set_msg('File not found', 'error');
680 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
681 }
682
683 $mode = 0;
684 if (!empty($_POST['ur'])) {
685 $mode |= 0400;
686 }
687 if (!empty($_POST['uw'])) {
688 $mode |= 0200;
689 }
690 if (!empty($_POST['ux'])) {
691 $mode |= 0100;
692 }
693 if (!empty($_POST['gr'])) {
694 $mode |= 0040;
695 }
696 if (!empty($_POST['gw'])) {
697 $mode |= 0020;
698 }
699 if (!empty($_POST['gx'])) {
700 $mode |= 0010;
701 }
702 if (!empty($_POST['or'])) {
703 $mode |= 0004;
704 }
705 if (!empty($_POST['ow'])) {
706 $mode |= 0002;
707 }
708 if (!empty($_POST['ox'])) {
709 $mode |= 0001;
710 }
711
712 if (@chmod($path . '/' . $file, $mode)) {
713 fm_set_msg('Permissions changed');
714 } else {
715 fm_set_msg('Permissions not changed', 'error');
716 }
717
718 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
719}
720
721/*************************** /ACTIONS ***************************/
722
723// get current path
724$path = FM_ROOT_PATH;
725if (FM_PATH != '') {
726 $path .= '/' . FM_PATH;
727}
728
729// check path
730if (!is_dir($path)) {
731 fm_redirect(FM_SELF_URL . '?p=');
732}
733
734// get parent folder
735$parent = fm_get_parent_path(FM_PATH);
736
737$objects = is_readable($path) ? scandir($path) : array();
738$folders = array();
739$files = array();
740if (is_array($objects)) {
741 foreach ($objects as $file) {
742 if ($file == '.' || $file == '..' && in_array($file, $GLOBALS['exclude_items'])) {
743 continue;
744 }
745 if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') {
746 continue;
747 }
748 $new_path = $path . '/' . $file;
749 if (is_file($new_path) && !in_array($file, $GLOBALS['exclude_items'])) {
750 $files[] = $file;
751 } elseif (is_dir($new_path) && $file != '.' && $file != '..' && !in_array($file, $GLOBALS['exclude_items'])) {
752 $folders[] = $file;
753 }
754 }
755}
756
757if (!empty($files)) {
758 natcasesort($files);
759}
760if (!empty($folders)) {
761 natcasesort($folders);
762}
763
764// upload form
765if (isset($_GET['upload']) && !FM_READONLY) {
766 fm_show_header(); // HEADER
767 fm_show_nav_path(FM_PATH); // current path
768 ?>
769
770 <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.css" rel="stylesheet">
771 <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script>
772 <script>
773 Dropzone.options.fileUploader = {
774 init: function () {
775 this.on("sending", function (file) {
776 let _path = (file.fullPath) ? file.fullPath : file.name;
777 document.getElementById("fullpath").value = _path
778 }).on("success", function (res) {
779 console.log('Upload Status >> ', res.status);
780 }).on("error", function(file, response) {
781 alert(response);
782 });
783 }
784 }
785 </script>
786 <div class="path">
787 <div class="card mb-2">
788 <h6 class="card-header">
789 Uploading files
790 </h6>
791 <div class="card-body">
792 <p class="card-text">
793 <a href="?p=<?php echo FM_PATH ?>"><i class="fa fa-chevron-circle-left"></i> Back</a> |
794 Destination folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?>
795 </p>
796
797 <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) . '?p=' . fm_enc(FM_PATH) ?>" class="dropzone" id="fileUploader" enctype="multipart/form-data">
798 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
799 <input type="hidden" name="fullpath" id="fullpath" value="<?php echo fm_enc(FM_PATH) ?>">
800 <div class="fallback">
801 <input name="file" type="file" multiple/>
802 </div>
803 </form>
804 </div>
805 </div>
806 </div>
807 <?php
808 fm_show_footer();
809 exit;
810}
811
812// copy form POST
813if (isset($_POST['copy']) && !FM_READONLY) {
814 $copy_files = $_POST['file'];
815 if (!is_array($copy_files) || empty($copy_files)) {
816 fm_set_msg('Nothing selected', 'alert');
817 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
818 }
819
820 fm_show_header(); // HEADER
821 fm_show_nav_path(FM_PATH); // current path
822 ?>
823 <div class="path">
824 <p><b>Copying</b></p>
825 <form action="" method="post">
826 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
827 <input type="hidden" name="finish" value="1">
828 <?php
829 foreach ($copy_files as $cf) {
830 echo '<input type="hidden" name="file[]" value="' . fm_enc($cf) . '">' . PHP_EOL;
831 }
832 ?>
833 <p class="break-word">Files: <b><?php echo implode('</b>, <b>', $copy_files) ?></b></p>
834 <p class="break-word">Source folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br>
835 <label for="inp_copy_to">Destination folder:</label>
836 <?php echo FM_ROOT_PATH ?>/<input type="text" name="copy_to" id="inp_copy_to" value="<?php echo fm_enc(FM_PATH) ?>">
837 </p>
838 <p><label><input type="checkbox" name="move" value="1"> Move'</label></p>
839 <p>
840 <button type="submit" class="btn"><i class="fa fa-check-circle"></i> Copy</button>
841 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
842 </p>
843 </form>
844 </div>
845 <?php
846 fm_show_footer();
847 exit;
848}
849
850// copy form
851if (isset($_GET['copy']) && !isset($_GET['finish']) && !FM_READONLY) {
852 $copy = $_GET['copy'];
853 $copy = fm_clean_path($copy);
854 if ($copy == '' || !file_exists(FM_ROOT_PATH . '/' . $copy)) {
855 fm_set_msg('File not found', 'error');
856 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
857 }
858
859 fm_show_header(); // HEADER
860 fm_show_nav_path(FM_PATH); // current path
861 ?>
862 <div class="path">
863 <p><b>Copying</b></p>
864 <p class="break-word">
865 Source path: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . $copy)) ?><br>
866 Destination folder: <?php echo fm_enc(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?>
867 </p>
868 <p>
869 <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>
870 <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>
871 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
872 </p>
873 <p><i>Select folder</i></p>
874 <ul class="folders break-word">
875 <?php
876 if ($parent !== false) {
877 ?>
878 <li><a href="?p=<?php echo urlencode($parent) ?>&copy=<?php echo urlencode($copy) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></li>
879 <?php
880 }
881 foreach ($folders as $f) {
882 ?>
883 <li>
884 <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>
885 <?php
886 }
887 ?>
888 </ul>
889 </div>
890 <?php
891 fm_show_footer();
892 exit;
893}
894
895// file viewer
896if (isset($_GET['view'])) {
897 $file = $_GET['view'];
898 $file = fm_clean_path($file);
899 $file = str_replace('/', '', $file);
900 if ($file == '' || !is_file($path . '/' . $file)) {
901 fm_set_msg('File not found', 'error');
902 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
903 }
904
905 fm_show_header(); // HEADER
906 fm_show_nav_path(FM_PATH); // current path
907
908 $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
909 $file_path = $path . '/' . $file;
910
911 $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
912 $mime_type = fm_get_mime_type($file_path);
913 $filesize = filesize($file_path);
914
915 $is_zip = false;
916 $is_gzip = false;
917 $is_image = false;
918 $is_audio = false;
919 $is_video = false;
920 $is_text = false;
921 $is_onlineViewer = false;
922
923 $view_title = 'File';
924 $filenames = false; // for zip
925 $content = ''; // for text
926
927 if($GLOBALS['online_viewer'] && in_array($ext, fm_get_onlineViewer_exts())){
928 $is_onlineViewer = true;
929 }
930 elseif ($ext == 'zip' || $ext == 'tar') {
931 $is_zip = true;
932 $view_title = 'Archive';
933 $filenames = fm_get_zif_info($file_path, $ext);
934 } elseif (in_array($ext, fm_get_image_exts())) {
935 $is_image = true;
936 $view_title = 'Image';
937 } elseif (in_array($ext, fm_get_audio_exts())) {
938 $is_audio = true;
939 $view_title = 'Audio';
940 } elseif (in_array($ext, fm_get_video_exts())) {
941 $is_video = true;
942 $view_title = 'Video';
943 } elseif (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
944 $is_text = true;
945 $content = file_get_contents($file_path);
946 }
947
948 ?>
949 <div class="row">
950 <div class="col-12">
951 <p class="break-word"><b><?php echo $view_title ?> "<?php echo fm_enc(fm_convert_win($file)) ?>"</b></p>
952 <p class="break-word">
953 Full path: <?php echo fm_enc(fm_convert_win($file_path)) ?><br>
954 File
955 size: <?php echo fm_get_filesize($filesize) ?><?php if ($filesize >= 1000): ?> (<?php echo sprintf('%s bytes', $filesize) ?>)<?php endif; ?>
956 <br>
957 MIME-type: <?php echo $mime_type ?><br>
958 <?php
959 // ZIP info
960 if (($is_zip || $is_gzip) && $filenames !== false) {
961 $total_files = 0;
962 $total_comp = 0;
963 $total_uncomp = 0;
964 foreach ($filenames as $fn) {
965 if (!$fn['folder']) {
966 $total_files++;
967 }
968 $total_comp += $fn['compressed_size'];
969 $total_uncomp += $fn['filesize'];
970 }
971 ?>
972 Files in archive: <?php echo $total_files ?><br>
973 Total size: <?php echo fm_get_filesize($total_uncomp) ?><br>
974 Size in archive: <?php echo fm_get_filesize($total_comp) ?><br>
975 Compression: <?php echo round(($total_comp / $total_uncomp) * 100) ?>%<br>
976 <?php
977 }
978 // Image info
979 if ($is_image) {
980 $image_size = getimagesize($file_path);
981 echo 'Image sizes: ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '<br>';
982 }
983 // Text info
984 if ($is_text) {
985 $is_utf8 = fm_is_utf8($content);
986 if (function_exists('iconv')) {
987 if (!$is_utf8) {
988 $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content);
989 }
990 }
991 echo 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '<br>';
992 }
993 ?>
994 </p>
995 <p>
996 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($file) ?>"><i class="fa fa-cloud-download"></i> Download</a></b>
997 <b><a href="<?php echo fm_enc($file_url) ?>" target="_blank"><i class="fa fa-external-link-square"></i> Open</a></b>
998
999 <?php
1000 // ZIP actions
1001 if (!FM_READONLY && ($is_zip || $is_gzip) && $filenames !== false) {
1002 $zip_name = pathinfo($file_path, PATHINFO_FILENAME);
1003 ?>
1004 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>&unzip=<?php echo urlencode($file) ?>"><i class="fa fa-check-circle"></i> UnZip</a></b>
1005 <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>
1006 UnZip to folder</a></b>
1007 <?php
1008 }
1009 if ($is_text && !FM_READONLY) {
1010 ?>
1011 <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>
1012 <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>
1013 <?php } ?>
1014 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-chevron-circle-left"></i> Back</a></b>
1015 </p>
1016 <?php
1017 if($is_onlineViewer) {
1018 // Google docs viewer
1019 echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
1020 } elseif ($is_zip) {
1021 // ZIP content
1022 if ($filenames !== false) {
1023 echo '<code class="maxheight">';
1024 foreach ($filenames as $fn) {
1025 if ($fn['folder']) {
1026 echo '<b>' . fm_enc($fn['name']) . '</b><br>';
1027 } else {
1028 echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')<br>';
1029 }
1030 }
1031 echo '</code>';
1032 } else {
1033 echo '<p>Error while fetching archive info</p>';
1034 }
1035 } elseif ($is_image) {
1036 // Image content
1037 if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico'))) {
1038 echo '<p><img src="' . fm_enc($file_url) . '" alt="" class="preview-img"></p>';
1039 }
1040 } elseif ($is_audio) {
1041 // Audio content
1042 echo '<p><audio src="' . fm_enc($file_url) . '" controls preload="metadata"></audio></p>';
1043 } elseif ($is_video) {
1044 // Video content
1045 echo '<div class="preview-video"><video src="' . fm_enc($file_url) . '" width="640" height="360" controls preload="metadata"></video></div>';
1046 } elseif ($is_text) {
1047 if (FM_USE_HIGHLIGHTJS) {
1048 // highlight
1049 $hljs_classes = array(
1050 'shtml' => 'xml',
1051 'htaccess' => 'apache',
1052 'phtml' => 'php',
1053 'lock' => 'json',
1054 'svg' => 'xml',
1055 );
1056 $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext;
1057 if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) {
1058 $hljs_class = 'nohighlight';
1059 }
1060 $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . fm_enc($content) . '</code></pre>';
1061 } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) {
1062 // php highlight
1063 $content = highlight_string($content, true);
1064 } else {
1065 $content = '<pre>' . fm_enc($content) . '</pre>';
1066 }
1067 echo $content;
1068 }
1069 ?>
1070 </div>
1071 </div>
1072 <?php
1073 fm_show_footer();
1074 exit;
1075}
1076
1077// file editor
1078if (isset($_GET['edit'])) {
1079 $file = $_GET['edit'];
1080 $file = fm_clean_path($file);
1081 $file = str_replace('/', '', $file);
1082 if ($file == '' || !is_file($path . '/' . $file)) {
1083 fm_set_msg('File not found', 'error');
1084 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
1085 }
1086
1087 fm_show_header(); // HEADER
1088 fm_show_nav_path(FM_PATH); // current path
1089
1090 $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
1091 $file_path = $path . '/' . $file;
1092
1093 // normal editer
1094 $isNormalEditor = true;
1095 if (isset($_GET['env'])) {
1096 if ($_GET['env'] == "ace") {
1097 $isNormalEditor = false;
1098 }
1099 }
1100
1101 // Save File
1102 if (isset($_POST['savedata'])) {
1103 $writedata = $_POST['savedata'];
1104 $fd = fopen($file_path, "w");
1105 @fwrite($fd, $writedata);
1106 fclose($fd);
1107 fm_set_msg('File Saved Successfully', 'alert');
1108 }
1109
1110 $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
1111 $mime_type = fm_get_mime_type($file_path);
1112 $filesize = filesize($file_path);
1113 $is_text = false;
1114 $content = ''; // for text
1115
1116 if (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
1117 $is_text = true;
1118 $content = file_get_contents($file_path);
1119 }
1120
1121 ?>
1122 <div class="path">
1123 <div class="edit-file-actions col-xs-12 col-md-6 text-right">
1124 <a title="Back"
1125 href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&view=<?php echo urlencode($file) ?>"><i class="fa fa-reply-all"></i> Back</a>
1126 <a title="Backup"
1127 href="javascript:backup('<?php echo urlencode($path) ?>','<?php echo urlencode($file) ?>')"><i class="fa fa-database"></i> Backup</a>
1128 <?php if ($is_text) { ?>
1129 <?php if ($isNormalEditor) { ?>
1130 <a title="Advanced"
1131 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>
1132 <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
1133 </button>
1134 <?php } else { ?>
1135 <a title="Plain Editor"
1136 href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>"><i class="fa fa-text-height"></i> Plain Editor</a>
1137 <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
1138 </button>
1139 <?php } ?>
1140 <?php } ?>
1141 </div>
1142 <?php
1143 if ($is_text && $isNormalEditor) {
1144 echo '<textarea id="normal-editor" rows="33" cols="120" style="width: 99.5%;">' . htmlspecialchars($content) . '</textarea>';
1145 } elseif ($is_text) {
1146 echo '<div id="editor" contenteditable="true">' . htmlspecialchars($content) . '</div>';
1147 } else {
1148 fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error');
1149 }
1150 ?>
1151 </div>
1152 <?php
1153 fm_show_footer();
1154 exit;
1155}
1156
1157// chmod (not for Windows)
1158if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {
1159 $file = $_GET['chmod'];
1160 $file = fm_clean_path($file);
1161 $file = str_replace('/', '', $file);
1162 if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
1163 fm_set_msg('File not found', 'error');
1164 fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
1165 }
1166
1167 fm_show_header(); // HEADER
1168 fm_show_nav_path(FM_PATH); // current path
1169
1170 $file_url = FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file;
1171 $file_path = $path . '/' . $file;
1172
1173 $mode = fileperms($path . '/' . $file);
1174
1175 ?>
1176 <div class="path">
1177 <p><b><?php echo 'Change Permissions'; ?></b></p>
1178 <p>
1179 <?php echo 'Full path:'; ?> <?php echo $file_path ?><br>
1180 </p>
1181 <form action="" method="post">
1182 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
1183 <input type="hidden" name="chmod" value="<?php echo fm_enc($file) ?>">
1184
1185 <table class="compact-table">
1186 <tr>
1187 <td></td>
1188 <td><b>Owner</b></td>
1189 <td><b>Group</b></td>
1190 <td><b>Other</b></td>
1191 </tr>
1192 <tr>
1193 <td style="text-align: right"><b>Read</b></td>
1194 <td><label><input type="checkbox" name="ur" value="1"<?php echo ($mode & 00400) ? ' checked' : '' ?>></label></td>
1195 <td><label><input type="checkbox" name="gr" value="1"<?php echo ($mode & 00040) ? ' checked' : '' ?>></label></td>
1196 <td><label><input type="checkbox" name="or" value="1"<?php echo ($mode & 00004) ? ' checked' : '' ?>></label></td>
1197 </tr>
1198 <tr>
1199 <td style="text-align: right"><b>Write</b></td>
1200 <td><label><input type="checkbox" name="uw" value="1"<?php echo ($mode & 00200) ? ' checked' : '' ?>></label></td>
1201 <td><label><input type="checkbox" name="gw" value="1"<?php echo ($mode & 00020) ? ' checked' : '' ?>></label></td>
1202 <td><label><input type="checkbox" name="ow" value="1"<?php echo ($mode & 00002) ? ' checked' : '' ?>></label></td>
1203 </tr>
1204 <tr>
1205 <td style="text-align: right"><b>Execute</b></td>
1206 <td><label><input type="checkbox" name="ux" value="1"<?php echo ($mode & 00100) ? ' checked' : '' ?>></label></td>
1207 <td><label><input type="checkbox" name="gx" value="1"<?php echo ($mode & 00010) ? ' checked' : '' ?>></label></td>
1208 <td><label><input type="checkbox" name="ox" value="1"<?php echo ($mode & 00001) ? ' checked' : '' ?>></label></td>
1209 </tr>
1210 </table>
1211
1212 <p>
1213 <button type="submit" class="btn"><i class="fa fa-check-circle"></i> Change</button>
1214 <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
1215 </p>
1216
1217 </form>
1218
1219 </div>
1220 <?php
1221 fm_show_footer();
1222 exit;
1223}
1224
1225//--- FILEMANAGER MAIN
1226fm_show_header(); // HEADER
1227fm_show_nav_path(FM_PATH); // current path
1228
1229// messages
1230fm_show_message();
1231
1232$num_files = count($files);
1233$num_folders = count($folders);
1234$all_files_size = 0;
1235?>
1236<form action="" method="post" class="pt-3">
1237 <input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
1238 <input type="hidden" name="group" value="1">
1239 <div class="table-responsive">
1240 <table class="table table-bordered table-hover table-sm bg-white" id="main-table">
1241 <thead class="thead-white">
1242 <tr>
1243 <?php if (!FM_READONLY): ?>
1244 <th style="width:3%">
1245 <div class="custom-control custom-checkbox">
1246 <input type="checkbox" class="custom-control-input" id="js-select-all-items" onclick="checkbox_toggle()">
1247 <label class="custom-control-label" for="js-select-all-items"></label>
1248 </div>
1249 </th><?php endif; ?>
1250 <th>Name</th>
1251 <th>Size</th>
1252 <th>Modified</th>
1253 <?php if (!FM_IS_WIN): ?>
1254 <th>Perms</th>
1255 <th>Owner</th><?php endif; ?>
1256 <th>Actions</th>
1257 </tr>
1258 </thead>
1259 <?php
1260 // link to parent folder
1261 if ($parent !== false) {
1262 ?>
1263 <tr><?php if (!FM_READONLY): ?>
1264 <td class="nosort"></td><?php endif; ?>
1265 <td class="border-0"><a href="?p=<?php echo urlencode($parent) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></td>
1266 <td class="border-0"></td>
1267 <td class="border-0"></td>
1268 <td class="border-0"></td>
1269 <?php if (!FM_IS_WIN) { ?>
1270 <td class="border-0"></td>
1271 <td class="border-0"></td>
1272 <?php } ?>
1273 </tr>
1274 <?php
1275 }
1276 $ii = 3399;
1277 foreach ($folders as $f) {
1278 $is_link = is_link($path . '/' . $f);
1279 $img = $is_link ? 'icon-link_folder' : 'fa fa-folder-o';
1280 $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));
1281 $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
1282 if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
1283 $owner = posix_getpwuid(fileowner($path . '/' . $f));
1284 $group = posix_getgrgid(filegroup($path . '/' . $f));
1285 } else {
1286 $owner = array('name' => '?');
1287 $group = array('name' => '?');
1288 }
1289 ?>
1290 <tr>
1291 <?php if (!FM_READONLY): ?>
1292 <td>
1293 <div class="custom-control custom-checkbox">
1294 <input type="checkbox" class="custom-control-input" id="<?php echo $ii ?>" name="file[]" value="<?php echo fm_enc($f) ?>">
1295 <label class="custom-control-label" for="<?php echo $ii ?>"></label>
1296 </div>
1297 </td><?php endif; ?>
1298 <td>
1299 <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) ?>
1300 </a><?php echo($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?></div>
1301 </td>
1302 <td>Folder</td>
1303 <td><?php echo $modif ?></td>
1304 <?php if (!FM_IS_WIN): ?>
1305 <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; ?>
1306 </td>
1307 <td><?php echo $owner['name'] . ':' . $group['name'] ?></td>
1308 <?php endif; ?>
1309 <td class="inline-actions"><?php if (!FM_READONLY): ?>
1310 <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>
1311 <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>
1312 <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>
1313 <?php endif; ?>
1314 <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>
1315 </td>
1316 </tr>
1317 <?php
1318 flush();
1319 $ii++;
1320 }
1321 $ik = 6070;
1322 foreach ($files as $f) {
1323 $is_link = is_link($path . '/' . $f);
1324 $img = $is_link ? 'fa fa-file-text-o' : fm_get_file_icon_class($path . '/' . $f);
1325 $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));
1326 $filesize_raw = filesize($path . '/' . $f);
1327 $filesize = fm_get_filesize($filesize_raw);
1328 $filelink = '?p=' . urlencode(FM_PATH) . '&view=' . urlencode($f);
1329 $all_files_size += $filesize_raw;
1330 $perms = substr(decoct(fileperms($path . '/' . $f)), -4);
1331 if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
1332 $owner = posix_getpwuid(fileowner($path . '/' . $f));
1333 $group = posix_getgrgid(filegroup($path . '/' . $f));
1334 } else {
1335 $owner = array('name' => '?');
1336 $group = array('name' => '?');
1337 }
1338 ?>
1339 <tr>
1340 <?php if (!FM_READONLY): ?>
1341 <td>
1342 <div class="custom-control custom-checkbox">
1343 <input type="checkbox" class="custom-control-input" id="<?php echo $ik ?>" name="file[]" value="<?php echo fm_enc($f) ?>">
1344 <label class="custom-control-label" for="<?php echo $ik ?>"></label>
1345 </div>
1346 </td><?php endif; ?>
1347 <td>
1348 <div class="filename"><a href="<?php echo $filelink ?>" title="File info"><i class="<?php echo $img ?>"></i> <?php echo fm_convert_win($f) ?>
1349 </a><?php echo($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?></div>
1350 </td>
1351 <td><span title="<?php printf('%s bytes', $filesize_raw) ?>"><?php echo $filesize ?></span></td>
1352 <td><?php echo $modif ?></td>
1353 <?php if (!FM_IS_WIN): ?>
1354 <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; ?>
1355 </td>
1356 <td><?php echo fm_enc($owner['name'] . ':' . $group['name']) ?></td>
1357 <?php endif; ?>
1358 <td class="inline-actions">
1359 <?php if (!FM_READONLY): ?>
1360 <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>
1361 <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>
1362 <a title="Copy to..."
1363 href="?p=<?php echo urlencode(FM_PATH) ?>&copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o"></i></a>
1364 <?php endif; ?>
1365 <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>
1366 <a title="Download" href="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($f) ?>"><i class="fa fa-download"></i></a>
1367 </td>
1368 </tr>
1369 <?php
1370 flush();
1371 $ik++;
1372 }
1373
1374 if (empty($folders) && empty($files)) {
1375 ?>
1376 <tfoot>
1377 <tr><?php if (!FM_READONLY): ?>
1378 <td></td><?php endif; ?>
1379 <td colspan="<?php echo !FM_IS_WIN ? '6' : '4' ?>"><em><?php echo 'Folder is empty' ?></em></td>
1380 </tr>
1381 </tfoot>
1382 <?php
1383 } else {
1384 ?>
1385 <tfoot>
1386 <tr><?php if (!FM_READONLY): ?>
1387 <td class="gray"></td><?php endif; ?>
1388 <td class="gray" colspan="<?php echo !FM_IS_WIN ? '6' : '4' ?>">
1389 Full size: <span title="<?php printf('%s bytes', $all_files_size) ?>"><?php echo fm_get_filesize($all_files_size) ?></span>,
1390 files: <?php echo $num_files ?>,
1391 folders: <?php echo $num_folders ?>
1392 </td>
1393 </tr>
1394 </tfoot>
1395 <?php
1396 }
1397 ?>
1398 </table>
1399 </div>
1400 <?php if (!FM_READONLY): ?>
1401 <div class="row">
1402 <div class="col-xs-12 col-sm-9">
1403 <ul class="list-inline footer-action">
1404 <li class="list-inline-item"> <a href="#/select-all" class="btn btn-small btn-outline-primary btn-2" onclick="select_all();return false;"><i class="fa fa-check-square"></i> Select all</a></li>
1405 <li class="list-inline-item"><a href="#/unselect-all" class="btn btn-small btn-outline-primary btn-2" onclick="unselect_all();return false;"><i class="fa fa-window-close"></i> Unselect all</a></li>
1406 <li class="list-inline-item"><a href="#/invert-all" class="btn btn-small btn-outline-primary btn-2" onclick="invert_all();return false;"><i class="fa fa-th-list"></i> Invert selection</a></li>
1407 <li class="list-inline-item"><input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('Delete selected files and folders?')">
1408 <a href="javascript:document.getElementById('a-delete').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-trash"></i> Delete </a></li>
1409 <li class="list-inline-item"><input type="submit" class="hidden" name="zip" id="a-zip" value="zip" onclick="return confirm('Create archive?')">
1410 <a href="javascript:document.getElementById('a-zip').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> Zip </a></li>
1411 <li class="list-inline-item"><input type="submit" class="hidden" name="tar" id="a-tar" value="tar" onclick="return confirm('Create archive?')">
1412 <a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> Tar </a></li>
1413 <li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
1414 <a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> Copy </a></li>
1415 </ul>
1416 </div>
1417 <div class="col-3 d-none d-sm-block"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right" style="color:silver">Tiny File Manager v2.1</a></div>
1418
1419 <?php endif; ?>
1420</form>
1421
1422<?php
1423fm_show_footer();
1424
1425//--- END
1426
1427// Functions
1428
1429/**
1430 * Delete file or folder (recursively)
1431 * @param string $path
1432 * @return bool
1433 */
1434function fm_rdelete($path)
1435{
1436 if (is_link($path)) {
1437 return unlink($path);
1438 } elseif (is_dir($path)) {
1439 $objects = scandir($path);
1440 $ok = true;
1441 if (is_array($objects)) {
1442 foreach ($objects as $file) {
1443 if ($file != '.' && $file != '..') {
1444 if (!fm_rdelete($path . '/' . $file)) {
1445 $ok = false;
1446 }
1447 }
1448 }
1449 }
1450 return ($ok) ? rmdir($path) : false;
1451 } elseif (is_file($path)) {
1452 return unlink($path);
1453 }
1454 return false;
1455}
1456
1457/**
1458 * Recursive chmod
1459 * @param string $path
1460 * @param int $filemode
1461 * @param int $dirmode
1462 * @return bool
1463 * @todo Will use in mass chmod
1464 */
1465function fm_rchmod($path, $filemode, $dirmode)
1466{
1467 if (is_dir($path)) {
1468 if (!chmod($path, $dirmode)) {
1469 return false;
1470 }
1471 $objects = scandir($path);
1472 if (is_array($objects)) {
1473 foreach ($objects as $file) {
1474 if ($file != '.' && $file != '..') {
1475 if (!fm_rchmod($path . '/' . $file, $filemode, $dirmode)) {
1476 return false;
1477 }
1478 }
1479 }
1480 }
1481 return true;
1482 } elseif (is_link($path)) {
1483 return true;
1484 } elseif (is_file($path)) {
1485 return chmod($path, $filemode);
1486 }
1487 return false;
1488}
1489
1490/**
1491 * Safely rename
1492 * @param string $old
1493 * @param string $new
1494 * @return bool|null
1495 */
1496function fm_rename($old, $new)
1497{
1498 $allowed = (FM_EXTENSION) ? explode(',', FM_EXTENSION) : false;
1499
1500 $ext = pathinfo($new, PATHINFO_EXTENSION);
1501 $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
1502
1503 if(!$isFileAllowed) return false;
1504
1505 return (!file_exists($new) && file_exists($old)) ? rename($old, $new) : null;
1506}
1507
1508/**
1509 * Copy file or folder (recursively).
1510 * @param string $path
1511 * @param string $dest
1512 * @param bool $upd Update files
1513 * @param bool $force Create folder with same names instead file
1514 * @return bool
1515 */
1516function fm_rcopy($path, $dest, $upd = true, $force = true)
1517{
1518 if (is_dir($path)) {
1519 if (!fm_mkdir($dest, $force)) {
1520 return false;
1521 }
1522 $objects = scandir($path);
1523 $ok = true;
1524 if (is_array($objects)) {
1525 foreach ($objects as $file) {
1526 if ($file != '.' && $file != '..') {
1527 if (!fm_rcopy($path . '/' . $file, $dest . '/' . $file)) {
1528 $ok = false;
1529 }
1530 }
1531 }
1532 }
1533 return $ok;
1534 } elseif (is_file($path)) {
1535 return fm_copy($path, $dest, $upd);
1536 }
1537 return false;
1538}
1539
1540/**
1541 * Safely create folder
1542 * @param string $dir
1543 * @param bool $force
1544 * @return bool
1545 */
1546function fm_mkdir($dir, $force)
1547{
1548 if (file_exists($dir)) {
1549 if (is_dir($dir)) {
1550 return $dir;
1551 } elseif (!$force) {
1552 return false;
1553 }
1554 unlink($dir);
1555 }
1556 return mkdir($dir, 0777, true);
1557}
1558
1559/**
1560 * Safely copy file
1561 * @param string $f1
1562 * @param string $f2
1563 * @param bool $upd
1564 * @return bool
1565 */
1566function fm_copy($f1, $f2, $upd)
1567{
1568 $time1 = filemtime($f1);
1569 if (file_exists($f2)) {
1570 $time2 = filemtime($f2);
1571 if ($time2 >= $time1 && $upd) {
1572 return false;
1573 }
1574 }
1575 $ok = copy($f1, $f2);
1576 if ($ok) {
1577 touch($f2, $time1);
1578 }
1579 return $ok;
1580}
1581
1582/**
1583 * Get mime type
1584 * @param string $file_path
1585 * @return mixed|string
1586 */
1587function fm_get_mime_type($file_path)
1588{
1589 if (function_exists('finfo_open')) {
1590 $finfo = finfo_open(FILEINFO_MIME_TYPE);
1591 $mime = finfo_file($finfo, $file_path);
1592 finfo_close($finfo);
1593 return $mime;
1594 } elseif (function_exists('mime_content_type')) {
1595 return mime_content_type($file_path);
1596 } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {
1597 $file = escapeshellarg($file_path);
1598 $mime = shell_exec('file -bi ' . $file);
1599 return $mime;
1600 } else {
1601 return '--';
1602 }
1603}
1604
1605/**
1606 * HTTP Redirect
1607 * @param string $url
1608 * @param int $code
1609 */
1610function fm_redirect($url, $code = 302)
1611{
1612 header('Location: ' . $url, true, $code);
1613 exit;
1614}
1615
1616/**
1617 * Clean path
1618 * @param string $path
1619 * @return string
1620 */
1621function fm_clean_path($path)
1622{
1623 $path = trim($path);
1624 $path = trim($path, '\\/');
1625 $path = str_replace(array('../', '..\\'), '', $path);
1626 if ($path == '..') {
1627 $path = '';
1628 }
1629 return str_replace('\\', '/', $path);
1630}
1631
1632/**
1633 * Get parent path
1634 * @param string $path
1635 * @return bool|string
1636 */
1637function fm_get_parent_path($path)
1638{
1639 $path = fm_clean_path($path);
1640 if ($path != '') {
1641 $array = explode('/', $path);
1642 if (count($array) > 1) {
1643 $array = array_slice($array, 0, -1);
1644 return implode('/', $array);
1645 }
1646 return '';
1647 }
1648 return false;
1649}
1650
1651/**
1652 * Get nice filesize
1653 * @param int $size
1654 * @return string
1655 */
1656function fm_get_filesize($size)
1657{
1658 if ($size < 1000) {
1659 return sprintf('%s B', $size);
1660 } elseif (($size / 1024) < 1000) {
1661 return sprintf('%s KiB', round(($size / 1024), 2));
1662 } elseif (($size / 1024 / 1024) < 1000) {
1663 return sprintf('%s MiB', round(($size / 1024 / 1024), 2));
1664 } elseif (($size / 1024 / 1024 / 1024) < 1000) {
1665 return sprintf('%s GiB', round(($size / 1024 / 1024 / 1024), 2));
1666 } else {
1667 return sprintf('%s TiB', round(($size / 1024 / 1024 / 1024 / 1024), 2));
1668 }
1669}
1670
1671/**
1672 * Get info about zip archive
1673 * @param string $path
1674 * @return array|bool
1675 */
1676function fm_get_zif_info($path, $ext) {
1677 if ($ext == 'zip' && function_exists('zip_open')) {
1678 $arch = zip_open($path);
1679 if ($arch) {
1680 $filenames = array();
1681 while ($zip_entry = zip_read($arch)) {
1682 $zip_name = zip_entry_name($zip_entry);
1683 $zip_folder = substr($zip_name, -1) == '/';
1684 $filenames[] = array(
1685 'name' => $zip_name,
1686 'filesize' => zip_entry_filesize($zip_entry),
1687 'compressed_size' => zip_entry_compressedsize($zip_entry),
1688 'folder' => $zip_folder
1689 //'compression_method' => zip_entry_compressionmethod($zip_entry),
1690 );
1691 }
1692 zip_close($arch);
1693 return $filenames;
1694 }
1695 } elseif($ext == 'tar' && class_exists('PharData')) {
1696 $archive = new PharData($path);
1697 $filenames = array();
1698 foreach(new RecursiveIteratorIterator($archive) as $file) {
1699 $parent_info = $file->getPathInfo();
1700 $zip_name = str_replace("phar://".$path, '', $file->getPathName());
1701 $zip_name = substr($zip_name, ($pos = strpos($zip_name, '/')) !== false ? $pos + 1 : 0);
1702 $zip_folder = $parent_info->getFileName();
1703 $zip_info = new SplFileInfo($file);
1704 $filenames[] = array(
1705 'name' => $zip_name,
1706 'filesize' => $zip_info->getSize(),
1707 'compressed_size' => $file->getCompressedSize(),
1708 'folder' => $zip_folder
1709 );
1710 }
1711 return $filenames;
1712 }
1713 return false;
1714}
1715
1716/**
1717 * Encode html entities
1718 * @param string $text
1719 * @return string
1720 */
1721function fm_enc($text)
1722{
1723 return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
1724}
1725
1726/**
1727 * Save message in session
1728 * @param string $msg
1729 * @param string $status
1730 */
1731function fm_set_msg($msg, $status = 'ok')
1732{
1733 $_SESSION['message'] = $msg;
1734 $_SESSION['status'] = $status;
1735}
1736
1737/**
1738 * Check if string is in UTF-8
1739 * @param string $string
1740 * @return int
1741 */
1742function fm_is_utf8($string)
1743{
1744 return preg_match('//u', $string);
1745}
1746
1747/**
1748 * Convert file name to UTF-8 in Windows
1749 * @param string $filename
1750 * @return string
1751 */
1752function fm_convert_win($filename)
1753{
1754 if (FM_IS_WIN && function_exists('iconv')) {
1755 $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename);
1756 }
1757 return $filename;
1758}
1759
1760/**
1761 * Get CSS classname for file
1762 * @param string $path
1763 * @return string
1764 */
1765function fm_get_file_icon_class($path)
1766{
1767 // get extension
1768 $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
1769
1770 switch ($ext) {
1771 case 'ico':
1772 case 'gif':
1773 case 'jpg':
1774 case 'jpeg':
1775 case 'jpc':
1776 case 'jp2':
1777 case 'jpx':
1778 case 'xbm':
1779 case 'wbmp':
1780 case 'png':
1781 case 'bmp':
1782 case 'tif':
1783 case 'tiff':
1784 case 'svg':
1785 $img = 'fa fa-picture-o';
1786 break;
1787 case 'passwd':
1788 case 'ftpquota':
1789 case 'sql':
1790 case 'js':
1791 case 'json':
1792 case 'sh':
1793 case 'config':
1794 case 'twig':
1795 case 'tpl':
1796 case 'md':
1797 case 'gitignore':
1798 case 'c':
1799 case 'cpp':
1800 case 'cs':
1801 case 'py':
1802 case 'map':
1803 case 'lock':
1804 case 'dtd':
1805 $img = 'fa fa-file-code-o';
1806 break;
1807 case 'txt':
1808 case 'ini':
1809 case 'conf':
1810 case 'log':
1811 case 'htaccess':
1812 $img = 'fa fa-file-text-o';
1813 break;
1814 case 'css':
1815 case 'less':
1816 case 'sass':
1817 case 'scss':
1818 $img = 'fa fa-css3';
1819 break;
1820 case 'zip':
1821 case 'rar':
1822 case 'gz':
1823 case 'tar':
1824 case '7z':
1825 $img = 'fa fa-file-archive-o';
1826 break;
1827 case 'php':
1828 case 'php4':
1829 case 'php5':
1830 case 'phps':
1831 case 'phtml':
1832 $img = 'fa fa-code';
1833 break;
1834 case 'htm':
1835 case 'html':
1836 case 'shtml':
1837 case 'xhtml':
1838 $img = 'fa fa-html5';
1839 break;
1840 case 'xml':
1841 case 'xsl':
1842 $img = 'fa fa-file-excel-o';
1843 break;
1844 case 'wav':
1845 case 'mp3':
1846 case 'mp2':
1847 case 'm4a':
1848 case 'aac':
1849 case 'ogg':
1850 case 'oga':
1851 case 'wma':
1852 case 'mka':
1853 case 'flac':
1854 case 'ac3':
1855 case 'tds':
1856 $img = 'fa fa-music';
1857 break;
1858 case 'm3u':
1859 case 'm3u8':
1860 case 'pls':
1861 case 'cue':
1862 $img = 'fa fa-headphones';
1863 break;
1864 case 'avi':
1865 case 'mpg':
1866 case 'mpeg':
1867 case 'mp4':
1868 case 'm4v':
1869 case 'flv':
1870 case 'f4v':
1871 case 'ogm':
1872 case 'ogv':
1873 case 'mov':
1874 case 'mkv':
1875 case '3gp':
1876 case 'asf':
1877 case 'wmv':
1878 $img = 'fa fa-file-video-o';
1879 break;
1880 case 'eml':
1881 case 'msg':
1882 $img = 'fa fa-envelope-o';
1883 break;
1884 case 'xls':
1885 case 'xlsx':
1886 $img = 'fa fa-file-excel-o';
1887 break;
1888 case 'csv':
1889 $img = 'fa fa-file-text-o';
1890 break;
1891 case 'bak':
1892 $img = 'fa fa-clipboard';
1893 break;
1894 case 'doc':
1895 case 'docx':
1896 $img = 'fa fa-file-word-o';
1897 break;
1898 case 'ppt':
1899 case 'pptx':
1900 $img = 'fa fa-file-powerpoint-o';
1901 break;
1902 case 'ttf':
1903 case 'ttc':
1904 case 'otf':
1905 case 'woff':
1906 case 'woff2':
1907 case 'eot':
1908 case 'fon':
1909 $img = 'fa fa-font';
1910 break;
1911 case 'pdf':
1912 $img = 'fa fa-file-pdf-o';
1913 break;
1914 case 'psd':
1915 case 'ai':
1916 case 'eps':
1917 case 'fla':
1918 case 'swf':
1919 $img = 'fa fa-file-image-o';
1920 break;
1921 case 'exe':
1922 case 'msi':
1923 $img = 'fa fa-file-o';
1924 break;
1925 case 'bat':
1926 $img = 'fa fa-terminal';
1927 break;
1928 default:
1929 $img = 'fa fa-info-circle';
1930 }
1931
1932 return $img;
1933}
1934
1935/**
1936 * Get image files extensions
1937 * @return array
1938 */
1939function fm_get_image_exts()
1940{
1941 return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd');
1942}
1943
1944/**
1945 * Get video files extensions
1946 * @return array
1947 */
1948function fm_get_video_exts()
1949{
1950 return array('webm', 'mp4', 'm4v', 'ogm', 'ogv', 'mov');
1951}
1952
1953/**
1954 * Get audio files extensions
1955 * @return array
1956 */
1957function fm_get_audio_exts()
1958{
1959 return array('wav', 'mp3', 'ogg', 'm4a');
1960}
1961
1962/**
1963 * Get text file extensions
1964 * @return array
1965 */
1966function fm_get_text_exts()
1967{
1968 return array(
1969 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',
1970 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',
1971 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',
1972 'map', 'lock', 'dtd', 'svg',
1973 );
1974}
1975
1976/**
1977 * Get mime types of text files
1978 * @return array
1979 */
1980function fm_get_text_mimes()
1981{
1982 return array(
1983 'application/xml',
1984 'application/javascript',
1985 'application/x-javascript',
1986 'image/svg+xml',
1987 'message/rfc822',
1988 );
1989}
1990
1991/**
1992 * Get file names of text files w/o extensions
1993 * @return array
1994 */
1995function fm_get_text_names()
1996{
1997 return array(
1998 'license',
1999 'readme',
2000 'authors',
2001 'contributors',
2002 'changelog',
2003 );
2004}
2005
2006/**
2007 * Get online docs viewer supported files extensions
2008 * @return array
2009 */
2010function fm_get_onlineViewer_exts()
2011{
2012 return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar');
2013}
2014
2015/**
2016 * Class to work with zip files (using ZipArchive)
2017 */
2018class FM_Zipper
2019{
2020 private $zip;
2021
2022 public function __construct()
2023 {
2024 $this->zip = new ZipArchive();
2025 }
2026
2027 /**
2028 * Create archive with name $filename and files $files (RELATIVE PATHS!)
2029 * @param string $filename
2030 * @param array|string $files
2031 * @return bool
2032 */
2033 public function create($filename, $files)
2034 {
2035 $res = $this->zip->open($filename, ZipArchive::CREATE);
2036 if ($res !== true) {
2037 return false;
2038 }
2039 if (is_array($files)) {
2040 foreach ($files as $f) {
2041 if (!$this->addFileOrDir($f)) {
2042 $this->zip->close();
2043 return false;
2044 }
2045 }
2046 $this->zip->close();
2047 return true;
2048 } else {
2049 if ($this->addFileOrDir($files)) {
2050 $this->zip->close();
2051 return true;
2052 }
2053 return false;
2054 }
2055 }
2056
2057 /**
2058 * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
2059 * @param string $filename
2060 * @param string $path
2061 * @return bool
2062 */
2063 public function unzip($filename, $path)
2064 {
2065 $res = $this->zip->open($filename);
2066 if ($res !== true) {
2067 return false;
2068 }
2069 if ($this->zip->extractTo($path)) {
2070 $this->zip->close();
2071 return true;
2072 }
2073 return false;
2074 }
2075
2076 /**
2077 * Add file/folder to archive
2078 * @param string $filename
2079 * @return bool
2080 */
2081 private function addFileOrDir($filename)
2082 {
2083 if (is_file($filename)) {
2084 return $this->zip->addFile($filename);
2085 } elseif (is_dir($filename)) {
2086 return $this->addDir($filename);
2087 }
2088 return false;
2089 }
2090
2091 /**
2092 * Add folder recursively
2093 * @param string $path
2094 * @return bool
2095 */
2096 private function addDir($path)
2097 {
2098 if (!$this->zip->addEmptyDir($path)) {
2099 return false;
2100 }
2101 $objects = scandir($path);
2102 if (is_array($objects)) {
2103 foreach ($objects as $file) {
2104 if ($file != '.' && $file != '..') {
2105 if (is_dir($path . '/' . $file)) {
2106 if (!$this->addDir($path . '/' . $file)) {
2107 return false;
2108 }
2109 } elseif (is_file($path . '/' . $file)) {
2110 if (!$this->zip->addFile($path . '/' . $file)) {
2111 return false;
2112 }
2113 }
2114 }
2115 }
2116 return true;
2117 }
2118 return false;
2119 }
2120}
2121
2122/**
2123 * Class to work with Tar files (using PharData)
2124 */
2125class FM_Zipper_Tar
2126{
2127 private $tar;
2128
2129 public function __construct()
2130 {
2131 $this->tar = null;
2132 }
2133
2134 /**
2135 * Create archive with name $filename and files $files (RELATIVE PATHS!)
2136 * @param string $filename
2137 * @param array|string $files
2138 * @return bool
2139 */
2140 public function create($filename, $files)
2141 {
2142 $this->tar = new PharData($filename);
2143 if (is_array($files)) {
2144 foreach ($files as $f) {
2145 if (!$this->addFileOrDir($f)) {
2146 return false;
2147 }
2148 }
2149 return true;
2150 } else {
2151 if ($this->addFileOrDir($files)) {
2152 return true;
2153 }
2154 return false;
2155 }
2156 }
2157
2158 /**
2159 * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
2160 * @param string $filename
2161 * @param string $path
2162 * @return bool
2163 */
2164 public function unzip($filename, $path)
2165 {
2166 $res = $this->tar->open($filename);
2167 if ($res !== true) {
2168 return false;
2169 }
2170 if ($this->tar->extractTo($path)) {
2171 return true;
2172 }
2173 return false;
2174 }
2175
2176 /**
2177 * Add file/folder to archive
2178 * @param string $filename
2179 * @return bool
2180 */
2181 private function addFileOrDir($filename)
2182 {
2183 if (is_file($filename)) {
2184 return $this->tar->addFile($filename);
2185 } elseif (is_dir($filename)) {
2186 return $this->addDir($filename);
2187 }
2188 return false;
2189 }
2190
2191 /**
2192 * Add folder recursively
2193 * @param string $path
2194 * @return bool
2195 */
2196 private function addDir($path)
2197 {
2198 $objects = scandir($path);
2199 if (is_array($objects)) {
2200 foreach ($objects as $file) {
2201 if ($file != '.' && $file != '..') {
2202 if (is_dir($path . '/' . $file)) {
2203 if (!$this->addDir($path . '/' . $file)) {
2204 return false;
2205 }
2206 } elseif (is_file($path . '/' . $file)) {
2207 try {
2208 $this->tar->addFile($path . '/' . $file);
2209 } catch (Exception $e) {
2210 return false;
2211 }
2212 }
2213 }
2214 }
2215 return true;
2216 }
2217 return false;
2218 }
2219}
2220
2221//--- templates functions
2222
2223/**
2224 * Show nav block
2225 * @param string $path
2226 */
2227function fm_show_nav_path($path)
2228{
2229 global $lang;
2230 ?>
2231 <nav class="navbar navbar-expand-md fixed-top navbar-light bg-white mb-4 main-nav">
2232 <a class="navbar-brand" href=""> File Manager </a>
2233 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
2234 <span class="navbar-toggler-icon"></span>
2235 </button>
2236 <div class="collapse navbar-collapse" id="navbarSupportedContent">
2237
2238 <?php
2239 $path = fm_clean_path($path);
2240 $root_url = "<a href='?p='><i class='fa fa-home' aria-hidden='true' title='" . FM_ROOT_PATH . "'></i></a>";
2241 $sep = '<i class="fa fa-caret-right"></i>';
2242 if ($path != '') {
2243 $exploded = explode('/', $path);
2244 $count = count($exploded);
2245 $array = array();
2246 $parent = '';
2247 for ($i = 0; $i < $count; $i++) {
2248 $parent = trim($parent . '/' . $exploded[$i], '/');
2249 $parent_enc = urlencode($parent);
2250 $array[] = "<a href='?p={$parent_enc}'>" . fm_enc(fm_convert_win($exploded[$i])) . "</a>";
2251 }
2252 $root_url .= $sep . implode($sep, $array);
2253 }
2254 echo '<div class="col-xs-6 col-sm-6">' . $root_url . '</div>';
2255 ?>
2256
2257 <div class="col-xs-12 col-sm-6 text-right">
2258 <ul class="navbar-nav mr-auto float-right">
2259 <?php if (!FM_READONLY): ?>
2260 <li class="nav-item mr-2">
2261 <div class="input-group input-group-sm mr-1">
2262 <input type="text" class="form-control" placeholder="Search" aria-label="Search" aria-describedby="search-addon2" id="search-addon">
2263 <div class="input-group-append">
2264 <span class="input-group-text" id="search-addon2"><i class="fa fa-search"></i></span>
2265 </div>
2266 </div>
2267 </li>
2268 <li class="nav-item">
2269 <a title="Upload files" class="nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&upload"><i class="fa fa-cloud-upload" aria-hidden="true"></i> Upload</a>
2270 </li>
2271 <li class="nav-item">
2272 <a title="New folder" class="nav-link" href="#createNewItem" data-toggle="modal" data-target="#createNewItem"><i class="fa fa-plus-square"></i> New Item</a>
2273 </li>
2274 <?php endif; ?>
2275 <?php if (FM_USE_AUTH): ?>
2276 <li class="nav-item avatar dropdown">
2277 <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-5" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-user-circle"></i> <?php echo $_SESSION['logged'] ?></a>
2278 <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink-5">
2279 <a title="Logout" class="dropdown-item nav-link" href="?logout=1"><i class="fa fa-sign-out" aria-hidden="true"></i> Sign out</a>
2280 </div>
2281 </li>
2282 <?php endif; ?>
2283 </ul>
2284 </div>
2285 </div>
2286 </nav>
2287 <?php
2288}
2289
2290/**
2291 * Show message from session
2292 */
2293function fm_show_message()
2294{
2295 if (isset($_SESSION['message'])) {
2296 $class = isset($_SESSION['status']) ? $_SESSION['status'] : 'ok';
2297 echo '<p class="message ' . $class . '">' . $_SESSION['message'] . '</p>';
2298 unset($_SESSION['message']);
2299 unset($_SESSION['status']);
2300 }
2301}
2302
2303/**
2304 * Show page header in Login Form
2305 */
2306function fm_show_header_login()
2307{
2308$sprites_ver = '20160315';
2309header("Content-Type: text/html; charset=utf-8");
2310header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
2311header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
2312header("Pragma: no-cache");
2313
2314global $lang;
2315?>
2316 <!DOCTYPE html>
2317<html lang="en">
2318<head>
2319 <meta charset="utf-8">
2320 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
2321 <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
2322 <meta name="author" content="CCP Programmers">
2323 <meta name="robots" content="noindex, nofollow">
2324 <meta name="googlebot" content="noindex">
2325 <title>H3K | Tiny File Manager</title>
2326 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
2327 <style>
2328 body.fm-login-page {
2329 background-color: #f7f9fb;
2330 font-size: 14px;
2331 }
2332 .fm-login-page .brand {
2333 width: 121px;
2334 overflow: hidden;
2335 margin: 0 auto;
2336 margin: 40px auto;
2337 margin-bottom: 25px;
2338 position: relative;
2339 z-index: 1;
2340 }
2341 .fm-login-page .brand img {
2342 width: 100%;
2343 }
2344 .fm-login-page .card-wrapper {
2345 width: 360px;
2346 }
2347 .fm-login-page .card {
2348 border-color: transparent;
2349 box-shadow: 0 4px 8px rgba(0,0,0,.05);
2350 }
2351 .fm-login-page .card-title {
2352 margin-bottom: 1.5rem;
2353 font-size: 24px;
2354 font-weight: 300;
2355 letter-spacing: -.5px;
2356 }
2357 .fm-login-page .form-control {
2358 border-width: 2.3px;
2359 }
2360 .fm-login-page .form-group label {
2361 width: 100%;
2362 }
2363 .fm-login-page .btn.btn-block {
2364 padding: 12px 10px;
2365 }
2366 .fm-login-page .footer {
2367 margin: 40px 0;
2368 color: #888;
2369 text-align: center;
2370 }
2371 @media screen and (max-width: 425px) {
2372 .fm-login-page .card-wrapper {
2373 width: 90%;
2374 margin: 0 auto;
2375 }
2376 }
2377 @media screen and (max-width: 320px) {
2378 .fm-login-page .card.fat {
2379 padding: 0;
2380 }
2381 .fm-login-page .card.fat .card-body {
2382 padding: 15px;
2383 }
2384 }
2385 .message {
2386 padding: 4px 7px;
2387 border: 1px solid #ddd;
2388 background-color: #fff
2389 }
2390 .message.ok {
2391 border-color: green;
2392 color: green
2393 }
2394 .message.error {
2395 border-color: red;
2396 color: red
2397 }
2398 .message.alert {
2399 border-color: orange;
2400 color: orange
2401 }
2402 </style>
2403</head>
2404<body class="fm-login-page">
2405<div id="wrapper" class="container-fluid">
2406
2407 <?php
2408 }
2409
2410 /**
2411 * Show page footer in Login Form
2412 */
2413 function fm_show_footer_login()
2414 {
2415 ?>
2416</div>
2417<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
2418<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
2419</body>
2420</html>
2421<?php
2422}
2423
2424/**
2425 * Show Header after login
2426 */
2427function fm_show_header()
2428{
2429$sprites_ver = '20160315';
2430header("Content-Type: text/html; charset=utf-8");
2431header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
2432header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
2433header("Pragma: no-cache");
2434
2435global $lang;
2436?>
2437 <!DOCTYPE html>
2438<html>
2439<head>
2440 <meta charset="utf-8">
2441 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
2442 <meta name="description" content="Web based File Manager in PHP, Manage your files efficiently and easily with Tiny File Manager">
2443 <meta name="author" content="CCP Programmers">
2444 <meta name="robots" content="noindex, nofollow">
2445 <meta name="googlebot" content="noindex">
2446 <title>H3K | Tiny File Manager</title>
2447 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
2448 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
2449 <?php if (isset($_GET['view']) && FM_USE_HIGHLIGHTJS): ?>
2450 <link rel="stylesheet"
2451 href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>.min.css">
2452 <?php endif; ?>
2453 <style>
2454 body {
2455 margin-top: 55px;
2456 font: 13px/16px Tahoma, Arial, sans-serif;
2457 color: #222;
2458 background: #F7F7F7;
2459 }
2460 .filename, td, th {
2461 white-space: nowrap
2462 }
2463 .navbar-brand {
2464 font-weight: bold;
2465 }
2466 .nav-item.avatar a {
2467 cursor: pointer;
2468 text-transform: capitalize;
2469 }
2470 .nav-item.avatar a > i {
2471 font-size: 15px;
2472 vertical-align: bottom;
2473 }
2474 .nav-item.avatar .dropdown-menu a {
2475 font-size: 13px;
2476 }
2477 #search-addon2 {
2478 background: transparent;
2479 border-left: 0;
2480 }
2481 #main-table a {
2482 text-decoration: none;
2483 }
2484 .table td, .table th {
2485 vertical-align: middle !important;
2486 }
2487 .hidden {
2488 display: none
2489 }
2490 pre.with-hljs {
2491 padding: 0
2492 }
2493 pre.with-hljs code {
2494 margin: 0;
2495 border: 0;
2496 overflow: visible
2497 }
2498 code.maxheight, pre.maxheight {
2499 max-height: 512px
2500 }
2501 .fa.fa-caret-right {
2502 font-size: 1.2em;
2503 margin: 0 4px;
2504 vertical-align: middle;
2505 color: #ececec
2506 }
2507 .fa.fa-home {
2508 font-size: 1.2em;
2509 vertical-align: bottom
2510 }
2511 .path {
2512 margin-bottom: 10px
2513 }
2514 form.dropzone {
2515 min-height: 200px;
2516 border: 2px dashed #007bff;
2517 line-height: 6rem;
2518 }
2519 .right {
2520 text-align: right
2521 }
2522 .center, .close, .login-form {
2523 text-align: center
2524 }
2525 .message {
2526 padding: 4px 7px;
2527 border: 1px solid #ddd;
2528 background-color: #fff
2529 }
2530 .message.ok {
2531 border-color: green;
2532 color: green
2533 }
2534 .message.error {
2535 border-color: red;
2536 color: red
2537 }
2538 .message.alert {
2539 border-color: orange;
2540 color: orange
2541 }
2542 .preview-img {
2543 max-width: 100%;
2544 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC)
2545 }
2546 .inline-actions > a > i {
2547 font-size: 1em;
2548 margin-left: 5px;
2549 background: #3785c1;
2550 color: #fff;
2551 padding: 3px;
2552 border-radius: 3px
2553 }
2554 .preview-video {
2555 position: relative;
2556 max-width: 100%;
2557 height: 0;
2558 padding-bottom: 62.5%;
2559 margin-bottom: 10px
2560 }
2561 .preview-video video {
2562 position: absolute;
2563 width: 100%;
2564 height: 100%;
2565 left: 0;
2566 top: 0;
2567 background: #000
2568 }
2569 .compact-table {
2570 border: 0;
2571 width: auto
2572 }
2573 .compact-table td, .compact-table th {
2574 width: 100px;
2575 border: 0;
2576 text-align: center
2577 }
2578 .compact-table tr:hover td {
2579 background-color: #fff
2580 }
2581 .filename {
2582 max-width: 420px;
2583 overflow: hidden;
2584 text-overflow: ellipsis
2585 }
2586 .break-word {
2587 word-wrap: break-word;
2588 margin-left: 30px
2589 }
2590 .break-word.float-left a {
2591 color: #7d7d7d
2592 }
2593 .break-word + .float-right {
2594 padding-right: 30px;
2595 position: relative
2596 }
2597 .break-word + .float-right > a {
2598 color: #7d7d7d;
2599 font-size: 1.2em;
2600 margin-right: 4px
2601 }
2602 #editor, .edit-file-actions {
2603 position: absolute;
2604 right: 30px
2605 }
2606 #editor {
2607 top: 60px;
2608 bottom: 5px;
2609 left: 30px
2610 }
2611 .edit-file-actions {
2612 top: 0;
2613 background: #fff;
2614 padding: 10px;
2615 z-index: 9999;
2616 }
2617 .edit-file-actions > a, .edit-file-actions > button {
2618 background: #fff;
2619 padding: 5px 15px;
2620 cursor: pointer;
2621 color: #296ea3;
2622 border: 1px solid #296ea3
2623 }
2624 #normal-editor {
2625 border-radius: 3px;
2626 border-width: 2px;
2627 padding: 10px;
2628 outline: none;
2629 }
2630 .btn-2 {
2631 border-radius: 0;
2632 padding: 3px 6px;
2633 font-size: small;
2634 }
2635 li.file:before, li.folder:before {
2636 font: normal normal normal 14px/1 FontAwesome;
2637 content: "\f016";
2638 margin-right: 5px
2639 }
2640 li.folder:before {
2641 content: "\f114"
2642 }
2643 i.fa.fa-folder-o {
2644 color: #eeaf4b
2645 }
2646 i.fa.fa-picture-o {
2647 color: #26b99a
2648 }
2649 i.fa.fa-file-archive-o {
2650 color: #da7d7d
2651 }
2652 .btn-2 i.fa.fa-file-archive-o {
2653 color: inherit;
2654 }
2655 i.fa.fa-css3 {
2656 color: #f36fa0
2657 }
2658 i.fa.fa-file-code-o {
2659 color: #ec6630
2660 }
2661 i.fa.fa-code {
2662 color: #cc4b4c
2663 }
2664 i.fa.fa-file-text-o {
2665 color: #0096e6
2666 }
2667 i.fa.fa-html5 {
2668 color: #d75e72
2669 }
2670 i.fa.fa-file-excel-o {
2671 color: #09c55d
2672 }
2673 i.fa.fa-file-powerpoint-o {
2674 color: #f6712e
2675 }
2676 .main-nav {
2677 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)
2678 }
2679 .dataTables_filter {
2680 display: none;
2681 }
2682 table.dataTable thead .sorting {
2683 cursor: pointer;
2684 background-repeat: no-repeat;
2685 background-position: center right;
2686 background-image: url(https://cdn.datatables.net/1.10.19/images/sort_both.png);
2687 }
2688 table.dataTable thead .sorting_asc {
2689 cursor: pointer;
2690 background-repeat: no-repeat;
2691 background-position: center right;
2692 background-image: url(https://cdn.datatables.net/1.10.19/images/sort_asc.png);
2693 }
2694 table.dataTable thead .sorting_desc {
2695 cursor: pointer;
2696 background-repeat: no-repeat;
2697 background-position: center right;
2698 background-image: url(https://cdn.datatables.net/1.10.19/images/sort_desc.png);
2699 }
2700 table.dataTable thead tr:first-child th:first-child{
2701 background-image: none;
2702 }
2703 .footer-action li {
2704 margin-bottom: 10px;
2705 }
2706 </style>
2707</head>
2708<body>
2709<div id="wrapper" class="container-fluid">
2710
2711 <!-- New Item creation -->
2712 <div class="modal fade" id="createNewItem" tabindex="-1" role="dialog" aria-label="newItemModalLabel" aria-hidden="true">
2713 <div class="modal-dialog" role="document">
2714 <div class="modal-content">
2715 <div class="modal-header">
2716 <h5 class="modal-title" id="newItemModalLabel"><i class="fa fa-plus-square fa-fw"></i>Create New Item</h5>
2717 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
2718 <span aria-hidden="true">×</span>
2719 </button>
2720 </div>
2721 <div class="modal-body">
2722 <p><label for="newfile">Item Type </label></p>
2723
2724 <div class="custom-control custom-radio custom-control-inline">
2725 <input type="radio" id="customRadioInline1" name="newfile" value="file" class="custom-control-input">
2726 <label class="custom-control-label" for="customRadioInline1">File</label>
2727 </div>
2728
2729 <div class="custom-control custom-radio custom-control-inline">
2730 <input type="radio" id="customRadioInline2" name="newfile" value="folder" class="custom-control-input" checked="">
2731 <label class="custom-control-label" for="customRadioInline2">Folder</label>
2732 </div>
2733
2734 <p class="mt-3"><label for="newfilename">Item Name </label></p>
2735 <input type="text" name="newfilename" id="newfilename" value="" class="form-control">
2736 </div>
2737 <div class="modal-footer">
2738 <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
2739 <button type="button" class="btn btn-success" onclick="newfolder('<?php echo fm_enc(FM_PATH) ?>');return false;">Create Now</button>
2740 </div>
2741 </div>
2742 </div>
2743 </div>
2744
2745 <?php
2746 }
2747
2748 /**
2749 * Show page footer
2750 */
2751 function fm_show_footer()
2752 {
2753 ?>
2754</div>
2755<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
2756<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
2757<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
2758<script>
2759 /**
2760 * Create new Folder/file
2761 * @param path {String}
2762 */
2763 function newfolder(e) {
2764 var t = document.getElementById("newfilename").value,
2765 n = document.querySelector('input[name="newfile"]:checked').value;
2766 null !== t && "" !== t && n && (window.location.hash = "#", window.location.search = "p=" + encodeURIComponent(e) + "&new=" + encodeURIComponent(t) + "&type=" + encodeURIComponent(n))
2767 }
2768
2769 function rename(e, t) {
2770 var n = prompt("New name", t);
2771 null !== n && "" !== n && n != t && (window.location.search = "p=" + encodeURIComponent(e) + "&ren=" + encodeURIComponent(t) + "&to=" + encodeURIComponent(n))
2772 }
2773
2774 function change_checkboxes(e, t) {
2775 for (var n = e.length - 1; n >= 0; n--) e[n].checked = "boolean" == typeof t ? t : !e[n].checked
2776 }
2777
2778 function get_checkboxes() {
2779 for (var e = document.getElementsByName("file[]"), t = [], n = e.length - 1; n >= 0; n--) (e[n].type = "checkbox") && t.push(e[n]); return t
2780 }
2781
2782 function select_all() {
2783 change_checkboxes(get_checkboxes(), !0)
2784 }
2785
2786 function unselect_all() {
2787 change_checkboxes(get_checkboxes(), !1)
2788 }
2789
2790 function invert_all() {
2791 change_checkboxes(get_checkboxes())
2792 }
2793
2794 function checkbox_toggle() {
2795 var e = get_checkboxes();
2796 e.push(this), change_checkboxes(e)
2797 }
2798
2799 /**
2800 * Create file backup with .bck
2801 */
2802 function backup(e, t) {
2803 var n = new XMLHttpRequest,
2804 a = "path=" + e + "&file=" + t + "&type=backup&ajax=true";
2805 return n.open("POST", "", !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), n.onreadystatechange = function () {
2806 4 == n.readyState && 200 == n.status && alert(n.responseText)
2807 }, n.send(a), !1
2808 }
2809
2810 //Save file
2811 function edit_save(e, t) {
2812 var n = "ace" == t ? editor.getSession().getValue() : document.getElementById("normal-editor").value;
2813 if (n) {
2814 var a = document.createElement("form");
2815 a.setAttribute("method", "POST"), a.setAttribute("action", "");
2816 var o = document.createElement("textarea");
2817 o.setAttribute("type", "textarea"), o.setAttribute("name", "savedata");
2818 var c = document.createTextNode(n);
2819 o.appendChild(c), a.appendChild(o), document.body.appendChild(a), a.submit()
2820 }
2821 }
2822
2823 /**
2824 * jQuery Document Ready Event
2825 */
2826 $(document).ready( function () {
2827 //dataTable init
2828 var $table = $('#main-table'),
2829 tableLng = $table.find('th').length,
2830 _targets = (tableLng && tableLng == 7 ) ? [0, 4,5,6] : [0,4],
2831 mainTable = $('#main-table').DataTable({
2832 "paging": false,
2833 "info": false,
2834 "columnDefs": [
2835 {
2836 "targets": _targets,
2837 "orderable": false
2838 }
2839 ]
2840 });
2841
2842 /**
2843 * Search using custom input box
2844 */
2845 $('#search-addon').on( 'keyup', function () {
2846 mainTable.search( this.value ).draw();
2847 });
2848 });
2849</script>
2850<?php if (isset($_GET['view']) && FM_USE_HIGHLIGHTJS): ?>
2851 <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
2852 <script>hljs.initHighlightingOnLoad();</script>
2853<?php endif; ?>
2854<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE): ?>
2855 <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ace.js"></script>
2856 <script>var editor = ace.edit("editor"); editor.getSession().setMode("ace/mode/javascript");</script>
2857<?php endif; ?>
2858</body>
2859</html>
2860<?php
2861}
2862
2863/**
2864 * Show image
2865 * @param string $img
2866 */
2867function fm_show_image($img)
2868{
2869 $modified_time = gmdate('D, d M Y 00:00:00') . ' GMT';
2870 $expires_time = gmdate('D, d M Y 00:00:00', strtotime('+1 day')) . ' GMT';
2871
2872 $img = trim($img);
2873 $images = fm_get_images();
2874 $image = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42mL4//8/A0CAAQAI/AL+26JNFgAAAABJRU5ErkJggg==';
2875 if (isset($images[$img])) {
2876 $image = $images[$img];
2877 }
2878 $image = base64_decode($image);
2879 if (function_exists('mb_strlen')) {
2880 $size = mb_strlen($image, '8bit');
2881 } else {
2882 $size = strlen($image);
2883 }
2884
2885 if (function_exists('header_remove')) {
2886 header_remove('Cache-Control');
2887 header_remove('Pragma');
2888 } else {
2889 header('Cache-Control:');
2890 header('Pragma:');
2891 }
2892
2893 header('Last-Modified: ' . $modified_time, true, 200);
2894 header('Expires: ' . $expires_time);
2895 header('Content-Length: ' . $size);
2896 header('Content-Type: image/png');
2897 echo $image;
2898
2899 exit;
2900}
2901
2902/**
2903 * Get base64-encoded images
2904 * @return array
2905 */
2906function fm_get_images()
2907{
2908 return array(
2909 'favicon' => 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ
2910bWFnZVJlYWR5ccllPAAAAZVJREFUeNqkk79Lw0AUx1+uidTQim4Waxfpnl1BcHMR6uLkIF0cpYOI
2911f4KbOFcRwbGTc0HQSVQQXCqlFIXgFkhIyvWS870LaaPYH9CDy8vdfb+fey930aSUMEvT6VHVzw8x
2912rKUX3N3Hj/8M+cZ6GcOtBPl6KY5iAA7KJzfVWrfbhUKhALZtQ6myDf1+X5nsuzjLUmUOnpa+v5r1
2913Z4ZDDfsLiwER45xDEATgOI6KntfDd091GidzC8vZ4vH1QQ09+4MSMAMWRREKPMhmsyr6voYmrnb2
2914PKEizdEabUaeFCDKCCHAdV0wTVNFznMgpVqGlZ2cipzHGtKSZwCIZJgJwxB38KHT6Sjx21V75Jcn
2915LXmGAKTRpGVZUx2dAqQzSEqw9kqwuGqONTufPrw37D8lQFxCvjgPXIixANLEGfwuQacMOC4kZz+q
2916GdhJS550BjpRCdCbAJCMJRkMASEIg+4Bxz4JwAwDSEueAYDLIM+QrOk6GHiRxjXSkJY8KUCvdXZ6
2917kbuvNx+mOcbN9taGBlpLAWf9nX8EGADoCfqkKWV/cgAAAABJRU5ErkJggg==',
2918 'sprites' => 'iVBORw0KGgoAAAANSUhEUgAAAYAAAAAgCAMAAAAscl/XAAAC/VBMVEUAAABUfn4KKipIcXFSeXsx
2919VlZSUlNAZ2c4Xl4lSUkRDg7w8O/d3d3LhwAWFhYXODgMLCx8fHw9PT2TtdOOAACMXgE8lt+dmpq+
2920fgABS3RUpN+VUycuh9IgeMJUe4C5dUI6meKkAQEKCgoMWp5qtusJmxSUPgKudAAXCghQMieMAgIU
2921abNSUlJLe70VAQEsh85oaGjBEhIBOGxfAoyUbUQAkw8gui4LBgbOiFPHx8cZX6PMS1OqFha/MjIK
2922VKFGBABSAXovGAkrg86xAgIoS5Y7c6Nf7W1Hz1NmAQB3Hgx8fHyiTAAwp+eTz/JdDAJ0JwAAlxCQ
2923UAAvmeRiYp6ysrmIAABJr/ErmiKmcsATpRyfEBAOdQgOXahyAAAecr1JCwHMiABgfK92doQGBgZG
2924AGkqKiw0ldYuTHCYsF86gB05UlJmQSlra2tVWED////8/f3t9fX5/Pzi8/Px9vb2+/v0+fnn8vLf
29257OzZ6enV5+eTpKTo6Oj6/v765Z/U5eX4+Pjx+Pjv0ojWBASxw8O8vL52dnfR19CvAADR3PHr6+vi
29264uPDx8v/866nZDO7iNT335jtzIL+7aj86aTIztXDw8X13JOlpKJoaHDJAACltratrq3lAgKfAADb
29274vb76N2au9by2I9gYGVIRkhNTE90wfXq2sh8gL8QMZ3pyn27AADr+uu1traNiIh2olTTshifodQ4
2928ZM663PH97+YeRq2GqmRjmkGjnEDnfjLVVg6W4f7s6/p/0fr98+5UVF6wz+SjxNsmVb5RUVWMrc7d
2929zrrIpWI8PD3pkwhCltZFYbNZja82wPv05NPRdXzhvna4uFdIiibPegGQXankxyxe0P7PnOhTkDGA
2930gBrbhgR9fX9bW1u8nRFamcgvVrACJIvlXV06nvtdgON4mdn3og7AagBTufkucO7snJz4b28XEhIT
2931sflynsLEvIk55kr866aewo2YuYDrnFffOTk6Li6hgAn3y8XkusCHZQbt0NP571lqRDZyMw96lZXE
2932s6qcrMmJaTmVdRW2AAAAbnRSTlMAZodsJHZocHN7hP77gnaCZWdx/ki+RfqOd/7+zc9N/szMZlf8
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
3002RK5CYII=',
3003 );
3004}
3005
3006?>