use UUID's for api keys and rename ENABLE_DEBUG_MODE to ENABLE_DEBUG
[GitHub/Stricted/Domain-Control-Panel.git] / lib / page / RecordEditPage.class.php
index 4a2caf655251cc5372ec9ab2dd1a41abd70343d7..9497ec84ddd25cc8effbb16fa8212ccc80cca1b5 100644 (file)
@@ -38,9 +38,16 @@ class RecordEditPage extends AbstractPage {
                $types = array('A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SRV', 'TXT', 'TLSA', 'NS', 'DS');
                $error = array();
                if (isset($_POST['submit']) && !empty($_POST['submit'])) {
-                       if (isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['ttl']) && !empty($_POST['ttl']) && isset($_POST['type']) && !empty($_POST['type']) && isset($_POST['data']) && !empty($_POST['data'])) {
+                       if (isset($_POST['name']) && isset($_POST['ttl']) && !empty($_POST['ttl']) && isset($_POST['type']) && !empty($_POST['type']) && isset($_POST['data']) && !empty($_POST['data'])) {
                                $type = trim($_POST['type']);
-                               $name = $idna->encode(trim($_POST['name']));
+                               
+                               if (!empty($_POST['name'])) {
+                                       $name = $idna->encode(trim($_POST['name']));
+                               }
+                               else {
+                                       $name = $idna->encode(trim($soa['origin']));
+                               }
+                               
                                if (in_array($type, $types)) {
                                        $aux = 0;
                                        if (($type == "MX" || $type == "TLSA" || $type == "SRV" || $type == "DS") && isset($_POST['aux']) && !empty($_POST['aux'])) {
@@ -113,7 +120,7 @@ class RecordEditPage extends AbstractPage {
                        $res = DNS::getDB()->query($sql, array($rr['zone'], $name, $type, $data, $_GET['id']));
                        $rr = DNS::getDB()->fetch_array($res);
                        if (!empty($rr)) {
-                               $error = array_merge($error, array('name', 'type', 'data'));
+                               $error = array_merge($error, array('type', 'data'));
                        }
                        
                        if (empty($error)) {