fully commit to getPostData, getQueryParameter#429
Draft
simonLeary42 wants to merge 7 commits intomainfrom
Draft
fully commit to getPostData, getQueryParameter#429simonLeary42 wants to merge 7 commits intomainfrom
simonLeary42 wants to merge 7 commits intomainfrom
Conversation
c48efb5 to
a4dcdec
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors direct $_POST and $_GET array access to use wrapper methods from the UnityHTTPD class. The change improves type safety and error handling by centralizing validation logic.
- Removes the boolean
$die_if_not_foundparameter fromgetQueryParameter()and creates separategetOptional*methods - Adds new
getOptionalPostData()andgetOptionalQueryParameter()methods for optional parameters - Systematically replaces direct array access with wrapper methods across multiple files
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/lib/UnityHTTPD.php | Adds getOptionalPostData() and getOptionalQueryParameter() methods; modifies getQueryParameter() signature to remove optional parameter |
| webroot/panel/pi.php | Replaces direct $_POST access with getPostData() for form handling |
| webroot/panel/groups.php | Replaces direct $_POST access with getPostData() for form type and TOS validation |
| webroot/panel/account.php | Replaces direct $_POST access with getPostData() for shell selection and TOS validation |
| webroot/admin/user-mgmt.php | Replaces direct $_POST access with getPostData() for user management forms |
| webroot/admin/pi-mgmt.php | Adds $getPIGroupFromPost helper function and replaces direct $_POST access throughout |
| webroot/admin/notices.php | Replaces direct $_POST access with getPostData() for notice management operations |
| webroot/admin/content.php | Replaces direct $_POST access with getPostData() for page editing |
| resources/templates/header.php | Uses getOptionalPostData() for conditional form type checking |
| webroot/js/ajax/ssh_generate.php | Uses getOptionalQueryParameter() for optional query parameter |
| webroot/api/content/index.php | Uses getOptionalQueryParameter() with null coalescing operator for line wrap parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
74b712e to
85fec6e
Compare
Member
Author
|
Closes #176 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
85fec6e to
8e05379
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #427.
This PR is at odds with #430. Marked as draft until one is chosen over the other.
It also splits off the
$die_if_key_not_existsfunctionality fromgetQueryParameterinto a separate functiongetOptionalQueryParameter, and adds thegetOptionalPostDatafunction.I'm unsure about this because it's ugly and not actually necessary thanks to our error handler.