[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] calendar: fix PHP warnings when viewing and creating calendar events
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a29070e174cc_38564a5a05063a@gitlab-sidekiq-low-urgency-cpu-bound-v2-5488cfffb7-74nch.mail> |
ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
277f055b by Alfred Syatsukwa at 2026-06-10T06:28:11+00:00
[FIX] calendar: fix PHP warnings when viewing and creating calendar events
---
* [FIX] calendar: Fix JitFilter asArray misuse in file upload services
* [FIX] calendar: add listroles and listprioritycolors to view_item to fix null offset warnings
See merge request tikiwiki/tiki!10478
- - - - -
3 changed files:
- lib/core/Services/Calendar/Controller.php
- lib/core/Services/File/Controller.php
- lib/core/Services/File/FinderController.php
Changes:
=====================================
lib/core/Services/Calendar/Controller.php
=====================================
@@ -755,6 +755,9 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
'preview' => $preview,
// related tracker items
'trackerItems' => ! empty($trackerItems) ? $trackerItems : [],
+ // legacy names expected by templates/calendar/view_item.tpl
+ 'listroles' => ['0' => '', '1' => tra('required'), '2' => tra('optional'), '3' => tra('non-participant')],
+ 'listprioritycolors' => ['fff', 'fdd', 'fcc', 'fbb', 'faa', 'f99', 'e88', 'd77', 'c66', 'b66', 'a66'],
];
}
=====================================
lib/core/Services/File/Controller.php
=====================================
@@ -109,7 +109,7 @@ class Services_File_Controller
$fileId = false;
}
- if (! empty($input->asArray('user')) && is_array($input->user->asArray())) {
+ if (! empty($input->asArray('user')) && $input->isArray('user')) {
$asuser = $input->asArray('user')[0];
}
$title = $input->title->text();
@@ -260,29 +260,10 @@ class Services_File_Controller
if (isset($_FILES['files']) && is_array($_FILES['files']['tmp_name']) && $util->checkCsrf()) {
// a few other params that are still arrays but shouldn't be (mostly)
- if (! empty($input->asArray('galleryId')) && is_array($input->galleryId->asArray())) {
- $input->offsetSet('galleryId', $input->asArray('galleryId')[0]);
- }
- if (! empty($input->asArray('hit_limit')) && is_array($input->hit_limit->asArray())) {
- $input->offsetSet('hit_limit', $input->asArray('hit_limit')[0]);
- }
- if (! empty($input->asArray('isbatch')) && is_array($input->isbatch->asArray())) {
- $input->offsetSet('isbatch', $input->asArray('isbatch')[0]);
- }
- if (! empty($input->asArray('deleteAfter')) && is_array($input->deleteAfter->asArray())) {
- $input->offsetSet('deleteAfter', $input->asArray('deleteAfter')[0]);
- }
- if (! empty($input->asArray('deleteAfter_unit')) && is_array($input->deleteAfter_unit->asArray())) {
- $input->offsetSet('deleteAfter_unit', $input->asArray('deleteAfter_unit')[0]);
- }
- if (! empty($input->asArray('author')) && is_array($input->author->asArray())) {
- $input->offsetSet('author', $input->asArray('author')[0]);
- }
- if (! empty($input->asArray('user')) && is_array($input->user->asArray())) {
- $input->offsetSet('user', $input->asArray('user')[0]);
- }
- if (! empty($input->asArray('listtoalert')) && is_array($input->listtoalert->asArray())) {
- $input->offsetSet('listtoalert', $input->asArray('listtoalert')[0]);
+ foreach (['galleryId', 'hit_limit', 'isbatch', 'deleteAfter', 'deleteAfter_unit', 'author', 'user', 'listtoalert'] as $arrayInputKey) {
+ if (! empty($input->asArray($arrayInputKey)) && $input->isArray($arrayInputKey)) {
+ $input->offsetSet($arrayInputKey, $input->asArray($arrayInputKey)[0]);
+ }
}
$gal_info = $this->checkTargetGallery($input);
@@ -939,8 +920,8 @@ class Services_File_Controller
// The file uploader sends galleryId as an array, while elFinder and older methods send it as an integer. This logic handles all cases.
// First, check for the array format used by the file uploader.
- $galleryIdFromInput = $input->galleryId->asArray();
- if (! empty($galleryIdFromInput) && is_array($galleryIdFromInput) && isset($galleryIdFromInput[0])) {
+ $galleryIdFromInput = $input->asArray('galleryId');
+ if (! empty($galleryIdFromInput) && $input->isArray('galleryId') && isset($galleryIdFromInput[0])) {
$galleryId = (int) $galleryIdFromInput[0];
} elseif ($input->galleryId->int()) {
// Second, check for an integer format, used by elFinder and other parts of Tiki.
=====================================
lib/core/Services/File/FinderController.php
=====================================
@@ -194,7 +194,7 @@ class Services_File_FinderController
if ($input->insertion_syntax->text()) {
$params['insertion_syntax'] = $input->insertion_syntax->text();
}
- $hashes = $input->hash->asArray();
+ $hashes = $input->asArray('hash');
$fileInfos = [];
foreach ($hashes as $hash) {
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/277f055beb74590918a6c604c4d4a501137fccb5
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/277f055beb74590918a6c604c4d4a501137fccb5
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs