$comment = escape_smart($_POST['comment']); $status = escape_smart($_POST['status']); $assign = escape_smart($_POST['assign']); $data = isset($_POST["misc"]) ? $_POST["misc"] : ""; $bn = basename(dirname($_SERVER[PHP_SELF])); if ($status == 6) { $misc = escape_smart("Duplicate Of=<a href='{$bn}/ticket.php?id={$data}'>{$data}</a>"); } // TODO: make a method of adding these messages that don't involve permanently storing a name... // has the status been changed? if (is_numeric($status) && $status != $issue['status']) { if (!db_query("UPDATE issues SET status = {$status}, misc='{$misc}' WHERE id = {$id} ")) { $error = true; $errors[] = 'The status of the ticket could not be changed. There may be a server error.'; } else { $comment .= "\n\n" . '[b]*** Status changed to ' . getstatusnm($status) . ' ***[/b]'; $comment .= $misc != "" ? "\n\n[b]*** Received extra data: {$data} ***[/b]" : ""; } } // has the assigned user been changed? if (is_numeric($assign) && $assign != $issue['assign']) { if (!db_query("UPDATE issues SET assign = {$assign} WHERE id = {$id}")) { $error = true; $errors[] = 'The assigned user of the ticket could not be changed. There may be a server error.'; } else { $comment .= "\n\n" . '[b]*** Assigned user changed to ' . $users->id($assign)->info['name'] . ' ***[/b]'; } } // now let's insert the comment! if (db_query("INSERT INTO comments (author, issue, content, when_posted) VALUES ({$_SESSION['uid']}, {$id}, '{$comment}', NOW())")) { if (!db_query("UPDATE issues SET num_comments = num_comments+1, when_updated = NOW() WHERE id = {$id}")) {
</li> </ul> </div> </div> <?php } ?> <div class="clear"></div> </div> <table class="details"> <tr> <td>Status</td> <td><?php echo getstatusnm($issue['status']); ?> </td> </tr> <tr> <td>Severity</td> <td><?php echo $issue['severity']; ?> /5 <small>[todo: show text not a number]</small></td> </tr> <tr> <td><?php echo $issue['status'] == 3 ? 'Was assigned to' : 'Assigned to'; ?> </td>
echo_tags($issue['tags']); ?> </td> <td class="replies"><?php echo $ticket['num_comments']; ?> </td> <td class="assigned<?php echo $ticket['assign'] == $_SESSION['uid'] && $ticket['status'] < 3 ? ' you' : ''; ?> "><?php echo $ticket['assign'] > 0 ? '<a href="profile.php?id=' . $ticket['assign'] . '">' . getunm($ticket['assign']) . '</a>' : '--'; ?> </td> <td class="last"><?php echo timeago($ticket['when_updated'], false, true); ?> </td> <td class="status"><?php echo getstatusnm($ticket["status"]); ?> </td> </tr> <?php } ?> </tbody> </table>