Fixed Status FTP Account Bug - Shouldn't Apply to Custom Accounts

This commit is contained in:
earnolmartin 2019-09-12 22:44:43 -06:00
parent 5758219d9a
commit b9e5955da6

View file

@ -9018,15 +9018,23 @@ function editFtpUser(){
return $this->errorText("This FTP account is not owned by your account."); return $this->errorText("This FTP account is not owned by your account.");
} }
$sql = "select * from ".$this->conf['ftpuserstable']['tablename']." where ftpusername='$ftpusername'";
if(!$this->isadmin()){
$sql .= " AND panelusername " . $inClause;
}
$ftp=$this->query($sql);
if(!$_insert){ if(!$_insert){
$inputparams=array( $inputparams = array();
array('status','select','lefttext'=>'Set Active/Passive','secenekler'=>$this->statusActivePassive),
#array('status','lefttext'=>'Set Active/Passive'), if($ftp != false && !empty($ftp) && !empty($ftp['status'])){
array('newpass','password','lefttext'=>'New Password: (leave empty for no change)'), $inputparams[] = array('status','select','lefttext'=>'Set Active/Passive','secenekler'=>$this->statusActivePassive);
array('newpass2','password', 'lefttext'=>'Enter Password Again:'), }
array('ftpusername','hidden','default'=>$ftpusername, 'lefttext'=>'FTP Username:'),
array('op','hidden','default'=>__FUNCTION__) $inputparams[] = array('newpass','password','lefttext'=>'New Password: (leave empty for no change)');
); $inputparams[] = array('newpass2','password', 'lefttext'=>'Enter Password Again:');
$inputparams[] = array('ftpusername','hidden','default'=>$ftpusername, 'lefttext'=>'FTP Username:');
$inputparams[] = array('op','hidden','default'=>__FUNCTION__);
$this->output.="Changing FTP User: $ftpusername <br>".inputform5($inputparams); $this->output.="Changing FTP User: $ftpusername <br>".inputform5($inputparams);
@ -9041,9 +9049,18 @@ function editFtpUser(){
$passwordset=", password=password('$newpass') "; $passwordset=", password=password('$newpass') ";
} }
$sql = "update ".$this->conf['ftpuserstable']['tablename']." SET ftpusername = '" . $ftpusername . "' $passwordset";
if(isset($status) && !empty($status)){
$sql .= ", status='$status'";
}
$sql .= " where $filt";
$success=$success && $this->executeQuery($sql);
$success=$success && $this->executeQuery("update ".$this->conf['ftpuserstable']['tablename']." set status='$status' $passwordset where $filt"); // Only update status if we actually used it
if(isset($status) && !empty($status)){
$success=$success && $this->addDaemonOp("daemonftp",$status,$this->conf['vhosts'].'/'.$ftpusername); $success=$success && $this->addDaemonOp("daemonftp",$status,$this->conf['vhosts'].'/'.$ftpusername);
}
$success=$success && $this->addDaemonOp('syncftp','','','','sync ftp for nonstandard homes'); $success=$success && $this->addDaemonOp('syncftp','','','','sync ftp for nonstandard homes');
$this->ok_err_text($success,'FTP account was successfully modified.','Failed to modify FTP account.'); $this->ok_err_text($success,'FTP account was successfully modified.','Failed to modify FTP account.');