26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29$langs->loadLangs(array(
"admin",
"other"));
34$action =
GETPOST(
'action',
'aZ09');
35$entry =
GETPOST(
'numero_entry',
'alpha');
48$sql =
"select MAX(name) as name from ".MAIN_DB_PREFIX.
"const";
49$sql .=
" WHERE name like 'FTP_SERVER_%'";
50$result = $db->query($sql);
52 $obj = $db->fetch_object($result);
54 preg_match(
'/([0-9]+)$/i', $obj->name, $reg);
55 if (!empty($reg[1])) {
56 $lastftpentry = $reg[1];
62if ($action ==
'add' ||
GETPOST(
'modify',
'alpha')) {
63 $ftp_name =
"FTP_NAME_".$entry;
64 $ftp_server =
"FTP_SERVER_".$entry;
68 if (!
GETPOST($ftp_name,
'alpha')) {
70 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
73 if (!
GETPOST($ftp_server,
'alpha')) {
75 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Server")),
null,
'errors');
79 $ftp_port =
"FTP_PORT_".$entry;
80 $ftp_user =
"FTP_USER_".$entry;
81 $ftp_password =
"FTP_PASSWORD_".$entry;
82 $ftp_passive =
"FTP_PASSIVE_".$entry;
94 $result4 =
dolibarr_set_const($db,
"FTP_PASSWORD_".$entry,
GETPOST($ftp_password,
'alpha'),
'chaine', 0,
'', $conf->entity);
100 $result6 =
dolibarr_set_const($db,
"FTP_PASSIVE_".$entry,
GETPOST($ftp_passive,
'alpha'),
'chaine', 0,
'', $conf->entity);
103 if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) {
105 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
114if (
GETPOST(
'delete',
'alpha')) {
135 if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) {
137 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
151$form =
new Form($db);
154$help_url =
'EN:Module_FTP_En|FR:Module_FTP|ES:Módulo_FTP';
158$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
159print
load_fiche_titre($langs->trans(
"FTPClientSetup"), $linkback,
'title_setup');
162if (!function_exists(
'ftp_connect')) {
163 print $langs->trans(
"FTPFeatureNotSupportedByYourPHP");
166 print
'<form name="ftpconfig" action="ftpclient.php" method="post">';
167 print
'<input type="hidden" name="token" value="'.newToken().
'">';
169 print
'<table class="noborder centpercent">';
170 print
'<tr class="liste_titre">';
171 print
'<td colspan="2">'.$langs->trans(
"NewFTPClient").
'</td>';
172 print
'<td>'.$langs->trans(
"Example").
'</td>';
175 print
'<tr class="oddeven">';
176 print
'<td>'.$langs->trans(
"Label").
'</td>';
177 print
'<td><input type="text" name="FTP_NAME_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_NAME_".($lastftpentry + 1)).
'" size="64"></td>';
178 print
'<td>My FTP access</td>';
181 print
'<tr class="oddeven">';
182 print
'<td>'.$langs->trans(
"Server").
'</td>';
183 print
'<td><input type="text" name="FTP_SERVER_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_SERVER_".($lastftpentry + 1)).
'" size="64"></td>';
184 print
'<td>localhost</td>';
187 print
'<tr class="oddeven">';
188 print
'<td width="100">'.$langs->trans(
"Port").
'</td>';
189 print
'<td><input type="text" name="FTP_PORT_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_PORT_".($lastftpentry + 1)).
'" size="64"></td>';
190 print
'<td>21 for pure non encrypted FTP or if option FTP_CONNECT_WITH_SSL (See Home-Setup-Other) is on (FTPS)<br>22 if option FTP_CONNECT_WITH_SFTP (See Home-Setup-Other) is on (SFTP)</td>';
193 print
'<tr class="oddeven">';
194 print
'<td>'.$langs->trans(
"User").
'</td>';
195 print
'<td><input type="text" name="FTP_USER_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_USER_".($lastftpentry + 1)).
'" class="minwidth175"></td>';
196 print
'<td>myftplogin</td>';
199 print
'<tr class="oddeven">';
200 print
'<td>'.$langs->trans(
"Password").
'</td>';
201 print
'<td><input type="password" name="FTP_PASSWORD_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_PASSWORD_".($lastftpentry + 1)).
'" class="minwidth175"></td>';
202 print
'<td>myftppassword</td>';
205 print
'<tr class="oddeven">';
206 print
'<td>'.$langs->trans(
"FTPPassiveMode").
'</td>';
207 $defaultpassive =
GETPOST(
"FTP_PASSIVE_".($lastftpentry + 1));
208 if (!GETPOSTISSET(
"FTP_PASSIVE_".($lastftpentry + 1))) {
211 print
'<td>'.$form->selectyesno(
'FTP_PASSIVE_'.($lastftpentry + 1), $defaultpassive, 2).
'</td>';
212 print
'<td>'.$langs->trans(
"No").
'</td>';
217 <input
type=
"submit" class=
"button" value=
"<?php echo $langs->trans("Add
") ?>"></div>
218 <input
type=
"hidden" name=
"action" value=
"add">
219 <input
type=
"hidden" name=
"numero_entry" value=
"<?php echo($lastftpentry + 1) ?>">
228 $sql =
"select name, value, note from ".MAIN_DB_PREFIX.
"const";
229 $sql .=
" WHERE name like 'FTP_SERVER_%'";
230 $sql .=
" ORDER BY name";
232 dol_syslog(
"ftpclient select ftp setup", LOG_DEBUG);
233 $resql = $db->query($sql);
235 $num = $db->num_rows($resql);
239 $obj = $db->fetch_object($resql);
242 preg_match(
'/([0-9]+)$/i', $obj->name, $reg);
247 print
'<form name="externalrssconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
248 print
'<input type="hidden" name="token" value="'.newToken().
'">';
249 print
'<input type="hidden" name="numero_entry" value="'.$idrss.
'">';
251 print
'<div class="div-table-responsive-no-min">';
252 print
'<table class="noborder centpercent">'.
"\n";
254 print
'<tr class="liste_titre">';
255 print
'<td class="fieldtitle">'.$langs->trans(
"FTP").
" ".($idrss).
"</td>";
259 $keyforname =
"FTP_NAME_".$idrss;
260 $keyforserver =
"FTP_SERVER_".$idrss;
261 $keyforport =
"FTP_PORT_".$idrss;
262 $keyforuser =
"FTP_USER_".$idrss;
263 $keyforpassword =
"FTP_PASSWORD_".$idrss;
264 $keyforpassive =
"FTP_PASSIVE_".$idrss;
266 print
'<tr class="oddeven">';
267 print
"<td>".$langs->trans(
"Name").
"</td>";
268 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_NAME_".$idrss.
"\" value=\"".
getDolGlobalString($keyforname).
"\" size=\"64\"></td>";
272 print
'<tr class="oddeven">';
273 print
"<td>".$langs->trans(
"Server").
"</td>";
274 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_SERVER_".$idrss.
"\" value=\"".
getDolGlobalString($keyforserver).
"\" size=\"64\"></td>";
278 print
'<tr class="oddeven">';
279 print
"<td width=\"100\">".$langs->trans(
"Port").
"</td>";
280 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_PORT_".$idrss.
"\" value=\"".
getDolGlobalString($keyforport).
"\" size=\"64\"></td>";
284 print
'<tr class="oddeven">';
285 print
"<td width=\"100\">".$langs->trans(
"User").
"</td>";
286 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_USER_".$idrss.
"\" value=\"".
getDolGlobalString($keyforuser).
"\" size=\"24\"></td>";
290 print
'<tr class="oddeven">';
291 print
"<td width=\"100\">".$langs->trans(
"Password").
"</td>";
292 print
"<td><input type=\"password\" class=\"flat\" name=\"FTP_PASSWORD_".$idrss.
"\" value=\"".
getDolGlobalString($keyforpassword).
"\" size=\"24\"></td>";
296 print
'<tr class="oddeven">';
297 print
"<td width=\"100\">".$langs->trans(
"FTPPassiveMode").
"</td>";
298 print
'<td>'.$form->selectyesno(
'FTP_PASSIVE_'.$idrss,
getDolGlobalString($keyforpassive), 1).
'</td>';
304 print
'<div class="center">';
305 print
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'">';
307 print
'<input type="submit" class="button" name="delete" value="'.$langs->trans(
"Delete").
'">';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.