Go to the documentation of this file.
25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
28 $langs->loadLangs(array(
"admin",
"other"));
33 $action =
GETPOST(
'action',
'aZ09');
34 $entry =
GETPOST(
'numero_entry',
'alpha');
47 $sql =
"select MAX(name) as name from ".MAIN_DB_PREFIX.
"const";
48 $sql .=
" WHERE name like 'FTP_SERVER_%'";
49 $result = $db->query($sql);
51 $obj = $db->fetch_object($result);
53 preg_match(
'/([0-9]+)$/i', $obj->name, $reg);
54 if (!empty($reg[1])) {
55 $lastftpentry = $reg[1];
61 if ($action ==
'add' ||
GETPOST(
'modify',
'alpha')) {
62 $ftp_name =
"FTP_NAME_".$entry;
63 $ftp_server =
"FTP_SERVER_".$entry;
67 if (!
GETPOST($ftp_name,
'alpha')) {
69 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
72 if (!
GETPOST($ftp_server,
'alpha')) {
74 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Server")),
null,
'errors');
78 $ftp_port =
"FTP_PORT_".$entry;
79 $ftp_user =
"FTP_USER_".$entry;
80 $ftp_password =
"FTP_PASSWORD_".$entry;
81 $ftp_passive =
"FTP_PASSIVE_".$entry;
93 $result4 =
dolibarr_set_const($db,
"FTP_PASSWORD_".$entry,
GETPOST($ftp_password,
'alpha'),
'chaine', 0,
'', $conf->entity);
99 $result6 =
dolibarr_set_const($db,
"FTP_PASSIVE_".$entry,
GETPOST($ftp_passive,
'alpha'),
'chaine', 0,
'', $conf->entity);
102 if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) {
104 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
113 if (
GETPOST(
'delete',
'alpha')) {
134 if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) {
136 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
153 $help_url =
'EN:Module_FTP_En|FR:Module_FTP|ES:Módulo_FTP';
157 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
158 print
load_fiche_titre($langs->trans(
"FTPClientSetup"), $linkback,
'title_setup');
161 if (!function_exists(
'ftp_connect')) {
162 print $langs->trans(
"FTPFeatureNotSupportedByYourPHP");
165 print
'<form name="ftpconfig" action="ftpclient.php" method="post">';
166 print
'<input type="hidden" name="token" value="'.newToken().
'">';
168 print
'<table class="noborder centpercent">';
169 print
'<tr class="liste_titre">';
170 print
'<td colspan="2">'.$langs->trans(
"NewFTPClient").
'</td>';
171 print
'<td>'.$langs->trans(
"Example").
'</td>';
174 print
'<tr class="oddeven">';
175 print
'<td>'.$langs->trans(
"Label").
'</td>';
176 print
'<td><input type="text" name="FTP_NAME_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_NAME_".($lastftpentry + 1)).
'" size="64"></td>';
177 print
'<td>My FTP access</td>';
180 print
'<tr class="oddeven">';
181 print
'<td>'.$langs->trans(
"Server").
'</td>';
182 print
'<td><input type="text" name="FTP_SERVER_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_SERVER_".($lastftpentry + 1)).
'" size="64"></td>';
183 print
'<td>localhost</td>';
186 print
'<tr class="oddeven">';
187 print
'<td width="100">'.$langs->trans(
"Port").
'</td>';
188 print
'<td><input type="text" name="FTP_PORT_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_PORT_".($lastftpentry + 1)).
'" size="64"></td>';
189 print
'<td>21 for pure non crypted 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>';
192 print
'<tr class="oddeven">';
193 print
'<td>'.$langs->trans(
"User").
'</td>';
194 print
'<td><input type="text" name="FTP_USER_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_USER_".($lastftpentry + 1)).
'" class="minwidth175"></td>';
195 print
'<td>myftplogin</td>';
198 print
'<tr class="oddeven">';
199 print
'<td>'.$langs->trans(
"Password").
'</td>';
200 print
'<td><input type="password" name="FTP_PASSWORD_'.($lastftpentry + 1).
'" value="'.
GETPOST(
"FTP_PASSWORD_".($lastftpentry + 1)).
'" class="minwidth175"></td>';
201 print
'<td>myftppassword</td>';
204 print
'<tr class="oddeven">';
205 print
'<td>'.$langs->trans(
"FTPPassiveMode").
'</td>';
206 $defaultpassive =
GETPOST(
"FTP_PASSIVE_".($lastftpentry + 1));
207 if (!
GETPOSTISSET(
"FTP_PASSIVE_".($lastftpentry + 1))) {
208 $defaultpassive = empty($conf->global->FTP_SUGGEST_PASSIVE_BYDEFAULT) ? 0 : 1;
210 print
'<td>'.$form->selectyesno(
'FTP_PASSIVE_'.($lastftpentry + 1), $defaultpassive, 2).
'</td>';
211 print
'<td>'.$langs->trans(
"No").
'</td>';
218 <input
type=
"submit" class=
"button" value=
"<?php echo $langs->trans("Add
") ?>"></div>
219 <input
type=
"hidden" name=
"action" value=
"add">
220 <input
type=
"hidden" name=
"numero_entry" value=
"<?php echo ($lastftpentry + 1) ?>">
230 $sql =
"select name, value, note from ".MAIN_DB_PREFIX.
"const";
231 $sql .=
" WHERE name like 'FTP_SERVER_%'";
232 $sql .=
" ORDER BY name";
234 dol_syslog(
"ftpclient select ftp setup", LOG_DEBUG);
235 $resql = $db->query($sql);
237 $num = $db->num_rows(
$resql);
241 $obj = $db->fetch_object(
$resql);
244 preg_match(
'/([0-9]+)$/i', $obj->name, $reg);
249 print
'<form name="externalrssconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
250 print
'<input type="hidden" name="token" value="'.newToken().
'">';
251 print
'<input type="hidden" name="numero_entry" value="'.$idrss.
'">';
253 print
'<div class="div-table-responsive-no-min">';
254 print
'<table class="noborder centpercent">'.
"\n";
256 print
'<tr class="liste_titre">';
257 print
'<td class="fieldtitle">'.$langs->trans(
"FTP").
" ".($idrss).
"</td>";
261 $keyforname =
"FTP_NAME_".$idrss;
262 $keyforserver =
"FTP_SERVER_".$idrss;
263 $keyforport =
"FTP_PORT_".$idrss;
264 $keyforuser =
"FTP_USER_".$idrss;
265 $keyforpassword =
"FTP_PASSWORD_".$idrss;
266 $keyforpassive =
"FTP_PASSIVE_".$idrss;
268 print
'<tr class="oddeven">';
269 print
"<td>".$langs->trans(
"Name").
"</td>";
270 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_NAME_".$idrss.
"\" value=\"".
getDolGlobalString($keyforname).
"\" size=\"64\"></td>";
274 print
'<tr class="oddeven">';
275 print
"<td>".$langs->trans(
"Server").
"</td>";
276 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_SERVER_".$idrss.
"\" value=\"".
getDolGlobalString($keyforserver).
"\" size=\"64\"></td>";
280 print
'<tr class="oddeven">';
281 print
"<td width=\"100\">".$langs->trans(
"Port").
"</td>";
282 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_PORT_".$idrss.
"\" value=\"".
getDolGlobalString($keyforport).
"\" size=\"64\"></td>";
286 print
'<tr class="oddeven">';
287 print
"<td width=\"100\">".$langs->trans(
"User").
"</td>";
288 print
"<td><input type=\"text\" class=\"flat\" name=\"FTP_USER_".$idrss.
"\" value=\"".
getDolGlobalString($keyforuser).
"\" size=\"24\"></td>";
292 print
'<tr class="oddeven">';
293 print
"<td width=\"100\">".$langs->trans(
"Password").
"</td>";
294 print
"<td><input type=\"password\" class=\"flat\" name=\"FTP_PASSWORD_".$idrss.
"\" value=\"".
getDolGlobalString($keyforpassword).
"\" size=\"24\"></td>";
298 print
'<tr class="oddeven">';
299 print
"<td width=\"100\">".$langs->trans(
"FTPPassiveMode").
"</td>";
300 print
'<td>'.$form->selectyesno(
'FTP_PASSIVE_'.$idrss,
getDolGlobalString($keyforpassive), 1).
'</td>';
306 print
'<div class="center">';
307 print
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'">';
309 print
'<input type="submit" class="button" name="delete" value="'.$langs->trans(
"Delete").
'">';
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
load_fiche_titre($titre, $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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.