1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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>
|