<?php
function import_dnsbls() {
  global $db;

  $dnsbl_inserts = [
      ['Spamhaus DBL', 'dbl.spamhaus.org', 'https://www.spamhaus.org/lookup/', 'host', '2023-10-01', 1],
      ['SURBL multi', 'multi.surbl.org', 'https://www.surbl.org/surbl-analysis', 'host', '2023-10-01', 1],
      ['ivmURI', 'ivmuri.fabel.dk', 'http://www.fabel.dk/', 'host', '2023-10-01', 1],
      ['Nordspam DBL', 'dbl.nordspam.com', 'https://www.nordspam.com/', 'host', '2023-10-01', 1],
      ['SEM FRESH', 'fresh.spameatingmonkey.net', 'https://spameatingmonkey.com/', 'host', '2023-10-01', 1],
      ['SEM URI', 'uribl.spameatingmonkey.net', 'https://spameatingmonkey.com/', 'host', '2023-10-01', 1],
      ['SEM URIRED', 'urired.spameatingmonkey.net', 'https://spameatingmonkey.com/', 'host', '2023-10-01', 1],
      ['SORBS RHSBL BADCONF', 'badconf.rhsbl.sorbs.net', 'http://www.sorbs.net/', 'host', '2023-10-01', 1],
      ['SORBS RHSBL NOMAIL', 'nomail.rhsbl.sorbs.net', 'http://www.sorbs.net/', 'host', '2023-10-01', 1],
      ['Abusix Mail Intelligence Domain Blacklist', 'dblack.mail.abusix.zone', 'https://abusix.com/', 'host', '2023-10-01', 1],
      ['0SPAM', 'bl.0spam.org', 'https://0spam.org/', 'ip', '2023-10-01', 1],
      ['0SPAM RBL', 'nbl.0spam.org', 'https://0spam.org/', 'ip', '2023-10-01', 1],
      ['Abusix Mail Intelligence Blacklist', 'black.mail.abusix.zone', 'https://abusix.com/', 'ip', '2023-10-01', 1],
      ['Abusix Mail Intelligence Exploit list', 'exploit.mail.abusix.zone', 'https://abusix.com/', 'ip', '2023-10-01', 1],
      ['Anonmails DNSBL', 'spam.dnsbl.anonmails.de', 'http://www.anonmails.de/', 'ip', '2023-10-01', 1],
      ['BACKSCATTERER', 'ips.backscatterer.org', 'http://www.backscatterer.org/', 'ip', '2023-10-01', 1],
      ['BARRACUDA', 'b.barracudacentral.org', 'http://www.barracudacentral.org/', 'ip', '2023-10-01', 1],
      ['BLOCKLIST.DE', 'bl.blocklist.de', 'https://www.blocklist.de/', 'ip', '2023-10-01', 1],
      ['CALIVENT', 'dnsbl.calivent.com.pe', 'http://dnsbl.calivent.com.pe/', 'ip', '2023-10-01', 1],
      ['CYMRU BOGONS', 'bogons.cymru.com', 'http://www.team-cymru.org/', 'ip', '2023-10-01', 1],
      ['DAN TOR', 'tor.dan.me.uk', 'https://www.dan.me.uk/', 'ip', '2023-10-01', 1],
      ['DAN TOREXIT', 'torexit.dan.me.uk', 'https://www.dan.me.uk/', 'ip', '2023-10-01', 1],
      ['DRMX', 'bl.drmx.org', 'http://www.drmx.org/', 'ip', '2023-10-01', 1],
      ['DRONE BL', 'dnsbl.dronebl.org', 'http://www.dronebl.org/', 'ip', '2023-10-01', 1],
      ['FABELSOURCES', 'spamsources.fabel.dk', 'http://www.fabel.dk/', 'ip', '2023-10-01', 1],
      ['HIL', 'hil.habeas.com', 'http://www.habeas.com/', 'ip', '2023-10-01', 1],
      ['HIL2', 'hil2.habeas.com', 'http://www.habeas.com/', 'ip', '2023-10-01', 1],
      ['Hostkarma Black', 'black.junkemailfilter.com', 'http://wiki.junkemailfilter.com/', 'ip', '2023-10-01', 1],
      ['IBM DNS Blacklist', 'dnsbl.cobion.com', 'http://www-01.ibm.com/', 'ip', '2023-10-01', 1],
      ['ICMFORBIDDEN', 'forbidden.icm.edu.pl', 'http://icm.edu.pl/', 'ip', '2023-10-01', 1],
      ['IMP SPAM', 'spamrbl.imp.ch', 'http://antispam.imp.ch/', 'ip', '2023-10-01', 1],
      ['IMP WORM', 'wormrbl.imp.ch', 'http://antispam.imp.ch/', 'ip', '2023-10-01', 1],
      ['INTERSERVER', 'rbl.interserver.net', 'http://rbl.interserver.net/', 'ip', '2023-10-01', 1],
      ['ivmSIP', 'ivmsip.fabel.dk', 'http://www.fabel.dk/', 'ip', '2023-10-01', 1],
      ['ivmSIP24', 'ivmsip24.fabel.dk', 'http://www.fabel.dk/', 'ip', '2023-10-01', 1],
      ['JIPPG', 'mail-abuse.blacklist.jippg.org', 'http://blacklist.jippg.org/', 'ip', '2023-10-01', 1],
      ['KEMPTBL', 'dnsbl.kempt.net', 'http://www.kempt.net/', 'ip', '2023-10-01', 1],
      ['Konstant', 'bl.konstant.no', 'http://bl.konstant.no/', 'ip', '2023-10-01', 1],
      ['LASHBACK', 'ubl.unsubscore.com', 'http://www.lashback.com/', 'ip', '2023-10-01', 1],
      ['MAILSPIKE BL', 'bl.mailspike.net', 'http://mailspike.org/', 'ip', '2023-10-01', 1],
      ['MAILSPIKE Z', 'z.mailspike.net', 'http://mailspike.org/', 'ip', '2023-10-01', 1],
      ['MSRBL Phishing', 'phishing.rbl.msrbl.net', 'http://www.msrbl.com/', 'ip', '2023-10-01', 1],
      ['MSRBL Spam', 'spam.rbl.msrbl.net', 'http://www.msrbl.com/', 'ip', '2023-10-01', 1],
      ['NETHERRELAYS', 'relays.nether.net', 'http://puck.nether.net/', 'ip', '2023-10-01', 1],
      ['NETHERUNSURE', 'unsure.nether.net', 'http://puck.nether.net/', 'ip', '2023-10-01', 1],
      ['Nordspam BL', 'bl.nordspam.com', 'https://www.nordspam.com/', 'ip', '2023-10-01', 1],
      ['PSBL', 'psbl.surriel.com', 'http://psbl.surriel.com/', 'ip', '2023-10-01', 1],
      ['RATS Dyna', 'dyna.spamrats.com', 'http://www.spamrats.com/', 'ip', '2023-10-01', 1],
      ['RATS NoPtr', 'noptr.spamrats.com', 'http://www.spamrats.com/', 'ip', '2023-10-01', 1],
      ['RATS Spam', 'spam.spamrats.com', 'http://www.spamrats.com/', 'ip', '2023-10-01', 1],
      ['RBL JP', 'rbl.jp', 'http://www.rbl.jp/', 'ip', '2023-10-01', 1],
      ['s5h.net', 'all.s5h.net', 'http://www.s5h.net/', 'ip', '2023-10-01', 1],
      ['SCHULTE', 'rbl.schulte.org', 'http://rbl.schulte.org/', 'ip', '2023-10-01', 1],
      ['SEM BACKSCATTER', 'backscatter.spameatingmonkey.net', 'https://spameatingmonkey.com/', 'ip', '2023-10-01', 1],
      ['SEM BLACK', 'bl.spameatingmonkey.net', 'https://spameatingmonkey.com/', 'ip', '2023-10-01', 1],
      ['Sender Score Reputation Network', 'bl.score.senderscore.com', 'https://senderscore.org/', 'ip', '2023-10-01', 1],
      ['SERVICESNET', 'korea.services.net', 'http://korea.services.net/', 'ip', '2023-10-01', 1],
      ['SPAMCOP', 'bl.spamcop.net', 'https://www.spamcop.net/', 'ip', '2023-10-01', 1],
      ['Spamhaus ZEN', 'zen.spamhaus.org', 'https://www.spamhaus.org/', 'ip', '2023-10-01', 1],
      ['SPFBL DNSBL', 'dnsbl.spfbl.net', 'https://spfbl.net/', 'ip', '2023-10-01', 1],
      ['Suomispam Reputation', 'bl.suomispam.net', 'http://suomispam.net/', 'ip', '2023-10-01', 1],
      ['SWINOG', 'dnsrbl.swinog.ch', 'http://antispam.imp.ch/', 'ip', '2023-10-01', 1],
      ['TRIUMF', 'rbl2.triumf.ca', 'http://rbl2.triumf.ca/', 'ip', '2023-10-01', 1],
      ['TRUNCATE', 'truncate.gbudb.net', 'http://www.gbudb.com/', 'ip', '2023-10-01', 1],
      ['UCEPROTECTL1', 'dnsbl-1.uceprotect.net', 'https://www.uceprotect.net/', 'ip', '2023-10-01', 1],
      ['UCEPROTECTL2', 'dnsbl-2.uceprotect.net', 'https://www.uceprotect.net/', 'ip', '2023-10-01', 1],
      ['UCEPROTECTL3', 'dnsbl-3.uceprotect.net', 'https://www.uceprotect.net/', 'ip', '2023-10-01', 1],
      ['Woodys SMTP Blacklist', 'blacklist.woody.ch', 'http://www.woody.ch/', 'ip', '2023-10-01', 1],
      ['ZapBL', 'dnsbl.zapbl.net', 'https://zapbl.net/', 'ip', '2023-10-01', 1],
  ];

  $values = [];
  foreach ($dnsbl_inserts as $row) {
      list($name, $dnszone, $url, $type, $last_verified, $is_active) = $row;
      $name = $db->escape_string($name);
      $dnszone = $db->escape_string($dnszone);
      $url = $db->escape_string($url); 
      $type = $db->escape_string($type);
      $last_verified = $db->escape_string($last_verified);
      $is_active = (int)$is_active;
      $values[] = "('$name', '$dnszone', '$url', '$type', '$last_verified', $is_active)";
  }

  if (!empty($values)) {
      $insert_sql = "INSERT INTO `evp_dnsbl` (`name`, `dnszone`, `url`, `type`, `last_verified`, `is_active`) VALUES " . implode(",\n", $values) . ";";
      return $insert_sql;
  } else {
      return '';
  }
}
?>