query($sql); $tid = $db->insert_id(); // update the log so it shows who created the ticket now. if ($pubpriv == "Public") $msg = "\$lang_createdbyweb ".$_POST[username].""; else $msg = "\$lang_taskcreatedby ".$_SESSION[user].""; $log = updateLog($tid, $msg); $sql = "update $tickets_table set update_log='$log' where id=$tid"; $db->query($sql); // insert the file into the database if it exists. // Modified by Adam Hall to allow attachment file upload support if ($enable_tattachments == 'On' && $_FILES['SelectedFile']['name'] != '' && $_FILES['SelectedFile']['name'] != 'none') { //Upload file and return new file name $mtime = explode(" ", microtime()); $mtime = $mtime[1].substr($mtime[0],5,3); $file_name = uploadAttachment($max_attachment_size, 'SelectedFile',$mtime); $file_type = $_FILES['SelectedFile']['type']; $file_size = $_FILES['SelectedFile']['size']; $sql = "INSERT into $attachments_table VALUES (NULL, NULL, $tid, '$file_name', '$file_upload_directory', '$file_type', '$file_size', NULL, 0, '$_SESSION[user]', $time)"; $db->query($sql); //insert all info about the attachment into the database. $file_id = $db->insert_id(); // insert the file into the database if it exists. // if ($enable_uattachments == 'On' && $the_file != '' && $the_file != 'none') { // $attachment = addslashes(fread(fopen($the_file, "rb"), filesize($the_file))); // if ($the_file_type == "application/x-gzip-compressed") { // $attachment = base64_decode($attachment); // } // $query = "INSERT into $attachments_table VALUES(NULL, NULL, $tid, '$the_file_name', '$the_file_type', '$the_file_size', '$attachment', 0, '$_SESSION[user]', $time)"; // $db->query($query); //insert all info about the attachment into the database. // $file_id = $db->insert_id(); // $attachsize = $file_size; if ($attachsize >= 1073741824) { $attachsize = round($attachsize / 1073741824 * 100) / 100 . "gb"; } elseif ($attachsize >= 1048576) { $attachsize = round($attachsize / 1048576 * 100) / 100 . "mb"; } elseif ($attachsize >= 1024) { $attachsize = round($attachsize / 1024 * 100) / 100 . "kb"; } else { $attachsize = $attachsize . "b"; } // update the update log $msg = "\$lang_fileattached : ".$_FILES['SelectedFile']['name']." ( $attachsize )"; $log = updateLog($tid, $msg); $sql = "update $tickets_table set update_log='$log' where id=$tid"; $db->query($sql); } //reset the userform session var... unset($_SESSION[userform]); // if the pager gateway is enabled...send a page to the supporters of that group if the ticket is set above the default. if ($enable_pager == 'On' && (getRank($_POST[priority], $tpriorities_table) <= $pager_rank_low)) { sendGroupPage($_POST[sg], $_POST[username], $_POST[short], $_POST[priority], $tid); } // now print out the html that lets the user know that their ticket was submitted successfully. header("Location: index.php?t=tsuc&id=$tid"); } } else { echo "
"; echo ""; } function createTicketHeader($msg) { startTable($msg, "middle"); endTable(); } function createSupporterInfo() { global $lang_supporterinfo, $lang_supportergroup, $lang_priority, $lang_ticket; if ($_GET[sg] == '') { $_GET[sg] = getDefaultSupporterGroupID(); } startTable("$lang_supporterinfo", "left", 100, 4); echo '