diff --git a/html/inc/forum.inc b/html/inc/forum.inc index ce5e740bb3..c1ecff834e 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -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; +} ?> diff --git a/html/inc/team.inc b/html/inc/team.inc index ca6da3e58f..857405daf3 100644 --- a/html/inc/team.inc +++ b/html/inc/team.inc @@ -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 '
'; start_table(); row2(''.tra('Search criteria (use one or more)').'', ''); diff --git a/html/inc/user.inc b/html/inc/user.inc index 0454811925..5b91f41e43 100644 --- a/html/inc/user.inc +++ b/html/inc/user.inc @@ -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 "

".tra("Projects in which you are participating")."

"; - } else { - echo "

".tra("Projects in which %1 is participating", $user->name)."

"; - } - start_table(); - row_heading_array(array( - tra("Project")."
".tra("Click for user page")."", 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 "

".tra("Projects in which you are participating")."

"; + } else { + echo "

".tra("Projects in which %1 is participating", $user->name)."

"; } + start_table(); + row_heading_array(array( + tra("Project")."
".tra("Click for user page")."", tra("Total credit"), tra("Average credit"), tra("Since") + )); + foreach($user->projects as $project) { + show_project($project); + } + end_table(); } function total_posts($user) { diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index be074c11cf..8de5c86a30 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -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 + ); } } diff --git a/html/user/forum_search_action.php b/html/user/forum_search_action.php index db4eecc809..fe594b4dd1 100644 --- a/html/user/forum_search_action.php +++ b/html/user/forum_search_action.php @@ -213,7 +213,7 @@ if (count($posts)){ end_table(); } -if (!count($thread) && !count($posts)){ +if (!count($threads) && !count($posts)){ echo "

".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).")."

" .tra("You can also %1try the same search on Google.%2", diff --git a/html/user/forum_thread.php b/html/user/forum_thread.php index 12db692094..c2f2e8a3b0 100644 --- a/html/user/forum_thread.php +++ b/html/user/forum_thread.php @@ -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(); } } diff --git a/html/user/login_action.php b/html/user/login_action.php index 20df8df095..ee82dd6a2b 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -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(); } diff --git a/html/user/team_search.php b/html/user/team_search.php index 3778695e8e..91aa5b0d2a 100644 --- a/html/user/team_search.php +++ b/html/user/team_search.php @@ -88,7 +88,7 @@ function show_list($list) { echo ""; } -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) { ."

" .tra("Use this form to find teams that might be right for you.") ."

\n"; - team_search_form($params); + team_search_form(null); if (isset($_COOKIE['init'])) { echo "

".tra("%1I'm not interested%2 in joining a team right now.", "", "");