IP whitelisting and/or blacklisting #171

Add Microsoft Office online view option #169
This commit is contained in:
Prasath Mani 2019-05-19 12:31:49 +05:30
parent ffc34859cc
commit 1696ebf0fc
3 changed files with 30 additions and 30 deletions

View file

@ -1,13 +0,0 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View file

@ -23,8 +23,7 @@
## Requirements
- PHP 5.5.0 or higher.
- [Zip extension](http://php.net/manual/en/book.zip.php) for zip and unzip actions.
- Fileinfo, iconv and mbstring extensions are strongly recommended.
- Fileinfo, iconv, zip, tar and mbstring extensions are strongly recommended.
## How to use
@ -62,8 +61,8 @@ 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: Cloud9 IDE - Syntax highlighting for over `150+` languages, Over `35+` themes with your favorite programming style
- :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
- :page_facing_up: Google/Microsoft doc viewer helps you preview `PDF/DOC/XLS/PPT/etc`. 25 MB can be previewed with the Google Drive viewer
- :zap: Backup files and IP white and blacklisting
- :mag_right: Search - Search and Sorting using `datatable js`
- :file_folder: Exclude folders from listing
- :globe_with_meridians: Multi-language support (English, Spanish, French, Italian, German, Russian, Thailand, Chinese and more..) for translations `translation.json` is file required

View file

@ -3,13 +3,13 @@
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false}';
/**
* H3K | Tiny File Manager V2.3.5
* H3K | Tiny File Manager V2.3.6
* CCP Programmers | ccpprogrammers@gmail.com
* https://tinyfilemanager.github.io
*/
//TFM version
define('VERSION', '2.3.5');
define('VERSION', '2.3.6');
//Application Title
define('APP_TITLE', 'Tiny File Manager');
@ -85,29 +85,41 @@ $iconv_input_encoding = 'UTF-8';
$datetime_format = 'd.m.y H:i';
// allowed file extensions for upload and rename
$allowed_extensions = ''; // 'gif,png,jpg'
// e.g. 'gif,png,jpg'
$allowed_extensions = '';
// Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
// full path, e.g http://example.com/favicon.png
// local path, e.g images/icons/favicon.png
$favicon_path = '?img=favicon';
// Array of files and folders excluded from listing
// e.r array('myfile.html', 'personal-folder')
$GLOBALS['exclude_items'] = array();
// Google Docs Viewer
$GLOBALS['online_viewer'] = true;
// Online office Docs Viewer
// Availabe rules are 'google', 'microsoft' or false
// google => View documents using Google Docs Viewer
// microsoft => View documents using Microsoft Web Apps Viewer
// false => disable online dov viewer
$GLOBALS['online_viewer'] = 'google';
//Sticky Nav bar
// Sticky Nav bar
// true => enable sticky header
// false => disable sticky header
$sticky_navbar = true;
//max upload file size
// max upload file size
define('MAX_UPLOAD_SIZE', '2048');
//--- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL
// private key and session name to store to the session
if ( !defined( 'FM_SESSION_ID')) {
define('FM_SESSION_ID', 'filemanager');
}
//Configuration
// Configuration
$cfg = new FM_Config();
// Default language
@ -124,8 +136,6 @@ $lang_list = array(
'en' => 'English'
);
//--- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL
if ($report_errors == true) {
@ini_set('error_reporting', E_ALL);
@ini_set('display_errors', 1);
@ -1291,8 +1301,9 @@ if (isset($_GET['view'])) {
$view_title = 'File';
$filenames = false; // for zip
$content = ''; // for text
$online_viewer = strtolower($GLOBALS['online_viewer']);
if($GLOBALS['online_viewer'] && in_array($ext, fm_get_onlineViewer_exts())){
if(online_viewer && online_viewer !== 'false' && in_array($ext, fm_get_onlineViewer_exts())){
$is_onlineViewer = true;
}
elseif ($ext == 'zip' || $ext == 'tar') {
@ -1388,8 +1399,11 @@ if (isset($_GET['view'])) {
<?php
}
if($is_onlineViewer) {
// Google docs viewer
echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
if($online_viewer == 'google') {
echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
} else if($online_viewer == 'microsoft') {
echo '<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=' . fm_enc($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
}
} elseif ($is_zip) {
// ZIP content
if ($filenames !== false) {