Esempio n. 1
0
/** Retrieve all records by a given type and domain id
 *
 * Example get all records that are of type A from domain id 1
 *
 * <code>
 * get_records_by_type_from_domid('A', 1)
 * </code>
 *
 * @param string $type Record type
 * @param int $recid Record ID
 *
 * @return object a DB class result object
 */
function get_records_by_type_from_domid($type, $recid)
{
    global $rtypes;
    global $db;
    // Does this type exist?
    if (!in_array(strtoupper($type), $rtypes)) {
        error(sprintf(ERR_INV_ARGC, "get_records_from_type", "this is not a supported record"));
    }
    // Get the domain id.
    $domid = recid_to_domid($recid);
    $result = $db->query("select id, type from records where domain_id=" . $db->quote($recid, 'integer') . " and type=" . $db->quote($type, 'text'));
    return $result;
}
}
$user_is_zone_owner = verify_user_is_owner_zoneid($zid);
$zone_info = get_zone_info_from_id($zid);
if ($record_id == "-1") {
    error(ERR_INV_INPUT);
} else {
    if ($confirm == '1') {
        if (delete_record($record_id)) {
            success("<a href=\"edit.php?id=" . $zid . "\">" . SUC_RECORD_DEL . "</a>");
            /*
            update serial after record deletion
            */
            update_soa_serial($zid);
        }
    } else {
        $zone_id = recid_to_domid($record_id);
        $zone_name = get_zone_name_from_id($zone_id);
        $user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
        $record_info = get_record_from_id($record_id);
        echo "     <h2>" . _('Delete record in zone') . " \"<a href=\"edit.php?id=" . $zid . "\">" . $zone_name . "</a>\"</h2>\n";
        if ($zone_info['type'] == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") {
            error(ERR_PERM_EDIT_RECORD);
        } else {
            echo "     <table>\n";
            echo "      <tr>\n";
            echo "       <th>Name</th>\n";
            echo "       <th>Type</th>\n";
            echo "       <th>Content</th>\n";
            if (isset($record_info['priority'])) {
                echo "       <th>Priority</th>\n";
            }