Country: $vol->country\n";
if ($vol->availability) {
$x .= "
Usual hours: $vol->availability";
}
if ($vol->specialties) {
$x .= "
Specialties: $vol->specialties";
}
if ($vol->projects) {
$x .= "
Projects: $vol->projects";
}
if ($vol->lang2) {
$x .= "
Primary language: $vol->lang1";
$x .= "
Secondary language: $vol->lang2";
}
$x .= "
";
return $x;
}
function live_contact($vol, $rating) {
$skypeid = $vol->skypeid;
echo "
Contact $vol->name on Skype
";
if ($vol->voice_ok) {
echo " Call (voice)
";
}
if ($vol->text_ok) {
echo " Chat (text)
";
}
echo "
Note: BOINC helpers are unpaid volunteers.
Their advise is not endorsed by BOINC
or the University of California.
After the conversation is over, please give us your
feedback:
|
";
}
function email_contact($vol) {
echo "
Contact $vol->name by email
|
";
}
$send_email = $_GET['send_email'];
$rate = $_GET['rate'];
session_set_cookie_params(86400*365);
session_start();
$uid = session_id();
if ($send_email) {
$volid = $_GET['volid'];
$subject = stripslashes($_GET['subject']);
$vol = vol_lookup($volid);
if (!$vol) {
error_page("No such volunteer $volid");
}
$msg = stripslashes($_GET['message']);
$body = "The following message was sent by a BOINC Help user.\n";
$email_addr = $_GET['email_addr'];
if ($email_addr) {
$body .= "(email address: $email_addr)\n";
}
$body .= "\n\n";
$body .= $msg;
if (!$subject) $subject = "BOINC Help request";
mail($vol->email_addr, $subject, $body, "From: BOINC");
page_head("Message sent");
echo "Your message has been sent to $vol->name";
page_tail();
} else if ($rate) {
$volid = $_GET['volid'];
$vol = vol_lookup($volid);
if (!$vol) {
error_page("No such volunteer $volid");
}
$x = $_GET['rating'];
if ($x==null) {
error_page("no rating given");
}
$rating = (int) $x;
if ($rating < 0 || $rating > 5) {
error_page("bad rating");
}
$comment = stripslashes($_GET['comment']);
$r = null;
$r->volunteerid = $volid;
$r->rating = $rating;
$r->timestamp = time();
$r->comment = $comment;
$r->auth = $uid;
if ($uid) {
$oldr = rating_lookup($r);
if ($oldr) {
$retval = rating_update($r);
if ($retval) vol_update_rating($vol, $oldr, $r);
} else {
$retval = rating_insert($r);
if ($retval) vol_new_rating($vol, $rating);
}
} else {
$retval = rating_insert($r);
if ($retval) vol_new_rating($vol, $rating);
}
if (!$retval) {
echo mysql_error();
error_page("database error");
}
page_head("Feedback recorded");
echo "Your feedback has been recorded. Thanks.
Return to BOINC Help.
";
page_tail();
} else {
page_head("Help Volunteer: $vol->name");
echo show_info($vol);
$status = skype_status($vol->skypeid);
if ($status != $vol->status) {
$vol->status = $status;
$vol->last_check = time();
if (online($vol->status)) {
$vol->last_online = time();
}
vol_update_status($vol);
}
$image = button_image($status);
echo "
";
if (online($status)) {
$rating = rating_vol_auth($vol->id, $uid);
if (!$rating) $rating->rating = -1;
live_contact($vol, $rating);
}
email_contact($vol);
page_tail();
}
?>