1
0
Fork 0
Dieser Commit ist enthalten in:
DSB 2012-07-23 08:54:07 +00:00
Ursprung eebf048a4b
Commit 78afe70561

Datei anzeigen

@ -313,14 +313,14 @@ class ConfigController extends Zend_Controller_Action
// Params for transferring a test file // Params for transferring a test file
$name = 'ftp_transfer_testfile.txt'; $name = 'ftp_transfer_testfile.txt';
$filename = APPLICATION_PATH . '/forms/Config/ftp_transfertest/ftp_transfer_testfile.txt'; $filename = APPLICATION_PATH . '/forms/Config/ftp_transfertest/ftp_transfer_testfile.txt';
$target_folder = APPLICATION_PATH . '/forms/Config/ftp_transfertest/ftp_target/'; $targetFolder = APPLICATION_PATH . '/forms/Config/ftp_transfertest/ftp_target/';
$upload = false; $upload = false;
// try to connect via ssl to the ftp server // try to connect via ssl to the ftp server
if ($ssl == 'y' && function_exists('ftp_ssl_connect')) { if ($ssl == 'y' && function_exists('ftp_ssl_connect')) {
$ftpStream = ftp_ssl_connect($server, $port, $timeout); $ftpStream = ftp_ssl_connect($server, $port, $timeout);
} else { } else {
// otherwise try to connect to the ftp server normally // otherwise try to connect to the ftp server normally
$ftpStream = ftp_connect($server, $port, $timeout); $ftpStream = ftp_connect($server, $port, $timeout);
} }
@ -341,11 +341,11 @@ class ConfigController extends Zend_Controller_Action
} else if (!ftp_chdir($ftpStream, $directory)) { } else if (!ftp_chdir($ftpStream, $directory)) {
$message = sprintf($translator->_('L_CHANGEDIRERROR')); $message = sprintf($translator->_('L_CHANGEDIRERROR'));
// chmod target_folder if it's necessary // chmod target_folder if it's necessary
} else if (file_exists($target_folder) && substr(sprintf('%o', fileperms($target_folder)), -4) < '0755') { } else if (file_exists($targetFolder) && substr(sprintf('%o', fileperms($targetFolder)), -4) < '0755') {
ftp_chmod($ftpStream, 0755, $target_folder); ftp_chmod($ftpStream, 0755, $targetFolder);
$message = ''; $message = '';
// ftp directory exists and chmod ok? let's test the ftp transfer with a test file // ftp directory exists and chmod ok? let's test the ftp transfer with a test file
} else if (!ftp_put($ftpStream, $target_folder.$name, $filename, FTP_ASCII)) { } else if (!ftp_put($ftpStream, $targetFolder.$name, $filename, FTP_ASCII)) {
$message = sprintf($translator->_('L_FTP_FILE_TRANSFER_ERROR'), $name); $message = sprintf($translator->_('L_FTP_FILE_TRANSFER_ERROR'), $name);
} else { } else {
@ -355,30 +355,30 @@ class ConfigController extends Zend_Controller_Action
$translator->_('L_FTP_OK'); $translator->_('L_FTP_OK');
// delete the test file after a successful transfer test // delete the test file after a successful transfer test
if (file_exists($target_folder.$name)) { if (file_exists($targetFolder.$name)) {
ftp_delete($ftpStream, $target_folder.$name); ftp_delete($ftpStream, $targetFolder.$name);
} }
} }
// let's show the error messages // let's show the error messages
if (!$upload && count($message) > 0) { if (!$upload && count($message) > 0) {
$this->view->popUpMessage()->addMessage( $this->view->popUpMessage()->addMessage(
'config-validate-error', 'config-validate-error',
'L_ERROR', 'L_ERROR',
$message, $message,
array( array(
'modal' => true 'modal' => true
) )
); );
// or show the confirmation message // or show the confirmation message
} else if ($upload && count($message) > 0) { } else if ($upload && count($message) > 0) {
$this->view->popUpMessage()->addMessage( $this->view->popUpMessage()->addMessage(
'config-validate-message', 'config-validate-message',
'L_NOTICE', 'L_NOTICE',
$message, $message,
array( array(
'modal' => true 'modal' => true
) )
); );
} }