Apache-DnsZone

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lang/README.lang
lang/br.lang
lang/dk.lang
lang/en.lang
lang/de.lang
lang/fr.lang
lang/it.lang
lang/se.lang
README
TODO
templates/standard/a/edit.tpl
templates/standard/a/add.tpl
templates/standard/a/remove.tpl
templates/standard/aaaa/edit.tpl
templates/standard/aaaa/add.tpl
templates/standard/aaaa/remove.tpl
templates/standard/layout.tpl
templates/standard/cname/edit.tpl
templates/standard/cname/add.tpl
templates/standard/cname/remove.tpl
templates/standard/view_domain.tpl
templates/standard/list_domain.tpl
templates/standard/soa/edit.tpl
templates/standard/ns/edit.tpl
templates/standard/ns/remove.tpl
templates/standard/ns/add.tpl
templates/standard/ptr/edit.tpl
templates/standard/ptr/add.tpl
templates/standard/ptr/remove.tpl
templates/standard/txt/edit.tpl
templates/standard/txt/remove.tpl
templates/standard/txt/add.tpl
templates/standard/mx/edit.tpl
templates/standard/mx/remove.tpl
templates/standard/mx/add.tpl
templates/standard/help.tpl
templates/standard/menu.tpl
templates/standard/settings.tpl
templates/standard/list_domain_record.tpl
templates/standard/login.tpl
templates/standard/view_domain/a.tpl
templates/standard/view_domain/a_record.tpl
templates/standard/view_domain/aaaa.tpl

TODO  view on Meta::CPAN

[In version 2.0] Sync feature? Have the interface perform a zone transfer (if you have more hosts to update from)
[In version 2.0] Multiuser on the same zone

[Won't fix in this version] Move away from using PerlSetVar's
[Won't fix in this version] Javascript to highlight login first field!

[Fixed] does ADD actually check (on submit) wheter the user has any more of that record type left?
[Fixed] Content-Length on all template based pages should be implemented. For allowing keep-alive $r->header_out("Content-Length", length(${$content_ref}));
[Fixed] when there's no records under a record, what does the template engine output? the wrong thing! when you DO have records left it should output the add thing, but if you don't have any records there and no allowed records it should parse RECORD...
[Fixed] all add pages have error handling now
[Fixed] all edit pages have error handling now 
[Fixed] Settings doesn't have a you-typed-something-wrong page yet
[Fixed] if there is an error in user input provide a window for people to enter the data again with fields marked red that needs the data again
[Fixed] on that: add templates need to be able to fill out the fields, otherwise it won't work
[Fixed] check_lang instead of using check_ttl (in sub settings)
[Fixed] clear out all references to HINFO
[Fixed] (output_headers+output_redirect) This implies that you NEED a function for handing out headers!  disable_caching($r) function? or maybe: output_header(Cache=>1)
[Fixed] . before @ in email? (SOA EDIT)
[Fixed] check_ip okay!
[Fixed] check_chars okay!
[Fixed] check_exchanger okay!

TODO  view on Meta::CPAN

[Fixed]   *.domain not provided for CNAME (doesn't work with any other *. record)(could be offered if we bother to check for other * records before + before adding other * records)
[Fixed]   *.domain not provided for NS (seems obvious not to use this)
[Fixed] Functions that use sql should be moved to Apache::DnsZone::DB::<db>
[Fixed] Can a preference be 0? (check_preference)
[Fixed] Allow more chars in check_txt?
[Fixed] Move around sql queries! so it might not be in the main file
[Fixed] functions to be implemented: (uid,email,lang_id,lang)get_user_info(username)(OK) (count)dom_count(uid)(OK) (lang_select)lang_select(uid, evt override lang_id)(OK) (1)update_password(uid, password)(OK) (domain, domain_owner_id)domain_stat?(dom...
[Fixed] all the (a|cname|mx|ns|txt)_lookup's have been made - why isn't the program using them? (MESSY!!!)
[Fixed] functions for the count(id)'s in mysql.pm?
[Fixed] list_domains need a way to prepare and get an executed statement handle back so the sql goes out of the function - along with view_domains
[Fixed] check_before*: return 1 if old eq new????? something is wrong with check_before_edit_MX|NS|TXT|A|CNAME
[Fixed] conflicts checking, rules:
[Fixed]   A, NS, MX, TXT can reside together.
[Fixed]   CNAME records can't have anything else associated with the same "name" not, A, NS, TXT, MX
[Fixed]   no .. in hostnames (checked for in check_host(fq-host))
[Fixed] already exsisting names? that need to be checked OFTEN! (maybe in check_*)
[Fixed] better checking on hosts (check_host|fqdn obviously doesn't work at all when you do anything that has an error in it)
[Fixed] Duplicate records || round robin! + database lookups
[Fixed] $DEBUG record in templates, for giving information about duplicate hostnames and bad hostnames/ips/whatever Call it $EXPLANATION?
[Fixed] Clean up after old header outputing stuff
[Fixed] Check wheter the "edit" submission is the changed at all
[Fixed] import scripts!
[Fixed] soa_locks? are soa locks enforced?
[Fixed] || Apache->request on all handlers
[Fixed] redo global vars shit! instead of $DnsZone::whatever, just have a global my $whatever
[Fixed] Ability to set a default language for login page? (DnsZoneLoginLang); Default login language!!
[Fixed] cookie stuff error codes in language files uc(cookiereturn)
[Fixed] Implement own Apache::AuthCookie derivate with templates! (use Apache::(AuthTicket|AuthCookieDBI) as examples)
[Fixed] TimeOut of cookie + 15 minute renewal of each cookie! If not done anything for the last 15 minutes and request another page => re-login; subclass of Apache::AuthCookie; Needs to take defaults from Apache::DnsZone::Config
[Fixed] Login template needs to be unfucked!
[Fixed] Maybe a layer above the menu system so that menus and stuff wont be on login page?
[Fixed] Template system outputter (so menu will only be shown on non-login page && list_domains (maybe even show all the domains you have in the url?))
[Fixed] logout?
[Fixed] is_updated_SOA? (Is SOA updated in edit submit request)
[Fixed] GET/POST where? POST => when submitting forms to avoid 4K limit
[Fixed] is_updated_* ttl eq and not == ?
[Fixed] which pages need caching and which don't? All pages should have caching turned off so no pages will be in cache if user is not authenticated
[Fixed] Settings, Logout, Menu, List domain texts! Menu with list_domains and settings and logout (if appropriate)
[Fixed] SSL - why would there be any issues with using ssl?
[Fixed] Login page language should use Accept-Language header if existing in the db otherwise the Login page language from the configuration. (Netscape can change this in preferences for navigator)
[Fixed] DnsZone::Debug needs to be worked on && export Debug from DnsZone.pm && get rid of DnsZone::Debug
[Fixed] Update SQL to include authentication tables
[Fixed] Install documentation
[Fixed] $VERSION in all files: ($VERSION) = qq$Revision: 1.23 $ =~ /([\d\.]+)/;

lang/en.lang  view on Meta::CPAN

		'ERROR_ZONE'        => 'Incorrect value for Zone',
		'ERROR_NS'          => 'Incorrect value for Nameserver',
		'ERROR_TXT'         => 'Incorrect value for Text',
		'ERROR_EMAIL'       => 'Incorrect value for E-mail',
		'ERROR_PASSWORD'    => 'Non-matching passwords',
		'ERROR_ADMIN_EMAIL' => 'Incorrect value for Administrative e-mail',
		'ERROR_REFRESH'     => 'Incorrect value for Refresh time',
		'ERROR_RETRY'       => 'Incorrect value for Retry time',
		'ERROR_EXPIRE'      => 'Incorrect value for Expire time',
		'FILLOUT_FIELDS'    => 'Please fill out the following fields:',
		'EDIT_FIELDS'       => 'Please edit fields:',
		'DELETE_RECORD'     => 'You are about to delete the following record:',
		'USERNAME'          => 'Username',
		'PASSWORD'          => 'Password',
		'LOGIN_BUTTON'      => 'Log In',
		'PAGE_LOGIN'        => 'Log In page',
		'LOGIN_NOTE'        => 'Note: Set your browser to accept cookies in order for login to succeed. You will be asked to log in again after some period of time.',
		'IDLE_TIMEOUT'      => 'Logout reason: Idle timeout',
		'MALFORMED_TICKET'  => 'Logout reason: Ticket malformed',
		'INVALID_HASH'      => 'Logout reason: Unknown ticket',
		'EXPIRED_TICKET'    => 'Logout reason: Ticket has expired',

lang/fr.lang  view on Meta::CPAN

#!/usr/bin/perl -w

# edited by khali@linux-fr.org (2001/03/24)
# $Id: fr.lang,v 1.6 2001/06/22 18:53:53 thomas Exp $

use strict;

sub lang () {
    my %text = (
		'SUBMIT'            => 'Confirmer',
		'CANCEL'            => 'Abandonner',
		'HELP'              => 'Aide',
		'EDIT'              => '&Eacute;diter',

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

    if ($dbh->is_duplicate_A($dom_id, $host, $address)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $host)) {
	return 0;
    }
    # no A record exists that has the same address, no CNAME record exists with the same name
    return 1;
}

sub check_before_edit_A {
    my $dom_id = shift;
    my $a_id = shift;
    my $new_host = shift;
    my $new_address = shift;
    Debug(5, qq{check_before_edit_A($dom_id, $a_id, $new_host, $new_address) called});
    my ($old_name, $old_address, $old_ttl) = $dbh->a_lookup($dom_id, $a_id);
    return 1 if $old_name eq $new_host && $old_address eq $new_address;
    if ($dbh->is_duplicate_A($dom_id, $new_host, $new_address)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    return 1;
}

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

    if ($dbh->is_duplicate_AAAA($dom_id, $host, $address)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $host)) {
	return 0;
    }
    # no A record exists that has the same address, no CNAME record exists with the same name
    return 1;
}

sub check_before_edit_AAAA {
    my $dom_id = shift;
    my $a_id = shift;
    my $new_host = shift;
    my $new_address = shift;
    Debug(5, qq{check_before_edit_AAAA($dom_id, $a_id, $new_host, $new_address) called});
    my ($old_name, $old_address, $old_ttl) = $dbh->aaaa_lookup($dom_id, $a_id);
    return 1 if $old_name eq $new_host && $old_address eq $new_address;
    if ($dbh->is_duplicate_AAAA($dom_id, $new_host, $new_address)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    return 1;
}

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

    }
    if ($dbh->does_NS_exist($dom_id, $host)) {
	return 0;
    }
    if ($dbh->does_TXT_exist($dom_id, $host)) {
	return 0;
    }
    return 1;
}

sub check_before_edit_CNAME {
    my $dom_id = shift;
    my $cname_id = shift;
    my $new_host = shift;
    my $new_cname = shift;
    Debug(5, qq{check_before_edit_CNAME($dom_id, $cname_id, $new_host, $new_cname) called});
    my ($old_host, $old_cname, $old_ttl) = $dbh->cname_lookup($dom_id, $cname_id);
    return 1 if $old_host eq $new_host && $old_cname eq $new_cname;
    return 1 if $old_host eq $new_host;
    if ($dbh->does_A_exist($dom_id, $new_host)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    if ($dbh->does_MX_exist($dom_id, $new_host)) {

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

    Debug(5, qq{check_before_add_MX($dom_id, $host, $exchanger, $preference) called});
    if ($dbh->is_duplicate_MX($dom_id, $host, $preference)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $host)) {
	return 0;
    }
    return 1;
}

sub check_before_edit_MX {
    my $dom_id = shift;
    my $mx_id = shift;
    my $new_host = shift;
    my $new_exchanger = shift;
    my $new_preference = shift;
    Debug(5, qq{check_before_edit_MX($dom_id, $mx_id, $new_host, $new_exchanger, $new_preference) called});
    my ($old_name, $old_exchanger, $old_preference, $old_ttl) = $dbh->mx_lookup($dom_id, $mx_id);
    return 1 if $old_name eq $new_host && $old_preference eq $new_preference;
    if ($dbh->is_duplicate_MX($dom_id, $new_host, $new_preference)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    return 1;
}

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

    Debug(5, qq{check_before_add_NS($dom_id, $host, $nsdname) called});
    if ($dbh->is_duplicate_NS($dom_id, $host, $nsdname)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $host)) {
	return 0;
    }
    return 1;
}

sub check_before_edit_NS {
    my $dom_id = shift;
    my $ns_id = shift;
    my $new_host = shift;
    my $new_ns = shift;
    Debug(5, qq{check_before_edit_NS($dom_id, $ns_id, $new_host, $new_ns) called});
    my ($old_name, $old_nameserver, $old_ttl) = $dbh->ns_lookup($dom_id, $ns_id);
    return 1 if $old_name eq $new_host && $old_nameserver eq $new_ns;
    if ($dbh->is_duplicate_NS($dom_id, $new_host, $new_ns)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    return 1;
}

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

    my $host = shift;
    my $reverse = shift;
    Debug(5, qq{check_before_add_PTR($dom_id, $host, $reverse) called});
    if ($dbh->is_duplicate_PTR($dom_id, $host, $reverse)) {
	return 0;
    }
    # no PTR record exists that has the same address
    return 1;
}

sub check_before_edit_PTR {
    my $dom_id = shift;
    my $ptr_id = shift;
    my $new_host = shift;
    my $new_reverse = shift;
    Debug(5, qq{check_before_edit_PTR($dom_id, $ptr_id, $new_host, $new_reverse) called});
    my ($old_name, $old_reverse, $old_ttl) = $dbh->ptr_lookup($dom_id, $ptr_id);
    return 1 if $old_name eq $new_host && $old_reverse eq $new_reverse;
    if ($dbh->is_duplicate_PTR($dom_id, $new_host, $new_reverse)) {
	return 0;
    }
    return 1;
}

sub is_updated_PTR {
    my $dom_id = shift;

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

    Debug(5, qq{check_before_add_TXT($dom_id, $host, $txt) called});
    if ($dbh->is_duplicate_TXT($dom_id, $host, $txt)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $host)) {
	return 0;
    }
    return 1;
}

sub check_before_edit_TXT {
    my $dom_id = shift;
    my $txt_id = shift;
    my $new_host = shift;
    my $new_txt = shift;
    Debug(5, qq{check_before_edit_TXT($dom_id, $txt_id, $new_host, $new_txt) called});
    my ($old_name, $old_txt, $old_ttl) = $dbh->txt_lookup($dom_id, $txt_id);
    return 1 if $old_name eq $new_host && $old_txt eq $new_txt;
    if ($dbh->is_duplicate_TXT($dom_id, $new_host, $new_txt)) {
	return 0;
    }
    if ($dbh->does_CNAME_exist($dom_id, $new_host)) {
	return 0;
    }
    return 1;
}

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

		return OK;
#	    } elsif ($button eq lc($lang{'HELP'})) {
#	        DnsZone::Debug(3, qq{pushing help() to PerlHandler (called from a pushed button)});
#		$r->push_handlers(PerlHandler => \&help);
#		return OK;
	    } 
	}
	if ($action eq 'view') {
	    Debug(3, qq{pushing view_domain() to PerlHandler});
	    $r->push_handlers(PerlHandler => \&view_domain);
	} elsif ($action eq 'edit') {
	    Debug(3, qq{pushing edit_record() to PerlHandler});
	    $r->push_handlers(PerlHandler => \&edit_record);
	} elsif ($action eq 'add') {
	    Debug(3, qq{pushing add_record() to PerlHandler});
	    $r->push_handlers(PerlHandler => \&add_record);
        } elsif ($action eq 'delete') {
  	    Debug(3, qq{pushing delete_record() to PerlHandler});
	    $r->push_handlers(PerlHandler => \&delete_record);
        } elsif ($action eq 'settings') {
  	    Debug(3, qq{pushing settings() to PerlHandler});
	    $r->push_handlers(PerlHandler => \&settings);
	} elsif ($action eq 'logout') {

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

    # is uid owner of dom_id
    my ($domain, $domain_owner_id) = $dbh->domain_stat($dom_id);
    unless (defined($domain_owner_id) && $uid == $domain_owner_id) {
	$r->log_reason("User trying to hijack another domain");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    # check for record_id & type
    unless (apr()->param('type')) {
	$r->log_reason("No type specified for edit");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    my $type = uc apr()->param('type');
    ($type) = ($type =~ /(\w+)/)[0];
    if ($type !~ /^\w+$/ || $type =~ /^SOA$/i) {
	$r->log_reason("User tried to supply bogus type data");
	output_redirect($r, 1, '/admin');
	$dbh->close();

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

    # is uid owner of dom_id
    my ($domain, $domain_owner_id) = $dbh->domain_stat($dom_id);
    unless (defined($domain_owner_id) && $uid == $domain_owner_id) {
	$r->log_reason("User trying to hijack another domain");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    # check for record_id & type
    unless (apr()->param('type')) {
	$r->log_reason("No type specified for edit");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    my $type = uc apr()->param('type');
    ($type) = ($type =~ /(\w+)/)[0];
    if ($type !~ /^\w+$/) {
	$r->log_reason("User tried to supply bogus type data");
	output_redirect($r, 1, '/admin');
	$dbh->close();

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


	output_headers($r, 1, length(${$content_ref}));

        $r->print(${$content_ref});	

        $dbh->close();
	return OK;
    }
}

sub edit_record {
    my $r = shift || Apache->request();
    Debug(3, qq{calling edit_record()});
    init($r);
    my $user = $r->connection->user;
    my ($uid, $email, $lang_id, $lang) = $dbh->get_user_info($user);

    # same as in view_domain() maybe a function should be built for this?
    if (!apr()->param('dom_id')) {
	$r->log_reason("No dom_id for this request: aborting");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;

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

    # is uid owner of dom_id
    my ($domain, $domain_owner_id) = $dbh->domain_stat($dom_id);
    unless (defined($domain_owner_id) && $uid == $domain_owner_id) {
	$r->log_reason("User trying to hijack another domain");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    # check for record_id & type
    unless (apr()->param('type')) {
	$r->log_reason("No type specified for edit");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }
    my $type = uc apr()->param('type');
    ($type) = ($type =~ /(\w+)/)[0];
    if ($type !~ /^\w+$/) {
	$r->log_reason("User tried to supply bogus type data");
	output_redirect($r, 1, '/admin');
	$dbh->close();

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

	else { $rec_lock = 1; }
    }
    if ($rec_lock) {
	$r->log_reason("User tried to change a locked record");
	output_redirect($r, 1, '/admin');
	$dbh->close();
	return REDIRECT;
    }

    if (apr()->param('button') && lc(apr()->param('button')) eq lc($lang{'SUBMIT'})) {
        Debug(5, qq{This is a submit of edit_record request});
	for ($type) {
	    if (/^SOA$/) { 
		my $soa_email = apr()->param('soa_email');
		my $refresh = apr()->param('refresh');
		my $retry = apr()->param('retry');
		my $expire = apr()->param('expire');
		my $default_ttl = apr()->param('default_ttl');
		my $all_set = 1;
		if (!(check_ttl($refresh) && check_ttl($retry) && check_ttl($expire) && check_ttl($default_ttl))) {
		    $all_set = 0;

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'soa/edit.tpl');
		    $tpl->assign(ADMIN_EMAIL_VALUE => encode_entities(apr()->param('soa_email')));
		    $tpl->assign(REFRESH_VALUE => encode_entities(apr()->param('refresh')));
		    $tpl->assign(RETRY_VALUE => encode_entities(apr()->param('retry')));
		    $tpl->assign(EXPIRE_VALUE => encode_entities(apr()->param('expire')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('default_ttl')));
		    
		    my ($auth_ns, $serial) = $dbh->get_authns_serial($dom_id);

		    $tpl->assign(AUTH_NS_VALUE => $auth_ns);
		    $tpl->assign(SERIAL_VALUE => $serial);

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

		    $all_set = 0;
		}
		my $host = "";
		if (!($host = check_fqdn(apr()->param('host'), $domain))) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_A($dom_id, $record_id, $host, $ip)) {
		    # update dns! and sql
		    # check wheter name is the same? so no need for update?
		    
		    # check wheter an excact copy exists in dns to avoid errors
		    if (is_updated_A($dom_id, $record_id, $host, $ip, $ttl)) {
			if (dns_update_A($dom_id, $record_id, $host, $ip, $ttl)) {
			    Debug(2, qq{dns_update_A succeded\n});
			} else {
			    Debug(2, qq{dns_update_A failed\n});
			}

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'a/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host'))); # maybe it needs to fully qualify it if it was okay?
		    $tpl->assign(IP_ADDRESS_VALUE => encode_entities(apr()->param('ip')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    # do the red-marker assignment

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!($ip = check_ip(apr()->param('ip')))) {
			$tpl->assign(IP_ADDRESS => qq{<font color="red">} . $lang{IP_ADDRESS} . qq{</font>});

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

		    $all_set = 0;
		}
		my $host = "";
		if (!($host = check_fqdn(apr()->param('host'), $domain))) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_AAAA($dom_id, $record_id, $host, $ipv6)) {
		    # update dns! and sql
		    # check wheter name is the same? so no need for update?
		    
		    # check wheter an excact copy exists in dns to avoid errors
		    if (is_updated_AAAA($dom_id, $record_id, $host, $ipv6, $ttl)) {
			if (dns_update_AAAA($dom_id, $record_id, $host, $ipv6, $ttl)) {
			    Debug(2, qq{dns_update_AAAA succeded\n});
			} else {
			    Debug(2, qq{dns_update_AAAA failed\n});
			}

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'aaaa/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host'))); # maybe it needs to fully qualify it if it was okay?
		    $tpl->assign(IPV6_ADDRESS_VALUE => encode_entities(apr()->param('ipv6')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    # do the red-marker assignment

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!ip_is_ipv6($ipv6)) {
			$tpl->assign(IPV6_ADDRESS => qq{<font color="red">} . $lang{IPV6_ADDRESS} . qq{</font>});

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

		}
		my $cname = apr()->param('cname');
		if (!check_cname_host($cname)) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		# do the update dance!
		if ($all_set && check_before_edit_CNAME($dom_id, $record_id, $host, $cname)) {
		    # update dns! and sql
		    # check wheter name is the same? so no need for update?
		    
		    # check wheter an excact copy exists in dns to avoid errors
		    if (is_updated_CNAME($dom_id, $record_id, $host, $cname, $ttl)) {
			if (dns_update_CNAME($dom_id, $record_id, $host, $cname, $ttl)) {
			    Debug(2, qq{dns_update_CNAME succeded\n});
			} else {
			    Debug(2, qq{dns_update_CNAME failed\n});
			}

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'cname/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host')));
		    $tpl->assign(CNAME_VALUE => encode_entities(apr()->param('cname')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!check_cname_host($cname)) {
			$tpl->assign(CNAME => qq{<font color="red">} . $lang{CNAME} . qq{</font>});
			$error_text .= qq{<br>$lang{ERROR_CNAME}};
		    }

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

		    $all_set = 0;
		}
		my $preference = apr()->param('preference');
		if (!check_preference($preference)) { 
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_MX($dom_id, $record_id, $host, $exchanger, $preference)) {
		    if (is_updated_MX($dom_id, $record_id, $host, $exchanger, $preference, $ttl)) {
                        if (dns_update_MX($dom_id, $record_id, $host, $exchanger, $preference, $ttl)) {
			    Debug(2, qq{dns_update_MX succeded\n});
			} else {
			    Debug(2, qq{dns_update_MX failed\n});
		        }
                    } else {
    		        Debug(2, qq{Dns record not changed so not updated\n});
                    }
		} else {

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

                    } else {
	                $tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
                    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'mx/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host')));
		    $tpl->assign(MX_VALUE => encode_entities(apr()->param('exchanger')));
		    $tpl->assign(PREFERENCE_VALUE => encode_entities(apr()->param('preference')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

                    my $error_text = $lang{ERROR_CORRECT};

		    if (!($host = check_fqdn(apr()->param('host'), $domain))) {
			$tpl->assign(HOST => qq{<font color="red">} . $lang{HOST} . qq{</font>});
                        $error_text .= qq{<br>$lang{ERROR_HOST}};

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

		    $all_set = 0;
		}
		my $nameserver = apr()->param('nsdname');
		if (!check_nameserver($nameserver)) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_NS($dom_id, $record_id, $zone, $nameserver)) {
		    if (is_updated_NS($dom_id, $record_id, $zone, $nameserver, $ttl)) {
			if (dns_update_NS($dom_id, $record_id, $zone, $nameserver, $ttl)) {
			    Debug(2, qq{dns_update_NS succeded\n});
                        } else {
			    Debug(2, qq{dns_update_NS failed\n});
                        }
                    } else {
			Debug(2, qq{Dns record not changed so not updating\n});
		    }
		} else {

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
                    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'ns/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('zone')));
		    $tpl->assign(NS_VALUE => encode_entities(apr()->param('nsdname')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!($zone = check_fqdn_ns(apr()->param('zone'), $domain))) {
			$tpl->assign(ZONE => qq{<font color="red">} . $lang{ZONE} . qq{</font>});
                        $error_text .= qq{<br>$lang{ERROR_ZONE}};
		    }

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

		    $all_set = 0;
		}
		my $host = "";
		if (!($host = check_reverse(apr()->param('reverse'), $domain))) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_PTR($dom_id, $record_id, $host, $reverse)) {
		    # update dns! and sql
		    # check wheter name is the same? so no need for update?
		    
		    # check wheter an excact copy exists in dns to avoid errors
		    if (is_updated_PTR($dom_id, $record_id, $host, $reverse, $ttl)) {
			if (dns_update_PTR($dom_id, $record_id, $host, $reverse, $ttl)) {
			    Debug(2, qq{dns_update_PTR succeded\n});
			} else {
			    Debug(2, qq{dns_update_PTR failed\n});
			}

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

		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);

		    $tpl->define(record => 'ptr/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host'))); # maybe it needs to fully qualify it if it was okay?
		    $tpl->assign(REVERSE_HOST_VALUE => encode_entities(apr()->param('reverse')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    # do the red-marker assignment

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!(check_host(apr()->param('host')))) {
			$tpl->assign(HOST => qq{<font color="red">} . $lang{HOST} . qq{</font>});

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

		    $all_set = 0;
		}
		my $txtdata = apr()->param('txtdata');
		if (!check_txt($txtdata)) {
		    $all_set = 0;
		}
		my $ttl = apr()->param('ttl');
		if (!check_ttl($ttl)) {
		    $all_set = 0;
		}
		if ($all_set && check_before_edit_TXT($dom_id, $record_id, $host, $txtdata)) {
		    if (is_updated_TXT($dom_id, $record_id, $host, $txtdata, $ttl)) {
			if (dns_update_TXT($dom_id, $record_id, $host, $txtdata, $ttl)) {
			    Debug(2, qq{dns_update_TXT succeded\n});
			} else {
			    Debug(2, qq{dns_update_TXT failed\n});
			}
		    } else {
			Debug(2, qq{Dns record not changed so not updating\n});			
		    }
		} else {

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

			$tpl->assign(ADDITIONAL_MENU => '');
		    } else {
			$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
		    }

		    my $page_title = $lang{PAGE_EDIT};
		    $page_title =~ s/\$record/$type/;
		    $page_title =~ s/\$domain/$domain/;
		    
		    $tpl->assign(TITLE => $page_title);
		    $tpl->define(record => 'txt/edit.tpl');
		    $tpl->assign(HOST_VALUE => encode_entities(apr()->param('host')));
		    $tpl->assign(TXT_VALUE => encode_entities(apr()->param('txtdata')));
		    $tpl->assign(TTL_VALUE => encode_entities(apr()->param('ttl')));

		    my $error_text = $lang{ERROR_CORRECT};

		    if (!($host = check_fqdn(apr()->param('host'), $domain))) {
			$tpl->assign(HOST => qq{<font color="red">} . $lang{HOST} . qq{</font>});
			$error_text .= qq{<br>$lang{ERROR_HOST}};
		    }

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

	    }
	    else { 
	        Debug(1, qq{User trying to update an unexsisting type: $type\n});
	    }
	}
        output_redirect($r, 1, qq{/admin?action=view&dom_id=$dom_id});
	$dbh->close();
	return REDIRECT;
    } else {
	# is view
        Debug(5, qq{This is a view of edit_record request});    

        my $tpl = new CGI::FastTemplate($cfg->{'cfg'}->{DnsZoneTemplateDir});
        $tpl->define(layout => 'layout.tpl', menu => 'menu.tpl');
        $tpl->assign(%lang);
        $tpl->assign(DEBUG => '');
	
	if ($dbh->get_domain_count($uid) == 1) {
	    $tpl->assign(ADDITIONAL_MENU => '');
	} else {
	    $tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });

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

        my $page_title = $lang{PAGE_EDIT};
        $page_title =~ s/\$record/$type/;
        $page_title =~ s/\$domain/$domain/;

        $tpl->assign(TITLE => $page_title);
	$tpl->assign(EXPLANATION => $lang{EDIT_FIELDS});
	for ($type) {
	    if (/^SOA$/) {
		my ($auth_ns, $soa_email, $serial, $refresh, $retry, $expire, $default_ttl) = $dbh->soa_lookup($dom_id);
		$soa_email =~ s/\./\@/;	    
		$tpl->define(record => 'soa/edit.tpl');
		$tpl->assign(AUTH_NS_VALUE => $auth_ns);
		$tpl->assign(SERIAL_VALUE => $serial);
		$tpl->assign(ADMIN_EMAIL_VALUE => $soa_email);
		$tpl->assign(REFRESH_VALUE => $refresh);
		$tpl->assign(RETRY_VALUE => $retry);
		$tpl->assign(EXPIRE_VALUE => $expire);
		$tpl->assign(TTL_VALUE => $default_ttl);
	    }
	    elsif (/^A$/) {
		my ($name, $address, $ttl) = $dbh->a_lookup($dom_id, $record_id);
		$tpl->define(record => 'a/edit.tpl');
		$tpl->assign(HOST_VALUE => $name);
		$tpl->assign(IP_ADDRESS_VALUE => $address);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^AAAA$/) {
		my ($name, $address, $ttl) = $dbh->aaaa_lookup($dom_id, $record_id);
		$tpl->define(record => 'aaaa/edit.tpl');
		$tpl->assign(HOST_VALUE => $name);
		$tpl->assign(IPV6_ADDRESS_VALUE => $address);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^CNAME$/) {
		my ($name, $cname, $ttl) = $dbh->cname_lookup($dom_id, $record_id);
		$tpl->define(record => 'cname/edit.tpl');
		$tpl->assign(HOST_VALUE => $name);
		$tpl->assign(CNAME_VALUE => $cname);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^MX$/) {
		my ($name, $exchanger, $preference, $ttl) = $dbh->mx_lookup($dom_id, $record_id);
		$tpl->define(record => 'mx/edit.tpl');
		$tpl->assign(HOST_VALUE => $name);
		$tpl->assign(MX_VALUE => $exchanger);
		$tpl->assign(PREFERENCE_VALUE => $preference);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^NS$/) {
		my ($name, $nsdname, $ttl) = $dbh->ns_lookup($dom_id, $record_id);
		$tpl->define(record => 'ns/edit.tpl');
		$tpl->assign(ZONE_VALUE => $name);
		$tpl->assign(NS_VALUE => $nsdname);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^PTR$/) {
		my ($name, $ptrdname, $ttl) = $dbh->ptr_lookup($dom_id, $record_id);
		$tpl->define(record => 'ptr/edit.tpl');
		$tpl->assign(HOST_VALUE => $ptrdname);
		$tpl->assign(REVERSE_HOST_VALUE => $name);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	    elsif (/^TXT$/) {
		my ($name, $txtdata, $ttl) = $dbh->txt_lookup($dom_id, $record_id);
		$txtdata = encode_entities($txtdata);
		$tpl->define(record => 'txt/edit.tpl');
		$tpl->assign(HOST_VALUE => $name);
		$tpl->assign(TXT_VALUE => $txtdata);
		$tpl->assign(TTL_VALUE => $ttl);
	    }
	}

        $tpl->assign(RECORD_ID => $record_id);
	$tpl->assign(DOM_ID => $dom_id);

	$tpl->parse(MENU => "menu");

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


    $tpl->assign(SOA_SERIAL_VALUE => $serial);
    $tpl->assign(SOA_ADMIN_EMAIL_VALUE => $email);
    $tpl->assign(SOA_AUTH_NS_VALUE => $auth_ns);
    $tpl->assign(SOA_REFRESH_VALUE => $refresh);
    $tpl->assign(SOA_RETRY_VALUE => $retry);
    $tpl->assign(SOA_EXPIRE_VALUE => $expire);
    $tpl->assign(SOA_TTL_VALUE => $default_ttl);
    
    if ($rec_lock == 0) {
	$tpl->assign(SOA_EDIT => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=SOA">$lang{EDIT}</a> ]});
    } else {
	$tpl->assign(SOA_EDIT => qq{<i>$lang{LOCKED}</i>});
    }

    $tpl->parse(SOA_RR => "view_domain_soa");
   
    if ($A_max != 0) { 
	my ($a_count) = $dbh->get_a_count($dom_id);
	if ($A_max > $a_count) {
	    $tpl->assign(A_ADD => qq{[ <a href="/admin?action=add&dom_id=$dom_id&type=A">$lang{ADD}</a> ]});

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

		my $bgcolor = "";
		if ($count % 2 != 1) {
		    $tpl->assign(A_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(A_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(A_HOST_VALUE => $A_name);
		$tpl->assign(A_IP_VALUE => $A_address);
		$tpl->assign(A_TTL_VALUE => $A_ttl);
		if ($A_rec_lock == 0) {
		    $tpl->assign(A_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=A&record_id=$A_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=A&record_id=$A_id">$lang{REMOVE}</a> ]});
		} else {
		    $tpl->assign(A_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(A_RECORD => ".view_domain_a_record");
	    }
	    $sth_A->finish();
	    $tpl->parse(A_RR => "view_domain_a");
	} else {
	    $tpl->assign(A_RECORD => '');
	    $tpl->parse(A_RR => "view_domain_a");

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

		my $bgcolor = "";
		if ($count % 2 != 1) {
		    $tpl->assign(AAAA_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(AAAA_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(AAAA_HOST_VALUE => $AAAA_name);
		$tpl->assign(AAAA_IPV6_VALUE => $AAAA_address);
		$tpl->assign(AAAA_TTL_VALUE => $AAAA_ttl);
		if ($AAAA_rec_lock == 0) {
		    $tpl->assign(AAAA_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=AAAA&record_id=$AAAA_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=AAAA&record_id=$AAAA_id">$lang{REMOVE}</a> ]});
		} else {
		    $tpl->assign(AAAA_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(AAAA_RECORD => ".view_domain_aaaa_record");
	    }
	    $sth_AAAA->finish();
	    $tpl->parse(AAAA_RR => "view_domain_aaaa");
	} else {
	    $tpl->assign(AAAA_RECORD => '');
	    $tpl->parse(AAAA_RR => "view_domain_aaaa");

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

		$count++;
		if ($count % 2 != 1) {
		    $tpl->assign(CNAME_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(CNAME_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(CNAME_HOST_VALUE => $CNAME_name);
		$tpl->assign(CNAME_CNAME_VALUE => $CNAME_cname);
		$tpl->assign(CNAME_TTL_VALUE => $CNAME_ttl);
		if ($CNAME_rec_lock == 0) {
		    $tpl->assign(CNAME_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=CNAME&record_id=$CNAME_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=CNAME&record_id=$CNAME_id">$lang{REMOVE}</a> ]});
		} else {
		    $tpl->assign(CNAME_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(CNAME_RECORD => ".view_domain_cname_record");
	    }
	    $tpl->parse(CNAME_RR => "view_domain_cname");
	    $sth_CNAME->finish();
	} else {
	    $tpl->assign(CNAME_RECORD => '');
	    $tpl->parse(CNAME_RR => "view_domain_cname");

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

		if ($count % 2 != 1) {
		    $tpl->assign(MX_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(MX_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(MX_HOST_VALUE => $MX_name);
		$tpl->assign(MX_MX_VALUE => $MX_exchanger);
		$tpl->assign(MX_PREFERENCE_VALUE => $MX_preference);
		$tpl->assign(MX_TTL_VALUE => $MX_ttl);
		if ($MX_rec_lock == 0) {
		    $tpl->assign(MX_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=MX&record_id=$MX_id">$lang{EDIT}</a> |  <a href="/admin?action=delete&dom_id=$dom_id&type=MX&record_id=$MX_id">$lang{REMOVE}</a> ]});
		} else {
		    $tpl->assign(MX_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(MX_RECORD => ".view_domain_mx_record");
	    }
	    $tpl->parse(MX_RR => "view_domain_mx");
	    $sth_MX->finish();
	} else {
	    $tpl->assign(MX_RECORD => '');
	    $tpl->parse(MX_RR => "view_domain_mx");

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

		$count++;
		if ($count % 2 != 1) {
		    $tpl->assign(NS_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(NS_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(NS_ZONE_VALUE => $NS_name);
		$tpl->assign(NS_NS_VALUE => $NS_nsdname);
		$tpl->assign(NS_TTL_VALUE => $NS_ttl);
		if ($NS_rec_lock == 0) {
		    $tpl->assign(NS_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=NS&record_id=$NS_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=NS&record_id=$NS_id">$lang{REMOVE}</a> ]}); 
		} else {
		    $tpl->assign(NS_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(NS_RECORD => ".view_domain_ns_record");
	    }
	    $tpl->parse(NS_RR => "view_domain_ns");
	    $sth_NS->finish();
	} else {
	    $tpl->assign(NS_RECORD => '');
	    $tpl->parse(NS_RR => "view_domain_ns");

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

		$count++;
		if ($count % 2 != 1) {
		    $tpl->assign(PTR_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(PTR_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(PTR_REVERSE_HOST_VALUE => $PTR_name);
		$tpl->assign(PTR_HOST_VALUE => $PTR_ptrdname);
		$tpl->assign(PTR_TTL_VALUE => $PTR_ttl);
		if ($PTR_rec_lock == 0) {
		    $tpl->assign(PTR_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=PTR&record_id=$PTR_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=PTR&record_id=$PTR_id">$lang{REMOVE}</a> ]}); 
		} else {
		    $tpl->assign(PTR_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(PTR_RECORD => ".view_domain_ptr_record");
	    }
	    $tpl->parse(PTR_RR => "view_domain_ptr");
	    $sth_PTR->finish();
	} else {
	    $tpl->assign(PTR_RECORD => '');
	    $tpl->parse(PTR_RR => "view_domain_ptr");

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

		$count++;
		if ($count % 2 != 1) {
		    $tpl->assign(TXT_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableEvenColor});
		} else {
		    $tpl->assign(TXT_RR_BGCOLOR => $cfg->{'cfg'}->{DnsZoneTableOddColor});
		}
		$tpl->assign(TXT_HOST_VALUE => $TXT_name);
		$tpl->assign(TXT_TXT_VALUE => $TXT_txt);
		$tpl->assign(TXT_TTL_VALUE => $TXT_ttl);
		if ($TXT_rec_lock == 0) {
		    $tpl->assign(TXT_CHANGE => qq{[ <a href="/admin?action=edit&dom_id=$dom_id&type=TXT&record_id=$TXT_id">$lang{EDIT}</a> | <a href="/admin?action=delete&dom_id=$dom_id&type=TXT&record_id=$TXT_id">$lang{REMOVE}</a> ]});
		} else {
		    $tpl->assign(TXT_CHANGE => qq{<i>$lang{LOCKED}</i>});
		}
		$tpl->parse(TXT_RECORD => ".view_domain_txt_record");
	    }
	    $tpl->parse(TXT_RR => "view_domain_txt");
	    $sth_TXT->finish();
	} else {
	    $tpl->assign(TXT_RECORD => '');
	    $tpl->parse(TXT_RR => "view_domain_txt");

templates/HOWTO  view on Meta::CPAN

The template system for DnsZone is implemented using CGI::FastTemplate, so if you want a better understanding of how the templating system actually works you will need to read the pod in CGI::FastTemplate.

Easiest way to create a new set of templates is to copy all of the existing templates into a new directory and edit them from there, that way you are sure to get everything that is needed to make DnsZone work.

It is important that you do not change any of the variable names in the template files since all language operations depend on them.

In your template directory you need the following files:

layout.tpl
menu.tpl
settings.tpl
list_domain_record.tpl
login.tpl
a/edit.tpl
a/add.tpl
a/remove.tpl
cname/edit.tpl
cname/add.tpl
cname/remove.tpl
view_domain.tpl
list_domain.tpl
soa/edit.tpl
ns/edit.tpl
ns/remove.tpl
ns/add.tpl
txt/edit.tpl
txt/remove.tpl
txt/add.tpl
mx/edit.tpl
mx/remove.tpl
mx/add.tpl
view_domain/a.tpl
view_domain/a_record.tpl
view_domain/soa.tpl
view_domain/cname.tpl
view_domain/cname_record.tpl
view_domain/mx_record.tpl
view_domain/mx.tpl
view_domain/ns_record.tpl

templates/HOWTO  view on Meta::CPAN

         login.tpl

         view_domain.tpl 
             $SOA_RR => view_domain/soa.tpl
             $A_RR => view_domain/a.tpl $A_RECORD => view_domain/a_record.tpl
             $CNAME_RR => view_domain/cname.tpl $CNAME_RECORD => view_domain/cname_record.tpl
             $MX_RR => view_domain/mx.tpl $MX_RECORD => view_domain/mx_record.tpl
             $NS_RR => view_domain/ns.tpl $NS_RECORD => view_domain/ns_record.tpl
             $TXT_RR => view_domain/txt.tpl $TXT_RECORD => view_domain/txt_record.tpl

         soa/edit.tpl

         a/add.tpl

         a/edit.tpl

         a/remove.tpl

         cname/add.tpl

         cname/edit.tpl

         cname/remove.tpl

         mx/add.tpl

         mx/edit.tpl

         mx/remove.tpl

         ns/add.tpl

         ns/edit.tpl

         ns/remove.tpl

         txt/add.tpl

         txt/edit.tpl

         txt/remove.tpl


templates/standard/a/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="A">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$IP_ADDRESS</td><td><input type="text" name="ip" value="$IP_ADDRESS_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/aaaa/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="AAAA">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$IPV6_ADDRESS</td><td><input type="text" name="ipv6" value="$IPV6_ADDRESS_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/cname/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="CNAME">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$CNAME</td><td><input type="text" name="cname" value="$CNAME_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/mx/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="MX">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$MX</td><td><input type="text" name="exchanger" value="$MX_VALUE"></td></tr>
  <tr><td>$PREFERENCE</td><td><input type="text" name="preference" value="$PREFERENCE_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/ns/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="NS">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$ZONE</td><td><input type="text" name="zone" value="$ZONE_VALUE"></td></tr>
  <tr><td>$NS</td><td><input type="text" name="nsdname" value="$NS_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/ptr/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="PTR">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$REVERSE_HOST</td><td><input type="text" name="reverse" value="$REVERSE_HOST_VALUE"></td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>

templates/standard/soa/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="SOA">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$AUTH_NS</td><td>$AUTH_NS_VALUE</td></tr>
  <tr><td>$SERIAL</td><td>$SERIAL_VALUE</td></tr>
  <tr><td>$ADMIN_EMAIL</td><td><input type="text" name="soa_email" value="$ADMIN_EMAIL_VALUE"></td></tr>
  <tr><td>$REFRESH</td><td><input type="text" name="refresh" value="$REFRESH_VALUE"></td></tr>
  <tr><td>$RETRY</td><td><input type="text" name="retry" value="$RETRY_VALUE"></td></tr>
  <tr><td>$EXPIRE</td><td><input type="text" name="expire" value="$EXPIRE_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="default_ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>

templates/standard/txt/edit.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="post">
<input type="hidden" name="type" value="TXT">
<input type="hidden" name="record_id" value="$RECORD_ID">
<input type="hidden" name="dom_id" value="$DOM_ID">
<input type="hidden" name="action" value="edit">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td colspan="2">$EXPLANATION</td></tr>
  <tr><td>$HOST</td><td><input type="text" name="host" value="$HOST_VALUE"></td></tr>
  <tr><td>$TXT</td><td><input type="text" name="txtdata" value="$TXT_VALUE"></td></tr>
  <tr><td>$TTL</td><td><input type="text" name="ttl" value="$TTL_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>



( run in 0.872 second using v1.01-cache-2.11-cpan-de7293f3b23 )