2012-11-25 17:53:15 +01:00
|
|
|
<!-- -*- mode: sgml; -*- -->
|
2011-05-06 15:49:43 +02:00
|
|
|
<?php
|
|
|
|
|
2012-11-25 19:39:46 +01:00
|
|
|
$g_androidStrings = array( "android", );
|
2011-05-06 15:49:43 +02:00
|
|
|
|
|
|
|
$scheme = "newxwgame";
|
|
|
|
$host = "10.0.2.2";
|
|
|
|
$lang = $_REQUEST["lang"];
|
|
|
|
$room = $_REQUEST["room"];
|
2011-07-01 03:22:42 +02:00
|
|
|
$np = $_REQUEST["np"];
|
2011-12-21 02:14:21 +01:00
|
|
|
$id = $_REQUEST["id"];
|
2012-11-25 17:53:15 +01:00
|
|
|
$wl = $_REQUEST["wl"];
|
2011-12-21 02:14:21 +01:00
|
|
|
|
2012-11-25 19:39:46 +01:00
|
|
|
$agent = $_SERVER['HTTP_USER_AGENT'];
|
|
|
|
$onAndroid = false;
|
|
|
|
for ( $ii = 0; $ii < count($g_androidStrings) && !$onAndroid; ++$ii ) {
|
|
|
|
$needle = $g_androidStrings[$ii];
|
|
|
|
$onAndroid = 0 != stripos( $agent, $needle );
|
|
|
|
}
|
|
|
|
|
|
|
|
$localurl = "$scheme://$host?room=$room&lang=$lang&np=$np";
|
2011-12-21 02:14:21 +01:00
|
|
|
if ( $id != "" ) {
|
2012-11-25 19:39:46 +01:00
|
|
|
$localurl .= "&id=$id";
|
2011-12-21 02:14:21 +01:00
|
|
|
}
|
2012-11-25 17:53:15 +01:00
|
|
|
if ( $wl != "" ) {
|
2012-11-25 19:39:46 +01:00
|
|
|
$localurl .= "&wl=$wl";
|
2012-11-25 17:53:15 +01:00
|
|
|
}
|
2011-05-06 15:49:43 +02:00
|
|
|
|
2012-11-25 19:39:46 +01:00
|
|
|
if ( $onAndroid ) {
|
2011-05-06 15:49:43 +02:00
|
|
|
print <<<EOF
|
|
|
|
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
2012-03-31 19:03:14 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="/xw4mobile.css" />
|
2012-11-25 19:39:46 +01:00
|
|
|
<title>Crosswords Invite redirect</title>
|
2011-05-06 15:49:43 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2011-07-15 03:47:45 +02:00
|
|
|
|
|
|
|
<div align="center">
|
|
|
|
<img src="./icon48x48.png">
|
|
|
|
|
2012-11-25 19:39:46 +01:00
|
|
|
<h1><a href="$localurl">Tap this link to launch Crosswords with
|
|
|
|
your new game.</a>
|
|
|
|
</h1>
|
|
|
|
<p>If this fails it's probably because you don't have a new enough
|
|
|
|
version of Crosswords installed.
|
2011-07-15 03:47:45 +02:00
|
|
|
</p>
|
|
|
|
|
2012-11-25 17:53:15 +01:00
|
|
|
<img src="./icon48x48.png">
|
2011-07-15 03:47:45 +02:00
|
|
|
</div>
|
2011-06-10 03:30:59 +02:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
2011-05-06 15:49:43 +02:00
|
|
|
|
|
|
|
EOF;
|
2011-07-14 15:42:37 +02:00
|
|
|
|
2012-11-25 19:39:46 +01:00
|
|
|
} else {
|
|
|
|
$subject = "Android device not identified";
|
|
|
|
|
|
|
|
$body = htmlentities("My browser is running on an android device but"
|
|
|
|
. " says its user agent is: \"$agent\". Please fix your script to recognize"
|
|
|
|
. " this as an Android browser.");
|
|
|
|
|
|
|
|
print <<<EOF
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Crosswords Invite redirect</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div align="center">
|
|
|
|
<img src="./icon48x48.png">
|
|
|
|
</div>
|
|
|
|
<p>This page is meant to be viewed on a browser on your Android
|
|
|
|
device. Please open the email that sent you here on that device to
|
|
|
|
complete the invitation process.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>(If you <em>are</em> viewing this on an Android device, you've
|
|
|
|
found a bug! Please <a href="mailto:
|
|
|
|
xwords@eehouse.org?subject=$subject&body=$body">email me</a> (and be
|
|
|
|
sure to leave the user agent string in the email body.)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
EOF;
|
|
|
|
}
|
|
|
|
|
2011-05-06 15:49:43 +02:00
|
|
|
?>
|