Skip to content

Commit ede219e

Browse files
committed
wip
1 parent 64f6836 commit ede219e

22 files changed

+41
-48
lines changed

resources/lib/UnityHTTPD.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function die(mixed $x = null, bool $show_user = false): never
4141
*/
4242
public static function redirect(?string $dest = null): never
4343
{
44-
$dest ??= pathJoin(CONFIG["site"]["prefix"], $_SERVER["REQUEST_URI"]);
44+
$dest ??= getURL($_SERVER["REQUEST_URI"]);
4545
$dest = htmlspecialchars($dest);
4646
header("Location: $dest");
4747
http_response_code(302);

resources/lib/UnityMailer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class UnityMailer extends PHPMailer
1313
private string $template_dir = __DIR__ . "/../mail"; // location of all email templates
1414
private string $override_template_dir = __DIR__ . "/../../deployment/mail_overrides";
1515

16-
private string $MSG_LINKREF;
1716
private string $MSG_SENDER_EMAIL;
1817
private string $MSG_SENDER_NAME;
1918
private string $MSG_SUPPORT_EMAIL;
@@ -28,7 +27,6 @@ public function __construct()
2827
parent::__construct();
2928
$this->isSMTP();
3029

31-
$this->MSG_LINKREF = CONFIG["site"]["url"] . CONFIG["site"]["prefix"];
3230
$this->MSG_SENDER_EMAIL = CONFIG["mail"]["sender"];
3331
$this->MSG_SENDER_NAME = CONFIG["mail"]["sender_name"];
3432
$this->MSG_SUPPORT_EMAIL = CONFIG["mail"]["support"];

resources/lib/UnityWebhook.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ class UnityWebhook
77
private string $template_dir = __DIR__ . "/../mail";
88
private string $override_template_dir = __DIR__ . "/../../deployment/mail_overrides";
99
private string $url = CONFIG["webhook"]["url"];
10-
private string $MSG_LINKREF;
1110
private string $Subject; // set by template
1211

13-
public function __construct()
14-
{
15-
$this->MSG_LINKREF = CONFIG["site"]["url"] . CONFIG["site"]["prefix"];
16-
}
1712
public function htmlToMarkdown(string $html): string
1813
{
1914
// Define regex patterns for each markdown format

resources/lib/utils.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,8 @@ function pathJoin()
8282
}
8383
return preg_replace("#/+#", "/", join("/", $paths));
8484
}
85+
86+
function getURL(...$args)
87+
{
88+
return pathJoin([CONFIG["site"]["url"], CONFIG["site"]["prefix"], ...$args]);
89+
}

resources/mail/footer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
>
44
<span>
55
You are receiving this email because you have an account
6-
on the <a target='_blank' href='<?php echo $this->MSG_LINKREF; ?>'>Unity Cluster</a>.
6+
on the <a target='_blank' href='<?php echo getURL("/"); ?>'>Unity Cluster</a>.
77
If you would like to stop receiving these emails,
88
you may request to close your account by replying to this email.
99
</span>

resources/mail/group_created.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<p>
99
Your request for a PI account on the Unity cluster has been approved.
1010
You can access the management page for your group
11-
<a href="<?php echo $this->MSG_LINKREF; ?>/panel/pi.php">on this page</a>.
11+
<a href="<?php echo getURL("panel/pi.php"); ?>">on this page</a>.
1212
</p>
1313

1414
<p>Do not hesitate to reply if you have any questions!</p>

resources/mail/group_request_admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
<p>
2121
You can approve this account
22-
<a href="<?php echo $this->MSG_LINKREF; ?>/admin/pi-mgmt.php">here</a>
22+
<a href="<?php echo getURL("admin/pi-mgmt.php"); ?>">here</a>
2323
.
2424
</p>

resources/mail/group_user_added.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<p>Hello,</p>
77

88
<p>You have been approved to join the PI group <?php echo $data["group"]; ?>.
9-
Navigate to the <a href="<?php echo $this->MSG_LINKREF; ?>/panel/groups.php">my groups</a>
9+
Navigate to the <a href="<?php echo getURL("panel/groups.php"); ?>">my groups</a>
1010
page to see your PI groups.</p>
1111

1212
<p>If you believe this to be a mistake, please reply to this email as soon as possible.</p>

resources/mail/group_user_request_owner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
</p>
2323

2424
<p>You can approve or deny this user on the
25-
<a href="<?php echo $this->MSG_LINKREF; ?>/panel/pi.php">my users</a> page</p>
25+
<a href="<?php echo getURL("panel/pi.php"); ?>">my users</a> page</p>

resources/mail/user_loginshell.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
<p>You have updated your login shell on the Unity cluster to <?php echo $data["new_shell"]; ?>.
99
You can view the login shell settings on the
10-
<a href="<?php echo $this->MSG_LINKREF; ?>/panel/account.php">account settings</a> page</p>
10+
<a href="<?php echo getURL("panel/account.php"); ?>">account settings</a> page</p>
1111

1212
<p>If you believe this to be a mistake, please reply to this email as soon as possible.</p>

0 commit comments

Comments
 (0)