Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code cleanup [skip ci]
James Colee44de572f524
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.phpindex 74fbe299ca..7ca74d1cf3 100644--- a/app/controllers/AccountController.php+++ b/app/controllers/AccountController.php@@ -70,7 +70,7 @@ class AccountController extends BaseControllerpublic function create($what){$subTitleIcon = $this->_subIconsByIdentifier[$what];- $subTitle = 'Create a new ' . $what . ' account';+ $subTitle = 'Create a new ' . e($what) . ' account';return View::make('accounts.create', compact('subTitleIcon', 'what', 'subTitle'));}@@ -82,7 +82,7 @@ class AccountController extends BaseController*/public function delete(Account $account){- $subTitle = 'Delete ' . strtolower($account->accountType->type) . ' "' . $account->name . '"';+ $subTitle = 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';return View::make('accounts.delete', compact('account', 'subTitle'));}@@ -101,7 +101,7 @@ class AccountController extends BaseController$this->_repository->destroy($account);- Session::flash('success', 'The ' . $typeName . ' account "' . e($name) . '" was deleted.');+ Session::flash('success', 'The ' . e($typeName) . ' account "' . e($name) . '" was deleted.');return Redirect::route('accounts.index', $typeName);}@@ -116,7 +116,7 @@ class AccountController extends BaseController$openingBalance = $this->_repository->openingBalanceTransaction($account);$subTitleIcon = $this->_subIconsByIdentifier[$account->accountType->type];- $subTitle = 'Edit ' . strtolower($account->accountType->type) . ' "' . $account->name . '"';+ $subTitle = 'Edit ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';// pre fill some useful values.$preFilled = [@@ -157,7 +157,7 @@ class AccountController extends BaseController$subTitleIcon = $this->_subIconsByIdentifier[$account->accountType->type];$what = $this->_shortNamesByFullName[$account->accountType->type];$journals = $this->_repository->getTransactionJournals($account, 50, $range);- $subTitle = 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"';+ $subTitle = 'Details for ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';return View::make('accounts.show', compact('account', 'what', 'range', 'subTitleIcon', 'journals', 'subTitle'));}@@ -184,17 +184,17 @@ class AccountController extends BaseController// return to create screen:if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {- return Redirect::route('accounts.create', $data['what'])->withInput();+ return Redirect::route('accounts.create', e($data['what']))->withInput();}// store:$this->_repository->store($data);Session::flash('success', 'Account "' . e($data['name']) . '" stored.');if ($data['post_submit_action'] == 'store') {- return Redirect::route('accounts.index', $data['what']);+ return Redirect::route('accounts.index', e($data['what']));}- return Redirect::route('accounts.create', $data['what'])->withInput();+ return Redirect::route('accounts.create', e($data['what']))->withInput();}/**@@ -231,7 +231,7 @@ class AccountController extends BaseController// go back to listif ($data['post_submit_action'] == 'update') {- return Redirect::route('accounts.index', $data['what']);+ return Redirect::route('accounts.index', e($data['what']));}// go back to update screen.diff --git a/app/controllers/BillController.php b/app/controllers/BillController.phpindex de7e0f3545..2b10e6d242 100644--- a/app/controllers/BillController.php+++ b/app/controllers/BillController.php@@ -45,7 +45,7 @@ class BillController extends BaseControllerpublic function delete(Bill $bill){return View::make('bills.delete')->with('bill', $bill)->with(- 'subTitle', 'Delete "' . $bill->name . '"'+ 'subTitle', 'Delete "' . e($bill->name) . '"');}@@ -73,7 +73,7 @@ class BillController extends BaseController$periods = \Config::get('firefly.periods_to_text');return View::make('bills.edit')->with('periods', $periods)->with('bill', $bill)->with(- 'subTitle', 'Edit "' . $bill->name . '"'+ 'subTitle', 'Edit "' . e($bill->name) . '"');}@@ -119,7 +119,7 @@ class BillController extends BaseControllerreturn View::make('bills.show', compact('journals', 'hideBill', 'bill'))->with(- 'subTitle', $bill->name+ 'subTitle', e($bill->name));}diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.phpindex b6d6da5df8..a067224a36 100644--- a/app/controllers/CategoryController.php+++ b/app/controllers/CategoryController.php@@ -41,7 +41,7 @@ class CategoryController extends BaseController*/public function delete(Category $category){- return View::make('categories.delete')->with('category', $category)->with('subTitle', 'Delete category "' . $category->name . '"');+ return View::make('categories.delete')->with('category', $category)->with('subTitle', 'Delete category "' . e($category->name) . '"');}/**@@ -65,7 +65,7 @@ class CategoryController extends BaseController*/public function edit(Category $category){- return View::make('categories.edit')->with('category', $category)->with('subTitle', 'Edit category "' . $category->name . '"');+ return View::make('categories.edit')->with('category', $category)->with('subTitle', 'Edit category "' . e($category->name) . '"');}/**diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.phpindex dc0648ba89..a7f00e3900 100644--- a/app/controllers/TransactionController.php+++ b/app/controllers/TransactionController.php@@ -98,7 +98,7 @@ class TransactionController extends BaseController$piggies[0] = '(no piggy bank)';$preFilled = Session::has('preFilled') ? Session::get('preFilled') : [];$respondTo = ['account_id', 'account_from_id'];- $subTitle = 'Add a new ' . $what;+ $subTitle = 'Add a new ' . e($what);foreach ($respondTo as $r) {if (!is_null(Input::get($r))) {@@ -123,7 +123,7 @@ class TransactionController extends BaseControllerpublic function delete(TransactionJournal $journal){$type = strtolower($journal->transactionType->type);- $subTitle = 'Delete ' . $type . ' "' . $journal->description . '"';+ $subTitle = 'Delete ' . e($type) . ' "' . e($journal->description) . '"';return View::make('transactions.delete', compact('journal', 'subTitle'));@@ -197,7 +197,7 @@ class TransactionController extends BaseControllerpublic function edit(TransactionJournal $journal){$what = strtolower($journal->transactiontype->type);- $subTitle = 'Edit ' . $what . ' "' . $journal->description . '"';+ $subTitle = 'Edit ' . e($what) . ' "' . e($journal->description) . '"';$budgets = FFForm::makeSelectList($this->_helper->getBudgets(), true);$accounts = FFForm::makeSelectList($this->_helper->getAssetAccounts());$piggies = FFForm::makeSelectList($this->_helper->getPiggyBanks(), true);@@ -346,7 +346,7 @@ class TransactionController extends BaseController}return View::make('transactions.show', compact('journal', 'members'))->with(- 'subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'+ 'subTitle', e($journal->transactionType->type) . ' "' . e($journal->description) . '"');}diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.phpindex f0a2e058e3..2db40a05e6 100644--- a/app/lib/FireflyIII/Database/Account/Account.php+++ b/app/lib/FireflyIII/Database/Account/Account.php@@ -208,8 +208,8 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterfacereturn true;} else {- var_dump($validation['errors']);- exit;+ \Log::error($validation['errors']->all());+ \App::abort(500);}}@@ -314,8 +314,8 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface$data = array_except($data, ['_token', 'what']);$account = new \Account($data);if (!$account->isValid()) {- var_dump($account->getErrors()->all());- exit;+ \Log::error($account->getErrors()->all());+ \App::abort(500);}$account->save();if (isset($data['openingbalance']) && floatval($data['openingbalance']) != 0) {diff --git a/app/lib/FireflyIII/Event/Piggybank.php b/app/lib/FireflyIII/Event/Piggybank.phpindex 52ca7e727b..f204a7ea8c 100644--- a/app/lib/FireflyIII/Event/Piggybank.php+++ b/app/lib/FireflyIII/Event/Piggybank.php@@ -285,8 +285,8 @@ class PiggyBank$event->amount = $diff;$event->date = new Carbon;if (!$event->isValid()) {- var_dump($event->getErrors());- exit();+ \Log::error($event->getErrors());+ \App::abort(500);}$event->save();}