static function ExecuteResetPassword($ft_id_pk, $password) { global $zdbh; global $controller; // Verify if Current user can Edit FTP Account. $currentuser = ctrl_users::GetUserDetail($uid); $sql = "SELECT * FROM x_ftpaccounts WHERE ft_acc_fk=:userid AND ft_id_pk=:editedUsrID AND ft_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':userid', $currentuser['userid']); $numrows->bindParam(':editedUsrID', $ft_id_pk); $numrows->execute(); if ($numrows->rowCount() == 0) { return; } // Change User Password runtime_hook::Execute('OnBeforeResetFTPPassword'); $rowftpsql = "SELECT * FROM x_ftpaccounts WHERE ft_id_pk=:ftIdPk"; $rowftpfind = $zdbh->prepare($rowftpsql); $rowftpfind->bindParam(':ftIdPk', $ft_id_pk); $rowftpfind->execute(); $rowftp = $rowftpfind->fetch(); $sql = $zdbh->prepare("UPDATE x_ftpaccounts SET ft_password_vc=:password WHERE ft_id_pk=:ftpid"); $sql->bindParam(':password', $password); $sql->bindParam(':ftpid', $ft_id_pk); $sql->execute(); self::$reset = true; // Include FTP server specific file here. $FtpModuleFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('ftp_php'); if (file_exists($FtpModuleFile)) { include $FtpModuleFile; } $retval = TRUE; runtime_hook::Execute('OnAfterResetFTPPassword'); return $retval; }
static function ResetAll() { global $zdbh; global $controller; $vhosts = array(); $numrecords = 0; //Get a list of current domains with records $sql = "SELECT COUNT(*) FROM x_dns WHERE dn_deleted_ts IS NULL"; if ($numrows = $zdbh->query($sql)) { if ($numrows->fetchColumn() != 0) { $sql = $zdbh->prepare("SELECT * FROM x_dns WHERE dn_deleted_ts IS NULL GROUP BY dn_vhost_fk"); $sql->execute(); while ($row = $sql->fetch()) { $vhosts[] = $row['dn_vhost_fk']; $numrecords++; } } } self::$reset = $numrecords; //Delete current records self::DeleteAll(); //Create Default Records foreach ($vhosts as $vhost) { self::CreateDefaultRecords($vhost); } }
static function ExecuteResetPassword($ft_id_pk, $password) { global $zdbh; global $controller; runtime_hook::Execute('OnBeforeResetFTPPassword'); $rowftpsql = "SELECT * FROM x_ftpaccounts WHERE ft_id_pk=:ftIdPk"; $rowftpfind = $zdbh->prepare($rowftpsql); $rowftpfind->bindParam(':ftIdPk', $ft_id_pk); $rowftpfind->execute(); $rowftp = $rowftpfind->fetch(); $sql = $zdbh->prepare("UPDATE x_ftpaccounts SET ft_password_vc=:password WHERE ft_id_pk=:ftpid"); $sql->bindParam(':password', $password); $sql->bindParam(':ftpid', $ft_id_pk); $sql->execute(); self::$reset = true; // Include FTP server specific file here. $FtpModuleFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('ftp_php'); if (file_exists($FtpModuleFile)) { include $FtpModuleFile; } $retval = TRUE; runtime_hook::Execute('OnAfterResetFTPPassword'); return $retval; }