diff --git a/app/controllers/admission/courseset.php b/app/controllers/admission/courseset.php
index c75aea95838b369558d71a09acc56682a84380df..b39cdfb7bf8ad29d60b716b18407bb55d499bae6 100644
--- a/app/controllers/admission/courseset.php
+++ b/app/controllers/admission/courseset.php
@@ -141,6 +141,7 @@ class Admission_CoursesetController extends AuthenticatedController
     public function configure_action($coursesetId = '')
     {
         $this->courseset = null;
+        $allCourses = [];
         if ($GLOBALS['perm']->have_perm('root')) {
             if ($coursesetId) {
                 // Load course set data.
@@ -159,7 +160,6 @@ class Admission_CoursesetController extends AuthenticatedController
             } else {
                 $this->myInstitutes = [];
                 $this->selectedInstitutes = [];
-                $allCourses = [];
                 $selectedCourses = [];
                 $this->selectedSemester = $_SESSION['_default_sem'] ?: Semester::findCurrent()->semester_id;
             }
diff --git a/app/controllers/admission/restricted_courses.php b/app/controllers/admission/restricted_courses.php
index e215fd0f886b80c783cb2e0fed186fdd0f97ce10..aafb589e44da1701e198aaa6e50831979f04782d 100644
--- a/app/controllers/admission/restricted_courses.php
+++ b/app/controllers/admission/restricted_courses.php
@@ -32,7 +32,7 @@ class Admission_RestrictedCoursesController extends AuthenticatedController
     {
 
         $actions = new ActionsWidget();
-        $actions->addLink(_("Export"), $this->url_for('admission/restricted_courses', ['csv' => 1]), Icon::create('export', 'clickable'));
+        $actions->addLink(_("Export"), $this->url_for('admission/restricted_courses', ['csv' => 1]), Icon::create('export'));
         Sidebar::get()->addWidget($actions);
 
         $sem_condition = "";
@@ -113,16 +113,14 @@ class Admission_RestrictedCoursesController extends AuthenticatedController
             }
         }
         if (is_array($this->not_distributed_coursesets)) {
-            PageLayout::postMessage(MessageBox::info(
+            PageLayout::postInfo(
                 _("Es existieren Anmeldesets, die zum Zeitpunkt der Platzverteilung nicht gelost wurden. Stellen Sie sicher, dass der Cronjob \"Losverfahren überprüfen\" ausgeführt wird."),
-                array_unique($this->not_distributed_coursesets)));
+                array_unique($this->not_distributed_coursesets));
         }
     }
 
     function get_courses($seminare_condition)
     {
-        global $perm, $user;
-
         $chunks = explode('_', $this->current_institut_id);
         $institut_id = $chunks[0];
         $all = $chunks[1] ?? null;
@@ -148,7 +146,7 @@ class Admission_RestrictedCoursesController extends AuthenticatedController
                 INNER JOIN seminare ON seminar_courseset.seminar_id=seminare.seminar_id
                 LEFT JOIN semester_courses ON (seminare.Seminar_id = semester_courses.course_id)
                 ";
-        if ($institut_id == 'all'  && $perm->have_perm('root')) {
+        if ($institut_id === 'all' && $GLOBALS['perm']->have_perm('root')) {
             $sql .= "WHERE 1 {$seminare_condition} ";
         } elseif ($all == 'all') {
             $sql .= "INNER JOIN Institute USING (Institut_id)
@@ -262,14 +260,17 @@ class Admission_RestrictedCoursesController extends AuthenticatedController
         $statement = DBManager::get()->prepare($query);
         $statement->execute($parameters);
         $temp = $statement->fetchAll(PDO::FETCH_ASSOC);
-
+        $_my_inst = [];
         foreach ($temp as $row) {
+            if (!isset($_my_inst[$row['Institut_id']])) {
+                $_my_inst[$row['Institut_id']] = [];
+            }
             $_my_inst[$row['Institut_id']] = [
                 'name'   => $row['Name'],
                 'is_fak' => $row['is_fak'],
                 'count'  => $row['count'],
             ];
-            if ($row["is_fak"] && (!isset($row['inst_perms']) || $row['inst_perms'] !== 'dozent')) {
+            if ($row['is_fak'] && (!isset($row['inst_perms']) || $row['inst_perms'] !== 'dozent')) {
                 $institute_statement->execute([$row['Institut_id']]);
                 $alle = $institute_statement->fetchAll();
                 if (count($alle)) {
diff --git a/app/controllers/admission/rule.php b/app/controllers/admission/rule.php
index a8fd05edbb03f378311e4d0fa5793cf8cbd846f5..061cc4ee0f5cfab69412973c391818c1c9a31a7d 100644
--- a/app/controllers/admission/rule.php
+++ b/app/controllers/admission/rule.php
@@ -92,7 +92,6 @@ class Admission_RuleController extends AuthenticatedController
     public function save_action($ruleType, $ruleId = '')
     {
         CSRFProtection::verifyUnsafeRequest();
-        $rules = AdmissionRule::getAvailableAdmissionRules();
         $this->rule = new $ruleType($ruleId);
         $requestData = Request::getInstance();
         // Check for start and end date and parse the String values to timestamps.
@@ -120,7 +119,6 @@ class Admission_RuleController extends AuthenticatedController
      */
     public function validate_action($ruleType, $ruleId = '')
     {
-        $rules = AdmissionRule::getAvailableAdmissionRules();
         $rule = new $ruleType($ruleId);
         $this->errors = $rule->validate(Request::getInstance());
     }
diff --git a/app/controllers/admission/userlist.php b/app/controllers/admission/userlist.php
index f2cda5797c13e5c84308b9d702914cc968846f3d..4c86185cddf375bf8f3110c3103535f392050c2b 100644
--- a/app/controllers/admission/userlist.php
+++ b/app/controllers/admission/userlist.php
@@ -64,13 +64,13 @@ class Admission_UserListController extends AuthenticatedController
         }
         $this->users = User::findMany(array_keys($this->userlist->getUsers()));
         if ($this->flash['name'] || $this->flash['factor'] || $this->flash['users'] || $this->flash['deleted_member']) {
-            if ($this->flash['name']) {
+            if (!empty($this->flash['name'])) {
                 $this->userlist->setName($this->flash['name']);
             }
-            if ($this->flash['factor']) {
+            if (!empty($this->flash['factor'])) {
                 $this->userlist->setFactor($this->flash['factor']);
             }
-            if ($this->flash['users'] || $this->flash['deleted_member']) {
+            if (!empty($this->flash['users']) || !empty($this->flash['deleted_member'])) {
                 $this->users = User::findMany($this->flash['cleared_users'] ?: $this->flash['users'] ?: []);
             }
         }
diff --git a/app/controllers/calendar/calendar.php b/app/controllers/calendar/calendar.php
index 5ad138fc79e2b6a582e14c27977f3b025e73e3a7..09eeaab6f77ed3a3756055b15a9c7b8e6680f2da 100644
--- a/app/controllers/calendar/calendar.php
+++ b/app/controllers/calendar/calendar.php
@@ -494,17 +494,10 @@ class Calendar_CalendarController extends AuthenticatedController
             $messages[] = _('Die Startzeit muss vor der Endzeit liegen.');
         }
 
-        if (Request::isXhr()) {
-            $event->setTitle(Request::get('summary', ''));
-            $event->event->description = Request::get('description', '');
-            $event->setUserDefinedCategories(Request::get('categories', ''));
-            $event->event->location = Request::get('location', '');
-        } else {
-            $event->setTitle(Request::get('summary'));
-            $event->event->description = Request::get('description', '');
-            $event->setUserDefinedCategories(Request::get('categories', ''));
-            $event->event->location = Request::get('location', '');
-        }
+        $event->setTitle(Request::get('summary', ''));
+        $event->event->description = Request::get('description', '');
+        $event->setUserDefinedCategories(Request::get('categories', ''));
+        $event->event->location        = Request::get('location', '');
         $event->event->category_intern = Request::int('category_intern', 1);
         $event->setAccessibility(Request::option('accessibility', 'PRIVATE'));
         $event->setPriority(Request::int('priority', 0));
@@ -538,7 +531,7 @@ class Calendar_CalendarController extends AuthenticatedController
         }
         switch ($rec_type) {
             case 'daily':
-                if (Request::option('type_daily', 'day') == 'day') {
+                if (Request::option('type_daily', 'day') === 'day') {
                     $rrule['linterval'] = Request::int('linterval_d', 1);
                     $rrule['rtype'] = 'DAILY';
                 } else {
@@ -548,41 +541,38 @@ class Calendar_CalendarController extends AuthenticatedController
                 }
                 break;
             case 'weekly':
+                $rrule['rtype'] = 'WEEKLY';
                 $rrule['linterval'] = Request::int('linterval_w', 1);
                 $rrule['wdays'] = implode('', Request::intArray('wdays',
                         [strftime('%u', $event->getStart())]));
-                $rrule['rtype'] = 'WEEKLY';
                 break;
             case 'monthly':
-                if (Request::option('type_m', 'day') == 'day') {
+                $rrule['rtype'] = 'MONTHLY';
+                if (Request::option('type_m', 'day') === 'day') {
                     $rrule['linterval'] = Request::int('linterval_m1', 1);
                     $rrule['day'] = Request::int('day_m',
                             strftime('%e', $event->getStart()));
-                    $rrule['rtype'] = 'MONTHLY';
                 } else {
                     $rrule['linterval'] = Request::int('linterval_m2', 1);
                     $rrule['sinterval'] = Request::int('sinterval_m', 1);
                     $rrule['wdays'] = Request::int('wday_m',
                             strftime('%u', $event->getStart()));
-                    $rrule['rtype'] = 'MONTHLY';
                 }
                 break;
             case 'yearly':
-                if (Request::option('type_y', 'day') == 'day') {
-                    $rrule['linterval'] = 1;
+                $rrule['rtype'] = 'YEARLY';
+                $rrule['linterval'] = 1;
+                if (Request::option('type_y', 'day') === 'day') {
                     $rrule['day'] = Request::int('day_y',
                             strftime('%e', $event->getStart()));
                     $rrule['month'] = Request::int('month_y1',
                             date('n', $event->getStart()));
-                    $rrule['rtype'] = 'YEARLY';
                 } else {
-                    $rrule['linterval'] = 1;
                     $rrule['sinterval'] = Request::int('sinterval_y', 1);
                     $rrule['wdays'] = Request::int('wday_y',
                             strftime('%u', $event->getStart()));
                     $rrule['month'] = Request::int('month_y2',
                             date('n', $event->getStart()));
-                    $rrule['rtype'] = 'YEARLY';
                 }
                 break;
         }
diff --git a/app/controllers/calendar/contentbox.php b/app/controllers/calendar/contentbox.php
index f2689bfd1069e074f89469cdfce3508816cde862..129fb59c38ba87af34dd7923d56bafa9f1014bf9 100644
--- a/app/controllers/calendar/contentbox.php
+++ b/app/controllers/calendar/contentbox.php
@@ -80,7 +80,7 @@ class Calendar_ContentboxController extends StudipController
     {
         $course = Course::find($id);
         $dates = $course->getDatesWithExdates()->findBy('end_time', [$this->start, $this->start + $this->timespan], '><');
-
+        $this->termine = [];
         foreach ($dates as $courseDate) {
             // Build info
             $info = [];
@@ -120,7 +120,7 @@ class Calendar_ContentboxController extends StudipController
             null,
             $restrictions
         );
-
+        $this->termine = [];
         // Prepare termine
         foreach ($events as $termin) {
             // Exclude events that begin after the given time range
diff --git a/app/controllers/calendar/group.php b/app/controllers/calendar/group.php
index 342a247a29f5a6fd3b439eb42b4608b374a934e9..f440a570cfbf6804049c1b1604ab4e4eb1338f86 100644
--- a/app/controllers/calendar/group.php
+++ b/app/controllers/calendar/group.php
@@ -18,12 +18,12 @@ class Calendar_GroupController extends Calendar_CalendarController
         $actions = new ActionsWidget();
         $actions->addLink(_('Termin anlegen'),
                           $this->url_for('calendar/group/edit'),
-                          Icon::create('add', 'clickable'),
+                          Icon::create('add'),
             ['data-dialog' => 'size=auto']);
         $actions->addLink(_('Kalender freigeben'),
                 $this->url_for('calendar/single/manage_access/' . $GLOBALS['user']->id,
                                ['group_filter' => $this->range_id]),
-                          Icon::create('community', 'clickable'),
+                          Icon::create('community'),
                           ['id' => 'calendar-open-manageaccess',
                                 'data-dialog' => '', 'data-dialogname' => 'manageaccess']);
         $sidebar->addWidget($actions);
@@ -49,6 +49,7 @@ class Calendar_GroupController extends Calendar_CalendarController
         // the first calendar is the calendar of the actual user
         $this->calendar = new SingleCalendar($GLOBALS['user']->id);
         $group = $this->getGroup($this->calendar);
+        $this->attendee_ids = [];
         if ($group) {
             $calendar_owners = CalendarUser::getOwners($GLOBALS['user']->id,
                         Calendar::PERMISSION_WRITABLE)->pluck('owner_id');
@@ -157,11 +158,11 @@ class Calendar_GroupController extends Calendar_CalendarController
                     header('X-Dialog-Close: 1');
                     exit;
                 } else {
-                    PageLayout::postMessage(MessageBox::success(_('Der Termin wurde nicht geändert.')));
+                    PageLayout::postSuccess(_('Der Termin wurde nicht geändert.'));
                     $this->relocate('calendar/group/' . $this->last_view, ['atime' => $this->atime]);
                 }
             } else {
-                PageLayout::postMessage(MessageBox::success(_('Der Termin wurde gespeichert.')));
+                PageLayout::postSuccess(_('Der Termin wurde gespeichert.'));
                 $this->relocate('calendar/group/' . $this->last_view, ['atime' => $this->atime]);
             }
         } else {
@@ -221,6 +222,7 @@ class Calendar_GroupController extends Calendar_CalendarController
 
     public function week_action($range_id = null)
     {
+        $this->calendars = [];
         $this->range_id = $range_id ?: $this->range_id;
         $timestamp = mktime(12, 0, 0, date('n', $this->atime),
                 date('j', $this->atime), date('Y', $this->atime));
@@ -260,6 +262,7 @@ class Calendar_GroupController extends Calendar_CalendarController
 
     public function month_action($range_id = null)
     {
+        $this->calendars = [];
         $this->range_id = $range_id ?: $this->range_id;
         $month_start = mktime(12, 0, 0, date('n', $this->atime), 1, date('Y', $this->atime));
         $month_end = mktime(12, 0, 0, date('n', $this->atime), date('t', $this->atime), date('Y', $this->atime));
@@ -299,6 +302,9 @@ class Calendar_GroupController extends Calendar_CalendarController
 
     public function year_action($range_id = null)
     {
+        $this->calendars = [];
+        $this->count_lists = [];
+
         $this->range_id = $range_id ?: $this->range_id;
         $start = mktime(0, 0, 0, 1, 1, date('Y', $this->atime));
         $end = mktime(23, 59, 59, 12, 31, date('Y', $this->atime));
diff --git a/app/controllers/calendar/instschedule.php b/app/controllers/calendar/instschedule.php
index dcf6ddf2bf057382b65ae7de9317a8a1c5b27abf..452e71db0db701b3ac11cddd4ca05f7542928120 100644
--- a/app/controllers/calendar/instschedule.php
+++ b/app/controllers/calendar/instschedule.php
@@ -20,7 +20,7 @@ class Calendar_InstscheduleController extends AuthenticatedController
      * this action is the main action of the schedule-controller, setting the environment for the timetable,
      * accepting a comma-separated list of days.
      *
-     * @param  string  a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
+     * @param  string $days a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
      */
     function index_action($days = false)
     {
@@ -108,14 +108,14 @@ class Calendar_InstscheduleController extends AuthenticatedController
             $this->url_for('calendar/instschedule/index/'. implode(',', $this->days),
                 ['printview'    => 'true',
                  'semester_id'  => $this->current_semester['semester_id']]),
-            Icon::create('print', 'clickable'),
+            Icon::create('print'),
             ['target' => '_blank']);
 
         // Only admins should have the ability to change their schedule settings here - they have no other schedule
         if ($GLOBALS['perm']->have_perm('admin')) {
             $actions->addLink(_("Darstellung ändern"),
                 $this->url_for('calendar/schedule/settings'),
-                Icon::create('admin', 'clickable'),
+                Icon::create('admin'),
                 ['data-dialog' => '']
             );
 
@@ -124,12 +124,12 @@ class Calendar_InstscheduleController extends AuthenticatedController
                 if ($GLOBALS['user']->cfg->MY_INSTITUTES_INCLUDE_CHILDREN) {
                     $actions->addLink(_("Untergeordnete Institute ignorieren"),
                         $this->url_for('calendar/instschedule/include_children/0'),
-                        Icon::create('checkbox-checked', 'clickable')
+                        Icon::create('checkbox-checked')
                     );
                 } else {
                     $actions->addLink(_("Untergeordnete Institute einbeziehen"),
                         $this->url_for('calendar/instschedule/include_children/1'),
-                        Icon::create('checkbox-unchecked', 'clickable')
+                        Icon::create('checkbox-unchecked')
                     );
                 }
             }
diff --git a/app/controllers/calendar/schedule.php b/app/controllers/calendar/schedule.php
index 67a45773894b62722dd3a1da33815de208794eaf..52c6f36c9e8bc113bb42e4432fe39087be3327a7 100644
--- a/app/controllers/calendar/schedule.php
+++ b/app/controllers/calendar/schedule.php
@@ -114,7 +114,7 @@ class Calendar_ScheduleController extends AuthenticatedController
             : CalendarScheduleModel::getUserCalendarView($GLOBALS['user']->id, $show_hidden, $this->current_semester, $this->days);;
 
         // have we chosen an entry to display?
-        if ($this->flash['entry']) {
+        if (!empty($this->flash['entry'])) {
             if ($inst_mode) {
                 $this->show_entry = $this->flash['entry'];
             } else if ($this->flash['entry']['id'] == null) {
@@ -162,10 +162,7 @@ class Calendar_ScheduleController extends AuthenticatedController
         $this->inst_mode = $inst_mode;
         $this->institute_name = $inst['name'];
         $this->institute_id = $institute_id;
-
-        if (Request::get('show_settings')) {
-            $this->show_settings = true;
-        }
+        $this->show_settings = Request::bool('show_settings', false);
     }
 
     public function new_entry_action()
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index 016167ec6e3ea75a7a110d9c06c83c0eff2267e3..47d2ecdda94ae323eff01a537de5ccdd3785b78b 100644
--- a/app/controllers/consultation/admin.php
+++ b/app/controllers/consultation/admin.php
@@ -286,7 +286,6 @@ class Consultation_AdminController extends ConsultationController
             throw new MethodNotAllowedException();
         }
 
-        $is_expired = false;
         if (!$slot_id) {
             $block = $this->loadBlock($block_id);
             $is_expired = $block->is_expired;
@@ -657,7 +656,6 @@ class Consultation_AdminController extends ConsultationController
         );
 
         if (array_sum($deleted) > 0) {
-            $message = [];
             if ($deleted['current'] > 0) {
                 PageLayout::postSuccess(sprintf(
                     _('%u aktuelle Termine wurden gelöscht'),
@@ -682,7 +680,7 @@ class Consultation_AdminController extends ConsultationController
             $slots = $this->getSlotsFromBulk();
         } else {
             $block = $this->loadBlock($block_id);
-
+            $slots = [];
             foreach ($block->slots as $slot) {
                 if ($slot_id && $slot->id != $slot_id) {
                     continue;
diff --git a/app/controllers/course/admission.php b/app/controllers/course/admission.php
index a0d38170e41554f965261a13951b7e8869e6aa85..d451b1c5132c967fef9d6ea29655132afe14bd20 100644
--- a/app/controllers/course/admission.php
+++ b/app/controllers/course/admission.php
@@ -40,6 +40,7 @@ class Course_AdmissionController extends AuthenticatedController
         PageLayout::setTitle($this->course->getFullname()." - " ._("Verwaltung von Zugangsberechtigungen"));
 
         $lockrules = words('admission_turnout admission_type admission_endtime admission_binding passwort read_level write_level admission_prelim admission_prelim_txt admission_starttime admission_endtime_sem admission_disable_waitlist user_domain admission_binding admission_studiengang');
+        $this->is_locked = [];
         foreach ($lockrules as $rule) {
             $this->is_locked[$rule] = LockRules::Check($this->course_id, $rule) ? 'disabled readonly' : '';
         }
@@ -119,7 +120,7 @@ class Course_AdmissionController extends AuthenticatedController
     {
         CSRFProtection::verifyUnsafeRequest();
         PageLayout::setTitle(_('Anmeldemodus ändern'));
-
+        $request = null;
         if (Request::submitted('change_admission_prelim')) {
             $request = Request::extract('admission_prelim int, admission_binding submitted, admission_prelim_txt');
             $request = array_diff_key($request, array_filter($this->is_locked));
@@ -197,7 +198,7 @@ class Course_AdmissionController extends AuthenticatedController
                 unset($question);
             }
         }
-        if (!$question) {
+        if (empty($question)) {
             $this->redirect($this->action_url('index'));
         } else {
             $this->button_yes = 'change_admission_prelim_yes';
@@ -246,7 +247,7 @@ class Course_AdmissionController extends AuthenticatedController
     {
         CSRFProtection::verifyUnsafeRequest();
         PageLayout::setTitle(_('Teilnehmendenanzahl ändern'));
-
+        $request = null;
         if (Request::submitted('change_admission_turnout')) {
             $request = Request::extract('admission_turnout int, admission_disable_waitlist submitted, admission_disable_waitlist_move submitted, admission_waitlist_max int');
             $request = array_diff_key($request, array_filter($this->is_locked));
@@ -302,7 +303,7 @@ class Course_AdmissionController extends AuthenticatedController
                 unset($question);
             }
         }
-        if (!$question) {
+        if (empty($question)) {
             $this->redirect($this->action_url('index'));
         } else {
             $this->request = $request;
@@ -359,7 +360,7 @@ class Course_AdmissionController extends AuthenticatedController
                     $question = sprintf(_("In dieser Veranstaltung existiert eine Anmeldeliste (Platzverteilung am %s). Die bestehende Anmeldeliste mit %s Einträgen wird gelöscht. Sind sie sicher?"), strftime('%x %R', $cs->getSeatDistributionTime()), count($priorities));
                 }
             }
-            if (!$question && $cs) {
+            if (empty($question) && $cs) {
                 CourseSet::removeCourseFromSet($cs->getId(), $this->course_id);
                 $cs->load();
                 if (!in_array($this->course_id, $cs->getCourses())) {
@@ -390,7 +391,7 @@ class Course_AdmissionController extends AuthenticatedController
                 }
             }
         }
-        if (!$question) {
+        if (empty($question)) {
             $this->redirect($this->action_url('index'));
         } else {
             $this->request = ['change_course_set_unassign' => 1];
@@ -497,7 +498,7 @@ class Course_AdmissionController extends AuthenticatedController
             $this->instant_course_set_view = true;
             $response = $this->relay('admission/courseset/configure/' . $cs->getId());
             $this->body = $response->body;
-            if ($response->headers['Location']) {
+            if (!empty($response->headers['Location'])) {
                 $this->redirect($response->headers['Location']);
             }
         } else {
diff --git a/app/controllers/course/basicdata.php b/app/controllers/course/basicdata.php
index a2524b4a375d81a3a65033c837ca1e322d21fd71..baa817a0fd515fe85915d27774452a76b0fc1117 100644
--- a/app/controllers/course/basicdata.php
+++ b/app/controllers/course/basicdata.php
@@ -481,7 +481,10 @@ class Course_BasicdataController extends AuthenticatedController
             }
 
             if (sizeof($before) && sizeof($after)) {
-                foreach($before as $k => $v) $log_message .= "$k: $v => " . $after[$k] . " \n";
+                $log_message = '';
+                foreach ($before as $k => $v) {
+                    $log_message .= "$k: $v => " . $after[$k] . " \n";
+                }
                 StudipLog::log('CHANGE_BASIC_DATA', $sem->getId(), " ", $log_message);
                 NotificationCenter::postNotification('SeminarBasicDataDidUpdate', $sem->id , $GLOBALS['user']->id);
             }
@@ -849,10 +852,10 @@ class Course_BasicdataController extends AuthenticatedController
         $this->redirect($this->url_for('course/basicdata/view/' . $sem->getId()));
     }
 
-    public function switchdeputy_action($course_id, $newstatus) {
+    public function switchdeputy_action($course_id, $newstatus)
+    {
         CSRFProtection::verifySecurityToken();
 
-        $course = Seminar::getInstance($course_id);
         switch($newstatus) {
             case 'dozent':
                 $dozent = new CourseMember();
diff --git a/app/controllers/course/block_appointments.php b/app/controllers/course/block_appointments.php
index 67035fa356c437a21dd4d7764bd11d5c50cde66c..31daa0dae1adf6ee93a87445c99afd0da3fcfc0d 100644
--- a/app/controllers/course/block_appointments.php
+++ b/app/controllers/course/block_appointments.php
@@ -122,7 +122,8 @@ class Course_BlockAppointmentsController extends AuthenticatedController
 
         $start_day = strtotime(Request::get('block_appointments_start_day'));
         $end_day = strtotime(Request::get('block_appointments_end_day'));
-
+        $start_time = null;
+        $end_time = null;
         if (!($start_day && $end_day && $start_day <= $end_day)) {
             $errors[] = _('Bitte geben Sie korrekte Werte für Start- und Enddatum an!');
         } else {
@@ -236,7 +237,6 @@ class Course_BlockAppointmentsController extends AuthenticatedController
                     'block_appointments_days'       => $days
                 ];
                 $dates_created = array_filter(array_map(function ($d) use ($free_room_text) {
-                    $result = false;
                     if (!Request::get('room_id')) {
                         $d->raum = $free_room_text;
                         $result = $d->store();
diff --git a/app/controllers/course/cancel_dates.php b/app/controllers/course/cancel_dates.php
index 98fb91b50f8081a4e28db8e45aed0b859d991020..f3420cb388c359a529f3b155dfc66f32a67b06bb 100644
--- a/app/controllers/course/cancel_dates.php
+++ b/app/controllers/course/cancel_dates.php
@@ -53,6 +53,7 @@ class Course_CancelDatesController extends AuthenticatedController
     {
         CSRFProtection::verifyUnsafeRequest();
         $sem = Seminar::getInstance($this->course_id);
+        $msg = '';
         foreach ($this->dates as $date) {
             $sem->cancelSingleDate($date->getTerminId(), $date->getMetadateId());
             $date->setComment(Request::get('cancel_dates_comment'));
diff --git a/app/controllers/course/dates.php b/app/controllers/course/dates.php
index 9c803b7e53e1958f2730951991ee63bb1ce099a5..024e8dbb6b49e4f9c3757bebb973fea70ed9afaa 100644
--- a/app/controllers/course/dates.php
+++ b/app/controllers/course/dates.php
@@ -136,7 +136,7 @@ class Course_DatesController extends AuthenticatedController
     public function details_action($termin_id)
     {
         $this->date = new CourseDate($termin_id);
-
+        $this->teachers = [];
         Navigation::activateItem('/course/schedule/dates');
         PageLayout::setTitle(
             $this->date->getTypeName() . ': ' .
@@ -182,7 +182,9 @@ class Course_DatesController extends AuthenticatedController
         $this->assignLockRulesToTemplate();
 
         Navigation::activateItem('/course/schedule/dates');
-
+        $start_time = null;
+        $end_time = null;
+        $xtitle = '';
         if (Request::isPost()) {
             CSRFProtection::verifyUnsafeRequest();
 
diff --git a/app/controllers/course/elearning.php b/app/controllers/course/elearning.php
index 2b0061885b436f39d8dbf2091d36a0b2bdeda882..a8a7626bed8003277fad8c49699072e066327092 100644
--- a/app/controllers/course/elearning.php
+++ b/app/controllers/course/elearning.php
@@ -102,16 +102,20 @@ class Course_ElearningController extends AuthenticatedController
         $content_modules_list = [];
         if ($object_connections->isConnected()) {
             $caching_active = true;
-            foreach ($connected_modules as $key => $connection) {
-                if (ELearningUtils::isCMSActive($connection["cms"])) {
+            $type_tmp = [];
 
-                    ELearningUtils::loadClass($connection["cms"]);
+            if (!empty($connected_modules)) {
+                foreach ($connected_modules as $key => $connection) {
+                    if (ELearningUtils::isCMSActive($connection["cms"])) {
 
-                    $connected_cms[$connection["cms"]]->newContentModule($connection["id"], $connection["type"], true);
-                    $connected_modules[$key]['title'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getTitle();
-                    $title_tmp[$key] = str_replace(['ä','ö','ü','ß'],['ae','oe','ue','ss'],mb_strtolower($connected_modules[$key]['title']));
-                    $type_tmp[$key] = array_search($connection['type'], array_keys($GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]['types']));
-                    $class_tmp[$key] = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]["CLASS_PREFIX"];
+                        ELearningUtils::loadClass($connection["cms"]);
+
+                        $connected_cms[$connection["cms"]]->newContentModule($connection["id"], $connection["type"], true);
+                        $connected_modules[$key]['title'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getTitle();
+                        $title_tmp[$key] = str_replace(['ä','ö','ü','ß'],['ae','oe','ue','ss'],mb_strtolower($connected_modules[$key]['title']));
+                        $type_tmp[$key] = array_search($connection['type'], array_keys($GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]['types']));
+                        $class_tmp[$key] = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]["CLASS_PREFIX"];
+                    }
                 }
             }
             array_multisort($class_tmp, SORT_ASC, $type_tmp, SORT_ASC, $title_tmp, SORT_ASC, $connected_modules);
@@ -133,7 +137,7 @@ class Course_ElearningController extends AuthenticatedController
                 $content_modules_list[$index]['module'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->view->show();
             }
         }
-        if (($this->module_count == 0) AND ($this->new_account_cms == "")) {
+        if (!$this->module_count && !$this->new_account_cms) {
             if (Context::isInstitute()) {
                 PageLayout::postInfo(_('Momentan sind dieser Einrichtung keine Lernmodule zugeordnet.'));
             } else {
@@ -182,7 +186,10 @@ class Course_ElearningController extends AuthenticatedController
 
         // ggf. bestehenden Ilias4-Kurs zuordnen
         if (Request::submitted('connect_course')) {
-            if ((ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select)) AND ($GLOBALS['perm']->have_studip_perm("dozent", Request::option("connect_course_sem_id")))) {
+            if (
+                ObjectConnections::getConnectionModuleId(Request::option('connect_course_sem_id'), 'crs', $this->cms_select)
+                && $GLOBALS['perm']->have_studip_perm('dozent', Request::option('connect_course_sem_id'))
+            ) {
                 ObjectConnections::setConnection($this->seminar_id, ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select), "crs", $this->cms_select);
                 PageLayout::postInfo(_('Zuordnung wurde gespeichert.'));
                 ELearningUtils::loadClass($this->cms_select);
diff --git a/app/controllers/course/enrolment.php b/app/controllers/course/enrolment.php
index a1e502372667a1df564e3e176fbfca9badb38dc6..a9ca3516bf62a0f4a5db4b2f8b6c71a59f84f46b 100644
--- a/app/controllers/course/enrolment.php
+++ b/app/controllers/course/enrolment.php
@@ -83,14 +83,17 @@ class Course_EnrolmentController extends AuthenticatedController
         } catch (Exception $e) {
             $this->confirmed = false;
         }
-
+        $msg_details = [];
+        $msg = '';
         $user_id = $GLOBALS['user']->id;
+        $enrol_user = false;
         $courseset = CourseSet::getSetForCourse($this->course_id);
         if ($courseset) {
             $errors = $courseset->checkAdmission($user_id, $this->course_id);
             if (count($errors)) {
                 $this->courseset_message = $courseset->toString(true);
                 $this->admission_error = MessageBox::error(_("Die Anmeldung war nicht erfolgreich."), $errors);
+                $admission_form = '';
                 foreach ($courseset->getAdmissionRules() as $rule) {
                     $admission_form .= $rule->getInput();
                 }
@@ -231,7 +234,7 @@ class Course_EnrolmentController extends AuthenticatedController
         StudipLock::release();
 
         if ($enrol_user && $this->confirmed) {
-            if ($course->admission_prelim) {
+            if (!empty($course) && $course->admission_prelim) {
                 $this->relocate(URLHelper::getLink('dispatch.php/course/details', ['sem_id' => $this->course_id]));
             } else {
                 $this->relocate(URLHelper::getLink('seminar_main.php', ['auswahl' => $this->course_id]));
@@ -260,6 +263,7 @@ class Course_EnrolmentController extends AuthenticatedController
         $user_id = $GLOBALS['user']->id;
         $courseset = CourseSet::getSetForCourse($this->course_id);
         $anchor = '';
+        $changed = 0;
         if ($courseset->isSeatDistributionEnabled() && !count($courseset->checkAdmission($user_id, $this->course_id))) {
             if ($limit = $courseset->getAdmissionRule('LimitedAdmission')) {
                 $admission_user_limit = Request::int('admission_user_limit');
diff --git a/app/controllers/course/forum/admin.php b/app/controllers/course/forum/admin.php
index a7fff7196e395bb013bccc6563f438ba6cbc1b34..e4d21d89dc21be852f0d896215bcdc0aa02f272f 100644
--- a/app/controllers/course/forum/admin.php
+++ b/app/controllers/course/forum/admin.php
@@ -31,9 +31,11 @@ class Course_Forum_AdminController extends ForumController
 
         // sort by cat
         $new_list = [];
+        $this->categories = [];
         // iterate over all categories and add the belonging areas to them
-        foreach ($categories = ForumCat::getListWithAreas($this->getId(), false) as $category) {
-            if ($category['topic_id']) {
+        $categories = ForumCat::getListWithAreas($this->getId(), false) ;
+        foreach ($categories as $category) {
+            if (!empty($category['topic_id'])) {
                 $new_list[$category['category_id']][$category['topic_id']] = $list['list'][$category['topic_id']];
                 unset($list['list'][$category['topic_id']]);
             } else if (ForumPerm::has('add_area', $this->seminar_id)) {
@@ -50,10 +52,10 @@ class Course_Forum_AdminController extends ForumController
         $this->list = $new_list;
 
     }
-    
+
     /**
      * show child entries for the passed entry
-     * 
+     *
      * @param string $parent_id id of entry to get the childs for
      */
     function childs_action($parent_id)
@@ -73,7 +75,7 @@ class Course_Forum_AdminController extends ForumController
 
     /**
      * move the submitted topics[] to the passed destination
-     * 
+     *
      * @param string $destination id of seminar to move topics to
      */
     function move_action($destination)
@@ -82,8 +84,10 @@ class Course_Forum_AdminController extends ForumController
         if (ForumCat::get($destination)) {
             $category_id = $destination;
             $destination = $this->getId();
+        } else {
+            $category_id = null;
         }
-        
+
         ForumPerm::check('admin', $this->getId(), $destination);
 
         foreach (Request::getArray('topics') as $topic_id) {
@@ -104,20 +108,23 @@ class Course_Forum_AdminController extends ForumController
 
                 // second step: move all to deep childs a level up (depth > 3)
                 $data = ForumEntry::getList('depth_to_large', $topic_id);
-                foreach ($data['list'] as $entry) {
-                    $path = ForumEntry::getPathToPosting($entry['topic_id']);
-                    array_shift($path); // Category
-                    array_shift($path); // Area
 
-                    $thread = array_shift($path); // Thread
+                if (!empty($data['list'])) {
+                    foreach ($data['list'] as $entry) {
+                        $path = ForumEntry::getPathToPosting($entry['topic_id']);
+                        array_shift($path); // Category
+                        array_shift($path); // Area
 
-                    ForumEntry::move($entry['topic_id'], $thread['id']);
+                        $thread = array_shift($path); // Thread
+
+                        ForumEntry::move($entry['topic_id'], $thread['id']);
+                    }
                 }
-                
+
                 // add entry to passed category when moving to the top
                 if ($category_id) {
                     ForumCat::addArea($category_id, $topic_id);
-                }                    
+                }
             }
         }
 
diff --git a/app/controllers/course/forum/area.php b/app/controllers/course/forum/area.php
index a93860aa5c5357a3ba7c2bbbe5786f9e97d9d9d5..821129f6bf67bd14d9e593d2e5d1f22e67d586d3 100644
--- a/app/controllers/course/forum/area.php
+++ b/app/controllers/course/forum/area.php
@@ -48,11 +48,10 @@ class Course_Forum_AreaController extends ForumController
     {
         ForumPerm::check('edit_area', $this->getId(), $area_id);
 
+        ForumEntry::update($area_id, Request::get('name'), Request::get('content'));
         if (Request::isAjax()) {
-            ForumEntry::update($area_id, Request::get('name'), Request::get('content'));
             $this->render_json(['content' => ForumEntry::killFormat(ForumEntry::killEdit(Request::get('content')))]);
         } else {
-            ForumEntry::update($area_id, Request::get('name'), Request::get('content'));
             $this->flash['messages'] = ['success' => _('Die Änderungen am Bereich wurden gespeichert.')];
             $this->redirect('course/forum/index/index');
         }
diff --git a/app/controllers/course/forum/index.php b/app/controllers/course/forum/index.php
index 97484616de2cad20a3403ab858c9b15d2f94dbcb..f2c6de7913d32375e7b597f307bc85e448924a38 100644
--- a/app/controllers/course/forum/index.php
+++ b/app/controllers/course/forum/index.php
@@ -108,8 +108,9 @@ class Course_Forum_IndexController extends ForumController
 
             if ($this->constraint['depth'] == 0) {  // BEREICHE
                 $new_list = [];
+                $this->categories  = [];
                 // iterate over all categories and add the belonging areas to them
-                foreach ($categories = ForumCat::getListWithAreas($this->getId(), false) as $category) {
+                foreach (ForumCat::getListWithAreas($this->getId(), false) as $category) {
                     if ($category['topic_id']) {
                         $new_list[$category['category_id']][$category['topic_id']] = $list['list'][$category['topic_id']];
                         unset($list['list'][$category['topic_id']]);
@@ -237,10 +238,7 @@ class Course_Forum_IndexController extends ForumController
         $this->postings          = $list['list'];
         $this->number_of_entries = $list['count'];
         $this->show_full_path    = true;
-
-        if (empty($this->postings)) {
-            $this->no_entries = true;
-        }
+        $this->no_entries        = empty($this->postings);
 
         $this->render_action('index');
     }
@@ -270,10 +268,7 @@ class Course_Forum_IndexController extends ForumController
         $this->postings          = $list['list'];
         $this->number_of_entries = $list['count'];
         $this->show_full_path    = true;
-
-        if (empty($this->postings)) {
-            $this->no_entries = true;
-        }
+        $this->no_entries        = empty($this->postings);
 
         // exploit the visitdate for this view
         $this->visitdate = ForumVisit::getLastVisit($this->getId());
@@ -306,8 +301,8 @@ class Course_Forum_IndexController extends ForumController
 
         $this->section = 'search';
         $this->topic_id = $this->getId();
-        $this->show_full_path    = true;
-
+        $this->show_full_path = true;
+        $this->options = [];
         // parse filter-options
         foreach (['search_title', 'search_content', 'search_author'] as $option) {
             $this->options[$option] = Request::option($option);
@@ -417,7 +412,7 @@ class Course_Forum_IndexController extends ForumController
         // get the page of the posting to be able to jump there again
         $page = ForumEntry::getPostingPage($topic_id);
         URLHelper::addLinkParam('page', $page);
-
+        $parent = null;
         if (ForumPerm::hasEditPerms($topic_id) || ForumPerm::check('remove_entry', $this->getId(), $topic_id)) {
             $path = ForumEntry::getPathToPosting($topic_id);
             $topic  = array_pop($path);
diff --git a/app/controllers/course/gradebook/lecturers.php b/app/controllers/course/gradebook/lecturers.php
index b934badbd96c22cb0bdf740a890e3cfc3d8f0486..2e98856e7fc83cd00a5f5c6306e5289dff58dfca 100644
--- a/app/controllers/course/gradebook/lecturers.php
+++ b/app/controllers/course/gradebook/lecturers.php
@@ -147,9 +147,7 @@ class Course_Gradebook_LecturersController extends AuthenticatedController
         $course = \Context::get();
         $gradingDefinitions = Definition::findByCourse($course);
         $this->groupedDefinitions = $this->getGroupedDefinitions($gradingDefinitions);
-        $this->customDefinitions = isset($this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY])
-                                 ? $this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY]
-                                 : [];
+        $this->customDefinitions = $this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY] ?? [];
 
         $this->students = $course->getMembersWithStatus('autor', true)->orderBy('nachname, vorname');
         $this->groupedInstances = $this->groupedInstances($course);
@@ -196,9 +194,7 @@ class Course_Gradebook_LecturersController extends AuthenticatedController
         $course = \Context::get();
         $gradingDefinitions = Definition::findByCourse($course);
         $this->groupedDefinitions = $this->getGroupedDefinitions($gradingDefinitions);
-        $this->customDefinitions = isset($this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY])
-                                 ? $this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY]
-                                 : [];
+        $this->customDefinitions = $this->groupedDefinitions[Definition::CUSTOM_DEFINITIONS_CATEGORY] ?? [];
     }
 
     /**
diff --git a/app/controllers/course/gradebook/students.php b/app/controllers/course/gradebook/students.php
index 06c983d8bd6cb97ef5886c7110f5ccba0b292668..81a1f7fc9e0c0992970d0b734c61b7e5dc91cd4d 100644
--- a/app/controllers/course/gradebook/students.php
+++ b/app/controllers/course/gradebook/students.php
@@ -69,7 +69,7 @@ class Course_Gradebook_StudentsController extends AuthenticatedController
         $lines = [];
         foreach ($this->categories as $category) {
             foreach ($this->groupedDefinitions[$category] as $definition) {
-                $instance = isset($this->groupedInstances[$definition->id]) ? $this->groupedInstances[$definition->id] : null;
+                $instance = $this->groupedInstances[$definition->id] ?? null;
                 $lines[] = [
                     $category,
                     $definition->name,
diff --git a/app/controllers/course/lti.php b/app/controllers/course/lti.php
index 01c57ded24cf7dca2f34908f0ecad267ddaae4de..2183aae9d1cdfee9dc3c8014a8ada3d63c5847ce 100644
--- a/app/controllers/course/lti.php
+++ b/app/controllers/course/lti.php
@@ -291,7 +291,8 @@ class Course_LtiController extends StudipController
             $lti_data->description = Studip\Markup::purifyHtml(Studip\Markup::markAsHtml($item['text']));
             $lti_data->tool_id = $tool_id;
             $lti_data->launch_url = (string) $item['url'];
-
+            $custom_parameters = '';
+            $options = [];
             if (is_array($item['custom'])) {
                 foreach ($item['custom'] as $key => $value) {
                     $custom_parameters .= $key . '=' . $value . "\n";
diff --git a/app/controllers/course/studygroup.php b/app/controllers/course/studygroup.php
index db54b97d84c92d950469fbe97a2cdab2fae79b39..6e7120a73d3143c41ebaf50c866364f886551cda 100644
--- a/app/controllers/course/studygroup.php
+++ b/app/controllers/course/studygroup.php
@@ -891,11 +891,11 @@ class Course_StudygroupController extends AuthenticatedController
      * @return void
      */
     public function savemodules_action()
+
     {
-        global $perm;
-        $perm->check("root");
+        $GLOBALS['perm']->check('root');
         PageLayout::setHelpKeyword('Admin.Studiengruppen');
-
+        $errors = [];
         if (!Request::get('institute')) {
             $errors[] = _('Bitte wählen Sie eine Einrichtung aus, der die Studiengruppen zugeordnet werden sollen!');
         }
@@ -927,7 +927,6 @@ class Course_StudygroupController extends AuthenticatedController
         }
         $this->redirect('course/studygroup/globalmodules');
     }
-
     /**
      * globally deactivates the studygroups
      *
diff --git a/app/controllers/help_content.php b/app/controllers/help_content.php
index 5e8faf98473e217e59d6fbc22488303a82aed4c3..4162d85e2169e7efa08a0c6a3b98b12a3286f536 100644
--- a/app/controllers/help_content.php
+++ b/app/controllers/help_content.php
@@ -125,7 +125,7 @@ class HelpContentController extends AuthenticatedController
         }
         $this->parameters         = $parameters;
         $this->help_content_route = Request::get('help_content_route');
-
+        $this->help_content_id    = null;
         $this->render_template('help_content/edit');
     }
 
diff --git a/app/controllers/institute/basicdata.php b/app/controllers/institute/basicdata.php
index a265cfef9c1ed24a1f25b13451f39c2f623b54e9..2f13d9b15acaa6fcd0299e6cbcd25d4942615e0b 100644
--- a/app/controllers/institute/basicdata.php
+++ b/app/controllers/institute/basicdata.php
@@ -81,7 +81,7 @@ class Institute_BasicdataController extends AuthenticatedController
         }
 
         $lockrule = LockRules::getObjectRule($i_view);
-        if ($lockrule->description && LockRules::CheckLockRulePermission($i_view, $lockrule['permission'])) {
+        if ($lockrule && $lockrule->description && LockRules::CheckLockRulePermission($i_view, $lockrule['permission'])) {
             PageLayout::postInfo(formatLinks($lockrule->description));
         }
 
@@ -115,7 +115,7 @@ class Institute_BasicdataController extends AuthenticatedController
         // Read faculties if neccessary
         if (count($institute->sub_institutes) === 0) {
             if ($GLOBALS['perm']->have_perm('root')) {
-                $this->faculties = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name ASC', [$i_view]);
+                $this->faculties = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name ASC');
             } else {
                 $temp = User::find($GLOBALS['user']->id)
                             ->institute_memberships->findBy('inst_perms', 'admin')
@@ -127,7 +127,7 @@ class Institute_BasicdataController extends AuthenticatedController
                 $this->faculties = $faculties;
             }
         }
-
+        $reason_txt = '';
         // Indicates whether the current user is allowed to delete the institute
         $this->may_delete = $i_view !== 'new'
                          && !(count($institute->home_courses) || count($institute->sub_institutes))
diff --git a/app/controllers/institute/members.php b/app/controllers/institute/members.php
index 33d8eab38dca30c0e5e45993915a5fa685d35307..04199b39a57da316c76421409b2bc7c09adcd2c1 100644
--- a/app/controllers/institute/members.php
+++ b/app/controllers/institute/members.php
@@ -177,6 +177,10 @@ class Institute_MembersController extends AuthenticatedController
                 $this->display_tables[] = [
                     'members'     => $institut_members,
                     'dview'       => $dview,
+                    'mail_status' => false,
+                    'mail_gruppe' => false,
+                    'group'       => null,
+                    'key'         => null,
                     'th_title'    => _('keiner Funktion zugeordnet'),
                 ];
             }
@@ -201,6 +205,8 @@ class Institute_MembersController extends AuthenticatedController
                     'members'     => $institut_members,
                     'dview'       => $dview,
                     'mail_status' => true,
+                    'mail_gruppe' => false,
+                    'group'       => null,
                     'key'         => $key,
                     'th_title'    => $permission,
                 ];
@@ -227,6 +233,11 @@ class Institute_MembersController extends AuthenticatedController
             $this->display_tables[] = [
                 'members' => $institut_members,
                 'dview'   => $dview,
+                'mail_status' => false,
+                'group'       => null,
+                'mail_gruppe' => false,
+                'key'         => null,
+                'th_title'    => null,
             ];
         }
 
@@ -272,10 +283,11 @@ class Institute_MembersController extends AuthenticatedController
             // output
             $this->display_tables[] = [
                 'members'     => $institut_members,
+                'mail_status' => false,
                 'group'       => $group,
                 'th_title'    => $title,
                 'dview'       => $dview,
-
+                'key'         => null,
                 // StEP 154: Nachricht an alle Mitglieder der Gruppe
                 'mail_gruppe' => $GLOBALS['ENABLE_EMAIL_TO_STATUSGROUP']
                               && $GLOBALS['perm']->have_studip_perm('autor', $this->institute->id),
diff --git a/app/controllers/resources/admin.php b/app/controllers/resources/admin.php
index 94319113c937b6d703e24c4145b7d6fff94d59a8..393cacb377013a110b532a463ea520eaf5c314f3 100644
--- a/app/controllers/resources/admin.php
+++ b/app/controllers/resources/admin.php
@@ -119,7 +119,7 @@ class Resources_AdminController extends AuthenticatedController
         );
 
         $this->sidebar->addWidget($user_search);
-
+        $this->last_activity_date = null;
         $user_id    = Request::get('user_id');
         $this->user = User::find($user_id);
         if ($this->user) {
@@ -453,7 +453,7 @@ class Resources_AdminController extends AuthenticatedController
                 //At least one property is selected for moving into another
                 //property group.
                 foreach ($this->property_move as $property_id => $group_id) {
-                    $property = $property_object_cache[$property_id];
+                    $property = $property_object_cache[$property_id] ?? null;
                     if (!$property) {
                         $property = ResourcePropertyDefinition::find($property_id);
                     }
@@ -482,7 +482,7 @@ class Resources_AdminController extends AuthenticatedController
 
             if ($this->group_position) {
                 foreach ($this->group_position as $group_id => $position) {
-                    $group = $group_object_cache[$group_id];
+                    $group = $group_object_cache[$group_id] ?? null;
                     if (!$group) {
                         $group = ResourcePropertyGroup::find($group_id);
                     }
diff --git a/app/controllers/resources/category.php b/app/controllers/resources/category.php
index 76f55fdbca9089496d2d49f50511bdc6a12a6560..e5403859a7519ba0e1433ed8ade17fded00c6407 100644
--- a/app/controllers/resources/category.php
+++ b/app/controllers/resources/category.php
@@ -59,7 +59,7 @@ class Resources_CategoryController extends AuthenticatedController
             'TRUE ORDER BY name ASC'
         );
         //Load the properties:
-        if ($this->category->property_links) {
+        if (!empty($this->category->property_links)) {
             foreach ($this->category->property_links as $link) {
                 //We want to make sure that only properties that are
                 //defined are displayed.
diff --git a/app/controllers/tour.php b/app/controllers/tour.php
index a288ab27ba0475694e17f15a69c611454c8b4ed3..3ff6eaa4220decce0264448cb57067e506edaa48 100644
--- a/app/controllers/tour.php
+++ b/app/controllers/tour.php
@@ -279,7 +279,7 @@ class TourController extends AuthenticatedController
 
         PageLayout::setTitle(_('Hilfe-Tour importieren'));
 
-        if ($_FILES['tour_file']['tmp_name']) {
+        if (!empty($_FILES['tour_file']['tmp_name'])) {
             $tour_json_data = file_get_contents($_FILES['tour_file']['tmp_name']);
             $tour_data = @json_decode($tour_json_data, true);
             if (!$tour_data || !$tour_data['tour']) {
@@ -622,7 +622,7 @@ class TourController extends AuthenticatedController
         }
 
         $this->delete_question = '';
-
+        $this->tour_startpage = '';
         // initialize
         PageLayout::setTitle(_('Verwalten von Touren'));
         PageLayout::setHelpKeyword('Basis.TourAdmin');
diff --git a/app/views/admin/datafields/new.php b/app/views/admin/datafields/new.php
index 25d9a8a0a5da6393694dee40abc005cb704c554b..0c6f696f98506652ad1ee74c54fdfda94b2ef642 100644
--- a/app/views/admin/datafields/new.php
+++ b/app/views/admin/datafields/new.php
@@ -126,7 +126,7 @@ use Studip\Button, Studip\LinkButton;
                 <? foreach ($institutes as $institute): ?>
                     <option value="<?= htmlReady($institute['Institut_id']) ?>"
                         class="<?= $institute['is_fak'] ? 'nested-item-header' : 'nested-item' ?>"
-                            <?= $item->institut_id === $institute['Institut_id'] ? 'selected' : ''?>>
+                            <?= isset($item) && $item->institut_id === $institute['Institut_id'] ? 'selected' : ''?>>
                         <?= htmlReady(my_substr($institute['Name'],0,80)) ?>
                     </option>
                 <? endforeach; ?>
diff --git a/app/views/help_content/edit.php b/app/views/help_content/edit.php
index 2197ff1095f0459f3db1e40085f3274ff7c2deca..a237988300c2237180abac2eb201eaa6f02edc5b 100644
--- a/app/views/help_content/edit.php
+++ b/app/views/help_content/edit.php
@@ -22,7 +22,7 @@
             <span class="required"><?= _('Sprache des Textes') ?>:</span>
             <select name="help_content_language">
                 <? foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $key => $language) : ?>
-                    <option value="<?= mb_substr($key, 0, 2) ?>"<?= ($help_content->language == mb_substr($key, 0, 2)) ? ' selected' : '' ?>>
+                    <option value="<?= mb_substr($key, 0, 2) ?>"<?= (isset($help_content) && $help_content->language === mb_substr($key, 0, 2)) ? ' selected' : '' ?>>
                         <?= $language['name'] ?>
                     </option>
                 <? endforeach ?>
@@ -32,11 +32,11 @@
         <label for="help_content_content">
             <?= _('Hilfe-Text') ?>:
             <textarea cols="60" rows="5" name="help_content_content"
-                      placeholder="<?= _('Bitte geben Sie den Text ein') ?>"><?= htmlReady($help_content->content ?: '') ?></textarea>
+                      placeholder="<?= _('Bitte geben Sie den Text ein') ?>"><?= htmlReady($help_content->content ?? '') ?></textarea>
         </label>
         <label for="help_content_comment">
             <?= _('Bemerkung') ?>:
-            <textarea name="help_content_comment"><?= htmlReady($help_content->comment ?: '') ?></textarea>
+            <textarea name="help_content_comment"><?= htmlReady($help_content->comment ?? '') ?></textarea>
         </label>
     </fieldset>
 
diff --git a/app/views/institute/basicdata/index.php b/app/views/institute/basicdata/index.php
index c794997cb91c5d43fbafd0934470e0f0a3b91ad3..8e697c1e01143bbeec67e9f6273c702a3a2e7020 100644
--- a/app/views/institute/basicdata/index.php
+++ b/app/views/institute/basicdata/index.php
@@ -1,4 +1,4 @@
-<?= $question ?>
+<?= $question ?? '' ?>
 <form method="post" name="edit" action="<?= $controller->url_for('institute/basicdata/store/' . $i_view) ?>" class="default">
     <?= CSRFProtection::tokenTag() ?>
 
diff --git a/app/views/institute/members/_table_body.php b/app/views/institute/members/_table_body.php
index 2aa3704259ee94ec89eb33d9311a7fa64968adc4..5d2a9a327715387b643c103ccd7aeec2bf369c8f 100644
--- a/app/views/institute/members/_table_body.php
+++ b/app/views/institute/members/_table_body.php
@@ -16,7 +16,7 @@
                     'inst_id'         => Context::getId(),
                 ]),
                 sprintf(_('Nachricht an alle Mitglieder mit dem Status %s verschicken'), $th_title),
-                Icon::create('mail', 'clickable'),
+                Icon::create('mail'),
                 ['data-dialog' => '']
             )
             ->condition($mail_gruppe ?? false)
@@ -26,13 +26,14 @@
                     'default_subject' => Context::get()->Name,
                 ]),
                 sprintf(_('Nachricht an alle Mitglieder der Gruppe %s verschicken'), $th_title),
-                Icon::create('mail', 'clickable'),
+                Icon::create('mail'),
                 ['data-dialog' => '']
             ) ?>
         </th>
     <? endif; ?>
     </tr>
 <? endif; ?>
+<? $role_entries = [] ?>
 <? foreach ($members as $member):
         $default_entries = DataFieldEntry::getDataFieldEntries([$member->user_id, $institute->id]);
 
@@ -94,7 +95,7 @@
             ->addLink(
                 $controller->url_for("messages/write?rec_uname={$member->username}"),
                 _('Nachricht an Benutzer verschicken'),
-                Icon::create('mail', 'clickable'),
+                Icon::create('mail'),
                 ['data-dialog' => '']
             )
             ->conditionAll(
@@ -105,16 +106,16 @@
             )
             ->condition(isset($group))
             ->addLink(
-                $controller->url_for('institute/members/remove_from_group', $group->id, $type, ['username' => $member->username]),
+                $controller->url_for('institute/members/remove_from_group', (isset($group) ? $group->id : null), $type, ['username' => $member->username]),
                 _('Person aus Gruppe austragen'),
-                Icon::create('door-leave', 'clickable'),
+                Icon::create('door-leave'),
                 ['data-confirm' => _('Wollen Sie die Person wirklich aus der Gruppe austragen?')]
             )
             ->condition(!isset($group))
             ->addLink(
                 $controller->url_for('institute/members/remove_from_institute', $type, ['username' => $member->username]),
                 _('Person aus Einrichtung austragen'),
-                Icon::create('door-leave', 'clickable'),
+                Icon::create('door-leave'),
                 ['data-confirm' => _('Wollen Sie die Person wirklich aus der Einrichtung austragen?')]
             ) ?>
         </td>
@@ -158,12 +159,12 @@
                         'contentbox_open' => $group->id,
                     ]),
                     _('Gruppendaten bearbeiten'),
-                    Icon::create('edit', 'clickable')
+                    Icon::create('edit')
                 )
                 ->addLink(
                     $controller->url_for('institute/members/remove_from_group', $group->id, $type, ['username' => $member->username]),
                     _('Person aus Gruppe austragen'),
-                    Icon::create('door-leave', 'clickable'),
+                    Icon::create('door-leave'),
                     ['data-confirm' => _('Wollen Sie die Person wirklich aus der Gruppe austragen?')]
                 ) ?>
             </td>
diff --git a/app/views/institute/members/index.php b/app/views/institute/members/index.php
index 25cf0aad5c5dc99b61a7be7c748efcf82c9ace68..4c1678b2eb6becfba50c593329a85fdf17bda86f 100644
--- a/app/views/institute/members/index.php
+++ b/app/views/institute/members/index.php
@@ -2,10 +2,10 @@
     <table class="default" id="list_institute_members">
         <caption><?= _('Mitarbeiterinnen und Mitarbeiter') ?></caption>
         <colgroup>
-            <col width="32">
+            <col style="width: 32px">
         <? foreach ($structure as $key => $field): ?>
             <? if ($key !== 'statusgruppe'): ?>
-                <col <? if (!empty($field['width'])): ?> width="<?= htmlReady($field['width']) ?>"<? endif; ?>>
+                <col <? if (!empty($field['width'])): ?> style="width: <?= htmlReady($field['width']) ?>px"<? endif ?>>
             <? endif; ?>
         <? endforeach; ?>
         </colgroup>
diff --git a/app/views/multipersonsearch/js_form.php b/app/views/multipersonsearch/js_form.php
index 6c3ddfa68d98e0b03efa0306074d3d1862a98b9b..63c2eaabfb47e68136d0b9341c3fa5de40abeeb4 100644
--- a/app/views/multipersonsearch/js_form.php
+++ b/app/views/multipersonsearch/js_form.php
@@ -3,7 +3,7 @@
       data-secure="li.ms-selected:gt(0)">
     <fieldset>
         <legend>
-            <?= htmlReady($title) ?: _('Nach Personen suchen') ?>
+            <?= htmlReady($title ?? _('Nach Personen suchen')) ?>
         </legend>
 
         <label class="with-action">
diff --git a/app/views/tour/admin_details.php b/app/views/tour/admin_details.php
index 3fbde8b17070c185187da0eb0d2af6f5efe426a1..3bbd1fa856049c07f58fdd63612683646e54dbe0 100644
--- a/app/views/tour/admin_details.php
+++ b/app/views/tour/admin_details.php
@@ -63,16 +63,16 @@ use Studip\Button, Studip\LinkButton;
         <label>
             <?= _('Zugang zur Tour') ?>:
             <select name="tour_access">
-                <option value="link" <? if ($tour->settings->access === 'link') echo 'selected'; ?>>
+                <option value="link" <? if (isset($tour->settings) && $tour->settings->access === 'link') echo 'selected'; ?>>
                     <?= _('unsichtbar') ?>
                 </option>
-                <option value="standard" <? if ($tour->settings->access === 'standard') echo 'selected'; ?>>
+                <option value="standard" <? if (isset($tour->settings) && $tour->settings->access === 'standard') echo 'selected'; ?>>
                     <?= _('Anzeige im Hilfecenter') ?>
                 </option>
-                <option value="autostart" <? if ($tour->settings->access === 'autostart') echo 'selected'; ?>>
+                <option value="autostart" <? if (isset($tour->settings) && $tour->settings->access === 'autostart') echo 'selected'; ?>>
                     <?= _('Startet bei jedem Aufruf der Seite, bis die Tour abgeschlossen wurde') ?>
                 </option>
-                <option value="autostart_once" <? if ($tour->settings->access === 'autostart_once') echo 'selected'; ?>>
+                <option value="autostart_once" <? if (isset($tour->settings) && $tour->settings->access === 'autostart_once') echo 'selected'; ?>>
                     <?= _('Startet nur beim ersten Aufruf der Seite') ?>
                 </option>
             </select>
diff --git a/app/views/tour/import.php b/app/views/tour/import.php
index 1481cbc41e7e859c013d8cbd42d99426ccdeddc2..d913ca9dd28aa7551e7ca52f9dcd039dab8281ca 100644
--- a/app/views/tour/import.php
+++ b/app/views/tour/import.php
@@ -11,7 +11,7 @@
     <fieldset>
         <legend><?= _('Importieren') ?></legend>
 
-    <? if (!$tourdata) :  ?>
+    <? if (empty($tourdata)) :  ?>
         <label>
             <span class="required"><?= _('Datei:') ?></span>
             <input type="file" size="60" name="tour_file"
@@ -47,7 +47,7 @@
     </fieldset>
 
     <footer data-dialog-button>
-    <? if (!$tourdata) :  ?>
+    <? if (empty($tourdata)) :  ?>
         <?= Studip\Button::create(_('Importieren'), 'import_file', ['data-dialog' => 'size=auto;reload-on-close'])?>
     <? endif ?>
         <?= Studip\LinkButton::createCancel(_('Schließen'), $controller->url_for('tour/admin_overview')) ?>
diff --git a/lib/classes/ForumEntry.php b/lib/classes/ForumEntry.php
index 776b6b19d23eddee58ff699f61d898c2f9e8db62..61cbd75c181921bce9a863d47bb5353ce9701fc1 100644
--- a/lib/classes/ForumEntry.php
+++ b/lib/classes/ForumEntry.php
@@ -597,7 +597,7 @@ class ForumEntry  implements PrivacyObject
     public static function getList($type, $parent_id)
     {
         $start = (ForumHelpers::getPage() - 1) * ForumEntry::POSTINGS_PER_PAGE;
-
+        $last_visit_date = ForumVisit::getLastVisit($constraint['seminar_id']);
         switch ($type) {
             case 'area':
                 $list = ForumEntry::getEntries($parent_id, ForumEntry::WITHOUT_CHILDS, '', 'DESC', 0, 1000);
@@ -650,7 +650,7 @@ class ForumEntry  implements PrivacyObject
                 $stmt->bindParam(':seminar_id', $constraint['seminar_id']);
                 $stmt->bindParam(':left', $constraint['lft']);
                 $stmt->bindParam(':right', $constraint['rgt']);
-                $stmt->bindParam(':mkdate', ForumVisit::getLastVisit($constraint['seminar_id']));
+                $stmt->bindParam(':mkdate', $last_visit_date);
                 $stmt->bindParam(':user_id', $GLOBALS['user']->id);
                 $stmt->execute();
 
@@ -669,7 +669,7 @@ class ForumEntry  implements PrivacyObject
                 $stmt_count->bindParam(':seminar_id', $constraint['seminar_id']);
                 $stmt_count->bindParam(':left', $constraint['lft']);
                 $stmt_count->bindParam(':right', $constraint['rgt']);
-                $stmt_count->bindParam(':mkdate', ForumVisit::getLastVisit($constraint['seminar_id']));
+                $stmt_count->bindParam(':mkdate', $last_visit_date);
                 $stmt_count->execute();
 
 
diff --git a/lib/export/export_studipdata_func.inc.php b/lib/export/export_studipdata_func.inc.php
index bc2b9906e7db395fb2c7a3db29f69a71c6d9d7f4..179daf45fd47fa2068a23fd91c17c6c23b5bddd9 100644
--- a/lib/export/export_studipdata_func.inc.php
+++ b/lib/export/export_studipdata_func.inc.php
@@ -815,7 +815,7 @@ function export_pers($inst_id)
             if (mb_strtolower($key) == 'email') {
                 $row[$key] = get_visible_email($row['user_id']);
             }
-            if ($row[$key] != '') {
+            if (!empty($row[$key])) {
                 $data_object .= xml_tag($val, $row[$key]);
             }
         }
diff --git a/lib/models/CronjobSchedule.class.php b/lib/models/CronjobSchedule.class.php
index cac458e7cfa5926e63e8df4c336b49d7259888bd..028eed7b12ed63c5920498c663823c53524dea03 100644
--- a/lib/models/CronjobSchedule.class.php
+++ b/lib/models/CronjobSchedule.class.php
@@ -120,7 +120,7 @@ class CronjobSchedule extends SimpleORMap
      */
     public function getTitle()
     {
-        return $this->content['title'] ?: $this->task->name;
+        return $this->content['title'] ?: $this->task->name ?? '';
     }
 
     protected function cbJsonifyParameters($type)
diff --git a/lib/models/User.class.php b/lib/models/User.class.php
index 06a4eae7d11d2d4b7913736f460cf75bedfd8661..82709db4b4edd926ac33a87c740d029f4c18b007 100644
--- a/lib/models/User.class.php
+++ b/lib/models/User.class.php
@@ -742,6 +742,9 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if (Config::get()->VOTE_ENABLE) {
             $activeVotes  = Questionnaire::countBySQL("user_id = ? AND visible = '1'", [$this->id]);
             $stoppedVotes = Questionnaire::countBySQL("user_id = ? AND visible = '0'", [$this->id]);
+        } else {
+            $activeVotes = [];
+            $stoppedVotes = [];
         }
         // Evaluations
         $evalDB = new EvaluationDB();
@@ -764,7 +767,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'
             ];
         }
@@ -772,7 +775,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'
                 ];
             }
@@ -780,28 +783,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'
             ];
@@ -809,7 +812,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'
             ];
@@ -817,7 +820,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'
             ];
@@ -825,7 +828,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'
             ];
         }
@@ -839,14 +842,14 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($statement->fetchColumn() && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['studying'])) {
             $homepage_elements['studying'] = [
                 'name'       => _('Wo ich studiere'),
-                'visibility' => $homepage_visibility['studying'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['studying'] ?? get_default_homepage_visibility($this->id),
                 'identifier' => 'studdata'
             ];
         }
         if ($this->info->lebenslauf && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['lebenslauf'])) {
             $homepage_elements['lebenslauf'] = [
                 'name'       => _('Lebenslauf'),
-                'visibility' => $homepage_visibility['lebenslauf'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['lebenslauf'] ?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'privatedata'
             ];
@@ -854,14 +857,14 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($this->info->hobby && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['hobby'])) {
             $homepage_elements['hobby'] = [
                 'name'       => _('Hobbys'),
-                'visibility' => $homepage_visibility['hobby'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['hobby'] ?? get_default_homepage_visibility($this->id),
                 'identifier' => 'privatedata'
             ];
         }
         if ($this->info->publi && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['publi'])) {
             $homepage_elements['publi'] = [
                 'name'       => _('Publikationen'),
-                'visibility' => $homepage_visibility['publi'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['publi'] ?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'privatedata'
             ];
@@ -869,7 +872,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($this->info->schwerp && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['schwerp'])) {
             $homepage_elements['schwerp'] = [
                 'name'       => _('Arbeitsschwerpunkte'),
-                'visibility' => $homepage_visibility['schwerp'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['schwerp'] ?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'privatedata'
             ];
@@ -880,7 +883,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
                 if ($field->getValue() && $field->isEditable($this->perms) && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms][$key])) {
                     $homepage_elements[$key] = [
                         'name'       => $field->getName(),
-                        'visibility' => $homepage_visibility[$key] ?: get_default_homepage_visibility($this->id),
+                        'visibility' => $homepage_visibility[$key] ?? get_default_homepage_visibility($this->id),
                         'extern'     => true,
                         'identifier' => 'additionaldata'
                     ];
@@ -891,7 +894,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         foreach ($this->profile_categories as $category) {
             $homepage_elements['kat_' . $category->id] = [
                 'name'       => $category->name,
-                'visibility' => $homepage_visibility['kat_' . $category->id] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['kat_' . $category->id] ?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'owncategory'
             ];
diff --git a/lib/statusgruppe.inc.php b/lib/statusgruppe.inc.php
index 719cdce69500c8ac9010422d05e51b53c673fe6f..41a60b94540a299cfc69b9f42897fb3cc8e61e20 100644
--- a/lib/statusgruppe.inc.php
+++ b/lib/statusgruppe.inc.php
@@ -108,7 +108,9 @@ function GetRoleNames($roles, $level = 0, $pred = '', $all = false) {
 
     if (is_array($roles))
     foreach ($roles as $role_id => $role) {
-        if (!$role['name']) $role['name'] = $role['role']->getName();
+        if (empty($role['name'])) {
+            $role['name'] = $role['role']->getName();
+        }
 
         if ($pred != '') {
             $new_pred = $pred.' > '.$role['name'];
@@ -116,11 +118,11 @@ function GetRoleNames($roles, $level = 0, $pred = '', $all = false) {
             $new_pred = $role['name'];
         }
 
-        if ($role['user_there'] || $all) {
+        if (!empty($role['user_there']) || $all) {
             $out[$role_id] = $new_pred;
         }
 
-        if ($role['child']) {
+        if (!empty($role['child'])) {
             $out = array_merge((array)$out, (array)GetRoleNames($role['child'], $level+1, $new_pred, $all));
         }
     }
diff --git a/public/export.php b/public/export.php
index 9430a68bcbcc7de109ccf7adde642b1c1996fc8d..43a8491aa37103d6a832e576b22f69d6d97cffaa 100644
--- a/public/export.php
+++ b/public/export.php
@@ -70,7 +70,7 @@ if (Config::get()->EXPORT_ENABLE)
     $xslt_process_done = false;
     $start_done = false;
     $xml_output_done = false;
-
+    $xslt_choose_done = false;
     // Zurueckbutton benutzt?
     if (Request::submitted('back'))
     {