mirror of https://github.com/BOINC/boinc.git
web: fix PHP warnings, and a small bug in forum search
This commit is contained in:
parent
24e46aebe2
commit
e12280909f
|
@ -1276,4 +1276,17 @@ function remove_subscriptions_thread($userid, $threadid) {
|
|||
BoincNotify::delete_aux("userid=$userid and type=".NOTIFY_SUBSCRIBED_POST." and opaque=$threadid");
|
||||
}
|
||||
|
||||
function parse_forum_cookie() {
|
||||
$x = array("", "");
|
||||
if (isset($_COOKIE['sorting'])) {
|
||||
$a = explode("|", $_COOKIE['sorting']);
|
||||
if (array_key_exists(0, $a)) {
|
||||
$x[0] = $a[0];
|
||||
}
|
||||
if (array_key_exists(1, $a)) {
|
||||
$x[1] = $a[1];
|
||||
}
|
||||
}
|
||||
return $x;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -28,6 +28,13 @@ require_once("../inc/time.inc");
|
|||
require_once("../inc/stats_sites.inc");
|
||||
|
||||
function team_search_form($params) {
|
||||
if (!$params) {
|
||||
$params = new StdClass;
|
||||
$params->keywords = "";
|
||||
$params->country = "";
|
||||
$params->type = "";
|
||||
$params->active = false;
|
||||
}
|
||||
echo '<form name="form" action="team_search.php">';
|
||||
start_table();
|
||||
row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
|
||||
|
|
|
@ -110,22 +110,23 @@ function cmp($a, $b) {
|
|||
}
|
||||
|
||||
function show_other_projects($user, $personal) {
|
||||
if (count($user->projects) > 1) {
|
||||
usort($user->projects, "cmp");
|
||||
if ($personal) {
|
||||
echo "<h2>".tra("Projects in which you are participating")."</h2>";
|
||||
} else {
|
||||
echo "<h2>".tra("Projects in which %1 is participating", $user->name)."</h2>";
|
||||
}
|
||||
start_table();
|
||||
row_heading_array(array(
|
||||
tra("Project")."<br/><span class=\"note\">".tra("Click for user page")."</span>", tra("Total credit"), tra("Average credit"), tra("Since")
|
||||
));
|
||||
foreach($user->projects as $project) {
|
||||
show_project($project);
|
||||
}
|
||||
end_table();
|
||||
if (!isset($user->projects)) return;
|
||||
if (count($user->projects) < 2) return;
|
||||
|
||||
usort($user->projects, "cmp");
|
||||
if ($personal) {
|
||||
echo "<h2>".tra("Projects in which you are participating")."</h2>";
|
||||
} else {
|
||||
echo "<h2>".tra("Projects in which %1 is participating", $user->name)."</h2>";
|
||||
}
|
||||
start_table();
|
||||
row_heading_array(array(
|
||||
tra("Project")."<br/><span class=\"note\">".tra("Click for user page")."</span>", tra("Total credit"), tra("Average credit"), tra("Since")
|
||||
));
|
||||
foreach($user->projects as $project) {
|
||||
show_project($project);
|
||||
}
|
||||
end_table();
|
||||
}
|
||||
|
||||
function total_posts($user) {
|
||||
|
|
|
@ -48,9 +48,7 @@ if (!$sort_style) {
|
|||
if ($user){
|
||||
$sort_style = $user->prefs->forum_sorting;
|
||||
} else {
|
||||
if (isset($_COOKIE['sorting'])) {
|
||||
list($sort_style,$thread_style)=explode("|",$_COOKIE['sorting']);
|
||||
}
|
||||
list($sort_style, $thread_style) = parse_forum_cookie();
|
||||
}
|
||||
} else {
|
||||
// set the sort style
|
||||
|
@ -58,8 +56,10 @@ if (!$sort_style) {
|
|||
$user->prefs->forum_sorting = $sort_style;
|
||||
$user->prefs->update("forum_sorting=$sort_style");
|
||||
} else {
|
||||
list($old_style,$thread_style)=explode("|",$_COOKIE['sorting']);
|
||||
send_cookie('sorting', implode("|",array($sort_style,$thread_style)), true);
|
||||
list($old_style, $thread_style) = parse_forum_cookie();
|
||||
send_cookie(
|
||||
'sorting', implode("|", array($sort_style, $thread_style)), true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ if (count($posts)){
|
|||
end_table();
|
||||
}
|
||||
|
||||
if (!count($thread) && !count($posts)){
|
||||
if (!count($threads) && !count($posts)){
|
||||
echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
|
||||
<p>"
|
||||
.tra("You can also %1try the same search on Google.%2",
|
||||
|
|
|
@ -78,8 +78,8 @@ if ($temp_sort_style) {
|
|||
if ($logged_in_user){
|
||||
$logged_in_user->prefs->thread_sorting = $sort_style;
|
||||
$logged_in_user->prefs->update("thread_sorting=$sort_style");
|
||||
} else if (array_key_exists('sorting', $_COOKIE)) {
|
||||
list($forum_style, $old_style) = explode("|", $_COOKIE['sorting']);
|
||||
} else {
|
||||
list($forum_style, $old_style) = parse_forum_cookie();
|
||||
}
|
||||
send_cookie('sorting',
|
||||
implode("|", array($forum_style, $sort_style)),
|
||||
|
@ -89,8 +89,8 @@ if ($temp_sort_style) {
|
|||
// get the sorting style from the user or a cookie
|
||||
if ($logged_in_user){
|
||||
$sort_style = $logged_in_user->prefs->thread_sorting;
|
||||
} else if (array_key_exists('sorting', $_COOKIE)) {
|
||||
list($forum_style, $sort_style) = explode("|",$_COOKIE['sorting']);
|
||||
} else {
|
||||
list($forum_style, $sort_style) = parse_forum_cookie();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,10 @@ if ($email_addr && $passwd) {
|
|||
}
|
||||
$authenticator = $user->authenticator;
|
||||
Header("Location: ".URL_BASE."$next_url");
|
||||
$perm = $_POST['stay_logged_in'];
|
||||
$perm = false;
|
||||
if (isset($_POST['stay_logged_in'])) {
|
||||
$perm = $_POST['stay_logged_in'];
|
||||
}
|
||||
send_cookie('auth', $authenticator, $perm);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ function show_list($list) {
|
|||
echo "</table>";
|
||||
}
|
||||
|
||||
function show_teams_html($list) {
|
||||
function show_teams_html($list, $params) {
|
||||
page_head(tra("Team search results"));
|
||||
if (sizeof($list) == 0) {
|
||||
echo tra("No teams were found matching your criteria. Try another search.")
|
||||
|
@ -165,7 +165,7 @@ $user = get_logged_in_user(false);
|
|||
$submit = get_str("submit", true);
|
||||
$xml = get_str("xml", true);
|
||||
if ($submit || $xml) {
|
||||
$params = null;
|
||||
$params = new StdClass;
|
||||
$params->keywords = get_str('keywords', true);
|
||||
$params->country = get_str("country", true);
|
||||
$params->type = get_int("type", true);
|
||||
|
@ -174,7 +174,7 @@ if ($submit || $xml) {
|
|||
if ($xml) {
|
||||
show_teams_xml($list);
|
||||
} else {
|
||||
show_teams_html($list);
|
||||
show_teams_html($list, $params);
|
||||
}
|
||||
} else {
|
||||
page_head(tra("Find a team"), 'document.form.keywords.focus()');
|
||||
|
@ -182,7 +182,7 @@ if ($submit || $xml) {
|
|||
."<p>"
|
||||
.tra("Use this form to find teams that might be right for you.")
|
||||
."</p>\n";
|
||||
team_search_form($params);
|
||||
team_search_form(null);
|
||||
if (isset($_COOKIE['init'])) {
|
||||
echo "<p>
|
||||
".tra("%1I'm not interested%2 in joining a team right now.", "<a href=home.php>", "</a>");
|
||||
|
|
Loading…
Reference in New Issue