# HG changeset patch # User rejo # Date 1207909154 0 # Node ID c795dd75a77e3df0e1d37c78d3539de64efb50cb # Parent 3673b1c9246ce74a70127502b7ac7199fec3f6d4 [feladat @ 242] Changed configuration file and variables. See [wiki:Documentation/ConfigurationFile documentation] for more information on new setup. diff -r 3673b1c9246c -r c795dd75a77e add_record.php --- a/add_record.php Thu Apr 10 19:42:47 2008 +0000 +++ b/add_record.php Fri Apr 11 10:19:14 2008 +0000 @@ -39,7 +39,7 @@ $zone_id = $_GET['id']; } -$ttl = $DEFAULT_TTL; +$ttl = $dns_ttl; if ((isset($_POST['ttl'])) && (v_num($_POST['ttl']))) { $ttl = $_POST['ttl']; } diff -r 3673b1c9246c -r c795dd75a77e edit.php --- a/edit.php Thu Apr 10 19:42:47 2008 +0000 +++ b/edit.php Fri Apr 11 10:19:14 2008 +0000 @@ -78,10 +78,10 @@ error(ERR_PERM_VIEW_ZONE); } else { echo "
\n"; - show_pages($record_count,ROWAMOUNT,$zone_id); + show_pages($record_count,$iface_rowamount,$zone_id); echo "
\n"; - $records = get_records_from_domain_id($zone_id,ROWSTART,ROWAMOUNT); + $records = get_records_from_domain_id($zone_id,ROWSTART,$iface_rowamount); if ( $records == "-1" ) { echo "

" . _("This zone does not have any records. Weird.") . "

\n"; } else { diff -r 3673b1c9246c -r c795dd75a77e inc/auth.inc.php --- a/inc/auth.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/auth.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -23,7 +23,7 @@ function doAuthenticate() { global $db; - global $EXPIRE; + global $iface_expire; if (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] == "logout") { logout(); } @@ -36,7 +36,7 @@ } // Check if the session hasnt expired yet. - if ((isset($_SESSION["userid"])) && ($_SESSION["lastmod"] != "") && ((time() - $_SESSION["lastmod"]) > $EXPIRE)) + if ((isset($_SESSION["userid"])) && ($_SESSION["lastmod"] != "") && ((time() - $_SESSION["lastmod"]) > $iface_expire)) { logout( _('Session expired, please login again.'),"error"); } diff -r 3673b1c9246c -r c795dd75a77e inc/config-me.inc.php --- a/inc/config-me.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/config-me.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -1,186 +1,22 @@ for more details. - * - * Copyright 2007, 2008 Rejo Zenger - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* Edit all fields below here to your information */ - -/* MySQL Configuration */ - -// -// Host we should connect to. -// This could be for example "localhost" or a sock file -$dbhost = 'localhost'; - -// -// Your user with SELECT/INSERT/UPDATE/DELETE/CREATE access to $dbdatabase -$dbuser = ''; - -// -// Your password, the password for $dbuser -$dbpass = ''; - -// Your database, the database you want to use for PowerDNS (or are already using) -$dbdatabase = ''; - -// The dsn you want to use (which database you want to use) -// Tested is mysql and pgsql default is mysql -$dbdsntype = 'mysql'; +// See for help. -/* URI Configuration */ - -// $BASE_URL -// This will be the main URI you will use to connect to Poweradmin. -// For instance: "http://poweradmin.sjeemz.nl" -$BASE_URL = "http://"; - -// $BASE_PATH -// If Poweradmin is in a subdir. Specify this here -// For instance: "/admin/" -$BASE_PATH = "/admin/"; - -// $LANG -// Which language should be used for the web interface? -$LANG = "en_EN"; - -// $STYLE -// Define skin of web frontend. This should be the basename of the CSS file that -// will be included, it will be used like: "style/$STYLE.css.php". -$STYLE = "example"; - -// $ROWAMOUNT -// Define which rowamount should be used in the listing of records. -$ROWAMOUNT = 50; - -/* DNS Record information */ - - -// $HOSTMASTER -// The email address of the hostmaster you want to be mailed. -// For instance: "hostmaster@sjeemz.nl" -$HOSTMASTER = ""; - -// $NS1 -// Your first nameserver -// Should be a domainname! Not an IP. -$NS1 = ""; - -// $NS2 -// Your second nameserver. -// If you dont have a second nameserver, fill in the same value as $NS1 -$NS2 = ""; - -/* You dont have to edit these fields. Change them if you want. */ - +$db_host = ""; +$db_user = ""; +$db_pass = ""; +$db_name = ""; +$db_type = ""; -// $EXPIRE -// Session timeout in seconds. This is 1800 seconds which is 30 minutes by default. -// The information in this field should be in seconds. -// After this $EXPIRE you are automatically logged out from the system. -$EXPIRE = 1800; - -// $DEFAULT_TTL -// Default TTL for records. -// Default time to live for all records. This notation is in seconds. -$DEFAULT_TTL = 86400; // (3600 seconds / 1 hour by default) - -// Enable fancy records or not (http://doc.powerdns.com/fancy-records.html)? true/false -$FANCY_RECORDS = true; - - -/* ------------------------------------------ */ -/* No need to make changes below this line... */ -/* Which means, dont touch it */ -/* ------------------------------------------ */ - -/* -------------------------------------------------------------------- */ -/* NO REALLY DONT TOUCH IT! Unless you _REALLY_ know what you are doing */ -/* -------------------------------------------------------------------- */ - -// $rtypes - array of possible record types -$rtypes = array('A', 'AAAA', 'CNAME', 'HINFO', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'TXT'); - -// If fancy records is enabled, extend this field. -if($FANCY_RECORDS) -{ - $rtypes[10] = 'URL'; - $rtypes[11] = 'MBOXFW'; -} - -// $template - array of records that will be applied when adding a new zone file -$template = array( - array( +$iface_lang = "en_EN"; +$iface_style = "example"; +$iface_rowamount = "50"; +$iface_expire = "1800"; - "name" => "##DOMAIN##", - "type" => "SOA", - "content" => "$NS1 $HOSTMASTER 1", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "##DOMAIN##", - "type" => "NS", - "content" => "$NS1", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "##DOMAIN##", - "type" => "NS", - "content" => "$NS2", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "www.##DOMAIN##", - "type" => "A", - "content" => "##WEBIP##", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "##DOMAIN##", - "type" => "A", - "content" => "##WEBIP##", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "mail.##DOMAIN##", - "type" => "A", - "content" => "##MAILIP##", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "localhost.##DOMAIN##", - "type" => "A", - "content" => "127.0.0.1", - "ttl" => "$DEFAULT_TTL", - "prio" => "" - ), - array( - "name" => "##DOMAIN##", - "type" => "MX", - "content" => "mail.##DOMAIN##", - "ttl" => "$DEFAULT_TTL", - "prio" => "10" - ) -); +$dns_hostmaster = ""; +$dns_ns1 = ""; +$dns_ns2 = ""; +$dns_ttl = "86400"; +$dns_fancy = "false"; + ?> diff -r 3673b1c9246c -r c795dd75a77e inc/database.inc.php --- a/inc/database.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/database.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -36,49 +36,49 @@ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError'); function dbConnect() { - global $dbdsntype; - global $dbuser; - global $dbpass; - global $dbhost; - global $dbdatabase; + global $db_type; + global $db_user; + global $db_pass; + global $db_host; + global $db_name; global $sql_regexp; - if (!(isset($dbuser) && $dbuser != "")) { + if (!(isset($db_user) && $db_user != "")) { include_once("header.inc.php"); error(ERR_DB_NO_DB_USER); include_once("footer.inc.php"); exit; } - if (!(isset($dbpass) && $dbpass != "")) { + if (!(isset($db_pass) && $db_pass != "")) { include_once("header.inc.php"); error(ERR_DB_NO_DB_PASS); include_once("footer.inc.php"); exit; } - if (!(isset($dbhost) && $dbhost != "")) { + if (!(isset($db_host) && $db_host != "")) { include_once("header.inc.php"); error(ERR_DB_NO_DB_HOST); include_once("footer.inc.php"); exit; } - if (!(isset($dbdatabase) && $dbdatabase != "")) { + if (!(isset($db_name) && $db_name != "")) { include_once("header.inc.php"); error(ERR_DB_NO_DB_NAME); include_once("footer.inc.php"); exit; } - if ((!isset($dbdsntype)) || (!($dbdsntype == "mysql" || $dbdsntype == "pgsql"))) { + if ((!isset($db_type)) || (!($db_type == "mysql" || $db_type == "pgsql"))) { include_once("header.inc.php"); error(ERR_DB_NO_DB_TYPE); include_once("footer.inc.php"); exit; } - $dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase"; + $dsn = "$db_type://$db_user:$db_pass@$db_host/$db_name"; $db = MDB2::connect($dsn); $db->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL); @@ -94,9 +94,9 @@ $mysql_pass = $dsn = ''; // Add support for regular expressions in both MySQL and PostgreSQL - if ( $dbdsntype == "mysql" ) { + if ( $db_type == "mysql" ) { $sql_regexp = "REGEXP"; - } elseif ( $dbdsntype == "pgsql" ) { + } elseif ( $db_type == "pgsql" ) { $sql_regexp = "~"; } else { error(ERR_DB_NO_DB_TYPE); diff -r 3673b1c9246c -r c795dd75a77e inc/dns.inc.php --- a/inc/dns.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/dns.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -178,7 +178,7 @@ $prio=0; } // Validate the TTL, it has to be numeric. - $ttl = (!isset($ttl) || !is_numeric($ttl)) ? $DEFAULT_TTL : $ttl; + $ttl = (!isset($ttl) || !is_numeric($ttl)) ? $dns_ttl : $ttl; return true; } @@ -439,8 +439,8 @@ if(is_numeric($soacontent[1])) { // its a TTL field, or at least not hostmaster or alike // Set final string to the default hostmaster addy - global $HOSTMASTER; - $totalsoa .= " ". $HOSTMASTER; + global $dns_hostmaster; + $totalsoa .= " ". $dns_hostmaster; } else { $totalsoa .= " ".$soacontent[1]; } diff -r 3673b1c9246c -r c795dd75a77e inc/header.inc.php --- a/inc/header.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/header.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -19,13 +19,13 @@ * along with this program. If not, see . */ -global $STYLE; +global $iface_style; echo "\n"; echo "\n"; echo " \n"; echo " Poweradmin\n"; -echo " \n"; +echo " \n"; echo " \n"; echo " \n"; diff -r 3673b1c9246c -r c795dd75a77e inc/i18n.inc.php --- a/inc/i18n.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/i18n.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -21,11 +21,10 @@ include_once("inc/config.inc.php"); -$language = $LANG; -setlocale(LC_ALL, $language); +setlocale(LC_ALL, $iface_lang); $gettext_domain = 'messages'; bindtextdomain($gettext_domain, "./locale"); textdomain($gettext_domain); -@putenv('LANG='.$language); -@putenv('LANGUAGE='.$language); +@putenv('LANG='.$iface_lang); +@putenv('LANGUAGE='.$iface_lang); ?> diff -r 3673b1c9246c -r c795dd75a77e inc/record.inc.php --- a/inc/record.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/record.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -310,6 +310,9 @@ if($zone_master_add == "1" || $zone_slave_add == "1") { global $db; + global $dns_ns1; + global $dns_hostmaster; + global $dns_ttl; if (($domain && $owner && $webip && $mailip) || ($empty && $owner && $domain) || (eregi('in-addr.arpa', $domain) && $owner) || @@ -331,9 +334,9 @@ } else { $now = time(); if ($empty && $domain_id) { - $ns1 = $GLOBALS['NS1']; - $hm = $GLOBALS['HOSTMASTER']; - $ttl = $GLOBALS['DEFAULT_TTL']; + $ns1 = $dns_ns1; + $hm = $dns_hostmaster; + $ttl = $dns_ttl; $query = "INSERT INTO records (domain_id, name, content, type, ttl, prio, change_date) VALUES (" . $db->quote($domain_id) . "," @@ -347,6 +350,7 @@ if (PEAR::isError($response)) { error($response->getMessage()); return false; } } elseif ($domain_id) { global $template; + global $dns_ttl; foreach ($template as $r) { if ((eregi('in-addr.arpa', $domain) && ($r["type"] == "NS" || $r["type"] == "SOA")) || (!eregi('in-addr.arpa', $domain))) @@ -358,7 +362,7 @@ $prio = intval($r["prio"]); if (!$ttl) { - $ttl = $GLOBALS["DEFAULT_TTL"]; + $ttl = $dns_ttl; } $query = "INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date) VALUES (" diff -r 3673b1c9246c -r c795dd75a77e inc/toolkit.inc.php --- a/inc/toolkit.inc.php Thu Apr 10 19:42:47 2008 +0000 +++ b/inc/toolkit.inc.php Fri Apr 11 10:19:14 2008 +0000 @@ -30,10 +30,9 @@ /************* * Constants * *************/ -define('ROWAMOUNT', $ROWAMOUNT); if (isset($_GET["start"])) { - define('ROWSTART', (($_GET["start"] - 1) * ROWAMOUNT)); + define('ROWSTART', (($_GET["start"] - 1) * $iface_rowamount)); } else { define('ROWSTART', 0); } @@ -56,6 +55,76 @@ // Array of the available zone types $server_types = array("MASTER", "SLAVE", "NATIVE"); +// $rtypes - array of possible record types +$rtypes = array('A', 'AAAA', 'CNAME', 'HINFO', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'TXT'); + +// If fancy records is enabled, extend this field. +if($dns_fancy) { + $rtypes[10] = 'URL'; + $rtypes[11] = 'MBOXFW'; +} + +// $template - array of records that will be applied when adding a new zone file +$template = array( + array( + + "name" => "##DOMAIN##", + "type" => "SOA", + "content" => "$dns_ns1 $dns_hostmaster 0", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "##DOMAIN##", + "type" => "NS", + "content" => "$dns_ns1", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "##DOMAIN##", + "type" => "NS", + "content" => "$dns_ns2", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "www.##DOMAIN##", + "type" => "A", + "content" => "##WEBIP##", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "##DOMAIN##", + "type" => "A", + "content" => "##WEBIP##", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "mail.##DOMAIN##", + "type" => "A", + "content" => "##MAILIP##", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "localhost.##DOMAIN##", + "type" => "A", + "content" => "127.0.0.1", + "ttl" => "$dns_ttl", + "prio" => "" + ), + array( + "name" => "##DOMAIN##", + "type" => "MX", + "content" => "mail.##DOMAIN##", + "ttl" => "$dns_ttl", + "prio" => "10" + ) +); + /************* * Includes * diff -r 3673b1c9246c -r c795dd75a77e list_zones.php --- a/list_zones.php Thu Apr 10 19:42:47 2008 +0000 +++ b/list_zones.php Fri Apr 11 10:19:14 2008 +0000 @@ -39,14 +39,14 @@ if ($perm_view == "none") { echo "

" . _('You do not have the permission to see any zones.') . "

\n"; -} elseif ($count_zones_view > ROWAMOUNT && $count_zones_all_letterstart == "0") { +} elseif ($count_zones_view > $iface_rowamount && $count_zones_all_letterstart == "0") { echo "

" . _('There are no zones to show in this listing.') . "

\n"; } else { echo "
\n"; - show_pages($count_zones_all_letterstart,ROWAMOUNT); + show_pages($count_zones_all_letterstart,$iface_rowamount); echo "
\n"; - if ($count_zones_view > ROWAMOUNT) { + if ($count_zones_view > $iface_rowamount) { echo "
"; show_letters(LETTERSTART); echo "
"; @@ -61,10 +61,10 @@ echo " \n"; echo " \n"; - if ($count_zones_view <= ROWAMOUNT) { - $zones = get_zones($perm_view,$_SESSION['userid'],"all",ROWSTART,ROWAMOUNT); + if ($count_zones_view <= $iface_rowamount) { + $zones = get_zones($perm_view,$_SESSION['userid'],"all",ROWSTART,$iface_rowamount); } else { - $zones = get_zones($perm_view,$_SESSION['userid'],LETTERSTART,ROWSTART,ROWAMOUNT); + $zones = get_zones($perm_view,$_SESSION['userid'],LETTERSTART,ROWSTART,$iface_rowamount); $count_zones_shown = ($zones == -1) ? 0 : count($zones); } foreach ($zones as $zone)