Permalink
Browse files

fix ftp home dir path for subdomains

  • Loading branch information...
andboson committed Aug 14, 2013
1 parent b0fe345 commit af7ec2784951827f13d0579c1225c205c54b8cc5
Showing with 15 additions and 0 deletions.
  1. +8 −0 modules/ftp_management/code/controller.ext.php
  2. +7 −0 modules/ftp_management/code/proftpd.php
View
@@ -158,6 +158,7 @@ static function ExecuteCreateFTP($uid, $username, $password, $destination, $doma
global $zdbh;
global $controller;
$currentuser = ctrl_users::GetUserDetail($uid);
runtime_hook::Execute('OnBeforeCreateFTPAccount');
if (fs_director::CheckForEmptyValue(self::CheckForErrors($username, $password))) {
// Check to see if its a new home directory or use a current one...
@@ -172,6 +173,13 @@ static function ExecuteCreateFTP($uid, $username, $password, $destination, $doma
} else {
$homedirectory_to_use = '/' . $destination;
}
// andboson: fix for exists domain
if ( $domainDestination ){
$homedirectory_to_use = ctrl_options::GetSystemOption('hosted_dir') . '/zadmin/'.$domainDestination;
}
$sql = $zdbh->prepare("INSERT INTO x_ftpaccounts (ft_acc_fk, ft_user_vc, ft_directory_vc, ft_access_vc, ft_password_vc, ft_created_ts) VALUES (:userid, :username, :homedir, :accesstype, :password, :time)");
$sql->bindParam(':userid', $currentuser['userid']);
$sql->bindParam(':username', $username);
View
@@ -34,9 +34,16 @@
}
// Included after acount has been created
if (!fs_director::CheckForEmptyValue(self::$create)) {
$homedir = ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . $homedirectoy_to_use . "";
// andboson: fix for exists domain
if( $domainDestination){
$homedir = $homedirectory_to_use;
}
$sql = $ftp_db->prepare("INSERT INTO ftpquotalimits (name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail) VALUES (:username, 'user', 'true', 'hard', 0, 0, 0, 0, 0, 0);");
$sql->bindParam(':username', $username);
$sql->execute();

0 comments on commit af7ec27

Please sign in to comment.