mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix some scrutiniser issues.
This commit is contained in:
parent
0b5cab99cf
commit
08ac27cccf
@ -111,9 +111,9 @@ class Handler extends ExceptionHandler
|
|||||||
/**
|
/**
|
||||||
* Convert an authentication exception into an unauthenticated response.
|
* Convert an authentication exception into an unauthenticated response.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
protected function unauthenticated($request)
|
protected function unauthenticated($request)
|
||||||
{
|
{
|
||||||
|
@ -32,9 +32,9 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
/** @var MessageBag */
|
/** @var MessageBag */
|
||||||
public $messages;
|
public $messages;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $allowedMimes;
|
protected $allowedMimes = [];
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $maxUploadSize;
|
protected $maxUploadSize = 0;
|
||||||
|
|
||||||
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
|
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
|
||||||
protected $uploadDisk;
|
protected $uploadDisk;
|
||||||
@ -44,8 +44,8 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->maxUploadSize = config('firefly.maxUploadSize');
|
$this->maxUploadSize = intval(config('firefly.maxUploadSize'));
|
||||||
$this->allowedMimes = config('firefly.allowedMimes');
|
$this->allowedMimes = (array) config('firefly.allowedMimes');
|
||||||
$this->errors = new MessageBag;
|
$this->errors = new MessageBag;
|
||||||
$this->messages = new MessageBag;
|
$this->messages = new MessageBag;
|
||||||
$this->uploadDisk = Storage::disk('upload');
|
$this->uploadDisk = Storage::disk('upload');
|
||||||
|
@ -167,6 +167,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
public function getJournals(): Collection
|
public function getJournals(): Collection
|
||||||
{
|
{
|
||||||
$this->run = true;
|
$this->run = true;
|
||||||
|
/** @var Collection $set */
|
||||||
$set = $this->query->get(array_values($this->fields));
|
$set = $this->query->get(array_values($this->fields));
|
||||||
Log::debug(sprintf('Count of set is %d', $set->count()));
|
Log::debug(sprintf('Count of set is %d', $set->count()));
|
||||||
$set = $this->filterTransfers($set);
|
$set = $this->filterTransfers($set);
|
||||||
|
@ -18,6 +18,7 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
use FireflyIII\Http\Requests\AttachmentFormRequest;
|
use FireflyIII\Http\Requests\AttachmentFormRequest;
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
@ -100,7 +101,9 @@ class AttachmentController extends Controller
|
|||||||
$content = $repository->getContent($attachment);
|
$content = $repository->getContent($attachment);
|
||||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||||
|
|
||||||
return response($content, 200)
|
/** @var LaravelResponse $response */
|
||||||
|
$response = response($content, 200);
|
||||||
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
||||||
@ -110,6 +113,8 @@ class AttachmentController extends Controller
|
|||||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', strlen($content));
|
->header('Content-Length', strlen($content));
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
|
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ use FireflyIII\Models\ExportJob;
|
|||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
||||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface as EJRI;
|
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface as EJRI;
|
||||||
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use View;
|
use View;
|
||||||
@ -73,8 +74,9 @@ class ExportController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$job->change('export_downloaded');
|
$job->change('export_downloaded');
|
||||||
|
/** @var LaravelResponse $response */
|
||||||
return response($content, 200)
|
$response = response($content, 200);
|
||||||
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
||||||
@ -85,6 +87,8 @@ class ExportController extends Controller
|
|||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', strlen($content));
|
->header('Content-Length', strlen($content));
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,8 +132,7 @@ class ExportController extends Controller
|
|||||||
* @param AccountRepositoryInterface $repository
|
* @param AccountRepositoryInterface $repository
|
||||||
* @param EJRI $jobs
|
* @param EJRI $jobs
|
||||||
*
|
*
|
||||||
* @return string
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function postIndex(ExportFormRequest $request, AccountRepositoryInterface $repository, EJRI $jobs)
|
public function postIndex(ExportFormRequest $request, AccountRepositoryInterface $repository, EJRI $jobs)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ use FireflyIII\Models\ImportJob;
|
|||||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
use Log;
|
use Log;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
@ -120,8 +121,9 @@ class ImportController extends Controller
|
|||||||
$result = json_encode($config, JSON_PRETTY_PRINT);
|
$result = json_encode($config, JSON_PRETTY_PRINT);
|
||||||
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
|
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
|
||||||
|
|
||||||
return response($result, 200)
|
/** @var LaravelResponse $response */
|
||||||
->header('Content-disposition', 'attachment; filename=' . $name)
|
$response = response($result, 200);
|
||||||
|
$response->header('Content-disposition', 'attachment; filename=' . $name)
|
||||||
->header('Content-Type', 'application/json')
|
->header('Content-Type', 'application/json')
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Connection', 'Keep-Alive')
|
->header('Connection', 'Keep-Alive')
|
||||||
@ -130,6 +132,8 @@ class ImportController extends Controller
|
|||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', strlen($result));
|
->header('Content-Length', strlen($result));
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +265,7 @@ class SingleController extends Controller
|
|||||||
|
|
||||||
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
|
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
|
||||||
}
|
}
|
||||||
|
/** @var array $files */
|
||||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||||
|
|
||||||
@ -315,6 +316,7 @@ class SingleController extends Controller
|
|||||||
|
|
||||||
$data = $request->getJournalData();
|
$data = $request->getJournalData();
|
||||||
$journal = $repository->update($journal, $data);
|
$journal = $repository->update($journal, $data);
|
||||||
|
/** @var array $files */
|
||||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ class SplitController extends Controller
|
|||||||
|
|
||||||
$data = $this->arrayFromInput($request);
|
$data = $this->arrayFromInput($request);
|
||||||
$journal = $repository->updateSplitJournal($journal, $data);
|
$journal = $repository->updateSplitJournal($journal, $data);
|
||||||
|
/** @var array $files */
|
||||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||||
// save attachments:
|
// save attachments:
|
||||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||||
|
@ -477,7 +477,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param float $amount
|
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return Account
|
* @return Account
|
||||||
|
@ -50,7 +50,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
* @param RuleGroup $moveTo
|
* @param RuleGroup|null $moveTo
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ interface RuleGroupRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
* @param RuleGroup $moveTo
|
* @param RuleGroup|null $moveTo
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -74,6 +74,8 @@ class AbstractTrigger
|
|||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RuleTrigger $trigger
|
* @param RuleTrigger $trigger
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
|
@ -90,11 +90,11 @@ class Amount
|
|||||||
$pos_c = $sign;
|
$pos_c = $sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default: (amount before currency)
|
// default is amount before currency
|
||||||
$format = $pos_a . $pos_d . '%v' . $space . $pos_b . '%s' . $pos_c . $pos_e;
|
$format = $pos_a . $pos_d . '%v' . $space . $pos_b . '%s' . $pos_c . $pos_e;
|
||||||
|
|
||||||
if ($csPrecedes) {
|
if ($csPrecedes) {
|
||||||
// (currency before amount)
|
// alternative is currency before amount
|
||||||
$format = $pos_a . $pos_b . '%s' . $pos_c . $space . $pos_d . '%v' . $pos_e;
|
$format = $pos_a . $pos_b . '%s' . $pos_c . $space . $pos_d . '%v' . $pos_e;
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Final format: "%s"', $format));
|
Log::debug(sprintf('Final format: "%s"', $format));
|
||||||
|
@ -285,7 +285,6 @@ class ExpandedForm
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param null $value
|
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
Loading…
Reference in New Issue
Block a user