mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-14 12:08:01 +00:00
added ftp_ssl support (not sftp!)
This commit is contained in:
@@ -61,6 +61,8 @@ This probably requires the php-ftp package but on some platforms it's included i
|
|||||||
|Option | value type | What it does|
|
|Option | value type | What it does|
|
||||||
|--- | --- | ---|
|
|--- | --- | ---|
|
||||||
|FTP_SERVER | string | IP or hostname of your FTP Server |
|
|FTP_SERVER | string | IP or hostname of your FTP Server |
|
||||||
|
|FTP_PORT | int | Port number of your FTP Server. Defaults to 21 |
|
||||||
|
|FTP_SSL | bool | If your FTP server supports SSL-FTP (note: not sFTP! not the same), set it to true |
|
||||||
|FTP_USER | string | FTP Username |
|
|FTP_USER | string | FTP Username |
|
||||||
|FTP_PASS | string | FTP Password |
|
|FTP_PASS | string | FTP Password |
|
||||||
|FTP_BASEDIR | string | Base path where files will be stored. Must end with / eg `/web/pictshare/` |
|
|FTP_BASEDIR | string | Base path where files will be stored. Must end with / eg `/web/pictshare/` |
|
||||||
|
|||||||
@@ -14,8 +14,13 @@ class FTPStorage implements StorageController
|
|||||||
function connect()
|
function connect()
|
||||||
{
|
{
|
||||||
if(!$this->connection)
|
if(!$this->connection)
|
||||||
$this->connection = ftp_connect(FTP_SERVER);
|
{
|
||||||
if(!$this->login)
|
if(defined('FTP_SSL') && FTP_SSL === true)
|
||||||
|
$this->connection = ftp_ssl_connect(FTP_SERVER, ((defined('FTP_SSL') && is_numeric(FTP_PORT))?FTP_PORT:21) );
|
||||||
|
else
|
||||||
|
$this->connection = ftp_connect(FTP_SERVER, ((defined('FTP_SSL') && is_numeric(FTP_PORT))?FTP_PORT:21) );
|
||||||
|
}
|
||||||
|
if($this->connection && !$this->login)
|
||||||
{
|
{
|
||||||
$this->login = ftp_login($this->connection, FTP_USER, FTP_PASS);
|
$this->login = ftp_login($this->connection, FTP_USER, FTP_PASS);
|
||||||
ftp_pasv($this->connection, TRUE);
|
ftp_pasv($this->connection, TRUE);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ foreach($sc as $contr)
|
|||||||
if((new $contr())->isEnabled()===true)
|
if((new $contr())->isEnabled()===true)
|
||||||
{
|
{
|
||||||
$controllers[] = new $contr();
|
$controllers[] = new $contr();
|
||||||
|
echo "[i] Found storage controller ".get_class($controllers[(count($controllers)-1)])."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user