aboutsummaryrefslogtreecommitdiff
path: root/admin/panes/shortens.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/panes/shortens.php')
-rw-r--r--admin/panes/shortens.php56
1 files changed, 54 insertions, 2 deletions
diff --git a/admin/panes/shortens.php b/admin/panes/shortens.php
index 51afcbb..165c198 100644
--- a/admin/panes/shortens.php
+++ b/admin/panes/shortens.php
@@ -33,9 +33,61 @@
<h2 style="text-align:center;">Shortened URLs</h2>
<ul class="list-group" style="margin-top:20px;">
- <li class="list-group-item">English (primary) <span style="float:right;"><a href="/admin/panes/editor.php?file=conduct.en&name=Code%20of%20Conduct%20-%20English&context=code">Edit</a> · <a href="/code-of-conduct/?en" target="_blank">View</a></span></li>
- <li class="list-group-item">French <span style="float:right;"><a href="/admin/panes/editor.php?file=conduct.fr&name=Code%20of%20Conduct%20-%20French&context=code">Edit</a> · <a href="/code-of-conduct/?fr" target="_blank">View</a></span></li>
+ <?php
+
+ $links = explode("\n", file_get_contents("/mnt/minteckrolt-urls/links.txt"));
+
+ foreach ($links as $link) {
+ if (trim($link) !== "") {
+ $url = explode(" ", $link)[0];
+ $redirect = explode(" ", $link)[1];
+
+ echo('<li class="list-group-item"><code>https://mt.ro.lt/<a href="https://mt.ro.lt/' . $url . '" target="_blank">' . $url . '</a></code> <span style="float:right;"><a href="#" onclick="deleteURL(\'' . $url . '\')">Delete</a></span></li>');
+ }
+ }
+
+ ?><li class="list-group-item">
+ <form id="creator" action="/admin/api/createURL.php">
+ <code>https://mt.ro.lt/<input type="text" name="shortenedName" placeholder="superurl"></code> → <input type="text" name="redirectsTo" placeholder="https://kde.org"> <span style="float:right;"><a href="#" onclick="document.getElementById('creator').submit();">Create</a></span>
+ </form>
+ </li>
</ul>
</div>
+<script>
+ let currurl;
+
+ function deleteURL(url) {
+ currurl = url;
+
+ $("#myModal").modal()
+ }
+
+ function confirmDelete(url) {
+ location.href = "/admin/api/deleteURL.php?_=" + url;
+ }
+</script>
+
+ <div class="modal" id="myModal">
+ <div class="modal-dialog">
+ <div class="modal-content">
+
+ <div class="modal-header">
+ <h4 class="modal-title">Delete this shortened URL?</h4>
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ </div>
+
+ <div class="modal-body">
+ This cannot be undone and may have unwanted side effects. After this URL is deleted, it will redirect to Minteck's Space's homepage.
+ </div>
+
+ <div class="modal-footer">
+ <button type="button" class="btn btn-success" onclick="confirmDelete(currurl);">Confirm</button>
+ <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
+ </div>
+
+ </div>
+ </div>
+ </div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file