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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<?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.
$parsed = parse_url($uri);
$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;
}
} elseif ( str_contains($parsed['query'], 'ibr=y') ) {
$action = $lang->ibr;
}
$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;
}
?>
<!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"><?= t($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>
|