From: Neil S. <sir...@us...> - 2003-07-17 13:09:34
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-07-17 12:02:38 UTC Modified files: create_record.php create_template_record.php edit_record.php edit_template_record.php edit_zone.php new_record.php new_template_record.php update_record.php update_template_record.php docs/CHANGELOG docs/TODO lib/records.inc.php Added files: delete_multi_records.php Log message: Author: SiRVulcaN <sir...@si...> Log message: - Allow users to delete multiple records at once. - Full MBOXFW support added. - Full URL support added. - Full RP support added. - Full HWINFO support added. - Full A6 support completed. - Full NS6 support completed. ---------------------- diff included ---------------------- Index: publicdnsadmin/create_record.php diff -u publicdnsadmin/create_record.php:1.3 publicdnsadmin/create_record.php:1.4 --- publicdnsadmin/create_record.php:1.3 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/create_record.php Thu Jul 17 05:02:27 2003 @@ -37,7 +37,7 @@ $domain = addslashes($row["name"]); $record = preg_replace("/\.+$/", "", $record); /* Remove trailing .'s */ - if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" ) { + if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" and $type != "MBOXFW" and $type != "URL" and $type != "RP" and $type != "HWINFO") { echo "<p class=\"error\">· Invalid pointer type: \"$type\"</p>\n"; } else { @@ -74,8 +74,13 @@ if ($type == "PTR") { $record_name = preg_replace("/^\.+/", "", "$record"); } else { - $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + if ($type == "MBOXFW") { + $record_name = "$record@$domain"; + } else { + $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + } } + $dbh->query("INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date) VALUES($zoneid, '$record_name', '$type', '$content', '$ttl', '$prio', '".time()."')"); updateZoneSerial($zoneid); echo "<p>The record was added<br><a href=\"edit_zone.php?id=$zoneid\">Proceed »</a></p>\n"; Index: publicdnsadmin/create_template_record.php diff -u publicdnsadmin/create_template_record.php:1.4 publicdnsadmin/create_template_record.php:1.5 --- publicdnsadmin/create_template_record.php:1.4 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/create_template_record.php Thu Jul 17 05:02:27 2003 @@ -35,7 +35,7 @@ $domain = '$DOMAIN'; $record = preg_replace("/\.+$/", "", $record); /* Remove trailing .'s */ - if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" ) { + if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" and $type != "MBOXFW" and $type != "URL" and $type != "RP" and $type != "HWINFO") { echo "<p class=\"error\">· Invalid pointer type: \"$type\"</p>\n"; } else { @@ -57,7 +57,12 @@ echo "<p class=\"error\">· Invalid record data for pointer type</p>\n"; } else { - $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + if ($type == "MBOXFW") { + $record_name = "$record@$domain"; + } else { + $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + } + $dbh->query("INSERT INTO template_records (template_id, name, type, content, ttl, prio) VALUES('$zoneid', '$record_name', '$type', '$content', '$ttl', '$prio')"); echo "<p>The record was added<br><a href=\"edit_template.php?id=$zoneid\">Proceed »</a></p>\n"; echo "<script language=\"JavaScript\">\n"; Index: publicdnsadmin/delete_multi_records.php diff -u /dev/null publicdnsadmin/delete_multi_records.php:1.1 --- /dev/null Thu Jul 17 05:02:38 2003 +++ publicdnsadmin/delete_multi_records.php Thu Jul 17 05:02:28 2003 @@ -0,0 +1,65 @@ +<?php +/* + Public DNS Administator + Originally Written by Trond Arve Nordheim <tr...@no...> + Modified By Neil Spierling <sir...@si...> + + Distributed under the GPL license, see LICENSE for + more information + + $Id: +*/ + +require("lib/prepend.php"); +require("lib/header.php"); + +$perms = getUserPermissions($_SESSION["_UID"]); + +if (userHasAccess($_SESSION["_UID"], "edit")) { + +?> +<h3>Edit domain » delete multple records</h3> +<?php + + if ($recdel) { + $del_count_max = count($recdel); + + $dbh = db_connect(); + foreach($recdel as $rcount=>$recordid) { + $result = $dbh->query("SELECT domain_owners.user_id, domains.name AS domain_name, records.* FROM domains, domain_owners, records WHERE records.id = '$recordid' AND domain_owners.domain_id = records.domain_id AND domains.id = domain_owners.domain_id AND records.type <> 'SOA'"); + if (!$dbh->isError($result) && $result->numRows()) { + $row = $result->fetchRow(); + if ($perms["edit_other"] or ($perms["edit_own"] and $row["user_id"] == $_SESSION["_UID"])) { + $dbh->query("DELETE FROM records WHERE id = '$recordid'"); + updateZoneSerial($row["domain_id"]); + } else { + echo "<p class=\"error\">· You don't have permission to delete this record- ($recordid)</p>\n"; + $error_occur = 1; + } + // Technically the above and below errors should happen, if they do it will be a very rare occasion. -sirvulcan + } else { + echo "<p class=\"error\">· Zone/record not found ($recordid)</p>\n"; + $error_occur = 1; + } + } + if ($error_occur == 1) { + echo "<p>Some records could not be deleted, please check make sure you have permission to access/delete them</p>"; + echo "<p>Some "; + } else { + echo "<p>All "; + } + echo "selected records were successfully deleted<br><a href=\"edit_zone.php?id=".$row["domain_id"]."\">Proceed»</a></p>\n"; + if ($error_occur != 1) { + echo "<script language=\"JavaScript\">\n"; + echo "document.location.href='edit_zone.php?id=".$row["domain_id"]."';\n"; + echo "</script>\n"; + } + $dbh->disconnect(); + } +} else { + displayNoAccess(); +} + +require("lib/footer.php"); + +?> Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.21 publicdnsadmin/docs/CHANGELOG:1.22 --- publicdnsadmin/docs/CHANGELOG:1.21 Wed Jul 16 09:03:08 2003 +++ publicdnsadmin/docs/CHANGELOG Thu Jul 17 05:02:28 2003 @@ -1,3 +1,10 @@ $Id: OUTsider <out...@ke...> - 16/7/2003 - Released 1.1 +SiRVulcaN <sir...@si...> - 17/7/2003 - Allow users to delete multiple records at once. + - Full MBOXFW support added. + - Full URL support added. + - Full RP support added. + - Full HWINFO support added. + - Full A6 support completed. + - Full NS6 support completed. Index: publicdnsadmin/docs/TODO diff -u publicdnsadmin/docs/TODO:1.9 publicdnsadmin/docs/TODO:1.10 --- publicdnsadmin/docs/TODO:1.9 Wed Jul 16 08:04:18 2003 +++ publicdnsadmin/docs/TODO Thu Jul 17 05:02:28 2003 @@ -1,4 +1,3 @@ - Some sort of maintenence news system (displayed on the main login page). -- Add URL/HWINFO/MBOXFW/RP record type support. - Syntax check records for validity to make it more fool proof. Index: publicdnsadmin/edit_record.php diff -u publicdnsadmin/edit_record.php:1.3 publicdnsadmin/edit_record.php:1.4 --- publicdnsadmin/edit_record.php:1.3 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/edit_record.php Thu Jul 17 05:02:28 2003 @@ -32,6 +32,10 @@ $record_name = preg_replace("/^(.*)$preg_dom$/", '\1', $row["name"]); $record_name = preg_replace("/^\.+/", "", $record_name); $record_name = preg_replace("/\.+$/", "", $record_name); + if ($row["type"] == "MBOXFW") { + $record_split = split("@", $record_name); + $record_name = $record_split[0]; + } ?> <form action="update_record.php?id=<?php echo $recordid; ?>" method="post"> @@ -40,9 +44,13 @@ <td><b>Record:</b></td> <? if ($row["type"] != "PTR") { + if ($row["type"] == "MBOXFW") { + echo "<td><input type=\"text\" name=\"record\" size=\"15\" maxlength=\"200\" value=\"" . htmlentities($record_name) . "\">@" . htmlentities($row["domain_name"]) . "</td>"; + } else { ?> <td><input type="text" name="record" size="15" maxlength="200" value="<?php echo htmlentities($record_name); ?>">.<?php echo htmlentities($row["domain_name"]); ?></td> <? + } } else { $expaddy = explode(".", htmlentities($record_name)); $dispaddy = $expaddy[3].".".$expaddy[2].".".$expaddy[1].".".$expaddy[0]; @@ -64,6 +72,10 @@ <option value="PTR"<?php if ($row["type"] == "PTR") { ?> selected<?php } ?>>PTR</option> <option value="CNAME"<?php if ($row["type"] == "CNAME") { ?> selected<?php } ?>>CNAME</option> <option value="TXT"<?php if ($row["type"] == "TXT") { ?> selected<?php } ?>>TXT</option> + <option value="MBOXFW"<?php if ($row["type"] == "MBOXFW") { ?> selected<?php } ?>>MBOXFW</option> + <option value="URL"<?php if ($row["type"] == "URL") { ?> selected<?php } ?>>URL</option> + <option value="RP"<?php if ($row["type"] == "RP") { ?> selected<?php } ?>>RP</option> + <option value="HWINFO"<?php if ($row["type"] == "HWINFO") { ?> selected<?php } ?>>HWINFO</option> </select></td> </tr> <tr> Index: publicdnsadmin/edit_template_record.php diff -u publicdnsadmin/edit_template_record.php:1.2 publicdnsadmin/edit_template_record.php:1.3 --- publicdnsadmin/edit_template_record.php:1.2 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/edit_template_record.php Thu Jul 17 05:02:28 2003 @@ -37,7 +37,11 @@ <table border="0" cellspacing="0" cellpadding="2"> <tr> <td><b>Record:</b></td> +<? if ($row["type"] == "MBOXFW") { ?> + <td><input type="text" name="record" size="15" maxlength="200" value="<?php echo htmlentities($record_name); ?>">@$DOMAIN</td> +<? } else { ?> <td><input type="text" name="record" size="15" maxlength="200" value="<?php echo htmlentities($record_name); ?>">.$DOMAIN</td> +<? } ?> </tr> <tr> <td><b>Type:</b></td> @@ -51,6 +55,10 @@ <option value="PTR"<?php if ($row["type"] == "PTR") { ?> selected<?php } ?>>PTR</option> <option value="CNAME"<?php if ($row["type"] == "CNAME") { ?> selected<?php } ?>>CNAME</option> <option value="TXT"<?php if ($row["type"] == "TXT") { ?> selected<?php } ?>>TXT</option> + <option value="MBOXFW"<?php if ($row["type"] == "MBOXFW") { ?> selected<?php } ?>>MBOXFW</option> + <option value="URL"<?php if ($row["type"] == "URL") { ?> selected<?php } ?>>URL</option> + <option value="RP"<?php if ($row["type"] == "RP") { ?> selected<?php } ?>>RP</option> + <option value="HWINFO"<?php if ($row["type"] == "HWINFO") { ?> selected<?php } ?>>HWINFO</option> </select></td> </tr> <tr> Index: publicdnsadmin/edit_zone.php diff -u publicdnsadmin/edit_zone.php:1.2 publicdnsadmin/edit_zone.php:1.3 --- publicdnsadmin/edit_zone.php:1.2 Fri Jun 13 06:28:58 2003 +++ publicdnsadmin/edit_zone.php Thu Jul 17 05:02:28 2003 @@ -35,7 +35,14 @@ $records = getRecords($zoneid); echo "<p>· <a href=\"new_record.php?zone=$zoneid\">New record</a></p>\n"; - echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; + + echo "<form action=\"delete_multi_records.php\" method=\"post\">\n"; + + if (count($records) > 1) { + echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th><input type=\"submit\" value=\"Del\"></th><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; + } else { + echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: #000000;\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><th><input type=\"submit\" disabled=\"true\" value=\"Del\"></th><th>Record</th><th>Type</th><th>Content</th><th>Priority</th><th>TTL</th><th> </th></tr>\n"; + } $row_id = 0; foreach ($records as $record) { @@ -47,10 +54,19 @@ $priority = " "; } - echo "<tr>\n"; + echo "<tr><td class=\"row$row_id\">"; + if ($record["type"] != "SOA") { + echo "<input type=\"checkbox\" name=\"recdel[]\" value=\"". $record["id"] ."\">"; + } + echo "</td>"; + if (htmlentities($record["type"]) != "PTR") { if ($record["type"] != "SOA") { - echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">".htmlentities($record["name"])."</a></td>\n"; + if ($record["type"] == "MBOXFW") { + echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">". $record["name"] ."</a></td>\n"; + } else { + echo "<td class=\"row$row_id\"><a href=\"edit_record.php?id=".$record["id"]."\">".htmlentities($record["name"])."</a></td>\n"; + } } else { echo "<td class=\"row$row_id\">".htmlentities($record["name"])."</td>\n"; } @@ -80,7 +96,7 @@ if ($row_id == 2) { $row_id = 0; } } - echo "</table></td></tr></table>\n"; + echo "</table></td></tr></table></form>\n"; } else { echo "<p class=\"error\">· You don't have permission to edit this domain</p>\n"; Index: publicdnsadmin/lib/records.inc.php diff -u publicdnsadmin/lib/records.inc.php:1.2 publicdnsadmin/lib/records.inc.php:1.3 --- publicdnsadmin/lib/records.inc.php:1.2 Fri Jun 13 06:29:00 2003 +++ publicdnsadmin/lib/records.inc.php Thu Jul 17 05:02:28 2003 @@ -7,7 +7,7 @@ Distributed under the GPL license, see LICENSE for more information - $Id: records.inc.php,v 1.2 2003/06/13 13:29:00 sirvulcan Exp $ + $Id: records.inc.php,v 1.3 2003/07/17 12:02:28 sirvulcan Exp $ */ function getRecords($zoneid) { @@ -72,10 +72,58 @@ } } + /* Fetch MBOXFW */ + $rec = getRecordsByType($zoneid, "MBOXFW"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + + /* Fetch URL */ + $rec = getRecordsByType($zoneid, "URL"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + + /* Fetch RP */ + $rec = getRecordsByType($zoneid, "RP"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + + /* Fetch HWINFO */ + $rec = getRecordsByType($zoneid, "HWINFO"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + + /* Fetch A6 */ + $rec = getRecordsByType($zoneid, "A6"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + + /* Fetch NS6 */ + $rec = getRecordsByType($zoneid, "NS6"); + if (count($rec)) { + foreach ($rec as $r) { + array_push($records, $r); + } + } + /* Fetch everything else */ $dbh = db_connect(); - $result = $dbh->query("SELECT * FROM records WHERE domain_id = '$zoneid' AND (type <> 'SOA' AND type <> 'NS' AND type <> 'MX' AND type <> 'A' AND type <> 'AAAA' AND type <> 'PTR' AND type <> 'CNAME')"); + $result = $dbh->query("SELECT * FROM records WHERE domain_id = '$zoneid' AND (type <> 'SOA' AND type <> 'NS' AND type <> 'MX' AND type <> 'A' AND type <> 'AAAA' AND type <> 'PTR' AND type <> 'CNAME' AND type <> 'MBOXFW' AND type <> 'URL' AND type <> 'RP' AND type <> 'HWINFO' AND type <> 'A6' AND type <> 'NS6')"); if (!$dbh->isError($result) && $result->numRows()) { while ($row = $result->fetchRow()) { @@ -156,8 +204,31 @@ if (!$content) { $ok = 0; } - } + } elseif ($type == "MBOXFW") { + if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$",$content)) { + $ok = 0; + } + } elseif ($type == "URL") { + if (!preg_match('#^http[s]?:\/\/#i', $content)) { + $content = 'http://' . $content; + } + if (!preg_match('#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $content)) { + $ok = 0; + } + } elseif ($type == "HWINFO") { + if (!$content) { + $ok = 0; + } + } elseif ($type == "A6") { + if (!preg_match("/^[0-9a-f\:]+$/", $content)) { + $ok = 0; + } + } elseif ($type == "NS6") { + if (!preg_match("/^[0-9a-f\:]+$/", $content)) { + $ok = 0; + } + } return $ok; } @@ -207,6 +278,30 @@ if (!$content) { $ok = 0; } + } elseif ($type == "MBOXFW") { + if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$",$content)) { + $ok = 0; + } + } elseif ($type == "URL") { + if (!preg_match('#^http[s]?:\/\/#i', $content)) { + $content = 'http://' . $content; + } + + if (!preg_match('#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $content)) { + $ok = 0; + } + } elseif ($type == "HWINFO") { + if (!$content) { + $ok = 0; + } + } elseif ($type == "A6") { + if (!preg_match("/^[0-9a-f\:]+/", $content)) { + $ok = 0; + } + } elseif ($type == "NS6") { + if (!preg_match("/^[0-9a-f\:]+/", $content)) { + $ok = 0; + } } return $ok; @@ -254,6 +349,26 @@ $ok = 0; } } elseif ($type == "CNAME") { + if ($record and !preg_match("/^[a-zA-Z0-9-_\.\*]+$/", $record)) { + if ($template and preg_match("/\\\$CONTENT/", $record)) { + $ok = 1; + } else { + $ok = 0; + } + } + } elseif ($type == "MBOXFW") { + if (eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*". "@([a-z0-9]+([\.-][a-z0-9]+))*$",$record)) { + $ok = 0; + } + } elseif ($type == "A6") { + if ($record and !preg_match("/^[a-zA-Z0-9-_\.\*]+$/", $record)) { + if ($template and preg_match("/\\\$CONTENT/", $record)) { + $ok = 1; + } else { + $ok = 0; + } + } + } elseif ($type == "NS6") { if ($record and !preg_match("/^[a-zA-Z0-9-_\.\*]+$/", $record)) { if ($template and preg_match("/\\\$CONTENT/", $record)) { $ok = 1; Index: publicdnsadmin/new_record.php diff -u publicdnsadmin/new_record.php:1.3 publicdnsadmin/new_record.php:1.4 --- publicdnsadmin/new_record.php:1.3 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/new_record.php Thu Jul 17 05:02:28 2003 @@ -49,6 +49,10 @@ <option value="PTR">PTR</option> <option value="CNAME">CNAME</option> <option value="TXT">TXT</option> + <option value="MBOXFW">MBOXFW</option> + <option value="URL">URL</option> + <option value="RP">RP</option> + <option value="HWINFO">HWINFO</option> </select></td> </tr> <tr> Index: publicdnsadmin/new_template_record.php diff -u publicdnsadmin/new_template_record.php:1.2 publicdnsadmin/new_template_record.php:1.3 --- publicdnsadmin/new_template_record.php:1.2 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/new_template_record.php Thu Jul 17 05:02:28 2003 @@ -48,6 +48,10 @@ <option value="PTR">PTR</option> <option value="CNAME">CNAME</option> <option value="TXT">TXT</option> + <option value="MBOXFW">MBOXFW</option> + <option value="URL">URL</option> + <option value="RP">RP</option> + <option value="HWINFO">HWINFO</option> </select></td> </tr> <tr> Index: publicdnsadmin/update_record.php diff -u publicdnsadmin/update_record.php:1.3 publicdnsadmin/update_record.php:1.4 --- publicdnsadmin/update_record.php:1.3 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/update_record.php Thu Jul 17 05:02:28 2003 @@ -38,7 +38,7 @@ $domain = addslashes($row["name"]); $record = preg_replace("/\.+$/", "", $record); /* Remove trailing .'s */ - if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" ) { + if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" and $type != "MBOXFW" and $type != "URL" and $type != "RP" and $type != "HWINFO") { echo "<p class=\"error\">· Invalid pointer type: \"$type\"</p>\n"; } else { @@ -75,7 +75,11 @@ if ($type == "PTR") { $record_name = preg_replace("/^\.+/", "", "$record"); } else { - $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + if ($type == "MBOXFW") { + $record_name = "$record@$domain"; + } else { + $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + } } $dbh->query("UPDATE records SET name = '$record_name', type = '$type', content = '$content', ttl = '$ttl', prio = '$prio', change_date = '".time()."' WHERE id = '$recordid'"); updateZoneSerial($row["id"]); Index: publicdnsadmin/update_template_record.php diff -u publicdnsadmin/update_template_record.php:1.3 publicdnsadmin/update_template_record.php:1.4 --- publicdnsadmin/update_template_record.php:1.3 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/update_template_record.php Thu Jul 17 05:02:28 2003 @@ -35,7 +35,7 @@ $domain = '$DOMAIN'; $record = preg_replace("/\.+$/", "", $record); /* Remove trailing .'s */ - if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT"and $type != "A6" and $type != "NS6" ) { + if ($type != "NS" and $type != "MX" and $type != "A" and $type != "AAAA" and $type != "PTR" and $type != "CNAME" and $type != "TXT" and $type != "A6" and $type != "NS6" and $type != "MBOXFW" and $type != "URL" and $type != "RP" and $type != "HWINFO") { echo "<p class=\"error\">· Invalid pointer type: \"$type\"</p>\n"; } else { @@ -59,7 +59,12 @@ echo "<p class=\"error\">· Invalid record data for pointer type</p>\n"; } else { - $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + if ($type == "MBOXFW") { + $record_name = "$record@$domain"; + } else { + $record_name = preg_replace("/^\.+/", "", "$record.$domain"); + } + $dbh->query("UPDATE template_records SET name = '$record_name', type = '$type', content = '$content', ttl = '$ttl', prio = '$prio' WHERE id = '$recordid'"); echo "<p>The record was updated<br><a href=\"edit_template.php?id=".$row["id"]."\">Proceed »</a></p>\n"; echo "<script language=\"JavaScript\">\n"; ----------------------- End of diff ----------------------- |