From 482cc4dfca3cf414587a9a1a70683caafe3bfa79 Mon Sep 17 00:00:00 2001
From: Simon Leary
Date: Thu, 11 Dec 2025 16:32:31 -0500
Subject: [PATCH 01/18] wip
---
resources/lib/UnityHTTPD.php | 2 +-
resources/lib/UnityMailer.php | 2 --
resources/lib/UnityWebhook.php | 5 -----
resources/lib/utils.php | 5 +++++
resources/mail/footer.php | 2 +-
resources/mail/group_created.php | 2 +-
resources/mail/group_request_admin.php | 2 +-
resources/mail/group_user_added.php | 2 +-
resources/mail/group_user_request_owner.php | 2 +-
resources/mail/user_loginshell.php | 2 +-
resources/mail/user_qualified.php | 2 +-
resources/mail/user_sshkey.php | 2 +-
resources/templates/footer.php | 10 ++++-----
resources/templates/header.php | 23 ++++++++-------------
webroot/admin/pi-mgmt.php | 2 +-
webroot/admin/user-mgmt.php | 2 +-
webroot/panel/account.php | 2 +-
webroot/panel/groups.php | 8 +++----
webroot/panel/modal/new_key.php | 12 +++++++----
webroot/panel/modal/new_pi.php | 2 +-
webroot/panel/new_account.php | 2 +-
webroot/panel/pi.php | 2 +-
22 files changed, 46 insertions(+), 49 deletions(-)
diff --git a/resources/lib/UnityHTTPD.php b/resources/lib/UnityHTTPD.php
index 7952a176..f434c808 100644
--- a/resources/lib/UnityHTTPD.php
+++ b/resources/lib/UnityHTTPD.php
@@ -42,7 +42,7 @@ public static function die(mixed $x = null, bool $show_user = false): never
*/
public static function redirect(?string $dest = null): never
{
- $dest ??= pathJoin(CONFIG["site"]["prefix"], $_SERVER["REQUEST_URI"]);
+ $dest ??= getURL($_SERVER["REQUEST_URI"]);
$dest = htmlspecialchars($dest);
header("Location: $dest");
http_response_code(302);
diff --git a/resources/lib/UnityMailer.php b/resources/lib/UnityMailer.php
index 51a1aeba..da5b85ef 100644
--- a/resources/lib/UnityMailer.php
+++ b/resources/lib/UnityMailer.php
@@ -13,7 +13,6 @@ class UnityMailer extends PHPMailer
private string $template_dir = __DIR__ . "/../mail"; // location of all email templates
private string $override_template_dir = __DIR__ . "/../../deployment/mail_overrides";
- private string $MSG_LINKREF;
private string $MSG_SENDER_EMAIL;
private string $MSG_SENDER_NAME;
private string $MSG_SUPPORT_EMAIL;
@@ -28,7 +27,6 @@ public function __construct()
parent::__construct();
$this->isSMTP();
- $this->MSG_LINKREF = CONFIG["site"]["url"] . CONFIG["site"]["prefix"];
$this->MSG_SENDER_EMAIL = CONFIG["mail"]["sender"];
$this->MSG_SENDER_NAME = CONFIG["mail"]["sender_name"];
$this->MSG_SUPPORT_EMAIL = CONFIG["mail"]["support"];
diff --git a/resources/lib/UnityWebhook.php b/resources/lib/UnityWebhook.php
index 80203762..522b644a 100644
--- a/resources/lib/UnityWebhook.php
+++ b/resources/lib/UnityWebhook.php
@@ -7,13 +7,8 @@ class UnityWebhook
private string $template_dir = __DIR__ . "/../mail";
private string $override_template_dir = __DIR__ . "/../../deployment/mail_overrides";
private string $url = CONFIG["webhook"]["url"];
- private string $MSG_LINKREF;
private string $Subject; // set by template
- public function __construct()
- {
- $this->MSG_LINKREF = CONFIG["site"]["url"] . CONFIG["site"]["prefix"];
- }
public function htmlToMarkdown(string $html): string
{
// Define regex patterns for each markdown format
diff --git a/resources/lib/utils.php b/resources/lib/utils.php
index a9a04aa8..e3270e51 100644
--- a/resources/lib/utils.php
+++ b/resources/lib/utils.php
@@ -82,3 +82,8 @@ function pathJoin()
}
return preg_replace("#/+#", "/", join("/", $paths));
}
+
+function getURL(...$args)
+{
+ return pathJoin([CONFIG["site"]["url"], CONFIG["site"]["prefix"], ...$args]);
+}
diff --git a/resources/mail/footer.php b/resources/mail/footer.php
index 9e6a712b..5b133d07 100644
--- a/resources/mail/footer.php
+++ b/resources/mail/footer.php
@@ -3,7 +3,7 @@
>
You are receiving this email because you have an account
- on the Unity Cluster.
+ on the Unity Cluster.
If you would like to stop receiving these emails,
you may request to close your account by replying to this email.
diff --git a/resources/mail/group_created.php b/resources/mail/group_created.php
index 618ef57f..b4c64481 100644
--- a/resources/mail/group_created.php
+++ b/resources/mail/group_created.php
@@ -8,7 +8,7 @@
Your request for a PI account on the Unity cluster has been approved.
You can access the management page for your group
-on this page.
+">on this page.
Do not hesitate to reply if you have any questions!
diff --git a/resources/mail/group_request_admin.php b/resources/mail/group_request_admin.php
index 8fe51027..96fefac4 100644
--- a/resources/mail/group_request_admin.php
+++ b/resources/mail/group_request_admin.php
@@ -19,6 +19,6 @@
You can approve this account
-here
+">here
.
diff --git a/resources/mail/group_user_added.php b/resources/mail/group_user_added.php
index 9c42b8cc..379ae751 100644
--- a/resources/mail/group_user_added.php
+++ b/resources/mail/group_user_added.php
@@ -6,7 +6,7 @@
Hello,
You have been approved to join the PI group .
-Navigate to the my groups
+Navigate to the ">my groups
page to see your PI groups.
If you believe this to be a mistake, please reply to this email as soon as possible.
diff --git a/resources/mail/group_user_request_owner.php b/resources/mail/group_user_request_owner.php
index 9ad4db55..9c32b1e4 100644
--- a/resources/mail/group_user_request_owner.php
+++ b/resources/mail/group_user_request_owner.php
@@ -22,4 +22,4 @@
You can approve or deny this user on the
- my users page
+ ">my users page
diff --git a/resources/mail/user_loginshell.php b/resources/mail/user_loginshell.php
index c21337dd..4197b9e1 100644
--- a/resources/mail/user_loginshell.php
+++ b/resources/mail/user_loginshell.php
@@ -7,6 +7,6 @@
You have updated your login shell on the Unity cluster to .
You can view the login shell settings on the
-account settings page
+">account settings page
If you believe this to be a mistake, please reply to this email as soon as possible.
diff --git a/resources/mail/user_qualified.php b/resources/mail/user_qualified.php
index 512930c3..4241bf28 100644
--- a/resources/mail/user_qualified.php
+++ b/resources/mail/user_qualified.php
@@ -15,6 +15,6 @@
Please login to the web portal to access Unity.
If you need console access, you will need to set your SSH keys in the
- account settings page.
+ ">account settings page.
If you believe this to be a mistake, please reply to this email as soon as possible.
diff --git a/resources/mail/user_sshkey.php b/resources/mail/user_sshkey.php
index 5a4a8076..20619c63 100644
--- a/resources/mail/user_sshkey.php
+++ b/resources/mail/user_sshkey.php
@@ -15,7 +15,7 @@
You can view the SSH public keys attached to your account on the
-account settings
+">account settings
page.
diff --git a/resources/templates/footer.php b/resources/templates/footer.php
index e5cd3d2c..66d1254d 100644
--- a/resources/templates/footer.php
+++ b/resources/templates/footer.php
@@ -10,7 +10,7 @@
for ($i = 0; $i < count($footer_logos); $i++) {
echo
"
-
";
}
?>
@@ -30,9 +30,9 @@