From 07151e1643934de1b19c910f3b3a287ee39a610c Mon Sep 17 00:00:00 2001 From: Prasath Mani Date: Fri, 2 Nov 2018 17:48:54 +0530 Subject: [PATCH] Added Google Docs Viewer --- README.md | 4 ++++ tinyfilemanager.php | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8968d1d..1cb6fbc 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ It is a simple, fast and small file manager with single php file. It is also a w ## Demo tinyfilemanager.herokuapp.com + Login Details : admin/admin | user/12345 + + ## Documents tinyfilemanager.github.io
@@ -50,6 +53,7 @@ To enable/disable authentication set $use_auth to true or false.
  • :sunglasses: Support user permissions - based on session and each user root folder mapping
  • :floppy_disk: Copy direct file URL
  • :pencil2: Edit text formats file using advanced editor
  • +
  • :page_facing_up: Google Drive viewer helps you preview PDF/DOC/XLS/PPT/etc. 25 MB can be previewed with the Google Drive viewer
  • :zap: Backup files
  • :mag_right: Search - Advanced Ajax based seach
  • :file_folder: Exclude folders from listing
  • diff --git a/tinyfilemanager.php b/tinyfilemanager.php index f0110fa..272dddb 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -64,6 +64,9 @@ $upload_extensions = ''; // 'gif,png,jpg' //Array of files and folders excluded from listing $GLOBALS['exclude_items'] = array(); +//Google Docs Viewer +$GLOBALS['online_viewer'] = true; + // include user config php file if (defined('FM_CONFIG') && is_file(FM_CONFIG)) { include(FM_CONFIG); @@ -845,12 +848,16 @@ if (isset($_GET['view'])) { $is_audio = false; $is_video = false; $is_text = false; + $is_onlineViewer = false; $view_title = 'File'; $filenames = false; // for zip $content = ''; // for text - if ($ext == 'zip') { + if($GLOBALS['online_viewer'] && in_array($ext, fm_get_onlineViewer_exts())){ + $is_onlineViewer = true; + } + elseif ($ext == 'zip') { $is_zip = true; $view_title = 'Archive'; $filenames = fm_get_zif_info($file_path); @@ -941,7 +948,10 @@ if (isset($_GET['view'])) { Back

    '; + } elseif ($is_zip) { // ZIP content if ($filenames !== false) { echo ''; @@ -1974,6 +1984,15 @@ function fm_get_text_names() ); } +/** + * Get audio files extensions + * @return array + */ +function fm_get_onlineViewer_exts() +{ + return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar'); +} + /** * Class to work with zip files (using ZipArchive) */