Skip to content
Snippets Groups Projects
Commit 5d014803 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

prevent php8 warnings (fourth batch of changes), re #2193

Merge request studip/studip!1426
parent 718af22c
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* @var Admin_PluginController $controller * @var Admin_PluginController $controller
* @var array $plugin * @var array $plugin
*/ */
?>
<?
if (mb_strpos($_SERVER['SERVER_NAME'], ':') !== false) { if (mb_strpos($_SERVER['SERVER_NAME'], ':') !== false) {
list($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']) = list($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']) =
explode(':', $_SERVER['SERVER_NAME']); explode(':', $_SERVER['SERVER_NAME']);
...@@ -26,7 +25,7 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || ...@@ -26,7 +25,7 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
<?= $m ?> <?= $m ?>
<? endforeach ?> <? endforeach ?>
</div> </div>
<form action="<?= $controller->url_for('admin/plugin/edit_automaticupdate/'.$plugin['id']) ?>" method="post" class="default" data-dialog="size=auto;reload-on-close"> <form action="<?= $controller->link_for('admin/plugin/edit_automaticupdate', $plugin['id'] ?? null) ?>" method="post" class="default" data-dialog="size=auto;reload-on-close">
<?= CSRFProtection::tokenTag() ?> <?= CSRFProtection::tokenTag() ?>
<input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>"> <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">
<?= MessageBox::info(_("Sie können gitlab, github.com oder dem neuen Stud.IP-Plugin-Marktplatz mitteilen, dass Ihr Stud.IP per Webhook über Änderungen im Code des Plugins benachrichtigt werden soll.")) ?> <?= MessageBox::info(_("Sie können gitlab, github.com oder dem neuen Stud.IP-Plugin-Marktplatz mitteilen, dass Ihr Stud.IP per Webhook über Änderungen im Code des Plugins benachrichtigt werden soll.")) ?>
...@@ -34,15 +33,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || ...@@ -34,15 +33,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
<legend><?= _("Einstellungen von Stud.IP") ?></legend> <legend><?= _("Einstellungen von Stud.IP") ?></legend>
<label> <label>
<?= _("URL, von der das Plugin als ZIP-Datei bezogen werden soll") ?> <?= _("URL, von der das Plugin als ZIP-Datei bezogen werden soll") ?>
<input type="url" name="automatic_update_url" value="<?= htmlReady($plugin['automatic_update_url']) ?>"> <input type="url" name="automatic_update_url" value="<?= htmlReady($plugin['automatic_update_url'] ?? '') ?>">
</label> </label>
<label> <label>
<?= _("Automatisches Update absichern über Sicherheitstoken (optional)") ?> <?= _("Automatisches Update absichern über Sicherheitstoken (optional)") ?>
<input type="checkbox" name="use_security_token" value="1"<?= $plugin['automatic_update_secret'] || !$plugin['automatic_update_url'] ? " checked" : "" ?>> <input type="checkbox" name="use_security_token" value="1"
<?= !empty($plugin['automatic_update_secret']) || empty($plugin['automatic_update_url']) ? " checked" : "" ?>>
</label> </label>
</fieldset> </fieldset>
<? if ($plugin['automatic_update_url']) : ?> <? if (!empty($plugin['automatic_update_url'])) : ?>
<fieldset> <fieldset>
<legend><?= _("Daten für das bereitstellende System") ?></legend> <legend><?= _("Daten für das bereitstellende System") ?></legend>
<p class="info"> <p class="info">
......
...@@ -85,7 +85,8 @@ class LockRules { ...@@ -85,7 +85,8 @@ class LockRules {
*/ */
public static function getObjectRule($object_id, $renew = false, $object_type = null) public static function getObjectRule($object_id, $renew = false, $object_type = null)
{ {
if(!array_key_exists($object_id, self::$lockmap) || $renew) { if (!array_key_exists($object_id, self::$lockmap) || $renew) {
self::$lockmap[$object_id] = null;
if ($object_type === null) { if ($object_type === null) {
$object_type = get_object_type($object_id, words('sem inst user')); $object_type = get_object_type($object_id, words('sem inst user'));
} }
...@@ -98,12 +99,10 @@ class LockRules { ...@@ -98,12 +99,10 @@ class LockRules {
if ($lr) { if ($lr) {
self::$lockmap[$object_id] = $lr->getId(); self::$lockmap[$object_id] = $lr->getId();
self::$lockrules[$lr->getId()] = $lr; self::$lockrules[$lr->getId()] = $lr;
} else {
self::$lockmap[$object_id] = null;
} }
} }
} }
return self::$lockmap[$object_id] ? self::$lockrules[self::$lockmap[$object_id]] : null; return self::$lockrules[self::$lockmap[$object_id]] ?? null;
} }
/** /**
......
...@@ -73,15 +73,16 @@ function get_object_name($range_id, $object_type) ...@@ -73,15 +73,16 @@ function get_object_name($range_id, $object_type)
$statement->execute([$range_id]); $statement->execute([$range_id]);
$row = $statement->fetch(PDO::FETCH_ASSOC); $row = $statement->fetch(PDO::FETCH_ASSOC);
if ($SEM_TYPE[$row['status']]['name'] == $SEM_TYPE_MISC_NAME) { if (!$row) {
$name = _('Unbekannt');
$type = _('Veranstaltung'); $type = _('Veranstaltung');
} else { } else {
$type = $SEM_TYPE[$row['status']]['name']; $name = $row['Name'];
} $type = $SEM_TYPE[$row['status']]['name'] ?? _('Veranstaltung');
if (!$type) { if ($type === $SEM_TYPE_MISC_NAME) {
$type = _('Veranstaltung'); $type = _('Veranstaltung');
}
} }
$name = $row['Name'];
} else if ($object_type == 'inst' || $object_type == 'fak') { } else if ($object_type == 'inst' || $object_type == 'fak') {
$query = "SELECT type, Name FROM Institute WHERE Institut_id = ?"; $query = "SELECT type, Name FROM Institute WHERE Institut_id = ?";
$statement = DBManager::get()->prepare($query); $statement = DBManager::get()->prepare($query);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment