diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2022-02-03 14:02:57 +0100 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2022-04-12 15:44:24 +0000 |
| commit | 35ac448d87d1436259061cf9aa3f00ae4c9c6deb (patch) | |
| tree | 47cbd46f97199c54c1dacf5ee9ed0ad436f1c762 | |
| parent | 956bc89af815fe31b0ef68721f051eb80c24786d (diff) | |
transfer changeset 59453 from svn
| -rw-r--r-- | app/controllers/evaluation.php | 2 | ||||
| -rw-r--r-- | app/controllers/profile.php | 4 | ||||
| -rw-r--r-- | app/views/news/display.php | 2 | ||||
| -rw-r--r-- | app/views/profile/index.php | 10 | ||||
| -rw-r--r-- | app/views/questionnaire/widget.php | 2 | ||||
| -rw-r--r-- | lib/classes/AutoInsert.class.php | 2 | ||||
| -rw-r--r-- | lib/classes/DataFieldEntry.class.php | 1 | ||||
| -rw-r--r-- | lib/classes/Request.class.php | 2 | ||||
| -rw-r--r-- | lib/classes/Score.class.php | 2 | ||||
| -rw-r--r-- | lib/classes/SkipLinks.php | 2 | ||||
| -rw-r--r-- | lib/classes/Widget.php | 2 | ||||
| -rw-r--r-- | lib/functions.php | 2 | ||||
| -rw-r--r-- | lib/models/StudipNews.class.php | 1 | ||||
| -rw-r--r-- | lib/navigation/StartNavigation.php | 4 | ||||
| -rw-r--r-- | lib/phplib/Seminar_Auth.class.php | 2 | ||||
| -rw-r--r-- | lib/phplib/Seminar_Perm.class.php | 2 | ||||
| -rw-r--r-- | lib/phplib/Seminar_User.class.php | 2 | ||||
| -rw-r--r-- | lib/seminar_open.php | 2 | ||||
| -rw-r--r-- | lib/user_visible.inc.php | 2 | ||||
| -rw-r--r-- | lib/visual.inc.php | 4 | ||||
| -rw-r--r-- | templates/header.php | 3 | ||||
| -rw-r--r-- | templates/layouts/base.php | 2 |
22 files changed, 32 insertions, 25 deletions
diff --git a/app/controllers/evaluation.php b/app/controllers/evaluation.php index 11a6b3a..40a70d7 100644 --- a/app/controllers/evaluation.php +++ b/app/controllers/evaluation.php @@ -40,7 +40,7 @@ class EvaluationController extends AuthenticatedController } // Special case: from widget and no data -> no output - if ($this->suppress_empty_output && count($this->evaluations) === 0) { + if (!empty($this->suppress_empty_output) && count($this->evaluations) === 0) { $this->render_nothing(); } else { $this->visit(); diff --git a/app/controllers/profile.php b/app/controllers/profile.php index cf9e1f5..32e8801 100644 --- a/app/controllers/profile.php +++ b/app/controllers/profile.php @@ -213,10 +213,10 @@ class ProfileController extends AuthenticatedController foreach ($category as $cat) { $head = $cat->name; $body = $cat->content; - $vis_text = ""; + $vis_text = ''; if ($this->user->user_id == $this->current_user->user_id) { - $vis_text .= ' (' . Visibility::getStateDescription('kat_' . $cat->kategorie_id) . ')'; + $vis_text = ' (' . Visibility::getStateDescription('kat_' . $cat->kategorie_id) . ')'; } if (Visibility::verify('kat_' . $cat->kategorie_id, $this->current_user->user_id)) { diff --git a/app/views/news/display.php b/app/views/news/display.php index 7ffd856..fe197e3 100644 --- a/app/views/news/display.php +++ b/app/views/news/display.php @@ -1,4 +1,4 @@ -<?= $question ?> +<?= $question ?? '' ?> <? if ($perm || $news): ?> <article class="studip"> <header> diff --git a/app/views/profile/index.php b/app/views/profile/index.php index e14dbec..17f4608 100644 --- a/app/views/profile/index.php +++ b/app/views/profile/index.php @@ -81,13 +81,13 @@ </section> -<?= $news ?> +<?= $news ?? '' ?> -<?= $dates ?> +<?= $dates ?? '' ?> -<?= $evaluations ?> +<?= $evaluations ?? '' ?> -<?= $questionnaires ?> +<?= $questionnaires ?? '' ?> <? if (!empty($ausgabe_inhalt)) : ?> <? foreach ($ausgabe_inhalt as $key => $inhalt) : ?> @@ -110,7 +110,7 @@ <?= $this->render_partial('profile/seminare') ?> <? endif ?> -<? if ($show_lit && $lit_list) : ?> +<? if (!empty($show_lit) && !empty($lit_list)) : ?> <article class="studip"> <header> <h1><?= _('Literaturlisten') ?></h1> diff --git a/app/views/questionnaire/widget.php b/app/views/questionnaire/widget.php index 393db14..f7c263e 100644 --- a/app/views/questionnaire/widget.php +++ b/app/views/questionnaire/widget.php @@ -21,7 +21,7 @@ <? foreach ($questionnaire_data as $questionnaire): ?> <?= $this->render_partial("questionnaire/_widget_questionnaire", ['questionnaire' => Questionnaire::buildExisting($questionnaire), 'range_type' => $range_type, 'range_id' => $range_id]) ?> <? endforeach; ?> - <? elseif (!$suppress_empty_output): ?> + <? elseif (empty($suppress_empty_output)): ?> <section class="noquestionnaires"> <?= _('Es sind keine Fragebögen vorhanden.') ?> <? if ($allowed_to_add) : ?> diff --git a/lib/classes/AutoInsert.class.php b/lib/classes/AutoInsert.class.php index 2ee009f..d9b1558 100644 --- a/lib/classes/AutoInsert.class.php +++ b/lib/classes/AutoInsert.class.php @@ -240,7 +240,7 @@ class AutoInsert * @param string $status Status for autoinsertion * @param bool $remove Whether the record should be added or removed */ - public static function updateSeminar($seminar_id, $domain = '', $status, $remove = false) + public static function updateSeminar($seminar_id, $domain, $status, $remove = false) { $query = $remove ? "DELETE FROM auto_insert_sem WHERE seminar_id = ? AND status= ? AND domain_id = ?" : "INSERT IGNORE INTO auto_insert_sem (seminar_id, status,domain_id) VALUES (?, ?, ?)"; $statement = DBManager::get()->prepare($query); diff --git a/lib/classes/DataFieldEntry.class.php b/lib/classes/DataFieldEntry.class.php index 552cc79..0dae104 100644 --- a/lib/classes/DataFieldEntry.class.php +++ b/lib/classes/DataFieldEntry.class.php @@ -101,6 +101,7 @@ abstract class DataFieldEntry return []; // we necessarily need a range ID } $parameters = []; + $clause1 = ''; if(is_array($range_id)) { // rangeID may be an array ("classic" rangeID and second rangeID used for user roles) $secRangeID = $range_id[1]; diff --git a/lib/classes/Request.class.php b/lib/classes/Request.class.php index e4d5472..22cf29d 100644 --- a/lib/classes/Request.class.php +++ b/lib/classes/Request.class.php @@ -114,7 +114,7 @@ class Request implements ArrayAccess, IteratorAggregate { $host = $_SERVER['SERVER_NAME']; $port = $_SERVER['SERVER_PORT']; - $ssl = $_SERVER['HTTPS'] == 'on'; + $ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; if ($ssl && $port != 443 || !$ssl && $port != 80) { $host .= ':' . $port; diff --git a/lib/classes/Score.class.php b/lib/classes/Score.class.php index ededb7e..515484b 100644 --- a/lib/classes/Score.class.php +++ b/lib/classes/Score.class.php @@ -172,7 +172,7 @@ class Score . " WHERE " . ($table['user_id_column'] ?: 'user_id') . " = :user " - . ($table['where'] ? (' AND ' . $table['where']) : ''); + . (!empty($table['where']) ? (' AND ' . $table['where']) : ''); } return join(' UNION ', $statements); } diff --git a/lib/classes/SkipLinks.php b/lib/classes/SkipLinks.php index 455790f..b5d7f35 100644 --- a/lib/classes/SkipLinks.php +++ b/lib/classes/SkipLinks.php @@ -101,7 +101,7 @@ class SkipLinks } usort(self::$links, function ($a, $b) { - return $a['position'] > $b['position']; + return $a['position'] - $b['position']; }); $navigation = new Navigation(''); diff --git a/lib/classes/Widget.php b/lib/classes/Widget.php index 90f3d56..f2dd3f0 100644 --- a/lib/classes/Widget.php +++ b/lib/classes/Widget.php @@ -231,7 +231,7 @@ class Widget public function __get($offset) { - return $this->template_variables[$offset]; + return $this->template_variables[$offset] ?? null; } public function __set($offset, $value) diff --git a/lib/functions.php b/lib/functions.php index acfb412..4c57b5e 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1520,7 +1520,7 @@ function studip_default_exception_handler($exception) { // ajax requests return JSON instead // re-use the http status code determined above - if (!strcasecmp($_SERVER['HTTP_X_REQUESTED_WITH'], 'xmlhttprequest')) { + if (!strcasecmp($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '', 'xmlhttprequest')) { header('Content-Type: application/json; charset=UTF-8'); $template = 'json_exception'; $layout = null; diff --git a/lib/models/StudipNews.class.php b/lib/models/StudipNews.class.php index 227561a..a0ffcd4 100644 --- a/lib/models/StudipNews.class.php +++ b/lib/models/StudipNews.class.php @@ -94,6 +94,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject public static function GetNewsByRange($range_id, $only_visible = false, $as_objects = false) { + $clause = ''; if ($only_visible){ $clause = " AND date < UNIX_TIMESTAMP() AND (date + expire) > UNIX_TIMESTAMP() "; } diff --git a/lib/navigation/StartNavigation.php b/lib/navigation/StartNavigation.php index 305767c..918a95a 100644 --- a/lib/navigation/StartNavigation.php +++ b/lib/navigation/StartNavigation.php @@ -31,6 +31,7 @@ class StartNavigation extends Navigation parent::initItem(); $news = 0; + $vote = 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(); @@ -98,7 +99,6 @@ class StartNavigation extends Navigation public function initSubNavigation() { global $perm, $auth; - $username = $auth->auth['uname']; parent::initSubNavigation(); @@ -106,6 +106,8 @@ class StartNavigation extends Navigation return; } + $username = $auth->auth['uname']; + $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, ['root','admin','dozent']) ? Config::get()->SEM_CREATE_PERM : 'dozent'; diff --git a/lib/phplib/Seminar_Auth.class.php b/lib/phplib/Seminar_Auth.class.php index 2cf0482..c98d8e5 100644 --- a/lib/phplib/Seminar_Auth.class.php +++ b/lib/phplib/Seminar_Auth.class.php @@ -439,7 +439,7 @@ class Seminar_Auth { global $_language_path; - if ($GLOBALS['user']->id !== 'nobody') { + if (!isset($GLOBALS['user']) || $GLOBALS['user']->id !== 'nobody') { $GLOBALS['user'] = new Seminar_User('nobody'); $GLOBALS['perm'] = new Seminar_Perm(); $GLOBALS['auth'] = $this; diff --git a/lib/phplib/Seminar_Perm.class.php b/lib/phplib/Seminar_Perm.class.php index ed12b06..88be47a 100644 --- a/lib/phplib/Seminar_Perm.class.php +++ b/lib/phplib/Seminar_Perm.class.php @@ -101,7 +101,7 @@ class Seminar_Perm { $pageperm = $this->permissions[$perm]; - $userperm = $this->permissions[$this->get_perm($user_id)]; + $userperm = $this->permissions[$this->get_perm($user_id)] ?? 0; return $pageperm <= $userperm; } diff --git a/lib/phplib/Seminar_User.class.php b/lib/phplib/Seminar_User.class.php index 06ecf7c..afe40a1 100644 --- a/lib/phplib/Seminar_User.class.php +++ b/lib/phplib/Seminar_User.class.php @@ -53,7 +53,7 @@ class Seminar_User { if ($this->id && $this->id != 'nobody') { if ($timestamp <= 0) { - if ((time() - $_SESSION['USER_LAST_LIFESIGN']) < 180) { + if ((time() - ($_SESSION['USER_LAST_LIFESIGN'] ?? 0)) < 180) { return 0; } $timestamp = time(); diff --git a/lib/seminar_open.php b/lib/seminar_open.php index abc134f..92787a7 100644 --- a/lib/seminar_open.php +++ b/lib/seminar_open.php @@ -179,7 +179,7 @@ if (!Request::isXhr() && $perm->have_perm('root')) { $_SESSION['migation-check']['disabled'] = true; } - if (!$_SESSION['migation-check']['disabled'] + if (empty($_SESSION['migation-check']['disabled']) && $_SESSION['migration-check']['count'] > 0 ) { $info = sprintf( diff --git a/lib/user_visible.inc.php b/lib/user_visible.inc.php index d0b1285..cf0da1c 100644 --- a/lib/user_visible.inc.php +++ b/lib/user_visible.inc.php @@ -304,7 +304,7 @@ function get_local_visibility_by_id($user_id, $context, $return_user_perm=false) // Valid context given. if (isset($data[$context])) { // Context may not be hidden per global config setting. - if ($NOT_HIDEABLE_FIELDS[$data['perms']][$context]) { + if (!empty($NOT_HIDEABLE_FIELDS[$data['perms']][$context])) { $result = true; } else { // Give also user's permission level. diff --git a/lib/visual.inc.php b/lib/visual.inc.php index 303987d..e6a66b5 100644 --- a/lib/visual.inc.php +++ b/lib/visual.inc.php @@ -544,7 +544,7 @@ function printhead($breite, $left, $link, $open, $new, $icon, $titel, $zusatz, } //Ausgabe des Contents einer aufgeklappten Kopfzeile -function printcontent ($breite, $write = FALSE, $inhalt, $edit, $printout = TRUE, $addon="", $noTdTag = false) { +function printcontent ($breite, $write, $inhalt, $edit, $printout = TRUE, $addon="", $noTdTag = false) { $print = ""; if ($noTdTag == false) @@ -679,7 +679,7 @@ function TransformInternalLinks($str){ } $str = $GLOBALS['ABSOLUTE_URI_STUDIP'] . $str; } - if (is_array($GLOBALS['STUDIP_DOMAINS']) && count($GLOBALS['STUDIP_DOMAINS']) > 1) { + if (isset($GLOBALS['STUDIP_DOMAINS']) && is_array($GLOBALS['STUDIP_DOMAINS']) && count($GLOBALS['STUDIP_DOMAINS']) > 1) { if (!isset($GLOBALS['TransformInternalLinks_domainData'])){ $domain_data['domains'] = ''; foreach ($GLOBALS['STUDIP_DOMAINS'] as $studip_domain) $domain_data['domains'] .= '|' . preg_quote($studip_domain); diff --git a/templates/header.php b/templates/header.php index efaedd8..38e78fd 100644 --- a/templates/header.php +++ b/templates/header.php @@ -13,6 +13,9 @@ if (isset($_COOKIE['navigation-length'])) { $_COOKIE['navigation-length'] ); } + +// Ensure variable is set +$accesskey_enabled = $accesskey_enabled ?? false; ?> <!-- Leiste unten --> diff --git a/templates/layouts/base.php b/templates/layouts/base.php index 409f331..a9e80aa 100644 --- a/templates/layouts/base.php +++ b/templates/layouts/base.php @@ -171,7 +171,7 @@ $getInstalledLanguages = function () { <? else: ?> <?= htmlReady( PageLayout::getTitle()) ?> <? endif ?> - <?= $public_hint ? '(' . htmlReady($public_hint) . ')' : '' ?> + <?= !empty($public_hint) ? '(' . htmlReady($public_hint) . ')' : '' ?> </div> </div> |
