Issues (1963)

html/user/prefs.php (1 issue)

Labels
Severity
1
<?php
2
// This file is part of BOINC.
3
// http://boinc.berkeley.edu
4
// Copyright (C) 2008 University of California
5
//
6
// BOINC is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License
8
// as published by the Free Software Foundation,
9
// either version 3 of the License, or (at your option) any later version.
10
//
11
// BOINC is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
// See the GNU Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19
require_once("../inc/util.inc");
20
require_once("../inc/prefs.inc");
21
require_once("../inc/prefs_project.inc");
22
23
$user = get_logged_in_user();
0 ignored issues
show
Are you sure the assignment to $user is correct as get_logged_in_user() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
25
$subset = get_str("subset", true);
26
if (!$subset) {
27
    $subset = "global";
28
}
29
$columns = get_int("cols", true);
30
$updated = get_int("updated", true);
31
$defaults = get_int("defaults", true);
32
33
page_head(tra("%1 preferences", subset_name($subset)));
34
if (isset($updated)) {
35
    echo "<p style='color: red'>
36
        ".tra("Your preferences have been updated, and
37
          will take effect when your computer communicates with %1
38
          or you issue the %2 Update %3 command from the BOINC Manager.",
39
          PROJECT, "<strong>", "</strong>")."
40
        </p>
41
    ";
42
}
43
if (isset($defaults)) {
44
    echo "<p style='color: red'>
45
        ".tra("Your preferences have been reset to the defaults, and
46
          will take effect when your computer communicates with %1
47
          or you issue the %2 Update %3 command from the BOINC Manager.",
48
          PROJECT, "<strong>", "</strong>")."
49
        </p>
50
    ";
51
}
52
if ($subset == "global") {
53
    print_prefs_display_global($user, $columns);
54
    if (!$defaults) {
55
        echo "<p>";
56
        show_button(
57
            "prefs_default.php",
58
            "Restore defaults",
59
            "Restore default preferences",
60
            "btn-warning btn-sm"
61
        );
62
    }
63
} else {
64
    print_prefs_display_project($user, $columns);
65
}
66
67
page_tail();
68
69
?>
70