-
Notifications
You must be signed in to change notification settings - Fork 11
fully commit to getPostData, getQueryParameter #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b53f82c to
c48efb5
Compare
c48efb5 to
a4dcdec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Co-authored-by: Copilot <[email protected]>
This PR is at odds with #430.
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.