Issues (1964)

html/inc/stats_sites.inc (30 issues)

1
<?php
2
// This file is part of BOINC.
3
// http://boinc.berkeley.edu
4
// Copyright (C) 2023 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
// the following sites generate stats for a given CPID
20
//
21
global $cpid_stats_sites;
22
$cpid_stats_sites = array(
23
    array("Free-DC",
24
        "http://stats.free-dc.org/stats.php?page=userbycpid&amp;cpid=%s"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
25
    ),
26
    array("BOINCstats",
27
        "http://boincstats.com/en/stats/-1/user/detail/%s"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
28
    ),
29
    array("BOINC Combined Statistics",
30
        "http://boinc.netsoft-online.com/e107_plugins/boinc/get_user.php?cpid=%s&amp;html=1"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
31
    ),
32
);
33
34
$stats_sites = array(
35
    array(
36
        "http://www.formula-boinc.org/",
37
        "Formula BOINC",
38
        "(Team ranking based on position within projects,
39
        as in Formula 1 racing, rather than total points)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
40
    ),
41
    array(
42
        "http://stats.free-dc.org",
43
        "Free-DC",
44
        "(Includes non-BOINC projects and completed projects.)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
45
    ),
46
/* page shows: Could not connect to the data server. Unable to proceed.
47
 * not mentioning statistics on the webpage, seems retired
48
    array(
49
        "http://www.boincuk.com/globalprojectstats.php",
50
        "BOINC UK",
51
        ""
52
    ),
53
*/
54
    array("http://boinc.netsoft-online.com/",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
55
        "BOINC Combined Statistics",
56
        "developed by James Drews"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
57
    ),
58
    array("http://boincstats.com/",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
59
        "BOINCstats",
60
        "by Willy de Zutter"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
61
    ),
62
    array("http://www.dc-vault.com",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
63
        "DC-Vault",
64
        "(Include non-BOINC projects)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
65
    ),
66
    array("http://www.seti.nl/boinc_team.php",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
67
        "SETI@Netherlands stats page",
68
        ""
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
69
    ),
70
/* page shows: This website has been permanently closed
71
    array("http://www.teamocuk.co.uk/",
72
        "Team OcUK stats",
73
        ""
74
    ),
75
*/
76
    array("http://statsbzh.boinc-af.org/listteams.php",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
77
        "SETIBZH Stats",
78
        "(cross-project team stats; available in French, English, Spanish, German)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
79
    ),
80
);
81
82
$team_stats_sites = array(
83
    array("http://stats.czechnationalteam.cz/", "Czech National Team", "(in Czech)"),
84
    array("http://www.boincitaly.org/", "BOINC.Italy"),
85
    array("https://www.crunchersansfrontieres.org/", "CRUNCHERS SANS FRONTIERES", "(French"),
86
    //array("http://www.spacepage.be/component/option,com_boinc/", "Spacepage"),
87
    //array("http://boinc.radax.net/de_boinc.htm", "BOINC@Austria"),
88
    //array("http://www.myboinc.com/scores/", "L'Alliance Francophone"),
89
    //array("http://boincdenmark.dk/", "BOINC@Denmark", "(Danish)"),
90
    //array("http://boincdenmark.dk/default_en.html", "BOINC@Denmark", "(English)"),
91
    //array("http://www.bigbee.be/comp/boinc/index.php",
92
    //    "Boinc.be team stats",
93
    //    ""
94
    //),
95
    //array("http://www.seti-teamartbell.com/", "Team Art Bell", ""),
96
    array("http://www.crunchers-freiburg.de/", "crunchers@freiburg", "(German)"),
97
);
98
99
// The following sites generate signature images based on user CPID
100
//
101
$sig_sites = array(
102
    array(
103
        "http://www.boincuk.com/show3.php",
104
        "BOINC UK",
105
        "(Highly configurable!)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
106
    ),
107
    array("http://boinc.mundayweb.com/",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
108
        "http://boinc.mundayweb.com",
109
        "(User-configurable stats counters. Cool!)"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
110
    ),
111
    array("http://boincstats.com/page/faq.php#3",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
112
        "BOINCstats",
113
        "by Willy de Zutter"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
114
    ),
115
);
116
117
// the following sites generate cross-project team stats based on CPID
118
//
119
$team_name_sites = array(
120
    array("http://stats.free-dc.org/stats.php?page=teambycpid&team=",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
121
        "Free-DC",
122
        ""
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
123
    ),
124
    array("http://boincstats.com/en/stats/-1/team/detail/",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
125
        "BOINCstats.com",
126
        "hashlc"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
127
    ),
128
    array("http://statsbzh.boinc-af.org/team.php?teamcpid=",
0 ignored issues
show
The first value in a multi-value array must be on a new line
Loading history...
129
        "SETIBZH",
130
        "hashlc"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
131
    ),
132
);
133
134
global $host_sites;
135
$host_sites = array(
136
    array(
137
        "http://boincstats.com/en/stats/-1/host/detail/",
138
        "BOINCstats.com",
139
        "boincstats_icon.png"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
140
    ),
141
    array(
142
        "http://stats.free-dc.org/stats.php?page=hostbycpid&cpid=",
143
        "Free-DC",
144
        "freedc_icon.png"
0 ignored issues
show
There should be a trailing comma after the last value of an array declaration.
Loading history...
145
    ),
146
);
147
148
function site_list($sites) {
149
    echo "<ul>\n";
150
    for ($i=0; $i<count($sites); $i++) {
0 ignored issues
show
Coding Style Performance introduced by
The use of count() inside a loop condition is not allowed; assign the return value to a variable and use the variable in the loop condition instead
Loading history...
Performance Best Practice introduced by
It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.

If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration:

for ($i=0; $i<count($array); $i++) { // calls count() on each iteration
}

// Better
for ($i=0, $c=count($array); $i<$c; $i++) { // calls count() just once
}
Loading history...
151
        $s = $sites[$i];
152
        $url = $s[0];
153
        $name = $s[1];
154
        $comment = array_key_exists(2, $s)?$s[2]:"";
155
        echo "<li><a href=\"$url\">$name</a> $comment\n";
156
    }
157
    echo "</ul>\n";
158
}
159
160
$GLOBALS['cpid_stats_sites'] = $cpid_stats_sites;
161
$GLOBALS['host_sites'] = $host_sites;
162
163
?>
164