diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-08-29 15:29:26 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-08-29 15:29:26 +0000 |
| commit | 7ebc446999286d42affc5d27ea888dd997a3d95c (patch) | |
| tree | e1393a88d17fcc74276460604d9ce9998379bdac /app | |
| parent | fd375126142decc222c1f61369dc198fb58b7f6e (diff) | |
prevent php8 warnings, fixes #3106
Closes #3106
Merge request studip/studip!2095
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/course/contentmodules.php | 8 | ||||
| -rw-r--r-- | app/controllers/course/elearning.php | 5 | ||||
| -rw-r--r-- | app/controllers/course/wizard.php | 2 | ||||
| -rw-r--r-- | app/controllers/new_password.php | 1 | ||||
| -rw-r--r-- | app/controllers/resources/room_request.php | 2 | ||||
| -rw-r--r-- | app/views/course/contentmodules/info.php | 4 |
6 files changed, 13 insertions, 9 deletions
diff --git a/app/controllers/course/contentmodules.php b/app/controllers/course/contentmodules.php index 06d46de..04eb846 100644 --- a/app/controllers/course/contentmodules.php +++ b/app/controllers/course/contentmodules.php @@ -298,22 +298,22 @@ class Course_ContentmodulesController extends AuthenticatedController 'visibility' => $visibility, 'active' => (bool) $tool, ]; - if ($metadata['icon_clickable']) { + if (!empty($metadata['icon_clickable'])) { $list[$plugin_id]['icon'] = $metadata['icon_clickable'] instanceof Icon ? $metadata['icon_clickable']->asImagePath() : Icon::create($plugin->getPluginURL().'/'.$metadata['icon_clickable'])->asImagePath(); - } elseif ($metadata['icon']) { + } elseif (!empty($metadata['icon'])) { $list[$plugin_id]['icon'] = $metadata['icon'] instanceof Icon ? $metadata['icon']->asImagePath() : Icon::create($plugin->getPluginURL().'/'.$metadata['icon'])->asImagePath(); } else { $list[$plugin_id]['icon'] = null; } - $list[$plugin_id]['summary'] = $metadata['summary']; + $list[$plugin_id]['summary'] = $metadata['summary'] ?? null; $list[$plugin_id]['mandatory'] = $this->sem_class->isModuleMandatory(get_class($plugin)); $list[$plugin_id]['highlighted'] = (bool) $plugin->isHighlighted(); $list[$plugin_id]['highlight_text'] = $plugin->getHighlightText(); - $list[$plugin_id]['category'] = $metadata['category']; + $list[$plugin_id]['category'] = $metadata['category'] ?? null; } return $list; diff --git a/app/controllers/course/elearning.php b/app/controllers/course/elearning.php index a8a7626..6e67b64 100644 --- a/app/controllers/course/elearning.php +++ b/app/controllers/course/elearning.php @@ -57,7 +57,10 @@ class Course_ElearningController extends AuthenticatedController if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select])) { unset($this->cms_select); } - if ($this->seminar_id != $_SESSION['elearning_open_close']["id"]) { + if ( + isset($_SESSION['elearning_open_close']['id']) + && $this->seminar_id !== $_SESSION['elearning_open_close']['id'] + ) { unset($_SESSION['cache_data']); unset($_SESSION['elearning_open_close']); } diff --git a/app/controllers/course/wizard.php b/app/controllers/course/wizard.php index 009e052..636d6eb 100644 --- a/app/controllers/course/wizard.php +++ b/app/controllers/course/wizard.php @@ -118,7 +118,7 @@ class Course_WizardController extends AuthenticatedController $values[$iterator->key()] = $iterator->current(); $iterator->next(); } - if ($this->steps[$step_number]['classname']) { + if (!empty($this->steps[$step_number]['classname'])) { $this->setStepValues($this->steps[$step_number]['classname'], $values); } // Back or forward button clicked -> set next step accordingly. diff --git a/app/controllers/new_password.php b/app/controllers/new_password.php index 5132c48..525d73b 100644 --- a/app/controllers/new_password.php +++ b/app/controllers/new_password.php @@ -111,6 +111,7 @@ class NewPasswordController extends StudipController $password = Request::get('new_password'); $confirm = Request::get('new_password_confirm'); + $errors = []; if (!$validator->ValidatePassword($password)) { $errors[] = _('Das Passwort ist zu kurz. Es sollte mindestens 8 Zeichen lang sein.'); } else if ($password !== $confirm) { diff --git a/app/controllers/resources/room_request.php b/app/controllers/resources/room_request.php index f128f23..db892e0 100644 --- a/app/controllers/resources/room_request.php +++ b/app/controllers/resources/room_request.php @@ -1997,7 +1997,7 @@ class Resources_RoomRequestController extends AuthenticatedController if ($save_only) { // redirect to reload all infos and showing the most current ones $this->redirect('resources/room_request/resolve/' . $request_id); - } elseif (Request::isDialog()) { + } elseif (Request::isDialog() && Context::get()) { $this->response->add_header('X-Dialog-Execute', '{"func": "STUDIP.AdminCourses.App.loadCourse", "payload": "'.Context::get()->id.'"}'); } } diff --git a/app/views/course/contentmodules/info.php b/app/views/course/contentmodules/info.php index 18d7ccf..11bf9dc 100644 --- a/app/views/course/contentmodules/info.php +++ b/app/views/course/contentmodules/info.php @@ -29,8 +29,8 @@ </div> </div> <div class="content-modules-controls-vue-app" is="ContentModulesControl" module_id="<?= htmlReady($plugin->getPluginId()) ?>"></div> - <? $keywords = preg_split( "/;/", $metadata['keywords'], -1, PREG_SPLIT_NO_EMPTY) ?> - <? if (count($keywords)) : ?> + <? $keywords = preg_split( "/;/", $metadata['keywords'] ?? '', -1, PREG_SPLIT_NO_EMPTY) ?> + <? if (count($keywords) > 0) : ?> <ul class="keywords"> <? foreach ($keywords as $keyword) : ?> <li> |
