about summary refs log tree commit diff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..4a126df
--- /dev/null
+++ b/index.php
@@ -0,0 +1,72 @@
+<?php
+	$uas = $_SERVER['HTTP_USER_AGENT'];
+	$os = "Linux";
+	if (str_contains($uas, "Windows")) {
+		$os = "Windows";
+	} elseif (str_contains($uas, "Android") || str_contains($uas, "CrOS")) {
+		$os = "Android";
+	} elseif (str_contains($uas, "iPad") || str_contains($uas, "iPhone")) {
+		$os = "iOS";
+	} elseif (str_contains($uas, "Mac OS X") || str_contains($uas, "Macintosh")) {
+		$os = "OSX";
+	} elseif (str_contains($uas, "Tizen")) {
+		$os = "Tizen";
+	}
+	$clients = json_decode(file_get_contents("clients_{$os}.json"));
+	$lang = json_decode(file_get_contents("lang/en.json"));
+	$uri = $_SERVER['QUERY_STRING'];
+	if ( substr($uri, 0, 5) != "xmpp:") {
+		$uri = "xmpp:" . $uri;
+	}
+	// TODO: Better invitation type detection.
+	$action = $lang->chat;
+	$name = ucfirst(explode("@", substr($uri, 5))[0]);
+	function t($template) {
+		GLOBAL $name;
+		return str_replace('{{name}}', $name, $template);
+	}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<meta content="IE=edge" http-equiv="X-UA-Compatible">
+	<meta content="width=device-width, initial-scale=1, user-scalable=0" name="viewport">
+	<title><?= t($action->title) ?></title>
+	<link href="stylesheets/styles.css" rel="stylesheet">
+	<link href="stylesheets/i.css" rel="stylesheet">
+	<style>
+		.main {
+			padding-top: 0px;
+			max-width: 600px;
+			width: 90%;
+			margin: 0 auto;
+		}
+	</style>
+</head>
+<body>
+	<div class="main">
+		<h3 class="text-center" id="heading"><?= t($action->heading) ?></h3>
+		<p class="text-center"><a class="btn btn-primary" id="button" href="<?= $uri ?>"><?= t($action->button)?></a></p>
+		<input type="url" class="form-control text-center" id="url_in" value="<?= $uri ?>" readonly/>
+		<!--div class="qrcode" id="qrcode">TODO</div-->
+
+		<p class="lead text-center" id="clients"><?= $lang->clients; ?></p>
+		<p class="lead text-center" id="recommend"><?= $lang->recommend; ?></p>
+
+		<p class="lead img-center text-center" id="client_list">
+			<?php
+			foreach ( $clients as $client ) {
+				echo $client;
+			}
+			?>
+		</p>
+
+		<i>
+			<p class="hint text-center" id="checkfulllist"><?= $lang->checkfulllist ?></p>
+			<p class="hint text-center" id="xmppis"><?= $lang->xmppis ?></p>
+		</i>
+		<p class="hint text-center" id="xmpp"></p>
+	</div>
+</body>
+</html>