mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
remove legacy media.upload_limit references
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Improved image background overlay and tools
|
* Improved image background overlay and tools
|
||||||
* Update all Form classes to rely on `PageInterface` instead of `Page` class
|
* Update all Form classes to rely on `PageInterface` instead of `Page` class
|
||||||
|
* Removed `media.upload_limit` references
|
||||||
1. [](#bugfix)
|
1. [](#bugfix)
|
||||||
* Incorrect 2FA lang code [#1618](https://github.com/getgrav/grav-plugin-admin/issues/1618)
|
* Incorrect 2FA lang code [#1618](https://github.com/getgrav/grav-plugin-admin/issues/1618)
|
||||||
* Fixed potential undefined property in `onPageNotFound` event handling
|
* Fixed potential undefined property in `onPageNotFound` event handling
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ class AdminPlugin extends Plugin
|
|||||||
$twig->twig_vars['admin'] = $this->admin;
|
$twig->twig_vars['admin'] = $this->admin;
|
||||||
$twig->twig_vars['admin_version'] = $this->version;
|
$twig->twig_vars['admin_version'] = $this->version;
|
||||||
$twig->twig_vars['logviewer'] = new LogViewer();
|
$twig->twig_vars['logviewer'] = new LogViewer();
|
||||||
|
$twig->twig_vars['form_max_filesize'] = Form::getMaxFilesize();
|
||||||
|
|
||||||
$fa_icons_file = CompiledYamlFile::instance($this->grav['locator']->findResource('plugin://admin/themes/grav/templates/forms/fields/iconpicker/icons' . YAML_EXT));
|
$fa_icons_file = CompiledYamlFile::instance($this->grav['locator']->findResource('plugin://admin/themes/grav/templates/forms/fields/iconpicker/icons' . YAML_EXT));
|
||||||
$fa_icons = $fa_icons_file->content();
|
$fa_icons = $fa_icons_file->content();
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class AdminBaseController
|
|||||||
'random_name' => false,
|
'random_name' => false,
|
||||||
'accept' => ['image/*'],
|
'accept' => ['image/*'],
|
||||||
'limit' => 10,
|
'limit' => 10,
|
||||||
'filesize' => $config->get('system.media.upload_limit', 5242880) // 5MB
|
'filesize' => Utils::getUploadLimit()
|
||||||
], (array)$settings, ['name' => $this->post['name']]);
|
], (array)$settings, ['name' => $this->post['name']]);
|
||||||
|
|
||||||
$upload = $this->normalizeFiles($_FILES['data'], $settings->name);
|
$upload = $this->normalizeFiles($_FILES['data'], $settings->name);
|
||||||
|
|||||||
@@ -1624,8 +1624,8 @@ class AdminController extends AdminBaseController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$grav_limit = $config->get('system.media.upload_limit', 0);
|
|
||||||
// You should also check filesize here.
|
// You should also check filesize here.
|
||||||
|
$grav_limit = Utils::getUploadLimit();
|
||||||
if ($grav_limit > 0 && $_FILES['file']['size'] > $grav_limit) {
|
if ($grav_limit > 0 && $_FILES['file']['size'] > $grav_limit) {
|
||||||
$this->admin->json_response = [
|
$this->admin->json_response = [
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
{% set limit = not field.multiple ? 1 : files.limit %}
|
{% set limit = not field.multiple ? 1 : files.limit %}
|
||||||
|
|
||||||
{% block input %}
|
{% block input %}
|
||||||
{% set form_max_filesize = form_max_filesize ?: config.system.media.upload_limit / 1024 / 1024 %}
|
|
||||||
{% set page_can_upload = exists or (type == 'page' and not exists and not (field.destination starts with '@self' or field.destination starts with 'self@')) %}
|
{% set page_can_upload = exists or (type == 'page' and not exists and not (field.destination starts with '@self' or field.destination starts with 'self@')) %}
|
||||||
{% if form or (type is not defined or page_can_upload) %}
|
{% if form or (type is not defined or page_can_upload) %}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,7 @@
|
|||||||
{% set media_local = form.getMediaRoute() ?: base_url_relative_frontend|rtrim('/') ~ '/' ~ admin.route|trim('/') %}
|
{% set media_local = form.getMediaRoute() ?: base_url_relative_frontend|rtrim('/') ~ '/' ~ admin.route|trim('/') %}
|
||||||
{% set media_path = url(context.relativePagePath) %}
|
{% set media_path = url(context.relativePagePath) %}
|
||||||
{% set media_uri = context.mediaUri() %}
|
{% set media_uri = context.mediaUri() %}
|
||||||
{% set upload_limit = grav.config.system.media.upload_limit / 1024 / 1024 %}
|
{% set dropzone_settings = { maxFileSize: form_max_filesize }|merge(pagemedia_settings) %}
|
||||||
{% set dropzone_settings = { maxFileSize: upload_limit }|merge(pagemedia_settings) %}
|
|
||||||
|
|
||||||
<div class="form-field grid vertical {% if field.classes is defined %}{{ field.classes }}{% endif %}">
|
<div class="form-field grid vertical {% if field.classes is defined %}{{ field.classes }}{% endif %}">
|
||||||
<div class="form-label">
|
<div class="form-label">
|
||||||
|
|||||||
Reference in New Issue
Block a user