Esempio n. 1
0
 $result = $ds->GetCustomerGrp($cust);
 // can only be one row - does not matter if nothing is
 // found as array search will return false
 $row = $result->FetchRow();
 if (!in_array($row["admingrp"], $grps)) {
     myError($w, $p, my_("You may not delete dns records as you are not a member of the customers admin group"));
 }
 // Log the Transaction.
 $ds->DbfTransactionStart();
 foreach ($dataid as $value) {
     // missing records will just get ignored
     if ($row = $ds->ds->GetRow("SELECT recidx, error_message, ip_hostname, host\n            FROM fwdzonerec \n            WHERE customer={$cust} AND recidx=" . $value)) {
         // update IP record if deleting auto A record
         if ($row["error_message"] == "A") {
             // found a subnet? Maybe it has been deleted!
             if ($result = $ds->GetBaseFromIp(inet_aton($row["ip_hostname"]), $cust)) {
                 $row1 = $result->FetchRow();
                 $baseindex = $row1["baseindex"];
                 $ds->ds->Execute("UPDATE ipaddr\n                            SET hname=" . $ds->ds->qstr($row["host"]) . "\n                            WHERE baseindex={$baseindex} AND ipaddr=" . inet_aton($row["ip_hostname"]));
                 insert($w, textbr(sprintf(my_("IP record %s updated in subnet '%s' due to deletion of auto created A record"), $row["ip_hostname"], $row1["descrip"])));
             }
         }
         $result =& $ds->ds->Execute("DELETE FROM fwdzonerec \n                    WHERE customer={$cust} AND recidx={$value}") and $ds->ds->Execute("UPDATE fwdzone \n                    SET error_message=" . $ds->ds->qstr("E") . ",\n                    lastmod=" . $ds->ds->DBTimeStamp(time()) . " WHERE customer={$cust} AND data_id=" . $dom_id) and $ds->AuditLog(array("event" => 120, "action" => "delete zone record", "cust" => $cust, "user" => getAuthUsername(), "id" => $value));
     }
 }
 $ds->DbfTransactionEnd();
 if ($result) {
     $ds->DbfTransactionEnd();
     insert($w, textbr(my_("Domain DNS Record Deleted.")));
     $zone = "";
 } else {