daily pastebin goal
59%
SHARE
TWEET

Untitled

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