|
1
|
|
|
<?php |
|
2
|
|
|
// This file is part of BOINC. |
|
3
|
|
|
// http://boinc.berkeley.edu |
|
4
|
|
|
// Copyright (C) 2014 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/profile.inc"); |
|
22
|
|
|
require_once("../inc/uotd.inc"); |
|
23
|
|
|
|
|
24
|
|
|
if (DISABLE_PROFILES) error_page("Profiles are disabled"); |
|
25
|
|
|
|
|
26
|
|
|
check_get_args(array("cmd", "pic")); |
|
27
|
|
|
|
|
28
|
|
|
$option = get_str('cmd', true); |
|
29
|
|
|
if ($option) { |
|
30
|
|
|
select_profile($option); |
|
31
|
|
|
exit(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
page_head(tra("Profiles")); |
|
35
|
|
|
|
|
36
|
|
|
echo " |
|
37
|
|
|
<p>".tra("%1 Profiles %2 let individuals share backgrounds and opinions with the %3 community.", "<b>", "</b>", PROJECT)." ". |
|
38
|
|
|
tra("Explore the diversity of your fellow volunteers, and contribute your own views for others to enjoy.")." |
|
39
|
|
|
<p>".tra("If you haven't already, you can %1 create your own user profile %2 for others to see!", "<a href=\"create_profile.php\">", "</a>"); |
|
40
|
|
|
|
|
41
|
|
|
start_table(); |
|
42
|
|
|
|
|
43
|
|
|
$today = getdate(time()); |
|
44
|
|
|
$UOTD_heading = tra("User of the Day")." -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year']; |
|
45
|
|
|
row1($UOTD_heading); |
|
46
|
|
|
echo "<tr><td>"; |
|
47
|
|
|
$profile = get_current_uotd(); |
|
48
|
|
|
if ($profile) { |
|
49
|
|
|
$user = BoincUser::lookup_id($profile->userid); |
|
50
|
|
|
echo uotd_thumbnail($profile, $user); |
|
51
|
|
|
echo user_links($user, BADGE_HEIGHT_MEDIUM)."<br>"; |
|
52
|
|
|
$resp = output_transform($profile->response1); |
|
53
|
|
|
$resp = sanitize_tags($resp); |
|
54
|
|
|
echo sub_sentence($resp, ' ', 150, true); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
echo "</td></tr>"; |
|
58
|
|
|
|
|
59
|
|
|
row1(tra("User Profile Explorer")); |
|
60
|
|
|
echo "<tr><td> |
|
61
|
|
|
<ul> |
|
62
|
|
|
<li>".tra("View the %1 User Picture Gallery %2.", "<a href=\"" . url_base() . "user_profile/user_gallery_1.html\">", "</a>")."</li> |
|
63
|
|
|
<li>".tra("Browse profiles %1 by country %2.", "<a href=\"" . url_base() . "user_profile/profile_country.html\">", "</a>")."</li> |
|
64
|
|
|
<li>".tra("Browse profiles %1 at random %2, %3 at random with pictures %2, or %4 at random without pictures %2.", "<a href=\"?cmd=rand&pic=-1\">", "</a>", |
|
65
|
|
|
"<a href=\"?cmd=rand&pic=1\">", "<a href=\"?cmd=rand&pic=0\">")."</li> |
|
66
|
|
|
"; |
|
67
|
|
|
if (file_exists(PROFILE_PATH . "profile_alpha.html")) { |
|
68
|
|
|
echo "<li>".tra("Alphabetical profile listings:")."<br>"; |
|
69
|
|
|
|
|
70
|
|
|
include( PROFILE_PATH . "profile_alpha.html" ); |
|
71
|
|
|
} |
|
72
|
|
|
echo "</ul></td></tr>"; |
|
73
|
|
|
|
|
74
|
|
|
row1(tra("Search profile text")); |
|
75
|
|
|
rowify( |
|
76
|
|
|
sprintf( |
|
77
|
|
|
'<form action="profile_search_action.php" method="GET"> |
|
78
|
|
|
<input type="text" name="search_string"> |
|
79
|
|
|
<input class="btn btn-sm" %s type="submit" value="%s"> |
|
80
|
|
|
</form>', |
|
81
|
|
|
button_style(), |
|
82
|
|
|
tra("Search") |
|
83
|
|
|
) |
|
84
|
|
|
); |
|
85
|
|
|
end_table(); |
|
86
|
|
|
|
|
87
|
|
|
page_tail(); |
|
88
|
|
|
|
|
89
|
|
|
function select_profile($cmd) { |
|
90
|
|
|
// Request for a random profile. |
|
91
|
|
|
// |
|
92
|
|
|
if ($cmd == "rand") { |
|
93
|
|
|
$profiles = array(); |
|
94
|
|
|
$pic = get_int('pic'); |
|
95
|
|
|
if ($pic == 0) { |
|
96
|
|
|
$profiles = BoincProfile::enum("has_picture=0", "limit 1000"); |
|
97
|
|
|
} else if ($pic == 1) { |
|
98
|
|
|
$profiles = BoincProfile::enum("has_picture=1", "limit 1000"); |
|
99
|
|
|
} else if ($pic == -1) { |
|
100
|
|
|
$profiles = BoincProfile::enum(null, "limit 1000"); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
if (count($profiles) == 0) { |
|
104
|
|
|
page_head(tra("No profiles")); |
|
105
|
|
|
echo tra("No profiles matched your query."); |
|
106
|
|
|
page_tail(); |
|
107
|
|
|
exit(); |
|
|
|
|
|
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
shuffle($profiles); |
|
111
|
|
|
$userid = $profiles[0]->userid; |
|
112
|
|
|
header("Location: ".url_base()."view_profile.php?userid=$userid"); |
|
113
|
|
|
exit(); |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
?> |
|
118
|
|
|
|
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.