Initial netmail import
This commit is contained in:
@@ -13,6 +13,7 @@ trait ParseNodes
|
||||
{
|
||||
$net = FALSE;
|
||||
$result = collect();
|
||||
|
||||
foreach (explode(' ',$line) as $node)
|
||||
{
|
||||
if (preg_match('#/#',$node))
|
||||
@@ -23,7 +24,7 @@ trait ParseNodes
|
||||
if (! $net)
|
||||
throw new \Exception('Missing Net?',$node);
|
||||
|
||||
$result->push($this->get_node($zone->id,$net,$node,0),$create);
|
||||
$result->push($this->get_node($zone->id,$net,$node,0,$create));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
26
app/Traits/ParseZNFPDomain.php
Normal file
26
app/Traits/ParseZNFPDomain.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
trait ParseZNFPDomain
|
||||
{
|
||||
private function parse_znfp_domain(string $data,$create=TRUE)
|
||||
{
|
||||
$z = substr($data,0,strpos($data,':'));
|
||||
|
||||
$x = strpos($data,':')+1;
|
||||
$n = substr($data,$x,strpos($data,'/')-$x);
|
||||
|
||||
$x = strpos($data,'/')+1;
|
||||
$f = substr($data,$x,(strpos($data,'.') OR strpos($data,'@')) ?: strlen($data)-$x);
|
||||
|
||||
$x = strpos($data,'.');
|
||||
$p = $x ? substr($data,$x+1,strpos($data,'@') ?: strlen($data)-$x) : 0;
|
||||
|
||||
// @todo We dont handle domain yet.
|
||||
$x = strpos($data,'@');
|
||||
$d = $x ? substr($data,$x+1) : 0;
|
||||
|
||||
return $this->get_node($z,$n,$f,$p,$create);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user