From b149483d28d0d1d12473c20115216223e9458827 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Wed, 28 Jan 2015 18:44:18 +0100 Subject: [PATCH] #PHRAS-223 #time 6h --- .../Phrasea/Controller/Prod/Export.php | 3 +- lib/classes/ftpclient.php | 20 +- templates/web/common/dialog_export.html.twig | 209 +++++++++--------- 3 files changed, 123 insertions(+), 109 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Export.php b/lib/Alchemy/Phrasea/Controller/Prod/Export.php index be6bb8f006..7ce17cb77e 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Export.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Export.php @@ -140,6 +140,8 @@ class Export implements ControllerProviderInterface } $success = false; + $msg = _('Error while connecting to FTP'); + try { $ftpClient = $app['phraseanet.ftp.client']($request->request->get('addr', ''), 21, 90, !!$request->request->get('ssl')); $ftpClient->login($request->request->get('login', ''), $request->request->get('pwd', '')); @@ -147,7 +149,6 @@ class Export implements ControllerProviderInterface $msg = _('Connection to FTP succeed'); $success = true; } catch (\Exception $e) { - $msg = sprintf(_('Error while connecting to FTP')); } return $app->json(array( diff --git a/lib/classes/ftpclient.php b/lib/classes/ftpclient.php index 4063d6edeb..cabc395f08 100644 --- a/lib/classes/ftpclient.php +++ b/lib/classes/ftpclient.php @@ -34,15 +34,21 @@ class ftpclient throw new Exception('Nom d\'hote incorrect ' . $host); } - if ($ssl === true) { - if (($this->connexion = ftp_ssl_connect($host, $port, $timeout)) === false) { - throw new Exception('Impossible de se connecter au serveur FTP en SSL'); - } - } else { - if (($this->connexion = ftp_connect($host, $port, $timeout)) === false) { - throw new Exception('Impossible de se connecter au serveur FTP ' . $host . ":$port $timeout"); + try { + if ($ssl === true) { + if (($this->connexion = @ftp_ssl_connect($host, $port, $timeout)) === false) { + throw new Exception('Impossible de se connecter au serveur FTP en SSL'); + } + } else { + if (($this->connexion = @ftp_connect($host, $port, $timeout)) === false) { + throw new Exception('Impossible de se connecter au serveur FTP ' . $host . ":$port $timeout"); + } } } + catch(\Exception $e) { + // any unknown pb + throw $e; + } return $this; } diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index 6527309c8f..571a3f6f48 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -2,61 +2,63 @@ {% macro print_ftp_form(datas) %}
-
- -
- +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- - +
+ +
+ + +
-
-
- -
- +
+ +
+ +
-
+
{% endmacro %} @@ -415,9 +417,6 @@

{% trans 'export:: FTP' %}

-
- -
-
-

{% trans 'export::mail: fichiers joint' %}

- {% for name, values in download.get_display_ftp() %} - {% if values.available > 0 %} -
-
- {% endif %} + {% if download.has_business_fields_access() %} + + {% endif %} - {% if app['phraseanet.registry'].get('GV_requireTOUValidationForExport') == true %} -
- -
- {% endif %} + {% if app['phraseanet.registry'].get('GV_requireTOUValidationForExport') == true %} +
+ +
+ {% endif %} +
@@ -492,7 +495,7 @@
- +