Skip to content
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

Eliminate some PHP warnings. #5443

Merged
merged 1 commit into from
Dec 5, 2023
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
1 change: 1 addition & 0 deletions html/inc/boinc_db.inc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class BoincDb extends DbConn {
}

class BoincUser {
public $prefs;
static $cache;
static function lookup($clause) {
$db = BoincDb::get();
Expand Down
32 changes: 22 additions & 10 deletions html/inc/prefs_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ class PREF_CONSENT extends PREF {
$this->tooltip_tr();
echo "<td class=\"text-right \">$this->desc</td>";
$consent_type_id = $this->consent_type_id;
$cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");
$cr = BoincLatestConsent::lookup(
"userid=$user->id AND consent_type_id='$consent_type_id'"
);
if ($cr) {
$this->show_value($user);
} else {
Expand All @@ -210,7 +212,9 @@ class PREF_CONSENT extends PREF {
$this->tooltip_tr();
echo "<td class=\"text-right \">$this->desc</td>";
$consent_type_id = $this->consent_type_id;
$cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");
$cr = BoincLatestConsent::lookup(
"userid=$user->id AND consent_type_id='$consent_type_id'"
);
if ($cr) {
$this->show_value($user);
} else {
Expand All @@ -228,7 +232,9 @@ class PREF_CONSENT extends PREF {

function show_value($user) {
$consent_type_id = $this->consent_type_id;
$cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");
$cr = BoincLatestConsent::lookup(
"userid=$user->id AND consent_type_id='$consent_type_id'"
);
if ($cr) {
$value = $cr->consent_flag;
} else {
Expand All @@ -238,7 +244,8 @@ class PREF_CONSENT extends PREF {
}
function show_form($user, $error) {
$consent_type_id = $this->consent_type_id;
$cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");
$cr = BoincLatestConsent::lookup(
"userid=$user->id AND consent_type_id='$consent_type_id'");
if ($cr) {
if ($this->invert) {
$checked = !$cr->consent_flag;
Expand All @@ -265,11 +272,14 @@ class PREF_CONSENT extends PREF {
// Check to see if latest consent of this name is already
// given, i.e., consent_flag set to "formget". If not, consent
// to this consent type.
$cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");

if ( (($cr) and ($cr->consent_flag!=$flag)) or
(!$cr) ) {
$rc = consent_to_a_policy($user, $consent_type_id, $flag, 0, 'Webform', time());
$cr = BoincLatestConsent::lookup(
"userid=$user->id AND consent_type_id='$consent_type_id$'"
);

if ((($cr) and ($cr->consent_flag!=$flag)) or (!$cr)) {
$rc = consent_to_a_policy(
$user, $consent_type_id, $flag, 0, 'Webform', time()
);
if (!$rc) {
error_page(tra("Database error:").BoincDb::error());
}
Expand All @@ -286,7 +296,9 @@ class PREF_CONSENT extends PREF {
function set_default(&$user) {
$consent_type_id = $this->consent_type_id;

$rc = consent_to_a_policy($user, $consent_type_id, $this->default, 0, 'Webform');
$rc = consent_to_a_policy(
$user, $consent_type_id, $this->default, 0, 'Webform'
);
if (!$rc) {
error_page(tra("Database error:").BoincDb::error());
}
Expand Down
8 changes: 5 additions & 3 deletions html/user/login_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
check_get_args(array("next_url"));

$next_url = get_str('next_url', true);
$next_url = urldecode($next_url);
$next_url = sanitize_local_url($next_url);
$next_url = urlencode($next_url);
if ($next_url) {
$next_url = urldecode($next_url);
$next_url = sanitize_local_url($next_url);
$next_url = urlencode($next_url);
}

$user = get_logged_in_user(false);
if ($user) {
Expand Down
1 change: 1 addition & 0 deletions html/user/notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function notices_rss_end() {

$notifies = BoincNotify::enum("userid = $userid $since_clause");

$threads = [];
$forum = news_forum();
if ($forum) {
$threads = BoincThread::enum(
Expand Down
Loading