--- /tmp/dsg/dolibarr/htdocs/ftp/admin/github_19.0.3_ftpclient.php +++ /tmp/dsg/dolibarr/htdocs/ftp/admin/client_ftpclient.php @@ -2 +2 @@ -/* Copyright (C) 2004-2022 Laurent Destailleur +/* Copyright (C) 2004-2016 Laurent Destailleur @@ -25 +24,0 @@ -// Load Dolibarr environment @@ -29 +28,4 @@ -$langs->loadLangs(array("admin", "other")); +$langs->loadLangs(array("admin", "ftp")); + +// Security check +if (!$user->admin) accessforbidden(); @@ -34 +36 @@ -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); @@ -36,5 +37,0 @@ - -// Security check -if (!$user->admin) { - accessforbidden(); -} @@ -51 +48,2 @@ -if ($result) { +if ($result) +{ @@ -53 +50,0 @@ - $reg = array(); @@ -55,4 +52,4 @@ - if (!empty($reg[1])) { - $lastftpentry = $reg[1]; - } -} else { + if ($reg[1]) $lastftpentry = $reg[1]; +} +else +{ @@ -62,3 +59,4 @@ -if ($action == 'add' || GETPOST('modify', 'alpha')) { - $ftp_name = "FTP_NAME_".$entry; - $ftp_server = "FTP_SERVER_".$entry; +if ($action == 'add' || GETPOST('modify', 'alpha')) +{ + $ftp_name = "FTP_NAME_".$entry; // $_POST["numero_entry"]; + $ftp_server = "FTP_SERVER_".$entry; //$_POST["numero_entry"]; @@ -68 +66,2 @@ - if (!GETPOST($ftp_name, 'alpha')) { + if (!GETPOST("$ftp_name", 'alpha')) + { @@ -73 +72,2 @@ - if (!GETPOST($ftp_server, 'alpha')) { + if (!GETPOST("$ftp_server", 'alpha')) + { @@ -78 +78,2 @@ - if (!$error) { + if (!$error) + { @@ -87,17 +88,8 @@ - if ($result1) { - $result2 = dolibarr_set_const($db, "FTP_SERVER_".$entry, GETPOST($ftp_server, 'alpha'), 'chaine', 0, '', $conf->entity); - } - if ($result2) { - $result3 = dolibarr_set_const($db, "FTP_USER_".$entry, GETPOST($ftp_user, 'alpha'), 'chaine', 0, '', $conf->entity); - } - if ($result3) { - $result4 = dolibarr_set_const($db, "FTP_PASSWORD_".$entry, GETPOST($ftp_password, 'alpha'), 'chaine', 0, '', $conf->entity); - } - if ($result4) { - $result5 = dolibarr_set_const($db, "FTP_NAME_".$entry, GETPOST($ftp_name, 'alpha'), 'chaine', 0, '', $conf->entity); - } - if ($result5) { - $result6 = dolibarr_set_const($db, "FTP_PASSIVE_".$entry, GETPOST($ftp_passive, 'alpha'), 'chaine', 0, '', $conf->entity); - } - - if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) { + if ($result1) $result2 = dolibarr_set_const($db, "FTP_SERVER_".$entry, GETPOST($ftp_server, 'alpha'), 'chaine', 0, '', $conf->entity); + if ($result2) $result3 = dolibarr_set_const($db, "FTP_USER_".$entry, GETPOST($ftp_user, 'alpha'), 'chaine', 0, '', $conf->entity); + if ($result3) $result4 = dolibarr_set_const($db, "FTP_PASSWORD_".$entry, GETPOST($ftp_password, 'alpha'), 'chaine', 0, '', $conf->entity); + if ($result4) $result5 = dolibarr_set_const($db, "FTP_NAME_".$entry, GETPOST($ftp_name, 'alpha'), 'chaine', 0, '', $conf->entity); + if ($result5) $result6 = dolibarr_set_const($db, "FTP_PASSIVE_".$entry, GETPOST($ftp_passive, 'alpha'), 'chaine', 0, '', $conf->entity); + + if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) + { @@ -107 +99,3 @@ - } else { + } + else + { @@ -114,2 +108,4 @@ -if (GETPOST('delete', 'alpha')) { - if ($entry) { +if (GETPOST('delete', 'alpha')) +{ + if ($entry) + { @@ -119,25 +115,18 @@ - if ($result1) { - $result2 = dolibarr_del_const($db, "FTP_SERVER_".$entry, $conf->entity); - } - if ($result2) { - $result3 = dolibarr_del_const($db, "FTP_USER_".$entry, $conf->entity); - } - if ($result3) { - $result4 = dolibarr_del_const($db, "FTP_PASSWORD_".$entry, $conf->entity); - } - if ($result4) { - $result5 = dolibarr_del_const($db, "FTP_NAME_".$entry, $conf->entity); - } - if ($result4) { - $result6 = dolibarr_del_const($db, "FTP_PASSIVE_".$entry, $conf->entity); - } - - if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) { - $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } else { - $db->rollback(); - dol_print_error($db); - } - } + if ($result1) $result2 = dolibarr_del_const($db, "FTP_SERVER_".$entry, $conf->entity); + if ($result2) $result3 = dolibarr_del_const($db, "FTP_USER_".$entry, $conf->entity); + if ($result3) $result4 = dolibarr_del_const($db, "FTP_PASSWORD_".$entry, $conf->entity); + if ($result4) $result5 = dolibarr_del_const($db, "FTP_NAME_".$entry, $conf->entity); + if ($result4) $result6 = dolibarr_del_const($db, "FTP_PASSIVE_".$entry, $conf->entity); + + if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) + { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $db->rollback(); + dol_print_error($db); + } + } @@ -153,4 +142 @@ - -$help_url = 'EN:Module_FTP_En|FR:Module_FTP|ES:Módulo_FTP'; - -llxHeader('', 'FTP', $help_url); +llxHeader(); @@ -162 +148,2 @@ -if (!function_exists('ftp_connect')) { +if (!function_exists('ftp_connect')) +{ @@ -164 +151,3 @@ -} else { +} +else +{ @@ -175 +164 @@ - print ''; + print ''; @@ -181 +170 @@ - print ''; + print ''; @@ -187 +176 @@ - print ''; + print ''; @@ -193 +182 @@ - print ''; + print ''; @@ -195 +184 @@ - print ''; + print ''; @@ -199 +188 @@ - print ''; + print ''; @@ -201 +190 @@ - print ''; + print ''; @@ -205 +194 @@ - print ''; + print ''; @@ -208,3 +197 @@ - if (!GETPOSTISSET("FTP_PASSIVE_".($lastftpentry + 1))) { - $defaultpassive = !getDolGlobalString('FTP_SUGGEST_PASSIVE_BYDEFAULT') ? 0 : 1; - } + if (!isset($_POST["FTP_PASSIVE_".($lastftpentry + 1)])) $defaultpassive = empty($conf->global->FTP_SUGGEST_PASSIVE_BYDEFAULT) ? 0 : 1; @@ -215,3 +202,4 @@ - print ''; ?> -
- ">
+ print ''; + + ?> +
">
@@ -219 +207 @@ - + @@ -222 +210 @@ - print '
'; ?> + ?> @@ -234 +222,2 @@ - if ($resql) { + if ($resql) + { @@ -238 +227,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -241 +230,0 @@ - $reg = array(); @@ -246,2 +235 @@ - print '
'; - print '
'; + print ""; @@ -251 +238,0 @@ - print '
'; @@ -268 +255 @@ - print ""; + print "global->$keyforname."\" size=\"64\">"; @@ -274 +261 @@ - print ""; + print "global->$keyforserver."\" size=\"64\">"; @@ -280 +267 @@ - print ""; + print "global->$keyforport."\" size=\"64\">"; @@ -286 +273 @@ - print ""; + print "global->$keyforuser."\" size=\"24\">"; @@ -292 +279 @@ - print ""; + print "global->$keyforpassword."\" size=\"24\">"; @@ -298 +285,9 @@ - print ''.$form->selectyesno('FTP_PASSIVE_'.$idrss, getDolGlobalString($keyforpassive), 1).''; + print ''.$form->selectyesno('FTP_PASSIVE_'.$idrss, $conf->global->$keyforpassive, 1).''; + print ""; + + print ""; + print ""; + print "trans("Modify")."\">"; + print "   "; + print "trans("Delete")."\">"; + print ""; @@ -302,7 +296,0 @@ - print '
'; - - print '
'; - print ''; - print "   "; - print ''; - print ''; @@ -311 +299 @@ - print '

'; + print '
'; @@ -315 +303,3 @@ - } else { + } + else + {