Example #1
0
                    if ($api_resault == false) {
                        # The FTP account was not deleted for some reason.
                        TriggerLog($useraccount['ac_id_pk'], $b = "FTP user (" . $rowftpaccounts['ft_user_vc'] . ") could not be fully deleted.");
                    } else {
                        TriggerLog($useraccount['ac_id_pk'], $b = "FTP user (" . $rowftpaccounts['ft_user_vc'] . ") has been deleted.");
                        #$reboot = system($filezilla_reload);
                    }
                    $total_deleted = $total_deleted + 1;
                } while ($rowftpaccounts = mysql_fetch_assoc($listftpaccounts));
                # Then obviously we should go and reload FileZilla's configuration.... Due to removal of FTP accounts!
            }
            $sql = "UPDATE z_ftpaccounts SET ft_deleted_ts=" . time() . " WHERE ft_acc_fk=" . $rowclients['ac_id_pk'] . " AND ft_deleted_ts IS NULL";
            DataExchange("w", $z_db_name, $sql);
            TriggerLog($useraccount['ac_id_pk'], $b = "User account ID: " . $rowclients['ac_id_pk'] . " (" . $total_deleted . "x FTP accounts)  has been deleted!");
            # Delete the user's home directory!
            zapi_filesystem_remove(GetSystemOption('hosted_dir') . $rowclients['ac_user_vc'] . "/");
            TriggerLog($useraccount['ac_id_pk'], $b = "User account ID: " . $rowclients['ac_id_pk'] . " (Home directory and contents for \"" . $rowclients['ac_user_vc'] . "\")  has been deleted!");
            # Delete the user's ZPanel login account
            $sql = "UPDATE z_accounts SET ac_deleted_ts=" . time() . " WHERE ac_id_pk=" . $rowclients['ac_id_pk'] . "";
            $packageid = DataExchange("w", $z_db_name, $sql);
            TriggerLog($useraccount['ac_id_pk'], $b = "User account ID: " . $rowclients['ac_id_pk'] . " (ZPanel login account \"" . $rowclients['ac_user_vc'] . "\")  has been deleted!");
            TriggerLog($useraccount['ac_id_pk'], $b = "User account ID: " . $rowclients['ac_id_pk'] . " has been deleted!");
        }
    } while ($rowclients = mysql_fetch_assoc($listclients));
    header("location: " . GetNormalModuleURL($returnurl) . "&r=ok");
    exit;
}
# We reload the FTP server here as there will be the requirement to do so...
if (ShowServerPlatform() == "Windows") {
    $filezilla_reload = GetSystemOption('filezilla_root') . "FileZilla server.exe /reload-config";
} else {
Example #2
0
         if (ShowServerPlatform() == 'Windows') {
             # Lets now go and try removing the domain from hMailServer (if configured in the ZPanel system settings:-
             $hmaildatabase = GetSystemOption('hmailserver_db');
             if (GetSystemOption('hmailserver_db') != "") {
                 # Lets delete all hMailServer accounts...
                 $sql = "SELECT domainid FROM hm_domains WHERE domainname='" . $rowdomains['vh_name_vc'] . "'";
                 $hmdomainid = DataExchange("l", $hmaildatabase, $sql);
                 $hmisdomain = DataExchange("t", $hmaildatabase, $sql);
                 $domain_id = $hmdomainid['domainid'];
                 # Lets delete the domain (if it exists in the hMailServer database....
                 if ($hmisdomain > 0) {
                     # Delete the domain now...
                     $sql = "DELETE FROM hm_domains WHERE domainid=" . $domain_id . "";
                     DataExchange("w", $hmaildatabase, $sql);
                     zapi_filesystem_remove("C:/Zpanel/bin/hmailserver/Data/" . $rowdomains['vh_name_vc'] . "/");
                     zapi_filesystem_remove("C:/Program Files/hMailServer/Data/" . $rowdomains['vh_name_vc'] . "/");
                 }
             }
         } else {
             # Now we delete the domain from the Postfix database.
             $postfixdatabase = GetSystemOption('hmailserver_db');
             $sql = "DELETE FROM domain WHERE domain = '" . $rowdomains['vh_name_vc'] . "'";
             DataExchange("w", $postfixdatabase, $sql);
         }
         # Remove the domain from the MySQL database now..
         $sql = "UPDATE z_vhosts SET vh_deleted_ts=" . time() . " WHERE vh_id_pk=" . $rowdomains['vh_id_pk'] . "";
         DataExchange("w", $z_db_name, $sql);
     }
 } while ($rowdomains = mysql_fetch_assoc($listdomains));
 header("location: " . GetNormalModuleURL($returnurl) . "&r=ok");
 exit;