net2ftp uses one script file (index.php) for all screens: login, browse, copy, ...
The functions are stored in different include files according to what they do:
- homepage.inc.php contains functions to print the login page and net2ftp homepage
- manage.inc.php contains the high-level functions to print the screens (copy, upload,...)
- filesystem.inc.php contains the low-level functions that execute FTP commands or local filesystem commands
- browse.inc.php contains all functions related to the Browse Screen (requesting the ftp_rawlist, parsing it, showing the output)
- authorizations.inc.php contains functions to check the authorizations
- html.inc.php contains functions which print the HTML header and footer
- httpheaders.inc.php contains the code that is related to sending HTTP headers (needed for example to trigger the Save As popup of your browser, when you want to download a file)
- registerglobals.inc.php registers the variables and does some preliminary checking
Two state variables (state and state2) determine which screen is shown.
Below is some sample code taken from index.php.
The login information and state variables are passed from screen to screen via forms.
There is a function to print the login information in an HTML form: printLoginInfo().
For the moment net2ftp doesn't use sessions.
This was to avoid session timeouts after 20 or 30 minutes; you can work without worrying about it for as long as you want.
In the meanwhile some users have pointed out on the forum how to avoid session timeouts, but I don't know what benefit sessions would bring.
There isn't really any information that has to be stored during a session.
Cookies are used to store the last FTP server, username and directory used.
net2ftp can be configured using the settings.inc.php and settings_authorizations.inc.php files.
When a function needs to access a variable, this variable is declared as global in the beginning of the function.
These variables are never changed during the execution of the program.
The icons were developed by Everaldo for KDE, and can be downloaded from http://www.everaldo.com.
There are 3 kinds of icons:
- action icons: when you press on them, an action is triggered.
There is an onMouseOver effect and onClick event.
These icons are 32x32 pixels.
- mime icons: they indicate which kind of file is shown in the browse view.
No onMouseOver effect.
These icons are 16x16 pixels.
- settings icons (not yet in use): they indicate if a setting is on or off -- for example if the FTP transfer mode is ASCII or BINARY.
When the mode is ASCII, the ASCII icon is shown with a border, and there is no onMouseOver effect.
The BINARY icon is shown without a border and there is an onMouseOver effect.
The code for this FTP transfer mode is already written but not yet in use.
In (recent) Mozilla-based browsers, PNG images with a transparent background are shown fine.
In Internet Explorer however they are not: the transparent regions are grey.
Microsoft has issued a note on how to fix this: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294714
The onMouseOver effect increases the icon size from 32x32 to 34x34 pixels.
To avoid that the rest of the content would move, there is margin of 2px when the icon is 32x32, and a margin of 0px when it is 34x34.
There are currently 2 action icon sets: the Crystal set, and the Kids set.
Which set is used depends on the skin.
All the code behind icons is in the skins.inc.php file.
If you're interested in helping with the development of net2ftp, feel free!
Post a message on the forum telling which feature you'ld like to develop, just to make sure someone else isn't working on the same thing.
If you need help or would like some advice, don't hesitate.
Once you're done, send the code to David, who will test it and include it in the main distribution.
In the future we may start working together on a common development server at net2ftp.org.
- Multi-lingual support
- Currently only the last FTP server, username and directory are stored in a cookie. An improvement would be to store the last 5 servers/usernames/directories used and print a drop-down list.
- Let the user select the number of upload fields. Currently it has to be specified in the settings file (requested by Ajay)
- An install script would be great... Most users have a problem because they erased a character by mistake...
- The admin panel can also be improved a lot: graphic statistics, enhanced functions,...
- Allow the user to select the mode of transfer, i.e. binary, ascii or auto (requested by Ajay and Decsifo)
- The chmod functionality should recursively go through all subdirectories and files, if the user wants it. (requested by emonkey)
- List the files and directories together, so that manipulations like chmod, zip download etc can be done on them together. Currently these have to be done seperately (requested by Ajay)
- Add an upload field at the bottom of the directories listing as well as makenew dir etc for immediate creation, instead of going to a new page for this (requested by Ajay)
- Show thumbnails for graphic files
- Search files for given string
- Apache/MySQL specific tools: password-protect directories, custom error pages, run SQL queries
- Add more cases to the function (printURL in browse.inc.php) that maps the FTP location to a URL.
Some examples:
ftp.freeserver.com/username/dir/file.php can be mapped to
http://username.freeserver.com/dir/file.php OR
http://www.freeserver.com/username/dir/file.php OR
http://freeusers.freeserver.com/~username/dir/file.php
More exotic features:
- Command Line Interface (requested by edph)
- URL to FTP (meaning, you enter the URL of a picture in net2ftp, and net2ftp gets that picture and saves it on your FTP server; could be extended to any content, like a page, sound, ...) (requested by arie)
- Email to FTP: send a mail to a specific address, and enter some commands in the mail. They are executed by net2ftp, and the result is sent back by email.
- Upload progress bar
- One-time passwords. For the paranoids who are going on holiday and don't want to compromise their password -- and still want to update their site from a cybercafe
- Client-side encryption with javascript
- Make FTP files available via HTML link. For example: <img src="http://www.net2ftp.com/getfile.php?ftpserver=ftp.myserver.com&file=/home/david/mypicture.jpg">
- Sign a file (MD5)