Skip to content

Fix item validation when loading trees - #123

Open
stonebuzz wants to merge 5 commits into
mainfrom
fix_core
Open

Fix item validation when loading trees#123
stonebuzz wants to merge 5 commits into
mainfrom
fix_core

Conversation

@stonebuzz

@stonebuzz stonebuzz commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

Fix item validation when loading trees

Screenshots (if appropriate):

@stonebuzz stonebuzz self-assigned this Aug 24, 2026
@stonebuzz
stonebuzz marked this pull request as draft August 24, 2026 10:17
@stonebuzz
stonebuzz requested a review from Rom1-B August 24, 2026 13:13
@stonebuzz
stonebuzz marked this pull request as ready for review August 24, 2026 13:13
Comment thread front/config.form.php
if (isset($_POST['target']) && !in_array($_POST['target'], ['_blank', 'right'], true)) {
unset($_POST['target']);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
foreach (['folderLinks', 'useSelection', 'useLines', 'useIcons', 'closeSameLevel', 'itemName', 'locationName'] as $field) {
if (isset($_POST[$field])) {
$_POST[$field] = (int) $_POST[$field];
}
}

Comment thread front/preference.form.php
Comment on lines 36 to +45
if (isset($_POST['plugin_treeview_user_preferences_save'])) {
$pref->update($_POST);
if (!($own_id = $pref->checkIfPreferenceExists(Session::getLoginUserID()))) {
$own_id = $pref->addDefaultPreference(Session::getLoginUserID());
if (!$own_id) {
Session::addMessageAfterRedirect(__s('Unable to save preferences', 'treeview'), false, ERROR);
Html::back();
}
}

$pref->update(['id' => $own_id, 'show_on_load' => (int) ($_POST['show_on_load'] ?? 0)]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a functional test for the preference-ownership fix and the entity/right filtering in getNodesFromDb()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants