Example #1
0
                 $ttl = $soa['ttl'];
                 $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES\n\t\t\t\t\t('{$sys_userid}', '{$sys_groupid}', 'riud', 'riud', '', '{$server_id}', '{$origin}', '{$ns}', '{$mbox}', '{$serial}', '{$refresh}', '{$retry}', '{$expire}', '{$minimum}', '{$ttl}', 'Y', '')";
                 $dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
                 unset($parts);
                 $msg .= 'Import Zone: ' . $soa['name'] . '<br />';
                 //* Process the other records
                 $records = $exdb->queryAllRecords("SELECT * FROM records WHERE type != 'SOA' AND domain_id = " . $domain['id']);
                 if (is_array($records)) {
                     foreach ($records as $rec) {
                         $rr = array();
                         $rr['name'] = addot($rec['name']);
                         $rr['type'] = $rec['type'];
                         $rr['aux'] = $rec['prio'];
                         $rr['ttl'] = $rec['ttl'];
                         if ($rec['type'] == 'NS' || $rec['type'] == 'MX' || $rec['type'] == 'CNAME') {
                             $rr['data'] = addot($rec['content']);
                         } else {
                             $rr['data'] = $rec['content'];
                         }
                         $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES\n\t\t\t\t\t\t\t('{$sys_userid}', '{$sys_groupid}', 'riud', 'riud', '', '{$server_id}', '{$dns_soa_id}', '{$rr['name']}', '{$rr['type']}', '{$rr['data']}', '{$rr['aux']}', '{$rr['ttl']}', 'Y')";
                         $dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
                         //$msg .= $insert_data.'<br />';
                     }
                 }
             }
         }
     }
 } else {
     $error .= $exdb->errorMessage;
 }
 //* restore db login details
                 $ttl = $app->db->quote($soa['ttl']);
                 $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES\n\t\t\t\t\t('{$sys_userid}', '{$sys_groupid}', 'riud', 'riud', '', '{$server_id}', '{$origin}', '{$ns}', '{$mbox}', '{$serial}', '{$refresh}', '{$retry}', '{$expire}', '{$minimum}', '{$ttl}', 'Y', '')";
                 $dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
                 unset($parts);
                 $msg .= 'Import Zone: ' . $soa['name'] . '<br />';
                 //* Process the other records
                 $records = $exdb->queryAllRecords("SELECT * FROM records WHERE type != 'SOA' AND domain_id = " . $domain['id']);
                 if (is_array($records)) {
                     foreach ($records as $rec) {
                         $rr = array();
                         $rr['name'] = $app->db->quote(addot($rec['name']));
                         $rr['type'] = $app->db->quote($rec['type']);
                         $rr['aux'] = $app->db->quote($rec['prio']);
                         $rr['ttl'] = $app->db->quote($rec['ttl']);
                         if ($rec['type'] == 'NS' || $rec['type'] == 'MX' || $rec['type'] == 'CNAME') {
                             $rr['data'] = $app->db->quote(addot($rec['content']));
                         } else {
                             $rr['data'] = $app->db->quote($rec['content']);
                         }
                         $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES\n\t\t\t\t\t\t\t('{$sys_userid}', '{$sys_groupid}', 'riud', 'riud', '', '{$server_id}', '{$dns_soa_id}', '{$rr['name']}', '{$rr['type']}', '{$rr['data']}', '{$rr['aux']}', '{$rr['ttl']}', 'Y')";
                         $dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
                         //$msg .= $insert_data.'<br />';
                     }
                 }
             }
         }
     }
 } else {
     $error .= $exdb->errorMessage;
 }
 //* restore db login details