Issues (1964)

html/user/language_select.php (3 issues)

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
20
require_once("../inc/util.inc");
21
require_once("../inc/translation.inc");
22
require_once("../inc/language_names.inc");
23
24
$languages = get_supported_languages();
0 ignored issues
show
Are you sure the assignment to $languages is correct as get_supported_languages() 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...
25
if (!is_array($languages)) {
26
    error_page("Language selection not enabled.  Project admins must run the update_translations.php script.");
27
}
28
29
$prefs = "";
30
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
31
    $prefs = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
32
    $prefs = sanitize_tags($prefs);
33
}
34
35
$set_lang = get_str("set_lang", true);
36
if ($set_lang){
37
    if (!in_array($set_lang, $languages) && $set_lang!="auto"){
38
        error_page("Language not supported");
39
    } else {
40
        send_cookie('lang', $set_lang, true);
41
        header("Location: index.php");
42
        exit;
43
    }
44
}
45
46
page_head(tra("Language selection"));
47
48
if (count($languages_in_use)) {
49
    $lang_code = $languages_in_use[0];
50
} else {
51
    $lang_code = 'en';
52
}
53
$cur_lang_desc = language_desc($lang_code);
54
55
echo "<p>",
56
    tra(
57
        "This web site is available in several languages. The currently selected language is %1.",
58
        $cur_lang_desc
59
    ),
60
    "</p><p>",
61
    tra(
62
        "Normally the choice of language is determined by your browser's language setting, which is: %1.  You can change this setting using:",
63
        "<b>$prefs</b>"
64
    ),
65
    "</p><ul>",
66
    "<li>",
67
    tra("Firefox: Tools/Options/General"),
68
    "<li>",
69
    tra("Microsoft IE: Tools/Internet Options/Languages"),
70
    "</ul>",
71
    "<p>",
72
    tra(
73
        "Or you can select a language from the following menu:"
74
    ),
75
    "</p>"
76
;
0 ignored issues
show
Space found before semicolon; expected ""</p>";" but found ""</p>"
;"
Loading history...
77
78
echo '<div class="col-sm-3">
79
';
80
language_form($lang_code);
81
echo '</div>
82
';
83
84
echo "<br clear=all><p> </p>",
85
    tra("Translations are done by volunteers.  If your native language is missing or incomplete, %1 you can help translate %2.",
86
    '<a href="https://github.com/BOINC/boinc/wiki/TranslateIntro">', '</a>'),
87
    "</p>"
88
;
0 ignored issues
show
Space found before semicolon; expected ""</p>";" but found ""</p>"
;"
Loading history...
89
page_tail();
90
?>
91