Skip to content

web: fix a couple of PHP warnings #6389

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 1 commit into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions html/user/forum_forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ function show_forum_threads($forum, $start, $sort_style, $user, $subs) {
$action = get_str('action', true);

if ($action == 'subscribe') {
$user = get_logged_in_user();
BoincSubscription::replace($user->id, -$id);
forum_page($forum, $user, 'You are now subscribed to this forum.');
} else if ($action == 'unsubscribe') {
$user = get_logged_in_user();
Comment on lines +275 to +279
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider retrieving the logged-in user once before the conditional rather than repeating get_logged_in_user() in both branches to reduce duplication.

Suggested change
$user = get_logged_in_user();
BoincSubscription::replace($user->id, -$id);
forum_page($forum, $user, 'You are now subscribed to this forum.');
} else if ($action == 'unsubscribe') {
$user = get_logged_in_user();
BoincSubscription::replace($user->id, -$id);
forum_page($forum, $user, 'You are now subscribed to this forum.');
} else if ($action == 'unsubscribe') {

Copilot uses AI. Check for mistakes.

BoincSubscription::delete($user->id, -$id);
forum_page($forum, $user, 'You are now unsubscribed from this forum.');
} else {
Expand Down
1 change: 1 addition & 0 deletions html/user/weak_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

// strip http://
//
$master_url = master_url();
$idx = strpos($master_url, '://');
if ($idx) {
$url = substr($master_url, $idx+strlen('://'));
Expand Down