Skip to content

Commit

Permalink
Merge pull request #5443 from BOINC/dpa_web10
Browse files Browse the repository at this point in the history
Eliminate some PHP warnings.
  • Loading branch information
AenBleidd authored Dec 5, 2023
2 parents de19de5 + b2b58f1 commit 836a138
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
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

0 comments on commit 836a138

Please sign in to comment.