From ad36da0bb1e64b8ab58d84617ee8482e05016dcd Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 27 Jun 2023 19:39:11 +1200 Subject: [PATCH] Code cleanup, no functional changes --- app/Casts/CollectionOrNull.php | 13 ++-- app/Classes/ANSI.php | 4 +- app/Classes/FTN.php | 2 +- app/Classes/FTN/Message.php | 50 ++++++------ app/Classes/FTN/Packet.php | 2 +- app/Classes/FTN/Process.php | 2 +- app/Classes/File.php | 2 +- app/Classes/File/Item.php | 8 +- app/Classes/File/Receive.php | 25 +++--- app/Classes/File/Send.php | 2 +- app/Classes/Font.php | 19 ++--- app/Classes/Node.php | 2 +- app/Classes/Page.php | 6 +- app/Classes/Protocol.php | 19 +++-- app/Classes/Protocol/Binkp.php | 78 +++++++++---------- app/Classes/Protocol/EMSI.php | 32 ++++---- app/Classes/Protocol/Zmodem.php | 62 +++++++-------- app/Classes/Sock/SocketClient.php | 16 ++-- app/Console/Commands/AddressMerge.php | 44 +++++------ app/Console/Commands/CommBinkpReceive.php | 2 +- app/Console/Commands/CommEMSIReceive.php | 2 +- app/Console/Commands/CommZmodemReceive.php | 2 +- app/Console/Commands/FilesList.php | 42 +++++----- app/Console/Commands/InitialSetup.php | 40 +++++----- app/Console/Commands/ServerStart.php | 4 +- app/Console/Commands/TicProcess.php | 44 +++++------ .../Auth/ForgotPasswordController.php | 2 +- .../Controllers/Auth/RegisterController.php | 9 ++- app/Http/Controllers/SystemController.php | 10 +-- app/Http/Controllers/ZoneController.php | 2 +- app/Http/Middleware/ActiveUser.php | 7 +- app/Http/Middleware/AddUserToView.php | 70 ++++++++--------- .../Middleware/RedirectIfAuthenticated.php | 13 ++-- app/Jobs/MessageProcess.php | 2 +- app/Jobs/NodelistImport.php | 6 +- app/Models/Address.php | 21 +++-- app/Models/Echomail.php | 2 +- app/Models/File.php | 2 +- app/Models/Netmail.php | 2 +- app/Notifications/AddressLink.php | 2 +- app/Notifications/Channels/NetmailChannel.php | 4 +- app/Notifications/NetmailTest.php | 2 +- app/Policies/SystemPolicy.php | 2 +- app/Providers/AuthServiceProvider.php | 2 +- app/Rules/FidoInteger.php | 42 +++++----- app/Rules/TwoByteInteger.php | 6 +- app/Rules/TwoByteIntegerWithZero.php | 6 +- app/Traits/EncodeUTF8.php | 2 +- app/Traits/SingleOrFail.php | 13 ++-- app/helpers.php | 42 +++++----- resources/views/about.blade.php | 71 ++++++++++++----- resources/views/domain/home.blade.php | 2 +- resources/views/echoarea/home.blade.php | 2 +- resources/views/filearea/home.blade.php | 2 +- .../views/layouts/partials/topmenu.blade.php | 4 +- resources/views/pkt.blade.php | 4 +- resources/views/system/home.blade.php | 2 +- resources/views/system/ours.blade.php | 2 +- .../views/system/widget/echoarea.blade.php | 2 +- .../views/system/widget/filearea.blade.php | 2 +- resources/views/user/addedit.blade.php | 6 +- resources/views/user/link.blade.php | 4 +- .../views/user/system/register.blade.php | 4 +- resources/views/zone/home.blade.php | 2 +- 64 files changed, 466 insertions(+), 438 deletions(-) diff --git a/app/Casts/CollectionOrNull.php b/app/Casts/CollectionOrNull.php index ab1c04c..e50a852 100644 --- a/app/Casts/CollectionOrNull.php +++ b/app/Casts/CollectionOrNull.php @@ -3,7 +3,6 @@ namespace App\Casts; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; -use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; class CollectionOrNull implements CastsAttributes @@ -11,13 +10,13 @@ class CollectionOrNull implements CastsAttributes /** * Cast the given value. * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $key - * @param mixed $value - * @param array $attributes + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $key + * @param mixed $value + * @param array $attributes * @return Collection */ - public function get($model, string $key, $value, array $attributes): Collection + public function get($model,string $key,$value,array $attributes): Collection { return collect(json_decode($value, true)); } @@ -31,7 +30,7 @@ class CollectionOrNull implements CastsAttributes * @param array $attributes * @return string|null */ - public function set($model, string $key, $value, array $attributes): ?string + public function set($model,string $key,$value,array $attributes): ?string { return ($value->count()) ? json_encode($value) : NULL; } diff --git a/app/Classes/ANSI.php b/app/Classes/ANSI.php index 1defabb..c52d9f8 100644 --- a/app/Classes/ANSI.php +++ b/app/Classes/ANSI.php @@ -129,7 +129,7 @@ class ANSI foreach ($ansi as $line) { foreach ($line as $char) { - if ($char == 0x1b) { + if ($char === 0x1b) { $escape = TRUE; continue; } @@ -214,7 +214,7 @@ class ANSI $current['b'] = (int)$buffer; } - if ($c == 'm') { + if ($c === 'm') { $ansi = FALSE; $escape = FALSE; $line .= chr(0x1b).chr(self::code($current)); diff --git a/app/Classes/FTN.php b/app/Classes/FTN.php index 10fe3b9..71ae4a0 100644 --- a/app/Classes/FTN.php +++ b/app/Classes/FTN.php @@ -56,6 +56,7 @@ abstract class FTN * * @param array $pack * @return string + * @throws \Exception */ protected static function unpackheader(array $pack): string { @@ -75,6 +76,5 @@ abstract class FTN ->transform(function($k,$v) {return $k[1].$v;}) ->values() ->join('/'); - ; } } \ No newline at end of file diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index 766c6f0..9f4e03b 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -52,21 +52,21 @@ class Message extends FTNBase ]; // Flags for messages - public const FLAG_PRIVATE = 1<<0; - public const FLAG_CRASH = 1<<1; - public const FLAG_RECD = 1<<2; - public const FLAG_SENT = 1<<3; - public const FLAG_FILEATTACH = 1<<4; - public const FLAG_INTRANSIT = 1<<5; - public const FLAG_ORPHAN = 1<<6; - public const FLAG_KILLSENT = 1<<7; - public const FLAG_LOCAL = 1<<8; - public const FLAG_HOLD = 1<<9; - public const FLAG_UNUSED_10 = 1<<10; - public const FLAG_FREQ = 1<<11; - public const FLAG_RETRECEIPT = 1<<12; - public const FLAG_ISRETRECEIPT = 1<<13; - public const FLAG_AUDITREQ = 1<<14; + public const FLAG_PRIVATE = 1<<0; + public const FLAG_CRASH = 1<<1; + public const FLAG_RECD = 1<<2; + public const FLAG_SENT = 1<<3; + public const FLAG_FILEATTACH = 1<<4; + public const FLAG_INTRANSIT = 1<<5; + public const FLAG_ORPHAN = 1<<6; + public const FLAG_KILLSENT = 1<<7; + public const FLAG_LOCAL = 1<<8; + public const FLAG_HOLD = 1<<9; + public const FLAG_UNUSED_10 = 1<<10; + public const FLAG_FREQ = 1<<11; + public const FLAG_RETRECEIPT = 1<<12; + public const FLAG_ISRETRECEIPT = 1<<13; + public const FLAG_AUDITREQ = 1<<14; public const FLAG_FILEUPDATEREQ = 1<<15; public const FLAG_ECHOMAIL = 1<<16; @@ -220,14 +220,14 @@ class Message extends FTNBase switch ($key) { // From Addresses case 'fz': return Arr::get($this->src,'z'); - case 'fn': return $this->src ? Arr::get($this->src,'n') : Arr::get($this->header,'onet');; - case 'ff': return $this->src ? Arr::get($this->src,'f') : Arr::get($this->header,'onode');; + case 'fn': return $this->src ? Arr::get($this->src,'n') : Arr::get($this->header,'onet'); + case 'ff': return $this->src ? Arr::get($this->src,'f') : Arr::get($this->header,'onode'); case 'fp': return Arr::get($this->src,'p'); case 'fd': return Arr::get($this->src,'d'); case 'fdomain': // We'll use the zone's domain if this method class was called with a zone - if ($this->zone && (($this->zone->domain->name == Arr::get($this->src,'d')) || ! Arr::get($this->src,'d'))) + if ($this->zone && (($this->zone->domain->name === Arr::get($this->src,'d')) || ! Arr::get($this->src,'d'))) return $this->zone->domain; // If we get the domain from the packet, we'll find it @@ -239,7 +239,7 @@ class Message extends FTNBase case 'tdomain': // We'll use the zone's domain if this method class was called with a zone - if ($this->zone && (($this->zone->domain->name == Arr::get($this->dst,'d')) || ! Arr::get($this->dst,'d'))) + if ($this->zone && (($this->zone->domain->name === Arr::get($this->dst,'d')) || ! Arr::get($this->dst,'d'))) return $this->zone->domain; // If we get the domain from the packet, we'll find it @@ -252,11 +252,11 @@ class Message extends FTNBase case 'fzone': // Use the zone if this class was called with it. - if ($this->zone && ($this->fz == $this->zone->zone_id)) + if ($this->zone && ($this->fz === $this->zone->zone_id)) return $this->zone; if ($this->fdomain) { - if (($x=$this->fdomain->zones->search(function($item) { return $item->zone_id == $this->fz; })) !== FALSE) + if (($x=$this->fdomain->zones->search(function($item) { return $item->zone_id === $this->fz; })) !== FALSE) return $this->fdomain->zones->get($x); } @@ -267,11 +267,11 @@ class Message extends FTNBase case 'tzone': // Use the zone if this class was called with it. - if ($this->zone && ($this->tz == $this->zone->zone_id)) + if ($this->zone && ($this->tz === $this->zone->zone_id)) return $this->zone; if ($this->tdomain) { - if (($x=$this->tdomain->zones->search(function($item) { return $item->zone_id == $this->tz; })) !== FALSE) + if (($x=$this->tdomain->zones->search(function($item) { return $item->zone_id === $this->tz; })) !== FALSE) return $this->tdomain->zones->get($x); } @@ -285,7 +285,7 @@ class Message extends FTNBase case 'tz': return Arr::get($this->echoarea ? $this->src : $this->dst,'z'); case 'tn': return Arr::get($this->header,'dnet'); case 'tf': return Arr::get($this->header,'dnode'); - case 'tp': ;return Arr::get($this->dst,'p',0); // @todo this wont work for netmails, since dst is not set for in transit messages + case 'tp': return Arr::get($this->dst,'p',0); // @todo this wont work for netmails, since dst is not set for in transit messages case 'fftn': case 'fftn_o': @@ -658,7 +658,7 @@ class Message extends FTNBase } else { $node = (int)$item; - }; + } $ftn = sprintf('%d:%d/%d',$this->fz,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX); // @todo This should be enhanced to include the address at the time of the message. diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 8559643..fc9173d 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -253,7 +253,7 @@ class Packet extends FTNBase implements \Iterator, \Countable } // Take 2 chars from the buffer and check if we have our end packet signature - if ($last && ($buf_ptr == 0)) { + if ($last && ($buf_ptr === 0)) { $last .= substr($readbuf,0,2); if (($end=strpos($last,"\x00".self::PACKED_MSG_LEAD,$buf_ptr)) !== FALSE) { diff --git a/app/Classes/FTN/Process.php b/app/Classes/FTN/Process.php index 184f5a1..fb2b209 100644 --- a/app/Classes/FTN/Process.php +++ b/app/Classes/FTN/Process.php @@ -54,7 +54,7 @@ abstract class Process // Look for a space $space = strrpos($subtext,' '); - if ($space == FALSE) + if ($space === FALSE) $space = strlen($subtext); else $subtext = substr($text,$offset,$space); diff --git a/app/Classes/File.php b/app/Classes/File.php index 1d122bd..7ceb630 100644 --- a/app/Classes/File.php +++ b/app/Classes/File.php @@ -33,7 +33,7 @@ class File extends FileBase implements \Iterator if ($this->isPacket() || ($path instanceof UploadedFile && (strcasecmp($path->getClientOriginalExtension(),'pkt') === 0))) { $this->canHandle = TRUE; break; - }; + } default: Log::alert(sprintf('%s:? Unknown file received: %s (%s) [%s]',self::LOGKEY,$x,$this->getExtension(),$path instanceof UploadedFile ? $path->getClientOriginalExtension() : '-')); diff --git a/app/Classes/File/Item.php b/app/Classes/File/Item.php index 5caaffc..df70ab5 100644 --- a/app/Classes/File/Item.php +++ b/app/Classes/File/Item.php @@ -137,16 +137,16 @@ class Item if (! $x || (strlen(substr($x,1)) != 3)) return self::IS_FILE; - if (strcasecmp(substr($x,2),'lo') == 0) + if (strcasecmp(substr($x,2),'lo') === 0) return self::IS_FLO; - if (strcasecmp(substr($x,1),'pkt') == 0) + if (strcasecmp(substr($x,1),'pkt') === 0) return self::IS_PKT; - if (strcasecmp(substr($x,1),'req') == 0) + if (strcasecmp(substr($x,1),'req') === 0) return self::IS_REQ; - if (strcasecmp(substr($x,1),'tic') == 0) + if (strcasecmp(substr($x,1),'tic') === 0) return self::IS_TIC; for ($i=0;$isum(function($item) { return $item->file_size; }); default: - throw new Exception('Unknown key: '.$key); + throw new \Exception('Unknown key: '.$key); } } /** * Close the file descriptor for our incoming file * - * @throws Exception + * @throws \Exception */ public function close(): void { if (! $this->f) - throw new Exception('No file to close'); + throw new \Exception('No file to close'); if ($this->file_pos != $this->receiving->file_size) { Log::warning(sprintf('%s: - Closing [%s], but missing [%d] bytes',self::LOGKEY,$this->receiving->file_name,$this->receiving->file_size-$this->file_pos)); @@ -120,7 +119,7 @@ final class Receive extends Item $po = Packet::process($packet,Arr::get(stream_get_meta_data($packet),'uri'),$f->itemSize(),$this->ao->system); // Check the messages are from the uplink - if ($this->ao->system->addresses->search(function($item) use ($po) { return $item->id == $po->fftn_o->id; }) === FALSE) { + if ($this->ao->system->addresses->search(function($item) use ($po) { return $item->id === $po->fftn_o->id; }) === FALSE) { Log::error(sprintf('%s: ! Packet [%s] is not from this link? [%d]',self::LOGKEY,$po->fftn_o->ftn,$this->ao->system_id)); break; @@ -154,7 +153,7 @@ final class Receive extends Item else MessageProcess::dispatchSync($msg,$f->pktName()); - } catch (Exception $e) { + } catch (\Exception $e) { Log::error(sprintf('%s:! Got error dispatching message [%s] (%d:%s-%s).',self::LOGKEY,$msg->msgid,$e->getLine(),$e->getFile(),$e->getMessage())); } @@ -204,7 +203,7 @@ final class Receive extends Item * @param Address $ao * @param bool $check * @return bool - * @throws Exception + * @throws \Exception */ public function open(Address $ao,bool $check=FALSE): bool { @@ -219,7 +218,7 @@ final class Receive extends Item } if (! $this->receiving) - throw new Exception('No files currently receiving'); + throw new \Exception('No files currently receiving'); $this->ao = $ao; $this->file_pos = 0; @@ -241,14 +240,14 @@ final class Receive extends Item * Add a new file to receive * * @param array $file - * @throws Exception + * @throws \Exception */ public function new(array $file): void { Log::debug(sprintf('%s:+ new [%s]',self::LOGKEY,join('|',$file))); if ($this->receiving) - throw new Exception('Can only have 1 file receiving at a time'); + throw new \Exception('Can only have 1 file receiving at a time'); $o = new Item($file,self::I_RECV); $this->list->push($o); @@ -261,15 +260,15 @@ final class Receive extends Item * * @param string $buf * @return int - * @throws Exception + * @throws \Exception */ public function write(string $buf): int { if (! $this->f) - throw new Exception('No file open for read'); + throw new \Exception('No file open for read'); if ($this->file_pos+strlen($buf) > $this->receiving->file_size) - throw new Exception(sprintf('Too many bytes received [%d] (%d)?',$this->file_pos+strlen($buf),$this->receiving->file_size)); + throw new \Exception(sprintf('Too many bytes received [%d] (%d)?',$this->file_pos+strlen($buf),$this->receiving->file_size)); $rc = fwrite($this->f,$buf); diff --git a/app/Classes/File/Send.php b/app/Classes/File/Send.php index f2e22db..3353ce6 100644 --- a/app/Classes/File/Send.php +++ b/app/Classes/File/Send.php @@ -180,7 +180,7 @@ final class Send extends Item public function feof(): bool { return (($this->sending instanceof Mail) || ($this->sending->isType(self::IS_TIC))) - ? ($this->file_pos == $this->size) + ? ($this->file_pos === $this->size) : feof($this->f); } diff --git a/app/Classes/Font.php b/app/Classes/Font.php index 9312798..192abd8 100644 --- a/app/Classes/Font.php +++ b/app/Classes/Font.php @@ -77,7 +77,7 @@ class Font $escape = FALSE; foreach (str_split(strtolower($this->text)) as $c) { - if ($c == "\x1b") { + if (ord($c) === 0x1b) { $escape = TRUE; continue; @@ -112,7 +112,7 @@ class Font $ansi = FALSE; foreach (str_split(strtolower($this->text)) as $c) { - if (ord($c) == 0x1b) { + if (ord($c) === 0x1b) { $escape = TRUE; } elseif ($escape && $c) { @@ -120,7 +120,7 @@ class Font $escape = FALSE; $ansi = TRUE; - } elseif (($c == ' ') || (! $font_chars=$chars->get($c))) { + } elseif (($c === ' ') || (! $font_chars=$chars->get($c))) { $result .= $c; } else { @@ -245,7 +245,7 @@ class Font // Work out the characters we need foreach (array_unique(str_split($text)) as $c) { - if (($c == ' ') || (! $x=Arr::get(static::FONT,$c))) { + if (($c === ' ') || (! $x=Arr::get(static::FONT,$c))) { continue; } @@ -265,7 +265,7 @@ class Font if (self::DEBUG) dump(sprintf('current position %d of %d',$current_pos,strlen($text))); for ($line=0;$line<$font_height;$line++) { - if ($line == 0) { + if ($line === 0) { $line_icon_width = $icon_width ->skip(intdiv($result_height,$step)*$step) ->take($step) @@ -324,9 +324,10 @@ class Font } $next_next_space_width = $current_line_width+$next_space_chars+$next_next_space_chars; - }; + } - if (self::DEBUG) dump(sprintf(' - our next space is: [%s] (%x) at %d in %d chars, taking %d chars (taking our width to %d)',$c,ord($c),$find_space_pos,$find_space_pos-$line_pos,$next_space_chars,$current_line_width+$next_space_chars)); + if (self::DEBUG) + dump(sprintf(' - our next space is: [%s] (%x) at %d in %d chars, taking %d chars (taking our width to %d)',$c,ord($c),$find_space_pos,$find_space_pos-$line_pos,$next_space_chars,$current_line_width+$next_space_chars)); // We are only spaces, so we can return to the next line if ($current_line_width+$next_space_chars > $line_width) { @@ -338,7 +339,7 @@ class Font } $c = substr($text,$line_pos,1); - if (($c == ' ') || (! $font_chars=$chars->get($c))) { + if (($c === ' ') || (! $font_chars=$chars->get($c))) { // Ignore this space if we are at the beginning of the line if ($current_line_width && ($next_next_space_width < $line_width)) { $line_result .= $c; @@ -357,7 +358,7 @@ class Font $line_pos++; if (self::DEBUG) dump(sprintf(' = line width [%d of %d] and we are on char [%d] our space is [%d]',$current_line_width,$line_width,$line_pos,$find_space_pos)); - if ($line_pos == strlen($text)) { + if ($line_pos === strlen($text)) { if (self::DEBUG) dump(sprintf(' = we are finished, as we are on char %d on line %d',$line_pos,$line)); break; } diff --git a/app/Classes/Node.php b/app/Classes/Node.php index ce8a966..ebf3ccf 100644 --- a/app/Classes/Node.php +++ b/app/Classes/Node.php @@ -289,7 +289,7 @@ class Node $ftn = $this->ftns_authed->first()->ftn; return $this->ftns->search(function($item) use ($ftn) { - if ($item->ftn == $ftn) { + if ($item->ftn === $ftn) { $item->system->last_session = Carbon::now(); $item->system->save(); $this->authed = TRUE; diff --git a/app/Classes/Page.php b/app/Classes/Page.php index 20f09ec..3346cd9 100644 --- a/app/Classes/Page.php +++ b/app/Classes/Page.php @@ -166,7 +166,7 @@ class Page .$line .str_repeat(' ',$buffer-$lc-($this->left_width ? self::LOGO_OFFSET_WIDTH : 0)); - } elseif (self::LOGO_OFFSET_WIDTH && $this->logo->height && ($result_height == $this->logo->height) && $this->left_box->height) { + } elseif (self::LOGO_OFFSET_WIDTH && $this->logo->height && ($result_height === $this->logo->height) && $this->left_box->height) { $result_line = str_repeat(' ',$buffer); } elseif ($result_height < $this->left_height-($this->logo->height ? 0 : self::LOGO_OFFSET_WIDTH)) { @@ -191,7 +191,7 @@ class Page // Add our header footer if ($x=ANSI::line_width($this->header_foot,FALSE)) { - if ($result_height == $this->header->height) { + if ($result_height === $this->header->height) { $result_line .= str_repeat(' ',($this->header_right ? self::MSG_WIDTH-($this->left_width ? self::LOGO_OFFSET_WIDTH*2 : 0)-$this->left_width-$x : 0)) .ANSI::text_to_ansi($this->header_foot); } @@ -199,7 +199,7 @@ class Page // Add our header underline if ($this->header_underline) { - if ($result_height == $this->header->height+($this->header_foot ? 1 : 0)) { + if ($result_height === $this->header->height+($this->header_foot ? 1 : 0)) { $result_line .= str_repeat(chr($this->header_underline),self::MSG_WIDTH-$buffer); } } diff --git a/app/Classes/Protocol.php b/app/Classes/Protocol.php index 4e272ea..1d0ad60 100644 --- a/app/Classes/Protocol.php +++ b/app/Classes/Protocol.php @@ -2,7 +2,6 @@ namespace App\Classes; -use Exception; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; @@ -93,13 +92,13 @@ abstract class Protocol public function __construct(Setup $o=NULL) { if ($o && ! $o->system->addresses->count()) - throw new Exception('We dont have any FTN addresses assigned'); + throw new \Exception('We dont have any FTN addresses assigned'); $this->setup = $o; } /** - * @throws Exception + * @throws \Exception */ public function __get($key) { @@ -113,12 +112,12 @@ abstract class Protocol return $this->comms[$key] ?? ''; default: - throw new Exception('Unknown key: '.$key); + throw new \Exception('Unknown key: '.$key); } } /** - * @throws Exception + * @throws \Exception */ public function __set($key,$value) { @@ -131,14 +130,14 @@ abstract class Protocol break; default: - throw new Exception('Unknown key: '.$key); + throw new \Exception('Unknown key: '.$key); } } /** * We got an error, close anything we are have open * - * @throws Exception + * @throws \Exception */ protected function error_close(): void { @@ -160,7 +159,7 @@ abstract class Protocol { $pid = pcntl_fork(); - if ($pid == -1) + if ($pid === -1) throw new SocketException(SocketException::CANT_ACCEPT,'Could not fork process'); Log::debug(sprintf('%s:= End [%d]',self::LOGKEY,$pid)); @@ -216,7 +215,7 @@ abstract class Protocol * @param SocketClient $client * @param Address|null $o * @return int - * @throws Exception + * @throws \Exception */ public function session(int $type,SocketClient $client,Address $o=NULL): int { @@ -311,7 +310,7 @@ abstract class Protocol $this->node->session_time%60, $this->send->total_sent,$this->send->total_sent_bytes,'b', $this->recv->total_recv,$this->recv->total_recv_bytes,'b', - (($rc & self::S_MASK) == self::S_OK) ? 'Successful' : 'Failed', + (($rc & self::S_MASK) === self::S_OK) ? 'Successful' : 'Failed', )); // Add unknown FTNs to the DB diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index ccbfed6..dc79d0c 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -180,7 +180,7 @@ final class Binkp extends BaseProtocol if ($this->DEBUG) Log::debug(sprintf('%s:+ binkp_hsdone',self::LOGKEY)); - if (($this->setup->opt_nd == self::O_WE) || ($this->setup->opt_nd == self::O_THEY)) + if (($this->setup->opt_nd === self::O_WE) || ($this->setup->opt_nd === self::O_THEY)) $this->setup->opt_nd = self::O_NO; if (! $this->setup->phone) @@ -319,7 +319,7 @@ final class Binkp extends BaseProtocol $this->rx_buf .= $this->client->read(0,$blksz-$this->rx_ptr); } catch (SocketException $e) { - if ($e->getCode() == 11) { + if ($e->getCode() === 11) { // @todo We maybe should count these and abort if there are too many? if ($this->DEBUG) Log::debug(sprintf('%s: - binkp_recv Socket EAGAIN',self::LOGKEY)); @@ -343,7 +343,7 @@ final class Binkp extends BaseProtocol } /* - if ($this->setup->opt_cr == self::O_YES ) { + if ($this->setup->opt_cr === self::O_YES ) { //decrypt_buf( (void *) &bp->rx_buf[bp->rx_ptr], (size_t) readsz, bp->keys_in ); } */ @@ -357,7 +357,7 @@ final class Binkp extends BaseProtocol /* Received complete block */ if ($this->rx_ptr === $blksz) { /* Header */ - if ($this->rx_size == -1 ) { + if ($this->rx_size === -1 ) { $this->is_msg = ord(substr($this->rx_buf,0,1)) >> 7; $this->rx_size = ((ord(substr($this->rx_buf,0,1))&0x7f) << 8 )+ord(substr($this->rx_buf,1,1)); $this->rx_ptr = 0; @@ -365,7 +365,7 @@ final class Binkp extends BaseProtocol if ($this->DEBUG) Log::debug(sprintf('%s: - binkp_recv HEADER, is_msg [%d], rx_size [%d]',self::LOGKEY,$this->is_msg,$this->rx_size)); - if ($this->rx_size == 0) + if ($this->rx_size === 0) goto ZeroLen; $rc = 1; @@ -380,7 +380,7 @@ final class Binkp extends BaseProtocol $this->mib++; /* Handle zero length block */ - if ($this->rx_size == 0 ) { + if ($this->rx_size === 0 ) { Log::debug(sprintf('%s:- binkp_recv Zero length msg - dropped',self::LOGKEY)); $this->rx_size = -1; $this->rx_ptr = 0; @@ -461,7 +461,7 @@ final class Binkp extends BaseProtocol $rc = 1; } - if ($this->recv->filepos == $this->recv->size) { + if ($this->recv->filepos === $this->recv->size) { Log::info(sprintf('%s: - Finished receiving file [%s] with size [%d]',self::LOGKEY,$this->recv->name,$this->recv->size)); $this->msgs(self::BPM_GOT,$this->recv->name_size_time); @@ -499,13 +499,13 @@ final class Binkp extends BaseProtocol if ($this->DEBUG) Log::debug(sprintf('%s:+ binkp_send - tx_left [%d]',self::LOGKEY,$this->tx_left)); - if ($this->tx_left === 0 ) { /* tx buffer is empty */ + if ($this->tx_left === 0 ) { /* tx buffer is empty */ $this->tx_ptr = $this->tx_left = 0; if ($this->DEBUG) Log::debug(sprintf('%s: - binkp_send msgs [%d]',self::LOGKEY,$this->mqueue->count())); - if ($this->mqueue->count()) { /* there are unsent messages */ + if ($this->mqueue->count()) { /* there are unsent messages */ while ($msg = $this->mqueue->shift()) { if (($msg->len+$this->tx_left) > self::MAX_BLKSIZE) { break; @@ -534,7 +534,7 @@ final class Binkp extends BaseProtocol $this->tx_buf .= $data; /* - if ($this->setup->opt_cr == self::O_YES) { + if ($this->setup->opt_cr === self::O_YES) { encrypt_buf($this->tx_buf,($data + BinkpMessage::BLK_HDR_SIZE),$this->keys_out); } */ @@ -543,11 +543,11 @@ final class Binkp extends BaseProtocol } // @todo should this be less than BP_BLKSIZE? Since a read could return a blocksize and it could be the end of the file? - if ($data < self::BP_BLKSIZE && $this->send->filepos == $this->send->size) { + if (($data < self::BP_BLKSIZE) && ($this->send->filepos === $this->send->size)) { $this->sessionSet(self::SE_WAITGOT); $this->sessionClear(self::SE_SENDFILE); } - } + } } else { try { @@ -560,7 +560,7 @@ final class Binkp extends BaseProtocol Log::debug(sprintf('%s:+ sent [%d]',self::LOGKEY,$rc)); } catch (Exception $e) { - if ($e->getCode() == 11) + if ($e->getCode() === 11) return 1; $this->socket_error = $e->getMessage(); @@ -580,7 +580,7 @@ final class Binkp extends BaseProtocol if ($this->DEBUG) Log::debug(sprintf('%s:= binkp_send [1]',self::LOGKEY)); - return 1; + return 1; } private function file_parse(string $str): ?array @@ -589,9 +589,9 @@ final class Binkp extends BaseProtocol Log::debug(sprintf('%s:+ file_parse [%s]',self::LOGKEY,$str)); $name = $this->strsep($str,' '); - $size = $this->strsep($str,' '); - $time = $this->strsep($str,' '); - $offs = $this->strsep($str,' '); + $size = (int)$this->strsep($str,' '); + $time = (int)$this->strsep($str,' '); + $offs = (int)$this->strsep($str,' '); if ($name && $size && $time) { return [ @@ -618,7 +618,7 @@ final class Binkp extends BaseProtocol $this->mqueue->push(new BinkpMessage($id,$msg_body)); /* - if ($this->setup->opt_cr == self::O_YES) { + if ($this->setup->opt_cr === self::O_YES) { //$this->encrypt_buf($this->bps->mqueue[$this->nmsgs]->msg,$this->bps->mqueue[$this->nmsgs]->len,$this->bps->keys_out); } */ @@ -634,7 +634,7 @@ final class Binkp extends BaseProtocol Log::debug(sprintf('%s:+ M_adr [%s]',self::LOGKEY,$buf)); $buf = $this->skip_blanks($buf); - $rc = 0; + $rc = 0; while(($rem_aka = $this->strsep($buf,' '))) { Log::info(sprintf('%s: - Parsing AKA [%s]',self::LOGKEY,$rem_aka)); @@ -672,7 +672,7 @@ final class Binkp extends BaseProtocol $rc = $this->node->aka_num; } - if ($rc == 0) { + if ($rc === 0) { Log::error(sprintf('%s: ! All AKAs [%d] are busy',self::LOGKEY,$this->node->aka_num)); $this->msgs( self::BPM_BSY,'All AKAs are busy'); @@ -694,7 +694,7 @@ final class Binkp extends BaseProtocol if ($this->md_challenge) { $this->msgs(self::BPM_PWD,sprintf('CRAM-MD5-%s',$this->node->get_md5chal($this->md_challenge))); - } elseif ($this->setup->opt_md == self::O_YES ) { + } elseif ($this->setup->opt_md === self::O_YES) { $this->msgs(self::BPM_ERR,'Can\'t use plaintext password'); $this->rc = self::S_FAILURE|self::S_ADDTRY; @@ -714,14 +714,14 @@ final class Binkp extends BaseProtocol if (! $this->originate) $this->msgs(self::BPM_ADR,$this->our_addresses()->pluck('ftn')->join(' ')); - return 1; + return 1; } private function M_chat(string $buf): int { Log::debug(sprintf('%s:+ M_chat [%s]',self::LOGKEY,$buf)); - if ($this->setup->opt_cht == self::O_YES) { + if ($this->setup->opt_cht === self::O_YES) { Log::error(sprintf('%s: ! We cannot do chat',self::LOGKEY)); } else { @@ -804,9 +804,9 @@ final class Binkp extends BaseProtocol // In NR mode, when we got -1 for the file offsite, the reply to our get will confirm our requested offset. if ($this->recv->name && ! strncasecmp(Arr::get($file,'file.name'),$this->recv->name,self::MAX_PATH) - && $this->recv->mtime == Arr::get($file,'file.mtime') - && $this->recv->size == Arr::get($file,'file.size') - && $this->recv->filepos == $file['offs']) + && $this->recv->mtime === Arr::get($file,'file.mtime') + && $this->recv->size === Arr::get($file,'file.size') + && $this->recv->filepos === $file['offs']) { $this->recv->open($this->node->address,$file['offs']<0); @@ -875,8 +875,8 @@ final class Binkp extends BaseProtocol if ($this->sessionGet(self::SE_SENDFILE) && $this->send->sendas && ! strncasecmp(Arr::get($file,'file.name'),$this->send->sendas,self::MAX_PATH) - && $this->send->mtime == Arr::get($file,'file.mtime') - && $this->send->size == Arr::get($file,'file.size')) + && $this->send->mtime === Arr::get($file,'file.mtime') + && $this->send->size === Arr::get($file,'file.size')) { if (! $this->send->seek($file['offs'])) { Log::error(sprintf('%s: ! Cannot send file from requested offset [%d]',self::LOGKEY,$file['offs'])); @@ -916,8 +916,8 @@ final class Binkp extends BaseProtocol if ($file = $this->file_parse($buf)) { if ($this->send->sendas && ! strncasecmp(Arr::get($file,'file.name'),$this->send->sendas,self::MAX_PATH) - && $this->send->mtime == Arr::get($file,'file.mtime') - && $this->send->size == Arr::get($file,'file.size')) + && $this->send->mtime === Arr::get($file,'file.mtime') + && $this->send->size === Arr::get($file,'file.size')) { // @todo Commit our mail transaction if the remote end confirmed receipt of the file. if ($this->sessionGet(self::SE_SENDFILE)) { @@ -983,10 +983,10 @@ final class Binkp extends BaseProtocol if (! $comma) { $this->client->speed = SocketClient::TCP_SPEED; - } elseif (strtolower(substr($comma,$c+1,1)) == 'k') { + } elseif (strtolower(substr($comma,$c+1,1)) === 'k') { $this->client->speed = $spd * 1024; - } elseif (strtolower(substr($comma,$c+1,1)) == 'm') { + } elseif (strtolower(substr($comma,$c+1,1)) === 'm') { $this->client->speed = $spd * 1024 * 1024; } else { @@ -1059,7 +1059,7 @@ final class Binkp extends BaseProtocol $this->setup->opt_md |= self::O_THEY; } - if (($this->setup->opt_md&(self::O_THEY|self::O_WANT)) == (self::O_THEY|self::O_WANT)) + if (($this->setup->opt_md&(self::O_THEY|self::O_WANT)) === (self::O_THEY|self::O_WANT)) $this->setup->opt_md = self::O_YES; } else { /* if ( strcmp( p, "GZ" ) || strcmp( p, "BZ2" ) || strcmp( p, "EXTCMD" )) */ @@ -1094,7 +1094,7 @@ final class Binkp extends BaseProtocol if ($this->optionGet(self::O_PWD) && $buf) { while (($t = $this->strsep($buf," \t"))) - if (strcmp($t,'non-secure') == 0) { + if (strcmp($t,'non-secure') === 0) { Log::debug(sprintf('%s: - Non Secure',self::LOGKEY)); $this->setup->opt_cr = self::O_NO; @@ -1172,7 +1172,7 @@ final class Binkp extends BaseProtocol Log::notice(sprintf('%s: - Remote proposed password for us [%s]',self::LOGKEY,$buf)); } - if (($this->setup->opt_md&(self::O_THEY|self::O_WANT )) == (self::O_THEY|self::O_WANT)) + if (($this->setup->opt_md&(self::O_THEY|self::O_WANT )) === (self::O_THEY|self::O_WANT)) $this->setup->opt_md = self::O_YES; if (!$have_pwd || $this->setup->opt_md != self::O_YES) @@ -1292,7 +1292,7 @@ final class Binkp extends BaseProtocol $this->rc = ($this->originate ? (self::S_REDIAL|self::S_ADDTRY) : self::S_BUSY); - if ($rc == 0) { + if ($rc === 0) { $this->error_close(); $this->error = -1; @@ -1309,7 +1309,7 @@ final class Binkp extends BaseProtocol break; } - if ($this->error == -1) + if ($this->error === -1) Log::error(sprintf('%s: ! protocol_session TIMEOUT',self::LOGKEY)); elseif ($this->error > 0) @@ -1329,7 +1329,7 @@ final class Binkp extends BaseProtocol break; } - if (strlen($buf) == 0) + if (strlen($buf) === 0) break; Log::warning(sprintf('%s: - Purged (%s) [%d] bytes from input stream',self::LOGKEY,hex_dump($buf),strlen($buf))); @@ -1355,7 +1355,7 @@ final class Binkp extends BaseProtocol while ($this->isSpace(substr($str,$c,1))) $c++; - return substr($str,$c); + return substr($str,$c); } /** diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index 67e645a..8d0aff6 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -190,7 +190,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface // Site address, password and compatibility $makedata .= sprintf('{EMSI}{%s}{%s}{%s}{%s}', $this->our_addresses()->pluck('ftn')->join(' '), - ($this->node->password == '-') ? '' : $this->node->password, + ($this->node->password === '-') ? '' : $this->node->password, join(',',$link_codes), join(',',$compat_codes), ); @@ -528,7 +528,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface if (++$tries > 6) return self::TIMEOUT; - if ($mode == self::SM_INBOUND) { + if ($mode === self::SM_INBOUND) { $this->client->buffer_add(self::EMSI_REQ.self::CR); } elseif ($tries > 1) { @@ -585,17 +585,17 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface if ($this->client->timer_expired($t1)) break; - if ($ch == self::TIMEOUT) + if ($ch === self::TIMEOUT) continue; if (! $got) { - if ($ch == ord('*')) + if ($ch === ord('*')) $got = 1; else continue; } - if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) { + if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) { if (! strncmp($p,self::EMSI_HBT,self::EMSI_SEQ_LEN)) { Log::debug(sprintf('%s: - Received EMSI_HBT',self::LOGKEY)); @@ -740,12 +740,12 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface if ($this->client->timer_expired($t1)) return self::TIMEOUT; - if ($ch == self::TIMEOUT) + if ($ch === self::TIMEOUT) continue; $ch &= 0x7f; - if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) { + if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) { if (! $p) continue; @@ -844,7 +844,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface return self::TIMEOUT; if ($this->client->timer_expired($t2)) { - if ($this->setup->do_prevent && $tries == 0) { + if ($this->setup->do_prevent && $tries === 0) { $this->setup->do_prevent = 0; $this->client->buffer_add(self::EMSI_INQ.self::CR); @@ -862,12 +862,12 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface continue; } - if ($ch == self::TIMEOUT) + if ($ch === self::TIMEOUT) continue; $ch &= 0x7f; - if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) { + if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) { if (strstr($p,self::EMSI_REQ)) { Log::info(sprintf('%s: - Got EMSI_REQ',self::LOGKEY)); if ($gotreq++) @@ -909,7 +909,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface if ($this->client->timer_expired($t1)) return self::TIMEOUT; - if (($ch == self::TIMEOUT) || $this->client->timer_expired($t2)) { + if (($ch === self::TIMEOUT) || $this->client->timer_expired($t2)) { if (! $got) { $this->emsi_banner(); $t2 = $this->client->timer_set(self::EMSI_RESEND_TO); @@ -923,10 +923,10 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface $ch &= 0x7f; - if ((! $got) && ($ch == ord('*'))) + if ((! $got) && ($ch === ord('*'))) $got = 1; - if ($got && (($ch == ord(self::CR)) || ($ch == ord(self::NL)))) { + if ($got && (($ch === ord(self::CR)) || ($ch === ord(self::NL)))) { $got = 0; if (strstr($p, self::EMSI_INQ)) { @@ -992,7 +992,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface if ($this->node->aka_authed) { $xproto = $this->is_freq_available(); - if ($xproto == self::FR_NOTHANDLED || $xproto == self::FR_NOTAVAILABLE) + if ($xproto === self::FR_NOTHANDLED || $xproto === self::FR_NOTAVAILABLE) $this->node->optionSet(self::O_HRQ); } @@ -1064,7 +1064,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface } $xproto = ($this->optionGet(self::O_RH1) && ($this->node->optionGet(self::O_RH1))); - $x = (substr($t,1,1) == 'H' && $xproto ) ? 'x' : ''; + $x = (substr($t,1,1) === 'H' && $xproto ) ? 'x' : ''; Log::info(sprintf('%s: = Using [%s]',self::LOGKEY,$t)); @@ -1166,7 +1166,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface // @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes. $rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address); - return ($rc == self::RCDO || $rc == self::ERROR); + return ($rc === self::RCDO || $rc === self::ERROR); } /** diff --git a/app/Classes/Protocol/Zmodem.php b/app/Classes/Protocol/Zmodem.php index 62156c1..a31f3dc 100644 --- a/app/Classes/Protocol/Zmodem.php +++ b/app/Classes/Protocol/Zmodem.php @@ -571,17 +571,17 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface if (($c = $this->client->read_ch($timeout)) < 0) return $c; - } while ((! ($this->ls_Protocol&self::LSZ_OPTDIRZAP)) && (($c == self::XON) || ($c == self::XOFF))); + } while ((! ($this->ls_Protocol&self::LSZ_OPTDIRZAP)) && (($c === self::XON) || ($c === self::XOFF))); - if ($c == self::CAN) { - if (++$this->ls_CANCount == 5) + if ($c === self::CAN) { + if (++$this->ls_CANCount === 5) return self::LSZ_CAN; } else { $this->ls_CANCount = 0; } - if (ord($c) == 0) + if (ord($c) === 0) return self::LSZ_ERROR; return $c&0x7f; @@ -598,8 +598,8 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface if (($ch = $this->client->read_ch($timeout)) < 0) return $ch; - if ($ch == self::CAN) { - if (++$this->ls_CANCount == 5) + if ($ch === self::CAN) { + if (++$this->ls_CANCount === 5) return self::LSZ_CAN; } else { @@ -688,13 +688,13 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface } } - if ($c == self::ZDLE) + if ($c === self::ZDLE) $this->ls_GotZDLE = 1; elseif ($c != self::LSZ_XONXOFF) return $c&0xff; - } while ($c == self::LSZ_XONXOFF); + } while ($c === self::LSZ_XONXOFF); } /* We will be here only in case of DLE */ @@ -757,12 +757,12 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface /* We are Direct ZedZap -- escape only */ if ($this->ls_Protocol&self::LSZ_OPTDIRZAP) { - $esc = (self::ZDLE == $c); + $esc = (self::ZDLE === $c); /* We are normal ZModem (may be ZedZap) */ } else { /* Receiver want to escape ALL */ - if (($this->ls_Protocol&self::LSZ_OPTESCAPEALL) && (($c&0x60) == 0)) { + if (($this->ls_Protocol&self::LSZ_OPTESCAPEALL) && (($c&0x60) === 0)) { $esc = 1; } else { @@ -778,7 +778,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface break; default: - $esc = ((($this->ls_txLastSent&0x7f) == ord('@')) && (($c&0x7f) == self::CR)); + $esc = ((($this->ls_txLastSent&0x7f) === ord('@')) && (($c&0x7f) === self::CR)); break; } } @@ -977,7 +977,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface /* Ok, now we could calculate real max frame size and initial block size */ if ($this->ls_txWinSize && $this->ls_MaxBlockSize>$this->ls_txWinSize) { - for ($this->ls_MaxBlockSize=1;$this->ls_MaxBlockSize<$this->ls_txWinSize;$this->ls_MaxBlockSize<<=1) {}; + for ($this->ls_MaxBlockSize=1;$this->ls_MaxBlockSize<$this->ls_txWinSize;$this->ls_MaxBlockSize<<=1) {} /*ls_MaxBlockSize >>= 1;*/ if ($this->ls_MaxBlockSize<32) @@ -1036,7 +1036,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface case self::ZFIN: Log::debug(sprintf('%s: - ls_zinitsender ZFIN [%d]',self::LOGKEY,$zfins)); - if (++$zfins == self::LSZ_TRUSTZFINS) + if (++$zfins === self::LSZ_TRUSTZFINS) return self::LSZ_ERROR; break; @@ -1338,7 +1338,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface return $rc; } else { - if ($rc == self::ZEOF) { + if ($rc === self::ZEOF) { Log::debug(sprintf('%s: - ls_zrecvfile ZEOF',self::LOGKEY)); if (($rc=$this->ls_zsendhhdr(self::ZRINIT,$this->ls_storelong(0))) < 0) @@ -1497,7 +1497,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface case self::ZFIN: Log::debug(sprintf('%s: - ls_zrecvfinfo ZFIN [%d], first [%d]',self::LOGKEY,$zfins,$first)); - if ($first || (++$zfins == self::LSZ_TRUSTZFINS)) + if ($first || (++$zfins === self::LSZ_TRUSTZFINS)) return self::ZFIN; break; @@ -1548,7 +1548,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface static $garbage = 0; /* Count of garbage characters */ $c = -1; - if ($state == self::rhInit) { + if ($state === self::rhInit) { if ($this->DEBUG) Log::debug(sprintf('%s: - ls_zrecvhdr Init State',self::LOGKEY)); @@ -1596,7 +1596,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface switch ($state) { case self::rhInit: - if ($c == self::ZPAD) + if ($c === self::ZPAD) $state = self::rhZPAD; else $garbage++; @@ -1693,7 +1693,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface } $frametype = $c; - $incrc = ($crcl == 2) ? $this->CRC16USD_UPDATE($c,self::LSZ_INIT_CRC16) : $this->CRC32_UPDATE($c,self::LSZ_INIT_CRC32); + $incrc = ($crcl === 2) ? $this->CRC16USD_UPDATE($c,self::LSZ_INIT_CRC16) : $this->CRC32_UPDATE($c,self::LSZ_INIT_CRC32); $state = self::rhBYTE; break; @@ -1704,10 +1704,10 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface $hdr[$got] = $c; - if ($len == ++$got) + if ($len === ++$got) $state = self::rhCRC; - $incrc = ($crcl == 2) ? $this->CRC16USD_UPDATE($c,$incrc) : $this->CRC32_UPDATE($c,$incrc); + $incrc = ($crcl === 2) ? $this->CRC16USD_UPDATE($c,$incrc) : $this->CRC32_UPDATE($c,$incrc); break; @@ -1715,7 +1715,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface if ($this->DEBUG) Log::debug(sprintf('%s: - ls_zrecvhdr [%02x] (%d|%d)',self::LOGKEY,$c,$crcgot+1,$got)); - if ($crcl == 2) { + if ($crcl === 2) { $crc <<= 8; $crc |= $c; @@ -1724,11 +1724,11 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface } /* Crc finished */ - if ($crcl == ++$crcgot) { + if ($crcl === ++$crcgot) { $state = self::rhInit; $garbage = 0; - if ($crcl == 2) { + if ($crcl === 2) { if (($this->ls_Protocol&self::LSZ_OPTCRC32) && ($readmode != self::rmHEX)) Log::error(sprintf('%s: - ls_zrecvhdr was CRC32, got CRC16 binary header',self::LOGKEY)); @@ -1752,7 +1752,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface return self::LSZ_BADCRC; /* We need to read after HEX header */ - if ($readmode == self::rmHEX) { + if ($readmode === self::rmHEX) { $state = self::rhCR; $readmode = self::rm8BIT; @@ -1948,7 +1948,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface { Log::debug(sprintf('%s:+ ls_zrpos, newpos [%d]',self::LOGKEY,$newpos)); - if ($newpos == $this->ls_txLastRepos) { + if ($newpos === $this->ls_txLastRepos) { if (++$this->ls_txReposCount > 10) { Log::error(sprintf('%s:! ZRPOS to [%ld] limit reached',self::LOGKEY,$newpos)); @@ -2043,7 +2043,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface $this->ls_sendchar($crc&0xff); } - if (! ($this->ls_Protocol&self::LSZ_OPTDIRZAP) && self::ZCRCW == $frame) + if (! ($this->ls_Protocol&self::LSZ_OPTDIRZAP) && self::ZCRCW === $frame) $this->client->buffer_add(chr(self::XON)); return $this->client->buffer_flush($this->ls_DataTimeout); @@ -2167,7 +2167,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface while (! $send->feof()) { /* We need to send ZDATA if previous frame was ZCRCW Also, frame will be ZCRCW, if it is after RPOS */ - if ($frame == self::ZCRCW) { + if ($frame === self::ZCRCW) { Log::debug(sprintf('%s: - ls_zsendfile send ZDATA at [%d]',self::LOGKEY,$send->filepos)); if (($rc=$this->ls_zsendbhdr(self::ZDATA,$this->ls_storelong($send->filepos))) < 0) @@ -2187,7 +2187,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface /* Select sub-frame type */ /* This is last sub-frame -- EOF */ if (strlen($txbuf) < $this->ls_txCurBlockSize) { - $frame = ($mode == self::sfStream) ? self::ZCRCE : self::ZCRCW; + $frame = ($mode === self::sfStream) ? self::ZCRCE : self::ZCRCW; /* This is not-last sub-frame */ } else { @@ -2221,7 +2221,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface $trys = 0; do { - $needack = (self::ZCRCW == $frame) || ($this->ls_txWinSize && ($send->filepos > $this->ls_txLastACK + $this->ls_txWinSize)); + $needack = (self::ZCRCW === $frame) || ($this->ls_txWinSize && ($send->filepos > $this->ls_txLastACK + $this->ls_txWinSize)); switch (($rc=$this->ls_zrecvhdr($this->ls_rxHdr,$needack ? $this->ls_HeaderTimeout : 0))) { // @todo set timeout to 5 for debugging wtih POP /* They don't need this file */ @@ -2285,7 +2285,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface /* Frame was ZCRCW and here is no ACK for it */ /* trys less than 10 */ (($this->ls_txWinSize && ($send->filepos>($this->ls_txLastACK+$this->ls_txWinSize))) - || ((self::ZCRCW == $frame) && ($send->filepos>$this->ls_txLastACK))) + || ((self::ZCRCW === $frame) && ($send->filepos>$this->ls_txLastACK))) && ++$trys < 10); if ($trys >= 10) @@ -2437,7 +2437,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface $sn = $this->ls_fetchlong($this->ls_rxHdr); /* Here is skip protection */ - if ($this->ls_SkipGuard && $sn && ($sn == $sernum-1)) { + if ($this->ls_SkipGuard && $sn && ($sn === $sernum-1)) { if (($rc=$this->ls_zsendhhdr(self::ZNAK,$this->ls_storelong(0))) < 0) return $rc; diff --git a/app/Classes/Sock/SocketClient.php b/app/Classes/Sock/SocketClient.php index d9b0f39..f28ad51 100644 --- a/app/Classes/Sock/SocketClient.php +++ b/app/Classes/Sock/SocketClient.php @@ -128,7 +128,7 @@ final class SocketClient { do { $this->buffer_flush(5); - if ($this->tty_status == self::TTY_SUCCESS) { + if ($this->tty_status === self::TTY_SUCCESS) { $n = min($this->tx_free,$num_bytes); $this->tx_buf = substr($data,$ptr,$n); $this->tx_free -= $n; @@ -189,7 +189,7 @@ final class SocketClient { if ($this->DEBUG) Log::debug(sprintf('%s: - Sent [%d] (%s)',self::LOGKEY,$rc,Str::limit($this->tx_buf,15))); - if ($rc == $restsize) { + if ($rc === $restsize) { $this->tx_buf = ''; $tx_ptr = 0; $this->tx_free += $rc; @@ -271,14 +271,14 @@ final class SocketClient { foreach ($resolved as $address) { try { - $try = Arr::get($address,Arr::get($address,'type') == 'AAAA' ? 'ipv6' : 'ip'); + $try = Arr::get($address,Arr::get($address,'type') === 'AAAA' ? 'ipv6' : 'ip'); if (! $try) continue; Log::alert(sprintf('%s: - Trying [%s:%d]',self::LOGKEY,$try,$port)); /* Create a TCP/IP socket. */ - $socket = socket_create(Arr::get($address,'type') == 'AAAA' ? AF_INET6 : AF_INET,SOCK_STREAM,SOL_TCP); + $socket = socket_create(Arr::get($address,'type') === 'AAAA' ? AF_INET6 : AF_INET,SOCK_STREAM,SOL_TCP); if ($socket === FALSE) throw new SocketException(SocketException::CANT_CREATE_SOCKET,socket_strerror(socket_last_error($socket))); @@ -287,7 +287,7 @@ final class SocketClient { } catch (\ErrorException $e) { // If 'Cannot assign requested address' - if (socket_last_error($socket) == 99) + if (socket_last_error($socket) === 99) continue; throw new SocketException(SocketException::CANT_CONNECT,socket_strerror(socket_last_error($socket))); @@ -382,7 +382,7 @@ final class SocketClient { // If our buffer is null, see if we have any out of band data. // @todo We throw an errorexception when the socket is closed by the remote I think. - if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0)) { + if (($rc === 0) && is_nulL($buf) && ($this->hasData(0) > 0)) { try { socket_recv($this->connection,$buf, $len,MSG_OOB); @@ -408,7 +408,7 @@ final class SocketClient { Log::debug(sprintf('%s:+ Start [%d] - rx_left[%d], rx_ptr[%d]',self::LOGKEY,$timeout,$this->rx_left,$this->rx_ptr)); // If our buffer is empty, we'll try and read from the remote - if ($this->rx_left == 0) { + if ($this->rx_left === 0) { if ($this->hasData($timeout) > 0) { try { if (! strlen($this->rx_buf = $this->read(0,self::RX_BUF_SIZE))) { @@ -419,7 +419,7 @@ final class SocketClient { } } catch (\Exception $e) { - return ($e->getCode() == 11) ? self::TTY_TIMEOUT : self::ERROR; + return ($e->getCode() === 11) ? self::TTY_TIMEOUT : self::ERROR; } if ($this->DEBUG) diff --git a/app/Console/Commands/AddressMerge.php b/app/Console/Commands/AddressMerge.php index 55bde1c..4a1d099 100644 --- a/app/Console/Commands/AddressMerge.php +++ b/app/Console/Commands/AddressMerge.php @@ -10,32 +10,32 @@ use App\Models\Address; class AddressMerge extends Command { - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'address:merge' + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'address:merge' .' {src : Source Address}' .' {dst : Destination Address}' .' {--F|force : Force}' .' {--I|ignore : Ignore different BBSes}' .' {--d|dryrun : Dry Run}'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'Permanently remove a duplicate address'; + /** + * The console command description. + * + * @var string + */ + protected $description = 'Permanently remove a duplicate address'; - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { $src = Address::withTrashed()->findOrfail($this->argument('src')); $dst = Address::withTrashed()->findOrfail($this->argument('dst')); @@ -126,6 +126,6 @@ class AddressMerge extends Command } } - return Command::SUCCESS; - } -} + return Command::SUCCESS; + } +} \ No newline at end of file diff --git a/app/Console/Commands/CommBinkpReceive.php b/app/Console/Commands/CommBinkpReceive.php index 6797c5a..297a997 100644 --- a/app/Console/Commands/CommBinkpReceive.php +++ b/app/Console/Commands/CommBinkpReceive.php @@ -42,7 +42,7 @@ class CommBinkpReceive extends Command $server->listen(); } catch (SocketException $e) { - if ($e->getMessage() == 'Can\'t accept connections: "Success"') + if ($e->getMessage() === 'Can\'t accept connections: "Success"') Log::debug('Server Terminated'); else Log::emergency('Uncaught Message: '.$e->getMessage()); diff --git a/app/Console/Commands/CommEMSIReceive.php b/app/Console/Commands/CommEMSIReceive.php index 40327eb..9bed256 100644 --- a/app/Console/Commands/CommEMSIReceive.php +++ b/app/Console/Commands/CommEMSIReceive.php @@ -42,7 +42,7 @@ class CommEMSIReceive extends Command $server->listen(); } catch (SocketException $e) { - if ($e->getMessage() == 'Can\'t accept connections: "Success"') + if ($e->getMessage() === 'Can\'t accept connections: "Success"') Log::debug('Server Terminated'); else Log::emergency('Uncaught Message: '.$e->getMessage()); diff --git a/app/Console/Commands/CommZmodemReceive.php b/app/Console/Commands/CommZmodemReceive.php index d771e81..c0c7769 100644 --- a/app/Console/Commands/CommZmodemReceive.php +++ b/app/Console/Commands/CommZmodemReceive.php @@ -41,7 +41,7 @@ class CommZmodemReceive extends Command $server->listen(); } catch (SocketException $e) { - if ($e->getMessage() == 'Can\'t accept connections: "Success"') + if ($e->getMessage() === 'Can\'t accept connections: "Success"') Log::debug('Server Terminated'); else Log::emergency('Uncaught Message: '.$e->getMessage()); diff --git a/app/Console/Commands/FilesList.php b/app/Console/Commands/FilesList.php index 7a1dce7..dc46414 100644 --- a/app/Console/Commands/FilesList.php +++ b/app/Console/Commands/FilesList.php @@ -8,27 +8,27 @@ use Illuminate\Support\Facades\DB; class FilesList extends Command { - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'files:list'; + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'files:list'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'List files'; + /** + * The console command description. + * + * @var string + */ + protected $description = 'List files'; - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { $this->table([ 'files.id' => 'ID', 'file' => 'Filename', @@ -38,5 +38,5 @@ class FilesList extends Command ->cursor()); return Command::SUCCESS; - } -} + } +} \ No newline at end of file diff --git a/app/Console/Commands/InitialSetup.php b/app/Console/Commands/InitialSetup.php index 2ce6d6a..793837b 100644 --- a/app/Console/Commands/InitialSetup.php +++ b/app/Console/Commands/InitialSetup.php @@ -8,27 +8,27 @@ use Illuminate\Support\Facades\Artisan; class InitialSetup extends Command { - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'initial:setup'; + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'initial:setup'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'Initial Setup of DB'; + /** + * The console command description. + * + * @var string + */ + protected $description = 'Initial Setup of DB'; - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { Artisan::call('db:seed',['class'=>InitialSetupSeeder::class]); } -} +} \ No newline at end of file diff --git a/app/Console/Commands/ServerStart.php b/app/Console/Commands/ServerStart.php index b9763c6..4b17eff 100644 --- a/app/Console/Commands/ServerStart.php +++ b/app/Console/Commands/ServerStart.php @@ -81,7 +81,7 @@ class ServerStart extends Command $pid = pcntl_fork(); - if ($pid == -1) + if ($pid === -1) die('could not fork'); // We are the child @@ -96,7 +96,7 @@ class ServerStart extends Command $server->listen(); } catch (SocketException $e) { - if ($e->getMessage() == 'Can\'t accept connections: "Success"') + if ($e->getMessage() === 'Can\'t accept connections: "Success"') Log::debug(sprintf('%s:! Server Terminated [%s]',self::LOGKEY,$item)); else Log::emergency(sprintf('%s:! Uncaught Message: %s',self::LOGKEY,$e->getMessage())); diff --git a/app/Console/Commands/TicProcess.php b/app/Console/Commands/TicProcess.php index 377fd34..c3712ef 100644 --- a/app/Console/Commands/TicProcess.php +++ b/app/Console/Commands/TicProcess.php @@ -8,32 +8,32 @@ use App\Jobs\TicProcess as Job; class TicProcess extends Command { - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'tic:process' + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'tic:process' .' {file : TIC file}' .' {domain? : Domain Name}'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'Process a TIC file'; + /** + * The console command description. + * + * @var string + */ + protected $description = 'Process a TIC file'; - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { // Dispatch job. Job::dispatchSync($this->argument('file'),$this->argument('domain')); - return Command::SUCCESS; - } -} + return Command::SUCCESS; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 796e397..984b684 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -37,7 +37,7 @@ class ForgotPasswordController extends Controller $this->credentials($request) ); - return $response == Password::RESET_LINK_SENT + return $response === Password::RESET_LINK_SENT ? $this->sendResetLinkResponse($request, $response) : $this->sendResetLinkFailedResponse($request, $response); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 0c29c65..6b194fc 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,13 +2,14 @@ namespace App\Http\Controllers\Auth; -use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; -use App\Models\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; +use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; +use App\Models\User; + class RegisterController extends Controller { /* @@ -60,7 +61,7 @@ class RegisterController extends Controller * Create a new user instance after a valid registration. * * @param array $data - * @return \App\Models\User + * @return User */ protected function create(array $data) { diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 7674229..f12ca08 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -401,7 +401,7 @@ class SystemController extends Controller { $ao = $o->addresses->firstWhere('id',$request->address_id); - if (($request->method() == 'POST') && $request->post()) { + if (($request->method() === 'POST') && $request->post()) { session()->flash('accordion','echoarea'); if ($ao->trashed() && collect($request->get('id'))->diff($ao->echoareas->pluck('id'))->count()) @@ -413,7 +413,7 @@ class SystemController extends Controller $ao->echoareas()->syncWithPivotValues($request->get('id',[]),['subscribed'=>Carbon::now()]); - return redirect()->back()->with('success','Echoareas updated');; + return redirect()->back()->with('success','Echoareas updated'); } $eo = Echoarea::active() @@ -438,7 +438,7 @@ class SystemController extends Controller { $ao = $o->addresses->firstWhere('id',$request->address_id); - if (($request->method() == 'POST') && $request->post()) { + if (($request->method() === 'POST') && $request->post()) { session()->flash('accordion','filearea'); // Ensure we have session details for this address. @@ -447,7 +447,7 @@ class SystemController extends Controller $ao->fileareas()->syncWithPivotValues($request->get('id',[]),['subscribed'=>Carbon::now()]); - return redirect()->back()->with('success','Fileareas updated');; + return redirect()->back()->with('success','Fileareas updated'); } $fo = Filearea::active() @@ -480,7 +480,7 @@ class SystemController extends Controller session()->flash('accordion','address'); // Quick check that this address belongs to this system - if ($so->addresses->search(function($item) use ($o) { return $item->id == $o->id; }) === FALSE) + if ($so->addresses->search(function($item) use ($o) { return $item->id === $o->id; }) === FALSE) abort(404); if ($request->post()) { diff --git a/app/Http/Controllers/ZoneController.php b/app/Http/Controllers/ZoneController.php index 95dba63..3fcdd5c 100644 --- a/app/Http/Controllers/ZoneController.php +++ b/app/Http/Controllers/ZoneController.php @@ -25,7 +25,7 @@ class ZoneController extends Controller Rule::unique('zones')->where(function ($query) use ($request,$o) { return $query->where('zone_id',$request->post('zone_id')) ->where('default',TRUE) - ->where('id','<>',$o->id);; + ->where('id','<>',$o->id); }) ], 'zone_id' => [ diff --git a/app/Http/Middleware/ActiveUser.php b/app/Http/Middleware/ActiveUser.php index 62ea150..05c272c 100644 --- a/app/Http/Middleware/ActiveUser.php +++ b/app/Http/Middleware/ActiveUser.php @@ -2,7 +2,6 @@ namespace App\Http\Middleware; -use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -11,11 +10,11 @@ class ActiveUser /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Request $request + * @param \Closure $next * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request,\Closure $next) { if (Auth::user()->exists && ! Auth::user()->active) { Auth::logout(); diff --git a/app/Http/Middleware/AddUserToView.php b/app/Http/Middleware/AddUserToView.php index 6df4069..2e3e725 100644 --- a/app/Http/Middleware/AddUserToView.php +++ b/app/Http/Middleware/AddUserToView.php @@ -8,43 +8,43 @@ use Illuminate\Contracts\Auth\Authenticatable; class AddUserToView { - /** - * The View Factory. - * - * @var \Illuminate\Contracts\View\Factory - */ - protected Factory $factory; + /** + * The View Factory. + * + * @var \Illuminate\Contracts\View\Factory + */ + protected Factory $factory; - /** - * The Authenticated user, if any. - * - * @var \Illuminate\Contracts\Auth\Authenticatable|null - */ - protected ?Authenticatable $user; + /** + * The Authenticated user, if any. + * + * @var \Illuminate\Contracts\Auth\Authenticatable|null + */ + protected ?Authenticatable $user; - /** - * Create a new Share Authenticated User instance. - * - * @param \Illuminate\Contracts\View\Factory $factory - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - */ - public function __construct(Factory $factory,Authenticatable $user=NULL) - { - $this->factory = $factory; - $this->user = $user; - } + /** + * Create a new Share Authenticated User instance. + * + * @param \Illuminate\Contracts\View\Factory $factory + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + */ + public function __construct(Factory $factory,Authenticatable $user=NULL) + { + $this->factory = $factory; + $this->user = $user; + } - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - $this->factory->share('user',$this->user); + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->factory->share('user',$this->user); - return $next($request); - } + return $next($request); + } } \ No newline at end of file diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 2395ddc..3dae84f 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,21 +2,22 @@ namespace App\Http\Middleware; -use App\Providers\RouteServiceProvider; -use Closure; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use App\Providers\RouteServiceProvider; + class RedirectIfAuthenticated { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param Request $request + * @param \Closure $next + * @param string|null $guard * @return mixed */ - public function handle($request, Closure $next, $guard = null) + public function handle(Request $request,\Closure $next,?string $guard=NULL) { if (Auth::guard($guard)->check()) { return redirect(RouteServiceProvider::HOME); diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index f09c6df..fd0fa51 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -57,7 +57,7 @@ class MessageProcess implements ShouldQueue $o->set_path = $this->msg->pathaddress; // Determine if the message is to this system, or in transit - if ($ftns->search(function($item) { return $this->msg->tftn == $item->ftn; }) !== FALSE) { + if ($ftns->search(function($item) { return $this->msg->tftn === $item->ftn; }) !== FALSE) { // @todo Check if it is a duplicate message // @todo Check if the message is from a system we know about diff --git a/app/Jobs/NodelistImport.php b/app/Jobs/NodelistImport.php index a022c1a..458335d 100644 --- a/app/Jobs/NodelistImport.php +++ b/app/Jobs/NodelistImport.php @@ -109,7 +109,7 @@ class NodelistImport implements ShouldQueue $tocrc .= $line."\r\n"; // Lines beginning with a semicolon(;) are comments - if ((! $line) OR preg_match('/^;/',$line) OR ($line == chr(0x1a))) + if ((! $line) OR preg_match('/^;/',$line) OR ($line === chr(0x1a))) continue; // Remove any embedded CR and BOM @@ -365,7 +365,7 @@ class NodelistImport implements ShouldQueue try { $so->addresses()->save($ao); - if ($ao->role == Address::NODE_HC) + if ($ao->role === Address::NODE_HC) $hub_id = $ao->id; $no->addresses()->attach($ao,['role'=>$ao->role]); @@ -387,7 +387,7 @@ class NodelistImport implements ShouldQueue Address::whereIN('id',$remove->pluck('id')->toArray())->update(['active'=>FALSE]); Address::whereIN('id',$remove->pluck('id')->toArray())->delete(); - if ($x=crc16(substr($tocrc,0,-3)) == $file_crc) { + if ($x=crc16(substr($tocrc,0,-3)) === $file_crc) { Log::info(sprintf('%s:Committing nodelist',self::LOGKEY)); DB::commit(); } else { diff --git a/app/Models/Address.php b/app/Models/Address.php index 5750b7e..71c5448 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -3,7 +3,6 @@ namespace App\Models; use Carbon\Carbon; -use Exception; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; @@ -131,7 +130,7 @@ class Address extends Model return $this->hasOne(self::class,NULL,'void'); default: - throw new Exception('Unknown role: '.serialize($this->role)); + throw new \Exception('Unknown role: '.serialize($this->role)); } } else { @@ -219,7 +218,7 @@ class Address extends Model * Who we send this systems mail to. * * @return Address|null - * @throws Exception + * @throws \Exception */ public function parent(): ?Address { @@ -287,7 +286,7 @@ class Address extends Model return NULL; default: - throw new Exception('Unknown role: '.serialize($this->role)); + throw new \Exception('Unknown role: '.serialize($this->role)); } return $parent?->parent(); @@ -370,7 +369,7 @@ class Address extends Model * @param bool $create * @param System|null $so * @return Address|null - * @throws Exception + * @throws \Exception */ public static function findFTN(string $address,bool $create=FALSE,System $so=NULL): ?self { @@ -426,7 +425,7 @@ class Address extends Model if ($create) { if (! $so) - throw new Exception(sprintf('%s:AKA create requested for [%s], but system not provided',self::LOGKEY,$address)); + throw new \Exception(sprintf('%s:AKA create requested for [%s], but system not provided',self::LOGKEY,$address)); if (! $ftn['d']) { Log::alert(sprintf('%s:! Refusing to create address [%s] no domain available',self::LOGKEY,$address)); @@ -507,7 +506,7 @@ class Address extends Model try { Log::info(sprintf('%s:Checking Activation code [%s] is valid for user [%d]',self::LOGKEY,$code,$uo->id)); - return ($code == $this->set_activation($uo)); + return ($code === $this->set_activation($uo)); } catch (\Exception $e) { Log::error(sprintf('%s:! Activation code [%s] invalid for user [%d]',self::LOGKEY,$code,$uo->id)); @@ -687,21 +686,21 @@ class Address extends Model * * @param string $ftn * @return array - * @throws Exception + * @throws \Exception */ public static function parseFTN(string $ftn): array { if (! preg_match(sprintf('#^%s$#',self::ftn_regex),strtolower($ftn),$matches)) - throw new Exception('Invalid FTN: '.$ftn); + throw new \Exception('Invalid FTN: '.$ftn); // Check our numbers are correct. foreach ([1,2,3] as $i) { if ((! is_numeric($matches[$i])) || ($matches[$i] > DomainController::NUMBER_MAX)) - throw new Exception('Invalid FTN: '.$ftn); + throw new \Exception('Invalid FTN: '.$ftn); } if (isset($matches[5]) AND ((! is_numeric($matches[$i])) || ($matches[5] > DomainController::NUMBER_MAX))) - throw new Exception('Invalid FTN: '.$ftn); + throw new \Exception('Invalid FTN: '.$ftn); return [ 'z'=>(int)$matches[1], diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index e9bf7d8..77b9330 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -213,7 +213,7 @@ final class Echomail extends Model implements Packet if ($x=$this->path->firstWhere('pivot.parent_id',$start)) { $result->push($x->$display); $result->push($this->pathorder($display,$x->pivot->id)); - }; + } return $result->flatten()->filter(); } diff --git a/app/Models/File.php b/app/Models/File.php index f94a2e2..a4ee08a 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -64,7 +64,7 @@ class File extends Model unlink(Storage::disk('local')->path($model->fullname)); } else { throw new \Exception(sprintf('Unable to move file [%s] to [%s]',$model->fullname,$model->full_storage_path)); - }; + } // Delete anything being replaced // @todo implement replace diff --git a/app/Models/Netmail.php b/app/Models/Netmail.php index d9fc548..883993c 100644 --- a/app/Models/Netmail.php +++ b/app/Models/Netmail.php @@ -172,7 +172,7 @@ final class Netmail extends Model implements Packet if ($x=$this->path->firstWhere('pivot.parent_id',$start)) { $result->push($x->$display); $result->push($this->pathorder($display,$x->pivot->id)); - }; + } return $result->flatten()->filter(); } diff --git a/app/Notifications/AddressLink.php b/app/Notifications/AddressLink.php index efebd1a..52fc707 100644 --- a/app/Notifications/AddressLink.php +++ b/app/Notifications/AddressLink.php @@ -38,7 +38,7 @@ class AddressLink extends Notification //implements ShouldQueue /** * Get the notification's delivery channels. * - * @param mixed $notifiable + * @param mixed $notifiable * @return array */ public function via($notifiable) diff --git a/app/Notifications/Channels/NetmailChannel.php b/app/Notifications/Channels/NetmailChannel.php index 58afb8b..4b07d39 100644 --- a/app/Notifications/Channels/NetmailChannel.php +++ b/app/Notifications/Channels/NetmailChannel.php @@ -32,8 +32,8 @@ class NetmailChannel /** * Send the given notification. * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification * @return \Psr\Http\Message\ResponseInterface|void */ public function send($notifiable,Notification $notification) diff --git a/app/Notifications/NetmailTest.php b/app/Notifications/NetmailTest.php index f09ce6e..40db812 100644 --- a/app/Notifications/NetmailTest.php +++ b/app/Notifications/NetmailTest.php @@ -35,7 +35,7 @@ class NetmailTest extends Notification //implements ShouldQueue /** * Get the notification's delivery channels. * - * @param mixed $notifiable + * @param mixed $notifiable * @return array */ public function via($notifiable) diff --git a/app/Policies/SystemPolicy.php b/app/Policies/SystemPolicy.php index 15801db..f7396b0 100644 --- a/app/Policies/SystemPolicy.php +++ b/app/Policies/SystemPolicy.php @@ -60,6 +60,6 @@ class SystemPolicy return FALSE; return $system->users->contains($user) - && (($system->addresses->count() == 0) || ($system->addresses->where('validated',TRUE)->count())); + && (($system->addresses->count() === 0) || ($system->addresses->where('validated',TRUE)->count())); } } \ No newline at end of file diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 31fa335..bb6cb31 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -28,7 +28,7 @@ class AuthServiceProvider extends ServiceProvider $this->registerPolicies(); Gate::define('admin',function (User $o) { - return $o->admin == TRUE; + return $o->admin === TRUE; }); } } diff --git a/app/Rules/FidoInteger.php b/app/Rules/FidoInteger.php index f5123f3..f05dc02 100644 --- a/app/Rules/FidoInteger.php +++ b/app/Rules/FidoInteger.php @@ -8,26 +8,26 @@ use App\Http\Controllers\DomainController; class FidoInteger implements Rule { - /** - * Determine if the validation rule passes. + /** + * Determine if the validation rule passes. * This will check that a number used for zone, net, host is between 1 and DomainController::NUMBER_MAX. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute,$value) - { - return (is_numeric($value) && ($value >= 0) && ($value < DomainController::NUMBER_MAX)); - } + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function passes($attribute,$value) + { + return (is_numeric($value) && ($value >= 0) && ($value < DomainController::NUMBER_MAX)); + } - /** - * Get the validation error message. - * - * @return string - */ - public function message() - { - return sprintf('The number must be between 0 and %d.',DomainController::NUMBER_MAX); - } -} + /** + * Get the validation error message. + * + * @return string + */ + public function message() + { + return sprintf('The number must be between 0 and %d.',DomainController::NUMBER_MAX); + } +} \ No newline at end of file diff --git a/app/Rules/TwoByteInteger.php b/app/Rules/TwoByteInteger.php index b04b521..1f36e7a 100644 --- a/app/Rules/TwoByteInteger.php +++ b/app/Rules/TwoByteInteger.php @@ -12,8 +12,8 @@ class TwoByteInteger implements Rule * Determine if the validation rule passes. * This will check that a number used for zone, net, host is between 1 and DomainController::NUMBER_MAX. * - * @param string $attribute - * @param mixed $value + * @param string $attribute + * @param mixed $value * @return bool */ public function passes($attribute,$value) @@ -30,4 +30,4 @@ class TwoByteInteger implements Rule { return sprintf('The number must be between 1 and %d.',DomainController::NUMBER_MAX); } -} +} \ No newline at end of file diff --git a/app/Rules/TwoByteIntegerWithZero.php b/app/Rules/TwoByteIntegerWithZero.php index 1c6251c..8f9f2d6 100644 --- a/app/Rules/TwoByteIntegerWithZero.php +++ b/app/Rules/TwoByteIntegerWithZero.php @@ -12,8 +12,8 @@ class TwoByteIntegerWithZero implements Rule * Determine if the validation rule passes. * This will check that a number used for zone, net, host is between 1 and DomainController::NUMBER_MAX. * - * @param string $attribute - * @param mixed $value + * @param string $attribute + * @param mixed $value * @return bool */ public function passes($attribute,$value) @@ -30,4 +30,4 @@ class TwoByteIntegerWithZero implements Rule { return sprintf('The number must be between 1 and %d.',DomainController::NUMBER_MAX); } -} +} \ No newline at end of file diff --git a/app/Traits/EncodeUTF8.php b/app/Traits/EncodeUTF8.php index 5881e4c..3b88a3e 100644 --- a/app/Traits/EncodeUTF8.php +++ b/app/Traits/EncodeUTF8.php @@ -55,7 +55,7 @@ trait EncodeUTF8 foreach ($properties as $property) { // Dont serialize the validation error - if (($property->name == 'errors') || $property->isStatic()) + if (($property->name === 'errors') || $property->isStatic()) continue; $property->setAccessible(true); diff --git a/app/Traits/SingleOrFail.php b/app/Traits/SingleOrFail.php index e08bed4..a0da4b8 100644 --- a/app/Traits/SingleOrFail.php +++ b/app/Traits/SingleOrFail.php @@ -16,11 +16,10 @@ trait SingleOrFail Builder::macro('singleOrFail',function () { $result = $this->get(); - if (($x=$result->count()) == 1) { + if (($x=$result->count()) === 1) return $result->first(); - } - if ($x == 0) + if ($x === 0) throw new ModelNotFoundException('Query brings back 0 record(s) called for singleOrFail()'); else throw new \Exception(sprintf('Query brings back %d record(s) called for singleOrFail()',$x)); @@ -30,9 +29,8 @@ trait SingleOrFail Builder::macro('single',function () { $result = $this->get(); - if ($result->count() == 1) { + if ($result->count() === 1) return $result->first(); - } return NULL; }); @@ -41,11 +39,10 @@ trait SingleOrFail Builder::macro('singleOrNew',function ($args) { $result = $this->where($args)->get(); - if ($result->count() == 1) { + if ($result->count() === 1) return $result->first(); - } return $this->newModelInstance($args); }); } -} +} \ No newline at end of file diff --git a/app/helpers.php b/app/helpers.php index f1e7e57..bd3251d 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,17 +3,21 @@ /** * Calculate CCITT-CRC16 checksum */ + +use Carbon\Carbon; +use Illuminate\Support\Collection; + if (! function_exists('crc16')) { - function crc16($data): int - { - $crc = 0x0000; - for ($i = 0; $i < strlen($data); $i++) { - $x = (($crc >> 8) ^ ord($data[$i])) & 0xFF; - $x ^= $x >> 4; - $crc = (($crc << 8) ^ ($x << 12) ^ ($x << 5) ^ $x) & 0xFFFF; - } - return $crc; - } + function crc16($data): int + { + $crc = 0x0000; + for ($i = 0; $i < strlen($data); $i++) { + $x = (($crc >> 8) ^ ord($data[$i])) & 0xFF; + $x ^= $x >> 4; + $crc = (($crc << 8) ^ ($x << 12) ^ ($x << 5) ^ $x) & 0xFFFF; + } + return $crc; + } } /** @@ -89,20 +93,20 @@ if (! function_exists('timew')) { * + 04 bits 10th Sec * = 32 (2 bits free) * - * @param \Carbon\Carbon|null $time + * @param Carbon|null $time * @return int */ - function timew(\Carbon\Carbon $time=NULL): int + function timew(Carbon $time=NULL): int { static $delay = 0; // If we are not passed a time, we'll use the time now if (! $time) { // In case we are called twice, we'll delay 1/10th second so we have a unique result. - if (\Carbon\Carbon::now()->getPreciseTimestamp(1) == $delay) + if (Carbon::now()->getPreciseTimestamp(1) === $delay) usleep(100000); - $time = \Carbon\Carbon::now(); + $time = Carbon::now(); } $delay = $time->getPreciseTimestamp(1); @@ -124,12 +128,12 @@ if (! function_exists('dwtime')) { * * @param int $time * @param int|null $year - * @return \Carbon\Carbon + * @return Carbon */ - function wtime(int $time,int $year=NULL): \Carbon\Carbon + function wtime(int $time,int $year=NULL): Carbon { if (! $year) - $year = \Carbon\Carbon::now()->year; + $year = Carbon::now()->year; // Does the time have milli seconds? if ($time > pow(2,26)-1) { @@ -154,7 +158,7 @@ if (! function_exists('dwtime')) { $month = ($time & 0x1f); - return \Carbon\Carbon::create($year,$month,$day,$hr,$min,$sec+$milli/10); + return Carbon::create($year,$month,$day,$hr,$min,$sec+$milli/10); } } @@ -162,7 +166,7 @@ if (! function_exists('optimize_path')) { /** * This will optimize an array of paths to show the smallest number of characters */ - function optimize_path(\Illuminate\Support\Collection $path): \Illuminate\Support\Collection + function optimize_path(Collection $path): Collection { $cur = NULL; $result = collect(); diff --git a/resources/views/about.blade.php b/resources/views/about.blade.php index ef3c9c7..d01bc24 100644 --- a/resources/views/about.blade.php +++ b/resources/views/about.blade.php @@ -9,27 +9,44 @@

Welcome to the FTN Clearing Houz.

-

FTN is an abbreviation for FidoNet Technology Network, and the most well known FTN is "FidoNet" that still exists today. - There were many other "Othernets" also created around that time and since, and some still in operation today as well.

-

FidoNet was born in the 1980's (well before the public Internet) when personal computers were being introduced to homes, and modems were being invented. - Some very clever people developed protocols and standards to exchange mail and files with peers, with the network growing to around 40,000 systems in the mid 1990's. - Those systems were called BBSes or Bulletin Board Systems. - As "the Internet" became more accessible, the usage of FidoNet and BBSes drastically reduced, but there are some systems still in operation today.

-

The FTN Clearing Houz is both an FTN Mailer and FTN message tosser, where mail is stored internally in a DB, and files in an S3 bucket. It can also hatch and toss files into FTN networks for both upstream and downstream nodes.

-

It was created as an idea to bring modern technology and capabilities to that legacy computing network that existed in the 1980's and 1990's, where many of those programs from the 1980's and 1990's are still in use today too.

- -

Setting up an FTN network is fun, but managing one for the longer term, in amongst our busy lives can involve some tedious repetitive tasks. - In the same vain, maintaining and growing an FTN network also can be time consuming, especially when your effort (or lack thereof) can affect the experience of your users. +

FTN is an abbreviation for FidoNet Technology Network, and the most well known FTN is " + FidoNet" that still exists today. + There were many other "Othernets" also created around that time and since, and some still in operation today as + well.

+

FidoNet was born in the 1980's (well before the public Internet) when personal computers were being introduced to + homes, and modems were being invented. + Some very clever people developed protocols and standards to exchange mail and files with peers, with the + network growing to around 40,000 systems in the mid 1990's. + Those systems were called BBSes or Bulletin Board + Systems. + As "the Internet" became more accessible, the usage of FidoNet and BBSes drastically reduced, but there are some + systems still in operation today.

+

The FTN Clearing Houz is both an FTN Mailer and FTN message tosser, where mail + is stored internally in a DB, and files in an S3 bucket. It can also hatch and toss files into FTN networks for + both upstream and downstream nodes.

+

It was created as an idea to bring modern technology and capabilities to that legacy computing network that + existed in the 1980's and 1990's, where many of those programs from the 1980's and 1990's are still in use today + too.

+

Setting up an FTN network is fun, but managing one for the longer term, in amongst our busy lives can involve + some tedious repetitive tasks. + In the same vain, maintaining and growing an FTN network also can be time consuming, especially when your effort + (or lack thereof) can affect the experience of your users. So FTN Clearing Houz was created to help address that.

-

Building this software is driven by three main goals:

    -
  1. Self Service - so that users can setup and re-jig their configuration themselves, or new users can join a network with the minimum of effort (relieving a dependancy on an admin to set you up, and thus freeing up time for those admins).
  2. +
  3. Self Service - so that users can setup and re-jig their configuration themselves, or new users can join a + network with the minimum of effort (relieving a dependancy on an admin to set you up, and thus freeing up + time for those admins). +
  4. Automation - so that repetitive tasks can be done with minimal effort.
  5. -
  6. High Availability - So if one hub goes down, users can automatically connect to an alternate hub to keep mail flowing. Furthermore, as hubs retire, new hubs can assume the role of the retiring hub with minimal effort.
  7. +
  8. High Availability - So if one hub goes down, users can automatically connect to an alternate hub to keep + mail flowing. Furthermore, as hubs retire, new hubs can assume the role of the retiring hub with minimal + effort. +
-

...all so that you can spend your time playing on your BBS rather than managing messages, failures or keeping an FTN network running.

+

...all so that you can spend your time playing on your BBS rather than managing messages, failures or keeping an + FTN network running.

For the BBS Sysop

For the BBS sysop, the FTN Clearing Houz has the following features:

@@ -38,7 +55,8 @@
  • Supports EMSI network transfers (for legacy "frontend" mailers)
  • Supports PING responses (to netmails)
  • A consistent reliable echomail/netmail hub for your BBSes, while you reconfigure your BBS.
    -If you have more than 1 BBS, then the Clearing Houz can receive all your mail from your uplinks and feed them to your BBSes. + If you have more than 1 BBS, then the Clearing Houz can receive all your mail from your uplinks and feed + them to your BBSes.
  • @@ -53,9 +71,14 @@ If you have more than 1 BBS, then the Clearing Houz can receive all your mail fr
  • Nodelist Management
  • Self service FTN Network Applications being implemented
  • Dynamic mail bundling for upstream and downstream nodes (no more "inbounds" and "outbounds")
  • -
  • Support for Fidonet Packet formats FTS-0001,FSC-0039,FSC-0045,FSC-0048
  • +
  • Support for Fidonet Packet formats FTS-0001, + FSC-0039, + FSC-0045, + FSC-0048
  • Automatic delisting of idle nodes (to be implemented)
  • -
  • DNS server, to enable resolving of registered nodes using domain dns names pN.fN.nN.zN.domain.ftn, or pN.fN.nN.zN.[domain dns zone]
  • +
  • DNS server, to enable resolving of registered nodes using domain dns names + pN.fN.nN.zN.domain.ftn, or + pN.fN.nN.zN.[domain dns zone]
  • Other things

    @@ -69,14 +92,20 @@ If you have more than 1 BBS, then the Clearing Houz can receive all your mail fr

    If you are here to link to BBS, please get started by logging in.

    Open Source

    -

    FTN Clearing Houz is built with Open Source software. At it's core, PHP drives this web UI and the interaction with nodes.

    -

    This web UI has been inspired by the great work at int10h.org. If you have ideas to make it even better, please send me a message, or submit your comments in gitlab

    +

    FTN Clearing Houz is built with Open Source software. At it's core, PHP drives this web UI and the interaction + with nodes.

    +

    This web UI has been inspired by the great work at int10h.org. If you have ideas + to make it even better, please send me a message, or submit your comments in gitlab

    Other technology that drives the Clearing Houz

    FTN Clearing Houz is made available by these technologies:

    • Docker - taking the effort out of building, deploying and easing the effort of upgrading.
    • -
    • CockroachDB - a high available, geodispersable database, that enables accessing configuration and data from multiple locations. CockroachDB enables the FTN Clearing Houz to appear as the same hub from multiple locations, providing a high available environment for Sysops to drop off and collect mail
    • +
    • CockroachDB - a high available, geodispersable database, that enables accessing configuration and + data from multiple locations. CockroachDB enables the FTN Clearing Houz to appear as the same hub from + multiple locations, providing a high available environment for Sysops to drop off and collect + mail
    • PostgreSQL - to store all the data
    • Memcached - to take some of the pressure off the database
    • PHP/Laravel - the coding framework used to create this UI, and to enable the transfer of mail between systems
    • diff --git a/resources/views/domain/home.blade.php b/resources/views/domain/home.blade.php index 8a7cc9d..660df4e 100644 --- a/resources/views/domain/home.blade.php +++ b/resources/views/domain/home.blade.php @@ -16,7 +16,7 @@
      - @if (\App\Models\Domain::count() == 0) + @if (\App\Models\Domain::count() === 0) @can('admin',(new \App\Models\Domain))

      There are no domains setup, to set up your first.

      @else diff --git a/resources/views/echoarea/home.blade.php b/resources/views/echoarea/home.blade.php index 7161c27..0d49d0b 100644 --- a/resources/views/echoarea/home.blade.php +++ b/resources/views/echoarea/home.blade.php @@ -16,7 +16,7 @@

      This system is aware of the following echoareas @can('admin',(new \App\Models\Echoarea))(you can add more)@endcan:

      - @if (\App\Models\Echoarea::count() == 0) + @if (\App\Models\Echoarea::count() === 0) @can('admin',(new \App\Models\Echoarea))

      There are no echoareas setup, to set up your first.

      @else diff --git a/resources/views/filearea/home.blade.php b/resources/views/filearea/home.blade.php index 20ec600..99c825e 100644 --- a/resources/views/filearea/home.blade.php +++ b/resources/views/filearea/home.blade.php @@ -16,7 +16,7 @@

      This system is aware of the following fileareas @can('admin',(new \App\Models\Filearea))(you can add more)@endcan:

      - @if (\App\Models\Filearea::count() == 0) + @if (\App\Models\Filearea::count() === 0) @can('admin',(new \App\Models\Filearea))

      There are no fileareas setup, to set up your first.

      @else diff --git a/resources/views/layouts/partials/topmenu.blade.php b/resources/views/layouts/partials/topmenu.blade.php index ad422c5..e70ca66 100644 --- a/resources/views/layouts/partials/topmenu.blade.php +++ b/resources/views/layouts/partials/topmenu.blade.php @@ -155,7 +155,7 @@ async : true, cache : false, beforeSend : function() { - if (c++ == 0) { + if (c++ === 0) { $('i.bi-search').addClass('spinner-grow spinner-grow-sm'); } }, @@ -166,7 +166,7 @@ process(data); }, complete : function() { - if (--c == 0) { + if (--c === 0) { $('i.bi-search').removeClass('spinner-grow spinner-grow-sm'); } } diff --git a/resources/views/pkt.blade.php b/resources/views/pkt.blade.php index f81950b..8094a17 100644 --- a/resources/views/pkt.blade.php +++ b/resources/views/pkt.blade.php @@ -60,7 +60,7 @@ @foreach($results as $item) @foreach ($item as $file => $result) -
      +

      Packet {{ $file }} (type {{ $result->type }}) is from {{ $result->fftn }} to {{ $result->tftn }}, dated {{ $result->date }}.

      This packet has {{ $result->messages->count() }} messages and {{ $result->password ? 'DOES' : 'does NOT' }} have a password.

      @@ -77,7 +77,7 @@ @if($msg->isNetmail()) Netmail @else Echomail {{ $msg->echoarea }} @endif : {{ $msg->msgid }} -
      +
      @if ($msg->errors) @foreach ($msg->errors->messages()->all() as $error) diff --git a/resources/views/system/home.blade.php b/resources/views/system/home.blade.php index 89bd40c..4667626 100644 --- a/resources/views/system/home.blade.php +++ b/resources/views/system/home.blade.php @@ -18,7 +18,7 @@ @can('admin',(new \App\Models\System))(you can add more):@endcan

      - @if (\App\Models\System::active()->count() == 0) + @if (\App\Models\System::active()->count() === 0) @can('create',(new \App\Models\System))

      There are no systems setup, to set up your first.

      @else diff --git a/resources/views/system/ours.blade.php b/resources/views/system/ours.blade.php index 3f41d38..c7afeca 100644 --- a/resources/views/system/ours.blade.php +++ b/resources/views/system/ours.blade.php @@ -8,7 +8,7 @@

      Our Systems

      - @if (\App\Models\System::count() == 0) + @if (\App\Models\System::count() === 0)

      There are no systems configured here.

      @else

      These BBS systems are configured here.

      diff --git a/resources/views/system/widget/echoarea.blade.php b/resources/views/system/widget/echoarea.blade.php index c568273..a710072 100644 --- a/resources/views/system/widget/echoarea.blade.php +++ b/resources/views/system/widget/echoarea.blade.php @@ -12,7 +12,7 @@ @foreach ($echoareas as $oo) - echoareas->search(function($item) use ($oo) { return $item->id == $oo->id; }) !== FALSE)checked @endif> + echoareas->search(function($item) use ($oo) { return $item->id === $oo->id; }) !== FALSE)checked @endif> {{ $oo->name }} {{ $oo->description }} diff --git a/resources/views/system/widget/filearea.blade.php b/resources/views/system/widget/filearea.blade.php index fcddb9b..d7cf41d 100644 --- a/resources/views/system/widget/filearea.blade.php +++ b/resources/views/system/widget/filearea.blade.php @@ -12,7 +12,7 @@ @foreach ($fileareas as $oo) - fileareas->search(function($item) use ($oo) { return $item->id == $oo->id; }) !== FALSE)checked @endif> + fileareas->search(function($item) use ($oo) { return $item->id === $oo->id; }) !== FALSE)checked @endif> {{ $oo->name }} {{ $oo->description }} diff --git a/resources/views/user/addedit.blade.php b/resources/views/user/addedit.blade.php index a3f2769..5be6878 100644 --- a/resources/views/user/addedit.blade.php +++ b/resources/views/user/addedit.blade.php @@ -75,11 +75,11 @@
      -
      id == $o->id)data-bs-toggle="tooltip" title="You cannot demote yourself" @endif> +
      id === $o->id)data-bs-toggle="tooltip" title="You cannot demote yourself" @endif> admin))checked @endif> - id == $o->id) || $user->cannot('admin',$o)) disabled @endif @if(! old('admin',$o->admin))checked @endif> + id === $o->id) || $user->cannot('admin',$o)) disabled @endif @if(! old('admin',$o->admin))checked @endif>
      @@ -113,7 +113,7 @@ @endsection @section('page-scripts') - @if($user->id == $o->id) + @if($user->id === $o->id)