diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index 268ac04..d65bda1 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -203,6 +203,8 @@ class Message extends FTNBase case 'msgid': return $this->kludge->get('msgid'); case 'message': + return utf8_decode($this->{$key}); + case 'subject': case 'user_to': case 'user_from': @@ -374,7 +376,7 @@ class Message extends FTNBase * Anything after the origin line is also kludge data. */ if ($y = strpos($v,"\r * Origin: ")) { - $this->message .= substr($v,$x+1,$y-$x-1); + $this->message .= utf8_encode(substr($v,$x+1,$y-$x-1)); $this->parseOrigin(substr($v,$y)); // If this is netmail, the FQFA will have been set by the INTL line, we can skip the rest of this @@ -400,7 +402,7 @@ class Message extends FTNBase // The message is the rest? } elseif (strlen($v) > $x+1) { - $this->message .= substr($v,$x+1); + $this->message .= utf8_encode(substr($v,$x+1)); } $v = substr($v,0,$x+1); @@ -506,6 +508,7 @@ class Message extends FTNBase * Translate the string into something printable via the web * * @param string $string + * @param array $skip * @return string */ public static function tr(string $string,array $skip=[0x0a,0x0d]): string diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index f0c4736..2511bbe 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -67,6 +67,7 @@ class DomainController extends Controller ->when($region,function($query,$region) { return $query->where('region_id',$region)->where('node_id','<>',0); }) ->when((! $region),function($query) use ($region) { return $query->where('region_id',0); }) ->where('point_id',0) + ->FTNorder() ->with(['system']) ->get(); diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 1300ddd..4cfd4a5 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -79,22 +79,20 @@ class SystemController extends Controller 'host_id_new' => [ 'required', new TwoByteInteger, - function ($attribute,$value,$fail) { + function ($attribute,$value,$fail) use ($request) { // Check that the region doesnt already exist $o = Address::where(function($query) use ($value) { return $query->where('region_id',$value) - ->where('host_id',0) - ->where('node_id',0) - ->where('point_id',0) ->where('role',DomainController::NODE_RC); }) // Check that a host doesnt already exist ->orWhere(function($query) use ($value) { return $query->where('host_id',$value) - ->where('node_id',0) - ->where('point_id',0) ->where('role',DomainController::NODE_NC); - }); + }) + ->where('zone_id',$request->post('zone_id')) + ->where('point_id',0) + ->where('active',TRUE); if ($o->count()) { $fail('Region or host already exists');