diff --git a/app/controllers/admin/extern.php b/app/controllers/admin/extern.php index 41833b12dd99dc99163253bbdb8c0b920d259a1f..559868e3351ec66cde90222ac9256240b801ab7f 100644 --- a/app/controllers/admin/extern.php +++ b/app/controllers/admin/extern.php @@ -66,8 +66,8 @@ class Admin_ExternController extends AuthenticatedController ExternPageConfig::findEachBySQL( function ($c) use (&$configs, &$count_not_migrated) { $configs[$c->type][] = $c; - if (isset($c->conf['not_fixed_after_migration'])) { - $count_not_migrated++; + if (isset($c->conf['not_fixed_after_migration'])) { + $count_not_migrated++; } }, "range_id = ?", [$this->range] @@ -165,7 +165,7 @@ class Admin_ExternController extends AuthenticatedController if ($this->page->page_config->isNew()) { PageLayout::postSuccess(sprintf( _('Eine neue externe Seite "%$1s" vom Typ %$2s wurde angelegt.'), - htmlReady($this->page->name), + htmlReady($this->page->name), htmlReady($this->page->type) )); } else { @@ -259,7 +259,11 @@ class Admin_ExternController extends AuthenticatedController */ public function info_action(string $config_id) { - $this->page = ExternPage::get(ExternPageConfig::find($config_id)); + $config = ExternPageConfig::find($config_id); + if (!$config) { + throw new Exception('ExternPageConfig object not found!'); + } + $this->page = ExternPage::get($config); if ($this->page->author) { $this->author = '<a href="' . URLHelper::getLink('dispatch.php/profile', ['username' => $this->page->author->username]) @@ -364,7 +368,7 @@ class Admin_ExternController extends AuthenticatedController $config->author_id = $config->editor_id = $GLOBALS['user']->id; $config->store(); PageLayout::postSuccess( - sprintf(_('Die Konfiguration "%s" wurde erfolgreich importiert.'), + sprintf(_('Die Konfiguration "%s" wurde erfolgreich importiert.'), htmlReady($config->name) )); } diff --git a/app/views/institute/extern/extern_config/persondetails.php b/app/views/institute/extern/extern_config/persondetails.php index 311551d53d8730debe57783eb433b6c9d4c8b205..897703db500aa86bec5c15a30ddffa8097361011 100644 --- a/app/views/institute/extern/extern_config/persondetails.php +++ b/app/views/institute/extern/extern_config/persondetails.php @@ -85,7 +85,7 @@ <select class="nested-select" name="semclass[]" multiple> <? foreach ($GLOBALS['SEM_CLASS'] as $key => $sem_class) : ?> <? if ($sem_class['show_browse']) : ?> - <option value="<?= $key ?>"<?= in_array($key, $page->semclass) ? ' selected' : '' ?>> + <option value="<?= $key ?>"<?= in_array($key, $page->semclass ?? []) ? ' selected' : '' ?>> <?= htmlReady($sem_class['name']) ?> </option> <? endif ?> diff --git a/app/views/institute/extern/index.php b/app/views/institute/extern/index.php index 2fdf31eaea3147186462e4c14b27f1205100e0aa..a93d969235695d4703331d95734358c9c5ffab9f 100644 --- a/app/views/institute/extern/index.php +++ b/app/views/institute/extern/index.php @@ -22,7 +22,7 @@ else : ?> </h1> </header> <? foreach ($config_types as $type_id => $config_type): ?> - <? if ($configs[$type_id]) : ?> + <? if (!empty($configs[$type_id])) : ?> <article id="<?= $type_id ?>" <? if (Request::option('open_type') === $type_id) echo 'class="open"'; ?>> <header> <h1> diff --git a/app/views/institute/extern/upload.php b/app/views/institute/extern/upload.php index 92b289419b410b11731df9ebedc2a8dcd4c9c818..675f31a58f69256a59bc4859b4f29867ae6f3bf2 100644 --- a/app/views/institute/extern/upload.php +++ b/app/views/institute/extern/upload.php @@ -16,7 +16,7 @@ <div style="font-size: smaller;"> (<?= _('Ohne Angabe wird der Name aus den importierten Daten genommen.') ?>) </div> - <input type="text" name="config_name" value="<?= htmlReady($config_name) ?>"> + <input type="text" name="config_name" value="<?= htmlReady($config_name ?? '') ?>"> </label> <label> <?= _('Konfigurationsdatei') ?> diff --git a/lib/classes/StudipTreeNodeCachableTrait.php b/lib/classes/StudipTreeNodeCachableTrait.php index 31823acee79b07ab7c52e17d7b25ee1e97290cc6..d40cf70b475ef3df588335d62b93899c121e95e1 100644 --- a/lib/classes/StudipTreeNodeCachableTrait.php +++ b/lib/classes/StudipTreeNodeCachableTrait.php @@ -37,7 +37,7 @@ trait StudipTreeNodeCachableTrait return $config; } - protected function getDescendantIds(): array + public function getDescendantIds(): array { $cache = self::getDescendantsCacheArray(); diff --git a/lib/extern/ExternPage.php b/lib/extern/ExternPage.php index 8ed0e96509c10cad5792c6a3a11850240b0f2028..d775bc4ac59658ea8dbeef8de0964f8d50e9fdf8 100644 --- a/lib/extern/ExternPage.php +++ b/lib/extern/ExternPage.php @@ -138,7 +138,7 @@ abstract class ExternPage $extract[] = array_values(array_filter(array_map('trim', explode(' ', $one)))); } foreach ($extract as $one) { - $return[$one[0]] = $one[1]; + $return[$one[0]] = $one[1] ?? null; } return $return; } @@ -236,7 +236,7 @@ abstract class ExternPage $allowed_params = $this->getAllowedRequestParams(true); $config_fields = $this->getConfigFields(true); foreach ($allowed_params as $param_name) { - $method = $config_fields[$param_name] ?: 'get'; + $method = $config_fields[$param_name] ?? 'get'; $param_value = Request::$method($param_name); if ($param_value) { $this->setValue($param_name, $param_value); @@ -342,6 +342,7 @@ abstract class ExternPage ): string { if (count($scopes) > 0) { $study_areas = StudipStudyArea::findMany($scopes); + $scopes = []; if ($with_kids) { foreach ($study_areas as $study_area) { diff --git a/lib/extern/ExternPageTimetable.php b/lib/extern/ExternPageTimetable.php index d4276000fc3d63dd0ffaa43c6ba966c14ba07e55..5d8dfd992aea15ab395d400c0e8e726381ce303e 100644 --- a/lib/extern/ExternPageTimetable.php +++ b/lib/extern/ExternPageTimetable.php @@ -162,7 +162,7 @@ class ExternPageTimetable extends ExternPage $time = new DateTime(); switch ($this->date_offset) { case 'start_date': - $time = DateTime::createFromFormat('d.m.Y', $this->date); + $time = $this->date ? DateTime::createFromFormat('d.m.Y', $this->date) : $time; break; case 'current_semester': $semester = Semester::findCurrent(); @@ -228,6 +228,7 @@ class ExternPageTimetable extends ExternPage protected function getContent() { $count = 0; + $date_content = []; foreach ($this->getDates() as $date) { $day = new DateTime(); $day->setTimestamp($date->date)->setTime(0, 0);