Compare commits

..

106 commits

Author SHA1 Message Date
David Bomba
9d7145c61b
Merge pull request #6902 from dnltsk/master
Drop .DS_Store and ignore them
2021-10-26 07:55:11 +11:00
Daniel Teske
97713e130b ignore .DS_Store files 2021-10-25 22:05:22 +02:00
Daniel Teske
1ddffc01c9 .DS_Store file dropped 2021-10-25 22:04:36 +02:00
Hillel Coren
7e973ff91e Adjust PHP version 2021-10-24 10:59:26 +03:00
Hillel Coren
ebcbbbaa1f Update version 2021-10-24 09:14:52 +03:00
David Bomba
bf6e93f8d8
Merge pull request #6864 from HDVinnie/master
(Update) Auth Config
2021-10-20 06:23:21 +11:00
HDVinnie
1937169640
Merge pull request #1 from HDVinnie/Huntr
update: auth.php config
2021-10-18 21:19:08 -04:00
HDVinnie
49038a0c17
update: auth.php config
- add rate limiting to avoid abuse
2021-10-18 21:16:54 -04:00
David Bomba
3e86707f9f
Merge pull request #6862 from turbo124/master
Update composer to support PHP 7.4
2021-10-19 11:14:51 +11:00
David Bomba
b427a69735 Update composer 2021-10-19 11:14:16 +11:00
David Bomba
487d44ba67
Merge pull request #6861 from invoiceninja/laravel6
Upgrades for Laravel 6 and PHP 7.4
2021-10-19 09:49:04 +11:00
David Bomba
a4a55f5369
Merge branch 'master' into laravel6 2021-10-19 09:48:57 +11:00
David Bomba
35795e415b Update dependencies 2021-10-19 08:01:49 +11:00
Hillel Coren
64674fea24 Add auth check in report 2021-10-17 09:19:28 +03:00
Benjamin Beganović
2ecab1b6a6
Merge pull request #6825 from HDVinnie/patch-1
Create SECURITY.md
2021-10-13 02:18:09 +02:00
HDVinnie
c97a3b8c16
Update SECURITY.md 2021-10-12 16:57:10 -04:00
HDVinnie
3689a70e36
Create SECURITY.md 2021-10-12 04:17:01 -04:00
David Bomba
597cfc0662 Fixes for Stripe 2021-10-06 12:10:09 +11:00
David Bomba
fa5c787140 Update composer.lock 2021-10-06 10:56:29 +11:00
David Bomba
32a9df4e67 Update composer.lock 2021-10-06 10:53:49 +11:00
David Bomba
7106056115 Update composer.lock 2021-10-06 10:44:30 +11:00
David Bomba
0b1a8d7572 Fixes for L6 2021-10-06 09:51:29 +11:00
David Bomba
32002bcfc3 Minor fixes for tests 2021-09-29 21:01:34 +10:00
David Bomba
9a4b63adbb Minor fixes for PHP 7.4 2021-09-29 20:25:46 +10:00
David Bomba
136ae88f95
Merge pull request #6746 from turbo124/master
PHP 7.4 Support
2021-09-29 19:11:57 +10:00
David Bomba
7ae74ab8ed Rebuilt composer.lock 2021-09-29 19:11:38 +10:00
David Bomba
c51f27803f Remove Unirest dependency 2021-09-29 18:21:46 +10:00
David Bomba
ebd87245af Fixes for L6 + PHP 7.4 2021-09-28 21:18:10 +10:00
David Bomba
64269c5fc0 Update PHP7.4 2021-09-27 21:55:48 +10:00
David Bomba
a164e945a7
Merge pull request #6727 from joshuadwire/laravel6
Upgrade to Laravel 6
2021-09-27 12:16:39 +10:00
Joshua Dwire
e619d1d541 Bug fix for associating task with an invoice 2021-09-26 21:34:11 -04:00
Joshua Dwire
40c30cce2f Laravel 6 support 2021-09-25 20:13:01 -04:00
David Bomba
b5aee8a8bf PHP 7.4 Support 2021-09-24 14:28:41 +10:00
Hillel Coren
63b331dcc8 Update version 2021-09-15 12:07:45 +03:00
David Bomba
956f2fda33
Merge pull request #6645 from turbo124/master
Improve migration dataset v4->v5
2021-09-15 11:02:22 +10:00
Benjamin Beganović
7cedb82d1e
Update bug_report.md 2021-09-13 16:47:01 +02:00
Hillel Coren
8dbd44d37d Update version 2021-09-12 09:24:52 +03:00
David Bomba
4c6c71a85d Add recurring expenses into export data 2021-09-12 11:29:46 +10:00
=
37126963f6 Adjustment for min/max of fee limits 2021-09-11 21:09:14 +10:00
=
e751a1ddbf Fixes for auto bill status of recurring invoices 2021-09-11 21:05:35 +10:00
=
e3039763c6 Merge branch 'master' of https://github.com/turbo124/invoiceninja 2021-09-11 20:35:28 +10:00
=
d6049b026e Add recurring 2021-09-11 20:35:23 +10:00
David Bomba
d5c264f540
Merge pull request #6581 from turbo124/master
Minor fixes for migration
2021-09-05 19:49:08 +10:00
David Bomba
21cc007474 Adjust send_invoice to always true 2021-08-31 10:20:43 +10:00
David Bomba
a66b500fc6 Recurring Expenses migration 2021-08-29 22:40:09 +10:00
David Bomba
fd4cf13234 Minor fixes 2021-08-24 20:42:56 +10:00
Hillel Coren
26ae669659 Handle deleted account in recurrence 2021-08-22 07:41:06 +03:00
David Bomba
5c85088a23
Merge pull request #6487 from turbo124/master
minor fixes for migrations
2021-08-19 00:43:11 +10:00
Hillel Coren
955ab0c5db Redirect v4 signup to v5 2021-08-08 10:47:15 +03:00
David Bomba
dcfd178c20
Merge pull request #6417 from dinandmentink/master
Allow configuring mailgun endpoint by setting MAILGUN_ENDPOINT
2021-08-06 19:59:01 +10:00
Dinand Mentink
d50b754cb0
Allow configuring mailgun endpoint by setting MAILGUN_ENDPOINT
Similar to https://laravel.com/docs/8.x/mail#mailgun-driver but keeping default the same as current US endpoint.
2021-08-06 10:24:13 +02:00
David Bomba
9372a304c7 minor fixes for migrations 2021-08-04 09:38:22 +10:00
Hillel Coren
54b47d4ac0 Update version 2021-08-02 16:04:45 +03:00
Hillel Coren
d398ae2411 Udjust check data script 2021-08-01 00:59:18 +03:00
David Bomba
9dfa3bc9dd
Merge pull request #6333 from turbo124/master
fixes for docs
2021-07-25 20:12:09 +10:00
=
22e739ca26 fixes for docs 2021-07-25 20:11:41 +10:00
David Bomba
fd960fa543
Merge pull request #6332 from turbo124/master
Fixes for docs
2021-07-25 20:09:38 +10:00
=
1e0fa8d044 Fixes for docs 2021-07-25 20:09:05 +10:00
David Bomba
6037e92fd3
Merge pull request #6330 from turbo124/master
Minor fixes for migration
2021-07-25 15:53:54 +10:00
David Bomba
b9a0438632 Minor fixes for migration 2021-07-25 15:53:27 +10:00
David Bomba
74a56afe6d
Merge pull request #6329 from turbo124/master
Force migrations
2021-07-25 11:41:42 +10:00
David Bomba
1a4b9ddac6 Fixes for forced migration 2021-07-25 11:41:13 +10:00
David Bomba
ba45d0b272 Checks for contact id 2021-07-25 09:11:28 +10:00
David Bomba
3671bcced5 MInor fixes 2021-07-24 10:33:07 +10:00
David Bomba
5ad41db0ce Add is_migrated flag to companies table 2021-07-24 10:30:41 +10:00
David Bomba
dbc0ba02fc
Merge pull request #6321 from turbo124/master
Fixes for migrations
2021-07-24 08:33:12 +10:00
David Bomba
97271449ed Fixes for min max limits on migration 2021-07-24 08:32:46 +10:00
David Bomba
e58e6b3980 Forced Migratoin 2021-07-23 14:38:55 +10:00
David Bomba
e25c6b8ee2 Forced Migration 2021-07-23 09:37:08 +10:00
David Bomba
37c7ec4265 Update export migrations 2021-07-23 08:24:00 +10:00
David Bomba
b02bf18989
Merge pull request #6287 from turbo124/master
Fixes for hosted migration workflow.
2021-07-17 22:01:43 +10:00
David Bomba
1324394256 Fixes for financial year start 2021-07-17 20:42:27 +10:00
David Bomba
391df15a96 Refactor Migration codebase 2021-07-17 18:58:42 +10:00
=
50a0532bf4 Streamline Hosted Migration 2021-07-17 15:59:08 +10:00
=
0743b003ab Streamlined hosted migration 2021-07-17 15:26:47 +10:00
David Bomba
05b12a6bb9 Refactor for hosted migration 2021-07-16 15:40:52 +10:00
David Bomba
1da5352bed Merge branch 'master' of https://github.com/turbo124/invoiceninja 2021-07-16 08:45:12 +10:00
David Bomba
7a07c3da1c Fixes for migrations 2021-07-16 08:45:07 +10:00
David Bomba
7b5e0a4eb2 Update migration route 2021-07-13 20:11:00 +10:00
David Bomba
f441166133
Merge pull request #6209 from turbo124/master
Minor fixes for migration
2021-07-04 22:10:22 +10:00
David Bomba
c5cbfff67b Minor fixes for migration 2021-07-04 22:10:00 +10:00
David Bomba
e87dd65bc2
Update api.rst 2021-07-04 08:08:39 +10:00
David Bomba
d9ce3467ae
Merge pull request #6194 from turbo124/master
Minor fixes for resources
2021-07-03 08:57:37 +10:00
David Bomba
e15de6dee6 Minor fixes for use 2021-07-03 08:57:14 +10:00
David Bomba
511ba0ee36 Add image resources 2021-07-03 08:55:11 +10:00
David Bomba
f5e6f23712
Merge pull request #6155 from invoiceninja/dependabot/composer/league/flysystem-1.1.4
Bump league/flysystem from 1.1.3 to 1.1.4
2021-06-29 14:47:46 +10:00
dependabot[bot]
874c162db2
Bump league/flysystem from 1.1.3 to 1.1.4
Bumps [league/flysystem](https://github.com/thephpleague/flysystem) from 1.1.3 to 1.1.4.
- [Release notes](https://github.com/thephpleague/flysystem/releases)
- [Changelog](https://github.com/thephpleague/flysystem/blob/2.x/CHANGELOG.md)
- [Commits](https://github.com/thephpleague/flysystem/compare/1.1.3...1.1.4)

---
updated-dependencies:
- dependency-name: league/flysystem
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-29 03:26:32 +00:00
David Bomba
e56846131f Sync Accounts between v4 and v5 2021-06-28 15:15:02 +10:00
Hillel Coren
93f0385a45 Update version 2021-06-26 22:56:26 +03:00
David Bomba
c9acbc3688 Fixes for migration" 2021-06-26 13:05:00 +10:00
David Bomba
2ca59a68e2
Merge pull request #6111 from turbo124/master
Disable V4 after migrating to V5
2021-06-26 12:34:55 +10:00
Hillel Coren
a29082d85e Update version 2021-06-25 12:49:42 +03:00
David Bomba
03d4992875 Fixes for migrations 2021-06-23 22:53:46 +10:00
David Bomba
48cfe8cc6b Move new properties to account_email_settings 2021-06-23 14:46:13 +10:00
David Bomba
7dc4ecd209 Forward requests to V5 and disable V4 2021-06-23 12:43:29 +10:00
David Bomba
a99aa30669 Forward request to V5 2021-06-23 11:57:40 +10:00
Hillel Coren
2d02e4f569 Update open source references 2021-06-20 08:55:25 +03:00
Hillel Coren
8dde332c6d Show migration option 2021-06-20 08:53:34 +03:00
David Bomba
c7c95423cf
Update README.md 2021-06-15 23:47:05 +10:00
David Bomba
25a1ec88eb
Update README.md 2021-06-15 22:01:06 +10:00
David Bomba
533d7b8546
Merge pull request #6028 from turbo124/master
License change
2021-06-15 21:43:34 +10:00
David Bomba
b002dfd2af License change 2021-06-15 21:42:17 +10:00
David Bomba
4dfb6de450
Merge pull request #6016 from turbo124/master
Update license
2021-06-14 19:15:09 +10:00
David Bomba
686042c922 Update license 2021-06-14 19:14:21 +10:00
Hillel Coren
f0692c75b4 Update lang 2021-06-10 16:27:49 +03:00
Hillel Coren
661232acaa Update lang 2021-06-10 16:06:16 +03:00
161 changed files with 13822 additions and 5337 deletions

View file

@ -36,6 +36,6 @@ If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
Note: Before posting don't forget to check our "Troubleshooting" category in the [docs](https://invoiceninja.github.io/docs/self-host-troubleshooting/) (https://invoiceninja.github.io/docs/self-host-troubleshooting/).
<!-- Note: Before posting don't forget to check our "Troubleshooting" category in the [docs](https://invoiceninja.github.io/docs/self-host-troubleshooting/) (https://invoiceninja.github.io/docs/self-host-troubleshooting/) -->
**(v5) Can you replicate the issue on our demo site? https://demo.invoiceninja.com**

2
.gitignore vendored
View file

@ -17,7 +17,7 @@
/bootstrap/environment.php
/vendor
/node_modules
/.DS_Store
.DS_Store
Thumbs.db
/.env
/.env.development.php

88
LICENSE
View file

@ -1,47 +1,47 @@
Copyright (c) 2018 by Hillel Coren
Invoice Ninja * https://www.invoiceninja.com
"CREATE. SEND. GET PAID"
Elastic License 2.0 (ELv2)
Elastic License
All Rights Reserved
ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the conditions below are met.
These conditions require a modest attribution to InvoiceNinja.com (the
"Author"), who hopes that its promotional value may help justify the
thousands of dollars in otherwise billable time invested in writing
this and other freely available, open-source software.
Acceptance
By using the software, you agree to all of the terms and conditions below.
1. Redistributions of source code, in whole or part and with or without
modification (the "Code"), must prominently display this GPG-signed
text in verifiable form.
2. Redistributions of the Code in binary form must be accompanied by
this GPG-signed text in any documentation and, each time the resulting
executable program or a program dependent thereon is launched, a
prominent display (e.g., splash screen or banner text) of the Author's
attribution information, which includes:
(a) Name ("Hillel Coren"),
(b) Professional identification ("Invoice Ninja"), and
(c) URL ("https://www.invoiceninja.com").
3. Neither the name nor any trademark of the Author may be used to
endorse or promote products derived from this software without specific
prior written permission.
4. Users are entirely responsible, to the exclusion of the Author and
any other persons, for compliance with (1) regulations set by owners or
administrators of employed equipment, (2) licensing terms of any other
software, and (3) local regulations regarding use, including those
regarding import, export, and use of encryption software.
Copyright License
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS;
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Limitations
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensors trademarks is subject to applicable law.
Patents
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
Notices
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
No Other Rights
These terms do not imply any licenses other than those expressly granted in these terms.
Termination
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
No Liability
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
Definitions
The licensor is the entity offering these terms, and the software is the software the licensor makes available under these terms, including any portion of it.
you refers to the individual or entity agreeing to these terms.
your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
your licenses are all the licenses granted to you for the software under these terms.
use means anything you do with the software requiring one of your licenses.
trademark means trademarks, service marks, and similar rights.
For more information regarding the interpretation of this license please see here: https://invoiceninja.github.io/docs/legal/license/

View file

@ -15,7 +15,7 @@ Just make sure to add the `invoice-ninja` tag to your question.
#### Note: v5 is now tagged Stable! To upgrade from v4 you need to [install v5](https://invoiceninja.github.io/docs/self-host-installation/) as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management.
All Pro and Enterprise features from the hosted app are included in the open-source code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client facing parts of the app.
All Pro and Enterprise features from the hosted app are included in the open-code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client facing parts of the app.
The self-host zip includes all third party libraries whereas downloading the code from GitHub requires using Composer to install the dependencies.
@ -92,5 +92,5 @@ For information on how contribute to Invoice Ninja, please see our [contributing
* [Mike Skaggs](https://github.com/titan-fail)
## License
Invoice Ninja is released under the Attribution Assurance License.
Invoice Ninja is released under the Elastic License 2.0
See [LICENSE](LICENSE) for details.

3
SECURITY.md Normal file
View file

@ -0,0 +1,3 @@
## Reporting a Vulnerability
If you discover any security related issues, please email contact@invoiceninja.com instead of using the issue tracker.

View file

@ -97,7 +97,7 @@ class CheckData extends Command
$this->checkFailedJobs();
}
$this->checkTranslations();
//$this->checkTranslations();
$this->logMessage('Done: ' . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
$errorEmail = env('ERROR_EMAIL');

View file

@ -7,6 +7,7 @@ use App\Models\User;
use App\Traits\GenerateMigrationResources;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
class ExportMigrations extends Command
{
@ -17,7 +18,7 @@ class ExportMigrations extends Command
*
* @var string
*/
protected $signature = 'migrations:export {--user=} {--random=}';
protected $signature = 'migrations:export {--user=} {--email=} {--random=}';
/**
* The console command description.
@ -46,8 +47,36 @@ class ExportMigrations extends Command
$this->info('Note: Migrations will be stored inside of (storage/migrations) folder.');
if($this->option('user')) {
$record = User::findOrFail($this->option('user'));
return $this->export($record);
$record = User::on(DB_NINJA_1)->find($this->option('user'));
if($record)
return $this->export($record);
$record = User::on(DB_NINJA_2)->find($this->option('user'));
if($record)
return $this->export($record);
$this->info('I could not find that user - sorry');
return;
}
if($this->option('email')) {
$record = User::on(DB_NINJA_1)->where('email', $this->option('email'))->first();
if($record)
return $this->export($record);
$record = User::on(DB_NINJA_2)->where('email', $this->option('email'))->first();
if($record)
return $this->export($record);
$this->info('I could not find that user by email - sorry');
return;
}
if($this->option('random')){
@ -92,6 +121,7 @@ class ExportMigrations extends Command
'products' => $this->getProducts(),
'credits' => $this->getCreditsNotes(),
'invoices' => $this->getInvoices(),
'recurring_expenses' => $this->getRecurringExpenses(),
'recurring_invoices' => $this->getRecurringInvoices(),
'quotes' => $this->getQuotes(),
'payments' => array_merge($this->getPayments(), $this->getCredits()),
@ -101,8 +131,10 @@ class ExportMigrations extends Command
'expenses' => $this->getExpenses(),
'tasks' => $this->getTasks(),
'documents' => $this->getDocuments(),
'ninja_tokens' => $this->getNinjaToken(),
];
Storage::makeDirectory('migrations');
$file = storage_path("migrations/{$fileName}.zip");
$zip = new \ZipArchive();

View file

@ -0,0 +1,154 @@
<?php
namespace App\Console\Commands;
use App\Jobs\HostedMigration;
use App\Libraries\Utils;
use App\Models\Company;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;
class ForceMigration extends Command
{
// define('DB_NINJA_1', 'db-ninja-1');
// define('DB_NINJA_2', 'db-ninja-2');
public $db = DB_NINJA_1;
public $force = false;
public $user = false;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ninja:force-migrate-v5 {--email=} {--force=} {--database=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Force migrate accounts to v5 - (Hosted function only)';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if($this->option('database'))
$this->db = $this->option('database');
if($this->option('force'))
$this->force = $this->option('force');
if(!Utils::isNinjaProd())
return;
config(['database.default' => $this->db]);
$company = $this->getCompany();
if(!$company){
$this->logMessage('Could not find a company with that email address');
exit;
}
$this->forceMigrate($company);
}
private function getCompany()
{
if($this->option('email')){
$user = User::on($this->db)
->where('email', $this->option('email'))
->whereNull('public_id')
->orWhere('public_id', 0)
->first();
if(!$user){
$this->logMessage('Could not find an owner user with that email address');
exit;
}
$this->user = $user;
return $user->account->company;
}
$company = Company::on($this->db)
->whereNull('plan')
->orWhereIn('plan', ['','free'])
->whereHas('accounts', function ($query){
$query->where('account_key', '!=', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
$query->orWhere('account_key', '!=', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx702');
$query->orWhere('account_key', '!=', 'AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT');
})
->with('accounts')
->withCount('accounts')
->having('accounts_count', '>=', 1)
->first();
return $company;
}
private function logMessage($str)
{
$str = date('Y-m-d h:i:s').' '.$str;
$this->info($str);
$this->log .= $str."\n";
}
private function forceMigrate($company)
{
$data = [];
if(!$this->user)
$this->user = $company->accounts->first()->users()->whereNull('public_id')->orWhere('public_id', 0)->first();
if(!$this->user){
$this->logMessage('Could not find an owner user with that email address');
exit;
}
if($company){
foreach($company->accounts as $key => $account)
{
$data['companies'][$key]['id'] = $account->id;
$data['companies'][$key]['force'] = $this->force;
}
$this->dispatch(new HostedMigration($this->user, $data, $this->db, true));
$company->is_migrated = true;
$company->save();
}
}
}

View file

@ -70,7 +70,9 @@ class SendRecurringInvoices extends Command
->get();
foreach ($accounts as $account) {
$account->checkCounterReset();
if(!$account->account_email_settings->is_disabled)
$account->checkCounterReset();
}
}
@ -94,6 +96,11 @@ class SendRecurringInvoices extends Command
$this->info(date('r') . ' Processing Invoice: '. $recurInvoice->id);
$account = $recurInvoice->account;
if($account->account_email_settings->is_disabled){
continue;
}
$account->loadLocalizationSettings($recurInvoice->client);
Auth::loginUsingId($recurInvoice->activeUser()->id);
@ -127,7 +134,7 @@ class SendRecurringInvoices extends Command
foreach ($expenses as $expense) {
$shouldSendToday = $expense->shouldSendToday();
if (! $shouldSendToday) {
if (! $shouldSendToday || $expense->account->account_email_settings->is_disabled) {
continue;
}

View file

@ -109,7 +109,7 @@ class SendReminders extends Command
/** @var Invoice $invoice */
foreach ($delayedAutoBillInvoices as $invoice) {
if ($invoice->isPaid()) {
if ($invoice->isPaid() || $invoice->account->is_deleted) {
continue;
}
@ -128,7 +128,7 @@ class SendReminders extends Command
$this->info(date('r ') . $accounts->count() . ' accounts found with fees enabled');
foreach ($accounts as $account) {
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->account_email_settings->is_disabled) {
continue;
}
@ -155,7 +155,7 @@ class SendReminders extends Command
$this->info(date('r ') . count($accounts) . ' accounts found with reminders enabled');
foreach ($accounts as $account) {
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->account_email_settings->is_disabled) {
continue;
}
@ -201,7 +201,7 @@ class SendReminders extends Command
$account = $scheduledReport->account;
$account->loadLocalizationSettings();
if (! $account->hasFeature(FEATURE_REPORTS)) {
if (! $account->hasFeature(FEATURE_REPORTS) || $account->account_email_settings->is_disabled) {
continue;
}

View file

@ -0,0 +1,82 @@
<?php
namespace App\Console\Commands;
use App\Libraries\Utils;
use App\Models\Company;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;
class SyncAccounts extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ninja:sync-v5';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sync accounts to v5 - (Hosted function only)';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if(!Utils::isNinjaProd())
return;
config(['database.default' => DB_NINJA_1]);
$this->updateAccounts();
config(['database.default' => DB_NINJA_2]);
$this->updateAccounts();
}
private function updateAccounts()
{
$data = [];
$a = Company::whereIn('plan', ['pro', 'enterprise'])
->with('accounts')
->cursor()->each(function ($company) use ($data){
$accounts = $company->accounts->pluck('account_key');
$data[] = [
'plan' => $company->plan,
'plan_term' => $company->plan_term,
'plan_started' => $company->plan_started,
'plan_paid' => $company->plan_paid,
'plan_expires' => $company->plan_expires,
'num_users' => $company->num_users,
'accounts' => $accounts
];
});
//post DATA
}
}

View file

@ -32,6 +32,7 @@ class Kernel extends ConsoleKernel
'App\Console\Commands\CalculatePayouts',
'App\Console\Commands\UpdateKey',
'App\Console\Commands\ExportMigrations',
'App\Console\Commands\SyncAccounts',
];
/**
@ -55,5 +56,20 @@ class Kernel extends ConsoleKernel
->command('ninja:send-reminders --force')
->sendOutputTo($logFile)
->daily();
if(Utils::isNinjaProd())
{
$schedule
->command('ninja:sync-v5')
->withoutOverlapping()
->daily();
// $schedule
// ->command('ninja:force-migrate-v5')
// ->everyMinute()
// ->withoutOverlapping();
}
}
}

View file

@ -361,7 +361,7 @@ if (! defined('APP_NAME')) {
define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com'));
define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest'));
define('NINJA_DATE', '2000-01-01');
define('NINJA_VERSION', '4.5.40' . env('NINJA_VERSION_SUFFIX'));
define('NINJA_VERSION', '4.5.46' . env('NINJA_VERSION_SUFFIX'));
define('NINJA_TERMS_VERSION', '1.0.1');
define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'));
@ -631,6 +631,8 @@ if (! defined('APP_NAME')) {
define('INVOICE_FIELDS_PRODUCT', 'product_fields');
define('INVOICE_FIELDS_TASK', 'task_fields');
define('NINJA_V5_TOKEN', env('NINJA_V5_TOKEN',false));
$creditCards = [
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],

View file

@ -2,20 +2,19 @@
namespace App\Exceptions;
use App\Http\Requests\Request;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Foundation\Validation\ValidationException;
use Illuminate\Http\Exception\HttpResponseException;
use Illuminate\Support\Facades\Response;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Facades\Response;
use Redirect;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Utils;
use Request;
/**
* Class Handler.
@ -30,7 +29,6 @@ class Handler extends ExceptionHandler
protected $dontReport = [
TokenMismatchException::class,
ModelNotFoundException::class,
ValidationException::class,
\Illuminate\Validation\ValidationException::class,
//AuthorizationException::class,
//HttpException::class,
@ -103,7 +101,7 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
$value = Request::header('X-Ninja-Token');
$value = \Request::header('X-Ninja-Token');
if ($e instanceof ModelNotFoundException) {

View file

@ -35,7 +35,6 @@ use Auth;
use Cache;
use File;
use Image;
use Input;
use Redirect;
use Request;
use Response;
@ -109,7 +108,7 @@ class AccountController extends BaseController
{
$user = false;
$account = false;
$guestKey = Input::get('guest_key'); // local storage key to login until registered
$guestKey = \Request::input('guest_key'); // local storage key to login until registered
if (Auth::check()) {
return Redirect::to('invoices/create');
@ -141,13 +140,13 @@ class AccountController extends BaseController
Session::flash('warning', $message);
}
if ($redirectTo = Input::get('redirect_to')) {
if ($redirectTo = \Request::input('redirect_to')) {
$redirectTo = SITE_URL . '/' . ltrim($redirectTo, '/');
} else {
$redirectTo = Input::get('sign_up') ? 'dashboard' : 'invoices/create';
$redirectTo = \Request::input('sign_up') ? 'dashboard' : 'invoices/create';
}
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
return Redirect::to($redirectTo)->with('sign_up', \Request::input('sign_up'));
}
/**
@ -159,9 +158,9 @@ class AccountController extends BaseController
$account = $user->account;
$company = $account->company;
$plan = Input::get('plan');
$term = Input::get('plan_term');
$numUsers = Input::get('num_users');
$plan = \Request::input('plan');
$term = \Request::input('plan_term');
$numUsers = \Request::input('num_users');
if ($plan != PLAN_ENTERPRISE) {
$numUsers = 1;
@ -764,11 +763,11 @@ class AccountController extends BaseController
{
$user = Auth::user();
$account = $user->account;
$modules = Input::get('modules');
$modules = \Request::input('modules');
if (Utils::isSelfHost()) {
// get all custom modules, including disabled
$custom_modules = collect(Input::get('custom_modules'))->each(function ($item, $key) {
$custom_modules = collect(\Request::input('custom_modules'))->each(function ($item, $key) {
$module = Module::find($item);
if ($module && $module->disabled()) {
$module->enable();
@ -782,10 +781,10 @@ class AccountController extends BaseController
});
}
$user->force_pdfjs = Input::get('force_pdfjs') ? true : false;
$user->force_pdfjs = \Request::input('force_pdfjs') ? true : false;
$user->save();
$account->live_preview = Input::get('live_preview') ? true : false;
$account->live_preview = \Request::input('live_preview') ? true : false;
// Automatically disable live preview when using a large font
$fonts = Cache::get('fonts')->filter(function ($font) use ($account) {
@ -813,7 +812,7 @@ class AccountController extends BaseController
*/
private function saveCustomizeDesign()
{
$designId = intval(Input::get('design_id')) ?: CUSTOM_DESIGN1;
$designId = intval(\Request::input('design_id')) ?: CUSTOM_DESIGN1;
$field = 'custom_design' . ($designId - 10);
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
@ -821,7 +820,7 @@ class AccountController extends BaseController
if (! $account->custom_design1) {
$account->invoice_design_id = CUSTOM_DESIGN1;
}
$account->$field = Input::get('custom_design');
$account->$field = \Request::input('custom_design');
$account->save();
Session::flash('message', trans('texts.updated_settings'));
@ -897,28 +896,28 @@ class AccountController extends BaseController
foreach (AccountEmailSettings::$templates as $type) {
$subjectField = "email_subject_{$type}";
$subject = Input::get($subjectField, $account->getEmailSubject($type));
$subject = \Request::input($subjectField, $account->getEmailSubject($type));
$account->account_email_settings->$subjectField = ($subject == $account->getDefaultEmailSubject($type) ? null : $subject);
$bodyField = "email_template_{$type}";
$body = Input::get($bodyField, $account->getEmailTemplate($type));
$body = \Request::input($bodyField, $account->getEmailTemplate($type));
$account->account_email_settings->$bodyField = ($body == $account->getDefaultEmailTemplate($type) ? null : $body);
}
foreach ([TEMPLATE_REMINDER1, TEMPLATE_REMINDER2, TEMPLATE_REMINDER3] as $type) {
$enableField = "enable_{$type}";
$account->$enableField = Input::get($enableField) ? true : false;
$account->{"num_days_{$type}"} = Input::get("num_days_{$type}");
$account->{"field_{$type}"} = Input::get("field_{$type}");
$account->{"direction_{$type}"} = Input::get("field_{$type}") == REMINDER_FIELD_INVOICE_DATE ? REMINDER_DIRECTION_AFTER : Input::get("direction_{$type}");
$account->$enableField = \Request::input($enableField) ? true : false;
$account->{"num_days_{$type}"} = \Request::input("num_days_{$type}");
$account->{"field_{$type}"} = \Request::input("field_{$type}");
$account->{"direction_{$type}"} = \Request::input("field_{$type}") == REMINDER_FIELD_INVOICE_DATE ? REMINDER_DIRECTION_AFTER : \Request::input("direction_{$type}");
$number = preg_replace('/[^0-9]/', '', $type);
$account->account_email_settings->{"late_fee{$number}_amount"} = Input::get("late_fee{$number}_amount");
$account->account_email_settings->{"late_fee{$number}_percent"} = Input::get("late_fee{$number}_percent");
$account->account_email_settings->{"late_fee{$number}_amount"} = \Request::input("late_fee{$number}_amount");
$account->account_email_settings->{"late_fee{$number}_percent"} = \Request::input("late_fee{$number}_percent");
}
$account->enable_reminder4 = Input::get('enable_reminder4') ? true : false;
$account->account_email_settings->frequency_id_reminder4 = Input::get('frequency_id_reminder4');
$account->enable_reminder4 = \Request::input('enable_reminder4') ? true : false;
$account->account_email_settings->frequency_id_reminder4 = \Request::input('frequency_id_reminder4');
$account->save();
$account->account_email_settings->save();
@ -935,7 +934,7 @@ class AccountController extends BaseController
private function saveTaxRates()
{
$account = Auth::user()->account;
$account->fill(Input::all());
$account->fill(Request::all());
$account->save();
Session::flash('message', trans('texts.updated_settings'));
@ -950,10 +949,10 @@ class AccountController extends BaseController
{
$account = Auth::user()->account;
$account->show_product_notes = Input::get('show_product_notes') ? true : false;
$account->fill_products = Input::get('fill_products') ? true : false;
$account->update_products = Input::get('update_products') ? true : false;
$account->convert_products = Input::get('convert_products') ? true : false;
$account->show_product_notes = \Request::input('show_product_notes') ? true : false;
$account->fill_products = \Request::input('fill_products') ? true : false;
$account->update_products = \Request::input('update_products') ? true : false;
$account->convert_products = \Request::input('convert_products') ? true : false;
$account->save();
Session::flash('message', trans('texts.updated_settings'));
@ -969,15 +968,15 @@ class AccountController extends BaseController
if (Auth::user()->account->hasFeature(FEATURE_INVOICE_SETTINGS)) {
$rules = [];
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
if (Input::get("{$entityType}_number_type") == 'pattern') {
if (\Request::input("{$entityType}_number_type") == 'pattern') {
$rules["{$entityType}_number_pattern"] = 'has_counter';
}
}
if (Input::get('credit_number_enabled')) {
if (\Request::input('credit_number_enabled')) {
$rules['credit_number_prefix'] = 'required_without:credit_number_pattern';
$rules['credit_number_pattern'] = 'required_without:credit_number_prefix';
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to('settings/'.ACCOUNT_INVOICE_SETTINGS)
@ -985,47 +984,47 @@ class AccountController extends BaseController
->withInput();
} else {
$account = Auth::user()->account;
$account->custom_value1 = Input::get('custom_value1');
$account->custom_value2 = Input::get('custom_value2');
$account->custom_invoice_taxes1 = Input::get('custom_invoice_taxes1') ? true : false;
$account->custom_invoice_taxes2 = Input::get('custom_invoice_taxes2') ? true : false;
$account->custom_value1 = \Request::input('custom_value1');
$account->custom_value2 = \Request::input('custom_value2');
$account->custom_invoice_taxes1 = \Request::input('custom_invoice_taxes1') ? true : false;
$account->custom_invoice_taxes2 = \Request::input('custom_invoice_taxes2') ? true : false;
$account->custom_fields = request()->custom_fields;
$account->invoice_number_padding = Input::get('invoice_number_padding');
$account->invoice_number_counter = Input::get('invoice_number_counter');
$account->quote_number_prefix = Input::get('quote_number_prefix');
$account->share_counter = Input::get('share_counter') ? true : false;
$account->invoice_terms = Input::get('invoice_terms');
$account->invoice_footer = Input::get('invoice_footer');
$account->quote_terms = Input::get('quote_terms');
$account->auto_convert_quote = Input::get('auto_convert_quote');
$account->auto_archive_quote = Input::get('auto_archive_quote');
$account->auto_archive_invoice = Input::get('auto_archive_invoice');
$account->auto_email_invoice = Input::get('auto_email_invoice');
$account->recurring_invoice_number_prefix = Input::get('recurring_invoice_number_prefix');
$account->invoice_number_padding = \Request::input('invoice_number_padding');
$account->invoice_number_counter = \Request::input('invoice_number_counter');
$account->quote_number_prefix = \Request::input('quote_number_prefix');
$account->share_counter = \Request::input('share_counter') ? true : false;
$account->invoice_terms = \Request::input('invoice_terms');
$account->invoice_footer = \Request::input('invoice_footer');
$account->quote_terms = \Request::input('quote_terms');
$account->auto_convert_quote = \Request::input('auto_convert_quote');
$account->auto_archive_quote = \Request::input('auto_archive_quote');
$account->auto_archive_invoice = \Request::input('auto_archive_invoice');
$account->auto_email_invoice = \Request::input('auto_email_invoice');
$account->recurring_invoice_number_prefix = \Request::input('recurring_invoice_number_prefix');
$account->client_number_prefix = trim(Input::get('client_number_prefix'));
$account->client_number_pattern = trim(Input::get('client_number_pattern'));
$account->client_number_counter = Input::get('client_number_counter');
$account->credit_number_counter = Input::get('credit_number_counter');
$account->credit_number_prefix = trim(Input::get('credit_number_prefix'));
$account->credit_number_pattern = trim(Input::get('credit_number_pattern'));
$account->reset_counter_frequency_id = Input::get('reset_counter_frequency_id');
$account->reset_counter_date = $account->reset_counter_frequency_id ? Utils::toSqlDate(Input::get('reset_counter_date')) : null;
$account->client_number_prefix = trim(\Request::input('client_number_prefix'));
$account->client_number_pattern = trim(\Request::input('client_number_pattern'));
$account->client_number_counter = \Request::input('client_number_counter');
$account->credit_number_counter = \Request::input('credit_number_counter');
$account->credit_number_prefix = trim(\Request::input('credit_number_prefix'));
$account->credit_number_pattern = trim(\Request::input('credit_number_pattern'));
$account->reset_counter_frequency_id = \Request::input('reset_counter_frequency_id');
$account->reset_counter_date = $account->reset_counter_frequency_id ? Utils::toSqlDate(\Request::input('reset_counter_date')) : null;
if (Input::has('recurring_hour')) {
$account->recurring_hour = Input::get('recurring_hour');
if (Request::has('recurring_hour')) {
$account->recurring_hour = \Request::input('recurring_hour');
}
if (! $account->share_counter) {
$account->quote_number_counter = Input::get('quote_number_counter');
$account->quote_number_counter = \Request::input('quote_number_counter');
}
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
if (Input::get("{$entityType}_number_type") == 'prefix') {
$account->{"{$entityType}_number_prefix"} = trim(Input::get("{$entityType}_number_prefix"));
if (\Request::input("{$entityType}_number_type") == 'prefix') {
$account->{"{$entityType}_number_prefix"} = trim(\Request::input("{$entityType}_number_prefix"));
$account->{"{$entityType}_number_pattern"} = null;
} else {
$account->{"{$entityType}_number_pattern"} = trim(Input::get("{$entityType}_number_pattern"));
$account->{"{$entityType}_number_pattern"} = trim(\Request::input("{$entityType}_number_pattern"));
$account->{"{$entityType}_number_prefix"} = null;
}
}
@ -1053,27 +1052,27 @@ class AccountController extends BaseController
{
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
$account = Auth::user()->account;
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
$account->hide_paid_to_date = Input::get('hide_paid_to_date') ? true : false;
$account->all_pages_header = Input::get('all_pages_header') ? true : false;
$account->all_pages_footer = Input::get('all_pages_footer') ? true : false;
$account->invoice_embed_documents = Input::get('invoice_embed_documents') ? true : false;
$account->header_font_id = Input::get('header_font_id');
$account->body_font_id = Input::get('body_font_id');
$account->primary_color = Input::get('primary_color');
$account->secondary_color = Input::get('secondary_color');
$account->invoice_design_id = Input::get('invoice_design_id');
$account->quote_design_id = Input::get('quote_design_id');
$account->font_size = intval(Input::get('font_size'));
$account->page_size = Input::get('page_size');
$account->hide_quantity = \Request::input('hide_quantity') ? true : false;
$account->hide_paid_to_date = \Request::input('hide_paid_to_date') ? true : false;
$account->all_pages_header = \Request::input('all_pages_header') ? true : false;
$account->all_pages_footer = \Request::input('all_pages_footer') ? true : false;
$account->invoice_embed_documents = \Request::input('invoice_embed_documents') ? true : false;
$account->header_font_id = \Request::input('header_font_id');
$account->body_font_id = \Request::input('body_font_id');
$account->primary_color = \Request::input('primary_color');
$account->secondary_color = \Request::input('secondary_color');
$account->invoice_design_id = \Request::input('invoice_design_id');
$account->quote_design_id = \Request::input('quote_design_id');
$account->font_size = intval(\Request::input('font_size'));
$account->page_size = \Request::input('page_size');
$account->background_image_id = Document::getPrivateId(request()->background_image_id);
$labels = [];
foreach (Account::$customLabels as $field) {
$labels[$field] = Input::get("labels_{$field}");
$labels[$field] = \Request::input("labels_{$field}");
}
$account->invoice_labels = json_encode($labels);
$account->invoice_fields = Input::get('invoice_fields_json');
$account->invoice_fields = \Request::input('invoice_fields_json');
$account->save();
@ -1089,12 +1088,12 @@ class AccountController extends BaseController
private function saveNotifications()
{
$user = Auth::user();
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
$user->notify_paid = Input::get('notify_paid');
$user->notify_approved = Input::get('notify_approved');
$user->only_notify_owned = Input::get('only_notify_owned');
$user->slack_webhook_url = Input::get('slack_webhook_url');
$user->notify_sent = \Request::input('notify_sent');
$user->notify_viewed = \Request::input('notify_viewed');
$user->notify_paid = \Request::input('notify_paid');
$user->notify_approved = \Request::input('notify_approved');
$user->only_notify_owned = \Request::input('only_notify_owned');
$user->slack_webhook_url = \Request::input('slack_webhook_url');
$user->save();
$account = $user->account;
@ -1117,8 +1116,8 @@ class AccountController extends BaseController
$this->accountRepo->save($request->input(), $account);
/* Logo image file */
if ($uploaded = Input::file('logo')) {
$path = Input::file('logo')->getRealPath();
if ($uploaded = Request::file('logo')) {
$path = Request::file('logo')->getRealPath();
$disk = $account->getLogoDisk();
$extension = strtolower($uploaded->getClientOriginalExtension());
@ -1204,7 +1203,7 @@ class AccountController extends BaseController
{
/** @var \App\Models\User $user */
$user = Auth::user();
$email = trim(strtolower(Input::get('email')));
$email = trim(strtolower(\Request::input('email')));
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
return Redirect::to('settings/' . ACCOUNT_USER_DETAILS)
@ -1218,34 +1217,34 @@ class AccountController extends BaseController
$rules['phone'] = 'required';
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to('settings/'.ACCOUNT_USER_DETAILS)
->withErrors($validator)
->withInput();
} else {
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->first_name = trim(\Request::input('first_name'));
$user->last_name = trim(\Request::input('last_name'));
$user->username = $email;
$user->email = $email;
$user->phone = trim(Input::get('phone'));
$user->dark_mode = Input::get('dark_mode');
$user->phone = trim(\Request::input('phone'));
$user->dark_mode = \Request::input('dark_mode');
if (! Auth::user()->is_admin) {
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
$user->notify_paid = Input::get('notify_paid');
$user->notify_approved = Input::get('notify_approved');
$user->only_notify_owned = Input::get('only_notify_owned');
$user->notify_sent = \Request::input('notify_sent');
$user->notify_viewed = \Request::input('notify_viewed');
$user->notify_paid = \Request::input('notify_paid');
$user->notify_approved = \Request::input('notify_approved');
$user->only_notify_owned = \Request::input('only_notify_owned');
}
if ($user->google_2fa_secret && ! Input::get('enable_two_factor')) {
if ($user->google_2fa_secret && ! \Request::input('enable_two_factor')) {
$user->google_2fa_secret = null;
}
if (Utils::isNinja()) {
if (Input::get('referral_code') && ! $user->referral_code) {
if (\Request::input('referral_code') && ! $user->referral_code) {
$user->referral_code = strtolower(str_random(RANDOM_KEY_LENGTH));
}
}
@ -1267,15 +1266,15 @@ class AccountController extends BaseController
/** @var \App\Models\Account $account */
$account = Auth::user()->account;
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
$account->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1; // US Dollar
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
$account->military_time = Input::get('military_time') ? true : false;
$account->show_currency_code = Input::get('show_currency_code') ? true : false;
$account->start_of_week = Input::get('start_of_week') ? Input::get('start_of_week') : 0;
$account->financial_year_start = Input::get('financial_year_start') ? Input::get('financial_year_start') : null;
$account->timezone_id = \Request::input('timezone_id') ? \Request::input('timezone_id') : null;
$account->date_format_id = \Request::input('date_format_id') ? \Request::input('date_format_id') : null;
$account->datetime_format_id = \Request::input('datetime_format_id') ? \Request::input('datetime_format_id') : null;
$account->currency_id = \Request::input('currency_id') ? \Request::input('currency_id') : 1; // US Dollar
$account->language_id = \Request::input('language_id') ? \Request::input('language_id') : 1; // English
$account->military_time = \Request::input('military_time') ? true : false;
$account->show_currency_code = \Request::input('show_currency_code') ? true : false;
$account->start_of_week = \Request::input('start_of_week') ? \Request::input('start_of_week') : 0;
$account->financial_year_start = \Request::input('financial_year_start') ? \Request::input('financial_year_start') : null;
$account->save();
event(new UserSettingsChanged());
@ -1291,10 +1290,10 @@ class AccountController extends BaseController
private function saveOnlinePayments()
{
$account = Auth::user()->account;
$account->token_billing_type_id = Input::get('token_billing_type_id');
$account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date'));
$account->gateway_fee_enabled = boolval(Input::get('gateway_fee_enabled'));
$account->send_item_details = boolval(Input::get('send_item_details'));
$account->token_billing_type_id = \Request::input('token_billing_type_id');
$account->auto_bill_on_due_date = boolval(\Request::input('auto_bill_on_due_date'));
$account->gateway_fee_enabled = boolval(\Request::input('gateway_fee_enabled'));
$account->send_item_details = boolval(\Request::input('send_item_details'));
$account->save();
@ -1332,7 +1331,7 @@ class AccountController extends BaseController
*/
public function checkEmail()
{
$email = trim(strtolower(Input::get('email')));
$email = trim(strtolower(\Request::input('email')));
$user = Auth::user();
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
@ -1370,16 +1369,16 @@ class AccountController extends BaseController
$rules['new_email'] .= ',' . Auth::user()->id . ',id';
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return '';
}
$firstName = trim(Input::get('new_first_name'));
$lastName = trim(Input::get('new_last_name'));
$email = trim(strtolower(Input::get('new_email')));
$password = trim(Input::get('new_password'));
$firstName = trim(\Request::input('new_first_name'));
$lastName = trim(\Request::input('new_last_name'));
$email = trim(strtolower(\Request::input('new_email')));
$password = trim(\Request::input('new_password'));
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
return '';
@ -1408,7 +1407,7 @@ class AccountController extends BaseController
$user->account->startTrial(PLAN_PRO);
if (Input::get('go_pro') == 'true') {
if (\Request::input('go_pro') == 'true') {
session([REQUESTED_PRO_PLAN => true]);
}
@ -1422,15 +1421,15 @@ class AccountController extends BaseController
public function doRegister()
{
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
$email = trim(Input::get('email'));
$email = trim(\Request::input('email'));
if (! $email || $email == TEST_USERNAME) {
return RESULT_FAILURE;
}
$license = new License();
$license->first_name = Input::get('first_name');
$license->last_name = Input::get('last_name');
$license->first_name = \Request::input('first_name');
$license->last_name = \Request::input('last_name');
$license->email = $email;
$license->transaction_reference = Request::getClientIp();
$license->license_key = Utils::generateLicense();
@ -1457,7 +1456,7 @@ class AccountController extends BaseController
*/
public function cancelAccount()
{
if ($reason = trim(Input::get('reason'))) {
if ($reason = trim(\Request::input('reason'))) {
$email = Auth::user()->email;
$name = Auth::user()->getDisplayName();
@ -1550,7 +1549,7 @@ class AccountController extends BaseController
*/
public function previewEmail(TemplateService $templateService)
{
$template = Input::get('template');
$template = \Request::input('template');
$invitation = \App\Models\Invitation::scope()
->with('invoice.client.contacts')
->first();

View file

@ -8,8 +8,8 @@ use App\Models\AccountGateway;
use App\Models\Gateway;
use App\Services\AccountGatewayService;
use Auth;
use Input;
use Redirect;
use Request;
use Session;
use stdClass;
use URL;
@ -88,9 +88,9 @@ class AccountGatewayController extends BaseController
Session::now('warning', trans('texts.enable_https'));
}
$account = Auth::user()->account;
$account = Auth::user()->account;
$accountGatewaysIds = $account->gatewayIds();
$wepay = Input::get('wepay');
$wepay = \Request::input('wepay');
$data = self::getViewModel();
$data['url'] = 'gateways';
@ -158,9 +158,9 @@ class AccountGatewayController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$count = $this->accountGatewayService->bulk($ids, $action);
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->accountGatewayService->bulk($ids, $action);
Session::flash('message', trans("texts.{$action}d_account_gateway"));
@ -174,8 +174,8 @@ class AccountGatewayController extends BaseController
*/
public function save($accountGatewayPublicId = false)
{
$gatewayId = Input::get('primary_gateway_id') ?: Input::get('secondary_gateway_id');
$gateway = Gateway::findOrFail($gatewayId);
$gatewayId = \Request::input('primary_gateway_id') ?: \Request::input('secondary_gateway_id');
$gateway = Gateway::findOrFail($gatewayId);
$rules = [];
$fields = $gateway->getFields();
@ -208,16 +208,16 @@ class AccountGatewayController extends BaseController
}
}
$creditcards = Input::get('creditCardTypes');
$validator = Validator::make(Input::all(), $rules);
$creditcards = \Request::input('creditCardTypes');
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
$url = $accountGatewayPublicId ? "/gateways/{$accountGatewayPublicId}/edit" : 'gateways/create?other_providers=' . ($gatewayId == GATEWAY_WEPAY ? 'false' : 'true');
return Redirect::to($url)
->withErrors($validator)
->withInput();
->withErrors($validator)
->withInput();
} else {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$oldConfig = null;
if ($accountGatewayPublicId) {
@ -250,7 +250,7 @@ class AccountGatewayController extends BaseController
if ($gatewayId != GATEWAY_WEPAY) {
foreach ($fields as $field => $details) {
$value = trim(Input::get($gateway->id . '_' . $field));
$value = trim(\Request::input($gateway->id . '_' . $field));
// if the new value is masked use the original value
if ($oldConfig && $value && $value === str_repeat('*', strlen($value))) {
$value = $oldConfig->$field;
@ -265,28 +265,28 @@ class AccountGatewayController extends BaseController
$config = clone $oldConfig;
}
$publishableKey = trim(Input::get('publishable_key'));
$publishableKey = trim(\Request::input('publishable_key'));
if ($publishableKey = str_replace('*', '', $publishableKey)) {
$config->publishableKey = $publishableKey;
} elseif ($oldConfig && property_exists($oldConfig, 'publishableKey')) {
$config->publishableKey = $oldConfig->publishableKey;
}
$plaidClientId = trim(Input::get('plaid_client_id'));
$plaidClientId = trim(\Request::input('plaid_client_id'));
if (! $plaidClientId || $plaidClientId = str_replace('*', '', $plaidClientId)) {
$config->plaidClientId = $plaidClientId;
} elseif ($oldConfig && property_exists($oldConfig, 'plaidClientId')) {
$config->plaidClientId = $oldConfig->plaidClientId;
}
$plaidSecret = trim(Input::get('plaid_secret'));
$plaidSecret = trim(\Request::input('plaid_secret'));
if (! $plaidSecret || $plaidSecret = str_replace('*', '', $plaidSecret)) {
$config->plaidSecret = $plaidSecret;
} elseif ($oldConfig && property_exists($oldConfig, 'plaidSecret')) {
$config->plaidSecret = $oldConfig->plaidSecret;
}
$plaidPublicKey = trim(Input::get('plaid_public_key'));
$plaidPublicKey = trim(\Request::input('plaid_public_key'));
if (! $plaidPublicKey || $plaidPublicKey = str_replace('*', '', $plaidPublicKey)) {
$config->plaidPublicKey = $plaidPublicKey;
} elseif ($oldConfig && property_exists($oldConfig, 'plaidPublicKey')) {
@ -294,11 +294,11 @@ class AccountGatewayController extends BaseController
}
if ($gatewayId == GATEWAY_STRIPE) {
$config->enableAlipay = boolval(Input::get('enable_alipay'));
$config->enableSofort = boolval(Input::get('enable_sofort'));
$config->enableSepa = boolval(Input::get('enable_sepa'));
$config->enableBitcoin = boolval(Input::get('enable_bitcoin'));
$config->enableApplePay = boolval(Input::get('enable_apple_pay'));
$config->enableAlipay = boolval(\Request::input('enable_alipay'));
$config->enableSofort = boolval(\Request::input('enable_sofort'));
$config->enableSepa = boolval(\Request::input('enable_sepa'));
$config->enableBitcoin = boolval(\Request::input('enable_bitcoin'));
$config->enableApplePay = boolval(\Request::input('enable_apple_pay'));
if ($config->enableApplePay && $uploadedFile = request()->file('apple_merchant_id')) {
$config->appleMerchantId = File::get($uploadedFile);
@ -308,11 +308,11 @@ class AccountGatewayController extends BaseController
}
if ($gatewayId == GATEWAY_STRIPE || $gatewayId == GATEWAY_WEPAY) {
$config->enableAch = boolval(Input::get('enable_ach'));
$config->enableAch = boolval(\Request::input('enable_ach'));
}
if ($gatewayId == GATEWAY_BRAINTREE) {
$config->enablePayPal = boolval(Input::get('enable_paypal'));
$config->enablePayPal = boolval(\Request::input('enable_paypal'));
}
$cardCount = 0;
@ -323,9 +323,9 @@ class AccountGatewayController extends BaseController
}
$accountGateway->accepted_credit_cards = $cardCount;
$accountGateway->show_address = Input::get('show_address') ? true : false;
$accountGateway->show_shipping_address = Input::get('show_shipping_address') ? true : false;
$accountGateway->update_address = Input::get('update_address') ? true : false;
$accountGateway->show_address = \Request::input('show_address') ? true : false;
$accountGateway->show_shipping_address = \Request::input('show_shipping_address') ? true : false;
$accountGateway->update_address = \Request::input('update_address') ? true : false;
$accountGateway->setConfig($config);
if ($accountGatewayPublicId) {
@ -395,7 +395,7 @@ class AccountGatewayController extends BaseController
'country' => 'required|in:US,CA,GB',
];
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to('gateways/create')
@ -404,9 +404,9 @@ class AccountGatewayController extends BaseController
}
if (! $user->email) {
$user->email = trim(Input::get('email'));
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->email = trim(\Request::input('email'));
$user->first_name = trim(\Request::input('first_name'));
$user->last_name = trim(\Request::input('last_name'));
$user->save();
}
@ -414,16 +414,16 @@ class AccountGatewayController extends BaseController
$wepay = Utils::setupWePay();
$userDetails = [
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
'email' => Input::get('email'),
'first_name' => Input::get('first_name'),
'last_name' => Input::get('last_name'),
'original_ip' => \Request::getClientIp(true),
'original_device' => \Request::server('HTTP_USER_AGENT'),
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
'email' => \Request::input('email'),
'first_name' => \Request::input('first_name'),
'last_name' => \Request::input('last_name'),
'original_ip' => \Request::getClientIp(true),
'original_device' => \Request::server('HTTP_USER_AGENT'),
'tos_acceptance_time' => time(),
'redirect_uri' => URL::to('gateways'),
'scope' => 'manage_accounts,collect_payments,view_user,preapprove_payments,send_money',
'redirect_uri' => URL::to('gateways'),
'scope' => 'manage_accounts,collect_payments,view_user,preapprove_payments,send_money',
];
$wepayUser = $wepay->request('user/register/', $userDetails);
@ -434,18 +434,18 @@ class AccountGatewayController extends BaseController
$wepay = new WePay($accessToken);
$accountDetails = [
'name' => Input::get('company_name'),
'description' => trans('texts.wepay_account_description'),
'name' => \Request::input('company_name'),
'description' => trans('texts.wepay_account_description'),
'theme_object' => json_decode(WEPAY_THEME),
'callback_uri' => $accountGateway->getWebhookUrl(),
'rbits' => $account->present()->rBits,
'country' => Input::get('country'),
'rbits' => $account->present()->rBits,
'country' => \Request::input('country'),
];
if (Input::get('country') == 'CA') {
$accountDetails['currencies'] = ['CAD'];
$accountDetails['country_options'] = ['debit_opt_in' => boolval(Input::get('debit_cards'))];
} elseif (Input::get('country') == 'GB') {
if (\Request::input('country') == 'CA') {
$accountDetails['currencies'] = ['CAD'];
$accountDetails['country_options'] = ['debit_opt_in' => boolval(\Request::input('debit_cards'))];
} elseif (\Request::input('country') == 'GB') {
$accountDetails['currencies'] = ['GBP'];
}
@ -464,14 +464,14 @@ class AccountGatewayController extends BaseController
$accountGateway->gateway_id = GATEWAY_WEPAY;
$accountGateway->setConfig([
'userId' => $wepayUser->user_id,
'accessToken' => $accessToken,
'tokenType' => $wepayUser->token_type,
'userId' => $wepayUser->user_id,
'accessToken' => $accessToken,
'tokenType' => $wepayUser->token_type,
'tokenExpires' => $accessTokenExpires,
'accountId' => $wepayAccount->account_id,
'state' => $wepayAccount->state,
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
'country' => Input::get('country'),
'accountId' => $wepayAccount->account_id,
'state' => $wepayAccount->state,
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
'country' => \Request::input('country'),
]);
if ($confirmationRequired) {
@ -522,22 +522,22 @@ class AccountGatewayController extends BaseController
*/
public function savePaymentGatewayLimits()
{
$gateway_type_id = intval(Input::get('gateway_type_id'));
$gateway_type_id = intval(\Request::input('gateway_type_id'));
$gateway_settings = AccountGatewaySettings::scope()->where('gateway_type_id', '=', $gateway_type_id)->first();
if (! $gateway_settings) {
$gateway_settings = AccountGatewaySettings::createNew();
if ( ! $gateway_settings) {
$gateway_settings = AccountGatewaySettings::createNew();
$gateway_settings->gateway_type_id = $gateway_type_id;
}
$gateway_settings->min_limit = Input::get('limit_min_enable') ? intval(Input::get('limit_min')) : null;
$gateway_settings->max_limit = Input::get('limit_max_enable') ? intval(Input::get('limit_max')) : null;
$gateway_settings->min_limit = \Request::input('limit_min_enable') ? intval(\Request::input('limit_min')) : null;
$gateway_settings->max_limit = \Request::input('limit_max_enable') ? intval(\Request::input('limit_max')) : null;
if ($gateway_settings->max_limit !== null && $gateway_settings->min_limit > $gateway_settings->max_limit) {
$gateway_settings->max_limit = $gateway_settings->min_limit;
}
$gateway_settings->fill(Input::all());
$gateway_settings->fill(Request::all());
$gateway_settings->save();
Session::flash('message', trans('texts.updated_settings'));

View file

@ -16,7 +16,6 @@ use Config;
use DB;
use Event;
use Exception;
use Input;
use Redirect;
use Response;
use Session;
@ -58,17 +57,17 @@ class AppController extends BaseController
}
$valid = false;
$test = Input::get('test');
$test = \Request::input('test');
$app = Input::get('app');
$app = \Request::input('app');
$app['key'] = env('APP_KEY') ?: strtolower(str_random(RANDOM_KEY_LENGTH));
$app['debug'] = Input::get('debug') ? 'true' : 'false';
$app['https'] = Input::get('https') ? 'true' : 'false';
$app['debug'] = \Request::input('debug') ? 'true' : 'false';
$app['https'] = \Request::input('https') ? 'true' : 'false';
$database = Input::get('database');
$database = \Request::input('database');
$dbType = 'mysql'; // $database['default'];
$database['connections'] = [$dbType => $database['type']];
$mail = Input::get('mail');
$mail = \Request::input('mail');
if ($test == 'mail') {
return self::testMail($mail);
@ -137,10 +136,10 @@ class AppController extends BaseController
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
if (! Account::count()) {
$firstName = trim(Input::get('first_name'));
$lastName = trim(Input::get('last_name'));
$email = trim(strtolower(Input::get('email')));
$password = trim(Input::get('password'));
$firstName = trim(\Request::input('first_name'));
$lastName = trim(\Request::input('last_name'));
$email = trim(strtolower(\Request::input('email')));
$password = trim(\Request::input('password'));
$account = $this->accountRepo->create($firstName, $lastName, $email, $password);
$user = $account->users()->first();
@ -167,13 +166,13 @@ class AppController extends BaseController
return Redirect::to('/settings/system_settings');
}
$app = Input::get('app');
$db = Input::get('database');
$mail = Input::get('mail');
$app = \Request::input('app');
$db = \Request::input('database');
$mail = \Request::input('mail');
$_ENV['APP_URL'] = $app['url'];
$_ENV['APP_DEBUG'] = Input::get('debug') ? 'true' : 'false';
$_ENV['REQUIRE_HTTPS'] = Input::get('https') ? 'true' : 'false';
$_ENV['APP_DEBUG'] = \Request::input('debug') ? 'true' : 'false';
$_ENV['REQUIRE_HTTPS'] = \Request::input('https') ? 'true' : 'false';
$_ENV['DB_TYPE'] = 'mysql'; // $db['default'];
$_ENV['DB_HOST'] = $db['type']['host'];
@ -314,7 +313,7 @@ class AppController extends BaseController
Session::flush();
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
Event::fire(new UserSettingsChanged());
Event::dispatch(new UserSettingsChanged());
// legacy fix: check cipher is in .env file
if (! env('APP_CIPHER')) {
@ -363,15 +362,15 @@ class AppController extends BaseController
public function emailBounced()
{
$messageId = Input::get('MessageID');
$error = Input::get('Name') . ': ' . Input::get('Description');
$messageId = \Request::input('MessageID');
$error = \Request::input('Name') . ': ' . \Request::input('Description');
return $this->emailService->markBounced($messageId, $error) ? RESULT_SUCCESS : RESULT_FAILURE;
}
public function emailOpened()
{
$messageId = Input::get('MessageID');
$messageId = \Request::input('MessageID');
return $this->emailService->markOpened($messageId) ? RESULT_SUCCESS : RESULT_FAILURE;
@ -409,7 +408,7 @@ class AppController extends BaseController
public function stats()
{
if (! hash_equals(Input::get('password') ?: '', env('RESELLER_PASSWORD'))) {
if (! hash_equals(\Request::input('password') ?: '', env('RESELLER_PASSWORD'))) {
sleep(3);
return '';

View file

@ -158,7 +158,7 @@ class LoginController extends Controller
}
}
Event::fire(new UserLoggedIn());
Event::dispatch(new UserLoggedIn());
return redirect()->intended($this->redirectTo);
}
@ -188,11 +188,11 @@ class LoginController extends Controller
$key = $userId . ':' . $request->totp;
//use cache to store token to blacklist
Cache::add($key, true, 4);
Cache::add($key, true, 4 * 60);
//login and redirect user
auth()->loginUsingId($userId);
Event::fire(new UserLoggedIn());
Event::dispatch(new UserLoggedIn());
if ($trust = request()->trust) {
$user = auth()->user();

View file

@ -42,7 +42,7 @@ class ResetPasswordController extends Controller
$this->middleware('guest');
}
protected function sendResetResponse($response)
protected function sendResetResponse(Request $request, $response)
{
$user = auth()->user();
@ -51,8 +51,8 @@ class ResetPasswordController extends Controller
session(['2fa:user:id' => $user->id]);
return redirect('/validate_two_factor/' . $user->account->account_key);
} else {
Event::fire(new UserLoggedIn());
return $this->traitSendResetResponse($response);
Event::dispatch(new UserLoggedIn());
return $this->traitSendResetResponse($request, $response);
}
}

View file

@ -12,7 +12,6 @@ use Cache;
use Crypt;
use File;
use Illuminate\Http\Request;
use Input;
use Redirect;
use Session;
use Utils;
@ -74,8 +73,8 @@ class BankAccountController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->bankAccountService->bulk($ids, $action);
Session::flash('message', trans('texts.archived_bank_account'));
@ -85,9 +84,9 @@ class BankAccountController extends BaseController
public function validateAccount()
{
$publicId = Input::get('public_id');
$username = trim(Input::get('bank_username'));
$password = trim(Input::get('bank_password'));
$publicId = \Request::input('public_id');
$username = trim(\Request::input('bank_username'));
$password = trim(\Request::input('bank_password'));
if ($publicId) {
$bankAccount = BankAccount::scope($publicId)->firstOrFail();
@ -100,11 +99,11 @@ class BankAccountController extends BaseController
$bankId = $bankAccount->bank_id;
} else {
$bankAccount = new BankAccount;
$bankAccount->bank_id = Input::get('bank_id');
$bankAccount->bank_id = \Request::input('bank_id');
}
$bankAccount->app_version = Input::get('app_version');
$bankAccount->ofx_version = Input::get('ofx_version');
$bankAccount->app_version = \Request::input('app_version');
$bankAccount->ofx_version = \Request::input('ofx_version');
if ($publicId) {
$bankAccount->save();
@ -115,18 +114,18 @@ class BankAccountController extends BaseController
public function store(CreateBankAccountRequest $request)
{
$bankAccount = $this->bankAccountRepo->save(Input::all());
$bankAccount = $this->bankAccountRepo->save(Request::all());
$bankId = Input::get('bank_id');
$username = trim(Input::get('bank_username'));
$password = trim(Input::get('bank_password'));
$bankId = \Request::input('bank_id');
$username = trim(\Request::input('bank_username'));
$password = trim(\Request::input('bank_password'));
return json_encode($this->bankAccountService->loadBankAccounts($bankAccount, $username, $password, true));
}
public function importExpenses($bankId)
{
return $this->bankAccountService->importExpenses($bankId, Input::all());
return $this->bankAccountService->importExpenses($bankId, Request::all());
}
public function showImportOFX()

View file

@ -5,7 +5,6 @@ namespace App\Http\Controllers;
use App\Models\EntityModel;
use App\Ninja\Serializers\ArraySerializer;
use Auth;
use Input;
use League\Fractal\Manager;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection;
@ -24,7 +23,7 @@ use Utils;
* @SWG\Info(
* version="1.0.0",
* title="Invoice Ninja API",
* description="An open-source invoicing and time-tracking app built with Laravel",
* description="A source-available invoicing and time-tracking app built with Laravel",
* termsOfService="",
* @SWG\Contact(
* email="contact@invoiceninja.com"
@ -56,11 +55,11 @@ class BaseAPIController extends Controller
{
$this->manager = new Manager();
if ($include = Request::get('include')) {
if ($include = \Request::get('include')) {
$this->manager->parseIncludes($include);
}
$this->serializer = Request::get('serializer') ?: API_SERIALIZER_ARRAY;
$this->serializer = \Request::get('serializer') ?: API_SERIALIZER_ARRAY;
if ($this->serializer === API_SERIALIZER_JSON) {
$this->manager->setSerializer(new JsonApiSerializer());
@ -92,24 +91,24 @@ class BaseAPIController extends Controller
protected function listResponse($query)
{
$transformerClass = EntityModel::getTransformerName($this->entityType);
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
$transformer = new $transformerClass(Auth::user()->account, \Request::input('serializer'));
$includes = $transformer->getDefaultIncludes();
$includes = $this->getRequestIncludes($includes);
$query->with($includes);
if (Input::get('filter_active')) {
if (\Request::input('filter_active')) {
$query->whereNull('deleted_at');
}
if (Input::get('updated_at') > 0) {
$updatedAt = intval(Input::get('updated_at'));
if (\Request::input('updated_at') > 0) {
$updatedAt = intval(\Request::input('updated_at'));
$query->where('updated_at', '>=', date('Y-m-d H:i:s', $updatedAt));
}
if (Input::get('client_id') > 0) {
$clientPublicId = Input::get('client_id');
if (\Request::input('client_id') > 0) {
$clientPublicId = \Request::input('client_id');
$filter = function ($query) use ($clientPublicId) {
$query->where('public_id', '=', $clientPublicId);
};
@ -136,7 +135,7 @@ class BaseAPIController extends Controller
}
$transformerClass = EntityModel::getTransformerName($this->entityType);
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
$transformer = new $transformerClass(Auth::user()->account, \Request::input('serializer'));
$data = $this->createItem($item, $transformer, $this->entityType);
@ -161,7 +160,7 @@ class BaseAPIController extends Controller
}
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
$limit = Input::get('per_page', DEFAULT_API_PAGE_SIZE);
$limit = \Request::input('per_page', DEFAULT_API_PAGE_SIZE);
if (Utils::isNinja()) {
$limit = min(MAX_API_PAGE_SIZE, $limit);
}
@ -178,7 +177,7 @@ class BaseAPIController extends Controller
protected function response($response)
{
$index = Request::get('index') ?: 'data';
$index = \Request::get('index') ?: 'data';
if ($index == 'none') {
unset($response['meta']);

View file

@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use Auth;
use Input;
use Redirect;
use Session;
use URL;
@ -15,24 +14,24 @@ class BlueVineController extends BaseController
$user = Auth::user();
$data = [
'personal_user_full_name' => Input::get('name'),
'business_phone_number' => Input::get('phone'),
'email' => Input::get('email'),
'personal_fico_score' => intval(Input::get('fico_score')),
'business_annual_revenue' => intval(Input::get('annual_revenue')),
'business_monthly_average_bank_balance' => intval(Input::get('average_bank_balance')),
'business_inception_date' => date('Y-m-d', strtotime(Input::get('business_inception'))),
'personal_user_full_name' => \Request::input('name'),
'business_phone_number' => \Request::input('phone'),
'email' => \Request::input('email'),
'personal_fico_score' => intval(\Request::input('fico_score')),
'business_annual_revenue' => intval(\Request::input('annual_revenue')),
'business_monthly_average_bank_balance' => intval(\Request::input('average_bank_balance')),
'business_inception_date' => date('Y-m-d', strtotime(\Request::input('business_inception'))),
'partner_internal_business_id' => 'ninja_account_' . $user->account_id,
];
if (! empty(Input::get('quote_type_factoring'))) {
if (! empty(\Request::input('quote_type_factoring'))) {
$data['invoice_factoring_offer'] = true;
$data['desired_credit_line'] = intval(Input::get('desired_credit_limit')['invoice_factoring']);
$data['desired_credit_line'] = intval(\Request::input('desired_credit_limit')['invoice_factoring']);
}
if (! empty(Input::get('quote_type_loc'))) {
if (! empty(\Request::input('quote_type_loc'))) {
$data['line_of_credit_offer'] = true;
$data['desired_credit_line_for_loc'] = intval(Input::get('desired_credit_limit')['line_of_credit']);
$data['desired_credit_line_for_loc'] = intval(\Request::input('desired_credit_limit')['line_of_credit']);
}
$api_client = new \GuzzleHttp\Client();

View file

@ -12,7 +12,6 @@ use Auth;
use Cache;
use DB;
use Exception;
use Input;
use Utils;
class BotController extends Controller
@ -28,7 +27,7 @@ class BotController extends Controller
{
abort(404);
$input = Input::all();
$input = \Request::all();
$botUserId = $input['from']['id'];
if (! $token = $this->authenticate($input)) {

View file

@ -7,7 +7,6 @@ use App\Http\Requests\CreateClientRequest;
use App\Http\Requests\UpdateClientRequest;
use App\Models\Client;
use App\Ninja\Repositories\ClientRepository;
use Input;
use Response;
class ClientApiController extends BaseAPIController
@ -46,11 +45,11 @@ class ClientApiController extends BaseAPIController
->orderBy('updated_at', 'desc')
->withTrashed();
if ($email = Input::get('email')) {
if ($email = \Request::input('email')) {
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
$query->where('email', $email);
});
} elseif ($idNumber = Input::get('id_number')) {
} elseif ($idNumber = \Request::input('id_number')) {
$clients = $clients->whereIdNumber($idNumber);
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers\ClientAuth;
use Illuminate\Mail\Message;
use Password;
use Config;
use Utils;
@ -39,7 +40,7 @@ class ForgotPasswordController extends Controller
}
/**
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function showLinkRequestForm()
{
@ -55,7 +56,7 @@ class ForgotPasswordController extends Controller
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
*/
public function sendResetLinkEmail(Request $request)
{
@ -91,7 +92,7 @@ class ForgotPasswordController extends Controller
});
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($response)
? $this->sendResetLinkResponse($request, $response)
: $this->sendResetLinkFailedResponse($request, $response);
}

View file

@ -19,7 +19,6 @@ use App\Ninja\Repositories\ClientRepository;
use App\Services\ClientService;
use Auth;
use Cache;
use Input;
use Redirect;
use Session;
use URL;
@ -57,7 +56,7 @@ class ClientController extends BaseController
public function getDatatable()
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterIdByEntity(ENTITY_CLIENT);
return $this->clientService->getDatatable($search, $userId);
@ -201,7 +200,7 @@ class ClientController extends BaseController
private static function getViewModel()
{
return [
'data' => Input::old('data'),
'data' => \Request::old('data'),
'account' => Auth::user()->account,
'sizes' => Cache::get('sizes'),
'customLabel1' => Auth::user()->account->customLabel('client1'),
@ -227,8 +226,8 @@ class ClientController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
if ($action == 'purge' && ! auth()->user()->is_admin) {
return redirect('dashboard')->withError(trans('texts.not_authorized'));

View file

@ -67,6 +67,17 @@ class ClientPortalController extends BaseController
$client = $invoice->client;
$account = $invoice->account;
/* Forward requests from V4 to V5 if the domain is set */
if(strlen($account->account_email_settings->forward_url_for_v5) >1){
if ($invoice->isType(INVOICE_TYPE_QUOTE))
$entity = 'quote';
else
$entity = 'invoice';
return redirect($account->account_email_settings->forward_url_for_v5."/client/".$entity."/".$invitationKey);
}
if (request()->silent) {
session(['silent:' . $client->id => true]);
return redirect(request()->url() . (request()->borderless ? '?borderless=true' : ''));
@ -78,7 +89,7 @@ class ClientPortalController extends BaseController
]);
}
if (! Input::has('phantomjs') && ! session('silent:' . $client->id) && ! Session::has($invitation->invitation_key)
if (! Request::has('phantomjs') && ! session('silent:' . $client->id) && ! Session::has($invitation->invitation_key)
&& (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
event(new QuoteInvitationWasViewed($invoice, $invitation));
@ -136,7 +147,7 @@ class ClientPortalController extends BaseController
}
}
if (! Input::has('phantomjs')) {
if (! Request::has('phantomjs')) {
if ($wepayGateway = $account->getGatewayConfig(GATEWAY_WEPAY)) {
$data['enableWePayACH'] = $wepayGateway->getAchEnabled();
}
@ -161,7 +172,7 @@ class ClientPortalController extends BaseController
'contact' => $contact,
'paymentTypes' => $paymentTypes,
'paymentURL' => $paymentURL,
'phantomjs' => Input::has('phantomjs'),
'phantomjs' => Request::has('phantomjs'),
'gatewayTypeId' => count($paymentTypes) == 1 ? $paymentTypes[0]['gatewayTypeId'] : false,
];
@ -228,7 +239,7 @@ class ClientPortalController extends BaseController
return RESULT_FAILURE;
}
if ($signature = Input::get('signature')) {
if ($signature = \Request::input('signature')) {
$invitation->signature_base64 = $signature;
$invitation->signature_date = date_create();
$invitation->save();
@ -389,7 +400,7 @@ class ClientPortalController extends BaseController
return '';
}
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_INVOICE, Input::get('sSearch'));
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_INVOICE, \Request::input('sSearch'));
}
public function recurringInvoiceDatatable()
@ -432,7 +443,7 @@ class ClientPortalController extends BaseController
if (! $contact = $this->getContact()) {
return $this->returnError();
}
$payments = $this->paymentRepo->findForContact($contact->id, Input::get('sSearch'));
$payments = $this->paymentRepo->findForContact($contact->id, \Request::input('sSearch'));
return Datatable::query($payments)
->addColumn('invoice_number', function ($model) {
@ -517,7 +528,7 @@ class ClientPortalController extends BaseController
return false;
}
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_QUOTE, Input::get('sSearch'));
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_QUOTE, \Request::input('sSearch'));
}
public function creditIndex()
@ -626,7 +637,7 @@ class ClientPortalController extends BaseController
return false;
}
return $this->documentRepo->getClientDatatable($contact->id, ENTITY_DOCUMENT, Input::get('sSearch'));
return $this->documentRepo->getClientDatatable($contact->id, ENTITY_DOCUMENT, \Request::input('sSearch'));
}
private function returnError($error = false)
@ -839,9 +850,9 @@ class ClientPortalController extends BaseController
public function verifyPaymentMethod()
{
$publicId = Input::get('source_id');
$amount1 = Input::get('verification1');
$amount2 = Input::get('verification2');
$publicId = \Request::input('source_id');
$amount1 = \Request::input('verification1');
$amount2 = \Request::input('verification2');
if (! $contact = $this->getContact()) {
return $this->returnError();
@ -895,14 +906,14 @@ class ClientPortalController extends BaseController
$client = $contact->client;
$account = $client->account;
$validator = Validator::make(Input::all(), ['source' => 'required']);
$validator = Validator::make(Request::all(), ['source' => 'required']);
if ($validator->fails()) {
return Redirect::to($client->account->enable_client_portal_dashboard ? '/client/dashboard' : '/client/payment_methods/');
}
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
$paymentMethod = PaymentMethod::clientId($client->id)
->wherePublicId(Input::get('source'))
->wherePublicId(\Request::input('source'))
->firstOrFail();
$customer = $paymentDriver->customer($client->id);
@ -934,14 +945,14 @@ class ClientPortalController extends BaseController
$client = $contact->client;
$validator = Validator::make(Input::all(), ['public_id' => 'required']);
$validator = Validator::make(Request::all(), ['public_id' => 'required']);
if ($validator->fails()) {
return Redirect::to('client/invoices/recurring');
}
$publicId = Input::get('public_id');
$enable = Input::get('enable');
$publicId = \Request::input('public_id');
$enable = \Request::input('enable');
$invoice = $client->invoices()->where('public_id', intval($publicId))->first();
if ($invoice && $invoice->is_recurring && ($invoice->auto_bill == AUTO_BILL_OPT_IN || $invoice->auto_bill == AUTO_BILL_OPT_OUT)) {

View file

@ -7,7 +7,6 @@ use App\Http\Requests\CreateContactRequest;
use App\Http\Requests\UpdateContactRequest;
use App\Models\Contact;
use App\Ninja\Repositories\ContactRepository;
use Input;
use Response;
use Utils;
use App\Services\ContactService;

View file

@ -8,7 +8,6 @@ use App\Http\Requests\UpdateCreditRequest;
use App\Models\Invoice;
use App\Models\Credit;
use App\Ninja\Repositories\CreditRepository;
use Input;
use Response;
class CreditApiController extends BaseAPIController

View file

@ -10,7 +10,6 @@ use App\Models\Credit;
use App\Ninja\Datatables\CreditDatatable;
use App\Ninja\Repositories\CreditRepository;
use App\Services\CreditService;
use Input;
use Redirect;
use Session;
use URL;
@ -47,13 +46,13 @@ class CreditController extends BaseController
public function getDatatable($clientPublicId = null)
{
return $this->creditService->getDatatable($clientPublicId, Input::get('sSearch'));
return $this->creditService->getDatatable($clientPublicId, \Request::input('sSearch'));
}
public function create(CreditRequest $request)
{
$data = [
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
'clientPublicId' => \Request::old('client') ? \Request::old('client') : ($request->client_id ?: 0),
'credit' => null,
'method' => 'POST',
'url' => 'credits',
@ -111,7 +110,7 @@ class CreditController extends BaseController
private function save($credit = null)
{
$credit = $this->creditService->save(Input::all(), $credit);
$credit = $this->creditService->save(\Request::all(), $credit);
$message = $credit->wasRecentlyCreated ? trans('texts.created_credit') : trans('texts.updated_credit');
Session::flash('message', $message);
@ -121,8 +120,8 @@ class CreditController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->creditService->bulk($ids, $action);
if ($count > 0) {

View file

@ -8,7 +8,6 @@ use App\Http\Requests\UpdateExpenseCategoryRequest;
use App\Models\ExpenseCategory;
use App\Ninja\Repositories\ExpenseCategoryRepository;
use App\Services\ExpenseCategoryService;
use Input;
class ExpenseCategoryApiController extends BaseAPIController
{

View file

@ -8,7 +8,6 @@ use App\Http\Requests\UpdateExpenseCategoryRequest;
use App\Ninja\Datatables\ExpenseCategoryDatatable;
use App\Ninja\Repositories\ExpenseCategoryRepository;
use App\Services\ExpenseCategoryService;
use Input;
use Session;
use View;
@ -40,7 +39,7 @@ class ExpenseCategoryController extends BaseController
public function getDatatable($expensePublicId = null)
{
return $this->categoryService->getDatatable(Input::get('sSearch'));
return $this->categoryService->getDatatable(\Request::input('sSearch'));
}
public function create(ExpenseCategoryRequest $request)
@ -89,8 +88,8 @@ class ExpenseCategoryController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->categoryService->bulk($ids, $action);
if ($count > 0) {

View file

@ -16,7 +16,6 @@ use App\Ninja\Repositories\InvoiceRepository;
use App\Services\ExpenseService;
use Auth;
use Cache;
use Input;
use Redirect;
use Request;
use Session;
@ -61,7 +60,7 @@ class ExpenseController extends BaseController
public function getDatatable($expensePublicId = null)
{
return $this->expenseService->getDatatable(Input::get('sSearch'));
return $this->expenseService->getDatatable(\Request::input('sSearch'));
}
public function getDatatableVendor($vendorPublicId = null)
@ -83,7 +82,7 @@ class ExpenseController extends BaseController
}
$data = [
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
'vendorPublicId' => Request::old('vendor') ? Request::old('vendor') : $request->vendor_id,
'expense' => null,
'method' => 'POST',
'url' => 'expenses',
@ -190,7 +189,7 @@ class ExpenseController extends BaseController
Session::flash('message', trans('texts.updated_expense'));
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore', 'invoice', 'add_to_invoice'])) {
return self::bulk();
}
@ -227,8 +226,8 @@ class ExpenseController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$referer = Request::server('HTTP_REFERER');
switch ($action) {
@ -268,7 +267,7 @@ class ExpenseController extends BaseController
->with('expenseCurrencyId', $currencyId)
->with('expenses', $ids);
} else {
$invoiceId = Input::get('invoice_id');
$invoiceId = \Request::input('invoice_id');
return Redirect::to("invoices/{$invoiceId}/edit")
->with('expenseCurrencyId', $currencyId)
@ -291,7 +290,7 @@ class ExpenseController extends BaseController
private static function getViewModel($expense = false)
{
return [
'data' => Input::old('data'),
'data' => Request::old('data'),
'account' => Auth::user()->account,
'vendors' => Vendor::scope()->withActiveOrSelected($expense ? $expense->vendor_id : false)->with('vendor_contacts')->orderBy('name')->get(),
'clients' => Client::scope()->withActiveOrSelected($expense ? $expense->client_id : false)->with('contacts')->orderBy('name')->get(),

View file

@ -6,7 +6,6 @@ use App\Libraries\Utils;
use App\Models\Account;
use App\Ninja\Mailers\Mailer;
use Auth;
use Input;
use Mail;
use Redirect;
use Request;
@ -65,17 +64,27 @@ class HomeController extends BaseController
*/
public function invoiceNow()
{
$url = 'https://invoicing.co';
if (Request::has('rc')) {
$url = $url . '?rc=' . \Request::input('rc');
}
return Redirect::to($url);
/*
// Track the referral/campaign code
if (Input::has('rc')) {
session([SESSION_REFERRAL_CODE => Input::get('rc')]);
if (Request::has('rc')) {
session([SESSION_REFERRAL_CODE => \Request::input('rc')]);
}
if (Auth::check()) {
$redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'invoices/create';
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
$redirectTo = \Request::input('redirect_to') ? SITE_URL . '/' . ltrim(\Request::input('redirect_to'), '/') : 'invoices/create';
return Redirect::to($redirectTo)->with('sign_up', \Request::input('sign_up'));
} else {
return View::make('public.invoice_now');
}
*/
}
/**
@ -115,7 +124,7 @@ class HomeController extends BaseController
*/
public function logError()
{
return Utils::logError(Input::get('error'), 'JavaScript');
return Utils::logError(\Request::input('error'), 'JavaScript');
}
/**

View file

@ -6,7 +6,6 @@ use Illuminate\Http\Request;
use App\Services\ImportService;
use App\Jobs\ImportData;
use Exception;
use Input;
use Redirect;
use Session;
use Utils;
@ -26,7 +25,7 @@ class ImportController extends BaseController
return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.confirm_account_to_import'));
}
$source = Input::get('source');
$source = \Request::input('source');
$files = [];
$timestamp = time();
@ -70,8 +69,8 @@ class ImportController extends BaseController
'timestamp' => $timestamp,
]);
} elseif ($source === IMPORT_JSON) {
$includeData = filter_var(Input::get('data'), FILTER_VALIDATE_BOOLEAN);
$includeSettings = filter_var(Input::get('settings'), FILTER_VALIDATE_BOOLEAN);
$includeData = filter_var(\Request::input('data'), FILTER_VALIDATE_BOOLEAN);
$includeSettings = filter_var(\Request::input('settings'), FILTER_VALIDATE_BOOLEAN);
if (config('queue.default') === 'sync') {
$results = $this->importService->importJSON($files[IMPORT_JSON], $includeData, $includeSettings);
$message = $this->importService->presentResults($results, $includeSettings);
@ -109,9 +108,9 @@ class ImportController extends BaseController
public function doImportCSV()
{
try {
$map = Input::get('map');
$headers = Input::get('headers');
$timestamp = Input::get('timestamp');
$map = \Request::input('map');
$headers = \Request::input('headers');
$timestamp = \Request::input('timestamp');
if (config('queue.default') === 'sync') {
$results = $this->importService->importCSV($map, $headers, $timestamp);

View file

@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use App\Models\Subscription;
use Auth;
use Input;
use Response;
use Utils;
@ -18,7 +17,7 @@ class IntegrationController extends BaseAPIController
*/
public function subscribe()
{
$eventId = Utils::lookupEventId(trim(Input::get('event')));
$eventId = Utils::lookupEventId(trim(\Request::input('event')));
if (! $eventId) {
return Response::json('Event is invalid', 500);
@ -26,7 +25,7 @@ class IntegrationController extends BaseAPIController
$subscription = Subscription::createNew();
$subscription->event_id = $eventId;
$subscription->target_url = trim(Input::get('target_url'));
$subscription->target_url = trim(\Request::input('target_url'));
$subscription->save();
if (! $subscription->id) {

View file

@ -17,7 +17,6 @@ use App\Ninja\Repositories\PaymentRepository;
use App\Services\InvoiceService;
use App\Services\PaymentService;
use Auth;
use Input;
use Response;
use Utils;
use Validator;
@ -64,12 +63,12 @@ class InvoiceApiController extends BaseAPIController
->orderBy('updated_at', 'desc');
// Filter by invoice number
if ($invoiceNumber = Input::get('invoice_number')) {
if ($invoiceNumber = \Request::input('invoice_number')) {
$invoices->whereInvoiceNumber($invoiceNumber);
}
// Fllter by status
if ($statusId = Input::get('status_id')) {
if ($statusId = \Request::input('status_id')) {
$invoices->where('invoice_status_id', '>=', $statusId);
}
@ -134,7 +133,7 @@ class InvoiceApiController extends BaseAPIController
*/
public function store(CreateInvoiceAPIRequest $request)
{
$data = Input::all();
$data = \Request::all();
$error = null;
if (isset($data['email'])) {

View file

@ -25,8 +25,8 @@ use App\Services\RecurringInvoiceService;
use Auth;
use Cache;
use DB;
use Input;
use Redirect;
use Request;
use Session;
use URL;
use Utils;
@ -68,7 +68,7 @@ class InvoiceController extends BaseController
public function getDatatable($clientPublicId = null)
{
$accountId = Auth::user()->account_id;
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_INVOICE, $search);
}
@ -76,7 +76,7 @@ class InvoiceController extends BaseController
public function getRecurringDatatable($clientPublicId = null)
{
$accountId = Auth::user()->account_id;
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
return $this->recurringInvoiceService->getDatatable($accountId, $clientPublicId, ENTITY_RECURRING_INVOICE, $search);
}
@ -317,7 +317,7 @@ class InvoiceController extends BaseController
}
return [
'data' => Input::old('data'),
'data' => Request::old('data'),
'account' => Auth::user()->account->load('country'),
'products' => Product::scope()->orderBy('product_key')->get(),
'taxRateOptions' => $taxRateOptions,
@ -345,8 +345,8 @@ class InvoiceController extends BaseController
$data = $request->input();
$data['documents'] = $request->file('documents');
$action = Input::get('action');
$entityType = Input::get('entityType');
$action = \Request::input('action');
$entityType = \Request::input('entityType');
$invoice = $this->invoiceService->save($data);
$entityType = $invoice->getEntityType();
@ -379,8 +379,8 @@ class InvoiceController extends BaseController
$data = $request->input();
$data['documents'] = $request->file('documents');
$action = Input::get('action');
$entityType = Input::get('entityType');
$action = \Request::input('action');
$entityType = \Request::input('entityType');
$invoice = $this->invoiceService->save($data, $request->entity());
$entityType = $invoice->getEntityType();
@ -402,14 +402,14 @@ class InvoiceController extends BaseController
private function emailInvoice($invoice)
{
$reminder = Input::get('reminder');
$template = Input::get('template');
$pdfUpload = Utils::decodePDF(Input::get('pdfupload'));
$reminder = \Request::input('reminder');
$template = \Request::input('template');
$pdfUpload = Utils::decodePDF(\Request::input('pdfupload'));
$entityType = $invoice->getEntityType();
if (filter_var(Input::get('save_as_default'), FILTER_VALIDATE_BOOLEAN)) {
if (filter_var(\Request::input('save_as_default'), FILTER_VALIDATE_BOOLEAN)) {
$account = Auth::user()->account;
$account->setTemplateDefaults(Input::get('template_type'), $template['subject'], $template['body']);
$account->setTemplateDefaults(\Request::input('template_type'), $template['subject'], $template['body']);
}
if (! Auth::user()->confirmed) {
@ -490,8 +490,8 @@ class InvoiceController extends BaseController
*/
public function bulk($entityType = ENTITY_INVOICE)
{
$action = Input::get('bulk_action') ?: Input::get('action');
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
$action = \Request::input('bulk_action') ?: \Request::input('action');
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
$count = $this->invoiceService->bulk($ids, $action);
if ($count > 0) {

View file

@ -6,15 +6,19 @@ use App\Http\Controllers\BaseController;
use App\Http\Requests\MigrationAuthRequest;
use App\Http\Requests\MigrationCompaniesRequest;
use App\Http\Requests\MigrationEndpointRequest;
use App\Http\Requests\MigrationForwardRequest;
use App\Http\Requests\MigrationTypeRequest;
use App\Jobs\HostedMigration;
use App\Libraries\Utils;
use App\Models\Account;
use App\Services\Migration\AuthService;
use App\Services\Migration\CompanyService;
use App\Services\Migration\CompleteService;
use App\Traits\GenerateMigrationResources;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Validator;
class StepsController extends BaseController
{
@ -45,6 +49,17 @@ class StepsController extends BaseController
*/
public function start()
{
if(Utils::isNinja()){
session()->put('MIGRATION_ENDPOINT', 'https://v5-app1.invoicing.co');
// session()->put('MIGRATION_ENDPOINT', 'http://ninja.test:8000');
session()->put('MIGRATION_ACCOUNT_TOKEN','');
session()->put('MIGRAITON_API_SECRET', null);
return $this->companies();
}
return view('migration.start');
}
@ -65,14 +80,17 @@ class StepsController extends BaseController
{
session()->put('MIGRATION_TYPE', $request->option);
if ($request->option == 0) {
session()->put('MIGRATION_ENDPOINT', 'https://invoicing.co');
if ($request->option == 0 || $request->option == '0') {
return redirect(
url('/migration/auth')
url('/migration/companies?hosted=true')
);
//old
// return redirect(
// url('/migration/auth')
// );
// return redirect(
// url('/migration/endpoint')
// );
@ -83,8 +101,39 @@ class StepsController extends BaseController
);
}
public function forwardUrl(Request $request)
{
$rules = [
'url' => 'nullable|url',
];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return back()
->withErrors($validator)
->withInput();
}
$account_settings = \Auth::user()->account->account_email_settings;
if(strlen($request->input('url')) == 0) {
$account_settings->is_disabled = false;
}
else {
$account_settings->is_disabled = true;
}
$account_settings->forward_url_for_v5 = rtrim($request->input('url'),'/');
$account_settings->save();
return back();
}
public function endpoint()
{
if ($this->shouldGoBack('endpoint')) {
return redirect(
url($this->access['endpoint']['redirect'])
@ -175,23 +224,39 @@ class StepsController extends BaseController
url($this->access['companies']['redirect'])
);
}
$bool = true;
if(Utils::isNinja())
{
$this->dispatch(new HostedMigration(auth()->user(), $request->all(), config('database.default')));
return view('migration.completed');
}
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')));
try {
$migrationData = $this->generateMigrationData($request->all());
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
->data($migrationData)
$completeService->data($migrationData)
->endpoint(session('MIGRATION_ENDPOINT'))
->start();
}
finally {
catch(\Exception $e){
info($e->getMessage());
return view('migration.completed', ['customMessage' => $e->getMessage()]);
}
if ($completeService->isSuccessful()) {
return view('migration.completed');
}
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
}
}
public function completed()
@ -257,6 +322,7 @@ class StepsController extends BaseController
'products' => $this->getProducts(),
'credits' => $this->getCreditsNotes(),
'invoices' => $this->getInvoices(),
'recurring_expenses' => $this->getRecurringExpenses(),
'recurring_invoices' => $this->getRecurringInvoices(),
'quotes' => $this->getQuotes(),
'payments' => array_merge($this->getPayments(), $this->getCredits()),

View file

@ -11,13 +11,13 @@ use App\Libraries\CurlUtils;
use Auth;
use Cache;
use CreditCard;
use Input;
use Omnipay;
use Session;
use URL;
use Utils;
use Validator;
use View;
use Request;
class NinjaController extends BaseController
{
@ -91,18 +91,18 @@ class NinjaController extends BaseController
*/
public function show_license_payment()
{
if (Input::has('return_url')) {
session(['return_url' => Input::get('return_url')]);
if (\Request::has('return_url')) {
session(['return_url' => \Request::input('return_url')]);
}
if (Input::has('affiliate_key')) {
if ($affiliate = Affiliate::where('affiliate_key', '=', Input::get('affiliate_key'))->first()) {
if (\Request::has('affiliate_key')) {
if ($affiliate = Affiliate::where('affiliate_key', '=', \Request::input('affiliate_key'))->first()) {
session(['affiliate_id' => $affiliate->id]);
}
}
if (Input::has('product_id')) {
session(['product_id' => Input::get('product_id')]);
if (\Request::has('product_id')) {
session(['product_id' => \Request::input('product_id')]);
} elseif (! Session::has('product_id')) {
session(['product_id' => PRODUCT_ONE_CLICK_INSTALL]);
}
@ -111,8 +111,8 @@ class NinjaController extends BaseController
return Utils::fatalError();
}
if (Utils::isNinjaDev() && Input::has('test_mode')) {
session(['test_mode' => Input::get('test_mode')]);
if (Utils::isNinjaDev() && \Request::has('test_mode')) {
session(['test_mode' => \Request::input('test_mode')]);
}
$account = $this->accountRepo->getNinjaAccount();
@ -167,7 +167,7 @@ class NinjaController extends BaseController
'country_id' => 'required',
];
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return redirect()->to('license')
@ -185,7 +185,7 @@ class NinjaController extends BaseController
if ($testMode) {
$ref = 'TEST_MODE';
} else {
$details = self::getLicensePaymentDetails(Input::all(), $affiliate);
$details = self::getLicensePaymentDetails(Request::all(), $affiliate);
$gateway = Omnipay::create($accountGateway->gateway->provider);
$gateway->initialize((array) $accountGateway->getConfig());
@ -203,9 +203,9 @@ class NinjaController extends BaseController
$licenseKey = Utils::generateLicense();
$license = new License();
$license->first_name = Input::get('first_name');
$license->last_name = Input::get('last_name');
$license->email = Input::get('email');
$license->first_name = \Request::input('first_name');
$license->last_name = \Request::input('last_name');
$license->email = \Request::input('email');
$license->transaction_reference = $ref;
$license->license_key = $licenseKey;
$license->affiliate_id = Session::get('affiliate_id');
@ -241,8 +241,8 @@ class NinjaController extends BaseController
*/
public function claim_license()
{
$licenseKey = Input::get('license_key');
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
$licenseKey = \Request::input('license_key');
$productId = \Request::input('product_id', PRODUCT_ONE_CLICK_INSTALL);
// add in dashes
if (strlen($licenseKey) == 20) {

View file

@ -19,12 +19,12 @@ use App\Services\PaymentService;
use Auth;
use Crawler;
use Exception;
use Input;
use Session;
use URL;
use Utils;
use Validator;
use View;
use Request;
/**
* Class OnlinePaymentController.
@ -114,7 +114,7 @@ class OnlinePaymentController extends BaseController
}
try {
return $paymentDriver->startPurchase(Input::all(), $sourceId);
return $paymentDriver->startPurchase(Request::all(), $sourceId);
} catch (Exception $exception) {
return $this->error($paymentDriver, $exception);
}
@ -202,12 +202,12 @@ class OnlinePaymentController extends BaseController
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
if ($error = Input::get('error_description') ?: Input::get('error')) {
if ($error = \Request::input('error_description') ?: \Request::input('error')) {
return $this->error($paymentDriver, $error);
}
try {
if ($paymentDriver->completeOffsitePurchase(Input::all())) {
if ($paymentDriver->completeOffsitePurchase(Request::all())) {
Session::flash('message', trans('texts.applied_payment'));
}
@ -332,7 +332,7 @@ class OnlinePaymentController extends BaseController
$paymentDriver = $accountGateway->paymentDriver();
try {
$result = $paymentDriver->handleWebHook(Input::all());
$result = $paymentDriver->handleWebHook(Request::all());
return response()->json(['message' => $result]);
} catch (Exception $exception) {
@ -350,8 +350,8 @@ class OnlinePaymentController extends BaseController
return redirect()->to(NINJA_WEB_URL, 301);
}
$account = Account::whereAccountKey(Input::get('account_key'))->first();
$redirectUrl = Input::get('redirect_url');
$account = Account::whereAccountKey(\Request::input('account_key'))->first();
$redirectUrl = \Request::input('redirect_url');
$failureUrl = URL::previous();
if (! $account || ! $account->enable_buy_now_buttons || ! $account->hasFeature(FEATURE_BUY_NOW_BUTTONS)) {
@ -360,7 +360,7 @@ class OnlinePaymentController extends BaseController
Auth::onceUsingId($account->users[0]->id);
$account->loadLocalizationSettings();
$product = Product::scope(Input::get('product_id'))->first();
$product = Product::scope(\Request::input('product_id'))->first();
if (! $product) {
return redirect()->to("{$failureUrl}/?error=invalid product");
@ -368,7 +368,7 @@ class OnlinePaymentController extends BaseController
// check for existing client using contact_key
$client = false;
if ($contactKey = Input::get('contact_key')) {
if ($contactKey = \Request::input('contact_key')) {
$client = Client::scope()->whereHas('contacts', function ($query) use ($contactKey) {
$query->where('contact_key', $contactKey);
})->first();
@ -380,7 +380,7 @@ class OnlinePaymentController extends BaseController
'email' => 'email|string|max:100',
];
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return redirect()->to("{$failureUrl}/?error=" . $validator->errors()->first());
}
@ -404,17 +404,17 @@ class OnlinePaymentController extends BaseController
$data = [
'client_id' => $client->id,
'is_recurring' => filter_var(Input::get('is_recurring'), FILTER_VALIDATE_BOOLEAN),
'is_public' => filter_var(Input::get('is_recurring'), FILTER_VALIDATE_BOOLEAN),
'frequency_id' => Input::get('frequency_id'),
'auto_bill_id' => Input::get('auto_bill_id'),
'start_date' => Input::get('start_date', date('Y-m-d')),
'is_recurring' => filter_var(\Request::input('is_recurring'), FILTER_VALIDATE_BOOLEAN),
'is_public' => filter_var(\Request::input('is_recurring'), FILTER_VALIDATE_BOOLEAN),
'frequency_id' => \Request::input('frequency_id'),
'auto_bill_id' => \Request::input('auto_bill_id'),
'start_date' => \Request::input('start_date', date('Y-m-d')),
'tax_rate1' => $account->tax_rate1,
'tax_name1' => $account->tax_name1 ?: '',
'tax_rate2' => $account->tax_rate2,
'tax_name2' => $account->tax_name2 ?: '',
'custom_text_value1' => Input::get('custom_invoice1'),
'custom_text_value2' => Input::get('custom_invoice2'),
'custom_text_value1' => \Request::input('custom_invoice1'),
'custom_text_value2' => \Request::input('custom_invoice2'),
'invoice_items' => [[
'product_key' => $product->product_key,
'notes' => $product->notes,
@ -424,8 +424,8 @@ class OnlinePaymentController extends BaseController
'tax_name1' => $product->tax_name1 ?: '',
'tax_rate2' => $product->tax_rate2,
'tax_name2' => $product->tax_name2 ?: '',
'custom_value1' => Input::get('custom_product1') ?: $product->custom_value1,
'custom_value2' => Input::get('custom_product2') ?: $product->custom_value2,
'custom_value1' => \Request::input('custom_product1') ?: $product->custom_value1,
'custom_value2' => \Request::input('custom_product2') ?: $product->custom_value2,
]],
];
$invoice = $invoiceService->save($data);
@ -445,7 +445,7 @@ class OnlinePaymentController extends BaseController
$link = $invitation->getLink();
}
if (filter_var(Input::get('return_link'), FILTER_VALIDATE_BOOLEAN)) {
if (filter_var(\Request::input('return_link'), FILTER_VALIDATE_BOOLEAN)) {
return $link;
} else {
return redirect()->to($link);

View file

@ -10,7 +10,6 @@ use App\Models\Payment;
use App\Ninja\Mailers\ContactMailer;
use App\Ninja\Repositories\PaymentRepository;
use App\Services\PaymentService;
use Input;
use Response;
class PaymentApiController extends BaseAPIController
@ -113,7 +112,7 @@ class PaymentApiController extends BaseAPIController
$payment = $this->paymentService->save($request->input(), null, $request->invoice);
if (Input::get('email_receipt')) {
if (\Request::input('email_receipt')) {
$this->contactMailer->sendPaymentConfirmation($payment);
}
@ -160,7 +159,7 @@ class PaymentApiController extends BaseAPIController
$data['public_id'] = $publicId;
$payment = $this->paymentRepo->save($data, $request->entity());
if (Input::get('email_receipt')) {
if (\Request::input('email_receipt')) {
$this->contactMailer->sendPaymentConfirmation($payment);
}

View file

@ -16,10 +16,10 @@ use App\Services\PaymentService;
use Auth;
use Cache;
use DropdownButton;
use Input;
use Session;
use Utils;
use View;
use Request;
class PaymentController extends BaseController
{
@ -79,7 +79,7 @@ class PaymentController extends BaseController
*/
public function getDatatable($clientPublicId = null)
{
return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
return $this->paymentService->getDatatable($clientPublicId, \Request::input('sSearch'));
}
/**
@ -98,8 +98,8 @@ class PaymentController extends BaseController
->with('client', 'invoice_status')
->orderBy('invoice_number')->get();
$clientPublicId = Input::old('client') ? Input::old('client') : ($request->client_id ?: 0);
$invoicePublicId = Input::old('invoice') ? Input::old('invoice') : ($request->invoice_id ?: 0);
$clientPublicId = Request::old('client') ? Request::old('client') : ($request->client_id ?: 0);
$invoicePublicId = Request::old('invoice') ? Request::old('invoice') : ($request->invoice_id ?: 0);
$totalCredit = false;
if ($clientPublicId && $client = Client::scope($clientPublicId)->first()) {
@ -118,7 +118,7 @@ class PaymentController extends BaseController
'method' => 'POST',
'url' => 'payments',
'title' => trans('texts.new_payment'),
'paymentTypeId' => Input::get('paymentTypeId'),
'paymentTypeId' => \Request::input('paymentTypeId'),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'totalCredit' => $totalCredit,
];
@ -211,7 +211,7 @@ class PaymentController extends BaseController
$payment = $this->paymentService->save($input, null, $request->invoice);
if (Input::get('email_receipt')) {
if (\Request::input('email_receipt')) {
$this->contactMailer->sendPaymentConfirmation($payment);
Session::flash('message', trans($credit ? 'texts.created_payment_and_credit_emailed_client' : 'texts.created_payment_emailed_client'));
} else {
@ -244,8 +244,8 @@ class PaymentController extends BaseController
*/
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
if ($action === 'email') {
$payment = Payment::scope($ids)->withArchived()->first();
@ -253,8 +253,8 @@ class PaymentController extends BaseController
Session::flash('message', trans('texts.emailed_payment'));
} else {
$count = $this->paymentService->bulk($ids, $action, [
'refund_amount' => Input::get('refund_amount'),
'refund_email' => Input::get('refund_email'),
'refund_amount' => \Request::input('refund_amount'),
'refund_email' => \Request::input('refund_email'),
]);
if ($count > 0) {
$message = Utils::pluralize($action == 'refund' ? 'refunded_payment' : $action.'d_payment', $count);

View file

@ -115,7 +115,7 @@ class PaymentTermApiController extends BaseAPIController
$paymentTerm = PaymentTerm::createNew();
$paymentTerm->num_days = Utils::parseInt(Input::get('num_days'));
$paymentTerm->num_days = Utils::parseInt(\Request::input('num_days'));
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
$paymentTerm->save();

View file

@ -7,7 +7,6 @@ use App\Http\Requests\UpdatePaymentTermRequest;
use App\Models\PaymentTerm;
use App\Services\PaymentTermService;
use Auth;
use Input;
use Redirect;
use Session;
use URL;
@ -114,7 +113,7 @@ class PaymentTermController extends BaseController
$paymentTerm = PaymentTerm::createNew();
}
$paymentTerm->num_days = Utils::parseInt(Input::get('num_days'));
$paymentTerm->num_days = Utils::parseInt(\Request::input('num_days'));
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
$paymentTerm->save();
@ -129,8 +128,8 @@ class PaymentTermController extends BaseController
*/
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->paymentTermService->bulk($ids, $action);
Session::flash('message', trans('texts.archived_payment_term'));

View file

@ -12,7 +12,6 @@ use App\Ninja\Repositories\ProductRepository;
use App\Services\ProductService;
use Auth;
use Illuminate\Auth\Access\AuthorizationException;
use Input;
use Redirect;
use Session;
use URL;
@ -72,7 +71,7 @@ class ProductController extends BaseController
*/
public function getDatatable()
{
return $this->productService->getDatatable(Auth::user()->account_id, Input::get('sSearch'));
return $this->productService->getDatatable(Auth::user()->account_id, \Request::input('sSearch'));
}
public function cloneProduct(ProductRequest $request, $publicId)
@ -167,7 +166,7 @@ class ProductController extends BaseController
$product = Product::createNew();
}
$this->productRepo->save(Input::all(), $product);
$this->productRepo->save(\Request::all(), $product);
$message = $productPublicId ? trans('texts.updated_product') : trans('texts.created_product');
Session::flash('message', $message);
@ -189,8 +188,8 @@ class ProductController extends BaseController
*/
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
if ($action == 'invoice') {
$products = Product::scope($ids)->get();

View file

@ -9,7 +9,6 @@ use App\Models\Project;
use App\Ninja\Repositories\ProjectRepository;
use App\Services\ProjectService;
use Auth;
use Input;
use Session;
use View;

View file

@ -12,7 +12,6 @@ use App\Ninja\Datatables\ProjectDatatable;
use App\Ninja\Repositories\ProjectRepository;
use App\Services\ProjectService;
use Auth;
use Input;
use Session;
use View;
@ -44,7 +43,7 @@ class ProjectController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterIdByEntity(ENTITY_PROJECT);
return $this->projectService->getDatatable($search, $userId);
@ -114,7 +113,7 @@ class ProjectController extends BaseController
Session::flash('message', trans('texts.updated_project'));
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore', 'invoice'])) {
return self::bulk();
}
@ -124,8 +123,8 @@ class ProjectController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
if ($action == 'invoice') {
$data = [];

View file

@ -11,7 +11,6 @@ use App\Ninja\Datatables\ProposalCategoryDatatable;
use App\Ninja\Repositories\ProposalCategoryRepository;
use App\Services\ProposalCategoryService;
use Auth;
use Input;
use Session;
use View;
@ -43,7 +42,7 @@ class ProposalCategoryController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterId();
return $this->proposalCategoryService->getDatatable($search, $userId);
@ -102,7 +101,7 @@ class ProposalCategoryController extends BaseController
Session::flash('message', trans('texts.updated_proposal_category'));
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore'])) {
return self::bulk();
}
@ -112,8 +111,8 @@ class ProposalCategoryController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->proposalCategoryService->bulk($ids, $action);

View file

@ -15,7 +15,6 @@ use App\Ninja\Datatables\ProposalDatatable;
use App\Ninja\Repositories\ProposalRepository;
use App\Services\ProposalService;
use Auth;
use Input;
use Session;
use View;
@ -50,7 +49,7 @@ class ProposalController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
//$userId = Auth::user()->filterId();
$userId = Auth::user()->filterIdByEntity(ENTITY_PROPOSAL);
@ -117,7 +116,7 @@ class ProposalController extends BaseController
public function store(CreateProposalRequest $request)
{
$proposal = $this->proposalService->save($request->input());
$action = Input::get('action');
$action = \Request::input('action');
if ($action == 'email') {
$this->dispatch(new SendInvoiceEmail($proposal->invoice, auth()->user()->id, false, false, $proposal));
@ -132,7 +131,7 @@ class ProposalController extends BaseController
public function update(UpdateProposalRequest $request)
{
$proposal = $this->proposalService->save($request->input(), $request->entity());
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore'])) {
return self::bulk();
@ -150,8 +149,8 @@ class ProposalController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action') ?: Input::get('action');
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
$action = \Request::input('bulk_action') ?: \Request::input('action');
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
$count = $this->proposalService->bulk($ids, $action);

View file

@ -12,7 +12,6 @@ use App\Ninja\Datatables\ProposalSnippetDatatable;
use App\Ninja\Repositories\ProposalSnippetRepository;
use App\Services\ProposalSnippetService;
use Auth;
use Input;
use Session;
use View;
@ -44,7 +43,7 @@ class ProposalSnippetController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterId();
return $this->proposalSnippetService->getDatatable($search, $userId);
@ -107,7 +106,7 @@ class ProposalSnippetController extends BaseController
Session::flash('message', trans('texts.updated_proposal_snippet'));
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore'])) {
return self::bulk();
}
@ -117,8 +116,8 @@ class ProposalSnippetController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->proposalSnippetService->bulk($ids, $action);

View file

@ -11,7 +11,6 @@ use App\Ninja\Datatables\ProposalTemplateDatatable;
use App\Ninja\Repositories\ProposalTemplateRepository;
use App\Services\ProposalTemplateService;
use Auth;
use Input;
use Session;
use View;
@ -43,7 +42,7 @@ class ProposalTemplateController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterId();
return $this->proposalTemplateService->getDatatable($search, $userId);
@ -147,7 +146,7 @@ class ProposalTemplateController extends BaseController
Session::flash('message', trans('texts.updated_proposal_template'));
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore'])) {
return self::bulk();
}
@ -157,8 +156,8 @@ class ProposalTemplateController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->proposalTemplateService->bulk($ids, $action);

View file

@ -19,7 +19,6 @@ use App\Ninja\Repositories\InvoiceRepository;
use App\Services\InvoiceService;
use Auth;
use Cache;
use Input;
use Redirect;
use Session;
use Utils;
@ -60,7 +59,7 @@ class QuoteController extends BaseController
public function getDatatable($clientPublicId = null)
{
$accountId = Auth::user()->account_id;
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_QUOTE, $search);
}
@ -82,7 +81,7 @@ class QuoteController extends BaseController
$data = [
'entityType' => $invoice->getEntityType(),
'invoice' => $invoice,
'data' => Input::old('data'),
'data' => \Request::old('data'),
'method' => 'POST',
'url' => 'invoices',
'title' => trans('texts.new_quote'),
@ -115,9 +114,9 @@ class QuoteController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action') ?: Input::get('action');
$action = \Request::input('bulk_action') ?: \Request::input('action');
;
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
if ($action == 'convert') {
$invoice = Invoice::with('invoice_items')->scope($ids)->firstOrFail();

View file

@ -13,10 +13,10 @@ use App\Ninja\Datatables\RecurringExpenseDatatable;
use App\Ninja\Repositories\RecurringExpenseRepository;
use App\Services\RecurringExpenseService;
use Auth;
use Input;
use Session;
use View;
use Cache;
use Request;
class RecurringExpenseController extends BaseController
{
@ -46,7 +46,7 @@ class RecurringExpenseController extends BaseController
public function getDatatable($expensePublicId = null)
{
$search = Input::get('sSearch');
$search = \Request::input('sSearch');
$userId = Auth::user()->filterId();
return $this->recurringExpenseService->getDatatable($search, $userId);
@ -61,7 +61,7 @@ class RecurringExpenseController extends BaseController
}
$data = [
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
'vendorPublicId' => Request::old('vendor') ? Request::old('vendor') : $request->vendor_id,
'expense' => null,
'method' => 'POST',
'url' => 'recurring_expenses',
@ -113,7 +113,7 @@ class RecurringExpenseController extends BaseController
private static function getViewModel()
{
return [
'data' => Input::old('data'),
'data' => Request::old('data'),
'account' => Auth::user()->account,
'categories' => ExpenseCategory::whereAccountId(Auth::user()->account_id)->withArchived()->orderBy('name')->get(),
'taxRates' => TaxRate::scope()->whereIsInclusive(false)->orderBy('name')->get(),
@ -136,7 +136,7 @@ class RecurringExpenseController extends BaseController
Session::flash('message', trans('texts.updated_recurring_expense'));
if (in_array(Input::get('action'), ['archive', 'delete', 'restore'])) {
if (in_array(\Request::input('action'), ['archive', 'delete', 'restore'])) {
return self::bulk();
}
@ -145,8 +145,8 @@ class RecurringExpenseController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->recurringExpenseService->bulk($ids, $action);
if ($count > 0) {

View file

@ -8,7 +8,6 @@ use App\Jobs\RunReport;
use App\Models\Account;
use App\Models\ScheduledReport;
use Auth;
use Input;
use Utils;
use View;
use Carbon;
@ -58,14 +57,14 @@ class ReportController extends BaseController
return redirect('/');
}
$action = Input::get('action');
$format = Input::get('format');
$action = \Request::input('action');
$format = \Request::input('format');
if (Input::get('report_type')) {
$reportType = Input::get('report_type');
$dateField = Input::get('date_field');
$startDate = date_create(Input::get('start_date'));
$endDate = date_create(Input::get('end_date'));
if (\Request::input('report_type')) {
$reportType = \Request::input('report_type');
$dateField = \Request::input('date_field');
$startDate = date_create(\Request::input('start_date'));
$endDate = date_create(\Request::input('end_date'));
} else {
$reportType = ENTITY_INVOICE;
$dateField = FILTER_INVOICE_DATE;

View file

@ -5,7 +5,6 @@ namespace App\Http\Controllers;
use App\Models\Subscription;
use App\Services\SubscriptionService;
use Auth;
use Input;
use Redirect;
use Session;
use URL;
@ -107,8 +106,8 @@ class SubscriptionController extends BaseController
*/
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->subscriptionService->bulk($ids, $action);
@ -137,7 +136,7 @@ class SubscriptionController extends BaseController
$subscriptionPublicId = $subscription->public_id;
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(\Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to($subscriptionPublicId ? 'subscriptions/edit' : 'subscriptions/create')->withInput()->withErrors($validator);

View file

@ -8,7 +8,6 @@ use App\Models\Task;
use App\Ninja\Repositories\TaskRepository;
use App\Ninja\Transformers\TaskTransformer;
use Auth;
use Input;
use Response;
class TaskApiController extends BaseAPIController
@ -103,7 +102,7 @@ class TaskApiController extends BaseAPIController
*/
public function store()
{
$data = Input::all();
$data = \Request::all();
$taskId = isset($data['id']) ? $data['id'] : false;
if (isset($data['client_id']) && $data['client_id']) {
@ -143,7 +142,7 @@ class TaskApiController extends BaseAPIController
$task = $this->taskRepo->save($taskId, $data);
$task = Task::scope($task->public_id)->with('client')->first();
$transformer = new TaskTransformer(Auth::user()->account, Input::get('serializer'));
$transformer = new TaskTransformer(Auth::user()->account, \Request::input('serializer'));
$data = $this->createItem($task, $transformer, 'task');
return $this->response($data);
@ -185,7 +184,7 @@ class TaskApiController extends BaseAPIController
$task = $request->entity();
$task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Input::all());
$task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Request::all());
return $this->itemResponse($task);
}

View file

@ -15,7 +15,6 @@ use App\Ninja\Repositories\TaskRepository;
use App\Services\TaskService;
use Auth;
use DropdownButton;
use Input;
use Redirect;
use Request;
use Session;
@ -86,7 +85,7 @@ class TaskController extends BaseController
*/
public function getDatatable($clientPublicId = null, $projectPublicId = null)
{
return $this->taskService->getDatatable($clientPublicId, $projectPublicId, Input::get('sSearch'));
return $this->taskService->getDatatable($clientPublicId, $projectPublicId, \Request::input('sSearch'));
}
/**
@ -126,8 +125,8 @@ class TaskController extends BaseController
$data = [
'task' => null,
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
'projectPublicId' => Input::old('project_id') ? Input::old('project_id') : ($request->project_id ?: 0),
'clientPublicId' => Request::old('client') ? Request::old('client') : ($request->client_id ?: 0),
'projectPublicId' => Request::old('project_id') ? Request::old('project_id') : ($request->project_id ?: 0),
'method' => 'POST',
'url' => 'tasks',
'title' => trans('texts.new_task'),
@ -229,7 +228,7 @@ class TaskController extends BaseController
*/
private function save($request, $publicId = null)
{
$action = Input::get('action');
$action = \Request::input('action');
if (in_array($action, ['archive', 'delete', 'restore'])) {
return self::bulk();
@ -260,8 +259,8 @@ class TaskController extends BaseController
*/
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ?: (Input::get('id') ?: Input::get('ids'));
$action = \Request::input('action');
$ids = \Request::input('public_id') ?: (\Request::input('id') ?: \Request::input('ids'));
$referer = Request::server('HTTP_REFERER');
if (in_array($action, ['resume', 'stop'])) {
@ -277,7 +276,7 @@ class TaskController extends BaseController
Session::flash('message', trans('texts.updated_task_status'));
return $this->returnBulk($this->entityType, $action, $ids);
} elseif ($action == 'invoice' || $action == 'add_to_invoice') {
$tasks = Task::scope($ids)->with('account', 'client', 'project')->orderBy('project_id', 'id')->get();
$tasks = Task::scope($ids)->with('account', 'client', 'project')->orderBy('project_id')->orderBy('id')->get();
$clientPublicId = false;
$data = [];
@ -315,7 +314,7 @@ class TaskController extends BaseController
if ($action == 'invoice') {
return Redirect::to("invoices/create/{$clientPublicId}")->with('tasks', $data);
} else {
$invoiceId = Input::get('invoice_id');
$invoiceId = \Request::input('invoice_id');
return Redirect::to("invoices/{$invoiceId}/edit")->with('tasks', $data);
}

View file

@ -8,7 +8,6 @@ use App\Models\TaxRate;
use App\Ninja\Repositories\TaxRateRepository;
use App\Services\TaxRateService;
use Auth;
use Input;
use Redirect;
use Session;
use URL;
@ -81,8 +80,8 @@ class TaxRateController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->taxRateService->bulk($ids, $action);
Session::flash('message', trans('texts.archived_tax_rate'));

View file

@ -5,7 +5,6 @@ namespace App\Http\Controllers;
use App\Models\AccountToken;
use App\Services\TokenService;
use Auth;
use Input;
use Redirect;
use Session;
use URL;
@ -108,8 +107,8 @@ class TokenController extends BaseController
*/
public function bulk()
{
$action = Input::get('bulk_action');
$ids = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$ids = \Request::input('bulk_public_id');
$count = $this->tokenService->bulk($ids, $action);
Session::flash('message', trans('texts.archived_token'));
@ -134,17 +133,17 @@ class TokenController extends BaseController
->where('public_id', '=', $tokenPublicId)->firstOrFail();
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(\Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to($tokenPublicId ? 'tokens/edit' : 'tokens/create')->withInput()->withErrors($validator);
}
if ($tokenPublicId) {
$token->name = trim(Input::get('name'));
$token->name = trim(\Request::input('name'));
} else {
$token = AccountToken::createNew();
$token->name = trim(Input::get('name'));
$token->name = trim(\Request::input('name'));
$token->token = strtolower(str_random(RANDOM_KEY_LENGTH));
}

View file

@ -8,7 +8,6 @@ use App\Ninja\Mailers\UserMailer;
use App\Ninja\Repositories\AccountRepository;
use App\Services\UserService;
use Auth;
use Input;
use Password;
use Redirect;
use Request;
@ -131,8 +130,8 @@ class UserController extends BaseController
public function bulk()
{
$action = Input::get('bulk_action');
$id = Input::get('bulk_public_id');
$action = \Request::input('bulk_action');
$id = \Request::input('bulk_public_id');
$user = User::where('account_id', '=', Auth::user()->account_id)
->where('public_id', '=', $id)
@ -184,7 +183,7 @@ class UserController extends BaseController
$rules['email'] = 'required|email|unique:users';
}
$validator = Validator::make(Input::all(), $rules);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
@ -192,20 +191,20 @@ class UserController extends BaseController
->withInput();
}
if (! \App\Models\LookupUser::validateField('email', Input::get('email'), $user)) {
if (! \App\Models\LookupUser::validateField('email', \Request::input('email'), $user)) {
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
->withError(trans('texts.email_taken'))
->withInput();
}
if ($userPublicId) {
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->username = trim(Input::get('email'));
$user->email = trim(Input::get('email'));
$user->first_name = trim(\Request::input('first_name'));
$user->last_name = trim(\Request::input('last_name'));
$user->username = trim(\Request::input('email'));
$user->email = trim(\Request::input('email'));
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
$user->is_admin = boolval(Input::get('is_admin'));
$user->permissions = self::formatUserPermissions(Input::get('permissions'));
$user->is_admin = boolval(\Request::input('is_admin'));
$user->permissions = self::formatUserPermissions(\Request::input('permissions'));
}
} else {
$lastUser = User::withTrashed()->where('account_id', '=', Auth::user()->account_id)
@ -213,23 +212,23 @@ class UserController extends BaseController
$user = new User();
$user->account_id = Auth::user()->account_id;
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->username = trim(Input::get('email'));
$user->email = trim(Input::get('email'));
$user->first_name = trim(\Request::input('first_name'));
$user->last_name = trim(\Request::input('last_name'));
$user->username = trim(\Request::input('email'));
$user->email = trim(\Request::input('email'));
$user->registered = true;
$user->password = strtolower(str_random(RANDOM_KEY_LENGTH));
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
$user->public_id = $lastUser->public_id + 1;
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
$user->is_admin = boolval(Input::get('is_admin'));
$user->permissions = self::formatUserPermissions(Input::get('permissions'));
$user->is_admin = boolval(\Request::input('is_admin'));
$user->permissions = self::formatUserPermissions(\Request::input('permissions'));
}
}
$user->save();
if (! $user->confirmed && Input::get('action') === 'email') {
if (! $user->confirmed && \Request::input('action') === 'email') {
$this->userMailer->sendConfirmation($user, Auth::user());
$message = trans('texts.sent_invite');
} else {
@ -306,14 +305,14 @@ class UserController extends BaseController
// check the current password is correct
if (! Auth::validate([
'email' => Auth::user()->email,
'password' => Input::get('current_password'),
'password' => \Request::input('current_password'),
])) {
return trans('texts.password_error_incorrect');
}
// validate the new password
$password = Input::get('new_password');
$confirm = Input::get('confirm_password');
$password = \Request::input('new_password');
$confirm = \Request::input('confirm_password');
if (strlen($password) < 6 || $password != $confirm) {
return trans('texts.password_error_invalid');
@ -389,12 +388,12 @@ class UserController extends BaseController
public function saveSidebarState()
{
if (Input::has('show_left')) {
Session::put(SESSION_LEFT_SIDEBAR, boolval(Input::get('show_left')));
if (Request::has('show_left')) {
Session::put(SESSION_LEFT_SIDEBAR, boolval(\Request::input('show_left')));
}
if (Input::has('show_right')) {
Session::put(SESSION_RIGHT_SIDEBAR, boolval(Input::get('show_right')));
if (Request::has('show_right')) {
Session::put(SESSION_RIGHT_SIDEBAR, boolval(\Request::input('show_right')));
}
return RESULT_SUCCESS;

View file

@ -8,7 +8,6 @@ use App\Http\Requests\CreateVendorRequest;
use App\Http\Requests\UpdateVendorRequest;
use App\Models\Vendor;
use App\Ninja\Repositories\VendorRepository;
use Input;
use Response;
use Utils;

View file

@ -12,7 +12,6 @@ use App\Ninja\Repositories\VendorRepository;
use App\Services\VendorService;
use Auth;
use Cache;
use Input;
use Redirect;
use Session;
use URL;
@ -49,7 +48,7 @@ class VendorController extends BaseController
public function getDatatable()
{
return $this->vendorService->getDatatable(Input::get('sSearch'));
return $this->vendorService->getDatatable(\Request::input('sSearch'));
}
/**
@ -149,7 +148,7 @@ class VendorController extends BaseController
private static function getViewModel()
{
return [
'data' => Input::old('data'),
'data' => \Request::old('data'),
'account' => Auth::user()->account,
];
}
@ -172,8 +171,8 @@ class VendorController extends BaseController
public function bulk()
{
$action = Input::get('action');
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
$action = \Request::input('action');
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
$count = $this->vendorService->bulk($ids, $action);
$message = Utils::pluralize($action.'d_vendor', $count);

View file

@ -104,8 +104,9 @@ class ApiCheck
return Response::json("Please wait {$wait} second(s)", 403, $headers);
}
Cache::put("hour_throttle:{$key}", $new_hour_throttle, 60);
Cache::put("last_api_request:{$key}", time(), 60);
Cache::put("hour_throttle:{$key}", $new_hour_throttle, 60 * 60);
Cache::put("last_api_request:{$key}", time(), 60 * 60);
}
return $next($request);

View file

@ -12,7 +12,6 @@ use Cache;
use Closure;
use Event;
use Illuminate\Http\Request;
use Input;
use Redirect;
use Schema;
use Session;
@ -151,8 +150,8 @@ class StartupCheck
}
// Check if we're requesting to change the account's language
if (Input::has('lang')) {
$locale = Input::get('lang');
if (\Request::has('lang')) {
$locale = \Request::input('lang');
App::setLocale($locale);
session([SESSION_LOCALE => $locale]);
@ -172,15 +171,15 @@ class StartupCheck
// Make sure the account/user localization settings are in the session
if (Auth::check() && ! Session::has(SESSION_TIMEZONE)) {
Event::fire(new UserLoggedIn());
Event::dispatch(new UserLoggedIn());
}
// Check if the user is claiming a license (ie, additional invoices, white label, etc.)
if (! Utils::isNinjaProd() && isset($_SERVER['REQUEST_URI'])) {
$claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license');
if (! $claimingLicense && Input::has('license_key') && Input::has('product_id')) {
$licenseKey = Input::get('license_key');
$productId = Input::get('product_id');
if (! $claimingLicense && \Request::has('license_key') && \Request::has('product_id')) {
$licenseKey = \Request::input('license_key');
$productId = \Request::input('product_id');
$url = (Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}&get_date=true";
$data = trim(CurlUtils::get($url));
@ -208,11 +207,11 @@ class StartupCheck
// Check data has been cached
$cachedTables = unserialize(CACHED_TABLES);
if (Input::has('clear_cache')) {
if (\Request::has('clear_cache')) {
Session::flash('message', 'Cache cleared');
}
foreach ($cachedTables as $name => $class) {
if (Input::has('clear_cache') || ! Cache::has($name)) {
if (\Request::has('clear_cache') || ! Cache::has($name)) {
// check that the table exists in case the migration is pending
if (! Schema::hasTable((new $class())->getTable())) {
continue;

View file

@ -4,7 +4,6 @@ namespace App\Http\Requests;
use App\Libraries\HistoryUtils;
use App\Models\EntityModel;
use Input;
use Utils;
class EntityRequest extends Request
@ -33,7 +32,7 @@ class EntityRequest extends Request
}
}
if (! $publicId) {
$publicId = Input::get('public_id') ?: Input::get('id');
$publicId = \Request::input('public_id') ?: \Request::input('id');
}
if (! $publicId) {

View file

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class MigrationForwardRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'url' => 'nullable|url',
];
}
}

View file

@ -0,0 +1,204 @@
<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Libraries\Utils;
use App\Models\Account;
use App\Models\User;
use App\Services\Migration\CompleteService;
use App\Traits\GenerateMigrationResources;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\Storage;
// use Unirest\Request;
class HostedMigration extends Job
{
use GenerateMigrationResources;
public $db;
public $data;
public $user;
private $v4_secret;
public $migration_token;
private $forced;
public function __construct(User $user, array $data, $db, $forced = false)
{
$this->user = $user;
$this->data = $data;
$this->db = $db;
$this->forced = $forced;
$this->v4_secret = config('ninja.ninja_hosted_secret');
}
/**
* Execute the job.
*/
public function handle()
{
config(['database.default' => $this->db]);
//Create or get a token
$this->getToken();
$completeService = (new CompleteService($this->migration_token));
$migrationData = $this->generateMigrationData($this->data);
$completeService->data($migrationData)
->endpoint('https://v5-app1.invoicing.co')
// ->endpoint('http://ninja.test:8000')
->start();
}
private function getToken()
{
$url = 'https://invoicing.co/api/v1/get_migration_account';
// $url = 'http://ninja.test:8000/api/v1/get_migration_account';
$headers = [
'X-API-HOSTED-SECRET' => $this->v4_secret,
'X-Requested-With' => 'XMLHttpRequest',
'Content-Type' => 'application/json',
];
$body = [
'first_name' => $this->user->first_name,
'last_name' => $this->user->last_name,
'email' => $this->user->email,
'privacy_policy' => true,
'terms_of_service' => true,
'password' => '',
];
$client = new \GuzzleHttp\Client([
'headers' => $headers,
]);
$response = $client->post($url,[
RequestOptions::JSON => $body,
RequestOptions::ALLOW_REDIRECTS => false
]);
if($response->getStatusCode() == 401){
info($response->getBody());
} elseif ($response->getStatusCode() == 200) {
$message_body = json_decode($response->getBody(), true);
$this->migration_token = $message_body['token'];
} else {
info(json_decode($response->getBody()->getContents()));
}
// $body = \Unirest\Request\Body::json($body);
// $response = Request::post($url, $headers, $body);
// if (in_array($response->code, [200])) {
// $data = $response->body;
// info(print_r($data,1));
// $this->migration_token = $data->token;
// } else {
// info("getting token failed");
// info($response->raw_body);
// }
return $this;
}
public function generateMigrationData(array $data): array
{
set_time_limit(0);
$migrationData = [];
foreach ($data['companies'] as $company) {
$account = Account::where('account_key', $company['id'])->firstOrFail();
$this->account = $account;
if($this->forced){
//forced migration - we need to set this v4 account as inactive.
//set activate URL
$account_email_settings = $this->account->account_email_settings;
$account_email_settings->account_email_settings->forward_url_for_v5 = "https://invoiceninja-{$this->account->id}.invoicing.co";
$account_email_settings->save();
$this->account->subdomain = "invoiceninja-{$this->account->id}";
}
$date = date('Y-m-d');
$accountKey = $this->account->account_key;
$output = fopen('php://output', 'w') or Utils::fatalError();
$fileName = "{$accountKey}-{$date}-invoiceninja";
$localMigrationData['data'] = [
'account' => $this->getAccount(),
'company' => $this->getCompany(),
'users' => $this->getUsers(),
'tax_rates' => $this->getTaxRates(),
'payment_terms' => $this->getPaymentTerms(),
'clients' => $this->getClients(),
'company_gateways' => $this->getCompanyGateways(),
'client_gateway_tokens' => $this->getClientGatewayTokens(),
'vendors' => $this->getVendors(),
'projects' => $this->getProjects(),
'products' => $this->getProducts(),
'credits' => $this->getCreditsNotes(),
'invoices' => $this->getInvoices(),
'recurring_expenses' => $this->getRecurringExpenses(),
'recurring_invoices' => $this->getRecurringInvoices(),
'quotes' => $this->getQuotes(),
'payments' => array_merge($this->getPayments(), $this->getCredits()),
'documents' => $this->getDocuments(),
'expense_categories' => $this->getExpenseCategories(),
'task_statuses' => $this->getTaskStatuses(),
'expenses' => $this->getExpenses(),
'tasks' => $this->getTasks(),
'documents' => $this->getDocuments(),
'ninja_tokens' => $this->getNinjaToken(),
];
$localMigrationData['force'] = array_key_exists('force', $company);
Storage::makeDirectory('migrations');
$file = Storage::path("migrations/{$fileName}.zip");
//$file = storage_path("migrations/{$fileName}.zip");
ksort($localMigrationData);
$zip = new \ZipArchive();
$zip->open($file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
$zip->addFromString('migration.json', json_encode($localMigrationData, JSON_PRETTY_PRINT));
$zip->close();
$localMigrationData['file'] = $file;
$migrationData[] = $localMigrationData;
}
return $migrationData;
}
}

View file

@ -10,7 +10,6 @@ use Carbon;
use DateTime;
use DateTimeZone;
use Exception;
use Input;
use Log;
use Request;
use Schema;
@ -437,7 +436,7 @@ class Utils
];
if (static::isNinja()) {
$data['url'] = Input::get('url', Request::url());
$data['url'] = \Request::input('url', Request::url());
$data['previous'] = url()->previous();
} else {
$data['url'] = request()->path();

View file

@ -0,0 +1,23 @@
<?php
namespace App\Logging;
class CustomizeSingleLogger
{
/**
* Customize the given logger instance.
*
* @param \Illuminate\Log\Logger $logger
*
* @return void
*/
public function __invoke($logger)
{
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log',
\Monolog\Logger::INFO, false));
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-warning.log',
\Monolog\Logger::WARNING, false));
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log',
\Monolog\Logger::ERROR, false));
}
}

View file

@ -1123,7 +1123,13 @@ class Account extends Eloquent
Session::put(SESSION_DATE_FORMAT, $this->date_format ? $this->date_format->format : DEFAULT_DATE_FORMAT);
Session::put(SESSION_DATE_PICKER_FORMAT, $this->date_format ? $this->date_format->picker_format : DEFAULT_DATE_PICKER_FORMAT);
$currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
//php 7.3
// $currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
//php 7.4
$currencyId = ($client && $client->currency_id) ? $client->currency_id : ($this->currency_id ?: DEFAULT_CURRENCY);
// $currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
$locale = ($client && $client->language_id) ? $client->language->locale : ($this->language_id ? $this->Language->locale : DEFAULT_LOCALE);
Session::put(SESSION_CURRENCY, $currencyId);
@ -1963,7 +1969,7 @@ Account::updated(function ($account) {
return;
}
Event::fire(new UserSettingsChanged());
Event::dispatch(new UserSettingsChanged());
});
Account::deleted(function ($account)

View file

@ -99,7 +99,7 @@ class LookupModel extends Eloquent
abort(404, "Looked up {$className} not found: {$field} => {$value}");
}
Cache::put($key, $server, 120);
Cache::put($key, $server, 120 * 60);
} else {
config(['database.default' => $current]);
}

View file

@ -243,7 +243,7 @@ class Payment extends EntityModel
$this->payment_status_id = $this->refunded == $this->amount ? PAYMENT_STATUS_REFUNDED : PAYMENT_STATUS_PARTIALLY_REFUNDED;
$this->save();
Event::fire(new PaymentWasRefunded($this, $refund_change));
Event::dispatch(new PaymentWasRefunded($this, $refund_change));
}
return true;
@ -258,7 +258,7 @@ class Payment extends EntityModel
return false;
}
Event::fire(new PaymentWasVoided($this));
Event::dispatch(new PaymentWasVoided($this));
$this->refunded = $this->amount;
$this->payment_status_id = PAYMENT_STATUS_VOIDED;
@ -271,7 +271,7 @@ class Payment extends EntityModel
{
$this->payment_status_id = PAYMENT_STATUS_COMPLETED;
$this->save();
Event::fire(new PaymentCompleted($this));
Event::dispatch(new PaymentCompleted($this));
}
/**
@ -282,7 +282,7 @@ class Payment extends EntityModel
$this->payment_status_id = PAYMENT_STATUS_FAILED;
$this->gateway_error = $failureMessage;
$this->save();
Event::fire(new PaymentFailed($this));
Event::dispatch(new PaymentFailed($this));
}
/**

View file

@ -220,11 +220,11 @@ class PaymentMethod extends EntityModel
}
if (! empty($data)) {
Cache::put('bankData:'.$routingNumber, $data, 5);
Cache::put('bankData:'.$routingNumber, $data, 5 * 60);
return $data;
} else {
Cache::put('bankData:'.$routingNumber, false, 5);
Cache::put('bankData:'.$routingNumber, false, 5 * 60);
return null;
}

View file

@ -33,6 +33,11 @@ trait HasRecurrence
}
$account = $this->account;
if (! $account) {
return false;
}
$timezone = $account->getTimezone();
if (! $this->start_date || Carbon::parse($this->start_date, $timezone)->isFuture()) {

View file

@ -74,7 +74,10 @@ trait Inviteable
}
}
return $hasValue ? implode($parts, '<br/>') : false;
return $hasValue ? implode('<br/>', $parts) : false;
// return $hasValue ? implode($parts, '<br/>') : false;
}
/**

View file

@ -402,8 +402,8 @@ class ContactMailer extends Mailer
$day_hits_remaining = $day_hits_remaining >= 0 ? $day_hits_remaining : 0;
}
Cache::put("email_day_throttle:{$key}", $new_day_throttle, 60);
Cache::put("last_email_request:{$key}", time(), 60);
Cache::put("email_day_throttle:{$key}", $new_day_throttle, 60 * 60);
Cache::put("last_email_request:{$key}", time(), 60 * 60);
if ($new_day_throttle > $day) {
$errorEmail = env('ERROR_EMAIL');
@ -414,7 +414,7 @@ class ContactMailer extends Mailer
->subject("Email throttle triggered for account " . $account->id);
});
}
Cache::put("throttle_notified:{$key}", true, 60 * 24);
Cache::put("throttle_notified:{$key}", true, 60 * 24 * 60);
return true;
}

View file

@ -794,9 +794,10 @@ class BasePaymentDriver
$payment->contact_id = $invitation->contact_id;
$payment->transaction_reference = $ref;
$payment->payment_date = $account->getDateTime()->format('Y-m-d');
$payment->ip = Request::ip();
$payment->ip = \Request::ip();
$payment = $this->creatingPayment($payment, $paymentMethod);
//Laravel 6 upgrade - uncommented this line as it was causing a failure
// $payment = $this->creatingPayment($payment, $paymentMethod);
if ($paymentMethod) {
$payment->last4 = $paymentMethod->last4;

View file

@ -228,7 +228,6 @@ class StripePaymentDriver extends BasePaymentDriver
if ( ! empty($data['payment_intent'])) {
// Find the existing payment intent.
$intent = PaymentIntent::retrieve($data['payment_intent']);
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
// Make sure that the provided payment intent matches the invoice amount.
throw new Exception('Incorrect PaymentIntent amount.');
@ -270,8 +269,8 @@ class StripePaymentDriver extends BasePaymentDriver
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
}
}
$intent = PaymentIntent::create($params);
}
if (empty($intent)) {
@ -282,6 +281,7 @@ class StripePaymentDriver extends BasePaymentDriver
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
} else if ($intent->status == 'succeeded') {
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
$payment = $this->createPayment($ref, $paymentMethod);
if ($this->invitation->invoice->account->isNinjaAccount()) {
@ -296,7 +296,6 @@ class StripePaymentDriver extends BasePaymentDriver
$this->tokenResponse = $payment_method;
parent::createToken();
}
return $payment;
} else {
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);

View file

@ -47,6 +47,10 @@ class InvoiceReport extends AbstractReport
public function run()
{
if (!Auth::user()) {
return;
}
$account = Auth::user()->account;
$statusIds = $this->options['status_ids'];
$exportFormat = $this->options['export_format'];

View file

@ -18,7 +18,6 @@ use App\Models\User;
use App\Models\UserAccount;
use App\Models\LookupUser;
use Auth;
use Input;
use Request;
use Schema;
use Session;
@ -37,19 +36,19 @@ class AccountRepository
}
$company = new Company();
$company->utm_source = Input::get('utm_source');
$company->utm_medium = Input::get('utm_medium');
$company->utm_campaign = Input::get('utm_campaign');
$company->utm_term = Input::get('utm_term');
$company->utm_content = Input::get('utm_content');
$company->utm_source = \Request::input('utm_source');
$company->utm_medium = \Request::input('utm_medium');
$company->utm_campaign = \Request::input('utm_campaign');
$company->utm_term = \Request::input('utm_term');
$company->utm_content = \Request::input('utm_content');
$company->referral_code = Session::get(SESSION_REFERRAL_CODE);
if (Input::get('utm_campaign')) {
if (env('PROMO_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PROMO_CAMPAIGN'))) {
if (\Request::input('utm_campaign')) {
if (env('PROMO_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('PROMO_CAMPAIGN'))) {
$company->applyDiscount(.75);
} elseif (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
} elseif (env('PARTNER_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
$company->applyFreeYear();
} elseif (env('EDUCATION_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('EDUCATION_CAMPAIGN'))) {
} elseif (env('EDUCATION_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('EDUCATION_CAMPAIGN'))) {
$company->applyFreeYear(2);
}
} else {

View file

@ -3,6 +3,7 @@
namespace App\Providers;
use Form;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
use Request;
use URL;
@ -26,6 +27,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
Route::singularResourceParameters(false);
Paginator::useBootstrapThree();
// support selecting job database
Queue::before(function (JobProcessing $event) {

View file

@ -6,7 +6,6 @@ use App\Events\UserLoggedIn;
use App\Ninja\Repositories\AccountRepository;
use App\Models\LookupUser;
use Auth;
use Input;
use Session;
use Socialite;
use Utils;
@ -98,7 +97,7 @@ class AuthService
}
}
$redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'dashboard';
$redirectTo = \Request::input('redirect_to') ? SITE_URL . '/' . ltrim(\Request::input('redirect_to'), '/') : 'dashboard';
return redirect()->to($redirectTo);
}

View file

@ -13,8 +13,9 @@
namespace App\Services\Migration;
use Unirest\Request;
use Unirest\Request\Body;
use GuzzleHttp\RequestOptions;
// use Unirest\Request;
// use Unirest\Request\Body;
class AuthService
{
@ -51,25 +52,57 @@ class AuthService
'password' => $this->password,
];
$body = Body::json($data);
$client = new \GuzzleHttp\Client([
'headers' => $this->getHeaders(),
]);
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
$response = $client->post($this->getUrl(),[
RequestOptions::JSON => $data,
RequestOptions::ALLOW_REDIRECTS => false
]);
if (in_array($response->code, [401])) {
info($response->raw_body);
if($response->getStatusCode() == 401){
info($response->getBody());
$this->isSuccessful = false;
$this->processErrors($response->body->message);
} elseif (in_array($response->code, [200])) {
$this->processErrors($response->getBody());
} elseif ($response->getStatusCode() == 200) {
$message_body = json_decode($response->getBody(), true);
info(print_r($message_body,1));
$this->isSuccessful = true;
$this->token = $response->body->data[0]->token->token;
$this->token = $message_body['data'][0]['token']['token'];
} else {
info($response->raw_body);
info(json_decode($response->getBody()->getContents()));
$this->isSuccessful = false;
$this->errors = [trans('texts.migration_went_wrong')];
}
//return $response->getBody();
// $body = Body::json($data);
// $response = Request::post($this->getUrl(), $this->getHeaders(), $body);
// if (in_array($response->code, [401])) {
// info($response->raw_body);
// $this->isSuccessful = false;
// $this->processErrors($response->body->message);
// } elseif (in_array($response->code, [200])) {
// $this->isSuccessful = true;
// $this->token = $response->body->data[0]->token->token;
// } else {
// info($response->raw_body);
// $this->isSuccessful = false;
// $this->errors = [trans('texts.migration_went_wrong')];
// }
return $this;
}

View file

@ -3,8 +3,6 @@
namespace App\Services\Migration;
use App\Models\Account;
use Unirest\Request;
use Unirest\Request\Body;
class CompanyService
{

View file

@ -2,8 +2,9 @@
namespace App\Services\Migration;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\Storage;
use Unirest\Request;
// use Unirest\Request;
class CompleteService
{
@ -40,26 +41,53 @@ class CompleteService
public function start()
{
$files = [];
foreach ($this->data as $companyKey => $companyData) {
$data[] = [
$data = [
'company_index' => $companyKey,
'company_key' => $companyData['data']['company']['company_key'],
'force' => $companyData['force'],
'contents' => 'name',
'name' => $companyKey,
];
$files[$companyKey] = $companyData['file'];
$payload[$companyKey] = [
'contents' => json_encode($data),
'name' => $companyData['data']['company']['company_key'],
];
$files[] = [
'name' => $companyKey,
'company_index' => $companyKey,
'company_key' => $companyData['data']['company']['company_key'],
'force' => $companyData['force'],
'contents' => file_get_contents($companyData['file']),
'filename' => basename($companyData['file']),
'Content-Type' => 'application/zip'
];
}
$body = \Unirest\Request\Body::multipart(['companies' => json_encode($data)], $files);
$client = new \GuzzleHttp\Client(
[
'headers' => $this->getHeaders(),
]);
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
$payload_data = [
'multipart'=> array_merge($files, $payload),
];
info(print_r($payload_data,1));
$response = $client->request("POST", $this->getUrl(),$payload_data);
if($response->getStatusCode() == 200){
if (in_array($response->code, [200])) {
$this->isSuccessful = true;
} else {
return json_decode($response->getBody(),true);
}else {
info($response->raw_body);
$this->isSuccessful = false;
@ -69,6 +97,26 @@ class CompleteService
}
return $this;
// $body = \Unirest\Request\Body::multipart(['companies' => json_encode($data)], $files);
// $response = Request::post($this->getUrl(), $this->getHeaders(), $body);
// if (in_array($response->code, [200])) {
// $this->isSuccessful = true;
// } else {
// info($response->raw_body);
// $this->isSuccessful = false;
// $this->errors = [
// 'Oops, something went wrong. Migration can\'t be processed at the moment. Please checks the logs.',
// ];
// }
return $this;
}
public function isSuccessful()

View file

@ -2,6 +2,7 @@
namespace App\Traits;
use App\Libraries\Utils;
use App\Models\AccountGateway;
use App\Models\AccountGatewaySettings;
use App\Models\AccountGatewayToken;
@ -19,6 +20,7 @@ use App\Models\PaymentMethod;
use App\Models\PaymentTerm;
use App\Models\Product;
use App\Models\Project;
use App\Models\RecurringExpense;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Models\TaxRate;
@ -71,11 +73,21 @@ trait GenerateMigrationResources
protected function getCompany()
{
info("get company");
info("get company");
$financial_year_start = null;
if($this->account->financial_year_start)
{
//2000-02-01 format
$exploded_date = explode("-", $this->account->financial_year_start);
$financial_year_start = (int)$exploded_date[1];
}
return [
'first_day_of_week' => $this->account->start_of_week,
'first_month_of_year' => $this->account->financial_year_start,
'first_month_of_year' => $financial_year_start,
'version' => NINJA_VERSION,
'referral_code' => $this->account->referral_code ?: '',
'account_id' => $this->account->id,
@ -130,10 +142,15 @@ info("get company");
{
info("get co settings");
$timezone_id = $this->account->timezone_id ? $this->account->timezone_id : 15;
if($timezone_id > 57)
$timezone_id = (string)($timezone_id - 1);
return [
'auto_bill' => $this->transformAutoBill($this->account->token_billing_id),
'payment_terms' => $this->account->payment_terms ? (string) $this->account->payment_terms : '',
'timezone_id' => $this->account->timezone_id ? (string) $this->account->timezone_id : '15',
'timezone_id' => $timezone_id,
'date_format_id' => $this->account->date_format_id ? (string) $this->account->date_format_id : '1',
'currency_id' => $this->account->currency_id ? (string) $this->account->currency_id : '1',
'name' => $this->account->name ?: trans('texts.untitled'),
@ -171,7 +188,7 @@ info("get company");
'all_pages_footer' => $this->account->all_pages_footer ? (bool) $this->account->all_pages_footer : true,
'all_pages_header' => $this->account->all_pages_header ? (bool) $this->account->all_pages_header : true,
'show_currency_code' => $this->account->show_currency_code ? (bool) $this->account->show_currency_code : false,
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : true,
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : false,
'send_portal_password' => $this->account->send_portal_password ? (bool) $this->account->send_portal_password : false,
'recurring_number_prefix' => $this->account->recurring_invoice_number_prefix ? $this->account->recurring_invoice_number_prefix : 'R',
'enable_client_portal' => $this->account->enable_client_portal ? (bool) $this->account->enable_client_portal : false,
@ -192,7 +209,7 @@ info("get company");
'payment_terms' => $this->account->payment_terms ?: '',
'reset_counter_frequency_id' => $this->account->reset_counter_frequency_id ? (string) $this->transformFrequencyId
($this->account->reset_counter_frequency_id) : '0',
'payment_type_id' => $this->account->payment_type_id ? (string) $this->account->payment_type_id : '1',
'payment_type_id' => $this->account->payment_type_id ? (string) $this->transformPaymentType($this->account->payment_type_id) : '1',
'reset_counter_date' => $this->account->reset_counter_date ?: '',
'tax_name1' => $this->account->tax_name1 ?: '',
'tax_rate1' => $this->account->tax_rate1 ?: 0,
@ -211,18 +228,88 @@ info("get company");
'auto_archive_quote' => $this->account->auto_archive_quote ? (bool) $this->account->auto_archive_quote : false,
'auto_email_invoice' => $this->account->auto_email_invoice ? (bool) $this->account->auto_email_invoice : false,
'counter_padding' => $this->account->invoice_number_padding ?: 4,
'reply_to_email' => $this->account->account_email_settings->reply_to_email ?: '',
'bcc_email' => $this->account->account_email_settings->bcc_email ?: '',
'email_subject_invoice' => $this->account->account_email_settings->email_subject_invoice ?: '',
'email_subject_quote' => $this->account->account_email_settings->email_subject_quote ?: '',
'email_subject_payment' => $this->account->account_email_settings->email_subject_payment ?: '',
'email_template_invoice' => $this->account->account_email_settings->email_template_invoice ?: '',
'email_template_quote' => $this->account->account_email_settings->email_template_quote ?: '',
'email_template_payment' => $this->account->account_email_settings->email_template_payment ?: '',
'email_subject_reminder1' => $this->account->account_email_settings->email_subject_reminder1 ?: '',
'email_subject_reminder2' => $this->account->account_email_settings->email_subject_reminder2 ?: '',
'email_subject_reminder3' => $this->account->account_email_settings->email_subject_reminder3 ?: '',
'email_subject_reminder_endless' => $this->account->account_email_settings->email_subject_reminder4 ?: '',
'email_template_reminder1' => $this->account->account_email_settings->email_template_reminder1 ?: '',
'email_template_reminder2' => $this->account->account_email_settings->email_template_reminder2 ?: '',
'email_template_reminder3' => $this->account->account_email_settings->email_template_reminder3 ?: '',
'email_template_reminder_endless' => $this->account->account_email_settings->email_template_reminder4 ?: '',
'late_fee_amount1' => $this->account->account_email_settings->late_fee1_amount ?: 0,
'late_fee_amount2' => $this->account->account_email_settings->late_fee2_amount ?: 0,
'late_fee_amount3' => $this->account->account_email_settings->late_fee3_amount ?: 0,
'late_fee_percent1' => $this->account->account_email_settings->late_fee1_percent ?: 0,
'late_fee_percent2' => $this->account->account_email_settings->late_fee2_percent ?: 0,
'late_fee_percent3' => $this->account->account_email_settings->late_fee3_percent ?: 0,
'enable_reminder1' => $this->account->enable_reminder1 ? true : false,
'enable_reminder2' => $this->account->enable_reminder2 ? true : false,
'enable_reminder3' => $this->account->enable_reminder3 ? true : false,
'enable_reminder_endless' => $this->account->enable_reminder4 ? true : false,
'num_days_reminder1' => $this->account->num_days_reminder1 ?: 0,
'num_days_reminder2' => $this->account->num_days_reminder2 ?: 0,
'num_days_reminder3' => $this->account->num_days_reminder3 ?: 0,
'schedule_reminder1' => $this->buildReminderString($this->account->direction_reminder1, $this->account->field_reminder1),
'schedule_reminder2' => $this->buildReminderString($this->account->direction_reminder2, $this->account->field_reminder2),
'schedule_reminder3' => $this->buildReminderString($this->account->direction_reminder3, $this->account->field_reminder3),
'endless_reminder_frequency_id' => $this->account->account_email_settings->reset_counter_frequency_id ? $this->transformFrequencyId($this->account->account_email_settings->reset_counter_frequency_id) : 0,
'email_signature' => $this->account->email_footer ?: '',
'email_style' => $this->getEmailStyle($this->account->email_design_id),
'custom_message_dashboard' => $this->account->customMessage('dashboard'),
'custom_message_unpaid_invoice' => $this->account->customMessage('unpaid_invoice'),
'custom_message_paid_invoice' => $this->account->customMessage('paid_invoice'),
'custom_message_unapproved_quote' => $this->account->customMessage('unapproved_quote'),
];
}
private function getEmailStyle($id){
switch ($id) {
case 1:
return 'plain';
break;
case 2:
return 'light';
break;
case 3:
return 'dark';
break;
default:
return 'light';
break;
}
}
private function buildReminderString($direction, $field)
{
$direction_string = $direction == 1 ? "after_" : "before_";
$field_string = $field == 1 ? "due_date" : "invoice_date";
return $direction_string.$field_string;
}
public function getTaxRates()
{
info("get tax rates");
$rates = TaxRate::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get tax rates => " . $rates->count());
$transformed = [];
foreach ($rates as $rate) {
@ -241,10 +328,12 @@ info("get company");
}
protected function getClients()
{info("get clients");
{
$clients = [];
info("get clients => ". $this->account->clients()->count());
foreach ($this->account->clients()->withTrashed()->get() as $client) {
$number = $client->id_number;
@ -293,8 +382,6 @@ info("get company");
private function getClientSettings($client)
{
info("get client settings");
$settings = new \stdClass();
$settings->currency_id = $client->currency_id ? (string) $client->currency_id : (string) $client->account->currency_id;
@ -311,12 +398,13 @@ info("get company");
protected function getClientContacts($client)
{
info("get client contacts");
$contacts = Contact::where('client_id', $client->id)->withTrashed()->get();
$transformed = [];
info("Importing contacts => " . $contacts->count());
foreach ($contacts as $contact) {
$transformed[] = [
'id' => $contact->id,
@ -350,6 +438,9 @@ info("get company");
{
$transformed = [];
if(!Utils::isNinja())
return $transformed;
$ninja_client = Client::where('public_id', $this->account->id)->first();
if(!$ninja_client)
@ -361,6 +452,10 @@ info("get company");
foreach($agts as $agt) {
$payment_method = $agt->default_payment_method;
if(!$payment_method)
continue;
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
$transformed[] = [
@ -384,12 +479,13 @@ info("get company");
protected function getProducts()
{
info("get products");
$products = Product::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get products " . $products->count());
$transformed = [];
foreach ($products as $product) {
@ -418,12 +514,13 @@ info("get company");
public function getUsers()
{
info("get users");
$users = User::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get users " . $users->count());
$transformed = [];
foreach ($users as $user) {
@ -454,7 +551,6 @@ info("get company");
private function getCreditsNotes()
{
info("get credit notes");
$credits = [];
@ -465,6 +561,8 @@ info("get company");
->withTrashed()
->get();
info("get credit notes => " . $export_credits->count());
foreach ($export_credits as $credit) {
$credits[] = [
'id' => $credit->id,
@ -511,7 +609,7 @@ info("get company");
protected function getInvoices()
{ info("get invoices");
{
$invoices = [];
@ -522,6 +620,8 @@ info("get company");
->withTrashed()
->get();
info("get invoices -> ". $export_invoices->count());
foreach ($export_invoices as $invoice) {
$invoices[] = [
'id' => $invoice->id,
@ -566,6 +666,7 @@ info("get company");
'deleted_at' => $invoice->deleted_at ? Carbon::parse($invoice->deleted_at)->toDateString() : null,
'invitations' => $this->getResourceInvitations($invoice->invitations, 'invoice_id'),
'auto_bill_enabled' => $invoice->auto_bill,
'recurring_id' => $invoice->recurring_invoice_id,
];
}
@ -591,10 +692,59 @@ info("get company");
return $design_id;
}
protected function getRecurringExpenses()
{
$expenses = [];
$export_expenses = RecurringExpense::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get recurring Expenses => " . $export_expenses->count());
foreach ($export_expenses as $expense) {
$expenses[] = [
'id' => $expense->id,
'amount' => $expense->amount,
'company_id' => $this->account->id,
'client_id' => $expense->client_id,
'user_id' => $expense->user_id,
'custom_value1' => '',
'custom_value2' => '',
'custom_value3' => '',
'custom_value4' => '',
'category_id' => $expense->expense_category_id,
'currency_id' => $expense->expense_currency_id,
'frequency_id' => $this->transformFrequencyId($expense->frequency_id),
'invoice_currency_id' => $expense->invoice_currency_id,
'private_notes' => $expense->private_notes,
'public_notes' => $expense->public_notes,
'should_be_invoiced' => $expense->should_be_invoiced,
'tax_name1' => $expense->tax_name1,
'tax_name2' => $expense->tax_name2,
'tax_name3' => '',
'tax_rate1' => $expense->tax_rate1,
'tax_rate2' => $expense->tax_rate2,
'tax_rate3' => 0,
'vendor_id' => $expense->vendor_id,
'is_deleted' => $expense->is_deleted,
'next_send_date' => $this->getNextSendDateForMigration($expense),
'remaining_cycles' => $this->getRemainingCycles($expense),
'created_at' => $expense->created_at ? Carbon::parse($expense->created_at)->toDateString() : null,
'updated_at' => $expense->updated_at ? Carbon::parse($expense->updated_at)->toDateString() : null,
'deleted_at' => $expense->deleted_at ? Carbon::parse($expense->deleted_at)->toDateString() : null,
];
}
return $expenses;
}
protected function getRecurringInvoices()
{
info("get recurring invoices");
$invoices = [];
@ -602,7 +752,9 @@ info("get company");
->where('amount', '>=', 0)
->where('is_recurring', true)
->withTrashed()
->get();
->get();
info("get recurring invoices => " . $export_invoices->count());
foreach ($export_invoices as $invoice) {
$invoices[] = [
@ -648,7 +800,8 @@ info("get company");
'due_date_days' => $this->transformDueDate($invoice),
'remaining_cycles' => $this->getRemainingCycles($invoice),
'invitations' => $this->getResourceInvitations($invoice->invitations, 'recurring_invoice_id'),
'auto_bill_enabled' => $invoice->auto_bill,
'auto_bill_enabled' => $this->calcAutoBillEnabled($invoice),
'auto_bill' => $this->calcAutoBill($invoice),
];
}
@ -656,6 +809,29 @@ info("get company");
}
private function calcAutoBillEnabled($invoice)
{
if($invoice->auto_bill == 1)
return 'off';
elseif($invoice->auto_bill == 2)
return 'optin';
elseif($invoice->auto_bill == 3)
return 'optout';
elseif($invoice->auto_bill == 4)
return 'always';
else
return 'off';
}
private function calcAutoBill($invoice)
{
if($invoice->auto_bill == 4)
return 1;
return $invoice->client_enable_auto_bill;
}
private function getNextSendDateForMigration($invoice)
{
@ -736,8 +912,13 @@ info("get company");
$due_date_parts = explode("-", $invoice->due_date);
if(is_array($due_date_parts) && count($due_date_parts) >=3)
if(is_array($due_date_parts) && count($due_date_parts) >=3){
if($due_date_parts[2] == "00")
return "0";
return (string)$due_date_parts[2];
}
return 'terms';
}
@ -925,7 +1106,7 @@ info("get company");
public function getResourceInvitations($items, $resourceKeyId)
{
info("get resource {$resourceKeyId} invitations");
// info("get resource {$resourceKeyId} invitations");
$transformed = [];
@ -998,7 +1179,7 @@ info("get company");
public function getInvoiceItems($items)
{
info("get invoice items");
// info("get invoice items");
$transformed = [];
@ -1030,8 +1211,6 @@ info("get company");
public function getQuotes()
{
info("get quotes");
$transformed = [];
@ -1040,6 +1219,8 @@ info("get company");
->withTrashed()
->get();
info("get quotes => " . $quotes->count());
foreach ($quotes as $quote) {
$transformed[] = [
'id' => $quote->id,
@ -1065,7 +1246,7 @@ info("get company");
'tax_name2' => $quote->tax_name2,
'tax_rate1' => $quote->tax_rate1,
'tax_rate2' => $quote->tax_rate2,
'invoice_id' => $quote->quote_invoice_id,
'invoice_id' => Invoice::getPrivateId($quote->quote_invoice_id),
'custom_surcharge1' => $quote->custom_value1 ?: '',
'custom_surcharge2' => $quote->custom_value2 ?: '',
'custom_value1' => $quote->custom_text_value1 ?: '',
@ -1115,7 +1296,6 @@ info("get company");
public function getPayments()
{
info("get payments");
$transformed = [];
@ -1124,6 +1304,9 @@ info("get company");
->withTrashed()
->get();
info("get payments => " . $payments->count());
foreach ($payments as $payment) {
$transformed[] = [
'id' => $payment->id,
@ -1188,7 +1371,7 @@ info("get company");
{
switch ($payment_type_id) {
case PAYMENT_TYPE_CREDIT:
return 1;
return 32;
case PAYMENT_TYPE_ACH:
return 4;
case PAYMENT_TYPE_VISA:
@ -1209,6 +1392,8 @@ info("get company");
return 12;
case PAYMENT_TYPE_PAYPAL:
return 13;
case 16:
return 15;
case PAYMENT_TYPE_CARTE_BLANCHE:
return 16;
case PAYMENT_TYPE_UNIONPAY:
@ -1249,12 +1434,13 @@ info("get company");
private function getCredits()
{
info("get credits");
$credits = Credit::where('account_id', $this->account->id)->where('balance', '>', 0)->whereIsDeleted(false)
->withTrashed()
->get();
info("get credits => " . $credits->count());
$transformed = [];
foreach ($credits as $credit) {
@ -1279,10 +1465,12 @@ info("get company");
private function getDocuments()
{
info("get documents");
$documents = Document::where('account_id', $this->account->id)->get();
info("get documents => " . $documents->count());
$transformed = [];
foreach ($documents as $document) {
@ -1322,12 +1510,9 @@ info("get company");
$fees_and_limits = $this->transformFeesAndLimits($gateway_type);
info("generated fees and limits = ");
info(print_r($fees_and_limits,1));
$translated_gateway_type = $this->translateGatewayTypeId($gateway_type);
info("translated gateway_type = {$translated_gateway_type}");
$fees->{$translated_gateway_type} = $fees_and_limits;
}
@ -1337,10 +1522,11 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getCompanyGateways()
{
info("get get company gateways");
$account_gateways = AccountGateway::where('account_id', $this->account->id)->withTrashed()->get();
info("get get company gateways => " . $account_gateways->count());
$transformed = [];
foreach ($account_gateways as $account_gateway) {
@ -1537,11 +1723,10 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getClientGatewayTokens()
{
info("get client gateway tokens");
$payment_methods = PaymentMethod::where('account_id', $this->account->id)->withTrashed()->get();
info("get client gateway tokens => " . $payment_methods->count());
$transformed = [];
$is_default = true;
@ -1550,6 +1735,9 @@ info("translated gateway_type = {$translated_gateway_type}");
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
$agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first();
if(!$contact && !$agt)
continue;
$transformed[] = [
'id' => $payment_method->id,
'company_id' => $this->account->id,
@ -1570,11 +1758,11 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getPaymentTerms()
{
info("get payment terms");
$payment_terms = PaymentTerm::where('account_id', 0)->orWhere('account_id', $this->account->id)->withTrashed()->get();
info("get payment terms => " . $payment_terms->count());
$transformed = [];
foreach($payment_terms as $payment_term)
@ -1601,10 +1789,10 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getTaskStatuses()
{
info("get task statuses");
$task_statuses = TaskStatus::where('account_id', $this->account->id)->withTrashed()->get();
info("get task statuses => " . $task_statuses->count());
if($task_statuses->count() == 0)
{
$defaults = [
@ -1647,10 +1835,10 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getExpenseCategories()
{
info("get expense categories");
$expense_categories = ExpenseCategory::where('account_id', $this->account->id)->withTrashed()->get();
info("get expense categories => " . $expense_categories->count());
$transformed = [];
foreach ($expense_categories as $category)
@ -1672,10 +1860,10 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getExpenses()
{
info("get expenses");
$expenses = Expense::where('account_id', $this->account->id)->withTrashed()->get();
info("get expenses => " . $expenses->count());
$transformed = [];
foreach ($expenses as $expense)
@ -1700,7 +1888,7 @@ info("translated gateway_type = {$translated_gateway_type}");
'invoice_documents' => $expense->invoice_documents,
'invoice_id' => $expense->invoice_id,
'payment_date' => $expense->payment_date,
'payment_type_id' => $expense->payment_type_id,
'payment_type_id' => $this->transformPaymentType($expense->payment_type_id),
'private_notes' => $expense->private_notes,
'public_notes' => $expense->public_notes,
'recurring_expense_id' => $expense->recurring_expense_id,
@ -1727,13 +1915,13 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getTasks()
{
info("get tasks");
$tasks = Task::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get tasks => " . $tasks->count());
$transformed = [];
foreach ($tasks as $task)
@ -1770,12 +1958,14 @@ info("translated gateway_type = {$translated_gateway_type}");
private function getProjects()
{
info("get projects");
$projects = Project::where('account_id', $this->account->id)
->withTrashed()
->get();
info("get projects => " . $projects);
$transformed = [];
foreach ($projects as $project)
@ -1812,10 +2002,10 @@ info("translated gateway_type = {$translated_gateway_type}");
protected function getVendors()
{
info("get vendors");
$vendor_query = Vendor::where('account_id', $this->account->id)->withTrashed()->get();
info("get vendors => " . $vendor_query->count());
$vendors = [];
foreach ($vendor_query as $vendor) {
@ -1859,7 +2049,7 @@ info("translated gateway_type = {$translated_gateway_type}");
protected function getVendorContacts($contacts)
{
info("get vendor contacts");
info("get vendor contacts => " . $contacts->count());
$transformed = [];
@ -1878,7 +2068,7 @@ info("translated gateway_type = {$translated_gateway_type}");
'custom_value4' => '',
'email' => $contact->email,
'is_primary' => (bool)$contact->is_primary,
'send_email' => (bool)$contact->send_invoice ?: false,
'send_email' => (bool)$contact->send_invoice ?: true,
'confirmed' => $contact->confirmation_token ? true : false,
'email_verified_at' => $contact->created_at->toDateTimeString(),
'last_login' => $contact->last_login,
@ -1934,8 +2124,8 @@ info("translated gateway_type = {$translated_gateway_type}");
}
$fees_and_limits = new \stdClass();
$fees_and_limits->min_limit = $ags->min_limit;
$fees_and_limits->max_limit = $ags->max_limit;
$fees_and_limits->min_limit = $ags->min_limit > 0 ? $ags->min_limit : -1;
$fees_and_limits->max_limit = $ags->max_limit > 0 ? $ags->max_limit : -1;
$fees_and_limits->fee_amount = $ags->fee_amount;
$fees_and_limits->fee_percent = $ags->fee_percent;
$fees_and_limits->fee_tax_name1 = $ags->tax_name1;

View file

@ -58,14 +58,6 @@ if (strstr($_SERVER['HTTP_USER_AGENT'], 'PhantomJS') && Utils::isNinjaDev()) {
}
*/
$app->configureMonologUsing(function($monolog) {
if (config('app.log') == 'single') {
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log', Monolog\Logger::INFO, false));
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-warning.log', Monolog\Logger::WARNING, false));
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log', Monolog\Logger::ERROR, false));
}
});
// Capture real IP if using cloudflare
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];

View file

@ -13,27 +13,40 @@
}
],
"require": {
"php": ">=7.1.0",
"php": ">=7.3.0",
"ext-gd": "*",
"ext-gmp": "*",
"ext-json": "*",
"ext-zip": "*",
"abdala/omnipay-pagseguro": "0.2",
"agmscode/omnipay-agms": "~1.0",
"anahkiasen/former": "4.*",
"andreas22/omnipay-fasapay": "1.*",
"asgrim/ofxparser": "^1.1",
"bacon/bacon-qr-code": "^1.0",
"barracudanetworks/archivestream-php": "^1.0",
"barryvdh/laravel-cors": "^0.9.1",
"barryvdh/laravel-debugbar": "~3.0.1",
"barryvdh/laravel-ide-helper": "~2.2",
"barryvdh/laravel-cors": "^1.0.6",
"barryvdh/laravel-debugbar": "~3.6.1",
"barryvdh/laravel-ide-helper": "~2.7",
"bramdevries/omnipay-paymill": "^1.0",
"cardgate/omnipay-cardgate": "~2.0",
"cerdic/css-tidy": "~v1.5",
"chumper/datatable": "dev-add-back-options",
"chumper/datatable": "dev-laravel6-support",
"cleverit/ubl_invoice": "1.*",
"codedge/laravel-selfupdater": "2.2.0",
"codedge/laravel-selfupdater": "2.3.0",
"collizo4sky/omnipay-wepay": "dev-address-fix#942f3e0",
"delatbabel/omnipay-fatzebra": "dev-master",
"dercoder/omnipay-ecopayz": "~1.0",
"dercoder/omnipay-paysafecard": "dev-master",
"digitickets/omnipay-barclays-epdq": "~3.0",
"digitickets/omnipay-datacash": "~3.0",
"digitickets/omnipay-gocardlessv2": "dev-payment-fix",
"doctrine/dbal": "2.5.x",
"digitickets/omnipay-realex": "~5.0",
"doctrine/dbal": "2.6.x",
"dompdf/dompdf": "0.6.2",
"ezyang/htmlpurifier": "~v4.7",
"fotografde/omnipay-checkoutcom": "~2.0",
"fruitcakestudio/omnipay-sisow": "~2.0",
"fzaninotto/faker": "^1.5",
"google/apiclient": "^2.0",
"guzzlehttp/guzzle": "^6.3",
@ -41,68 +54,57 @@
"jaybizzle/laravel-crawler-detect": "1.*",
"jlapp/swaggervel": "master-dev",
"jonnyw/php-phantomjs": "dev-fixes",
"justinbusschau/omnipay-secpay": "~2.0",
"laracasts/presenter": "dev-master",
"turbo124/framework": "5.5.51",
"laravel/framework": "^6.20",
"laravel/helpers": "^1.4",
"laravel/legacy-encrypter": "^1.0",
"laravel/socialite": "3.0.x-dev",
"laravel/socialite": "~4.4.1",
"laravel/tinker": "^1.0",
"laravelcollective/html": "5.5.*",
"laravelcollective/html": "^6.2",
"league/csv": "^9.1",
"league/flysystem-aws-s3-v3": "~1.0",
"league/flysystem-rackspace": "~1.0",
"league/fractal": "0.13.*",
"maatwebsite/excel": "~2.0",
"mashape/unirest-php": "^3.0",
"mpdf/mpdf": "7.1.7",
"nesbot/carbon": "^1.26",
"nwidart/laravel-modules": "2.0.*",
"omnipay/authorizenet": "dev-solution-id as 2.5.0",
"omnipay/firstdata": "^2.4",
"patricktalmadge/bootstrapper": "5.5.x",
"turbo124/google2fa-laravel": "0.1.2",
"predis/predis": "^1.1",
"simshaun/recurr": "dev-master",
"stripe/stripe-php": "^6.40",
"symfony/css-selector": "~3.1",
"turbo124/laravel-push-notification": "2.*",
"webpatser/laravel-countries": "dev-master#75992ad",
"websight/l5-google-cloud-storage": "dev-master",
"wepay/php-sdk": "^0.2",
"wildbit/postmark-php": "^2.5",
"abdala/omnipay-pagseguro": "0.2",
"agmscode/omnipay-agms": "~1.0",
"andreas22/omnipay-fasapay": "1.*",
"bramdevries/omnipay-paymill": "^1.0",
"cardgate/omnipay-cardgate": "~2.0",
"delatbabel/omnipay-fatzebra": "dev-master",
"dercoder/omnipay-ecopayz": "~1.0",
"dercoder/omnipay-paysafecard": "dev-master",
"digitickets/omnipay-barclays-epdq": "~3.0",
"digitickets/omnipay-datacash": "~3.0",
"digitickets/omnipay-realex": "~5.0",
"fotografde/omnipay-checkoutcom": "~2.0",
"fruitcakestudio/omnipay-sisow": "~2.0",
"justinbusschau/omnipay-secpay": "~2.0",
"lokielse/omnipay-alipay": "~1.4",
"maatwebsite/excel": "dev-carbon#8b17952",
"meebio/omnipay-creditcall": "dev-master",
"meebio/omnipay-secure-trading": "dev-master",
"mfauveau/omnipay-pacnet": "~2.0",
"mpdf/mpdf": "^8.0",
"nesbot/carbon": "^2.0",
"nwidart/laravel-modules": "2.0.*",
"omnipay/authorizenet": "dev-solution-id as 2.5.0",
"omnipay/bitpay": "dev-master",
"omnipay/braintree": "^1.1",
"omnipay/common": "2.5.2",
"omnipay/firstdata": "^2.4",
"omnipay/gocardless": "dev-master",
"omnipay/mollie": "3.*",
"omnipay/omnipay": "~2.3",
"omnipay/payfast": "~2.0",
"omnipay/stripe": "~2.0",
"patricktalmadge/bootstrapper": "5.12.x",
"pragmarx/google2fa-laravel": "0.1.4",
"predis/predis": "^1.1",
"simshaun/recurr": "dev-master",
"softcommerce/omnipay-paytrace": "~1.0",
"stripe/stripe-php": "^7",
"superbalist/laravel-google-cloud-storage": "^2.2",
"symfony/css-selector": "~3.1",
"therobfonz/laravel-mandrill-driver": "~1.0",
"turbo124/laravel-push-notification": "dev-master",
"vemcogroup/laravel-sparkpost-driver": "~2.0",
"vink/omnipay-komoju": "~1.0",
"omnipay/common": "2.5.2"
"webpatser/laravel-countries": "dev-master#75992ad",
"wepay/php-sdk": "^0.2",
"wildbit/postmark-php": "^2.5"
},
"require-dev": {
"symfony/dom-crawler": "~3.1",
"codeception/c3": "2.*",
"codeception/codeception": "2.*",
"phpspec/phpspec": "~2.1",
"phpspec/phpspec": "~6.1",
"phpunit/phpunit": "~5.7"
},
"autoload": {
@ -174,11 +176,11 @@
},
{
"type": "vcs",
"url": "https://github.com/hillelcoren/datatable"
"url": "https://github.com/turbo124/chumper-datatable"
},
{
"type": "vcs",
"url": "https://github.com/hillelcoren/php-phantomjs"
"url": "https://github.com/turbo124/php-phantomjs"
},
{
"type": "vcs",
@ -187,6 +189,22 @@
{
"type": "vcs",
"url": "https://github.com/hillelcoren/omnipay-authorizenet"
},
{
"type": "vcs",
"url": "https://github.com/turbo124/omnipay-common"
},
{
"type": "vcs",
"url": "https://github.com/turbo124/laravel-push-notification"
},
{
"type": "vcs",
"url": "https://github.com/turbo124/NotificationPusher"
},
{
"type": "vcs",
"url": "https://github.com/tainmar/Laravel-Excel"
}
]
}

6897
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -88,21 +88,6 @@ return [
'cipher' => env('APP_CIPHER', 'AES-256-CBC'),
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => env('LOG', 'single'),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
@ -155,11 +140,10 @@ return [
'Laravel\Socialite\SocialiteServiceProvider',
'Jlapp\Swaggervel\SwaggervelServiceProvider',
'Maatwebsite\Excel\ExcelServiceProvider',
Websight\GcsProvider\CloudStorageServiceProvider::class,
'Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider',
Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider::class,
Codedge\Updater\UpdaterServiceProvider::class,
Nwidart\Modules\LaravelModulesServiceProvider::class,
Barryvdh\Cors\ServiceProvider::class,
Fruitcake\Cors\CorsServiceProvider::class,
PragmaRX\Google2FALaravel\ServiceProvider::class,
'Chumper\Datatable\DatatableServiceProvider',
Laravel\Tinker\TinkerServiceProvider::class,
@ -175,7 +159,6 @@ return [
'App\Providers\RouteServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
'Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider',
],
@ -203,76 +186,75 @@ return [
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Gate' => 'Illuminate\Support\Facades\Gate',
'Hash' => 'Illuminate\Support\Facades\Hash',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Gate' => 'Illuminate\Support\Facades\Gate',
'Hash' => 'Illuminate\Support\Facades\Hash',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
// Added Class Aliases
'Form' => 'Collective\Html\FormFacade',
'HTML' => 'Collective\Html\HtmlFacade',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Alert' => 'Bootstrapper\Facades\Alert',
'Badge' => 'Bootstrapper\Facades\Badge',
'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb',
'Button' => 'Bootstrapper\Facades\Button',
'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup',
'ButtonToolbar' => 'Bootstrapper\Facades\ButtonToolbar',
'Carousel' => 'Bootstrapper\Facades\Carousel',
'DropdownButton' => 'Bootstrapper\Facades\DropdownButton',
'Helpers' => 'Bootstrapper\Facades\Helpers',
'Icon' => 'Bootstrapper\Facades\Icon',
'Label' => 'Bootstrapper\Facades\Label',
'MediaObject' => 'Bootstrapper\Facades\MediaObject',
'Navbar' => 'Bootstrapper\Facades\Navbar',
'Navigation' => 'Bootstrapper\Facades\Navigation',
'Paginator' => 'Bootstrapper\Facades\Paginator',
'Progress' => 'Bootstrapper\Facades\Progress',
'Tabbable' => 'Bootstrapper\Facades\Tabbable',
'Table' => 'Bootstrapper\Facades\Table',
'Thumbnail' => 'Bootstrapper\Facades\Thumbnail',
'Typeahead' => 'Bootstrapper\Facades\Typeahead',
'Typography' => 'Bootstrapper\Facades\Typography',
'Former' => 'Former\Facades\Former',
'Omnipay' => 'Omnipay\Omnipay',
'CreditCard' => 'Omnipay\Common\CreditCard',
'Image' => 'Intervention\Image\Facades\Image',
'Countries' => 'Webpatser\Countries\CountriesFacade',
'Carbon' => 'Carbon\Carbon',
'Rocketeer' => 'Rocketeer\Facades\Rocketeer',
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification',
'Crawler' => 'Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect',
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
'Updater' => Codedge\Updater\UpdaterFacade::class,
'Module' => Nwidart\Modules\Facades\Module::class,
'Form' => 'Collective\Html\FormFacade',
'HTML' => 'Collective\Html\HtmlFacade',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Alert' => 'Bootstrapper\Facades\Alert',
'Badge' => 'Bootstrapper\Facades\Badge',
'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb',
'Button' => 'Bootstrapper\Facades\Button',
'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup',
'ButtonToolbar' => 'Bootstrapper\Facades\ButtonToolbar',
'Carousel' => 'Bootstrapper\Facades\Carousel',
'DropdownButton' => 'Bootstrapper\Facades\DropdownButton',
'Helpers' => 'Bootstrapper\Facades\Helpers',
'Icon' => 'Bootstrapper\Facades\Icon',
'Label' => 'Bootstrapper\Facades\Label',
'MediaObject' => 'Bootstrapper\Facades\MediaObject',
'Navbar' => 'Bootstrapper\Facades\Navbar',
'Navigation' => 'Bootstrapper\Facades\Navigation',
'Paginator' => 'Bootstrapper\Facades\Paginator',
'Progress' => 'Bootstrapper\Facades\Progress',
'Tabbable' => 'Bootstrapper\Facades\Tabbable',
'Table' => 'Bootstrapper\Facades\Table',
'Thumbnail' => 'Bootstrapper\Facades\Thumbnail',
'Typeahead' => 'Bootstrapper\Facades\Typeahead',
'Typography' => 'Bootstrapper\Facades\Typography',
'Former' => 'Former\Facades\Former',
'Omnipay' => 'Omnipay\Omnipay',
'CreditCard' => 'Omnipay\Common\CreditCard',
'Image' => 'Intervention\Image\Facades\Image',
'Countries' => 'Webpatser\Countries\CountriesFacade',
'Carbon' => 'Carbon\Carbon',
'Rocketeer' => 'Rocketeer\Facades\Rocketeer',
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
'Crawler' => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class,
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
'Updater' => Codedge\Updater\UpdaterFacade::class,
'Module' => Nwidart\Modules\Facades\Module::class,
'Utils' => App\Libraries\Utils::class,
'Utils' => App\Libraries\Utils::class,
'DateUtils' => App\Libraries\DateUtils::class,
'HTMLUtils' => App\Libraries\HTMLUtils::class,
'CurlUtils' => App\Libraries\CurlUtils::class,
'Domain' => App\Constants\Domain::class,
'Domain' => App\Constants\Domain::class,
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
],

View file

@ -104,11 +104,13 @@ return [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
'clients' => [
'provider' => 'clients',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],

View file

@ -10,11 +10,11 @@ return [
| to accept any value.
|
*/
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['*'],
'allowedMethods' => ['*'],
'exposedHeaders' => [],
'maxAge' => 0,
'supports_credentials' => false,
'allowed_origins' => ['*'],
'allowed_headers' => ['*'],
'allowed_methods' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
];

View file

@ -133,6 +133,7 @@ return [
'redis' => [
'cluster' => false,
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),

122
config/datatables.php Normal file
View file

@ -0,0 +1,122 @@
<?php
return [
/*
* DataTables search options.
*/
'search' => [
/*
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
'smart' => true,
/*
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
*/
'multi_term' => true,
/*
* Case insensitive will search the keyword in lower case format.
* SQL: LOWER(column) LIKE LOWER(keyword)
*/
'case_insensitive' => true,
/*
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
'use_wildcards' => false,
/*
* Perform a search which starts with the given keyword.
* SQL: column LIKE "keyword%"
*/
'starts_with' => false,
],
/*
* DataTables internal index id response column name.
*/
'index_column' => 'DT_RowIndex',
/*
* List of available builders for DataTables.
* This is where you can register your custom dataTables builder.
*/
'engines' => [
'eloquent' => Yajra\DataTables\EloquentDataTable::class,
'query' => Yajra\DataTables\QueryDataTable::class,
'collection' => Yajra\DataTables\CollectionDataTable::class,
'resource' => Yajra\DataTables\ApiResourceDataTable::class,
],
/*
* DataTables accepted builder to engine mapping.
* This is where you can override which engine a builder should use
* Note, only change this if you know what you are doing!
*/
'builders' => [
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
//Illuminate\Database\Query\Builder::class => 'query',
//Illuminate\Support\Collection::class => 'collection',
],
/*
* Nulls last sql pattern for PostgreSQL & Oracle.
* For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction'
*/
'nulls_last_sql' => ':column :direction NULLS LAST',
/*
* User friendly message to be displayed on user if error occurs.
* Possible values:
* null - The exception message will be used on error response.
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
*/
'error' => env('DATATABLES_ERROR', null),
/*
* Default columns definition of dataTable utility functions.
*/
'columns' => [
/*
* List of columns hidden/removed on json response.
*/
'excess' => ['rn', 'row_num'],
/*
* List of columns to be escaped. If set to *, all columns are escape.
* Note: You can set the value to empty array to disable XSS protection.
*/
'escape' => '*',
/*
* List of columns that are allowed to display html content.
* Note: Adding columns to list will make us available to XSS attacks.
*/
'raw' => ['action'],
/*
* List of columns are are forbidden from being searched/sorted.
*/
'blacklist' => ['password', 'remember_token'],
/*
* List of columns that are only allowed fo search/sort.
* If set to *, all columns are allowed.
*/
'whitelist' => '*',
],
/*
* JsonResponse header and options config.
*/
'json' => [
'header' => [],
'options' => 0,
],
];

View file

@ -83,7 +83,7 @@ return [
//'service_account_certificate' => storage_path() . '/credentials.p12',
//'service_account_certificate_password' => env('GCS_PASSWORD', ''),
'project_id' => env('GCS_PROJECT_ID'),
'credentials' => storage_path() . '/gcs-credentials.json',
'key_file' => storage_path() . '/gcs-credentials.json',
],
],

52
config/hashing.php Normal file
View file

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

82
config/logging.php Normal file
View file

@ -0,0 +1,82 @@
<?php
use Monolog\Handler\StreamHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', env('LOG', 'stack')),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'tap'=>[\App\Logging\CustomizeSingleLogger::class]
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];

View file

@ -47,4 +47,6 @@ return [
'subscription_key' => env('MSBOT_LUIS_SUBSCRIPTION_KEY'),
],
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', false),
];

View file

@ -19,6 +19,7 @@ return [
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN',''),
'secret' => env('MAILGUN_SECRET',''),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'mandrill' => [

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