123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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, 7) == 'xmpp%3a') {
- $uri = urldecode($uri);
- }
- 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>
|