diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2022-09-28 14:24:20 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2022-09-28 14:24:20 +0000 |
| commit | e75c08bedd60a6674d22ce3e2ec57b5a5f1d85eb (patch) | |
| tree | 2d9cf000153360bdc9e1841693406f3a3b1d58ae /lib/models | |
| parent | 1e6f3d59c1989dc0da68d3200090cb4768ab3094 (diff) | |
fix for BIESt #1118
Merge request studip/studip!676
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/LogEvent.php | 2 | ||||
| -rw-r--r-- | lib/models/OERHost.php | 4 | ||||
| -rw-r--r-- | lib/models/SimpleCollection.class.php | 6 | ||||
| -rw-r--r-- | lib/models/SimpleORMap.class.php | 4 | ||||
| -rw-r--r-- | lib/models/User.class.php | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/lib/models/LogEvent.php b/lib/models/LogEvent.php index 38fdd72..2e83590 100644 --- a/lib/models/LogEvent.php +++ b/lib/models/LogEvent.php @@ -279,7 +279,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject protected function formatSemester($field) { $all_semester = Semester::findAllVisible(false); foreach ($all_semester as $val) { - if ($val['beginn'] == $this->$field) { + if (!empty($val['beginn']) && ($val['beginn'] == $this->$field)) { return '<em>' . $val['name'] . '</em>'; } } diff --git a/lib/models/OERHost.php b/lib/models/OERHost.php index 7cb2ba5..1c7c01e 100644 --- a/lib/models/OERHost.php +++ b/lib/models/OERHost.php @@ -15,7 +15,7 @@ class OERHost extends OERIdentity { $host = self::findOneBySQL("`private_key` IS NOT NULL AND `sorm_class` = 'OERHost' LIMIT 1"); if ($host) { - $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/"; + $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/"; if ($host->isFieldDirty("url")) { $host->store(); } @@ -23,7 +23,7 @@ class OERHost extends OERIdentity } else { $host = new self(); $host['name'] = Config::get()->UNI_NAME_CLEAN; - $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/"; + $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/"; $host['last_updated'] = time(); $host->store(); return $host; diff --git a/lib/models/SimpleCollection.class.php b/lib/models/SimpleCollection.class.php index 588de1b..26439b2 100644 --- a/lib/models/SimpleCollection.class.php +++ b/lib/models/SimpleCollection.class.php @@ -684,9 +684,9 @@ class SimpleCollection extends StudipArrayObject $func = function ($d1, $d2) use ($sorter, $sort_func, $sort_locale) { do { - $field = current($sorter); - $dir = $field[1] ?? ''; - $field = $field[0] ?? ''; + $current_sorter = current($sorter); + $field = $current_sorter[0]; + $dir = $current_sorter[1] ?? ''; if (!$sort_locale) { $value1 = $d1[$field]; $value2 = $d2[$field]; diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index 5fed34a..bc670d8 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -1094,14 +1094,14 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate } if ($type === 'has_and_belongs_to_many') { $thru_table = $options['thru_table']; - if (!$options['thru_key']) { + if (empty($options['thru_key'])) { $options['thru_key'] = $this->pk()[0]; } if (empty($options['thru_assoc_key']) || empty($options['assoc_foreign_key'])) { $class = $options['class_name']; $record = new $class(); $meta = $record->getTableMetadata(); - if (!$options['thru_assoc_key'] ) { + if (empty($options['thru_assoc_key'])) { $options['thru_assoc_key'] = $meta['pk'][0]; } if (empty($options['assoc_foreign_key'])) { diff --git a/lib/models/User.class.php b/lib/models/User.class.php index 7ce868b..7eb1321 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -365,7 +365,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject } //locked user - if ((int)$attributes['locked'] == 1) { + if (!empty($attributes['locked'])) { $where[] = "au.`locked` = 1"; } |
