-
Notifications
You must be signed in to change notification settings - Fork 12
rewrite PI search functionality #538
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
54420d2
add cache for pi_search.php using $_SESSION
simonLeary42 afcee25
remove newline
simonLeary42 798dd1d
remove unused variable
simonLeary42 7ae58bd
add comment
simonLeary42 9c2decd
remove empty()
simonLeary42 8af1966
use variable
simonLeary42 c4c35c3
style
simonLeary42 d4bf158
don't need to give html element an ID
simonLeary42 323e968
no results
simonLeary42 1960fb9
style
simonLeary42 a24990f
add comment
simonLeary42 b9d04b2
no closure, remove newlines
simonLeary42 a5b38ac
remove (request by owner mail) feature
simonLeary42 3037575
tweak strtolowers
simonLeary42 9b0592f
const
simonLeary42 c50860a
improve ajax error handling
simonLeary42 821dac8
update placeholder text
simonLeary42 d58210b
improve behavior when session cache missing
simonLeary42 c47d6aa
cleanup cache from session
simonLeary42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
|
|
||
| require_once __DIR__ . "/../../../resources/autoload.php"; // Load required libs | ||
| use UnityWebPortal\lib\UnityHTTPD; | ||
|
|
||
| $search_query = strtolower(UnityHTTPD::getQueryParameter("search")); | ||
| if ($search_query === "") { | ||
| echo "[]"; | ||
| UnityHTTPD::die(); | ||
| } | ||
| if (!array_key_exists("pi_group_gid_to_owner_gecos_and_mail", $_SESSION)) { | ||
| UnityHTTPD::internalServerError( | ||
| '$_SESSION["pi_group_gid_to_owner_gecos_and_mail"] does not exist!', | ||
| "Session cache not found. Try reloading the page." | ||
| ); | ||
| } | ||
| $pi_group_gid_to_owner_gecos_and_mail = $_SESSION["pi_group_gid_to_owner_gecos_and_mail"]; | ||
| $output = []; | ||
| foreach ($pi_group_gid_to_owner_gecos_and_mail as $gid => [$gecos, $mail]) { | ||
| $gid = strtolower($gid); | ||
| $gecos = strtolower($gecos); | ||
| $mail = strtolower($mail); | ||
| if (str_contains($gid, $search_query) || str_contains($gecos, $search_query) || str_contains($mail, $search_query)) { | ||
| array_push($output, $gid); | ||
| if (count($output) >= 10) { | ||
simonLeary42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
| echo jsonEncode($output); | ||
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
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
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.