has_profile) return null; $profile = BoincProfile::lookup("userid=$user->id"); if (!$profile->has_picture) return null; if (profile_screening() && $profile->verification!=1) return null; return profile_thumb_url($user->id); } // When passed profile->verification, this function is used to tell the // user the verification status of their profile. // function offensive_profile_warning($verify_flag) { if ($verify_flag == 0) { return " Your profile will be made visible to other people
as soon as it has been approved by the project.
This may take up to a few days.
"; } else if ($verify_flag == -1) { return " Your profile has been marked as unacceptable.
It is not visible to other people. Please change it.
"; } return ""; } // If the user with id = $userid has uploaded a picture his/herself, // delete it and its thumbnail. // function delete_user_pictures($userid) { $path = profile_image_path($userid); if (file_exists($path)) { unlink($path); } $path = profile_thumb_path($userid); if (file_exists($path)) { unlink($path); } } function scale_image( $image, $origWidth, $origHeight, $targetWidth, $targetHeight ) { // If the image is already smaller than the target dimensions, // just return it. // if ($origWidth <= $targetWidth && $origHeight <= $targetHeight) { return $image; } ($origWidth > $origHeight)? $scalar = ($origWidth / $targetWidth) : $scalar = ($origHeight / $targetHeight); if ($scalar != 0) { $destWidth = $origWidth / $scalar; $destHeight = $origHeight / $scalar; } else { $destWidth = $origWidth; $destHeight = $origHeight; } $gd_info = gd_info(); $newGD = (strstr($gd_info["GD Version"], "2.0")!=""); if ($newGD) { // If you are using a modern PHP/GD installation that does // 'truecolor' images, this is what's needed. $newImage = ImageCreateTrueColor($destWidth, $destHeight); ImageCopyResampled( $newImage, $image, 0, 0, 0, 0, $destWidth, $destHeight, $origWidth, $origHeight ); } else { // If not, use this block. // The image quality is lower but it works using older PHP/GD versions. $newImage = ImageCreate($destWidth, $destHeight); ImageCopyResized( $newImage, $image, 0, 0, 0, 0, $destWidth, $destHeight, $origWidth, $origHeight ); } return $newImage; } // Generates a string containing: // 1) the name of the user with ID == $userid, // with a link to a view of their profile // 2) the first MAX_DESC_LENGTH characters from the response1 field // of said user's profile. function get_profile_summary($profile) { $user = get_user_from_id($profile->userid); if (!$user || !$profile) { echo "Database error!"; // Change this to a standard error page. exit(); } $description = ""; if (strlen($profile->response1) != 0) { $temp = $profile->response1; $description = "(\"" . sub_sentence(strip_tags($temp), ' ', MAX_DESC_LENGTH, true) . "\")"; } $summary = "userid."\">".$user->name." ".$description; return $summary; } // Displays a user's profile (if they have one); // $screen_mode is set if we're in the administrative profile-screening page, // in which case we show everything function show_profile($user, $logged_in_user, $screen_mode = false) { BoincForumPrefs::lookup($user); if (is_banished($user)) { error_page("User is banished"); } $profile = get_profile($user->id); if (!$profile) { error_page("No user profile exists for that user ID."); } $can_edit = isset($logged_in_user) && $logged_in_user && $user->id == $logged_in_user->id; if ($can_edit) { row1("Edit your profile"); } // If screening is enabled, only show picture in certain situations // $show_picture = $profile->has_picture; if (profile_screening()) { if (!$screen_mode && !$can_edit && $profile->verification!=1) { $show_picture = false; } } if ($show_picture) { echo " id)."\"> "; } // If the user is viewing their own picture, display its status if it's not // yet verified. This will tell them if other users can't view it yet, or // if there is a problem with it and they need to replace it. // if (profile_screening() && $profile->has_picture && $can_edit && $profile->verification!=1) { row1(offensive_profile_warning($profile->verification)); } // Setup text output options based on logged in user forum settings // if (!$screen_mode) { $logged_in_user = get_logged_in_user(false); BoincForumPrefs::lookup($logged_in_user); $options = get_transform_settings_from_user($logged_in_user); } row1(show_profile_heading1()); row1(output_transform($profile->response1,$options), 2, "foobar"); row1(show_profile_heading2()); row1(output_transform($profile->response2,$options), 2, "foobar"); if (!$can_edit and !$screen_mode) { row1("Your feedback on this profile"); row2( "Recommend this profile for User of the Day:", "I id&vote=recommend>like this profile" ); row2( "Alert administrators to an offensive profile:", "I id&vote=reject>don't like this profile" ); } } $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit ?>