From 747bd87d73219c198edd36735fe4ee479aaa207a Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 28 Jan 2013 09:58:03 +0000 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20pour=20le=20FTP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should fix #1423 --- bureau/admin/ftp_doedit.php | 47 +++++++++++++++++-------------------- bureau/admin/ftp_edit.php | 42 ++++++++++++++++++++++----------- bureau/class/m_ftp.php | 2 +- 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/bureau/admin/ftp_doedit.php b/bureau/admin/ftp_doedit.php index 1e64b3a4..eff68547 100644 --- a/bureau/admin/ftp_doedit.php +++ b/bureau/admin/ftp_doedit.php @@ -29,21 +29,23 @@ */ require_once("../class/config.php"); $fields = array ( - "id" => array ("post", "integer", ""), - "create" => array ("post", "integer", ""), - "pass" => array ("post", "string", ""), - "passconf" => array ("post", "string", ""), - "prefixe" => array ("post", "string", ""), - "login" => array ("post", "string", ""), - "dir" => array ("post", "string", ""), + "id" => array ("post", "integer", ""), + "create" => array ("post", "integer", ""), + "pass" => array ("post", "string", ""), + "passconf" => array ("post", "string", ""), + "prefixe" => array ("post", "string", ""), + "login" => array ("post", "string", ""), + "dir" => array ("post", "string", ""), ); getFields($fields); if ($pass != $passconf) { - $error = _("Passwords do not match"); - include("ftp_edit.php"); - exit(); + $error = _("Passwords do not match"); + include_once("head.php"); + echo "

"._("Create a FTP account")."

$error

"; + include("foot.php"); + exit(); } if (! $id && !$create) { //not a creation and not an edit @@ -59,22 +61,17 @@ if (! $id ) { //create } if (!$r) { - $error=$err->errstr(); - include("ftp_edit.php"); - exit(); + $error=$err->errstr(); + $is_include=true; + $rr[0]["prefixe"]=$prefixe; + $rr[0]["login"]=$login; + $rr[0]["dir"]=$dir; + include_once("ftp_edit.php"); + exit(); } else { - $error=_("The ftp account has been successfully changed"); - include("ftp_list.php"); - exit(); + $error=_("The ftp account has been successfully changed"); + include("ftp_list.php"); + exit(); } -include_once("head.php"); - ?> -

-$error

"; - } -?> - diff --git a/bureau/admin/ftp_edit.php b/bureau/admin/ftp_edit.php index 23e8ad98..be53c19f 100644 --- a/bureau/admin/ftp_edit.php +++ b/bureau/admin/ftp_edit.php @@ -30,12 +30,14 @@ require_once("../class/config.php"); include_once("head.php"); -$fields = array ( - "id" => array ("request", "integer", ""), - "create" => array ("get", "integer", "0"), - "dir" => array ("get", "string", "0"), -); -getFields($fields); +if ( !isset($is_include) ) { + $fields = array ( + "id" => array ("request", "integer", ""), + "create" => array ("get", "integer", "0"), + "dir" => array ("get", "string", "0"), + ); + getFields($fields); +} if (!$id && !$create) { $error=_("Neither a creation nor a edition"); @@ -47,8 +49,8 @@ if (!$id && $create) { //creation echo "

"._("Create a FTP account")."

"; } else { echo "

"._("Editing a FTP account")."

"; - $r=$ftp->get_ftp_details($id); - if (!$r) { + $rr=$ftp->get_ftp_details($id); + if (!$rr) { $error=$err->errstr(); } } @@ -57,8 +59,6 @@ if (!$id && $create) { //creation $error

"; - include_once("foot.php"); - exit(); } ?>
@@ -67,13 +67,13 @@ if (isset($error) && $error) { - + @@ -92,7 +92,7 @@ if (isset($error) && $error) { @@ -109,6 +109,20 @@ function ftp_edit_pass_toggle() { $('#ftp_tr_editpass').toggle(); } +function ftp_check_pass() { + if ( $('#pass').val() != $('#passconf').val() ) { + alert(''); + return false; + } + if ( $('#pass').val() == '' ) { + // Check if it's a edtion or a creation + if ( ) { return true ; } + alert(''); + return false; + } + return true; +} + log("ftp","get_list"); $r=array(); - $db->query("SELECT id, name, homedir FROM ftpusers WHERE uid='$cuid' ORDER BY homedir;"); + $db->query("SELECT id, name, homedir FROM ftpusers WHERE uid='$cuid' ORDER BY name;"); if ($db->num_rows()) { while ($db->next_record()) { // On passe /var/alternc/html/u/user
 _ " size="20" maxlength="64" /> _ " size="20" maxlength="64" />
- " size="20" maxlength="64" /> - + " size="20" maxlength="64" /> +

- " /> + " onclick='return ftp_check_pass();' /> " onclick="document.location='ftp_list.php'"/>