Issues (1963)

html/user/delete_profile.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/boinc_db.inc");
20
require_once("../inc/util.inc");
21
require_once("../inc/profile.inc");
22
23
if (DISABLE_PROFILES) error_page("Profiles are disabled");
24
25
$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...
26
27
$cmd = get_str("cmd", true);
28
29
if ($cmd == "delete") {
30
    $result = delete_profile($user);
31
    if (!$result) {
32
        error_page(tra("couldn't delete profile - please try again later"));
33
    }
34
    delete_user_pictures($user->id);
35
    page_head(tra("Delete Confirmation"));
36
    $user->update("has_profile=0");
37
    echo tra("Your profile has been deleted.")."<br>";
38
    page_tail();
39
    exit();
40
}
41
42
page_head(tra("Profile delete confirmation"));
43
44
echo "
45
    <h2>".tra("Are you sure?")."</h2><p>
46
    ".tra("Deleted profiles are gone forever and cannot be recovered --
47
you will have to start from scratch
48
if you want another profile in the future.")."
49
    <p>
50
    ".tra("If you're sure, click 'Yes'
51
to remove your profile from our database.")."
52
    <p>
53
";
54
    show_button("delete_profile.php?cmd=delete", tra("Yes"), tra("Delete my profile"));
55
    show_button("index.php", tra("No"), tra("Do not delete my profile"));
56
page_tail();
57
58
?>
59