diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2022-02-03 12:18:38 +0100 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2022-04-12 15:44:24 +0000 |
| commit | 83712c03a1e212587050671d2534902035c54c2d (patch) | |
| tree | 085636d23a55573e9f747d8fc89f4d694b3b5929 | |
| parent | 7fca46eda99e80f3ffd48126e356546094a68cc9 (diff) | |
transfer changeset 59447 from svn
37 files changed, 86 insertions, 73 deletions
diff --git a/app/controllers/files.php b/app/controllers/files.php index 4e11440..11457cc 100644 --- a/app/controllers/files.php +++ b/app/controllers/files.php @@ -365,9 +365,9 @@ class FilesController extends AuthenticatedController $_SESSION['files_overview']['course_id'] = $this->course_id; } } else { - $this->begin = $_SESSION['files_overview']['begin']; - $this->end = $_SESSION['files_overview']['end']; - $this->course_id = $_SESSION['files_overview']['course_id']; + $this->begin = $_SESSION['files_overview']['begin'] ?? null; + $this->end = $_SESSION['files_overview']['end'] ?? null; + $this->course_id = $_SESSION['files_overview']['course_id'] ?? null; } } @@ -473,7 +473,7 @@ class FilesController extends AuthenticatedController $new_file_refs = FileRef::findAll($GLOBALS['user']->id, $this->begin, $this->end, $this->course_id, $this->page_size, $offset); //Group the file refs by their folder: foreach ($new_file_refs as $file_ref) { - if (!is_array($folders[$file_ref->folder_id])) { + if (!isset($folders[$file_ref->folder_id]) || !is_array($folders[$file_ref->folder_id])) { $folders[$file_ref->folder_id] = [ 'folder' => $file_ref->folder->getTypedFolder(), 'file_refs' => [] diff --git a/app/controllers/studip_controller.php b/app/controllers/studip_controller.php index fd52034..357ded7 100644 --- a/app/controllers/studip_controller.php +++ b/app/controllers/studip_controller.php @@ -293,7 +293,7 @@ abstract class StudipController extends Trails_Controller $to = implode('/', $args); //preserve fragment - [$to, $fragment] = explode('#', $to); + [$to, $fragment] = @explode('#', $to); $url = parent::url_for($to); diff --git a/app/views/files/_overview.php b/app/views/files/_overview.php index 6fd203f..7b03f44 100644 --- a/app/views/files/_overview.php +++ b/app/views/files/_overview.php @@ -102,6 +102,6 @@ </div> <? endif ?> -<? if ($no_files) : ?> +<? if ($no_files ?? false) : ?> <?= MessageBox::info(_('Es sind keine Dateien vorhanden, die für Sie zugänglich sind!')) ?> <? endif ?> diff --git a/app/views/files/flat.php b/app/views/files/flat.php index 7702767..f8c3b4b 100644 --- a/app/views/files/flat.php +++ b/app/views/files/flat.php @@ -55,7 +55,7 @@ foreach ($topFolder->getAdditionalActionButtons() as $button) { :files="files" :folders="folders" :topfolder="topfolder" - enable_table_filter="<?= $enable_table_filter ? 'true' : 'false' ?>" + enable_table_filter="<?= $enable_table_filter ?? false ? 'true' : 'false' ?>" table_title="<?= htmlReady($table_title) ?>" pagination="<?= htmlReady($pagination_html) ?>" :initial_sort="{sortedBy:'chdate',sortDirection:'desc'}" diff --git a/app/views/files_dashboard/_input-group-search.php b/app/views/files_dashboard/_input-group-search.php index 0606b68..f685461 100644 --- a/app/views/files_dashboard/_input-group-search.php +++ b/app/views/files_dashboard/_input-group-search.php @@ -1,7 +1,7 @@ <div class="input-group files-search"> <input name="q" - value="<?= htmlReady($query) ?>" + value="<?= htmlReady($query ?? '') ?>" placeholder="<?= _('Was suchen Sie?') ?>" aria-label="<?= _('Was suchen Sie?') ?>" minlength="4" @@ -13,7 +13,7 @@ <?= Icon::create('search')->asImg(['title' => _("Suche starten")]) ?> </button> - <? if ($query != '') : ?> + <? if ($query ?? false) : ?> <?= \Studip\LinkButton::createReset(_('Zurücksetzen'), $controller->url_for('files_dashboard/search')) ?> <? endif ?> </span> diff --git a/db/migrations/5.1.22_resize_oer_content_type_length.php b/db/migrations/5.1.22_resize_oer_content_type_length.php index 0fd36b6..0fd36b6 100644..100755 --- a/db/migrations/5.1.22_resize_oer_content_type_length.php +++ b/db/migrations/5.1.22_resize_oer_content_type_length.php diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 608f929..4c8622a 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -50,11 +50,15 @@ if (isset($_SERVER['SERVER_NAME'])) { explode(':', $_SERVER['SERVER_NAME']); } - $ABSOLUTE_URI_STUDIP = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http'; + $is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; + + $ABSOLUTE_URI_STUDIP = $is_https ? 'https' : 'http'; $ABSOLUTE_URI_STUDIP .= '://'.$_SERVER['SERVER_NAME']; - if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || - $_SERVER['HTTPS'] != 'on' && $_SERVER['SERVER_PORT'] != 80) { + if ( + ($is_https && $_SERVER['SERVER_PORT'] != 443) + || (!$is_https && $_SERVER['SERVER_PORT'] != 80) + ) { $ABSOLUTE_URI_STUDIP .= ':'.$_SERVER['SERVER_PORT']; } diff --git a/lib/classes/Log.php b/lib/classes/Log.php index 22c9f6c..fc3a2e1 100644 --- a/lib/classes/Log.php +++ b/lib/classes/Log.php @@ -119,9 +119,8 @@ class Log public static function set($name = '', $log_handler = null) { $name = mb_strlen($name) ? $name : 0; - if (isset(self::$instances[$name])) { - $old = self::$instances[$name]; - } + + $old = self::$instances[$name] ?? null; self::$instances[$name] = new Log($log_handler); return $old; } diff --git a/lib/classes/NotificationCenter.class.php b/lib/classes/NotificationCenter.class.php index dce878e..1adf5f2 100644 --- a/lib/classes/NotificationCenter.class.php +++ b/lib/classes/NotificationCenter.class.php @@ -65,9 +65,10 @@ class NotificationCenter }; } - self::$observers[$event][] = - ['predicate' => $predicate ?: NULL, - 'observer' => [$observer, $method]]; + self::$observers[$event][] = [ + 'predicate' => $predicate ?? NULL, + 'observer' => [$observer, $method] + ]; } /** diff --git a/lib/classes/PageLayout.php b/lib/classes/PageLayout.php index e40b22b..a8f3ffa 100644 --- a/lib/classes/PageLayout.php +++ b/lib/classes/PageLayout.php @@ -463,7 +463,7 @@ class PageLayout */ public static function isHeaderEnabled() { - return self::$display_header && !$GLOBALS['_NOHEADER']; + return self::$display_header && empty($GLOBALS['_NOHEADER']); } /** diff --git a/lib/classes/RangeConfig.class.php b/lib/classes/RangeConfig.class.php index c384661..fc90434 100644 --- a/lib/classes/RangeConfig.class.php +++ b/lib/classes/RangeConfig.class.php @@ -52,7 +52,7 @@ class RangeConfig extends Config $range_id = $range_id->getRangeId(); } - if (static::$instances[$range_id] === null) { + if (!isset(static::$instances[$range_id])) { static::$instances[$range_id] = new static($range_id); } return static::$instances[$range_id]; @@ -121,7 +121,7 @@ class RangeConfig extends Config } while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $this->data[$row['field']] = $this->convertFromDatabase( - $this->metadata[$row['field']]['type'], + $this->metadata[$row['field']]['type'] ?? 'string', $row['value'], $row['field'] ); diff --git a/lib/classes/SemBrowse.class.php b/lib/classes/SemBrowse.class.php index a60201a..af6b2f3 100644 --- a/lib/classes/SemBrowse.class.php +++ b/lib/classes/SemBrowse.class.php @@ -1169,7 +1169,7 @@ class SemBrowse { if (!$option['visible'] || $option['target'] != $target) { return null; } - if (!$option['url']) { + if (empty($option['url'])) { switch ($option_name) { case 'courses': case 'semtree': diff --git a/lib/classes/SkipLinks.php b/lib/classes/SkipLinks.php index b906ed5..455790f 100644 --- a/lib/classes/SkipLinks.php +++ b/lib/classes/SkipLinks.php @@ -83,7 +83,7 @@ class SkipLinks * @param integer $position the position of the link in the list * @param boolean $overwriteable false if position is not overwritable by another link */ - public static function addIndex($name, $id, $position = null, $overwriteable = false) + public static function addIndex($name, $id, $position = null, $overwritable = false) { $url = '#' . $id; self::addLink($name, $url, $position, $overwriteable); @@ -124,7 +124,7 @@ class SkipLinks if (isset(self::$position[$link['position']])) { return false; } - if (!$link['overwrite']) { + if (!isset($link['overwrite']) || !$link['overwrite']) { self::$position[$link['position']] = true; } return true; diff --git a/lib/classes/StudipPDO.class.php b/lib/classes/StudipPDO.class.php index 2153ecf..eb3b0df 100644 --- a/lib/classes/StudipPDO.class.php +++ b/lib/classes/StudipPDO.class.php @@ -178,12 +178,12 @@ class StudipPDO extends PDO * @param mixed fetch mode parameter (see PDOStatement::setFetchMode) * @return object PDOStatement object */ - public function query($statement, $mode = NULL, $arg1 = NULL, $arg2 = NULL) + public function query($statement, $fetch_mode = NULL, ...$fetch_args) { $this->verify($statement); if (isset($mode)) { - $stmt = parent::query($statement, $mode, $arg1, $arg2); + $stmt = parent::query($statement, $mode, ...$fetchArgs); } else { $stmt = parent::query($statement); } diff --git a/lib/classes/StudipPDOStatement.php b/lib/classes/StudipPDOStatement.php index 51972ed..bb1af0d 100644 --- a/lib/classes/StudipPDOStatement.php +++ b/lib/classes/StudipPDOStatement.php @@ -117,6 +117,7 @@ class StudipPDOStatement implements IteratorAggregate } } + $emulate_prepare = false; // emulate prepared statement if necessary foreach ($this->params as $key => $param) { if ($param['type'] === StudipPDO::PARAM_ARRAY || diff --git a/lib/classes/URLHelper.php b/lib/classes/URLHelper.php index a36cc10..e11d8de 100644 --- a/lib/classes/URLHelper.php +++ b/lib/classes/URLHelper.php @@ -169,8 +169,8 @@ class URLHelper { $link_params = $ignore_registered_params ? [] : self::$params; - list($url, $fragment) = explode('#', $url); - list($url, $query) = explode('?', $url); + @list($url, $fragment) = explode('#', $url); + @list($url, $query) = explode('?', $url); if ($url !== '') { $url = self::resolveURL($url); diff --git a/lib/classes/WidgetContainer.php b/lib/classes/WidgetContainer.php index 5287305..1b0578e 100644 --- a/lib/classes/WidgetContainer.php +++ b/lib/classes/WidgetContainer.php @@ -24,12 +24,12 @@ abstract class WidgetContainer public static function Get() { $class = get_called_class(); - if (static::$instances[$class] === null) { + if (!isset(static::$instances[$class])) { static::$instances[$class] = new static; } return static::$instances[$class]; } - + /** * Private constructor to ensure that the singleton Get() method is always * used. @@ -39,12 +39,12 @@ abstract class WidgetContainer protected function __construct() { } - + /** * Contains the widgets of the container */ protected $widgets = []; - + /** * Add a widget to the container. * @@ -75,9 +75,9 @@ abstract class WidgetContainer public function insertWidget(Widget $widget, $before_index, $index = null) { $index = $index ?: $this->guessIndex($widget); - + $inserted = false; - + $widgets = []; foreach ($this->widgets as $idx => $wdgt) { if ($idx === $before_index) { @@ -96,7 +96,7 @@ abstract class WidgetContainer } $this->widgets = $widgets; - + return $widget; } @@ -151,7 +151,7 @@ abstract class WidgetContainer * * @param String $index Index/name of the widget to remove. * @throws Exception if the specified position is invalid - */ + */ public function removeWidget($index) { if (!isset($this->widgets[$index])) { diff --git a/lib/classes/sidebar/LinkElement.php b/lib/classes/sidebar/LinkElement.php index b38a145..29f0fd4 100644 --- a/lib/classes/sidebar/LinkElement.php +++ b/lib/classes/sidebar/LinkElement.php @@ -151,9 +151,7 @@ class LinkElement extends WidgetElement implements ArrayAccess */ public function addClass($class) { - $this->attributes['class'] = $this->attributes['class'] - ? $this->attributes['class'] . " " . $class - : $class; + $this->attributes['class'] = trim(($this->attributes['class'] ?? '') . " {$class}"); return $this; } diff --git a/lib/filesystem/HiddenFolder.php b/lib/filesystem/HiddenFolder.php index 60a8cbd..107d35c 100644 --- a/lib/filesystem/HiddenFolder.php +++ b/lib/filesystem/HiddenFolder.php @@ -107,7 +107,7 @@ class HiddenFolder extends PermissionEnabledFolder public function __get($attribute) { if ($attribute === 'download_allowed') { - return $this->folderdata['data_content']['download_allowed']; + return $this->folderdata['data_content']['download_allowed'] ?? null; } return $this->folderdata[$attribute]; } diff --git a/lib/functions.php b/lib/functions.php index bbed629..eced4fa 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1007,7 +1007,7 @@ function format_help_url($keyword) { // all help urls need short language tag (de, en) $lang = 'de'; - if ($_SESSION['_language']) { + if (isset($_SESSION['_language'])) { [$lang] = explode('_', $_SESSION['_language']); } @@ -1428,6 +1428,8 @@ function get_route($route = '') $trails = explode('dispatch.php/', $route); $dispatcher = new StudipDispatcher(); $pieces = explode('/', $trails[1]); + + $trail = ''; foreach ($pieces as $index => $piece) { $trail .= ($trail ? '/' : '') . $piece; if ($dispatcher->file_exists($trail . '.php')) { diff --git a/lib/models/HelpTour.class.php b/lib/models/HelpTour.class.php index d200eba..9bb815d 100644 --- a/lib/models/HelpTour.class.php +++ b/lib/models/HelpTour.class.php @@ -82,6 +82,9 @@ class HelpTour extends SimpleORMap public static function GetHelpbarTourData() { $visible_tours = []; + $active_tour_id = null; + $active_tour_step_nr = null; + $route = get_route(); $tours = HelpTour::getToursByRoute($route); foreach($tours as $index => $tour) { @@ -100,7 +103,7 @@ class HelpTour extends SimpleORMap } } //if there is an active tour, initialize it - if ($_SESSION['active_tour']['tour_id'] + if (isset($_SESSION['active_tour']['tour_id']) && ($_SESSION['active_tour']['last_route'] === $route || $_SESSION['active_tour']['next_route'] === $route)) { diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index 8397fa0..7983f0c 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -241,7 +241,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate } foreach (['has_many', 'belongs_to', 'has_one', 'has_and_belongs_to_many'] as $type) { - if (is_array($config[$type])) { + if (isset($config[$type]) && is_array($config[$type])) { foreach (array_keys($config[$type]) as $one) { $config['relations'][$one] = null; } @@ -310,9 +310,9 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate $config['known_slots'] = array_merge( array_keys($config['db_fields']), - array_keys($config['alias_fields'] ?: []), - array_keys($config['additional_fields'] ?: []), - array_keys($config['relations'] ?: []) + array_keys($config['alias_fields'] ?? []), + array_keys($config['additional_fields'] ?? []), + array_keys($config['relations'] ?? []) ); foreach (array_map('strtolower', get_class_methods($class)) as $method) { @@ -339,7 +339,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate static::configure(); } - return self::$config[static::class][$key]; + return self::$config[static::class][$key] ?? null; } /** @@ -1027,7 +1027,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate if (!$options['class_name']) { throw new Exception('Option class_name not set for relation ' . $name); } - if (!$options['assoc_foreign_key']) { + if (!isset($options['assoc_foreign_key']) || !$options['assoc_foreign_key']) { if ($type === 'has_many' || $type === 'has_one') { $options['assoc_foreign_key'] = $this->pk[0]; } else if ($type === 'belongs_to') { @@ -1062,14 +1062,14 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate throw new Exception("For relation " . $name . " assoc_foreign_key must be a name of a column"); } } - if (!$options['assoc_func']) { + if (!isset($options['assoc_func']) || !$options['assoc_func']) { if ($type !== 'has_and_belongs_to_many') { $options['assoc_func'] = $options['assoc_foreign_key'] === 'id' ? 'find' : 'findBy' . $options['assoc_foreign_key']; } else { $options['assoc_func'] = 'findThru'; } } - if (!$options['foreign_key']) { + if (!isset($options['foreign_key']) || !$options['foreign_key']) { $options['foreign_key'] = 'id'; } if ($options['foreign_key'] instanceof Closure) { @@ -1758,7 +1758,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate $where_query = null; $pk_not_set = []; foreach ($this->pk as $key) { - $pk = $this->content_db[$key] ?: $this->content[$key]; + $pk = $this->content_db[$key] ?? $this->content[$key] ?? null; if (isset($pk)) { $where_query[] = "`{$this->db_table}`.`{$key}` = " . DBManager::get()->quote($pk); } else { @@ -2134,7 +2134,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate } $params = $options['assoc_func_params_func']; if ($options['type'] === 'has_many') { - $records = function($record) use ($to_call, $params, $options) {$p = (array)$params($record); return call_user_func_array($to_call, array_merge(count($p) ? $p : [null], [$options['order_by']]));}; + $records = function($record) use ($to_call, $params, $options) {$p = (array)$params($record); return call_user_func_array($to_call, array_merge(count($p) ? $p : [null], [$options['order_by'] ?? null]));}; $this->relations[$relation] = new SimpleORMapCollection($records, $options, $this); } elseif ($options['type'] === 'has_and_belongs_to_many') { $records = function($record) use ($to_call, $params, $options) {$p = (array)$params($record); return call_user_func_array($to_call, array_merge(count($p) ? $p : [null], [$options]));}; diff --git a/lib/models/User.class.php b/lib/models/User.class.php index db670fb..497b76e 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -535,7 +535,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject $format = 'full'; } - $sql = $GLOBALS['_fullname_sql'][$format]; + $sql = $GLOBALS['_fullname_sql'][$format] ?? null; if (!$sql || $format == 'no_title') { return $this->vorname . ' ' . $this->nachname; } diff --git a/lib/navigation/BrowseNavigation.php b/lib/navigation/BrowseNavigation.php index e178817..ea67233 100644 --- a/lib/navigation/BrowseNavigation.php +++ b/lib/navigation/BrowseNavigation.php @@ -24,6 +24,8 @@ class BrowseNavigation extends Navigation { global $user, $perm; + $courselink = false; + // check if logged in if (is_object($user) && $user->id != 'nobody') { $coursetext = _('Veranstaltungen'); diff --git a/lib/navigation/Navigation.php b/lib/navigation/Navigation.php index 45b5bbf..e019eb7 100644 --- a/lib/navigation/Navigation.php +++ b/lib/navigation/Navigation.php @@ -120,7 +120,7 @@ class Navigation implements IteratorAggregate } $subnav = $node->getSubNavigation(); - $node = $subnav[$name]; + $node = $subnav[$name] ?? null; if (!isset($node)) { throw new InvalidArgumentException("navigation item '$path' not found"); diff --git a/lib/navigation/StartNavigation.php b/lib/navigation/StartNavigation.php index 646ba4d..305767c 100644 --- a/lib/navigation/StartNavigation.php +++ b/lib/navigation/StartNavigation.php @@ -30,6 +30,7 @@ class StartNavigation extends Navigation { parent::initItem(); + $news = 0; if (mb_stripos($_SERVER['REQUEST_URI'], "web_migrate.php") === false && is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') { if (WidgetHelper::hasWidget($GLOBALS['user']->id, 'News')) { $news = StudipNews::CountUnread(); diff --git a/lib/phplib/Seminar_Auth.class.php b/lib/phplib/Seminar_Auth.class.php index db2828c..2cf0482 100644 --- a/lib/phplib/Seminar_Auth.class.php +++ b/lib/phplib/Seminar_Auth.class.php @@ -265,7 +265,9 @@ class Seminar_Auth $cfg = Config::GetInstance(); //check if the user got kicked meanwhile, or if user is locked out if ($this->auth['uid'] && !in_array($this->auth['uid'], ['form', 'nobody'])) { - $user = $GLOBALS['user']->id == $this->auth['uid'] ? $GLOBALS['user'] : User::find($this->auth['uid']); + $user = (isset($GLOBALS['user']) && $GLOBALS['user']->id == $this->auth['uid']) + ? $GLOBALS['user'] + : User::find($this->auth['uid']); $exp_d = $user->username ? UserConfig::get($user->id)->EXPIRATION_DATE : 0; if (!$user->username || $user->locked || ($exp_d > 0 && $exp_d < time())) { $this->unauth(); diff --git a/lib/phplib/Seminar_Perm.class.php b/lib/phplib/Seminar_Perm.class.php index e846983..ed12b06 100644 --- a/lib/phplib/Seminar_Perm.class.php +++ b/lib/phplib/Seminar_Perm.class.php @@ -216,7 +216,7 @@ class Seminar_Perm { $pageperm = $this->permissions[$perm]; - $userperm = $this->permissions[$this->get_studip_perm($range_id, $user_id)]; + $userperm = $this->permissions[$this->get_studip_perm($range_id, $user_id)] ?? 0; return $pageperm <= $userperm; } diff --git a/lib/phplib/Seminar_Session.class.php b/lib/phplib/Seminar_Session.class.php index 422419b..a5bc592 100644 --- a/lib/phplib/Seminar_Session.class.php +++ b/lib/phplib/Seminar_Session.class.php @@ -207,7 +207,7 @@ class Seminar_Session $this->that_class = 'CT_Cache'; } $this->cookie_path = $this->cookie_path ?: $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']; - $this->cookie_secure = $_SERVER['HTTPS'] === 'on'; + $this->cookie_secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; $this->name(get_class($this)); } diff --git a/lib/phplib/page_open.php b/lib/phplib/page_open.php index 5e63897..48de189 100644 --- a/lib/phplib/page_open.php +++ b/lib/phplib/page_open.php @@ -30,7 +30,7 @@ function page_open($feature) { # the perm feature depends on auth and sess if (isset($feature["perm"])) { - if (!is_object($GLOBALS['perm'])) { + if (!isset($GLOBALS['perm']) || !is_object($GLOBALS['perm'])) { $GLOBALS['perm'] = new $feature["perm"]; } } @@ -38,7 +38,7 @@ function page_open($feature) { # the user feature depends on auth and sess if (isset($feature["user"])) { - if (!is_object($GLOBALS['user'])) { + if (!isset($GLOBALS['user']) || !is_object($GLOBALS['user'])) { $GLOBALS['user'] = new $feature["user"]($GLOBALS['auth']->auth["uid"]); } diff --git a/lib/plugins/engine/PluginManager.class.php b/lib/plugins/engine/PluginManager.class.php index 1745e50..659126c 100644 --- a/lib/plugins/engine/PluginManager.class.php +++ b/lib/plugins/engine/PluginManager.class.php @@ -568,7 +568,7 @@ class PluginManager $plugin = $plugin_class->newInstance(); } - return $this->plugin_cache[$class] = $plugin; + return $this->plugin_cache[$class] = $plugin ?? null; } /** @@ -587,7 +587,7 @@ class PluginManager $plugin = $this->getCachedPlugin($plugin_info); } - return $plugin; + return $plugin ?? null; } /** diff --git a/templates/footer.php b/templates/footer.php index 0ea313b..28731fb 100644 --- a/templates/footer.php +++ b/templates/footer.php @@ -41,7 +41,7 @@ <li> <a <? if (is_internal_url($url = $nav->getURL())) : ?> - href="<?= URLHelper::getLink($url, $header_template->link_params) ?>" + href="<?= URLHelper::getLink($url, $header_template->link_params ?? []) ?>" <? else: ?> href="<?= htmlReady($url) ?>" target="_blank" rel="noopener noreferrer" <? endif ?> diff --git a/templates/header-navigation-item.php b/templates/header-navigation-item.php index a163140..ba70ce5 100644 --- a/templates/header-navigation-item.php +++ b/templates/header-navigation-item.php @@ -2,7 +2,7 @@ $attributes = $nav->getLinkAttributes(); $image_attributes = $nav->getImage()->getAttributes(); -$attributes['title'] = $image_attributes['title']; +$attributes['title'] = $image_attributes['title'] ?? null; // Add badge number to link attributes if ($nav->getBadgeNumber()) { diff --git a/templates/header.php b/templates/header.php index 8f29921..efaedd8 100644 --- a/templates/header.php +++ b/templates/header.php @@ -85,7 +85,7 @@ if (isset($_COOKIE['navigation-length'])) { $alert = true; } } ?> - <div id="notification_marker"<?= $alert ? ' class="alert"' : "" ?> title="<?= _("Benachrichtigungen") ?>" data-lastvisit="<?= $lastvisit ?>"> + <div id="notification_marker"<?= $alert ?? false ? ' class="alert"' : "" ?> title="<?= _("Benachrichtigungen") ?>" data-lastvisit="<?= $lastvisit ?>"> <?= count($notifications) ?> </div> <div class="list below" id="notification_list"> diff --git a/templates/layouts/base.php b/templates/layouts/base.php index 6fde8c9..409f331 100644 --- a/templates/layouts/base.php +++ b/templates/layouts/base.php @@ -1,5 +1,5 @@ <?php -NotificationCenter::postNotification('PageWillRender', $body_id ? : PageLayout::getBodyElementId()); +NotificationCenter::postNotification('PageWillRender', $body_id ?? PageLayout::getBodyElementId()); $navigation = PageLayout::getTabNavigation(); $tab_root_path = PageLayout::getTabNavigationPath(); if ($navigation) { @@ -98,7 +98,7 @@ $getInstalledLanguages = function () { </script> </head> -<body id="<?= $body_id ?: PageLayout::getBodyElementId() ?>" <? if (SkipLinks::isEnabled()) echo 'class="enable-skiplinks"'; ?>> +<body id="<?= $body_id ?? PageLayout::getBodyElementId() ?>" <? if (SkipLinks::isEnabled()) echo 'class="enable-skiplinks"'; ?>> <div id="layout_wrapper"> <? SkipLinks::insertContainer() ?> <? SkipLinks::addIndex(_('Hauptinhalt'), 'layout_content', 100, true) ?> @@ -138,7 +138,7 @@ $getInstalledLanguages = function () { <? endif ?> <? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?> - <?= $this->render_partial('tabs', compact('navigation', 'membership')) ?> + <?= $this->render_partial('tabs', @compact('navigation', 'membership')) ?> <? endif; ?> </nav> <? endif; ?> @@ -199,4 +199,4 @@ $getInstalledLanguages = function () { </a> </body> </html> -<?php NotificationCenter::postNotification('PageDidRender', $body_id ? : PageLayout::getBodyElementId()); +<?php NotificationCenter::postNotification('PageDidRender', $body_id ?? PageLayout::getBodyElementId()); diff --git a/templates/sidebar/time-range-filter.php b/templates/sidebar/time-range-filter.php index 1e343b0..cfec69c 100644 --- a/templates/sidebar/time-range-filter.php +++ b/templates/sidebar/time-range-filter.php @@ -2,12 +2,12 @@ <?= CSRFProtection::tokenTag() ?> <label> <?= _('Dateien neuer als') ?>: - <input type="text" name="begin" value="<?= htmlReady($begin) ?>" + <input type="text" name="begin" value="<?= htmlReady($begin ?? '') ?>" class="has-date-picker"> </label> <label> <?= _('Dateien älter als') ?>: - <input type="text" name="end" value="<?= htmlReady($end) ?>" + <input type="text" name="end" value="<?= htmlReady($end ?? '') ?>" class="has-date-picker submit-on-change"> </label> <? if ($course_options) : ?> diff --git a/templates/sidebar/widget-layout.php b/templates/sidebar/widget-layout.php index de3f82f..2140188 100644 --- a/templates/sidebar/widget-layout.php +++ b/templates/sidebar/widget-layout.php @@ -1,9 +1,9 @@ <div class="<?= $base_class ?>-widget <? if ($layout_css_classes && is_array($layout_css_classes)) echo htmlReady(implode(' ', $layout_css_classes)); ?>" - <? if ($id) printf('id="%s"', htmlReady($id)) ?> - <? if ($style) printf('style="%s"', $style) ?>> + <? if ($id ?? false) printf('id="%s"', htmlReady($id)) ?> + <? if ($style ?? false) printf('style="%s"', $style) ?>> <? if ($title): ?> <div class="<?= $base_class ?>-widget-header"> - <? if ($extra): ?> + <? if ($extra ?? false): ?> <div class="<?= $base_class ?>-widget-extra"><?= $extra ?></div> <? endif; ?> <?= htmlReady($title) ?> |
