Compare commits

..

10 Commits

Author SHA1 Message Date
github-actions
89ce2838d5 Auto commit for release 'develop' on 2024-02-22 2024-02-22 01:29:01 +01:00
James Cole
356b217692 Add missing array 2024-02-20 20:33:33 +01:00
James Cole
950e39b753 Clean up methods. 2024-02-20 20:05:43 +01:00
James Cole
8f14979717 Clean up rule set. 2024-02-20 19:59:55 +01:00
James Cole
aa2afd162e Fix https://github.com/orgs/firefly-iii/discussions/8557 2024-02-20 19:51:13 +01:00
James Cole
fe33352ec1 Fix translation for https://github.com/firefly-iii/firefly-iii/issues/8555 2024-02-19 05:57:06 +01:00
github-actions
65c5249815 Auto commit for release 'develop' on 2024-02-19 2024-02-19 01:30:23 +01:00
James Cole
b1afaea1aa Various updates. 2024-02-18 11:35:08 +01:00
James Cole
997dc3814b Add host header validation 2024-02-17 08:18:49 +01:00
James Cole
b37b5b86d4 Fix https://github.com/firefly-iii/firefly-iii/issues/8544 2024-02-16 20:42:04 +01:00
158 changed files with 794 additions and 714 deletions

View File

@@ -35,36 +35,39 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
return $config->setRules([
'no_unused_imports' => true,
'@PhpCsFixer' => true,
'@PHP83Migration' => true,
'@PhpCsFixer:risky' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'strict_param' => true,
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'array_syntax' => ['syntax' => 'short'],
'native_function_invocation' => false, // annoying
'php_unit_data_provider_name' => false, // bloody annoying long test names
'static_lambda' => false, // breaks the Response macro for API's.
'phpdoc_summary' => false, // annoying.
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'protected',
],
],
'statement_indentation' => true,
'type_declaration_spaces' => false,
'cast_spaces' => false,
'binary_operator_spaces' => [
'default' => 'at_least_single_space',
'operators' => [
'=>' => 'align_single_space_by_scope',
'=' => 'align_single_space_minimal_by_scope',
'??=' => 'align_single_space_minimal_by_scope',
],
],
'void_return' => true,
])
return $config->setRules(
[
// rule sets
'@PHP83Migration' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'strict_param' => true,
'no_unused_imports' => true,
'single_space_around_construct' => true,
'statement_indentation' => true,
'void_return' => true,
// disabled rules
'native_function_invocation' => false, // annoying
'php_unit_data_provider_name' => false, // bloody annoying long test names
'static_lambda' => false, // breaks the Response macro for API's.
'phpdoc_summary' => false, // annoying.
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'type_declaration_spaces' => false,
'cast_spaces' => false,
// complex rules
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'at_least_single_space',
'operators' => [
'=>' => 'align_single_space_by_scope',
'=' => 'align_single_space_minimal_by_scope',
'??=' => 'align_single_space_minimal_by_scope',
],
],
])
->setFinder($finder);

View File

@@ -1,6 +1,6 @@
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
# Never set it to "testing".
APP_ENV=local
APP_ENV=production
# Set to true if you want to see debug information in error screens.
APP_DEBUG=false
@@ -332,15 +332,7 @@ DEMO_PASSWORD=
FIREFLY_III_LAYOUT=v1
#
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.
# It won't work. It doesn't do ANYTHING. Don't believe the lies you read online. I'm not joking.
# This configuration value WILL NOT HELP.
#
# Notable exception to this rule is Synology, which, according to some users, will use APP_URL to rewrite stuff.
#
# This variable is ONLY used in some of the emails Firefly III sends around. Nowhere else.
# So when configuring anything WEB related this variable doesn't do anything. Nothing
#
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
# Please make sure this URL matches the external URL of your Firefly III installation.
# It is used to validate specific requests and to generate URLs in emails.
#
APP_URL=http://localhost

View File

@@ -68,7 +68,7 @@ class DestroyController extends Controller
$allExceptAssets = [AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::RECONCILIATION, AccountType::REVENUE];
$all = [AccountType::ASSET, AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEBT, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::RECONCILIATION];
$liabilities = [AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD];
$transactions = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION, TransactionType::OPENING_BALANCE];
$transactions = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION];
match ($objects) {
'budgets' => $this->destroyBudgets(),

View File

@@ -66,7 +66,7 @@ class DestroyController extends Controller
*/
public function destroy(Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -75,7 +75,7 @@ class ShowController extends Controller
*/
public function download(Attachment $attachment): LaravelResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -123,7 +123,7 @@ class ShowController extends Controller
*/
public function index(): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -161,7 +161,7 @@ class ShowController extends Controller
*/
public function show(Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -74,7 +74,7 @@ class StoreController extends Controller
*/
public function store(StoreRequest $request): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -98,7 +98,7 @@ class StoreController extends Controller
*/
public function upload(Request $request, Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -69,7 +69,7 @@ class UpdateController extends Controller
*/
public function update(UpdateRequest $request, Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -70,7 +70,7 @@ class AttemptController extends Controller
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -114,7 +114,7 @@ class AttemptController extends Controller
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class DestroyController extends Controller
*/
public function destroy(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -120,7 +120,7 @@ class DestroyController extends Controller
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -66,7 +66,7 @@ class MessageController extends Controller
*/
public function index(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -106,7 +106,7 @@ class MessageController extends Controller
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -71,7 +71,7 @@ class ShowController extends Controller
*/
public function index(): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -106,7 +106,7 @@ class ShowController extends Controller
*/
public function show(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -131,7 +131,7 @@ class ShowController extends Controller
*/
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -60,7 +60,7 @@ class StoreController extends Controller
public function store(CreateRequest $request): JsonResponse
{
$data = $request->getData();
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data);
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -57,7 +57,7 @@ class SubmitController extends Controller
*/
public function submit(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -60,7 +60,7 @@ class UpdateController extends Controller
public function update(Webhook $webhook, UpdateRequest $request): JsonResponse
{
$data = $request->getData();
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data);
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -73,7 +73,7 @@ class MoveTransactionsRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -73,7 +73,7 @@ class TransactionRequest extends FormRequest
$this->validateTransactionQuery($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -46,7 +46,7 @@ class DateRequest extends FormRequest
{
$start = $this->getCarbonDate('start');
$end = $this->getCarbonDate('end');
if($start->diffInYears($end) > 5) {
if ($start->diffInYears($end) > 5) {
throw new FireflyException('Date range out of range.');
}

View File

@@ -88,7 +88,7 @@ class Request extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -104,7 +104,7 @@ class StoreRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -109,7 +109,7 @@ class UpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -92,7 +92,7 @@ class StoreRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -104,7 +104,7 @@ class UpdateRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -88,7 +88,7 @@ class UpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -132,7 +132,7 @@ class StoreRequest extends FormRequest
$this->validateAccountInformation($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -142,7 +142,7 @@ class UpdateRequest extends FormRequest
$this->valUpdateAccountInfo($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -109,7 +109,7 @@ class StoreRequest extends FormRequest
$this->atLeastOneActiveAction($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -119,7 +119,7 @@ class UpdateRequest extends FormRequest
$this->atLeastOneValidAction($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -71,7 +71,7 @@ class TriggerRequest extends FormRequest
private function getAccounts(): array
{
if(null === $this->get('accounts')) {
if (null === $this->get('accounts')) {
return [];
}

View File

@@ -192,7 +192,7 @@ class StoreRequest extends FormRequest
$this->validateGroupDescription($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -206,7 +206,7 @@ class UpdateRequest extends FormRequest
$this->validateAccountInformationUpdate($validator, $transactionGroup);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class StoreRequest extends FormRequest
$this->validateExistingLink($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class UpdateRequest extends FormRequest
$this->validateUpdate($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -98,7 +98,7 @@ class UserUpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -38,10 +38,6 @@ class TransactionController extends Controller
public function listByCount(ListByCountRequest $request): JsonResponse
{
// collect transactions:
$pageSize = $this->parameters->get('limit');
$page = $request->getPage();
$page = max($page, 1);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setUserGroup(auth()->user()->userGroup)

View File

@@ -80,7 +80,7 @@ class BalanceChartRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class DashboardChartRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -212,7 +212,7 @@ class StoreRequest extends FormRequest
$this->validateGroupDescription($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -207,7 +207,7 @@ class UpdateRequest extends Request
$this->validateAccountInformationUpdate($validator, $transactionGroup);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -72,6 +72,16 @@ class UpgradeFireflyInstructions extends Command
}
}
// validate some settings.
if ('' === $text && 'local' === (string)config('app.env')) {
$text = 'Please set APP_ENV=production for a safer environment.';
}
$prefix = 'v';
if (str_starts_with($version, 'develop')) {
$prefix = '';
}
$this->newLine();
$this->showLogo();
$this->newLine();
@@ -79,7 +89,7 @@ class UpgradeFireflyInstructions extends Command
$this->boxed('');
if ('' === $text) {
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
$this->boxed(sprintf('Thank you for updating to Firefly III, %s%s', $prefix, $version));
$this->boxedInfo('There are no extra upgrade instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -88,7 +98,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for updating to Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();
@@ -181,13 +191,24 @@ class UpgradeFireflyInstructions extends Command
$text = (string)$config[$compare];
}
}
// validate some settings.
if ('' === $text && 'local' === (string)config('app.env')) {
$text = 'Please set APP_ENV=production for a safer environment.';
}
$prefix = 'v';
if (str_starts_with($version, 'develop')) {
$prefix = '';
}
$this->newLine();
$this->showLogo();
$this->newLine();
$this->showLine();
$this->boxed('');
if ('' === $text) {
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo('There are no extra installation instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -196,7 +217,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();

View File

@@ -30,8 +30,8 @@ namespace FireflyIII\Enums;
*/
enum StringPosition
{
case STARTS;
case ENDS;
case CONTAINS;
case IS;
case STARTS;
case ENDS;
case CONTAINS;
case IS;
}

View File

@@ -60,7 +60,7 @@ class RuleHandler
try {
Notification::send($user, new RuleActionFailed($params));
} catch(ClientException $e) {
} catch (ClientException $e) {
Log::error(sprintf('[a] Error sending notification that the rule action failed: %s', $e->getMessage()));
}
}
@@ -89,7 +89,7 @@ class RuleHandler
try {
Notification::send($user, new RuleActionFailed($params));
} catch(ClientException $e) {
} catch (ClientException $e) {
Log::error(sprintf('[b] Error sending notification that the rule action failed: %s', $e->getMessage()));
}
}

View File

@@ -40,7 +40,7 @@ class BudgetObserver
$budgetLimits = $budget->budgetlimits()->get();
/** @var BudgetLimit $budgetLimit */
foreach($budgetLimits as $budgetLimit) {
foreach ($budgetLimits as $budgetLimit) {
// this loop exists so several events are fired.
$budgetLimit->delete();
}

View File

@@ -492,7 +492,7 @@ class GroupCollector implements GroupCollectorInterface
if (0 === $this->limit) {
$this->setLimit(50);
}
if(null !== $this->startRow && null !== $this->endRow) {
if (null !== $this->startRow && null !== $this->endRow) {
$total = $this->endRow - $this->startRow;
return new LengthAwarePaginator($set, $this->total, $total, 1);

View File

@@ -68,6 +68,9 @@ class ForgotPasswordController extends Controller
return view('error', compact('message'));
}
// validate host header.
$this->validateHost();
$this->validateEmail($request);
// verify if the user is not a demo user. If so, we give him back an error.
@@ -118,4 +121,19 @@ class ForgotPasswordController extends Controller
return view('auth.passwords.email')->with(compact('allowRegistration', 'pageTitle'));
}
/**
* @throws FireflyException
*/
private function validateHost(): void
{
$configuredHost = parse_url((string)config('app.url'), PHP_URL_HOST);
if (false === $configuredHost || null === $configuredHost) {
throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.');
}
$host = request()->host();
if ($configuredHost !== $host) {
throw new FireflyException('The Host-header does not match the host in the APP_URL environment variable. Please make sure these match. See also: https://bit.ly/FF3-host-header');
}
}
}

View File

@@ -80,6 +80,7 @@ class ResetPasswordController extends Controller
return view('error', compact('message'));
}
$rules = [
'token' => 'required',
'email' => 'required|email',
@@ -90,7 +91,7 @@ class ResetPasswordController extends Controller
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
// database. Otherwise, we will parse the error and return the response.
$response = $this->broker()->reset(
$this->credentials($request),
function ($user, $password): void {

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\AccountType;
@@ -178,7 +177,9 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION,
'php_os' => PHP_OS,
'uname' => php_uname('m'),
'interface' => \PHP_SAPI,
'bits' => \PHP_INT_SIZE * 8,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),

View File

@@ -66,7 +66,7 @@ class IndexController extends Controller
*/
public function export(): LaravelResponse|RedirectResponse
{
if(auth()->user()->hasRole('demo')) {
if (auth()->user()->hasRole('demo')) {
session()->flash('info', (string) trans('firefly.demo_user_export'));
return redirect(route('export.index'));

View File

@@ -78,7 +78,7 @@ class RecurrenceController extends Controller
$weekend = (int) $request->get('weekend');
$repetitionMoment = '';
$skip = (int) $request->get('skip');
$skip = $skip < 1 || $skip > 31 ? 1 : $skip;
$skip = $skip < 0 || $skip > 31 ? 0 : $skip;
$weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
if (false === $start || false === $end || false === $firstDate || false === $endDate) {

View File

@@ -387,7 +387,7 @@ class TagController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$tagId = $tag['id'];
if(!array_key_exists($tagId, $report)) {
if (!array_key_exists($tagId, $report)) {
continue;
}
foreach ($tag['transaction_journals'] as $journal) {
@@ -425,7 +425,7 @@ class TagController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$tagId = $tag['id'];
if(!array_key_exists($tagId, $report)) {
if (!array_key_exists($tagId, $report)) {
continue;
}
foreach ($tag['transaction_journals'] as $journal) {

View File

@@ -140,7 +140,7 @@ class SelectController extends Controller
$trigger = new RuleTrigger();
$trigger->trigger_type = $textTrigger['type'];
$trigger->trigger_value = $textTrigger['value'];
if(false === $needsContext) {
if (false === $needsContext) {
$trigger->trigger_value = 'true';
}
$trigger->stop_processing = $textTrigger['stop_processing'];

View File

@@ -59,7 +59,7 @@ class CreateController extends Controller
*/
public function index()
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class DeleteController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class EditController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
*/
public function index()
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class ShowController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -0,0 +1,41 @@
<?php
/*
* TrustHosts.php
* Copyright (c) 2024 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, null|string>
*/
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@@ -136,7 +136,7 @@ class AccountFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -62,7 +62,7 @@ class AttachmentFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -82,7 +82,7 @@ class BillStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -86,7 +86,7 @@ class BillUpdateRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -83,7 +83,7 @@ class BudgetFormStoreRequest extends FormRequest
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -92,7 +92,7 @@ class BudgetFormUpdateRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -51,7 +51,7 @@ class BudgetIncomeRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -51,7 +51,7 @@ class BulkEditJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -72,7 +72,7 @@ class CategoryFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -60,7 +60,7 @@ class ConfigurationRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -84,7 +84,7 @@ class CurrencyFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class DeleteAccountFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class EmailFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class InviteUserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -79,7 +79,7 @@ class JournalLinkRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -64,7 +64,7 @@ class LinkTypeFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class MassDeleteJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -54,7 +54,7 @@ class MassEditJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -57,7 +57,7 @@ class NewUserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -68,7 +68,7 @@ class ObjectGroupFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -73,7 +73,7 @@ class PiggyBankStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -77,7 +77,7 @@ class PiggyBankUpdateRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class ProfileFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -80,7 +80,7 @@ class ReconciliationStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -247,7 +247,7 @@ class RecurrenceFormRequest extends FormRequest
$this->validateAccountInformation($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -250,7 +250,7 @@ class ReportFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -123,7 +123,7 @@ class RuleFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -79,7 +79,7 @@ class RuleGroupFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -57,7 +57,7 @@ class SelectTransactionsRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -82,7 +82,7 @@ class TagFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -54,7 +54,7 @@ class TestRuleFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class TokenFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -60,7 +60,7 @@ class TriggerRecurrenceRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -68,7 +68,7 @@ class UserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -58,7 +58,7 @@ class UserRegistrationRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -142,7 +142,7 @@ class RuleRepository implements RuleRepositoryInterface
continue;
}
$triggerType = $trigger->trigger_type;
if(str_starts_with($trigger->trigger_type, '-')) {
if (str_starts_with($trigger->trigger_type, '-')) {
$triggerType = substr($trigger->trigger_type, 1);
}
$needsContext = config(sprintf('search.operators.%s.needs_context', $triggerType)) ?? true;
@@ -484,7 +484,7 @@ class RuleRepository implements RuleRepositoryInterface
'no_external_id',
'any_external_id',
];
if(in_array($type, $needTrue, true)) {
if (in_array($type, $needTrue, true)) {
$value = '';
}

View File

@@ -80,7 +80,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$tagId = (int)$tag['id'];
$tagName = (string)$tag['name'];
$journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
if (!in_array($tagId, $tagIds, true)) {
continue;
}
@@ -164,7 +164,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$tagName = (string)$tag['name'];
$journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
if (!in_array($tagId, $tagIds, true)) {
continue;
}

View File

@@ -20,7 +20,7 @@ class IsValidAmount implements ValidationRule
$value = (string)$value;
// must not be empty:
if($this->emptyString($value)) {
if ($this->emptyString($value)) {
$fail('validation.filled')->translate();
$message = sprintf('IsValidAmount: "%s" cannot be empty.', $value);
Log::debug($message);
@@ -30,7 +30,7 @@ class IsValidAmount implements ValidationRule
}
// must be a number:
if(!$this->isValidNumber($value)) {
if (!$this->isValidNumber($value)) {
$fail('validation.numeric')->translate();
$message = sprintf('IsValidAmount: "%s" is not a number.', $value);
Log::debug($message);
@@ -40,7 +40,7 @@ class IsValidAmount implements ValidationRule
}
// must not be scientific notation:
if($this->scientificNumber($value)) {
if ($this->scientificNumber($value)) {
$fail('validation.scientific_notation')->translate();
$message = sprintf('IsValidAmount: "%s" cannot be in the scientific notation.', $value);
Log::debug($message);
@@ -50,7 +50,7 @@ class IsValidAmount implements ValidationRule
}
// must be more than minus a lots:
if($this->lessThanLots($value)) {
if ($this->lessThanLots($value)) {
$amount = bcmul('-1', self::BIG_AMOUNT);
$fail('validation.gte.numeric')->translate(['value' => $amount]);
$message = sprintf('IsValidAmount: "%s" must be more than %s.', $value, $amount);
@@ -61,7 +61,7 @@ class IsValidAmount implements ValidationRule
}
// must be less than a large number
if($this->moreThanLots($value)) {
if ($this->moreThanLots($value)) {
$fail('validation.lte.numeric')->translate(['value' => self::BIG_AMOUNT]);
$message = sprintf('IsValidAmount: "%s" must be more than %s.', $value, self::BIG_AMOUNT);
Log::debug($message);

View File

@@ -19,7 +19,7 @@ class IsValidPositiveAmount implements ValidationRule
{
$value = (string)$value;
// must not be empty:
if($this->emptyString($value)) {
if ($this->emptyString($value)) {
$fail('validation.filled')->translate();
$message = sprintf('IsValidPositiveAmount: "%s" cannot be empty.', $value);
Log::debug($message);
@@ -29,7 +29,7 @@ class IsValidPositiveAmount implements ValidationRule
}
// must be a number:
if(!$this->isValidNumber($value)) {
if (!$this->isValidNumber($value)) {
$fail('validation.numeric')->translate();
$message = sprintf('IsValidPositiveAmount: "%s" is not a number.', $value);
Log::debug($message);
@@ -38,7 +38,7 @@ class IsValidPositiveAmount implements ValidationRule
return;
}
// must not be scientific notation:
if($this->scientificNumber($value)) {
if ($this->scientificNumber($value)) {
$fail('validation.scientific_notation')->translate();
$message = sprintf('IsValidPositiveAmount: "%s" cannot be in the scientific notation.', $value);
Log::debug($message);
@@ -47,7 +47,7 @@ class IsValidPositiveAmount implements ValidationRule
return;
}
// must be more than zero:
if($this->lessOrEqualToZero($value)) {
if ($this->lessOrEqualToZero($value)) {
$fail('validation.more_than_zero')->translate();
$message = sprintf('IsValidPositiveAmount: "%s" must be more than zero.', $value);
Log::debug($message);
@@ -56,7 +56,7 @@ class IsValidPositiveAmount implements ValidationRule
return;
}
// must be less than a large number
if($this->moreThanLots($value)) {
if ($this->moreThanLots($value)) {
$fail('validation.lte.numeric')->translate(['value' => self::BIG_AMOUNT]);
$message = sprintf('IsValidPositiveAmount: "%s" must be less than %s.', $value, self::BIG_AMOUNT);
Log::debug($message);

View File

@@ -19,7 +19,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
{
$value = (string)$value;
// must not be empty:
if($this->emptyString($value)) {
if ($this->emptyString($value)) {
$fail('validation.filled')->translate();
$message = sprintf('IsValidZeroOrMoreAmount: "%s" cannot be empty.', $value);
Log::debug($message);
@@ -29,7 +29,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
}
// must be a number:
if(!$this->isValidNumber($value)) {
if (!$this->isValidNumber($value)) {
$fail('validation.numeric')->translate();
$message = sprintf('IsValidZeroOrMoreAmount: "%s" is not a number.', $value);
Log::debug($message);
@@ -38,7 +38,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
return;
}
// must not be scientific notation:
if($this->scientificNumber($value)) {
if ($this->scientificNumber($value)) {
$fail('validation.scientific_notation')->translate();
$message = sprintf('IsValidZeroOrMoreAmount: "%s" cannot be in the scientific notation.', $value);
Log::debug($message);
@@ -47,7 +47,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
return;
}
// must be zero or more
if(!$this->zeroOrMore($value)) {
if (!$this->zeroOrMore($value)) {
$fail('validation.more_than_zero_correct')->translate();
$message = sprintf('IsValidZeroOrMoreAmount: "%s" must be zero or more.', $value);
Log::debug($message);
@@ -56,7 +56,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
return;
}
// must be less than a large number
if($this->moreThanLots($value)) {
if ($this->moreThanLots($value)) {
$fail('validation.lte.numeric')->translate(['value' => self::BIG_AMOUNT]);
$message = sprintf('IsValidPositiveAmount: "%s" must be less than %s.', $value, self::BIG_AMOUNT);
Log::debug($message);

View File

@@ -136,7 +136,7 @@ class UpdateRequest implements UpdateRequestInterface
{
app('log')->debug('Now in parseResult()', $information);
$return = [];
$current = config('firefly.version');
$current = (string)config('firefly.version');
$latest = $information['version'];
// strip the 'v' from the version if it's there.
@@ -144,24 +144,7 @@ class UpdateRequest implements UpdateRequestInterface
$latest = substr($latest, 1);
}
if (str_starts_with($current, 'develop')) {
Log::debug(sprintf('User is running develop version "%s"', $current));
$parts = explode('/', $current);
/** @var Carbon $devDate */
$devDate = Carbon::createFromFormat('Y-m-d', $parts[1]);
if ($devDate->lte($information['date'])) {
Log::debug(sprintf('This development release is older, release = %s, latest version %s = %s', $devDate->format('Y-m-d'), $latest, $information['date']->format('Y-m-d')));
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_current_dev_older', ['version' => $current, 'new_version' => $latest]);
return $return;
}
Log::debug(sprintf('This development release is newer, release = %s, latest version %s = %s', $devDate->format('Y-m-d'), $latest, $information['date']->format('Y-m-d')));
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_current_dev_newer', ['version' => $current, 'new_version' => $latest]);
return $return;
return $this->parseDevelopResult($current, $latest, $information);
}
$compare = version_compare($latest, $current);
@@ -239,4 +222,27 @@ class UpdateRequest implements UpdateRequestInterface
return $return;
}
private function parseDevelopResult(string $current, string $latest, array $information): array
{
Log::debug(sprintf('User is running develop version "%s"', $current));
$parts = explode('/', $current);
$return = [];
/** @var Carbon $devDate */
$devDate = Carbon::createFromFormat('Y-m-d', $parts[1]);
if ($devDate->lte($information['date'])) {
Log::debug(sprintf('This development release is older, release = %s, latest version %s = %s', $devDate->format('Y-m-d'), $latest, $information['date']->format('Y-m-d')));
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_current_dev_older', ['version' => $current, 'new_version' => $latest]);
return $return;
}
Log::debug(sprintf('This development release is newer, release = %s, latest version %s = %s', $devDate->format('Y-m-d'), $latest, $information['date']->format('Y-m-d')));
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_current_dev_newer', ['version' => $current, 'new_version' => $latest]);
return $return;
}
}

View File

@@ -620,7 +620,7 @@ trait TransactionValidation
break;
case'transfer':
case 'transfer':
if (count($sources) > 1 || count($dests) > 1) {
$validator->errors()->add('transactions.0.source_id', (string) trans('validation.all_accounts_equal'));
$validator->errors()->add('transactions.0.destination_id', (string) trans('validation.all_accounts_equal'));

110
composer.lock generated
View File

@@ -793,16 +793,16 @@
},
{
"name": "doctrine/inflector",
"version": "2.0.9",
"version": "2.0.10",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65"
"reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65",
"reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc",
"reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc",
"shasum": ""
},
"require": {
@@ -864,7 +864,7 @@
],
"support": {
"issues": "https://github.com/doctrine/inflector/issues",
"source": "https://github.com/doctrine/inflector/tree/2.0.9"
"source": "https://github.com/doctrine/inflector/tree/2.0.10"
},
"funding": [
{
@@ -880,7 +880,7 @@
"type": "tidelift"
}
],
"time": "2024-01-15T18:05:13+00:00"
"time": "2024-02-18T20:23:39+00:00"
},
{
"name": "doctrine/lexer",
@@ -2932,16 +2932,16 @@
},
{
"name": "league/csv",
"version": "9.14.0",
"version": "9.15.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/csv.git",
"reference": "34bf0df7340b60824b9449b5c526fcc3325070d5"
"reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/34bf0df7340b60824b9449b5c526fcc3325070d5",
"reference": "34bf0df7340b60824b9449b5c526fcc3325070d5",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/fa7e2441c0bc9b2360f4314fd6c954f7ff40d435",
"reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435",
"shasum": ""
},
"require": {
@@ -2956,12 +2956,12 @@
"ext-xdebug": "*",
"friendsofphp/php-cs-fixer": "^v3.22.0",
"phpbench/phpbench": "^1.2.15",
"phpstan/phpstan": "^1.10.50",
"phpstan/phpstan": "^1.10.57",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"phpunit/phpunit": "^10.5.3",
"symfony/var-dumper": "^6.4.0"
"phpunit/phpunit": "^10.5.9",
"symfony/var-dumper": "^6.4.2"
},
"suggest": {
"ext-dom": "Required to use the XMLConverter and the HTMLConverter classes",
@@ -3017,7 +3017,7 @@
"type": "github"
}
],
"time": "2023-12-29T07:34:53+00:00"
"time": "2024-02-20T20:00:00+00:00"
},
{
"name": "league/event",
@@ -5803,16 +5803,16 @@
},
{
"name": "spatie/laravel-html",
"version": "3.4.0",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-html.git",
"reference": "20bd3185ae085b2eced952bc5191cb8eb922250e"
"reference": "ead179a8b6802647027486049f5209bd23b610a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-html/zipball/20bd3185ae085b2eced952bc5191cb8eb922250e",
"reference": "20bd3185ae085b2eced952bc5191cb8eb922250e",
"url": "https://api.github.com/repos/spatie/laravel-html/zipball/ead179a8b6802647027486049f5209bd23b610a9",
"reference": "ead179a8b6802647027486049f5209bd23b610a9",
"shasum": ""
},
"require": {
@@ -5869,7 +5869,7 @@
"spatie"
],
"support": {
"source": "https://github.com/spatie/laravel-html/tree/3.4.0"
"source": "https://github.com/spatie/laravel-html/tree/3.5.0"
},
"funding": [
{
@@ -5877,7 +5877,7 @@
"type": "custom"
}
],
"time": "2024-01-05T16:35:10+00:00"
"time": "2024-02-20T15:17:00+00:00"
},
{
"name": "spatie/laravel-ignition",
@@ -8990,16 +8990,16 @@
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.10.4",
"version": "v3.10.5",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d"
"reference": "d1a48965f2b25a6cec2eea07d719b568a37c9a88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d",
"reference": "09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/d1a48965f2b25a6cec2eea07d719b568a37c9a88",
"reference": "d1a48965f2b25a6cec2eea07d719b568a37c9a88",
"shasum": ""
},
"require": {
@@ -9058,7 +9058,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.10.4"
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.10.5"
},
"funding": [
{
@@ -9070,20 +9070,20 @@
"type": "github"
}
],
"time": "2024-02-14T08:52:12+00:00"
"time": "2024-02-15T10:45:45+00:00"
},
{
"name": "barryvdh/laravel-ide-helper",
"version": "v2.15.0",
"version": "v2.15.1",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
"reference": "dca3ebe81ea385632651791cb8b3db42153c380c"
"reference": "77831852bb7bc54f287246d32eb91274eaf87f8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/dca3ebe81ea385632651791cb8b3db42153c380c",
"reference": "dca3ebe81ea385632651791cb8b3db42153c380c",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/77831852bb7bc54f287246d32eb91274eaf87f8b",
"reference": "77831852bb7bc54f287246d32eb91274eaf87f8b",
"shasum": ""
},
"require": {
@@ -9152,7 +9152,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
"source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.15.0"
"source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.15.1"
},
"funding": [
{
@@ -9164,7 +9164,7 @@
"type": "github"
}
],
"time": "2024-02-14T11:19:26+00:00"
"time": "2024-02-15T14:23:20+00:00"
},
{
"name": "barryvdh/reflection-docblock",
@@ -9651,16 +9651,16 @@
},
{
"name": "maximebf/debugbar",
"version": "v1.20.1",
"version": "v1.20.2",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "06ebf922ccedfa4cc43015825697ee8c1fb80f7e"
"reference": "484625c23a4fa4f303617f29fcacd42951c9c01d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/06ebf922ccedfa4cc43015825697ee8c1fb80f7e",
"reference": "06ebf922ccedfa4cc43015825697ee8c1fb80f7e",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/484625c23a4fa4f303617f29fcacd42951c9c01d",
"reference": "484625c23a4fa4f303617f29fcacd42951c9c01d",
"shasum": ""
},
"require": {
@@ -9711,9 +9711,9 @@
],
"support": {
"issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/v1.20.1"
"source": "https://github.com/maximebf/php-debugbar/tree/v1.20.2"
},
"time": "2024-02-13T19:03:14+00:00"
"time": "2024-02-15T10:49:09+00:00"
},
{
"name": "mockery/mockery",
@@ -9859,16 +9859,16 @@
},
{
"name": "nikic/php-parser",
"version": "v5.0.0",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69",
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69",
"shasum": ""
},
"require": {
@@ -9911,9 +9911,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1"
},
"time": "2024-01-07T17:17:35+00:00"
"time": "2024-02-21T19:24:10+00:00"
},
{
"name": "phar-io/manifest",
@@ -10081,16 +10081,16 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.8.0",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc"
"reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc",
"reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353",
"reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353",
"shasum": ""
},
"require": {
@@ -10133,9 +10133,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.1"
},
"time": "2024-01-11T11:49:22+00:00"
"time": "2024-01-18T19:15:27+00:00"
},
{
"name": "phpmyadmin/sql-parser",
@@ -10318,16 +10318,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.58",
"version": "1.10.59",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "a23518379ec4defd9e47cbf81019526861623ec2"
"reference": "e607609388d3a6d418a50a49f7940e8086798281"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2",
"reference": "a23518379ec4defd9e47cbf81019526861623ec2",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281",
"reference": "e607609388d3a6d418a50a49f7940e8086798281",
"shasum": ""
},
"require": {
@@ -10376,7 +10376,7 @@
"type": "tidelift"
}
],
"time": "2024-02-12T20:02:57+00:00"
"time": "2024-02-20T13:59:13+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",

View File

@@ -114,7 +114,7 @@ use TwigBridge\ServiceProvider;
return [
'name' => envNonEmpty('APP_NAME', 'Firefly III'),
'env' => envNonEmpty('APP_ENV', 'local'),
'env' => envNonEmpty('APP_ENV', 'production'),
'debug' => env('APP_DEBUG', false),
'url' => envNonEmpty('APP_URL', 'http://localhost'),
'timezone' => envNonEmpty('TZ', 'UTC'),

Some files were not shown because too many files have changed in this diff Show More