Apache-DnsZone

 view release on metacpan or  search on metacpan

lib/Apache/DnsZone.pm  view on Meta::CPAN

    my $query = $res->res->query($domain, "SOA");
    my $rr = ($query->answer)[0];
    return $rr->serial;
}

##############################################################
# update_serial(domain_id)                                   #
# updates zone serial in db from serial taken from real zone #
##############################################################

sub update_serial ($) {
    my $domain_id = shift;
    Debug(5, qq{update_serial($domain_id) called\n});
    my $serial = get_serial_from_zone($domain_id);
    $dbh->update_serial_soa($domain_id, $serial);
}

######################################
# check_ttl(ttl)                     #
# checks for ttl to be an int of > 0 #
######################################

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    
    my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
    $sth_password_update->execute($password, $uid);
    $sth_password_update->finish();

    return 1;
}

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

}

sub view_domain_TXT_prepare {
    my $self = shift;
    my $dom_id = shift;
    my $sth = $self->{'dbh'}->prepare("select id, name, txtdata, ttl, rec_lock from records_TXT where domain = ?");
    $sth->execute($dom_id);
    return $sth;
}

sub update_serial_soa {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_serial_soa called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update soa set serial = ? where domain = ?");
	$sth->execute($serial, $domain_id);
	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::update_SOA failed: $@});
	return 0;
    }
    return 1;
}

sub update_SOA {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    my $soa_email = shift;
    my $refresh = shift;
    my $retry = shift;
    my $expire = shift;
    my $default_ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_SOA called});
    eval {

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->execute($domain_id, $name, $ip, $ttl);
	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_A failed: $@});
	return 0;
    }
    return 1;
}

sub update_A {
    my $self = shift;
    my $domain_id = shift;
    my $a_id = shift;
    my $name = shift;
    my $ip = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_A called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_A set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ip, $ttl, $a_id, $domain_id);

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->execute($domain_id, $name, $address, $ttl);
	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_AAAA failed: $@});
	return 0;
    }
    return 1;
}

sub update_AAAA {
    my $self = shift;
    my $domain_id = shift;
    my $aaaa_id = shift;
    my $name = shift;
    my $address = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_AAAA called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_AAAA set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $address, $ttl, $aaaa_id, $domain_id);

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_CNAME failed: $@});
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_CNAME {
    my $self = shift;
    my $domain_id = shift;
    my $cname_id = shift;
    my $name = shift;
    my $cname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_CNAME called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_CNAME set name = ?, cname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $cname, $ttl, $cname_id, $domain_id);

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_MX failed: $@});
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_MX {
    my $self = shift;
    my $domain_id = shift;
    my $mx_id = shift;
    my $name = shift;
    my $exchanger = shift;
    my $preference = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_MX called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_MX set name = ?, exchanger = ?, preference = ?, ttl = ? where id = ? and domain = ?");

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_NS failed: $@});
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_NS {
    my $self = shift;
    my $domain_id = shift;
    my $ns_id = shift;
    my $name = shift;
    my $ns = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_NS called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_NS set name = ?, nsdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ns, $ttl, $ns_id, $domain_id);

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_PTR failed: $@});
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_PTR {
    my $self = shift;
    my $domain_id = shift;
    my $ptr_id = shift;
    my $name = shift;
    my $ptrdname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_PTR called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_PTR set name = ?, ptrdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ptrdname, $ttl, $ptr_id, $domain_id);

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	$sth->finish();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_TXT failed: $@});
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_TXT {
    my $self = shift;
    my $domain_id = shift;
    my $txt_id = shift;
    my $name = shift;
    my $txt = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_TXT called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_TXT set name = ?, txtdata = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $txt, $ttl, $txt_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth_password_update->execute($password, $uid);
	$sth_password_update->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

}

sub view_domain_TXT_prepare {
    my $self = shift;
    my $dom_id = shift;
    my $sth = $self->{'dbh'}->prepare("select id, name, txtdata, ttl, rec_lock from records_TXT where domain = ?");
    $sth->execute($dom_id);
    return $sth;
}

sub update_serial_soa {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_serial_soa called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update soa set serial = ? where domain = ?");
	$sth->execute($serial, $domain_id);
	$sth->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::update_SOA failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_SOA {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    my $soa_email = shift;
    my $refresh = shift;
    my $retry = shift;
    my $expire = shift;
    my $default_ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_SOA called});
    eval {

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_A failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_A {
    my $self = shift;
    my $domain_id = shift;
    my $a_id = shift;
    my $name = shift;
    my $ip = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_A called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_A set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ip, $ttl, $a_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_AAAA failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_AAAA {
    my $self = shift;
    my $domain_id = shift;
    my $aaaa_id = shift;
    my $name = shift;
    my $address = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_AAAA called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_AAAA set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $address, $ttl, $aaaa_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_CNAME failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_CNAME {
    my $self = shift;
    my $domain_id = shift;
    my $cname_id = shift;
    my $name = shift;
    my $cname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_CNAME called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_CNAME set name = ?, cname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $cname, $ttl, $cname_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_MX failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_MX {
    my $self = shift;
    my $domain_id = shift;
    my $mx_id = shift;
    my $name = shift;
    my $exchanger = shift;
    my $preference = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_MX called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_MX set name = ?, exchanger = ?, preference = ?, ttl = ? where id = ? and domain = ?");

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_NS failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_NS {
    my $self = shift;
    my $domain_id = shift;
    my $ns_id = shift;
    my $name = shift;
    my $ns = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_NS called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_NS set name = ?, nsdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ns, $ttl, $ns_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_PTR failed: $@});
        $self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_PTR {
    my $self = shift;
    my $domain_id = shift;
    my $ptr_id = shift;
    my $name = shift;
    my $ptrdname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_PTR called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_PTR set name = ?, ptrdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ptrdname, $ttl, $ptr_id, $domain_id);

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_TXT failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_TXT {
    my $self = shift;
    my $domain_id = shift;
    my $txt_id = shift;
    my $name = shift;
    my $txt = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_TXT called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_TXT set name = ?, txtdata = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $txt, $ttl, $txt_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth_password_update->execute($password, $uid);
	$sth_password_update->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

}

sub view_domain_TXT_prepare {
    my $self = shift;
    my $dom_id = shift;
    my $sth = $self->{'dbh'}->prepare("select id, name, txtdata, ttl, rec_lock from records_TXT where domain = ?");
    $sth->execute($dom_id);
    return $sth;
}

sub update_serial_soa {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_serial_soa called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update soa set serial = ? where domain = ?");
	$sth->execute($serial, $domain_id);
	$sth->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::update_SOA failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_SOA {
    my $self = shift;
    my $domain_id = shift;
    my $serial = shift;
    my $soa_email = shift;
    my $refresh = shift;
    my $retry = shift;
    my $expire = shift;
    my $default_ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_SOA called});
    eval {

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_A failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_A {
    my $self = shift;
    my $domain_id = shift;
    my $a_id = shift;
    my $name = shift;
    my $ip = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_A called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_A set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ip, $ttl, $a_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

	$self->{'dbh'}->commit();
    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_AAAA failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub update_AAAA {
    my $self = shift;
    my $domain_id = shift;
    my $aaaa_id = shift;
    my $name = shift;
    my $address = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_AAAA called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_AAAA set name = ?, address = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $address, $ttl, $aaaa_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_CNAME failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_CNAME {
    my $self = shift;
    my $domain_id = shift;
    my $cname_id = shift;
    my $name = shift;
    my $cname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_CNAME called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_CNAME set name = ?, cname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $cname, $ttl, $cname_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_MX failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_MX {
    my $self = shift;
    my $domain_id = shift;
    my $mx_id = shift;
    my $name = shift;
    my $exchanger = shift;
    my $preference = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_MX called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_MX set name = ?, exchanger = ?, preference = ?, ttl = ? where id = ? and domain = ?");

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_NS failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_NS {
    my $self = shift;
    my $domain_id = shift;
    my $ns_id = shift;
    my $name = shift;
    my $ns = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_NS called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_NS set name = ?, nsdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ns, $ttl, $ns_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_PTR failed: $@});
        $self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_PTR {
    my $self = shift;
    my $domain_id = shift;
    my $ptr_id = shift;
    my $name = shift;
    my $ptrdname = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_PTR called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_PTR set name = ?, ptrdname = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $ptrdname, $ttl, $ptr_id, $domain_id);

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

    };
    if ($@) {
        Apache::DnsZone::Debug(1, qq{Apache::DnsZone::DB::set_TXT failed: $@});
	$self->{'dbh'}->rollback();
	return 0;
    }
    Apache::DnsZone::update_serial($domain_id);
    return 1;
}

sub update_TXT {
    my $self = shift;
    my $domain_id = shift;
    my $txt_id = shift;
    my $name = shift;
    my $txt = shift;
    my $ttl = shift;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::DB::update_TXT called});
    eval {
	my $sth = $self->{'dbh'}->prepare("update records_TXT set name = ?, txtdata = ?, ttl = ? where id = ? and domain = ?");
	$sth->execute($name, $txt, $ttl, $txt_id, $domain_id);



( run in 0.451 second using v1.01-cache-2.11-cpan-95122f20152 )