skypeid;
echo "
Contact $vol->name live using Skype
";
if ($vol->voice_ok) {
echo " Call $vol->name on Skype
";
}
if ($vol->text_ok) {
echo " Chat with $vol->name on Skype
";
}
echo "
After the conversation is over, please give us your
feedback:
";
}
function email_contact($vol) {
echo "
Contact $vol->name by email
\n";
}
$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'];
$vol = vol_lookup($volid);
if (!$vol) {
error_page("No such volunteer $volid");
}
$msg = $_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;
mail($vol->email_addr, "BOINC Help request", $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) {
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) {
$retval = rating_update($r);
if (!$retval) {
$retval = rating_insert($r);
}
} else {
$retval = rating_insert($r);
}
if (!$retval) {
echo mysql_error();
error_page("database error");
}
vol_update_rating($vol, $rating);
page_head("Feedback recorded");
echo "Your feedback has been recorded. Thanks.
Return to BOINC Help.
";
page_tail();
} else {
page_head("Contact $vol->name");
$status = skype_status($vol->skypeid);
$image = button_image($status);
echo "
";
if (online($status)) {
$rating = rating_vol_auth($vol, $uid);
if (!$rating) $rating->rating = -1;
live_contact($vol, $rating);
}
email_contact($vol);
page_tail();
}
?>