Elxis CMS Forum

Support => Administration => Topic started by: yiannos on November 15, 2006, 12:14:28

Title: Usage of FTP function in admin
Post by: yiannos on November 15, 2006, 12:14:28
Could you please tell me (or direct me to where it is mentioned) where the FTP function is used in elxis?

And one suggestion: At the ftp setup page in Administration, it would be usefull to add a "Test" button to check wheter the admin has entered correct credentials and ftp address.

TIA
Title: Re: Usage of FTP function in admin
Post by: datahell on November 15, 2006, 12:38:15
FTP function is used everywhere in Elxis! For handling files in Elxis we have created a class named File Manager which is globally accessible under the object name fmanager and is located in Elxis Core. File manager has internal check routines to determine if for a requested task will use the normal php functions or will try to perform requested action using FTP.

Example:
Lets say you wish to delete file 'test.txt'
You do this by writing this:
$fmanager->deleteFile('test.txt');

File manager will check if file is writable (so deletable) by php. If yes he will delete it using the php's function unlink. If not he will delete it using the KFTP class/functions. fmanager connects and disconnects automatically from your ftp account. You don't have to tell him to connect or disconnect. If is connected he keeps the connection open (or sleep), so if he needs it again to not have to login again.

The check for the correct credentials and ftp address is done during the Elxis installation procedure. Maybe we should also add a "Test button" in administration as you proposed although there will be a small security risk there: Someone (not the site owner) could continiously try to guess ftp password using this check function... (ftp username and address are very easy to know).
Title: Re: Usage of FTP function in admin
Post by: datahell on November 15, 2006, 12:46:24
If you wish you can create a small Elxis tool that will do this check for you.
You can also very easy check if Elxis is connected/uses ftp by checking the output of this:

$fmanager->useftp;


Note: the value above depends on the requested task and file's/directory's permissions