Code cleanup, no functional changes
This commit is contained in:
parent
b70a36003a
commit
ad36da0bb1
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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('/');
|
||||
;
|
||||
}
|
||||
}
|
@ -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.
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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() : '-'));
|
||||
|
@ -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;$i<count($ext);$i++)
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Classes\File;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@ -75,19 +74,19 @@ final class Receive extends Item
|
||||
->sum(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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 <DLE> */
|
||||
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 <CR><LF> 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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
@ -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()));
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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()) {
|
||||
|
@ -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' => [
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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],
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
$this->registerPolicies();
|
||||
|
||||
Gate::define('admin',function (User $o) {
|
||||
return $o->admin == TRUE;
|
||||
return $o->admin === TRUE;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
@ -9,27 +9,44 @@
|
||||
<p>Welcome to the <strong class="highlight">FTN Clearing Houz</strong>.</p>
|
||||
|
||||
<div class="float-end ps-3 pb-3" id="network_traffic"></div>
|
||||
<p>FTN is an abbreviation for FidoNet Technology Network, and the most well known FTN is "<a href="https://wikipedia.org/wiki/FidoNet">FidoNet</a>" that still exists today.
|
||||
There were many other "Othernets" also created around that time and since, and some still in operation today as well.</p>
|
||||
<p>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 <a href="https://wikipedia.org/wiki/Bulletin_board_system">Bulletin Board Systems</a>.
|
||||
As "the Internet" became more accessible, the usage of FidoNet and BBSes drastically reduced, but there are some systems still in operation today.</p>
|
||||
<p>The <strong class="highlight">FTN Clearing Houz</strong> 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.</p>
|
||||
<p>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.</p>
|
||||
|
||||
<p>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.
|
||||
<p>FTN is an abbreviation for FidoNet Technology Network, and the most well known FTN is "
|
||||
<a href="https://wikipedia.org/wiki/FidoNet">FidoNet</a>" that still exists today.
|
||||
There were many other "Othernets" also created around that time and since, and some still in operation today as
|
||||
well.</p>
|
||||
<p>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 <a href="https://wikipedia.org/wiki/Bulletin_board_system">Bulletin Board
|
||||
Systems</a>.
|
||||
As "the Internet" became more accessible, the usage of FidoNet and BBSes drastically reduced, but there are some
|
||||
systems still in operation today.</p>
|
||||
<p>The <strong class="highlight">FTN Clearing Houz</strong> 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.</p>
|
||||
<p>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.</p>
|
||||
<p>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.</p>
|
||||
|
||||
<p>Building this software is driven by three main goals:</p>
|
||||
<ol>
|
||||
<li>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).</li>
|
||||
<li>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).
|
||||
</li>
|
||||
<li>Automation - so that repetitive tasks can be done with minimal effort.</li>
|
||||
<li>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.</li>
|
||||
<li>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.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>...all so that you can spend your time playing on your BBS rather than managing messages, failures or keeping an FTN network running.</p>
|
||||
<p>...all so that you can spend your time playing on your BBS rather than managing messages, failures or keeping an
|
||||
FTN network running.</p>
|
||||
|
||||
<h3>For the BBS Sysop</h3>
|
||||
<p>For the BBS sysop, the FTN Clearing Houz has the following features:</p>
|
||||
@ -38,7 +55,8 @@
|
||||
<li>Supports EMSI network transfers (for legacy "frontend" mailers)</li>
|
||||
<li>Supports PING responses (to netmails)</li>
|
||||
<li>A consistent reliable echomail/netmail hub for your BBSes, while you reconfigure your BBS.<br>
|
||||
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.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -53,9 +71,14 @@ If you have more than 1 BBS, then the Clearing Houz can receive all your mail fr
|
||||
<li>Nodelist Management</li>
|
||||
<li>Self service FTN Network Applications <sup>being implemented</sup></li>
|
||||
<li>Dynamic mail bundling for upstream and downstream nodes (no more "inbounds" and "outbounds")</li>
|
||||
<li>Support for Fidonet Packet formats <a href="http://ftsc.org/docs/fts-0001.016">FTS-0001</a>,<a href="http://ftsc.org/docs/fsc-0039.004">FSC-0039</a>,<a href="http://ftsc.org/docs/fsc-0045.001">FSC-0045</a>,<a href="http://ftsc.org/docs/fsc-0048.002">FSC-0048</a></li>
|
||||
<li>Support for Fidonet Packet formats <a href="http://ftsc.org/docs/fts-0001.016">FTS-0001</a>,
|
||||
<a href="http://ftsc.org/docs/fsc-0039.004">FSC-0039</a>,
|
||||
<a href="http://ftsc.org/docs/fsc-0045.001">FSC-0045</a>,
|
||||
<a href="http://ftsc.org/docs/fsc-0048.002">FSC-0048</a></li>
|
||||
<li>Automatic delisting of idle nodes <sup>(to be implemented)</sup></li>
|
||||
<li>DNS server, to enable resolving of registered nodes using domain dns names <strong class="highlight">p<em>N</em>.f<em>N</em>.n<em>N</em>.z<em>N</em>.<em>domain</em>.ftn</strong>, or <strong class="highlight">p<em>N</em>.f<em>N</em>.n<em>N</em>.z<em>N</em>.<em>[domain dns zone]</em></strong></li>
|
||||
<li>DNS server, to enable resolving of registered nodes using domain dns names
|
||||
<strong class="highlight">p<em>N</em>.f<em>N</em>.n<em>N</em>.z<em>N</em>.<em>domain</em>.ftn</strong>, or
|
||||
<strong class="highlight">p<em>N</em>.f<em>N</em>.n<em>N</em>.z<em>N</em>.<em>[domain dns zone]</em></strong></li>
|
||||
</ul>
|
||||
|
||||
<h4>Other things</h4>
|
||||
@ -69,14 +92,20 @@ If you have more than 1 BBS, then the Clearing Houz can receive all your mail fr
|
||||
<p>If you are here to link to BBS, please get started by <a href="{{ url('login') }}">logging in</a>.</p>
|
||||
|
||||
<h2>Open Source</h2>
|
||||
<p>FTN Clearing Houz is built with Open Source software. At it's core, PHP drives this web UI and the interaction with nodes.</p>
|
||||
<p>This web UI has been inspired by the great work at <a href="https://int10h.org">int10h.org</a>. If you have ideas to make it even better, please send me a message, or submit your comments in <a href="https://dev.dege.au/bbs/clrghouz">gitlab</a></p>
|
||||
<p>FTN Clearing Houz is built with Open Source software. At it's core, PHP drives this web UI and the interaction
|
||||
with nodes.</p>
|
||||
<p>This web UI has been inspired by the great work at <a href="https://int10h.org">int10h.org</a>. If you have ideas
|
||||
to make it even better, please send me a message, or submit your comments in <a
|
||||
href="https://dev.dege.au/bbs/clrghouz">gitlab</a></p>
|
||||
|
||||
<h3>Other technology that drives the Clearing Houz</h3>
|
||||
<p>FTN Clearing Houz is made available by these technologies:</p>
|
||||
<ul>
|
||||
<li>Docker - taking the effort out of building, deploying and easing the effort of upgrading.</li>
|
||||
<li><strike>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</strike></li>
|
||||
<li><strike>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</strike></li>
|
||||
<li>PostgreSQL - to store all the data
|
||||
<li>Memcached - to take some of the pressure off the database</li>
|
||||
<li>PHP/Laravel - the coding framework used to create this UI, and to enable the transfer of mail between systems</li>
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
@if (\App\Models\Domain::count() == 0)
|
||||
@if (\App\Models\Domain::count() === 0)
|
||||
@can('admin',(new \App\Models\Domain))
|
||||
<p>There are no domains setup, to <a href="{{ url('ftn/domain/addedit') }}">set up your first</a>.</p>
|
||||
@else
|
||||
|
@ -16,7 +16,7 @@
|
||||
<div class="col-9">
|
||||
<p>This system is aware of the following echoareas @can('admin',(new \App\Models\Echoarea))(you can <a href="{{ url('ftn/echoarea/addedit') }}">add</a> more)@endcan:</p>
|
||||
|
||||
@if (\App\Models\Echoarea::count() == 0)
|
||||
@if (\App\Models\Echoarea::count() === 0)
|
||||
@can('admin',(new \App\Models\Echoarea))
|
||||
<p>There are no echoareas setup, to <a href="{{ url('ftn/echoarea/addedit') }}">set up your first</a>.</p>
|
||||
@else
|
||||
|
@ -16,7 +16,7 @@
|
||||
<div class="col-9">
|
||||
<p>This system is aware of the following fileareas @can('admin',(new \App\Models\Filearea))(you can <a href="{{ url('ftn/filearea/addedit') }}">add</a> more)@endcan:</p>
|
||||
|
||||
@if (\App\Models\Filearea::count() == 0)
|
||||
@if (\App\Models\Filearea::count() === 0)
|
||||
@can('admin',(new \App\Models\Filearea))
|
||||
<p>There are no fileareas setup, to <a href="{{ url('ftn/filearea/addedit') }}">set up your first</a>.</p>
|
||||
@else
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
@foreach($results as $item)
|
||||
@foreach ($item as $file => $result)
|
||||
<h3 class="accordion-header" data-bs-toggle="collapse" data-bs-target="#collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" aria-expanded="false">Packet Results <strong class="highlight">{{ $file }}</strong></h3>
|
||||
<div id="collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($result->messages->count() == 1 && $loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_packet">
|
||||
<div id="collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($result->messages->count() === 1 && $loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_packet">
|
||||
<div class="accordion-body">
|
||||
<p>Packet <strong class="highlight">{{ $file }}</strong> (type <strong class="highlight">{{ $result->type }}</strong>) is from <strong class="highlight">{{ $result->fftn }}</strong> to <strong class="highlight">{{ $result->tftn }}</strong>, dated <strong class="highlight">{{ $result->date }}</strong>.</p>
|
||||
<p>This packet has <strong class="highlight">{{ $result->messages->count() }}</strong> messages and <strong class="highlight">{{ $result->password ? 'DOES' : 'does NOT' }}</strong> have a password.</p>
|
||||
@ -77,7 +77,7 @@
|
||||
@if($msg->isNetmail()) Netmail @else Echomail <strong>{{ $msg->echoarea }}</strong> @endif : {{ $msg->msgid }}
|
||||
</h4>
|
||||
|
||||
<div id="collapse_msg_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($result->messages->count() == 1 && $loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_file_{{ $loop->parent->parent->index }}">
|
||||
<div id="collapse_msg_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($result->messages->count() === 1 && $loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_file_{{ $loop->parent->parent->index }}">
|
||||
<div class="accordion-body">
|
||||
@if ($msg->errors)
|
||||
@foreach ($msg->errors->messages()->all() as $error)
|
||||
|
@ -18,7 +18,7 @@
|
||||
@can('admin',(new \App\Models\System))(you can <a href="{{ url('ftn/system/addedit') }}">add</a> more):@endcan
|
||||
</p>
|
||||
|
||||
@if (\App\Models\System::active()->count() == 0)
|
||||
@if (\App\Models\System::active()->count() === 0)
|
||||
@can('create',(new \App\Models\System))
|
||||
<p>There are no systems setup, to <a href="{{ url('ftn/system/addedit') }}">set up your first</a>.</p>
|
||||
@else
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="col-12">
|
||||
<h2>Our Systems</h2>
|
||||
|
||||
@if (\App\Models\System::count() == 0)
|
||||
@if (\App\Models\System::count() === 0)
|
||||
<p class="pad">There are no systems configured here.</p>
|
||||
@else
|
||||
<p>These BBS systems are configured here.</p>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<tbody>
|
||||
@foreach ($echoareas as $oo)
|
||||
<tr>
|
||||
<td><input type="checkbox" name="id[]" value="{{ $oo->id }}" @if($ao->echoareas->search(function($item) use ($oo) { return $item->id == $oo->id; }) !== FALSE)checked @endif></td>
|
||||
<td><input type="checkbox" name="id[]" value="{{ $oo->id }}" @if($ao->echoareas->search(function($item) use ($oo) { return $item->id === $oo->id; }) !== FALSE)checked @endif></td>
|
||||
<td>{{ $oo->name }}</td>
|
||||
<td>{{ $oo->description }}</td>
|
||||
</tr>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<tbody>
|
||||
@foreach ($fileareas as $oo)
|
||||
<tr>
|
||||
<td><input type="checkbox" name="id[]" value="{{ $oo->id }}" @if($ao->fileareas->search(function($item) use ($oo) { return $item->id == $oo->id; }) !== FALSE)checked @endif></td>
|
||||
<td><input type="checkbox" name="id[]" value="{{ $oo->id }}" @if($ao->fileareas->search(function($item) use ($oo) { return $item->id === $oo->id; }) !== FALSE)checked @endif></td>
|
||||
<td>{{ $oo->name }}</td>
|
||||
<td>{{ $oo->description }}</td>
|
||||
</tr>
|
||||
|
@ -75,11 +75,11 @@
|
||||
<div class="offset-1 col-1">
|
||||
<label for="admin" class="form-label">Site Admin</label>
|
||||
<div class="input-group">
|
||||
<div class="btn-group" role="group" @if($user->id == $o->id)data-bs-toggle="tooltip" title="You cannot demote yourself" @endif>
|
||||
<div class="btn-group" role="group" @if($user->id === $o->id)data-bs-toggle="tooltip" title="You cannot demote yourself" @endif>
|
||||
<input type="radio" class="btn-check" name="admin" id="admin_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('admin',$o->admin))checked @endif>
|
||||
<label class="btn btn-outline-success" for="admin_yes">Yes</label>
|
||||
|
||||
<input type="radio" class="btn-check btn-danger" name="admin" id="admin_no" value="0" required @if(($user->id == $o->id) || $user->cannot('admin',$o)) disabled @endif @if(! old('admin',$o->admin))checked @endif>
|
||||
<input type="radio" class="btn-check btn-danger" name="admin" id="admin_no" value="0" required @if(($user->id === $o->id) || $user->cannot('admin',$o)) disabled @endif @if(! old('admin',$o->admin))checked @endif>
|
||||
<label class="btn btn-outline-danger" for="admin_no">No</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -113,7 +113,7 @@
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
@if($user->id == $o->id)
|
||||
@if($user->id === $o->id)
|
||||
<script>
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
||||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||
|
@ -119,7 +119,7 @@
|
||||
async : true,
|
||||
cache : false,
|
||||
beforeSend : function() {
|
||||
if (c++ == 0) {
|
||||
if (c++ === 0) {
|
||||
icon.removeClass('d-none');
|
||||
}
|
||||
},
|
||||
@ -130,7 +130,7 @@
|
||||
process(data);
|
||||
},
|
||||
complete : function() {
|
||||
if (--c == 0) {
|
||||
if (--c === 0) {
|
||||
icon.addClass('d-none');
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@
|
||||
async : true,
|
||||
cache : false,
|
||||
beforeSend : function() {
|
||||
if (c++ == 0) {
|
||||
if (c++ === 0) {
|
||||
icon.removeClass('d-none');
|
||||
}
|
||||
},
|
||||
@ -238,7 +238,7 @@
|
||||
process(data);
|
||||
},
|
||||
complete : function() {
|
||||
if (--c == 0) {
|
||||
if (--c === 0) {
|
||||
icon.addClass('d-none');
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
@if (\App\Models\Zone::count() == 0)
|
||||
@if (\App\Models\Zone::count() === 0)
|
||||
@can('admin',(new \App\Models\Zone))
|
||||
<p>There are no zones setup, to <a href="{{ url('ftn/zone/addedit') }}">set up your first</a>.</p>
|
||||
@else
|
||||
|
Loading…
Reference in New Issue
Block a user