Пример #1
0
        }
        $ds->DbfTransactionStart();
        // check for attached files
        if (DBF_TYPE == "mssql" or DBF_TYPE == "ado_mssql" or DBF_TYPE == "odbc_mssql") {
            $result =& $ds->ds->Execute("SELECT ipaddr\n                FROM ipaddradd\n                WHERE baseindex={$baseindextmp} AND datalength(infobin) != 0");
        } else {
            $result =& $ds->ds->Execute("SELECT ipaddr\n                FROM ipaddradd\n                WHERE baseindex={$baseindextmp} AND " . $ds->ds->length . "(infobin) != 0");
        }
        $files = 0;
        while ($rowadd = $result->FetchRow()) {
            insert($w, textbr(sprintf(my_("IP address %s has files attached"), inet_ntoa($rowadd["ipaddr"]))));
            $files++;
        }
        // only delete if there are no files attached
        if ($files == 0) {
            if ($ds->DeleteSubnet($baseindextmp)) {
                $ds->AuditLog(array("event" => 172, "action" => "delete subnet", "user" => getAuthUsername(), "baseaddr" => $baseip, "size" => $size, "cust" => $cust));
                $ds->DbfTransactionEnd();
                insert($w, textbr(sprintf(my_("Subnet %s deleted"), $baseip)));
            } else {
                insert($w, textbr(sprintf(my_("Subnet %s could not be deleted"), $baseip)));
            }
        } else {
            insert($w, textbr(sprintf(my_("Subnet %s could not be deleted - there are files attached"), $baseip)));
        }
    }
} else {
    if ($action == "split" or $action == "join") {
        // check if user belongs to customer admin group
        $result = $ds->GetCustomerGrp($cust);
        // can only be one row - does not matter if nothing is