2006-04-26 12:28:53 +00:00
< ? php
2015-09-25 15:42:00 +00:00
2006-04-26 12:28:53 +00:00
/*
2012-08-28 08:59:05 +00:00
----------------------------------------------------------------------
LICENSE
2015-09-25 15:42:00 +00:00
2012-08-28 08:59:05 +00:00
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License ( GPL )
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
2015-09-25 15:42:00 +00:00
2012-08-28 08:59:05 +00:00
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2015-09-25 15:42:00 +00:00
2012-08-28 08:59:05 +00:00
To read the license please visit http :// www . gnu . org / copyleft / gpl . html
----------------------------------------------------------------------
2017-10-06 21:42:39 +00:00
*/
2012-08-28 08:59:05 +00:00
2006-04-26 12:28:53 +00:00
/**
2015-09-25 15:42:00 +00:00
* FTP account management class
2017-10-08 17:31:34 +00:00
*
* @ copyright AlternC - Team 2000 - 2017 https :// alternc . com /
2015-09-25 15:42:00 +00:00
*/
2006-04-26 12:28:53 +00:00
class m_ftp {
2018-06-22 15:37:04 +00:00
var $srv_proftpd ;
2012-08-28 08:59:05 +00:00
2011-05-03 07:25:51 +00:00
2015-09-25 15:42:00 +00:00
/**
2017-10-06 21:42:39 +00:00
* Constructor
2015-09-25 15:42:00 +00:00
*/
function m_ftp () {
global $L_FQDN ;
2018-06-24 17:05:59 +00:00
$this -> srv_proftpd = variable_get ( 'fqdn_proftpd' , $L_FQDN , 'Human name for FTP server. If you change it, launch reload-certs' , array ( 'desc' => 'Name' , 'type' => 'string' ));
2013-01-29 09:13:34 +00:00
}
2015-09-25 15:42:00 +00:00
/**
* Password kind used in this class ( hook for admin class )
*/
function alternc_password_policy () {
return array ( " ftp " => " FTP accounts " );
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* hook function called by menu class
* to add menu to the left panel
*/
2015-09-25 15:42:00 +00:00
function hook_menu () {
global $quota ;
$q = $quota -> getquota ( " ftp " );
$obj = array (
'title' => _ ( " FTP accounts " ),
'link' => 'toggle' ,
2017-08-17 19:32:21 +00:00
'pos' => 100 ,
2015-09-25 15:42:00 +00:00
'links' => array (),
);
if ( $quota -> cancreate ( " ftp " )) {
$obj [ 'links' ][] = array (
'txt' => _ ( " Create a new ftp account " ),
'url' => " ftp_edit.php?create=1 " ,
'class' => '' ,
);
}
if ( $q [ 'u' ] > 0 ) { // if there are some FTP accounts
$obj [ 'links' ][] = array (
'txt' => _ ( " FTP accounts list " ),
'url' => " ftp_list.php "
);
}
return $obj ;
2006-04-26 12:28:53 +00:00
}
2014-03-26 13:31:06 +00:00
2017-10-06 21:42:39 +00:00
/**
* Return the values needed to activate security access . See get_auth_class ()
* in authip for more informations
*/
2015-09-25 15:42:00 +00:00
function authip_class () {
$c = Array ();
$c [ 'name' ] = " FTP " ;
$c [ 'protocol' ] = " ftp " ;
$c [ 'values' ] = Array ();
$tt = $this -> get_list ();
if ( empty ( $tt ) || ! is_array ( $tt )) {
return $c ;
}
foreach ( $this -> get_list () as $v ) {
$c [ 'values' ][ $v [ 'id' ]] = $v [ 'login' ];
}
return $c ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Switch enabled status of an account
*/
2015-09-25 15:42:00 +00:00
function switch_enabled ( $id , $status = null ) {
2017-08-15 18:05:02 +00:00
global $cuid , $db , $msg ;
2015-09-25 15:42:00 +00:00
if ( ! $jj = $this -> get_ftp_details ( $id )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , 'ftp' , _ ( " This account do not exist or is not of this account " ));
2015-09-25 15:42:00 +00:00
return false ;
}
if ( $status == null ) {
if ( $jj [ 0 ][ 'enabled' ] == true ) {
$status = 0 ;
} else {
$status = 1 ;
}
}
// Be sure what is in $status, in case of it was a parameter
2017-08-15 18:05:02 +00:00
$status = ( $status ? 1 : 0 );
2015-09-25 15:42:00 +00:00
2016-05-17 16:57:01 +00:00
if ( ! $db -> query ( " UPDATE ftpusers SET enabled = ? WHERE uid = ? AND id = ? ; " , array ( $status , $cuid , $id ))) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , 'ftp' , _ ( " Error during update " ));
2015-09-25 15:42:00 +00:00
return false ;
} else {
return true ;
}
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Retourne la liste des comptes FTP du compte h<EFBFBD> berg<EFBFBD>
2015-09-25 15:42:00 +00:00
* Retourne la liste des comptes FTP sous forme de tableau index<EFBFBD> de
* tableaus associatifs comme suit :
* $a [ " id " ] = ID du compte ftp
* $a [ " login " ] = Nom de login du compte
* $a [ " dir " ] = Dossier relatif <EFBFBD> la racine du compte de l ' utilisateur
* @ return array Retourne le tableau des comptes
*/
function get_list () {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " get_list " );
2015-09-25 15:42:00 +00:00
$r = array ();
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT id, name, homedir, enabled FROM ftpusers WHERE uid= ? ORDER BY name; " , array ( $cuid ));
2015-09-25 15:42:00 +00:00
if ( $db -> num_rows ()) {
while ( $db -> next_record ()) {
$r [] = array (
" id " => $db -> f ( " id " ),
" login " => $db -> f ( " name " ),
" enabled " => $db -> f ( " enabled " ),
//"dir"=>$match[1]
" dir " => $db -> f ( " homedir " )
);
}
return $r ;
} else {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " INFO " , " ftp " , _ ( " No FTP account found " ));
2015-09-25 15:42:00 +00:00
return array ();
}
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Retourne les details d ' un compte FTP ( voir get_list )
2015-09-25 15:42:00 +00:00
* Le tableau est celui du compte d ' id specifie
* @ param integer $id Numero du compte dont on souhaite obtenir les d<EFBFBD> tails
* @ return array Tableau associatif contenant les infos du comptes ftp
*/
function get_ftp_details ( $id ) {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " get_ftp_details " , $id );
2015-09-25 15:42:00 +00:00
$r = array ();
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT id, name, homedir, enabled FROM ftpusers WHERE uid= ? AND id= ?; " , array ( $cuid , $id ));
2015-09-25 15:42:00 +00:00
if ( $db -> num_rows ()) {
$db -> next_record ();
$regexp = " /^ " . preg_quote ( getuserpath (), " / " ) . " \ /(.*) $ / " ;
$match = array ();
preg_match ( $regexp , $db -> f ( " homedir " ), $match );
$lg = explode ( " _ " , $db -> f ( " name " ));
if (( ! is_array ( $lg )) || ( count ( $lg ) != 2 )) {
$lg [ 0 ] = $db -> f ( " name " );
$lg [ 1 ] = " " ;
}
$r [] = array (
" id " => $db -> f ( " id " ),
" prefixe " => $lg [ 0 ],
" login " => $lg [ 1 ],
" dir " => $match [ 1 ],
" enabled " => $db -> f ( " enabled " )
);
return $r ;
} else {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " This FTP account does not exist " ));
2015-09-25 15:42:00 +00:00
return false ;
}
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Retourne la liste des prefixes utilisables par le compte courant
2015-09-25 15:42:00 +00:00
* @ return array tableau contenant la liste des prefixes ( domaines + login )
* du compte actuel .
*/
function prefix_list () {
global $db , $mem , $cuid ;
$r = array ();
$r [] = $mem -> user [ " login " ];
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT domaine FROM domaines WHERE compte= ? ORDER BY domaine; " , array ( $cuid ));
2015-09-25 15:42:00 +00:00
while ( $db -> next_record ()) {
$r [] = $db -> f ( " domaine " );
}
return $r ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
2015-09-25 15:42:00 +00:00
/**
* Check if the login is fine ( syntax )
* @ param string $l
*/
function check_login ( $l ) {
2017-08-15 18:05:02 +00:00
global $msg ;
2015-09-25 15:42:00 +00:00
// special chars and the max numbers of them allowed
// to be able to give a specific error
$vv = array ( '_' => '1' , ' ' => 0 );
foreach ( $vv as $k => $n ) {
if ( substr_count ( $l , $k ) > $n ) { // if there is more than $n $k
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , 'ftp' , sprintf ( _ ( " FTP login is incorrect: too many '%s' " ), $k ));
2015-09-25 15:42:00 +00:00
return false ;
}
}
// Explicitly look for only allowed chars
if ( ! preg_match ( " /^[A-Za-z0-9]+[A-Za-z0-9_ \ . \ -]* $ / " , $l )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , 'ftp' , _ ( " FTP login is incorrect " ));
2015-09-25 15:42:00 +00:00
return false ;
}
return true ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Affiche ( ECHO ) la liste des prefixes disponibles sous forme de champs d ' option
2015-09-25 15:42:00 +00:00
* Les champs sont affich<EFBFBD> s sous la forme < option > prefixe </ option >...
* La valeur $current se voit affubl<EFBFBD> e de la balise SELECTED .
* @ param string $current Prefixe s<EFBFBD> lectionn<EFBFBD> par d<EFBFBD> faut
* @ return boolean TRUE .
*/
function select_prefix_list ( $current ) {
$r = $this -> prefix_list ();
reset ( $r );
while ( list ( $key , $val ) = each ( $r )) {
if ( $current == $val ) {
$c = " selected= \" selected \" " ;
} else {
$c = " " ;
}
echo " <option $c > $val </option> " ;
}
return true ;
2013-01-29 09:19:31 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Modifie les param<EFBFBD> tres du comptes FTP $id .
2015-09-25 15:42:00 +00:00
* @ param integer $id Num<EFBFBD> ro du compte dont on veut modifier les param<EFBFBD> tres
* @ param string $prefixe Prefixe du compte FTP
* @ param string $login login ajout<EFBFBD> au pr<EFBFBD> fixe ( $prefixe_ $login )
* @ param string $pass mot de passe
* @ param string $dir R<EFBFBD> pertoire racine du compte
* @ return boolean TRUE si le compte a <EFBFBD> t<EFBFBD> modifi<EFBFBD> , FALSE si une erreur est survenue .
*/
function put_ftp_details ( $id , $prefixe , $login , $pass , $dir ) {
2017-08-15 18:05:02 +00:00
global $db , $msg , $bro , $cuid , $admin ;
$msg -> log ( " ftp " , " put_ftp_details " , $id );
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT count(*) AS cnt FROM ftpusers WHERE id= ? and uid= ?; " , array ( $id , $cuid ));
2015-09-25 15:42:00 +00:00
$db -> next_record ();
if ( ! $db -> f ( " cnt " )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " This FTP account does not exist " ));
2015-09-25 15:42:00 +00:00
return false ;
}
$dir = $bro -> convertabsolute ( $dir );
if ( substr ( $dir , 0 , 1 ) == " / " ) {
$dir = substr ( $dir , 1 );
}
$r = $this -> prefix_list ();
if ( ! in_array ( $prefixe , $r )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " The chosen prefix is not allowed " ));
2015-09-25 15:42:00 +00:00
return false ;
}
$full_login = $prefixe ;
if ( $login ) {
$full_login .= " _ " . $login ;
}
if ( ! $this -> check_login ( $full_login )) {
return false ;
}
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT COUNT(*) AS cnt FROM ftpusers WHERE id!= ? AND name= ?; " , array ( $id , $full_login ));
2015-09-25 15:42:00 +00:00
$db -> next_record ();
if ( $db -> f ( " cnt " )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " This FTP account already exists " ));
2015-09-25 15:42:00 +00:00
return false ;
}
$absolute = getuserpath () . " / $dir " ;
if ( ! file_exists ( $absolute )) {
system ( " /bin/mkdir -p $absolute " );
}
if ( ! is_dir ( $absolute )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " The directory cannot be created " ));
2015-09-25 15:42:00 +00:00
return false ;
}
if ( trim ( $pass )) {
// Check this password against the password policy using common API :
if ( is_callable ( array ( $admin , " checkPolicy " ))) {
if ( ! $admin -> checkPolicy ( " ftp " , $full_login , $pass )) {
return false ; // The error has been raised by checkPolicy()
}
}
2018-04-17 02:46:05 +00:00
$encrypted_password = _sha512cr ( $pass );
2016-05-17 16:57:01 +00:00
$db -> query ( " UPDATE ftpusers SET name= ? , password='', encrypted_password= ?, homedir= ?, uid= ? WHERE id= ?; " , array ( $full_login , $encrypted_password , $absolute , $cuid , $id ));
2015-09-25 15:42:00 +00:00
} else {
2016-05-17 16:57:01 +00:00
$db -> query ( " UPDATE ftpusers SET name= ? , homedir= ? , uid= ? WHERE id= ? ; " , array ( $full_login , $absolute , $cuid , $id ));
2015-09-25 15:42:00 +00:00
}
return true ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Efface le compte ftp specifie
2015-09-25 15:42:00 +00:00
* @ param integer $id Numero du compte FTP a supprimer .
* @ return boolean TRUE si le compte a ete efface , FALSE sinon .
*/
function delete_ftp ( $id ) {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " delete_ftp " , $id );
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT name FROM ftpusers WHERE id= ? and uid= ? ; " , array ( $id , $cuid ));
2015-09-25 15:42:00 +00:00
$db -> next_record ();
$name = $db -> f ( " name " );
if ( ! $name ) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " This FTP account does not exist " ));
2015-09-25 15:42:00 +00:00
return false ;
}
2016-05-17 16:57:01 +00:00
$db -> query ( " DELETE FROM ftpusers WHERE id= ? ; " , array ( $id ));
2015-09-25 15:42:00 +00:00
return $name ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Cree un nouveau compte FTP .
2015-09-25 15:42:00 +00:00
* @ param string $prefixe Prefixe au login
* @ param string $login Login ftp ( login = prefixe_login )
* @ param string $pass Mot de passe FTP
* @ param string $dir Repertoire racine du compte relatif à la racine du membre
* @ return boolean TRUE si le compte a ete cree , FALSE sinon .
*/
function add_ftp ( $prefixe , $login , $pass , $dir ) {
2017-08-15 18:05:02 +00:00
global $db , $msg , $quota , $bro , $cuid , $admin ;
$msg -> log ( " ftp " , " add_ftp " , $prefixe . " _ " . $login );
2015-09-25 15:42:00 +00:00
$dir = $bro -> convertabsolute ( $dir );
if ( substr ( $dir , 0 , 1 ) == " / " ) {
$dir = substr ( $dir , 1 );
}
$r = $this -> prefix_list ();
if ( empty ( $pass )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " Password can't be empty " ));
2015-09-25 15:42:00 +00:00
return false ;
}
if ( ! in_array ( $prefixe , $r ) || $prefixe == " " ) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " The chosen prefix is not allowed " ));
2015-09-25 15:42:00 +00:00
return false ;
}
$full_login = $prefixe ;
if ( $login ) {
$full_login .= " _ " . $login ;
}
if ( ! $this -> check_login ( $full_login )) {
return false ;
}
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT count(*) AS cnt FROM ftpusers WHERE name= ? ; " , array ( $full_login ));
2015-09-25 15:42:00 +00:00
$db -> next_record ();
if ( $db -> f ( " cnt " )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " This FTP account already exists " ));
2015-09-25 15:42:00 +00:00
return false ;
}
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT login FROM membres WHERE uid= ? ; " , array ( $cuid ));
2015-09-25 15:42:00 +00:00
$db -> next_record ();
$absolute = getuserpath () . " / $dir " ;
if ( ! file_exists ( $absolute )) {
system ( " /bin/mkdir -p $absolute " ); // FIXME replace with action
}
if ( ! is_dir ( $absolute )) {
2017-10-06 16:04:36 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " The directory cannot be created " ));
2015-09-25 15:42:00 +00:00
return false ;
}
// Check this password against the password policy using common API :
if ( is_callable ( array ( $admin , " checkPolicy " ))) {
if ( ! $admin -> checkPolicy ( " ftp " , $full_login , $pass )) {
return false ; // The error has been raised by checkPolicy()
}
}
if ( $quota -> cancreate ( " ftp " )) {
2018-04-17 02:46:05 +00:00
$encrypted_password = _sha512cr ( $pass );
2016-05-17 16:57:01 +00:00
$db -> query ( " INSERT INTO ftpusers (name,password, encrypted_password,homedir,uid) VALUES ( ?, '', ?, ?, ?) " , array ( $full_login , $encrypted_password , $absolute , $cuid ));
2015-09-25 15:42:00 +00:00
return true ;
} else {
2017-10-07 17:08:17 +00:00
$msg -> raise ( " ERROR " , " ftp " , _ ( " Your FTP account quota is over. You cannot create more FTP accounts " ));
2015-09-25 15:42:00 +00:00
return false ;
}
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Retourne TRUE si $dir possee un compte FTP
2015-09-25 15:42:00 +00:00
* @ param string $dir Dossier a tester , relatif a la racine du compte courant
* @ return boolean retourne TRUE si $dir a un compte FTP , FALSE sinon .
*/
function is_ftp ( $dir ) {
2017-08-15 18:05:02 +00:00
global $db , $msg ;
$msg -> log ( " ftp " , " is_ftp " , $dir );
2015-09-25 15:42:00 +00:00
if ( substr ( $dir , 0 , 1 ) == " / " ) {
$dir = substr ( $dir , 1 );
}
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT id FROM ftpusers WHERE homedir= ? ; " , array ( getuserpath () . " / " . $dir ));
2015-09-25 15:42:00 +00:00
if ( $db -> num_rows ()) {
$db -> next_record ();
return $db -> f ( " id " );
} else {
return false ;
}
2006-04-26 12:28:53 +00:00
}
2009-11-30 06:01:34 +00:00
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Fonction appellee par domains quand un domaine est supprime pour le membre
2015-09-25 15:42:00 +00:00
* @ param string $dom Domaine à detruire .
* @ access private
*/
function alternc_del_domain ( $dom ) {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " alternc_del_domain " , $dom );
2016-05-17 16:57:01 +00:00
$db -> query ( " DELETE FROM ftpusers WHERE uid= ? AND ( name LIKE ? OR name LIKE ?) " , array ( $cuid , $dom . " \ _% " , $dom ));
2015-09-25 15:42:00 +00:00
return true ;
2009-11-30 06:01:34 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
/**
* Fonction appellee par membres quand un membre est efface
2015-09-25 15:42:00 +00:00
* @ access private
*/
function alternc_del_member () {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " alternc_del_member " );
2016-05-17 16:57:01 +00:00
$db -> query ( " DELETE FROM ftpusers WHERE uid= ? " , array ( $cuid ));
2015-09-25 15:42:00 +00:00
return true ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
/**
* Returns the used quota for the $name service for the current user .
* @ param $name string name of the quota
* @ return integer the number of service used or false if an error occured
* @ access private
*/
function hook_quota_get () {
2017-08-15 18:05:02 +00:00
global $db , $msg , $cuid ;
$msg -> log ( " ftp " , " getquota " );
2015-09-25 15:42:00 +00:00
$q = Array ( " name " => " ftp " , " description " => _ ( " FTP accounts " ), " used " => 0 );
2016-05-17 16:57:01 +00:00
$db -> query ( " SELECT COUNT(*) AS cnt FROM ftpusers WHERE uid= ? " , array ( $cuid ));
2015-09-25 15:42:00 +00:00
if ( $db -> next_record ()) {
$q [ 'used' ] = $db -> f ( " cnt " );
}
return $q ;
2006-04-26 12:28:53 +00:00
}
2015-09-25 15:42:00 +00:00
/**
* Exporte toutes les informations ftp du compte AlternC
* @ access private
* EXPERIMENTAL 'sid' function ;)
*/
function alternc_export_conf () {
2017-08-15 18:05:02 +00:00
global $db , $msg ;
$msg -> log ( " ftp " , " export " );
2015-09-25 15:42:00 +00:00
$f = $this -> get_list ();
$str = " <ftp> " ;
foreach ( $f as $d => $v ) {
$str .= " <login> " . ( $v [ " login " ]) . " </login> \n " ;
$str .= " <password> " . ( $v [ " encrypted_password " ]) . " </password> \n " ;
$str .= " <directory> " . ( $v [ " dir " ]) . " <directory> \n " ;
}
$str .= " </ftp> \n " ;
return $str ;
2012-08-26 16:11:53 +00:00
}
2015-09-25 15:42:00 +00:00
2017-10-06 21:42:39 +00:00
} /* Class m_ftp */
2015-09-25 15:42:00 +00:00