Better error management in FTP client module
This commit is contained in:
parent
c482fa38ad
commit
3844c02058
@ -1,9 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,15 +26,15 @@
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$def = array();
|
||||
$lastftpentry=0;
|
||||
|
||||
// positionne la variable pour le nombre de rss externes
|
||||
// Positionne la variable pour le nombre de rss externes
|
||||
$sql ="select MAX(name) name from ".MAIN_DB_PREFIX."const";
|
||||
$sql.=" WHERE name like 'FTP_SERVER_%'";
|
||||
$result=$db->query($sql);
|
||||
@ -58,7 +54,22 @@ if ($_POST["action"] == 'add' || $_POST["modify"])
|
||||
$ftp_name = "FTP_NAME_" . $_POST["numero_entry"];
|
||||
$ftp_server = "FTP_SERVER_" . $_POST["numero_entry"];
|
||||
|
||||
if (isset($_POST[$ftp_name]) && isset($_POST[$ftp_server]))
|
||||
$error=0;
|
||||
$mesg='';
|
||||
|
||||
if (empty($_POST[$ftp_name]))
|
||||
{
|
||||
$error=1;
|
||||
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>';
|
||||
}
|
||||
|
||||
if (empty($_POST[$ftp_server]))
|
||||
{
|
||||
$error=1;
|
||||
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'</div>';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ftp_port = "FTP_PORT_" . $_POST["numero_entry"];
|
||||
$ftp_user = "FTP_USER_" . $_POST["numero_entry"];
|
||||
@ -131,7 +142,8 @@ if (! function_exists('ftp_connect'))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
// Formulaire ajout
|
||||
print '<form name="ftpconfig" action="ftpclient.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -69,7 +69,7 @@ $s_ftp_user='FTP_USER_'.$numero_ftp;
|
||||
$s_ftp_password='FTP_PASSWORD_'.$numero_ftp;
|
||||
$ftp_name=$conf->global->$s_ftp_name;
|
||||
$ftp_server=$conf->global->$s_ftp_server;
|
||||
$ftp_port=$conf->global->$s_ftp_port;
|
||||
$ftp_port=$conf->global->$s_ftp_port; if (empty($ftp_port)) $ftp_port=21;
|
||||
$ftp_user=$conf->global->$s_ftp_user;
|
||||
$ftp_password=$conf->global->$s_ftp_password;
|
||||
|
||||
|
||||
@ -95,18 +95,19 @@ class modFTP extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 2800;
|
||||
$this->rights[$r][1] = 'Use FTP client in read mode';
|
||||
$this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'read';
|
||||
|
||||
/* Not yet developed
|
||||
$r++;
|
||||
$this->rights[$r][0] = 2801;
|
||||
$this->rights[$r][1] = 'Use FTP client in write mode';
|
||||
$this->rights[$r][1] = 'Use FTP client in write mode (can also upload files)';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'write';
|
||||
|
||||
*/
|
||||
|
||||
// Menus
|
||||
//------
|
||||
|
||||
@ -335,7 +335,7 @@ Module600Name=Notifications
|
||||
Module600Desc=Send notifications by email on some Dolibarr business events to third party's contacts
|
||||
Module700Name=Donations
|
||||
Module700Desc=Donations' management
|
||||
Module800Name=OSCommerce direct
|
||||
Module800Name=OSCommerce by direct database access
|
||||
Module800Desc=Interface to show an OSCommerce or OSCSS shop via direct database access
|
||||
Module900Name=OSCommerce by WS
|
||||
Module900Desc=Interface to show an OSCommerce shop via Web services.\nThis module requiere you to install components from /oscommerce_ws/ws_server into your OSCommerce server. See README file in /oscommerce_ws/ws_server.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user