From e1af76a74550bcdd55eb48b9a32f39f468a466cd Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Wed, 26 Oct 2022 10:32:43 +0000 Subject: fix for BIESt 1283, closes #1283 Closes #1283 Merge request studip/studip!1066 --- app/controllers/admin/install.php | 2 ++ app/controllers/course/members.php | 1 - app/controllers/messages.php | 6 ++--- app/controllers/oer/addfile.php | 2 +- app/controllers/resources/booking.php | 4 ++-- app/views/admin/install/layout.php | 4 ++-- app/views/admin/install/prepare.php | 10 ++++----- app/views/admin/install/root.php | 8 +++---- app/views/messages/overview.php | 10 ++++----- app/views/messages/write.php | 2 +- lib/classes/AutoInsert.class.php | 2 +- lib/classes/LinkButton.class.php | 2 +- .../Exceptions/InvalidAuthTokenException.php | 4 ++-- lib/classes/SystemChecker.php | 2 +- lib/classes/restapi/RouteMap.php | 6 ++--- lib/elearning/Ilias4ContentModule.class.php | 4 ++-- lib/models/CourseDate.class.php | 4 ++-- lib/models/Courseware/StructuralElement.php | 2 ++ lib/models/DatafieldEntryModel.class.php | 1 + lib/raumzeit/MetaDate.class.php | 2 +- lib/visual.inc.php | 2 +- phpstan-php8.neon.dist | 26 ++++++++++++++++++++++ tests/unit/lib/classes/RequestTest.php | 5 ----- 23 files changed, 68 insertions(+), 43 deletions(-) create mode 100644 phpstan-php8.neon.dist diff --git a/app/controllers/admin/install.php b/app/controllers/admin/install.php index 03c9511..e25c8d5 100644 --- a/app/controllers/admin/install.php +++ b/app/controllers/admin/install.php @@ -71,6 +71,8 @@ class Admin_InstallController extends Trails_Controller $this->valid = true; $this->hide_back_button = false; + + return true; } public function index_action() diff --git a/app/controllers/course/members.php b/app/controllers/course/members.php index c0c5075..09ed96c 100644 --- a/app/controllers/course/members.php +++ b/app/controllers/course/members.php @@ -755,7 +755,6 @@ class Course_MembersController extends AuthenticatedController /** * Change the visibilty of an autor - * @return Boolean */ public function change_visibility_action($cmd, $mode) { diff --git a/app/controllers/messages.php b/app/controllers/messages.php index d3d8985..c4fd07b 100644 --- a/app/controllers/messages.php +++ b/app/controllers/messages.php @@ -412,7 +412,7 @@ class MessagesController extends AuthenticatedController { ], 'MessageUser::build'); } - if (!$this->default_message->receivers->count() && is_array($_SESSION['sms_data']['p_rec'])) { + if (!$this->default_message->receivers->count() && !empty($_SESSION['sms_data']['p_rec'])) { $this->default_message->receivers = DBManager::get()->fetchAll("SELECT user_id,'rec' as snd_rec FROM auth_user_md5 WHERE username IN(?) ORDER BY Nachname,Vorname", [$_SESSION['sms_data']['p_rec']], 'MessageUser::build'); unset($_SESSION['sms_data']); } @@ -566,8 +566,8 @@ class MessagesController extends AuthenticatedController { $this->default_message['subject'] = Request::get("default_subject"); } $settings = UserConfig::get($GLOBALS['user']->id)->MESSAGING_SETTINGS; - $this->mailforwarding = Request::get('emailrequest') ? true : $settings['request_mail_forward']; - $this->show_adressees = Request::get('show_adressees') ? true : $settings['show_adressees'];; + $this->mailforwarding = Request::bool('emailrequest', $settings['request_mail_forward'] ?? false); + $this->show_adressees = Request::bool('show_adressees', $settings['show_adressees'] ?? false); if (Request::get('inst_id') || Request::get('course_id') || Request::option('group_id') || !Config::get()->SHOW_ADRESSEES_LIMIT) { $this->show_adressees = null; } diff --git a/app/controllers/oer/addfile.php b/app/controllers/oer/addfile.php index cc0364a..eb17341 100644 --- a/app/controllers/oer/addfile.php +++ b/app/controllers/oer/addfile.php @@ -67,7 +67,7 @@ class Oer_AddfileController extends AuthenticatedController //Load the folder by its ID. - $folder = new Folder($folder_id); + $folder = new Folder(); $folder_type = $folder->folder_type; //Check if the specified folder type is a FolderType implementation. if (is_a($folder_type, 'FolderType', true)) { diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php index 2889449..47ddd4c 100644 --- a/app/controllers/resources/booking.php +++ b/app/controllers/resources/booking.php @@ -95,8 +95,8 @@ class Resources_BookingController extends AuthenticatedController if ($this->booking->getAssignedUserType() === 'course') { $course = $this->booking->assigned_course_date->course; if ($course instanceof Course) { - $has_perms = $GLOBALS['perm']->have_studip_perm('user', $course->id, $user->id); - $vis_perms = $GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM, $user->id); + $has_perms = $GLOBALS['perm']->have_studip_perm('user', $course->id, $this->current_user->id); + $vis_perms = $GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM, $this->current_user->id); if ($has_perms || $vis_perms || $course->visible) { $this->user_may_see_course_data = true; } diff --git a/app/views/admin/install/layout.php b/app/views/admin/install/layout.php index 8a0f993..7f10064 100644 --- a/app/views/admin/install/layout.php +++ b/app/views/admin/install/layout.php @@ -21,7 +21,7 @@
- + @@ -47,7 +47,7 @@ - >'), 'continue') ?> + >'), 'continue') ?> 'visibility: hidden;']) ?> diff --git a/app/views/admin/install/prepare.php b/app/views/admin/install/prepare.php index 95e728d..9cf2694 100644 --- a/app/views/admin/install/prepare.php +++ b/app/views/admin/install/prepare.php @@ -32,7 +32,7 @@ + value="">
@@ -40,7 +40,7 @@
@@ -49,7 +49,7 @@ + value="">
@@ -57,7 +57,7 @@
@@ -66,7 +66,7 @@ diff --git a/app/views/admin/install/root.php b/app/views/admin/install/root.php index 46cffe4..332590b 100644 --- a/app/views/admin/install/root.php +++ b/app/views/admin/install/root.php @@ -8,7 +8,7 @@
+ value="">
@@ -24,18 +24,18 @@
+ value="">
+ value="">
- +

diff --git a/app/views/messages/overview.php b/app/views/messages/overview.php index cbbb922..6ece394 100644 --- a/app/views/messages/overview.php +++ b/app/views/messages/overview.php @@ -40,14 +40,14 @@ 0) : ?> - 0)) : ?> + 0)) : ?>

" href=" Request::int("offset") + $messageBufferCount]) ?>">asImg(["class" => "text-bottom"]) ?>
@@ -57,16 +57,16 @@ - render_partial("messages/_message_row.php", compact("message", "received")) ?> + render_partial('messages/_message_row.php', ['message' => $message, 'received' => $received, 'settings' => $settings]) ?> - 0)) : ?> + 0)) : ?>