Exemple #1
0
function handle_add($user)
{
    $destid = get_int('userid');
    if ($destid == $user->id) {
        error_page(tra("You can't be friends with yourself"));
    }
    $destuser = BoincUser::lookup_id($destid);
    if (!$destuser) {
        error_page("No such user");
    }
    check_pending($user, $destuser);
    check_ignoring($user, $destuser);
    page_head(tra("Add friend"));
    echo "\n        <form method=post action=friend.php>\n        <input type=hidden name=userid value={$destid}>\n        <input type=hidden name=action value=add_confirm>" . tra("You have asked to add %1 as a friend. We will notify %1 and will ask him/her to confirm that you are friends.", "<b>" . $destuser->name . "</b>") . "\n        <p>" . tra("Add an optional message here:") . "\n        <br>\n        " . textarea_with_counter("message", 250, "") . "\n        <p>\n        <input type=submit value=\"" . tra("OK") . "\">\n        </form>\n    ";
    page_tail();
}
         $select_1 = "checked=\"true\"";
     } else {
         $select_2 = "checked=\"true\"";
     }
 } else {
     $select_0 = "checked=\"true\"";
 }
 row1(tra("Message-board identity"));
 row2(tra("Avatar") . "\n    <br><p class=\"text-muted\">" . tra("An image representing you on the message boards.") . "\n    <br>" . tra("Format: JPG or PNG. Size: at most 4 KB, 100x100 pixels") . "</p>", "<input type=\"radio\" id=\"avatar_select_0\" name=\"avatar_select\" value=\"0\" " . $select_0 . ">\n        <label for=\"avatar_select_0\">" . tra("Don't use an avatar") . "</label><br>\n    <input type=\"radio\" id=\"avatar_select_1\" name=\"avatar_select\" value=\"1\" " . $select_1 . ">\n        <label for=\"avatar_select_1\">" . tra("Use a Globally Recognized Avatar provided by %1", "<a href=\"http://gravatar.com\">Gravatar.com</a>") . "</label><br>\n    <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" " . $select_2 . ">\n        <label for=\"avatar_select_2\">" . tra("Use this uploaded avatar:") . "</label> <input type=\"file\" name=\"picture\">");
 if (strlen($user->prefs->avatar)) {
     row2(tra("Avatar preview") . "<br><p class=\"text-muted\">" . tra("This is how your avatar will look") . "</p>", "<img src=\"" . $user->prefs->avatar . "\" width=\"100\" height=\"100\">");
 }
 $signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : "";
 $signature = $user->prefs->signature;
 $maxlen = 250;
 row2(tra("Signature for message board posts") . html_info() . "<br><br>" . tra("Check out %1various free services%2\n<br> providing dynamic 'signature images'\n<br> showing your latest credit info, project news, etc.", "<a href=https://boinc.berkeley.edu/links.php#sigs>", "</a>"), textarea_with_counter("signature", 250, $signature) . "<br><input type=\"checkbox\" name=\"signature_by_default\" " . $signature_by_default . "> " . tra("Attach signature by default"));
 if ($user->prefs->signature != "") {
     row2(tra("Signature preview") . "<br><p class=\"text-muted\">" . tra("This is how your signature will look in the forums") . "</p>", output_transform($user->prefs->signature));
 }
 // ------------ Message display  -----------
 $forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : "";
 $forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : "";
 $forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : "";
 $forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : "";
 $forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : "";
 $forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : "";
 $forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : "";
 $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount);
 $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount);
 row1(tra("Message display"));
 row2(tra("What to display"), "<input type=\"checkbox\" name=\"forum_hide_avatars\" " . $forum_hide_avatars . "> " . tra("Hide avatar images") . "<br>\n    <input type=\"checkbox\" name=\"forum_hide_signatures\" " . $forum_hide_signatures . "> " . tra("Hide signatures") . "<br>\n    <input type=\"checkbox\" name=\"forum_images_as_links\" " . $forum_image_as_link . "> " . tra("Show images as links") . "<br>\n    <input type=\"checkbox\" name=\"forum_link_popup\" " . $forum_link_popup . "> " . tra("Open links in new window/tab") . "<br>\n    <input type=\"checkbox\" name=\"forum_highlight_special\" " . $forum_highlight_special . "> " . tra("Highlight special users") . "<br>\n    <input type=\"text\" name=\"forum_display_wrap_postcount\" size=3 value=\"" . $forum_display_wrap_postcount . "\"> " . tra("Display this many messages per page") . "<br />\n    ");