Пример #1
0
     header("location: " . $returnurl . "&edit=" . $rowclients['ac_id_pk'] . "");
     exit;
 }
 if (isset($_POST['inDelete_' . $rowclients['ac_id_pk']])) {
     # Log the action in the database...
     TriggerLog($useraccount['ac_id_pk'], $b = "User account ID: " . $rowclients['ac_id_pk'] . " requested for deletion.");
     # Delete all cron jobs
     $sql = "SELECT * FROM z_cronjobs WHERE ct_acc_fk=" . $rowclients['ac_id_pk'] . " AND ct_deleted_ts IS NULL";
     $listcronjobs = DataExchange("r", $z_db_name, $sql);
     $rowcronjobs = mysql_fetch_assoc($listcronjobs);
     $totalRows_cronjobs = DataExchange("t", $z_db_name, $sql);
     $total_deleted = 0;
     if ($totalRows_cronjobs > 0) {
         do {
             # Go through and delete each entry from the crontab file for the user!
             zapi_cronjob_remove(GetSystemOption('cron_file'), $rowcronjobs['ct_id_pk']);
             $total_deleted = $total_deleted + 1;
         } while ($rowcronjobs = mysql_fetch_assoc($listcronjobs));
     }
     $sql = "UPDATE z_cronjobs SET ct_deleted_ts=" . time() . " WHERE ct_acc_fk=" . $rowclients['ac_id_pk'] . " AND ct_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 Crontasks)  has been deleted!");
     # Delete all mailboxes
     $sql = "SELECT * FROM z_mailboxes WHERE mb_acc_fk=" . $rowclients['ac_id_pk'] . " AND mb_deleted_ts IS NULL";
     $listmailboxes = DataExchange("r", $z_db_name, $sql);
     $rowmailboxes = mysql_fetch_assoc($listmailboxes);
     $totalRows_mailboxes = DataExchange("t", $z_db_name, $sql);
     $total_deleted = 0;
     if ($totalRows_mailboxes > 0) {
         do {
             # Go through and delete each entry from the hmailserver database!
Пример #2
0
        DataExchange("w", $z_db_name, $sql);
        TriggerLog($useraccount['ac_id_pk'], $b = "Was unable to write to the crontab file (" . GetSystemOption('cron_file') . "), check that the file is not read-only and that the file path in the ZPanel settings is correct.");
        header("location: " . GetNormalModuleURL($returnurl) . "&r=error");
        exit;
    }
    # Now we add some infomation to the system log.
    TriggerLog($useraccount['ac_id_pk'], $b = "New cron job has been added by user (" . Cleaner('i', $_POST['inScript']) . ")\rDescription:-\r" . Cleaner('i', $_POST['inDescription']) . "");
    header("location: " . GetNormalModuleURL($returnurl) . "&r=ok");
    exit;
}
if ($_POST['inAction'] == 'delete') {
    # User has choosen to delete the task...
    do {
        if (isset($_POST['inDelete_' . $rowtasks['ct_id_pk']])) {
            # Call the API function!
            $api_resault = zapi_cronjob_remove(GetSystemOption('cron_file'), $rowtasks['ct_id_pk']);
            if ($api_resault == false) {
                # The cronjob was not deleted for some reason!
                TriggerLog($useraccount['ac_id_pk'], $b = "Was unable to write to the crontab file (" . GetSystemOption('cron_file') . "), check that the file is not read-only and that the file path in the ZPanel settings is correct.");
                header("location: " . GetNormalModuleURL($returnurl) . "&r=error");
                exit;
            }
            # Do all other account deleted related stuff here!!!
            $sql = "UPDATE z_cronjobs SET ct_deleted_ts=" . time() . " WHERE ct_id_pk=" . $rowtasks['ct_id_pk'] . "";
            DataExchange("w", $z_db_name, $sql);
            # Log the action in the database...
            TriggerLog($useraccount['ac_id_pk'], $b = "User cron job ID: " . $rowtasks['ct_id_pk'] . " was deleted.");
        }
    } while ($rowtasks = mysql_fetch_assoc($listtasks));
    header("location: " . GetNormalModuleURL($returnurl) . "&r=ok");
    exit;