From 8e7fa102b85030e63ee7c50636d35e4f118e3716 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Fri, 29 Jul 2022 11:14:28 +0200 Subject: [PATCH] Clean --- htdocs/core/lib/ftp.lib.php | 5 ++--- htdocs/ftp/index.php | 13 ++++--------- htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/fr_FR/companies.lang | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/ftp.lib.php b/htdocs/core/lib/ftp.lib.php index 19dacfdea76..42f5806fba5 100644 --- a/htdocs/core/lib/ftp.lib.php +++ b/htdocs/core/lib/ftp.lib.php @@ -185,7 +185,6 @@ function dol_ftp_delete($connect_id, $file, $newsection) if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) { return ssh2_sftp_unlink($connect_id, $newremotefileiso); } else { - var_dump($newremotefileiso); return @ftp_delete($connect_id, $newremotefileiso); } } @@ -242,8 +241,8 @@ function dol_ftp_rmdir($connect_id, $file, $newsection) $newremotefileiso = utf8_decode($remotefile); if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) { - $result = ssh2_sftp_rmdir($connect_id, $newremotefileiso); + return ssh2_sftp_rmdir($connect_id, $newremotefileiso); } else { - $result = @ftp_rmdir($connect_id, $newremotefileiso); + return @ftp_rmdir($connect_id, $newremotefileiso); } } diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 324e3b27a38..cf647929ac8 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -188,17 +188,15 @@ if (GETPOST("const", 'array') && GETPOST("delete") && GETPOST("delete") == $lang if ($conn_id && $ok && !$mesg) { foreach (GETPOST('const', 'array') as $const) { - var_dump($const); if (isset($const["check"])) { // Is checkbox checked $langs->load("other"); // Remote file $file = $const["file"]; $newsection = $const["section"]; - $newsection = $section; $result = dol_ftp_delete($conn_id, $file, $newsection); - var_dump($newsection); + if ($result) { setEventMessages($langs->trans("FileWasRemoved", $file), null, 'mesgs'); } else { @@ -230,7 +228,7 @@ if ($action == 'confirm_deletesection' && $confirm == 'yes') { if ($conn_id && $ok && !$mesg) { $newsection = $section; - $result = dol_ftp_rmdir($connect_id, $file, $newsection); + $result = dol_ftp_rmdir($conn_id, $file, $newsection); if ($result) { setEventMessages($langs->trans("DirWasRemoved", $file), null, 'mesgs'); @@ -361,12 +359,12 @@ if (!function_exists('ftp_connect')) { if (!empty($ftp_server)) { // Confirm remove file if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode(GETPOST('section')).'&file='.urlencode(GETPOST('file')), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode(GETPOST('section')).'&file='.urlencode(GETPOST('file')), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', GETPOST('file')), 'confirm_deletefile', '', '', 1); } // Confirmation de la suppression d'une ligne categorie if ($action == 'delete_section') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode(GETPOST('section')).'&file='.urlencode(GETPOST('file')), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode(GETPOST('section')).'&file='.urlencode(GETPOST('file')), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', GETPOST('file')), 'confirm_deletesection', '', '', 1); } print $langs->trans("Server").': '.$ftp_server.'
'; @@ -456,8 +454,6 @@ if (!function_exists('ftp_connect')) { } else { $buff = ftp_rawlist($conn_id, $newsectioniso); $contents = ftp_nlist($conn_id, $newsectioniso); // Sometimes rawlist fails but never nlist - //var_dump($contents); - //var_dump($buff); } $nboflines = count($contents); @@ -467,7 +463,6 @@ if (!function_exists('ftp_connect')) { while ($i < $nboflines && $i < 1000) { $vals = preg_split('@ +@', utf8_encode($buff[$i]), 9); //$vals=preg_split('@ +@','drwxr-xr-x 2 root root 4096 Aug 30 2008 backup_apollon1',9); - //var_dump($vals); $file = $vals[8]; if (empty($file)) { $rawlisthasfailed = true; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 71b16f24506..996c98c203a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -444,7 +444,7 @@ AddAddress=Add address SupplierCategory=Vendor category JuridicalStatus200=Independent DeleteFile=Delete file -ConfirmDeleteFile=Are you sure you want to delete this file? +ConfirmDeleteFile=Are you sure you want to delete this file %s? AllocateCommercial=Assigned to sales representative Organization=Organization FiscalYearInformation=Fiscal Year diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 889f16b3f75..3359131aa51 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -443,7 +443,7 @@ AddAddress=Créer adresse SupplierCategory=Catégorie du fournisseur JuridicalStatus200=Indépendant DeleteFile=Suppression d'un fichier -ConfirmDeleteFile=Êtes-vous sûr de vouloir supprimer ce fichier ? +ConfirmDeleteFile=Êtes-vous sûr de vouloir supprimer ce fichier %s? AllocateCommercial=Affecter un commercial Organization=Organisme FiscalYearInformation=Exercice fiscal