Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fix missing right checks on some ajax config endpoints and escape default value and URL field output.
- Fix item creation with null value for mandatory fields
- Fix search crash when two containers share a dropdown field with the same name.
- Fix handle native GLPI dropdown types when binding additional fields to form destination
Expand Down
2 changes: 1 addition & 1 deletion ajax/container_display_condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @link https://github.com/pluginsGLPI/fields
* -------------------------------------------------------------------------
*/
Session::checkLoginUser();
Session::checkRight('config', READ);

if (isset($_GET['action'])) {
if ($_GET['action'] === 'get_add_form') {
Expand Down
2 changes: 2 additions & 0 deletions ajax/container_itemtypes_dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

Session::checkLoginUser();

PluginFieldsContainer::showFormItemtype($_REQUEST);
2 changes: 2 additions & 0 deletions ajax/container_subtype_dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

Session::checkLoginUser();

PluginFieldsContainer::showFormSubtype($_REQUEST, true);
2 changes: 1 addition & 1 deletion ajax/field_specific_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

header('Content-Type: text/html; charset=UTF-8');
Html::header_nocache();
Session::checkLoginUser();
Session::checkRight('config', READ);

$id = $_POST['id'];
$type = $_POST['type'];
Expand Down
2 changes: 1 addition & 1 deletion ajax/reorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

use Glpi\DBAL\QueryExpression;

Session::checkLoginUser();
Session::checkRight('config', UPDATE);

if (
!array_key_exists('container_id', $_POST)
Expand Down
2 changes: 1 addition & 1 deletion ajax/status_override.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* -------------------------------------------------------------------------
*/

Session::checkLoginUser();
Session::checkRight('config', READ);

if (isset($_GET['action'])) {
if ($_GET['action'] === 'get_status_dropdown') {
Expand Down
2 changes: 2 additions & 0 deletions front/export_to_yaml.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

include(__DIR__ . '/../hook.php');

Session::checkRight('config', READ);
Expand Down
2 changes: 2 additions & 0 deletions front/labeltranslation.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

Session::checkRight('config', UPDATE);

$translation = new PluginFieldsLabelTranslation();
Expand Down
2 changes: 2 additions & 0 deletions front/profile.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

Session::checkRight('config', UPDATE);

if (isset($_POST['update'])) {
Expand Down
2 changes: 2 additions & 0 deletions front/regenerate_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

include(__DIR__ . '/../hook.php');

Session::checkRight('config', READ);
Expand Down
2 changes: 1 addition & 1 deletion inc/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public function showSummary($container)
echo Dropdown::getDropdownName($table, $this->fields['default_value']);
}
} else {
echo $this->fields['default_value'];
echo htmlspecialchars((string) $this->fields['default_value']);
}

echo '</td>';
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

require_once __DIR__ . '/../../src/Plugin.php';

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
Expand Down
2 changes: 1 addition & 1 deletion templates/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

{% elseif type == 'url' %}
{% set ext_link %}
{% if value|length %}
{% if value|length and value matches '/^(https?|mailto):/i' %}
<a target="_blank" href="{{ value }}">
<i class="ti ti-external-link"></i>
{{ __('show', 'fields') }}
Expand Down
2 changes: 2 additions & 0 deletions tests/Units/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

namespace GlpiPlugin\Field\Tests\Units;

use Computer;
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

declare(strict_types=1);

require __DIR__ . '/../../../tests/bootstrap.php';

if (!Plugin::isPluginActive("fields")) {
Expand Down