2006-12-01 00:38:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("docutil.php");
|
|
|
|
require_once("help_funcs.php");
|
|
|
|
require_once("help_db.php");
|
|
|
|
|
|
|
|
$volid = $_GET['volid'];
|
|
|
|
|
|
|
|
$vol = vol_lookup($volid);
|
|
|
|
|
2006-12-04 17:10:39 +00:00
|
|
|
function show_info($vol) {
|
2006-12-13 18:48:12 +00:00
|
|
|
$x = "<span class=note> Country: $vol->country\n";
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($vol->availability) {
|
|
|
|
$x .= "<br>Usual hours: $vol->availability";
|
|
|
|
}
|
|
|
|
if ($vol->specialties) {
|
|
|
|
$x .= "<br>Specialties: $vol->specialties";
|
|
|
|
}
|
|
|
|
if ($vol->projects) {
|
|
|
|
$x .= "<br>Projects: $vol->projects";
|
|
|
|
}
|
|
|
|
if ($vol->lang2) {
|
|
|
|
$x .= "<br>Primary language: $vol->lang1";
|
|
|
|
$x .= "<br>Secondary language: $vol->lang2";
|
|
|
|
}
|
2006-12-13 18:48:12 +00:00
|
|
|
$x .= "</span><p>";
|
2006-12-04 17:10:39 +00:00
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
2006-12-02 04:32:22 +00:00
|
|
|
function live_contact($vol, $rating) {
|
2006-12-01 00:38:36 +00:00
|
|
|
$skypeid = $vol->skypeid;
|
|
|
|
echo "
|
2006-12-04 17:10:39 +00:00
|
|
|
<table class=box cellpadding=8 width=100%><tr><td>
|
|
|
|
<font size=+2><b>Contact $vol->name on Skype</b></font>
|
|
|
|
<script>
|
|
|
|
if (navigator.userAgent.indexOf('MSIE') != -1) {
|
|
|
|
document.write(
|
|
|
|
\"<br>If requested, please enable ActiveX controls for this site.<br>\"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<p>
|
2006-12-01 00:38:36 +00:00
|
|
|
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
|
|
|
|
";
|
|
|
|
if ($vol->voice_ok) {
|
2006-12-04 17:10:39 +00:00
|
|
|
echo "<a href=skype:$skypeid?call onclick=\"return skypeCheck();\"><img align=top border=0 src=images/help/phone_icon_green.gif> Call (voice)</a>
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
if ($vol->text_ok) {
|
2006-12-04 17:10:39 +00:00
|
|
|
echo "<p><a href=skype:$skypeid?chat onclick=\"return skypeCheck();\"><img align=top border=0 src=images/help/skype_chat_icon.png> Chat (text)</a>
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
2006-12-04 17:10:39 +00:00
|
|
|
<p>
|
2006-12-13 18:48:12 +00:00
|
|
|
<span class=note>Note: BOINC helpers are unpaid volunteers.
|
2006-12-04 17:10:39 +00:00
|
|
|
Their advise is not endorsed by BOINC
|
2006-12-13 18:48:12 +00:00
|
|
|
or the University of California.</span>
|
2006-12-01 00:38:36 +00:00
|
|
|
<hr>
|
|
|
|
After the conversation is over, please give us your
|
|
|
|
feedback:
|
|
|
|
|
|
|
|
<form action=help_vol.php>
|
|
|
|
<input type=hidden name=volid value=\"$vol->id\">
|
|
|
|
|
|
|
|
";
|
|
|
|
list_start();
|
2006-12-02 04:32:22 +00:00
|
|
|
list_item(
|
2006-12-13 18:48:12 +00:00
|
|
|
"Rating<br><span class=note>Would you recommend $vol->name to people seeking help with BOINC?</span>",
|
2006-12-02 04:32:22 +00:00
|
|
|
star_select("rating", $rating->rating)
|
|
|
|
);
|
|
|
|
list_item("Comments", textarea("comment", $rating->comment));
|
2006-12-01 00:38:36 +00:00
|
|
|
list_item("", "<input type=submit name=rate value=OK>");
|
|
|
|
list_end();
|
|
|
|
echo "
|
|
|
|
</form>
|
2006-12-04 17:10:39 +00:00
|
|
|
</td></tr></table>
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function email_contact($vol) {
|
|
|
|
echo "
|
2006-12-04 17:10:39 +00:00
|
|
|
<p><table class=box width=100%><tr><td>
|
2006-12-01 00:38:36 +00:00
|
|
|
<h2>Contact $vol->name by email</h2>
|
|
|
|
<form action=help_vol.php>
|
|
|
|
<input type=hidden name=volid value=\"$vol->id\">
|
|
|
|
";
|
|
|
|
list_start();
|
|
|
|
list_item(
|
2007-01-15 19:25:23 +00:00
|
|
|
"Your email address",
|
2006-12-01 00:38:36 +00:00
|
|
|
input("email_addr", "")
|
|
|
|
);
|
2006-12-13 18:48:12 +00:00
|
|
|
list_item("Subject<br><span class=note>Include 'BOINC' in the subject so $vol->name will know it's not spam</span>", input("subject", ""));
|
|
|
|
list_item("Message<br><span class=note>Please including
|
|
|
|
a detailed description of the problem you're experiencing.</span>",
|
2006-12-11 23:42:54 +00:00
|
|
|
textarea("message", "")
|
|
|
|
);
|
2006-12-01 00:38:36 +00:00
|
|
|
list_item("", "<input type=submit name=send_email value=OK>");
|
|
|
|
list_end();
|
2006-12-04 17:10:39 +00:00
|
|
|
echo "</form>
|
|
|
|
</td></tr></table>
|
|
|
|
";
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$send_email = $_GET['send_email'];
|
|
|
|
$rate = $_GET['rate'];
|
2006-12-02 04:32:22 +00:00
|
|
|
session_set_cookie_params(86400*365);
|
|
|
|
session_start();
|
|
|
|
$uid = session_id();
|
|
|
|
|
2006-12-01 00:38:36 +00:00
|
|
|
if ($send_email) {
|
|
|
|
$volid = $_GET['volid'];
|
2006-12-11 23:42:54 +00:00
|
|
|
$subject = stripslashes($_GET['subject']);
|
2006-12-01 00:38:36 +00:00
|
|
|
$vol = vol_lookup($volid);
|
|
|
|
if (!$vol) {
|
|
|
|
error_page("No such volunteer $volid");
|
|
|
|
}
|
2007-01-11 00:20:58 +00:00
|
|
|
$msg = stripslashes($_GET['message']);
|
2007-01-15 19:25:23 +00:00
|
|
|
if (!$msg) {
|
|
|
|
error_page("You must supply a message");
|
|
|
|
}
|
2006-12-01 00:38:36 +00:00
|
|
|
$body = "The following message was sent by a BOINC Help user.\n";
|
|
|
|
$email_addr = $_GET['email_addr'];
|
2007-01-15 19:25:23 +00:00
|
|
|
if (!$email_addr) {
|
|
|
|
error_page("You need to specify your email address");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
2007-01-15 19:25:23 +00:00
|
|
|
$reply = "\r\nreply-to: $email_addr";
|
2006-12-01 00:38:36 +00:00
|
|
|
$body .= "\n\n";
|
|
|
|
$body .= $msg;
|
2006-12-11 23:42:54 +00:00
|
|
|
if (!$subject) $subject = "BOINC Help request";
|
2007-01-15 19:25:23 +00:00
|
|
|
mail($vol->email_addr, $subject, $body, "From: BOINC".$reply);
|
2006-12-01 00:38:36 +00:00
|
|
|
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");
|
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
$x = $_GET['rating'];
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($x==null) {
|
2006-12-02 04:32:22 +00:00
|
|
|
error_page("no rating given");
|
|
|
|
}
|
|
|
|
$rating = (int) $x;
|
2006-12-01 00:38:36 +00:00
|
|
|
if ($rating < 0 || $rating > 5) {
|
|
|
|
error_page("bad rating");
|
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
$comment = stripslashes($_GET['comment']);
|
2006-12-01 00:38:36 +00:00
|
|
|
$r = null;
|
|
|
|
$r->volunteerid = $volid;
|
|
|
|
$r->rating = $rating;
|
|
|
|
$r->timestamp = time();
|
|
|
|
$r->comment = $comment;
|
2006-12-02 04:32:22 +00:00
|
|
|
$r->auth = $uid;
|
|
|
|
if ($uid) {
|
2006-12-04 17:10:39 +00:00
|
|
|
$oldr = rating_lookup($r);
|
|
|
|
if ($oldr) {
|
|
|
|
$retval = rating_update($r);
|
|
|
|
if ($retval) vol_update_rating($vol, $oldr, $r);
|
|
|
|
} else {
|
2006-12-02 04:32:22 +00:00
|
|
|
$retval = rating_insert($r);
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($retval) vol_new_rating($vol, $rating);
|
2006-12-02 04:32:22 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$retval = rating_insert($r);
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($retval) vol_new_rating($vol, $rating);
|
2006-12-02 04:32:22 +00:00
|
|
|
}
|
2006-12-01 00:38:36 +00:00
|
|
|
if (!$retval) {
|
2006-12-02 04:32:22 +00:00
|
|
|
echo mysql_error();
|
2006-12-01 00:38:36 +00:00
|
|
|
error_page("database error");
|
|
|
|
}
|
|
|
|
page_head("Feedback recorded");
|
2006-12-02 04:32:22 +00:00
|
|
|
echo "Your feedback has been recorded. Thanks.
|
|
|
|
<p>
|
|
|
|
<a href=help.php>Return to BOINC Help</a>.
|
|
|
|
";
|
2006-12-01 00:38:36 +00:00
|
|
|
page_tail();
|
|
|
|
} else {
|
2006-12-04 17:10:39 +00:00
|
|
|
page_head("Help Volunteer: $vol->name");
|
|
|
|
echo show_info($vol);
|
2006-12-01 00:38:36 +00:00
|
|
|
$status = skype_status($vol->skypeid);
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($status != $vol->status) {
|
|
|
|
$vol->status = $status;
|
|
|
|
$vol->last_check = time();
|
|
|
|
if (online($vol->status)) {
|
|
|
|
$vol->last_online = time();
|
|
|
|
}
|
|
|
|
vol_update_status($vol);
|
|
|
|
}
|
2006-12-01 00:38:36 +00:00
|
|
|
$image = button_image($status);
|
|
|
|
echo "
|
2006-12-02 04:32:22 +00:00
|
|
|
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
|
2006-12-01 00:38:36 +00:00
|
|
|
<img src=images/help/$image><p>
|
|
|
|
";
|
|
|
|
if (online($status)) {
|
2006-12-04 17:10:39 +00:00
|
|
|
$rating = rating_vol_auth($vol->id, $uid);
|
2006-12-02 04:32:22 +00:00
|
|
|
if (!$rating) $rating->rating = -1;
|
|
|
|
live_contact($vol, $rating);
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
email_contact($vol);
|
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
?>
|