mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Remove safe methods.
This commit is contained in:
@@ -118,7 +118,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
public function saveAttachmentFromApi(Attachment $attachment, string $content): bool
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
$resource = \Safe\tmpfile();
|
||||
$resource = tmpfile();
|
||||
if (false === $resource) {
|
||||
Log::error('Cannot create temp-file for file upload.');
|
||||
|
||||
@@ -133,17 +133,17 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
|
||||
$path = stream_get_meta_data($resource)['uri'];
|
||||
Log::debug(sprintf('Path is %s', $path));
|
||||
$result = \Safe\fwrite($resource, $content);
|
||||
$result = fwrite($resource, $content);
|
||||
if (false === $result) {
|
||||
Log::error('Could not write temp file.');
|
||||
|
||||
return false;
|
||||
}
|
||||
Log::debug(sprintf('Wrote %d bytes to temp file.', $result));
|
||||
$finfo = \Safe\finfo_open(FILEINFO_MIME_TYPE);
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
if (false === $finfo) {
|
||||
Log::error('Could not open finfo.');
|
||||
\Safe\fclose($resource);
|
||||
fclose($resource);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
$allowedMime = config('firefly.allowedMimes');
|
||||
if (!in_array($mime, $allowedMime, true)) {
|
||||
Log::error(sprintf('Mime type %s is not allowed for API file upload.', $mime));
|
||||
\Safe\fclose($resource);
|
||||
fclose($resource);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
$this->uploadDisk->put($file, $content);
|
||||
|
||||
// update attachment.
|
||||
$attachment->md5 = (string) \Safe\md5_file($path);
|
||||
$attachment->md5 = (string) md5_file($path);
|
||||
$attachment->mime = $mime;
|
||||
$attachment->size = strlen($content);
|
||||
$attachment->uploaded = true;
|
||||
@@ -225,7 +225,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
$attachment = new Attachment(); // create Attachment object.
|
||||
$attachment->user()->associate($user);
|
||||
$attachment->attachable()->associate($model);
|
||||
$attachment->md5 = (string) \Safe\md5_file($file->getRealPath());
|
||||
$attachment->md5 = (string) md5_file($file->getRealPath());
|
||||
$attachment->filename = $file->getClientOriginalName();
|
||||
$attachment->mime = $file->getMimeType();
|
||||
$attachment->size = $file->getSize();
|
||||
@@ -333,7 +333,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
protected function hasFile(UploadedFile $file, Model $model): bool
|
||||
{
|
||||
$md5 = \Safe\md5_file($file->getRealPath());
|
||||
$md5 = md5_file($file->getRealPath());
|
||||
$name = $file->getClientOriginalName();
|
||||
$class = $model::class;
|
||||
$count = 0;
|
||||
|
@@ -167,7 +167,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'external_id');
|
||||
$this->query->where('journal_meta.data', '!=', sprintf('%s', \Safe\json_encode($externalId)));
|
||||
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($externalId)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
@@ -190,14 +190,14 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->where('journal_meta.data', '!=', \Safe\json_encode($url));
|
||||
$this->query->where('journal_meta.data', '!=', json_encode($url));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function excludeInternalReference(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -211,14 +211,14 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'recurrence_id');
|
||||
$this->query->where('journal_meta.data', '!=', sprintf('%s', \Safe\json_encode($recurringId)));
|
||||
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($recurringId)));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function externalIdContains(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -230,7 +230,7 @@ trait MetaCollection
|
||||
|
||||
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -242,7 +242,7 @@ trait MetaCollection
|
||||
|
||||
public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -254,7 +254,7 @@ trait MetaCollection
|
||||
|
||||
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -266,7 +266,7 @@ trait MetaCollection
|
||||
|
||||
public function externalIdEnds(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -278,7 +278,7 @@ trait MetaCollection
|
||||
|
||||
public function externalIdStarts(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
$externalId = (string) \Safe\json_encode($externalId);
|
||||
$externalId = (string) json_encode($externalId);
|
||||
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -291,7 +291,7 @@ trait MetaCollection
|
||||
public function externalUrlContains(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', trim($url, '"'));
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $url));
|
||||
@@ -302,7 +302,7 @@ trait MetaCollection
|
||||
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', trim($url, '"'));
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s%%', $url));
|
||||
@@ -313,7 +313,7 @@ trait MetaCollection
|
||||
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s', $url));
|
||||
@@ -324,7 +324,7 @@ trait MetaCollection
|
||||
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
|
||||
// var_dump($url);
|
||||
|
||||
@@ -337,7 +337,7 @@ trait MetaCollection
|
||||
public function externalUrlEnds(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('%%%s', $url));
|
||||
@@ -348,7 +348,7 @@ trait MetaCollection
|
||||
public function externalUrlStarts(string $url): GroupCollectorInterface
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$url = (string) \Safe\json_encode($url);
|
||||
$url = (string) json_encode($url);
|
||||
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
|
||||
// var_dump($url);
|
||||
|
||||
@@ -399,7 +399,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceContains(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
// var_dump($internalReference);
|
||||
// exit;
|
||||
@@ -414,7 +414,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -427,7 +427,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -440,7 +440,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -453,7 +453,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceEnds(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -466,7 +466,7 @@ trait MetaCollection
|
||||
|
||||
public function internalReferenceStarts(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
@@ -704,7 +704,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'external_id');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($externalId)));
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($externalId)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
@@ -714,7 +714,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->where('journal_meta.data', '=', \Safe\json_encode($url));
|
||||
$this->query->where('journal_meta.data', '=', json_encode($url));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
@@ -722,12 +722,12 @@ trait MetaCollection
|
||||
|
||||
public function setInternalReference(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
$internalReference = (string) \Safe\json_encode($internalReference);
|
||||
$internalReference = (string) json_encode($internalReference);
|
||||
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
|
||||
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($internalReference)));
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($internalReference)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
@@ -737,7 +737,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'recurrence_id');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($recurringId)));
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($recurringId)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
@@ -747,7 +747,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
$this->query->where('journal_meta.name', '=', 'sepa_ct_id');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($sepaCT)));
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($sepaCT)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
|
@@ -593,7 +593,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) {
|
||||
$name = $result['meta_name'];
|
||||
if (array_key_exists('meta_data', $result) && '' !== (string) $result['meta_data']) {
|
||||
$result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string) \Safe\json_decode($result['meta_data']), 0, 10));
|
||||
$result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string) json_decode($result['meta_data']), 0, 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
|
||||
$json = '';
|
||||
|
||||
try {
|
||||
$json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR);
|
||||
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
|
||||
} catch (\JsonException $e) {
|
||||
app('log')->error('Could not generate hash.');
|
||||
app('log')->error(sprintf('JSON value: %s', $json));
|
||||
|
Reference in New Issue
Block a user