2006-12-01 00:38:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("docutil.php");
|
2010-10-14 19:07:02 +00:00
|
|
|
require_once("../html/inc/util.inc");
|
2006-12-01 00:38:36 +00:00
|
|
|
require_once("help_funcs.php");
|
|
|
|
require_once("help_db.php");
|
|
|
|
|
2010-10-13 23:21:19 +00:00
|
|
|
$volid = get_int('volid');
|
2006-12-01 00:38:36 +00:00
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
2008-10-09 22:44:45 +00:00
|
|
|
function live_contact($vol) {
|
2006-12-01 00:38:36 +00:00
|
|
|
$skypeid = $vol->skypeid;
|
|
|
|
echo "
|
2006-12-04 17:10:39 +00:00
|
|
|
<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
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2010-08-10 19:45:34 +00:00
|
|
|
echo " <p>";
|
|
|
|
help_warning();
|
|
|
|
echo " <hr> ";
|
2008-10-09 22:44:45 +00:00
|
|
|
}
|
2006-12-01 00:38:36 +00:00
|
|
|
|
2008-10-09 22:44:45 +00:00
|
|
|
function show_rating($vol, $rating) {
|
|
|
|
echo "
|
|
|
|
If $vol->name has helped you, please give us your feedback:
|
|
|
|
<form action=help_vol.php>
|
|
|
|
<input type=hidden name=volid value=\"$vol->id\">
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
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>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function email_contact($vol) {
|
|
|
|
echo "
|
2008-10-09 22:44:45 +00:00
|
|
|
<p>
|
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", ""));
|
2010-01-06 06:01:23 +00:00
|
|
|
list_item("Message<br><span class=note>
|
|
|
|
|
|
|
|
Please include a detailed description of the problem
|
|
|
|
you're experiencing.
|
|
|
|
If possible, include the contents of BOINC's message log.
|
|
|
|
</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>
|
|
|
|
";
|
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);
|
2007-06-22 03:46:42 +00:00
|
|
|
if (!$vol || $vol->hide) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("No such volunteer $volid");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
2007-01-11 00:20:58 +00:00
|
|
|
$msg = stripslashes($_GET['message']);
|
2007-01-15 19:25:23 +00:00
|
|
|
if (!$msg) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("You must supply a message");
|
2007-01-15 19:25:23 +00:00
|
|
|
}
|
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 22:53:41 +00:00
|
|
|
if (!is_valid_email_addr($email_addr)) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("You must specify a valid 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) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("No such volunteer $volid");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
$x = $_GET['rating'];
|
2006-12-04 17:10:39 +00:00
|
|
|
if ($x==null) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("no rating given");
|
2006-12-02 04:32:22 +00:00
|
|
|
}
|
|
|
|
$rating = (int) $x;
|
2006-12-01 00:38:36 +00:00
|
|
|
if ($rating < 0 || $rating > 5) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("bad rating");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
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();
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("database error");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
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>
|
|
|
|
";
|
2010-01-06 06:01:23 +00:00
|
|
|
echo "<table class=box cellpadding=8 width=100%><tr><td width=40%>";
|
2006-12-01 00:38:36 +00:00
|
|
|
if (online($status)) {
|
2008-10-09 22:44:45 +00:00
|
|
|
live_contact($vol);
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
email_contact($vol);
|
2008-10-09 22:44:45 +00:00
|
|
|
echo "</td></tr></table><p>\n";
|
|
|
|
echo "<table class=box cellpadding=8 width=100%><tr><td>";
|
|
|
|
$rating = rating_vol_auth($vol->id, $uid);
|
|
|
|
if (!$rating) $rating->rating = -1;
|
|
|
|
show_rating($vol, $rating);
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
2006-12-01 00:38:36 +00:00
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
?>
|