From 960174da96f8f74ffe28cd985e644cf9514630b4 Mon Sep 17 00:00:00 2001 From: "Noah Commandeur (TwoCream)" <157007478+noahcommandeur-twocream@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:16:27 +0200 Subject: [PATCH 01/11] Fix nice path support inheritance (#616) --- src/Controller/Admin/ElementController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Admin/ElementController.php b/src/Controller/Admin/ElementController.php index 31fe98c924..1bc30de37b 100644 --- a/src/Controller/Admin/ElementController.php +++ b/src/Controller/Admin/ElementController.php @@ -542,7 +542,7 @@ public function getNicePathAction(Request $request): JsonResponse $idProperty = $request->get('idProperty', 'id'); $methodName = 'get' . ucfirst($fieldname); if ($ownerType == 'object' && method_exists($source, $methodName)) { - $data = $source->$methodName(); + $data = DataObject\Service::useInheritedValues(true, [$source, $methodName]); $editModeData = $fd->getDataForEditmode($data, $source); // Inherited values show as an empty array if (is_array($editModeData) && !empty($editModeData)) { From 33a7befde058625b5c9e85a33c85896e7f31dde8 Mon Sep 17 00:00:00 2001 From: fabfischer Date: Fri, 19 Jul 2024 11:53:40 +0200 Subject: [PATCH 02/11] fix: search for e-mails does not break with a leading at-sign (#618) (cherry picked from commit 7999ef435d84f133d469539b5664c6b1d65c176e) --- src/Controller/Admin/EmailController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller/Admin/EmailController.php b/src/Controller/Admin/EmailController.php index 37257978a6..1d67bb606d 100644 --- a/src/Controller/Admin/EmailController.php +++ b/src/Controller/Admin/EmailController.php @@ -76,6 +76,10 @@ public function emailLogsAction(Request $request): JsonResponse $filterTerm = implode(' ', $parts); } + if (str_starts_with($filterTerm, '@')) { + $filterTerm = str_replace('@', '', $filterTerm); + } + $condition = '( MATCH (`from`,`to`,`cc`,`bcc`,`subject`,`params`) AGAINST (' . $list->quote($filterTerm) . ' IN BOOLEAN MODE) )'; if ($request->get('documentId')) { From 7cad2aa699dc350fcdb1d31161adc3661dab91af Mon Sep 17 00:00:00 2001 From: robertSt7 <104770750+robertSt7@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:50:10 +0200 Subject: [PATCH 03/11] Bug document Save Buttons (#622) * Fix: hidden menu entries in Save & Publish * Fix: hidden menu entries in Save & Publish --- public/js/pimcore/document/document.js | 13 +++++++++++++ public/js/pimcore/document/page_snippet.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/public/js/pimcore/document/document.js b/public/js/pimcore/document/document.js index 1201182b0a..cd09171c5a 100644 --- a/public/js/pimcore/document/document.js +++ b/public/js/pimcore/document/document.js @@ -246,6 +246,19 @@ pimcore.document.document = Class.create(pimcore.element.abstract, { } if (this.toolbarButtons.save && this.toolbarButtons.publish) { + if (this.isAllowed("save")) { + const menuItem = this.toolbarButtons.publish.menu.items.items.find( + element => element.text === t('save_draft') + ) + menuItem.setHidden(false) + } + if (this.isAllowed("settings")) { + const menuItem = this.toolbarButtons.publish.menu.items.items.find( + element => element.text === t('save_only_scheduled_tasks') + ) + menuItem.setHidden(false) + } + this.toolbarButtons.publish.show(); } diff --git a/public/js/pimcore/document/page_snippet.js b/public/js/pimcore/document/page_snippet.js index 812f57e44e..33ec870238 100644 --- a/public/js/pimcore/document/page_snippet.js +++ b/public/js/pimcore/document/page_snippet.js @@ -38,8 +38,8 @@ pimcore.document.page_snippet = Class.create(pimcore.document.document, { height: 49, }); - const tabPanel = this.getTabPanel(); const toolbar = this.getLayoutToolbar(); + const tabPanel = this.getTabPanel(); if (pimcore.helpers.checkIfNewHeadbarLayoutIsEnabled()) { this.tab = new Ext.Panel({ From afa10bff2f8bfe9c8af7b6b75885bc403f6984f0 Mon Sep 17 00:00:00 2001 From: robertSt7 <104770750+robertSt7@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:30:18 +0200 Subject: [PATCH 04/11] [Security]: Disclosed system and database information behind /admin firewall via statistics (#625) * Fix: Disclosed system and database information behind /admin firewall via statistics * Apply php-cs-fixer changes --------- Co-authored-by: robertSt7 --- config/services.yaml | 6 ++++++ public/js/pimcore/startup.js | 22 ++++++++++++---------- src/Controller/Admin/IndexController.php | 20 ++++++++++++++++++-- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 620201a8de..94c8951360 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -18,6 +18,12 @@ services: public: true tags: ['controller.service_arguments'] + Pimcore\Bundle\AdminBundle\Controller\Admin\IndexController: + public: true + arguments: + $httpClient: '@pimcore.http_client' + tags: [ 'controller.service_arguments' ] + # # COMMANDS # diff --git a/public/js/pimcore/startup.js b/public/js/pimcore/startup.js index c2df2747d3..21327cc775 100644 --- a/public/js/pimcore/startup.js +++ b/public/js/pimcore/startup.js @@ -562,19 +562,21 @@ Ext.onReady(function () { request.open('GET', Routing.generate('pimcore_admin_index_statistics')); request.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - request.onload = function () { - if (this.status >= 200 && this.status < 400) { - var res = Ext.decode(this.response); + if (pimcore.currentuser.admin) { + request.onload = function () { + if (this.status >= 200 && this.status < 400) { + var res = Ext.decode(this.response); - var request = new XMLHttpRequest(); - request.open('POST', "https://liveupdate.pimcore.org/statistics"); + var request = new XMLHttpRequest(); + request.open('POST', "https://liveupdate.pimcore.org/statistics"); - var data = new FormData(); - data.append('data', encodeURIComponent(JSON.stringify(res))); + var data = new FormData(); + data.append('data', encodeURIComponent(JSON.stringify(res))); - request.send(data); - } - }; + request.send(data); + } + }; + } request.send(data); } } diff --git a/src/Controller/Admin/IndexController.php b/src/Controller/Admin/IndexController.php index dc3c4b3e1c..cd051502ff 100644 --- a/src/Controller/Admin/IndexController.php +++ b/src/Controller/Admin/IndexController.php @@ -18,6 +18,7 @@ use Doctrine\DBAL\Connection; use Exception; +use GuzzleHttp\ClientInterface; use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController; use Pimcore\Bundle\AdminBundle\Event\AdminEvents; use Pimcore\Bundle\AdminBundle\Event\IndexActionSettingsEvent; @@ -61,7 +62,8 @@ class IndexController extends AdminAbstractController implements KernelResponseE { public function __construct( protected EventDispatcherInterface $eventDispatcher, - protected TranslatorInterface $translator + protected TranslatorInterface $translator, + protected ClientInterface $httpClient ) { } @@ -156,7 +158,21 @@ public function statisticsAction(Request $request, Connection $db, KernelInterfa $data = []; } - return $this->adminJson($data); + if ($this->getAdminUser()->isAdmin()) { + return $this->adminJson($data); + } + + $response = $this->httpClient->request( + 'POST', + 'https://liveupdate.pimcore.org/statistics', + [ + 'body' => json_encode($data), + ] + ); + + return $this->adminJson([ + 'success' => ($response->getStatusCode() >= 200 && $response->getStatusCode() < 400), + ]); } protected function addRuntimePerspective(array &$templateParams, User $user): static From 6fbe41c4d6d674abbe0f3af040133a4f07f5b56d Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Fri, 26 Jul 2024 08:13:34 +0200 Subject: [PATCH 05/11] reduce queries in tags get children by id (#629) --- src/Controller/Admin/TagsController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Controller/Admin/TagsController.php b/src/Controller/Admin/TagsController.php index 277e7a1204..7fa2705a57 100644 --- a/src/Controller/Admin/TagsController.php +++ b/src/Controller/Admin/TagsController.php @@ -154,12 +154,14 @@ public function treeGetChildrenByIdAction(Request $request): JsonResponse protected function convertTagToArray(Tag $tag, bool $showSelection, array $assignedTagIds, bool $loadChildren = false, bool $recursiveChildren = false): array { + $hasChildren = $tag->hasChildren(); + $tagArray = [ 'id' => $tag->getId(), 'text' => $tag->getName(), 'path' => $tag->getNamePath(), - 'expandable' => $tag->hasChildren(), - 'leaf' => !$tag->hasChildren(), + 'expandable' => $hasChildren, + 'leaf' => !$hasChildren, 'iconCls' => 'pimcore_icon_element_tags', 'qtipCfg' => [ 'title' => 'ID: ' . $tag->getId(), @@ -170,7 +172,7 @@ protected function convertTagToArray(Tag $tag, bool $showSelection, array $assig $tagArray['checked'] = isset($assignedTagIds[$tag->getId()]); } - if ($loadChildren) { + if ($hasChildren && $loadChildren) { $children = $tag->getChildren(); $loadChildren = $recursiveChildren; foreach ($children as $child) { From eb9289d25f61d3832fbb77f1eb0b742de730df7d Mon Sep 17 00:00:00 2001 From: Norbert Bogucki Date: Fri, 26 Jul 2024 09:16:04 +0200 Subject: [PATCH 06/11] [PIMCORE-17387] Fix bug with reorder of localized fields in class (#635) * [PIMCORE-17387] Fix bug with reorder of localized fields in class * Respect block data type too --------- Co-authored-by: markus-moser --- public/js/pimcore/object/helpers/layout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/pimcore/object/helpers/layout.js b/public/js/pimcore/object/helpers/layout.js index ac23df74b4..53e4c4fa01 100644 --- a/public/js/pimcore/object/helpers/layout.js +++ b/public/js/pimcore/object/helpers/layout.js @@ -34,8 +34,8 @@ pimcore.object.helpers.layout = { button: [], text: [], root: ["panel", "region", "tabpanel", "accordion", "text", "iframe", "button", "fieldcontainer", "fieldset"], - localizedfields: ["panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"], - block: ["panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"] + localizedfields: ["data", "panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"], + block: ["data", "panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"] }; }, From 8a47136663bc0ed2ab5e134449a2d1699448a4a0 Mon Sep 17 00:00:00 2001 From: Melissa Kittl Date: Fri, 26 Jul 2024 10:56:09 +0200 Subject: [PATCH 07/11] Improve logic for classification store in diff_versions to also show entry if a group is only active in one version (was added / removed) in the other version (#550) --- .../admin/data_object/data_object/diff_versions.html.twig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/admin/data_object/data_object/diff_versions.html.twig b/templates/admin/data_object/data_object/diff_versions.html.twig index 4e87bd68ee..adc9330ec0 100644 --- a/templates/admin/data_object/data_object/diff_versions.html.twig +++ b/templates/admin/data_object/data_object/diff_versions.html.twig @@ -125,7 +125,7 @@ {% endif %} {% for activeGroupId, enabled in existingGroups %} - {% if activeGroups1[activeGroupId] is defined and activeGroups2[activeGroupId] is defined %} + {% if activeGroups1[activeGroupId] is defined or activeGroups2[activeGroupId] is defined %} {% set groupDefinition = pimcore_object_classificationstore_group(activeGroupId) %} {% if groupDefinition is not empty %} {% set keyGroupRelations = groupDefinition.getRelations() %} @@ -146,7 +146,8 @@ {% if isImportPreview is not defined or isNew is not defined %} {{ preview1 | raw }} {% endif %} - {% set fieldIsEqual = keyDef is instanceof('\\Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\EqualComparisonInterface') and not keyDef.isEqual(keyData1, keyData2) ? 'modified' : '' %} + {% set isActiveInOneVersionOnly = activeGroups1[activeGroupId] is not defined or activeGroups2[activeGroupId] is not defined %} + {% set fieldIsEqual = keyDef is instanceof('\\Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\EqualComparisonInterface') and not keyDef.isEqual(keyData1, keyData2) or isActiveInOneVersionOnly ? 'modified' : '' %} {{ preview2 }} {% endfor %} From 022e87f147eaa7a39debb69b1cd9662ede49a535 Mon Sep 17 00:00:00 2001 From: Alex Rothberg Date: Tue, 30 Jul 2024 07:13:02 -0400 Subject: [PATCH 08/11] Add missing workflow_transition_unsaved_data string (#624) --- translations/admin.en.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/translations/admin.en.yaml b/translations/admin.en.yaml index 2758fde929..3cbd9a8064 100644 --- a/translations/admin.en.yaml +++ b/translations/admin.en.yaml @@ -790,6 +790,7 @@ there_are_more_items: 'There are more items than displayed' workflow_actions: Actions workflow_notes_requred_field_message: '"%s" is a required field.' workflow_transition_applied_successfully: 'Action applied successfully' +workflow_transition_unsaved_data: 'Your data changes have not been saved yet. Please, save changes before applying workflow transition.' workflow_change_email_notification_subject: "Workflow update for %s in workflow '%s'" workflow_details: 'Workflow Details' workflow_graph: 'Workflow Graph' @@ -1020,4 +1021,4 @@ female: Female pdf_js_unsafe: This PDF file contains JavaScript. If you want to view it, please download and open it in your local PDF viewer. pdf_scan_in_progress: 'Preview not available: PDF is being scanned. This may take a while.' invalid_option: 'Invalid Option field [ {field} ]: Please choose a valid option for select / multiselect field [ {field} ]. Current value: "{option}"' -respect_timezone: 'Respect timezone' \ No newline at end of file +respect_timezone: 'Respect timezone' From cac664d632a0416ae13ddc7b62708234eb1d862e Mon Sep 17 00:00:00 2001 From: Bernhard Rusch Date: Fri, 2 Aug 2024 09:38:03 +0200 Subject: [PATCH 09/11] Data Object: Version preview fix for localized values inside field collections (#621) --- .../admin/data_object/data_object/preview_version.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/admin/data_object/data_object/preview_version.html.twig b/templates/admin/data_object/data_object/preview_version.html.twig index 178725a4c6..dc6db5142a 100644 --- a/templates/admin/data_object/data_object/preview_version.html.twig +++ b/templates/admin/data_object/data_object/preview_version.html.twig @@ -160,7 +160,7 @@ {{ lfd.getTitle()|trans([],'admin') }} ({{ language }}) {{ fieldItem.fieldName }} - {{ lfd.getName() }}/{{ language }} - {{ fieldItem.Localizedfields.getLocalizedValue(lfd.getName(), language) }} + {{ lfd.getVersionPreview(fieldItem.Localizedfields.getLocalizedValue(lfd.getName(), language)) | raw }} {% endfor %} {% endfor %} From c3f0648dde6d7ede017b46081a79d45ba42bb3e4 Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Fri, 2 Aug 2024 09:51:31 +0200 Subject: [PATCH 10/11] Fix ManyToOne relation width with combo display mode (#636) * Fix ManyToOne relation with combo display mode * Update manyToOneRelation.js --- public/js/pimcore/object/tags/manyToOneRelation.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/pimcore/object/tags/manyToOneRelation.js b/public/js/pimcore/object/tags/manyToOneRelation.js index f5bf237ece..48ae159dc8 100644 --- a/public/js/pimcore/object/tags/manyToOneRelation.js +++ b/public/js/pimcore/object/tags/manyToOneRelation.js @@ -171,6 +171,12 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac href.cls = 'pimcore_droptarget_display_edit'; href.fieldBodyCls = 'pimcore_droptarget_display x-form-trigger-wrap'; this.component = new Ext.form.field.Display(href); + this.component.on('afterrender', function (el) { + el.inputEl.setWidth(href.width); + el.inputEl.setStyle({ + 'overflow': 'hidden' + }); + }); } if (this.data.published === false) { @@ -205,12 +211,6 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac pimcore.helpers.openElement(this.data.id, this.data.type, subtype); }.bind(this)); }.bind(this)); - this.component.on('afterrender', function (el) { - el.inputEl.setWidth(href.width); - el.inputEl.setStyle({ - 'overflow': 'hidden' - }); - }); var items = [this.component, { xtype: "button", From 442e7589116de1abb27b581665cd57f48d136c7b Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Wed, 7 Aug 2024 11:09:07 +0200 Subject: [PATCH 11/11] [Task]: Removing symfony/string conflict(#649) --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 9c05284ecb..37e25a903b 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "php": "~8.1.0 || ~8.2.0 || ~8.3.0", "cbschuld/browser.php": "^1.9.6", "phpoffice/phpspreadsheet": "^1.24 || ^2.1", - "pimcore/pimcore": "~11.3.0", + "pimcore/pimcore": "~11.3.1", "symfony/webpack-encore-bundle": "^1.13.2" }, "require-dev": { @@ -40,9 +40,6 @@ "kernel/Kernel.php" ] }, - "conflict": { - "symfony/string": "<6.0" - }, "extra": { "branch-alias": { "1.x-dev": "1.5.x-dev"