Coder Social home page Coder Social logo

dulldusk / phpfm Goto Github PK

View Code? Open in Web Editor NEW
215.0 215.0 97.0 2.29 MB

phpFileManager is a complete filesystem management tool on a single file. This is a tool meant for rapid file access, and also to verify the server php configuration and security. The script can be renamed and deployed on an unique known url, and offers password protection.

Home Page: https://sourceforge.net/projects/phpfm/

License: Other

PHP 100.00%

phpfm's People

Contributors

acca avatar andrewlytvyn avatar dirmanhana avatar dulldusk avatar h3zjp avatar megamindmk avatar misterduval avatar quidn avatar slmi avatar tallguy297 avatar wily123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpfm's Issues

Error: undefined mime_content_type()

Hello,
I'm Max Base.

uname -a

FreeBSD  12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  i386

php --version

PHP 7.3.9 (cli) (built: Sep  7 2019 01:13:06) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.9, Copyright (c) 1999-2018, by Zend Technologies

Error

Fatal error: Uncaught Error: Call to undefined function mime_content_type() in /home/hidden-a/b/c/d/e/f/g/index.php:2142 Stack trace: #0 /home/hidden-a/b/c/d/e/f/g/index.php(3792): is_binary('/home/onelang.i...') #1 /home/hidden-a/b/c/d/e/f/g/index.php(673): edit_file_form() #2 {main} thrown in /home/hidden-a/b/c/d/e/f/g/index.php on line 2142

mime_content_type() is no longer deprecated, php7 has support for this function now.

Untitled

Hack

<?php
function _mime_content_type($filename) {
    $result = new finfo();

    if (is_resource($result) === true) {
        return $result->file($filename, FILEINFO_MIME_TYPE);
    }

    return false;
}

#17

Best,
Max

allow copy to same dir

Would be good, to consider, allowing copying files to same dir as they reside..some wants to just clone a file (e.g. using it as a template for something)

Move not working as expected + Solution to fix

Hello,
First great tool to manage files on the server where default file manager sucks.

Issue:
When we move files and select folder from left, it changes to directory starting with ""
Reverting back is tough nut to crack when you have lot of files. Anyways, I found the solution too.

Solution:
Change line no 1249 from
parent.frame3.set_dir_dest(arg+'');
to
parent.frame3.set_dir_dest(arg+'". addslashes(DIRECTORY_SEPARATOR) . "');

All works well now.

Thanks!

Multiple Top Level Directories

Before I do this myself I was wondering. Is there a guide or solution to having multiple top level directories in the left frame. I will explain why. In my directory I have a docs directory, which contains all the latex2html and latex2pdf documents. PHPfm is an excellent solution for browsing this directory and previewing our documents. But as our organisation is growing, we plan to split up and move our docs directory into other directories. This means in PHPfm we would need to have a top level directory for foobar-one/docs and another for foobar-two/docs and so forth. Look forward to your replies

System charset fix [1.7.8]

file list will cause problem under chinese windows system.

fix:
line 1836
change "ISO-8859-1" to "GB2312"

中文系统下,文件目录错误。
1836行,将 ISO-8859-1改为 GB2312 即可

Call to undefined function apache_request_headers()

The apache_request_headers () function is called before checking for its existence and throws a fatal error on my system. I suggest to move the if(!function_exists('apache_request_headers')){...} block to the beginning of the file.

fb_log blocks phpfm and my Mozilla Firefox

Hi,

fb_log blocks my phpfm and Mozilla Firefox.

Is the line nessessary? Perhaps you can delete this feature. ChromePhp::log ???

I delete this line and all works fine.

fb_log("Page generated in ".number_format((getmicrotime()-$script_init_time), 3, '.', '')."s (limit ".ini_get("max_execution_time")."s) using ".format_size(memory_get_usage())." (limit ".ini_get("memory_limit").")")

Call to undefined function disk_total_space()

Hi,
on some systems i get the following error. Perhaps you can change the software that users on restricted web hosting platforms without this function do not get the error.

Fatal error: Uncaught Error: Call to undefined function disk_total_space() in /path/to/www/phpfm/test.php:3164 Stack trace: #0 /path/to/www/phpfm/test.php(5541): dir_list_form() #1 /path/to/www/phpfm/test.php(641): frame3() #2 {main} thrown in /path/to/www/phpfm/test.php on line 3164

I change it this way:

old:
<span>".et('Partition')." = ".format_size(disk_total_space($fm_current_dir))." / ".format_size(disk_free_space($fm_current_dir))." ".et('Free')."</span>";
new:
<span></span>

unicode chars on buttons + FIX

If you are using unicode chars on buttons, your code with javascript switch statements isnt working as expected with the button's values, because somewhere the special characters on the buttons are converted to html entities (so "Ford& iacute; t" isnt will be equal to "Fordít"):

$et['hu']['SelInverse'] = 'Fordít'; //í

This is your code:

// Select all/none/inverse
.....
               switch (Butt.value){
                case '".et('SelAll')."':
                    if (select(entry_list[Row.id])) newClassName = 'entrySelected';
                break;
                case '".et('SelNone')."':
                    if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';
                break;
                case '".et('SelInverse')."':
                    if (entry_list[Row.id].selected){
                        if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';
                    } else {
                        if (select(entry_list[Row.id])) newClassName = 'entrySelected';
                    }
                break;
            }
....

Fix: You should use html_entity_decode on all similar cases like this, for example:

switch (Butt.value){
                case '".html_entity_decode(et('SelAll'))."':
                    if (select(entry_list[Row.id])) newClassName = 'entrySelected';
                break;
                case '".html_entity_decode(et('SelNone'))."':
                    if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';
                break;
                case '".html_entity_decode(et('SelInverse'))."':
                    if (entry_list[Row.id].selected){
                        if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';
                    } else {
                        if (select(entry_list[Row.id])) newClassName = 'entrySelected';
                    }
                break;
            }

On long term try to change your code to check button ids instead of their values.

Upload not working / Windows 10 - solution provided

The file upload ends in a fatal error:
Fatal error:
Uncaught ArgumentCountError: Too few arguments to function system_exec_cmd(), 1 passed in C:\xampp\htdocs\Filemanager\Jobs.php on line 990 and exactly 2 expected in C:\xampp\htdocs\Filemanager\Jobs.php:4780...

Solution: Add 2nd parameter $output in line 990 and line 983:
if ($is_windows) system_exec_cmd('icacls "'.$file.'" /q /c /reset', $output);

Unclear on permissions

So this thing works like a charm. From what i gather, it does everything (and more than) i need.
Im wondering what permissions need to be for it to work correctly at least on my case. Im a newbie. Password wont save, i cant upload nor delete files, so i imagine this is related to permissions of lighttpd.

Thanks for the help!

V.

zipped folders accompanied by extra files with the same name

When I zip nested directories on Linux shared hosting with PHP 7.3., I cannot unzip them after download to Windows 10 (e.g. with 7z).
The zip archives contain one extra file for every folder with the same name. These files get extracted first - to 0-byte files - after which the folders cannot be extracted because the files with the same name are in their way.

It is probably related to some basics of Linux/Windows file system representation - but, unfortunately, I have no time to dive into that. In the meantime, I'll just work around with time-consuming unzipped folder downloads via FTP - but maybe other people would know what to do about it?

Here a small example with a zipped version of the file structure:

dir example
--dir a
----hello.txt
--dir b

http://stahl-electronics.com/frank/example.zip

Text edit format

Text files are saved in DOS format (CR/LF). There is no option to save in Unix format (LF).
For example Perl CGI scripts will not work if saved in DOS format

Cannot close popup windows

When I open popup windows(Server Info, Shell, Portscan, About or Edit) , the positions are too up as its close link hide under browser window and I cannot close the popup window without refresh the page. I checked it in Safari, Chrome, Opera, Firefox in MacOS also in Microsoft Edge on windows, all have the same problem. It possible to fix by one of three below solutions:
1- Change line 1459 to "top: 60%;"
2- Change line 1461 to "transform: translate(-50%, -40%);"
3- Change line 1459 to "top: 0;" and line 1461 to "transform: translate(-50%, 0);"

why is needed the whole app in just 1 file?

i know it is easier to download an deploy .... but a was thinking...

the actual generated web page consists of many elements like js scripts, some icons, lists, frames, divs, tables, rows, cells, links, ajax calls, config saves, etc... and for many single calls it has to load the same file that is about 8kb

maybe wil be good if additionally there were also another "multifile" version ... in addition to maybe smaller files and faster load times, it will also be modular and easier to maintain .... currently i am trying to analyze and understand whats wrong with zipped folders (#27) but is very difficult to browse the code in a single multiformat large file :(

File tree view is not loading

File tree view is not loading and I'm getting error following error.
Tested in : Chrome Version 71.0.3578.98
image

*updating new version jstree might solve the problem

Impossible to download big files with size > of PHP memory_limit or RAM size

If I try to download a file which is bigger in size than PHP memory_limit i got this error:

PHP Fatal error: Allowed memory size of XXXXXXX bytes exhausted (tried to allocate XXXXXXXX bytes) in PATH/index.php on line 921

The motivation could be that fpassthru($fh); on line 921 loads the full the file in memory resulting in exhausted memory due to memory_limit settings or size of server's RAM memory.

cannot view some files in nginx with regex server names

i have nginx with regex server names (to capture subdomain name for later use) so i can automatically support a document root for each subdomain with a single conf

in some document root folders, when i click "view" in any file (any type), it fails to guess the path and showing it... note other actions like edit, rename, etc. work flawlessly

01

02

this is a portion of my virtual server conf file, note the "subdomain" captured variable (also see nginx documentation: http://nginx.org/en/docs/http/server_names.html#regex_names)

# [...]
server {
    listen       80;
    server_name  ~^(?<subdomain>.*)\.netgamer\.cl$;

    root   /srv/netgamer/$subdomain;
    index  index.php index.html index.htm;
# [...]

issue in shell

when I type "-" this then browser window zoom out it's so annoying please fix this bug

HTTP Error 431 when navigating

After a few minutes of navigation, the script stops working with HTTP error 431. The reason - cookie is too big. It is required to clear the cookie in the browser. If you comment out this line, the problem disappears.

phpfm/index.php

Line 712 in 84a3ee2

setcookie((string)$dir_cookiename, (string)$total_size, 0 , "/");

problem new versions with byethost

I tested script in free host of byethost.com. New versions (v1.3 and above) don't work properly. They can't show home directory.
Error: I/O Error. /home/vol5_8/

In my tests, v1.0 to v1.2 work fine.

English miss spelling

“items” is wrong in below english lanquage array:
$set[“en”][“NoSel”] = ‘There are no selected itens’;
$set[“en”][“RemSel”] = ‘DELETE selected itens’;

By the way, i want to add “Persian/Dari” translation, but i do not know how to send it to you.

[humble request] change fonts size option (default font, monospaced, etc)

hi... thanks for your amazinf software ... after resolve my nginx bug (search issues) i am very happy with it

however i found fonts too tiny especially monospaced fonts (file editor, shell console, etc) ... i couldn't find how to change fonts size anywhere, just colors ... i would like some option or config value to set fonts size too .. thanks

Linux Mint Vanessa 21 & PHP File Manager 1.7.9 error.

I installed your PHP file manager 1.7.9 Last Changed: 2020-04-28 on the latest version of Linux Mint Vanessa 21.
When I go to http://localhost/ all I get is a blank screen.
Your previous version of your file manager 1.7.9 Last Changed: 2021-09-18 worked with no problem.
I have tested my Apache2 & PHP8.0 configuration and everything seems to be OK.

Am I missing a prerequisite?

Here is my install code...
echo -e '\033[1;33mInstalling \033[1;34mApache\033[0m'
apt-get -y -qq install apache2 >/dev/null
echo -e '\033[1;33mInstalling \033[1;34mPHP\033[0m'
apt-get -y -qq update >/dev/null
apt-get -y -qq install php >/dev/null
apt-get -y -qq install php-bcmath >/dev/null
apt-get -y -qq install php-bz2 >/dev/null
apt-get -y -qq install php-cgi >/dev/null
apt-get -y -qq install php-cli >/dev/null
apt-get -y -qq install php-common >/dev/null
apt-get -y -qq install php-curl >/dev/null
apt-get -y -qq install php-fpm >/dev/null
apt-get -y -qq install php-gd >/dev/null
apt-get -y -qq install php-intl >/dev/null
apt-get -y -qq install libapache2-mod-php >/dev/null
apt-get -y -qq install php-mbstring >/dev/null
apt-get -y -qq install php-mysql >/dev/null
apt-get -y -qq install php-xml >/dev/null
apt-get -y -qq install php-zip >/dev/null
## Create Index Page & Override limit.
mkdir -p /var/www/html
cp -f files/phpFileManager.php /var/www/html/index.php
chmod -R 0777 /var/www/html
rm -f /var/www/html/index.html
echo -e 'php_value upload_max_filesize 4.0G'>/var/www/html/.htaccess
echo -e 'php_value post_max_size 4.2G'>>/var/www/html/.htaccess
echo -e 'php_value memory_limit -1'>>/var/www/html/.htaccess
sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
sed -i 's/Restart=on-abort/Restart=always/g' /lib/systemd/system/apache2.service
systemctl -q enable apache2

Thank you...

permit open in popup

Hi!
Could you please re-add the possibility to open a file editing in a real popup? It allows to open multiple files and compare them for example. Also to edit a file full screen.
Thanks 👍

cannot write in config textboxes, + saving does not work

If i click on the config button, I cannot write anything in the textboxes.
Also if i change the dropdown settings, it is not retained.
Saving does not work.
I changed permissions of the phpfm dir and files to 777 but that does not help
I am using php 7.4

Can you please fix this?
Also where are these settings stored?

Thank you

Call to undefined function apache_request_headers() : solved

Hi,
on nginx server the Call to undefined function apache_request_headers() can be solved by adding this function just after Header and Globals.

see : https://stackoverflow.com/questions/2916232/call-to-undefined-function-apache-request-headers

// +--------------------------------------------------
// | Header and Globals
// +--------------------------------------------------

//function to solve error Call to undefined function apache_request_headers() on non apache servers
if( !function_exists('apache_request_headers') ) {
///
function apache_request_headers() {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach($SERVER as $key => $val) {
if( preg_match($rx_http, $key) ) {
$arh_key = preg_replace($rx_http, '', $key);
$rx_matches = array();
// do some nasty string manipulations to restore the original letter case
// this should work in most cases
$rx_matches = explode('
', $arh_key);
if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val);
$arh_key = implode('-', $rx_matches);
}
$arh[$arh_key] = $val;
}
}
return( $arh );
}
///
}
///

Upload through rest api

Is it possible i can upload from third party app throug api?

If its possible can you make some example please.

PHPFM not compatible with php v8

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home//vel.com/phpfm_1.7.9.php:2389 Stack trace: #0 /home/vel.com/phpfm_1.7.9.php(5534): dir_list_form() #1 /home/vel.com/phpfm_1.7.9.php(603): frame3() #2 {main} thrown in /home/vel.com/phpfm_1.7.9.php on line 2389

Missing language strings

Hi,

there is one missing string from all translations:

$et['en']['Download'] = 'Download';

(Its the text on the 'ZIP download' button)

Add 2fa for security

Hey how are you? This tool is amazing!
I think that is a good idea to enforce the auth method with 2FA like google authenticator. In my installations of your tool I always use https and add a delay in login for brute force protection (with a simple "sleep()"). With 2FA this tool will be much better that now it is!

Cannot paste in shell window

We cannot paste a command directory to the shell window, so I have to write it down again manually and it is taking time plus mistyping problem.

Word wrap in editor

If you can set word wrap in editor it will be better to see the codes without horizontal scroll.

[humble question] multi user profiles

hi.. thanks again ... i just installed phpfm after resolve the nginx bug (see issues) and i think i am turning a phpfm fan xD

i have a home webserver where i give webhosting to some friends ... i would like to give an access password to each one, with basedir restricted to their document root

naturally there would be at least 2 roles: admin and user ...

for the user, basedir should be hidden/read-only and phpfm should hide itself for edition (however i am thinking, anyway some clever user could upload and unzip any online filemanager through phpfm itself to gain full access... a thing to think)

the admin should be able to edit basedir and reset passwords for everyone

Disable Functions, Master Password and Change link behaivor

Is there any way to disable functions and have a master password?
I would like to have a master password that have all options, and also a user password that only have the functions enabled on config, i would like to use this as a read-only file manager for my users (disable config, server info, create files and directory, uploads, shell, portscan, resolve ids, delete, copy, move, compress, zip download, symlink, hardlink, permissions, execute, decompress, edit, rename, get size) hide .files and also i would like that if a file is a .php, .html, .txt (files that are visible on a browser) when click on file it open the direct route it in a new tab instead of download it

Is it possible?

Readonly Mode

Congratulation for this great job.
Would it be possible to have a readonly mode with a dedicated password?
Thanks

How to set password

How to set password in this script? In which line number I need to set the password? In which variable I need to set the password? Please clarify it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.