parent
8a84fa7069
commit
747bd87d73
|
@ -29,21 +29,23 @@
|
||||||
*/
|
*/
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
$fields = array (
|
$fields = array (
|
||||||
"id" => array ("post", "integer", ""),
|
"id" => array ("post", "integer", ""),
|
||||||
"create" => array ("post", "integer", ""),
|
"create" => array ("post", "integer", ""),
|
||||||
"pass" => array ("post", "string", ""),
|
"pass" => array ("post", "string", ""),
|
||||||
"passconf" => array ("post", "string", ""),
|
"passconf" => array ("post", "string", ""),
|
||||||
"prefixe" => array ("post", "string", ""),
|
"prefixe" => array ("post", "string", ""),
|
||||||
"login" => array ("post", "string", ""),
|
"login" => array ("post", "string", ""),
|
||||||
"dir" => array ("post", "string", ""),
|
"dir" => array ("post", "string", ""),
|
||||||
);
|
);
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
|
|
||||||
if ($pass != $passconf) {
|
if ($pass != $passconf) {
|
||||||
$error = _("Passwords do not match");
|
$error = _("Passwords do not match");
|
||||||
include("ftp_edit.php");
|
include_once("head.php");
|
||||||
exit();
|
echo "<h3>"._("Create a FTP account")."</h3><p class=\"error\">$error</p>";
|
||||||
|
include("foot.php");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $id && !$create) { //not a creation and not an edit
|
if (! $id && !$create) { //not a creation and not an edit
|
||||||
|
@ -59,22 +61,17 @@ if (! $id ) { //create
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
$error=$err->errstr();
|
$error=$err->errstr();
|
||||||
include("ftp_edit.php");
|
$is_include=true;
|
||||||
exit();
|
$rr[0]["prefixe"]=$prefixe;
|
||||||
|
$rr[0]["login"]=$login;
|
||||||
|
$rr[0]["dir"]=$dir;
|
||||||
|
include_once("ftp_edit.php");
|
||||||
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$error=_("The ftp account has been successfully changed");
|
$error=_("The ftp account has been successfully changed");
|
||||||
include("ftp_list.php");
|
include("ftp_list.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once("head.php");
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div align="center"><h3><?php __("Editing an FTP account"); ?></h3></div>
|
|
||||||
<?php
|
|
||||||
if (isset($error) && $error) {
|
|
||||||
echo "<p class=\"error\">$error</p>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php include_once("foot.php"); ?>
|
|
||||||
|
|
|
@ -30,12 +30,14 @@
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
include_once("head.php");
|
include_once("head.php");
|
||||||
|
|
||||||
$fields = array (
|
if ( !isset($is_include) ) {
|
||||||
"id" => array ("request", "integer", ""),
|
$fields = array (
|
||||||
"create" => array ("get", "integer", "0"),
|
"id" => array ("request", "integer", ""),
|
||||||
"dir" => array ("get", "string", "0"),
|
"create" => array ("get", "integer", "0"),
|
||||||
);
|
"dir" => array ("get", "string", "0"),
|
||||||
getFields($fields);
|
);
|
||||||
|
getFields($fields);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$id && !$create) {
|
if (!$id && !$create) {
|
||||||
$error=_("Neither a creation nor a edition");
|
$error=_("Neither a creation nor a edition");
|
||||||
|
@ -47,8 +49,8 @@ if (!$id && $create) { //creation
|
||||||
echo "<h3>"._("Create a FTP account")."</h3>";
|
echo "<h3>"._("Create a FTP account")."</h3>";
|
||||||
} else {
|
} else {
|
||||||
echo "<h3>"._("Editing a FTP account")."</h3>";
|
echo "<h3>"._("Editing a FTP account")."</h3>";
|
||||||
$r=$ftp->get_ftp_details($id);
|
$rr=$ftp->get_ftp_details($id);
|
||||||
if (!$r) {
|
if (!$rr) {
|
||||||
$error=$err->errstr();
|
$error=$err->errstr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +59,6 @@ if (!$id && $create) { //creation
|
||||||
<?php
|
<?php
|
||||||
if (isset($error) && $error) {
|
if (isset($error) && $error) {
|
||||||
echo "<p class=\"error\">$error</p>";
|
echo "<p class=\"error\">$error</p>";
|
||||||
include_once("foot.php");
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form method="post" action="ftp_doedit.php" name="main" id="main">
|
<form method="post" action="ftp_doedit.php" name="main" id="main">
|
||||||
|
@ -67,13 +67,13 @@ if (isset($error) && $error) {
|
||||||
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
|
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="login"><?php __("Username"); ?></label></th>
|
<th><label for="login"><?php __("Username"); ?></label></th>
|
||||||
<td><select class="inl" name="prefixe"><?php @$ftp->select_prefix_list($r["prefixe"]); ?></select> <b>_</b> <input type="text" class="int" name="login" id="login" value="<?php @ehe($r[0]["login"]); ?>" size="20" maxlength="64" /></td>
|
<td><select class="inl" name="prefixe"><?php @$ftp->select_prefix_list($rr[0]["prefixe"]); ?></select> <b>_</b> <input type="text" class="int" name="login" id="login" value="<?php @ehe($rr[0]["login"]); ?>" size="20" maxlength="64" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="dir"><?php __("Folder"); ?></label></th>
|
<th><label for="dir"><?php __("Folder"); ?></label></th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="int" name="dir" id="dir" value="<?php empty($dir)?@ehe("/".$r[0]["dir"]):@ehe($dir); ?>" size="20" maxlength="64" />
|
<input type="text" class="int" name="dir" id="dir" value="<?php empty($dir)?@ehe("/".$rr[0]["dir"]):@ehe($dir); ?>" size="20" maxlength="64" />
|
||||||
<?php display_browser( empty($dir)?("/".( isset($r[0]["dir"])?$r[0]["dir"]:'') ):$dir , "main.dir" ); ?>
|
<?php display_browser( empty($dir)?("/".( isset($rr[0]["dir"])?$rr[0]["dir"]:'') ):$dir , "main.dir" ); ?>
|
||||||
<p><?php __("This is the root folder for this FTP user. i.e. this FTP user can access to this forlder and all its sub-folders."); ?></p>
|
<p><?php __("This is the root folder for this FTP user. i.e. this FTP user can access to this forlder and all its sub-folders."); ?></p>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
@ -92,7 +92,7 @@ if (isset($error) && $error) {
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="trbtn">
|
<tr class="trbtn">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" />
|
<input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" onclick='return ftp_check_pass();' />
|
||||||
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ftp_list.php'"/>
|
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ftp_list.php'"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -109,6 +109,20 @@ function ftp_edit_pass_toggle() {
|
||||||
$('#ftp_tr_editpass').toggle();
|
$('#ftp_tr_editpass').toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ftp_check_pass() {
|
||||||
|
if ( $('#pass').val() != $('#passconf').val() ) {
|
||||||
|
alert('<?php __("Password do not match"); ?>');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( $('#pass').val() == '' ) {
|
||||||
|
// Check if it's a edtion or a creation
|
||||||
|
if ( <?php echo (isset($id) && ! empty($id))?'true':'false' ?> ) { return true ; }
|
||||||
|
alert('<?php __("Please enter a password"); ?>');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class m_ftp {
|
||||||
global $db,$err,$cuid;
|
global $db,$err,$cuid;
|
||||||
$err->log("ftp","get_list");
|
$err->log("ftp","get_list");
|
||||||
$r=array();
|
$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()) {
|
if ($db->num_rows()) {
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
// On passe /var/alternc/html/u/user
|
// On passe /var/alternc/html/u/user
|
||||||
|
|
Loading…
Reference in New Issue