Additional syntax validation for areafix/filefix commands
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -37,18 +38,21 @@ class Area extends Base
|
||||
{
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
// If command starts with '-', its to unsubscribe
|
||||
if (str_starts_with($this->arguments[0],'-')) {
|
||||
$sub = FALSE;
|
||||
$area = substr($this->arguments[0],1);
|
||||
if (! ($area=Arr::get($this->arguments,0,NULL)))
|
||||
return sprintf('%-25s <-- INVALID, AN AREA IS REQUIRED',$command);
|
||||
|
||||
} elseif (str_starts_with($this->arguments[0],'+')) {
|
||||
// If command starts with '-', its to unsubscribe
|
||||
if (str_starts_with($area,'-')) {
|
||||
$sub = FALSE;
|
||||
$area = substr($area,1);
|
||||
|
||||
} elseif (str_starts_with($area,'+')) {
|
||||
$sub = TRUE;
|
||||
$area = substr($this->arguments[0],1);
|
||||
$area = substr($area,1);
|
||||
|
||||
} else {
|
||||
$sub = TRUE;
|
||||
$area = $this->arguments[0];
|
||||
$area = $area;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s:- Processing [%s] for [%s]',self::LOGKEY,$sub ? 'ADD' : 'REMOVE',$area));
|
||||
|
Reference in New Issue
Block a user