aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2024-05-07 13:47:43 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-05-07 13:47:43 +0000
commit95d79f130e55a68649f603df38a2b895c59d23ab (patch)
tree728dd5f0b5dedabad304088d742585d6c314836d /app
parent4e9e416671846d119fe9a0f9189d8e989076910e (diff)
prevent php-warnings, closes #4124
Closes #4124 Merge request studip/studip!2969
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/extern.php14
-rw-r--r--app/views/institute/extern/extern_config/persondetails.php2
-rw-r--r--app/views/institute/extern/index.php2
-rw-r--r--app/views/institute/extern/upload.php2
4 files changed, 12 insertions, 8 deletions
diff --git a/app/controllers/admin/extern.php b/app/controllers/admin/extern.php
index 41833b1..559868e 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 311551d..897703d 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 2fdf31e..a93d969 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 92b2894..675f31a 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') ?>