forked from davidpanderson/science_united
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
195 lines (180 loc) · 5.9 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// SU home page; also can be used for AMs based on SU source code
require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/news.inc");
require_once("../inc/cache.inc");
require_once("../inc/uotd.inc");
require_once("../inc/sanitize_html.inc");
require_once("../inc/text_transform.inc");
require_once("../project/project.inc");
require_once("../inc/bootstrap.inc");
require_once("../inc/su_user.inc");
require_once("../inc/su_graph.inc");
//$stopped = web_stopped();
$stopped = false;
$user = get_logged_in_user(false);
// shown only when site is down
//
function closed_panel() {
global $master_url;
echo '
<p class="lead text-center">'
.tra("%1 is temporarily shut down for maintenance.", PROJECT)
.'</p>
';
}
function user_summary($user) {
show_download($user);
echo "<h3>".tra("Recent contribution")."</h3>\n";
show_user_graph($user, "ec", 30);
show_calls_to_action();
echo sprintf('<center><a href=%ssu_home.php class="btn btn-success">%s</a></center>
',
URL_BASE,
tra('Continue to your home page')
);
}
function intro_panel() {
panel(null,
function() {
echo "<p>";
echo tra("%1 lets you help scientific research projects by giving them computing power. These projects do research in astronomy, physics, biomedicine, mathematics, and environmental science; you can pick the areas you want to support.", "<b>".PROJECT."</b>");
echo "<p>";
echo tra("You help by installing BOINC, a free program that runs scientific jobs in the background and when you're not using the computer. BOINC is secure and will not affect your normal use of the computer.");
echo "<p>";
if (PROJECT == 'Science United') {
echo tra(
"%1 is operated by the BOINC project at UC Berkeley.",
PROJECT
);
echo " ";
echo tra(
"%1 and the research projects it supports are non-profit.",
PROJECT
);
}
echo "<br><br>\n";
echo sprintf('<center><a href="%ssu_join.php" class="btn btn-success"><font size=+2>%s</font></a></center>
',
URL_BASE,
tra('Join %1', PROJECT)
);
echo sprintf('<br><br>%s <a href=%slogin_form.php>%s</a>',
tra("Already joined?"),
URL_BASE,
tra("Log in.")
);
if (PROJECT == 'Science United') {
echo "<p><p>BOINC user? <a href=intro.php>Read this</a>.\n";
}
}
);
}
function user_panel(){
global $user, $master_url;
panel(
tra("Welcome, %1", $user->name),
function() use($user) {
user_summary($user);
},
"panel-primary"
);
if (!DISABLE_PROFILES) {
$profile = get_current_uotd();
if ($profile) {
panel('User of the Day',
function() use ($profile) {
show_uotd($profile);
}
);
}
}
}
function news_panel() {
panel(tra('News'),
function() {
include("motd.php");
if (!web_stopped()) {
show_news(0, 5);
}
},
"panel-primary"
);
}
function slide_show() {
$pics = array(
"virus.jpg"=>tra("Ebola-Infected VERO E6 Cell"),
"higgs.jpg"=>tra("Simulation of Higgs boson detection"),
"earth.jpg"=>tra("The Earth's interrelated climate systems"),
"protein.png"=>tra("Structure of protein GIF"),
"hubble.jpg"=>tra("The Hubble ultra-deep field image"),
);
echo '<div class="carousel slide" data-interval="4000" data-ride="carousel">
<div class="carousel-inner">
';
$c = "item active";
foreach ($pics as $pic=>$caption) {
echo sprintf('
<div class="%s">
<img class="d-block img-fluid" width=400 src="pictures/%s">
<div class="carousel-caption">%s</div>
</div>
', $c, $pic, $caption
);
$c = "item";
}
echo '</div></div>
';
}
page_head(PROJECT, null, true);
if ($stopped) {
grid('closed_panel', function(){}, function(){});
} else {
if ($user) {
grid(null, 'user_panel', 'news_panel');
} else {
grid(null, 'intro_panel', 'slide_show');
}
}
if (PROJECT == 'Science United') {
echo "
<p>
<table width=100%>
<tr>
<td width=30%></td>
<td valign=top>
<center>
<nobr><img src=pictures/NSF_4-Color_bitmap_Logo.png height=120> <img src=ucbseal.png height=100></nobr>
<br><small>
";
echo tra("Science United is funded by the %1National Science Foundation%2, award #1664190, and is based at the %3University of California, Berkeley%4.",
"<a href=https://nsf.gov>", "</a>",
"<a href=https://berkeley.edu>", "</a>"
);
echo "
Image credits: CERN and NIAID.
</small></center>
</td>
<td width=30%></td>
</tr></table>
";
}
page_tail(false, "", true);
?>