/'), array('"', '>'), $name); $summary = preg_replace(array('/"/', '/>/'), array('"', '>'), $summary); } else { $name = ''; if(! empty($user['lastname']) && ! empty($user['preferredname'])) $name = "{$user["preferredname"]} {$user['lastname']}"; elseif(! empty($user['lastname']) && ! empty($user['preferredname'])) $name = "{$user["firstname"]} {$user['lastname']}"; $email = $user["email"]; $summary = ""; $text = ""; } if(! in_array('helpform', $noHTMLwrappers)) print "

VCL Help

\n"; print "This form sends a request to the VCL support group. Please provide "; print "as much information as possible.

\n"; if(HELPFAQURL != '') { print "Please see our "; print "FAQ Section before sending your request - it may be an easy "; print "fix!

\n"; } print "
\n"; print "\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
Name:"; printSubmitErr(NAMEERR); print "
Email:"; printSubmitErr(EMAILERR); print "
Summary:"; printSubmitErr(SUMMARYERR); print "
\n"; print "
\n"; print "Please describe the problem you are having. Include a description "; print "of how you encountered the problem and any error messages you "; print "received:
\n"; printSubmitErr(TEXTERR); print "
\n"; if(in_array('helpform', $noHTMLwrappers)) $cdata = array('indrupal' => 1); else $cdata = array(); $cont = addContinuationsEntry('submitHelpForm', $cdata, SECINDAY, 1, 0); print "\n"; print "\n"; print "
\n"; } //////////////////////////////////////////////////////////////////////////////// /// /// \fn submitHelpForm() /// /// \brief processes the help form and notifies the user that it was submitted /// //////////////////////////////////////////////////////////////////////////////// function submitHelpForm() { global $user, $submitErr, $submitErrMsg; $name = processInputVar("name", ARG_STRING); $email = processInputVar("email", ARG_STRING); $summary = processInputVar("summary", ARG_STRING); $text = processInputVar("comments", ARG_STRING); $testname = $name; if(get_magic_quotes_gpc()) $testname = stripslashes($name); if(! preg_match('/^([-A-Za-z \']{1,} [-A-Za-z \']{2,})*$/', $testname)) { $submitErr |= NAMEERR; $submitErrMsg[NAMEERR] = "Name can only contain letters, spaces, apostrophes ('), and dashes (-)"; } if(! preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $email)) { $submitErr |= EMAILERR; $submitErrMsg[EMAILERR] = "Invalid email address, please correct"; } if(empty($summary)) { $submitErr |= SUMMARYERR; $submitErrMsg[SUMMARYERR] = "Please fill in a very short summary of the " . "problem"; } if(empty($text)) { $submitErr |= TEXTERR; $submitErrMsg[TEXTERR] = "Please fill in your problem in the box below.
"; } if($submitErr) { printHelpForm(); return; } $computers = getComputers(); $requests = getUserRequests("all"); $query = "SELECT l.start AS start, " . "l.finalend AS end, " . "l.computerid AS computerid, " . "i.prettyname AS prettyimage " . "FROM log l, " . "image i " . "WHERE l.userid = " . $user["id"] . " AND " . "i.id = l.imageid AND " . "(unix_timestamp(NOW()) - unix_timestamp(l.finalend)) < 14400"; $qh = doQuery($query, 290); while($row = mysql_fetch_assoc($qh)) { array_push($requests, $row); } $from = $user["email"]; if(get_magic_quotes_gpc()) $text = stripslashes($text); $message = "Problem report submitted from VCL web form:\n\n" . "User: " . $user["unityid"] . "\n" . "Name: " . $testname . "\n" . "Email: " . $email . "\n" . "Problem description:\n\n$text\n\n"; $end = time(); $start = $end - 14400; $recentrequests = ""; foreach($requests as $request) { if(datetimeToUnix($request["end"]) > $start || datetimeToUnix($request["start"] < $end)) { $thisstart = str_replace(' ', ' ', prettyDatetime($request["start"])); $thisend = str_replace(' ', ' ', prettyDatetime($request["end"])); $recentrequests .= "Image: " . $request["prettyimage"] . "\n" . "Computer: " . $computers[$request["computerid"]]["hostname"] . "\n" . "Start: $thisstart\n" . "End: $thisend\n\n"; } } if(! empty($recentrequests)) { $message .= "-----------------------------------------------\n"; $message .= "User's recent reservations:\n\n" . $recentrequests . "\n"; } else { $message .= "User has no recent reservations\n"; } $indrupal = getContinuationVar('indrupal', 0); if(! $indrupal) print "

VCL Help

\n"; $mailParams = "-f" . ENVELOPESENDER; if(get_magic_quotes_gpc()) $summary = stripslashes($summary); if(! mail(HELPEMAIL, "$summary", $message, "From: $from\r\nReply-To: $email\r\n", $mailParams)){ print "The Server was unable to send mail at this time. Please e-mail "; print "" . HELPEMAIL . " for "; print "help with your problem."; } else { print "Your problem report has been submitted. Thank you for letting "; print "us know of your problem so that we can improve this site.
\n"; } } ?>