authInfo->getPerms('user')->check(Perm::U_NOTES_MANAGE)) Template::throwError(403); $filterUser = null; if(filter_has_var(INPUT_GET, 'u')) { $filterUserId = filter_input(INPUT_GET, 'u', FILTER_SANITIZE_NUMBER_INT); try { $filterUser = $msz->usersCtx->getUserInfo($filterUserId); } catch(RuntimeException $ex) { Template::throwError(404); } } $pagination = Pagination::fromInput($msz->usersCtx->modNotes->countNotes(userInfo: $filterUser), 10); if(!$pagination->validOffset) Template::throwError(404); $notes = []; $noteInfos = $msz->usersCtx->modNotes->getNotes(userInfo: $filterUser, pagination: $pagination); foreach($noteInfos as $noteInfo) { $userInfo = $msz->usersCtx->getUserInfo($noteInfo->userId); $userColour = $msz->usersCtx->getUserColour($userInfo); if($noteInfo->authorId === null) { $authorInfo = null; $authorColour = null; } else { $authorInfo = $msz->usersCtx->getUserInfo($noteInfo->authorId); $authorColour = $msz->usersCtx->getUserColour($authorInfo); } $notes[] = [ 'info' => $noteInfo, 'user' => $userInfo, 'user_colour' => $userColour, 'author' => $authorInfo, 'author_colour' => $authorColour, ]; } Template::render('manage.users.notes', [ 'manage_notes' => $notes, 'manage_notes_pagination' => $pagination, 'manage_notes_filter_user' => $filterUser, ]);