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