Minor fixes

This commit is contained in:
Daniel Björkholm
2015-01-16 18:24:58 +01:00
parent cb601afbca
commit 8be97a48b1
4 changed files with 74 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
@@ -20,6 +20,19 @@ if ($view !== false){
mysql_insert("INSERT INTO `znote_tickets_replies` ($fields) VALUES ($data)");
mysql_update("UPDATE `znote_tickets` SET `status`='Staff-Reply' WHERE `id`='$view' LIMIT 1;");
} else if (!empty($_POST['admin_ticket_close'])) {
$ticketId = (int) $_POST['admin_ticket_id'];
mysql_update("UPDATE `znote_tickets` SET `status` = 'CLOSED' WHERE `id` ='$ticketId' LIMIT 1;");
} else if (!empty($_POST['admin_ticket_open'])) {
$ticketId = (int) $_POST['admin_ticket_id'];
mysql_update("UPDATE `znote_tickets` SET `status` = 'Open' WHERE `id` ='$ticketId' LIMIT 1;");
} else if (!empty($_POST['admin_ticket_delete'])) {
$ticketId = (int) $_POST['admin_ticket_id'];
mysql_delete("DELETE FROM `znote_tickets` WHERE `id`='$ticketId' LIMIT 1;");
header("Location: admin_helpdesk.php");
}
$ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;");
@@ -28,11 +41,11 @@ if ($view !== false){
<table class="znoteTable ThreadTable table table-striped">
<tr class="yellow">
<th>
<?php
echo getClock($ticketData['creation'], true);
<?php
echo getClock($ticketData['creation'], true);
?>
- Created by:
<?php
- Created by:
<?php
echo $ticketData['username'];
?>
</th>
@@ -51,11 +64,11 @@ if ($view !== false){
<table class="znoteTable ThreadTable table table-striped">
<tr class="yellow">
<th>
<?php
echo getClock($reply['created'], true);
<?php
echo getClock($reply['created'], true);
?>
- Posted by:
<?php
- Posted by:
<?php
echo $reply['username'];
?>
</th>
@@ -66,19 +79,44 @@ if ($view !== false){
</td>
</tr>
</table>
<hr class="bighr">
<?php
}
}
?>
<form action="" method="post">
<input type="hidden" name="username" value="ADMIN"><br>
<textarea class="forumReply" name="reply_text" style="width: 610px; height: 150px"></textarea><br>
<input name="" type="submit" value="Post Reply" class="btn btn-primary">
</form>
<!-- Open/Close Ticket -->
<table class="znoteTable ThreadTable table table-striped">
<tr>
<td>
<form action="" method="post" align="center">
<input type="hidden" name="admin_ticket_id" value="<?php echo $ticketData['id']; ?>">
<?php if ($ticketData['status'] !== 'CLOSED') { ?>
<input type="submit" name="admin_ticket_close" value="Close Ticket" class="btn btn-warning">
<?php } else { ?>
<input type="submit" name="admin_ticket_open" value="Open Ticket" class="btn btn-success">
<?php } ?>
</form>
</td>
<td>
<form action="" method="post" align="center" onClick="return confirm('Are you sure you want to delete this ticket?');">
<input type="hidden" name="admin_ticket_id" value="<?php echo $ticketData['id']; ?>">
<input type="submit" name="admin_ticket_delete" value="Delete Ticket" class="btn btn-danger">
</form>
</td>
</tr>
</table>
<?php if ($ticketData['status'] !== 'CLOSED') { ?>
<hr class="bighr">
<form action="" method="post">
<input type="hidden" name="username" value="ADMIN"><br>
<textarea class="forumReply" name="reply_text" style="width: 610px; height: 150px"></textarea><br>
<input name="" type="submit" value="Post Reply" class="btn btn-primary">
</form>
<?php } ?>
<?php
} else {
?>
?>
<h1>Latest Tickets</h1>
<?php
$tickets = mysql_select_multi("SELECT id,subject,creation,status FROM znote_tickets ORDER BY creation DESC");
@@ -105,5 +143,5 @@ if ($view !== false){
<?php
} else echo 'No helpdesk tickets has been submitted.';
}
include 'layout/overall/footer.php';
include 'layout/overall/footer.php';
?>