about summary refs log tree commit diff
path: root/index.php
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2022-06-06 19:52:36 +0000
committerZach DeCook <zachdecook@librem.one>2022-06-06 19:52:36 +0000
commitdd106c063b84060dd158cd5d3b79f4ac3a15eecc (patch)
tree5e565f79f6be7e96a81ed4a92456243e5f328bc3 /index.php
parent7c1b0f6ec2733ba82a89c1488618ec77d8a16067 (diff)
downloadphp-xmpp-invitation-dd106c063b84060dd158cd5d3b79f4ac3a15eecc.tar.gz
URIs: Add register URIs
Diffstat (limited to 'index.php')
-rw-r--r--index.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/index.php b/index.php
index b7a0024..6b37a18 100644
--- a/index.php
+++ b/index.php
@@ -22,13 +22,23 @@
 	$action = $lang->chat;
 	if ( str_contains($uri, '?join') ) {
 		$action = $lang->muc;
+	} elseif ( str_contains($uri, '?register;') ) {
+		$action = $lang->register;
+		if ( str_contains($uri, "@") ) {
+			$action = $lang->register_name;
+		}
 	}
-	$name = ucfirst(explode("@", substr($uri, 5))[0]);
+	$parsed = parse_url($uri);
+	$name = explode("@", $parsed['path'])[0];
+	$server = explode("@", $parsed['path'])[1] ?? $name;
 	function t($template) {
 		GLOBAL $name;
 		GLOBAL $os;
+		GLOBAL $server;
 		$template = str_replace('{{name}}', $name, $template);
+		$template = str_replace('{{Name}}', ucfirst($name), $template);
 		$template = str_replace('{{os}}', $os, $template);
+		$template = str_replace('{{server}}', $server, $template);
 		return $template;
 	}
 ?>