aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2022-11-07 13:04:29 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-11-07 13:04:29 +0000
commita2a499c2d267561f1a445ffe02a8a5b5f96cf4c0 (patch)
treef2cb7075d9fdf8c262d1625b0471059f4e737fbb /lib
parentcf4f0ddaa8a5e7e8380175c7d07402fa6ea3e8c5 (diff)
prevent php8-warning, closes #1750
Closes #1750 Merge request studip/studip!1139
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/Icon.class.php4
-rw-r--r--lib/classes/MultiPersonSearch.class.php22
-rw-r--r--lib/classes/Seminar.class.php3
-rw-r--r--lib/classes/TreeAbstract.class.php2
-rw-r--r--lib/classes/sidebar/RoomClipboardWidget.class.php2
-rw-r--r--lib/classes/visibility/UserPrivacy.php2
-rw-r--r--lib/evaluation/classes/db/EvaluationObjectDB.class.php2
-rw-r--r--lib/evaluation/evaluation_admin_overview.inc.php11
-rw-r--r--lib/evaluation/evaluation_admin_overview.lib.php9
-rw-r--r--lib/filesystem/StandardFile.php4
-rw-r--r--lib/models/ToolActivation.php3
-rw-r--r--lib/models/User.class.php22
-rw-r--r--lib/seminar_open.php2
13 files changed, 48 insertions, 40 deletions
diff --git a/lib/classes/Icon.class.php b/lib/classes/Icon.class.php
index 30d3f3a..f2e4fa5 100644
--- a/lib/classes/Icon.class.php
+++ b/lib/classes/Icon.class.php
@@ -368,7 +368,9 @@ class Icon
{
$size = $size ?: Icon::DEFAULT_SIZE;
if (isset($this->attributes['size'])) {
- list($size, $temp) = explode('@', $this->attributes['size'], 2);
+ $parts = explode('@', $this->attributes['size'], 2);
+ $size = $parts[0];
+ $temp = $parts[1] ?? null;
unset($this->attributes['size']);
}
return (int)$size;
diff --git a/lib/classes/MultiPersonSearch.class.php b/lib/classes/MultiPersonSearch.class.php
index eafcdbb..db984c7 100644
--- a/lib/classes/MultiPersonSearch.class.php
+++ b/lib/classes/MultiPersonSearch.class.php
@@ -491,17 +491,17 @@ class MultiPersonSearch {
*/
public function restoreFromSession() {
if (isset($_SESSION['multipersonsearch'][$this->name])) {
- $this->title = $_SESSION['multipersonsearch'][$this->name]['title'];
- $this->description = $_SESSION['multipersonsearch'][$this->name]['description'];
- $this->quickfilterIds = $_SESSION['multipersonsearch'][$this->name]['quickfilterIds'];
- $this->additionalHMTL = $_SESSION['multipersonsearch'][$this->name]['additionalHMTL'];
- $this->executeURL = html_entity_decode($_SESSION['multipersonsearch'][$this->name]['executeURL']);
- $this->jsFunction = $_SESSION['multipersonsearch'][$this->name]['jsFunction'];
- $this->defaultSelectableUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectableUsersIDs'];
- $this->defaultSelectedUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectedUsersIDs'];
- $this->searchObject = unserialize($_SESSION['multipersonsearch'][$this->name]['searchObject']);
- $this->navigationItem = $_SESSION['multipersonsearch'][$this->name]['navigationItem'];
- $this->dataDialogStatus = $_SESSION['multipersonsearch'][$this->name]['dataDialogStatus'];
+ $this->title = $_SESSION['multipersonsearch'][$this->name]['title'] ?? '';
+ $this->description = $_SESSION['multipersonsearch'][$this->name]['description'] ?? '';
+ $this->quickfilterIds = $_SESSION['multipersonsearch'][$this->name]['quickfilterIds'] ?? [];
+ $this->additionalHMTL = $_SESSION['multipersonsearch'][$this->name]['additionalHMTL'] ?? '';
+ $this->executeURL = html_entity_decode($_SESSION['multipersonsearch'][$this->name]['executeURL'] ?? '');
+ $this->jsFunction = $_SESSION['multipersonsearch'][$this->name]['jsFunction'] ?? '';
+ $this->defaultSelectableUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectableUsersIDs'] ?? [];
+ $this->defaultSelectedUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectedUsersIDs'] ?? [];
+ $this->searchObject = unserialize($_SESSION['multipersonsearch'][$this->name]['searchObject'] ?? null);
+ $this->navigationItem = $_SESSION['multipersonsearch'][$this->name]['navigationItem'] ?? null;
+ $this->dataDialogStatus = $_SESSION['multipersonsearch'][$this->name]['dataDialogStatus'] ?? '';
}
}
diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php
index 0e839e8..84985e2 100644
--- a/lib/classes/Seminar.class.php
+++ b/lib/classes/Seminar.class.php
@@ -333,6 +333,9 @@ class Seminar
$cycles[$id]['last_date'] = CycleDataDB::getLastDate($id);
if (!empty($cycles[$id]['assigned_rooms'])) {
foreach ($cycles[$id]['assigned_rooms'] as $room_id => $count) {
+ if (!isset($rooms[$room_id])) {
+ $rooms[$room_id] = 0;
+ }
$rooms[$room_id] += $count;
}
}
diff --git a/lib/classes/TreeAbstract.class.php b/lib/classes/TreeAbstract.class.php
index dc96820..7cdb940 100644
--- a/lib/classes/TreeAbstract.class.php
+++ b/lib/classes/TreeAbstract.class.php
@@ -203,7 +203,7 @@ class TreeAbstract {
*/
public function getKids($item_id)
{
- return (is_array($this->tree_childs[$item_id])) ? $this->tree_childs[$item_id] : null;
+ return (isset($this->tree_childs[$item_id]) && is_array($this->tree_childs[$item_id])) ? $this->tree_childs[$item_id] : null;
}
/**
diff --git a/lib/classes/sidebar/RoomClipboardWidget.class.php b/lib/classes/sidebar/RoomClipboardWidget.class.php
index da5146a..3d90c36 100644
--- a/lib/classes/sidebar/RoomClipboardWidget.class.php
+++ b/lib/classes/sidebar/RoomClipboardWidget.class.php
@@ -14,7 +14,7 @@ class RoomClipboardWidget extends ClipboardWidget
public function __construct()
{
parent::__construct(['Room']);
-
+ $this->allowed_item_class = '';
$this->setTitle(_('Individuelle Raumgruppen'));
$this->template = 'sidebar/room-clipboard-widget';
diff --git a/lib/classes/visibility/UserPrivacy.php b/lib/classes/visibility/UserPrivacy.php
index e521dc3..1cfbcda 100644
--- a/lib/classes/visibility/UserPrivacy.php
+++ b/lib/classes/visibility/UserPrivacy.php
@@ -71,7 +71,7 @@ class UserPrivacy
}
}
- $child = $idmap[$key] ?: new User_Visibility_Settings();
+ $child = $idmap[$key] ?? new User_Visibility_Settings();
$child->setData([
'user_id' => $this->user->id,
'parent_id' => $vis->id,
diff --git a/lib/evaluation/classes/db/EvaluationObjectDB.class.php b/lib/evaluation/classes/db/EvaluationObjectDB.class.php
index 2af32a4..1e8f66f 100644
--- a/lib/evaluation/classes/db/EvaluationObjectDB.class.php
+++ b/lib/evaluation/classes/db/EvaluationObjectDB.class.php
@@ -200,7 +200,7 @@ class EvaluationObjectDB extends DatabaseObject
{
$no_permisson = 0;
$rangeIDs = $eval->getRangeIDs();
-
+ $no_permisson_ranges = [];
if (!is_array($rangeIDs)) {
$rangeIDs = [$rangeIDs];
}
diff --git a/lib/evaluation/evaluation_admin_overview.inc.php b/lib/evaluation/evaluation_admin_overview.inc.php
index 32b7a5f..d8ba9a3 100644
--- a/lib/evaluation/evaluation_admin_overview.inc.php
+++ b/lib/evaluation/evaluation_admin_overview.inc.php
@@ -51,7 +51,7 @@ define("DISCARD_OPENID", "discard_openid");
/* Create objects ---------------------------------------------------------- */
$db = new EvaluationObjectDB ();
-if ($db->isError) {
+if ($db->getErrors()) {
return MessageBox::error(_("Datenbankfehler"));
}
$lib = new EvalOverview ($db, $GLOBALS['perm'], $GLOBALS['user']);
@@ -59,10 +59,10 @@ $lib = new EvalOverview ($db, $GLOBALS['perm'], $GLOBALS['user']);
/* Set variables ----------------------------------------------------------- */
-if ($_SESSION['evalID']) {
+if (isset($_SESSION['evalID'])) {
unset($_SESSION['evalID']);
}
-if ($_SESSION['rangeID']) {
+if (isset($_SESSION['rangeID'])) {
unset($_SESSION['rangeID']);
}
@@ -70,7 +70,7 @@ if (!empty($the_range)) {
$rangeID = $the_range;
}
-$rangeID = ($rangeID) ? $rangeID : Context::getId();
+$rangeID = $rangeID ?? Context::getId();
if (empty ($rangeID) || ($rangeID == $GLOBALS['user']->username)) {
$rangeID = $GLOBALS['user']->id;
@@ -101,9 +101,10 @@ if (!$GLOBALS['perm']->have_studip_perm("tutor", $rangeID) && $GLOBALS['user']->
return;
}
-$safeguard = $lib->callSafeguard($evalAction, $evalID, $rangeID, $search, $referer);
+$safeguard = $lib->callSafeguard($evalAction, $evalID, $rangeID, $search, null);
/* ---------------------------------------------------------- end: safeguard */
+$foundTable = '';
/* found public templates -------------------------------------------------- */
if ($templates_search) {
$search = trim($search);
diff --git a/lib/evaluation/evaluation_admin_overview.lib.php b/lib/evaluation/evaluation_admin_overview.lib.php
index b552a5f..54f3f46 100644
--- a/lib/evaluation/evaluation_admin_overview.lib.php
+++ b/lib/evaluation/evaluation_admin_overview.lib.php
@@ -2210,14 +2210,15 @@ class EvalOverview
*/
function getPageCommand()
{
- if (Request::option("evalAction"))
- return Request::option("evalAction");
-
+ if (Request::option('evalAction')) {
+ return Request::option('evalAction');
+ }
+ $command = [];
foreach ($_REQUEST as $key => $value) {
if (preg_match("/(.*)_button(_x)?/", $key, $command))
break;
}
- return $command[1];
+ return $command[1] ?? '';
}
# ===================================================== end: public functions #
diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 05f6979..412600f 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -65,11 +65,11 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
$fileref = new FileRef();
$fileref['name'] = $filename;
- $fileref['description'] = $data['description'] ?: "";
+ $fileref['description'] = $data['description'] ?? "";
$fileref['downloads'] = 0;
$fileref['user_id'] = $user_id;
$fileref['file_id'] = $file->getId();
- $fileref['content_terms_of_use_id'] = $data['content_terms_of_use_id'] ?: ContentTermsOfUse::findDefault()->id;
+ $fileref['content_terms_of_use_id'] = $data['content_terms_of_use_id'] ?? ContentTermsOfUse::findDefault()->id;
return new static($fileref, $file);
}
diff --git a/lib/models/ToolActivation.php b/lib/models/ToolActivation.php
index 06ec25f..422fb0f 100644
--- a/lib/models/ToolActivation.php
+++ b/lib/models/ToolActivation.php
@@ -82,8 +82,7 @@ class ToolActivation extends SimpleORMap
$module = $this->getStudipModule();
if ($module) {
$metadata = $module->getMetadata();
- $name = $metadata['displayname'] ?: $module->getPluginName();
- return $name;
+ return $metadata['displayname'] ?? $module->getPluginName();
}
}
diff --git a/lib/models/User.class.php b/lib/models/User.class.php
index 6011e6b..7ec24aa 100644
--- a/lib/models/User.class.php
+++ b/lib/models/User.class.php
@@ -718,6 +718,8 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
// Non-private dates.
if (Config::get()->CALENDAR_ENABLE) {
$dates = CalendarEvent::countBySql('range_id = ?', [$this->id]);
+ } else {
+ $dates = [];
}
// Votes
@@ -737,7 +739,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if (Avatar::getAvatar($this->id)->is_customized() && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['picture'])) {
$homepage_elements['picture'] = [
'name' => _('Eigenes Bild'),
- 'visibility' => $homepage_visibility['picture'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['picture'] ?? get_default_homepage_visibility($this->id),
'extern' => true,
'identifier' => 'commondata'
];
@@ -746,7 +748,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if ($this->info->motto && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['motto'])) {
$homepage_elements['motto'] = [
'name' => _('Motto'),
- 'visibility' => $homepage_visibility['motto'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['motto']?? get_default_homepage_visibility($this->id),
'identifier' => 'privatedata'
];
}
@@ -754,7 +756,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if ($GLOBALS['user']->cfg->getValue('SKYPE_NAME') && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['skype_name'])) {
$homepage_elements['skype_name'] = [
'name' => _('Skype Name'),
- 'visibility' => $homepage_visibility['skype_name'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['skype_name']?? get_default_homepage_visibility($this->id),
'identifier' => 'privatedata'
];
}
@@ -762,28 +764,28 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if ($this->info->privatnr && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['Private Daten_phone'])) {
$homepage_elements['private_phone'] = [
'name' => _('Private Telefonnummer'),
- 'visibility' => $homepage_visibility['private_phone'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['private_phone']?? get_default_homepage_visibility($this->id),
'identifier' => 'privatedata'
];
}
if ($this->info->privatcell && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['private_cell'])) {
$homepage_elements['private_cell'] = [
'name' => _('Private Handynummer'),
- 'visibility' => $homepage_visibility['private_cell'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['private_cell']?? get_default_homepage_visibility($this->id),
'identifier' => 'privatedata'
];
}
if ($this->info->privadr && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['privadr'])) {
$homepage_elements['privadr'] = [
'name' => _('Private Adresse'),
- 'visibility' => $homepage_visibility['privadr'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['privadr']?? get_default_homepage_visibility($this->id),
'identifier' => 'privatedata'
];
}
if ($this->info->home && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['homepage'])) {
$homepage_elements['homepage'] = [
'name' => _('Homepage-Adresse'),
- 'visibility' => $homepage_visibility['homepage'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['homepage']?? get_default_homepage_visibility($this->id),
'extern' => true,
'identifier' => 'privatedata'
];
@@ -791,7 +793,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if ($news && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['news'])) {
$homepage_elements['news'] = [
'name' => _('Ankündigungen'),
- 'visibility' => $homepage_visibility['news'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['news']?? get_default_homepage_visibility($this->id),
'extern' => true,
'identifier' => 'commondata'
];
@@ -799,7 +801,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if (Config::get()->CALENDAR_ENABLE && $dates && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['dates'])) {
$homepage_elements['termine'] = [
'name' => _('Termine'),
- 'visibility' => $homepage_visibility['termine'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['termine']?? get_default_homepage_visibility($this->id),
'extern' => true,
'identifier' => 'commondata'
];
@@ -807,7 +809,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
if (Config::get()->VOTE_ENABLE && ($activeVotes || $stoppedVotes || $activeEvals) && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['votes'])) {
$homepage_elements['votes'] = [
'name' => _('Fragebögen'),
- 'visibility' => $homepage_visibility['votes'] ?: get_default_homepage_visibility($this->id),
+ 'visibility' => $homepage_visibility['votes']?? get_default_homepage_visibility($this->id),
'identifier' => 'commondata'
];
}
diff --git a/lib/seminar_open.php b/lib/seminar_open.php
index 3449f20..8d7d65e 100644
--- a/lib/seminar_open.php
+++ b/lib/seminar_open.php
@@ -186,7 +186,7 @@ if (!Request::isXhr() && $perm->have_perm('root')) {
$_SESSION['migration-check']['disabled'] = true;
}
- if (!$_SESSION['migration-check']['disabled']
+ if (!empty($_SESSION['migration-check']['disabled'])
&& $_SESSION['migration-check']['count'] > 0
) {
$info = sprintf(