Marius Burkard
2016-07-01 49441bdd0f3ff75d5092d5b832b97ea722a66363
interface/web/dns/dns_import.php
@@ -38,10 +38,22 @@
$error = '';
// Loading the template
$app->uses('tpl,validate_dns');
$app->uses('tform,tpl,validate_dns');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl', 'templates/dns_import.htm');
$app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
// Check if dns record limit has been reached. We will check only users, not admins
if($_SESSION["s"]["user"]["typ"] == 'user') {
   $app->tform->formDef['db_table_idx'] = 'id';
   $app->tform->formDef['db_table'] = 'dns_soa';
   if(!$app->tform->checkClientLimit('limit_dns_zone')) {
      $app->error($app->lng('limit_dns_zone_txt'));
   }
   if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
      $app->error('Reseller: '.$app->lng('limit_dns_zone_txt'));
   }
}
// import variables
$template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0;
@@ -216,7 +228,7 @@
      $line = trim($line);
      if ($line != '' && substr($line, 0, 1) != ';'){
         if(strpos($line, ";") !== FALSE) {
            if (!preg_match("/v=DKIM|v=DMARC/",$line)) {
            if(!preg_match("/\"[^\"]+;[^\"]*\"/", $line)) {
               $line = substr($line, 0, strpos($line, ";"));
            }
         }
@@ -267,12 +279,13 @@
      $parts = explode(' ', $line);
      // make elements lowercase
      $dkim=@($parts[3]=='"v=DKIM1;')?true:false;
      $dmarc=@($parts[3]=='"v=DMARC1;')?true:false;
      $new_parts = array();
      foreach($parts as $part){
         if(!$dkim && !$dmarc) {
      if(
         (strpos($part, ';') === false) &&
         (!preg_match("/^\"/", $part)) &&
         (!preg_match("/\"$/", $part))
      ) {
            $new_parts[] = strtolower($part);
         } else {
            $new_parts[] = $part;