|
1 |
| -<?php |
2 |
| - |
| 1 | +<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */ |
3 | 2 | namespace BNETDocs\Templates\Packet;
|
4 |
| - |
5 | 3 | use \CarlBennett\MVC\Libraries\Pair;
|
6 |
| - |
7 |
| -$title = "Delete Packet"; |
8 |
| -$description = "This form allows an individual to delete a packet."; |
9 |
| - |
10 |
| -$this->opengraph->attach(new Pair("url", "/packet/delete")); |
11 |
| -$this->opengraph->attach(new Pair("type", "article")); |
12 |
| - |
13 |
| -switch ($this->getContext()->error) { |
14 |
| - case "ACL_NOT_SET": |
15 |
| - $message = "You do not have the privilege to delete packets."; |
16 |
| - break; |
17 |
| - case "NOT_FOUND": |
18 |
| - $message = "Cannot find packet by that id."; |
19 |
| - break; |
20 |
| - case "NOT_LOGGED_IN": |
21 |
| - $message = "You must be logged in to delete packets."; |
22 |
| - break; |
23 |
| - case "INTERNAL_ERROR": |
24 |
| - $message = "An internal error occurred while processing your request. " |
25 |
| - . "Our staff have been notified of the issue. Try again later."; |
26 |
| - break; |
27 |
| - default: |
28 |
| - $message = $this->getContext()->error; |
| 4 | +$title = 'Delete Packet'; |
| 5 | +$description = 'This form allows an individual to delete a packet.'; |
| 6 | +$this->opengraph->attach(new Pair('url', '/packet/delete')); |
| 7 | +$this->opengraph->attach(new Pair('type', 'article')); |
| 8 | +$error = $this->getContext()->error; |
| 9 | +switch ($error) |
| 10 | +{ |
| 11 | + case 'ACL_NOT_SET': $message = 'You do not have the privilege to delete packets.'; break; |
| 12 | + case 'NOT_FOUND': $message = 'Cannot find packet by that id.'; break; |
| 13 | + case 'NOT_LOGGED_IN': $message = 'You must be logged in to delete packets.'; break; |
| 14 | + case 'INTERNAL_ERROR': $message = 'An internal error occurred while processing your request. Our staff have been notified of the issue. Try again later.'; break; |
| 15 | + default: $message = $error; |
29 | 16 | }
|
30 |
| - |
31 |
| -require("./header.inc.phtml"); |
32 |
| -?> |
33 |
| - <article> |
34 |
| -<?php if (is_null($this->getContext()->error)) { ?> |
35 |
| - <header>Delete Packet</header> |
36 |
| - <form method="POST" action="?id=<?php echo |
37 |
| - htmlspecialchars($this->getContext()->id, ENT_HTML5, "UTF-8"); ?>"> |
38 |
| - <section> |
39 |
| - <p>Are you sure you wish to delete this packet?</p> |
40 |
| - <p><input type="text" readonly="readonly" value="<?php echo filter_var($this->getContext()->title, FILTER_SANITIZE_STRING); ?>" tabindex="1"/></p> |
41 |
| - <p><input type="submit" value="Delete Packet" tabindex="2" autofocus="autofocus"/></p> |
42 |
| - </section> |
43 |
| - </form> |
44 |
| -<?php } else if ($this->getContext()->error === false) { ?> |
45 |
| - <header class="green">Packet Deleted</header> |
46 |
| - <section class="green"> |
47 |
| - <p>You have successfully deleted the packet!</p> |
48 |
| - <p>Use the navigation to the left to move to another page.</p> |
49 |
| - </section> |
50 |
| -<?php } else { ?> |
51 |
| - <header class="red">Delete Packet</header> |
52 |
| - <section class="red"> |
53 |
| - <p>An error occurred while attempting to delete the packet.</p> |
54 |
| - <p><?php echo $message; ?></p> |
55 |
| - <p>Use the navigation to the left to move to another page.</p> |
56 |
| - </section> |
57 |
| -<?php } ?> |
58 |
| - </article> |
59 |
| -<?php require("./footer.inc.phtml"); ?> |
| 17 | +$id = filter_var($this->getContext()->id, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 18 | +require('./header.inc.phtml'); ?> |
| 19 | +<div class="container"> |
| 20 | +<? if (is_null($error)) { ?> |
| 21 | + <h1 class="text-danger"><?=$title?></h1> |
| 22 | + <p class="text-danger"><?=$description?></p> |
| 23 | + <form method="POST" action="?id=<?=$id?>"> |
| 24 | + <div class="alert alert-danger"> |
| 25 | + <p class="mb-0">Are you sure you wish to delete this packet?</p> |
| 26 | + </div> |
| 27 | + <pre><code class="language-objectivec"><? echo filter_var($this->getContext()->title, FILTER_SANITIZE_STRING); ?></code></pre> |
| 28 | + <input class="btn btn-danger" type="submit" value="Delete Packet" tabindex="2" autofocus="autofocus"/> |
| 29 | + </form> |
| 30 | +<? } else if ($error === false) { ?> |
| 31 | + <h1 class="text-success">Packet Deleted</h1> |
| 32 | + <div class="alert alert-success"> |
| 33 | + <p class="mb-0">You have successfully deleted the packet!</p> |
| 34 | + </div> |
| 35 | +<? } else { ?> |
| 36 | + <h1 class="text-danger">Delete Packet</h1> |
| 37 | + <div class="alert alert-danger"> |
| 38 | + <p>An error occurred while attempting to delete the packet.</p> |
| 39 | + <p class="mb-0"><?=$message?></p> |
| 40 | + </div> |
| 41 | +<? } ?> |
| 42 | +</div> |
| 43 | +<? require("./footer.inc.phtml"); ?> |
0 commit comments