Make upload size globally available #2828

This commit is contained in:
James Cole 2020-03-19 08:43:52 +01:00
parent 75afe35e98
commit 6129b9d25c
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
4 changed files with 8 additions and 15 deletions

View File

@ -66,10 +66,6 @@ class BillController extends Controller
{
parent::__construct();
$maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
app('view')->share('showBudget', true);
$this->middleware(

View File

@ -61,6 +61,14 @@ class Controller extends BaseController
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
app('view')->share('FF_VERSION', config('firefly.version'));
// upload size
$maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
// share is alpha, is beta
$isAlpha = false;
if (false !== strpos(config('firefly.version'), 'alpha')) {

View File

@ -46,10 +46,6 @@ class CreateController extends Controller
{
parent::__construct();
$maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
$this->middleware(
static function ($request, $next) {
app('view')->share('title', (string) trans('firefly.transactions'));

View File

@ -47,13 +47,6 @@ class EditController extends Controller
{
parent::__construct();
$maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
// some useful repositories:
$this->middleware(
static function ($request, $next) {