|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace BNETDocs\Templates\Server; |
| 4 | + |
| 5 | +use \BNETDocs\Libraries\Server; |
| 6 | +use \CarlBennett\MVC\Libraries\Common; |
| 7 | +use \CarlBennett\MVC\Libraries\Pair; |
| 8 | + |
| 9 | +$object_id = $this->getContext()->server_id; |
| 10 | +$object = $this->getContext()->server; |
| 11 | +$object_status = null; |
| 12 | +$object_type = $this->getContext()->server_type; |
| 13 | + |
| 14 | +$object_user = ($object ? $object->getUser() : null); |
| 15 | +$object_user_avatar = ($object_user ? $object_user->getAvatarURI(22) : null); |
| 16 | +$object_user_url = ($object_user ? $object_user->getURI() : null); |
| 17 | + |
| 18 | +$title = ($object ? $object->getName() : "Server Not Found"); |
| 19 | +$description = ($object ? "The BNETDocs Status Page for " . $object->getName() |
| 20 | + : "The requested server does not exist or could not be found."); |
| 21 | + |
| 22 | +$this->opengraph->attach(new Pair("type", "article")); |
| 23 | + |
| 24 | +$url = Common::relativeUrlToAbsolute("/server/" . urlencode($object_id)); |
| 25 | + |
| 26 | +if ($object) { |
| 27 | + |
| 28 | + $url = $object->getURI(); |
| 29 | + |
| 30 | + $object_status_bitmask = $object->getStatusBitmask(); |
| 31 | + if ($object_status_bitmask & Server::STATUS_ONLINE) { |
| 32 | + $object_status = "<span class=\"online\">Online</span>"; |
| 33 | + } else { |
| 34 | + $object_status = "<span class=\"offline\">Offline</span>"; |
| 35 | + } |
| 36 | + if ($object_status_bitmask & Server::STATUS_DISABLED) { |
| 37 | + $object_status .= ", <span class=\"disabled\">Disabled</span>"; |
| 38 | + } |
| 39 | + |
| 40 | +} |
| 41 | + |
| 42 | +$this->opengraph->attach(new Pair("url", $url)); |
| 43 | + |
| 44 | +$this->additional_css[] = "/a/servers.css"; |
| 45 | +require("./header.inc.phtml"); |
| 46 | +?> |
| 47 | + <article> |
| 48 | +<?php if ($object) { ?> |
| 49 | + <a href="https://plus.google.com/share?url=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="header-button float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-gplus-24px.png"); ?>"/></a> |
| 50 | + <a href="https://twitter.com/share?text=<?php echo urlencode($title); ?>&url=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="header-button float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-twitter-24px.png"); ?>"/></a> |
| 51 | + <a href="https://facebook.com/sharer/sharer.php?u=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="header-button float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-facebook-24px.png"); ?>"/></a> |
| 52 | + <header>Server Status</header> |
| 53 | + <section> |
| 54 | + <?php require("./NYI.inc.phtml"); ?> |
| 55 | + </section> |
| 56 | + <section> |
| 57 | + <table class="serverview"><tbody> |
| 58 | + <tr><th>Label</th><td><?php echo filter_var($object->getLabel(), FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></td></tr> |
| 59 | + <tr><th>Address</th><td class="address"><?php echo filter_var($object->getAddress() . ":" . $object->getPort(), FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></td></tr> |
| 60 | + <tr><th>Owner</th><td><?php if ($object_user) { ?><a href="<?php echo $object_user_url; ?>"><img class="avatar" src="<?php echo $object_user_avatar; ?>"/> <?php echo filter_var($object_user->getName(), FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></a><?php } else { echo "Anonymous"; } ?></td></tr> |
| 61 | + <tr><th>Type</th><td><?php echo filter_var($object_type->getLabel(), FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></td></tr> |
| 62 | + <tr><th>Current Status:</th><td><?php echo $object_status; ?></td></tr> |
| 63 | + </tbody></table> |
| 64 | + </section> |
| 65 | +<?php } else { ?> |
| 66 | + <header class="red"><?php echo filter_var($title, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></header> |
| 67 | + <section class="red"><?php echo filter_var($description, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></section> |
| 68 | +<?php } ?> |
| 69 | + </article> |
| 70 | +<?php require("./footer.inc.phtml"); ?> |
0 commit comments