mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
first cut at script old clients will see responding to new-style invitations
This commit is contained in:
parent
e16245d19e
commit
dd882ba9d4
1 changed files with 94 additions and 0 deletions
94
xwords4/android/scripts/and_index.php
Normal file
94
xwords4/android/scripts/and_index.php
Normal file
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
$g_androidStrings = array( "android", );
|
||||
$g_apk = 'XWords4-release_android_beta_55-39-gbffb231.apk';
|
||||
|
||||
function printHead() {
|
||||
print <<<EOF
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/xw4mobile.css" />
|
||||
<title>Crosswords Invite redirect</title>
|
||||
</head>
|
||||
<body>
|
||||
<p><em>UNDER CONSTRUCTION -- certain assumptions will go away before the next version ships</em></p>
|
||||
|
||||
<img src="../icon48x48.png"/>
|
||||
EOF;
|
||||
}
|
||||
|
||||
function printTail() {
|
||||
print <<<EOF
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
}
|
||||
|
||||
function printNonAndroid() {
|
||||
$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
|
||||
<p>Please open the link that sent you here on an Android device.</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>
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
function printAndroid() {
|
||||
print <<<EOF
|
||||
<p>Hello Kati, Chris, Mana, Deb, and maybe Brynn,</p>
|
||||
|
||||
<p>You'll have come here after clicking a link in an invite
|
||||
email. But you should not be seeing this page.</p>
|
||||
|
||||
<p>If you got this page on your device, it means either
|
||||
<ul>
|
||||
<li> you haven't installed a copy of Crosswords built after Nov. 25</li>
|
||||
<li> OR </li>
|
||||
<li> that you have, and when you clicked on the link and were asked to
|
||||
choose between a browser and Crosswords you chose the browser.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>In the first
|
||||
case, <a href="http://eehouse.org/xw4/android/$g_apk">download
|
||||
and install the latest Crosswords</a>. Then go back to the invite
|
||||
email (or text) and tap the link again.</p>
|
||||
|
||||
<p>In the second, hit your back button, click the link in your invite
|
||||
email (or text) again, and this time choose Crosswords.</p>
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Main()
|
||||
**********************************************************************/
|
||||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$onAndroid = false;
|
||||
for ( $ii = 0; $ii < count($g_androidStrings) && !$onAndroid; ++$ii ) {
|
||||
$needle = $g_androidStrings[$ii];
|
||||
$onAndroid = false !== stripos( $agent, $needle );
|
||||
}
|
||||
$onFire = false !== stripos( $agent, 'silk' );
|
||||
|
||||
printHead();
|
||||
if ( /*true || */ $onFire || $onAndroid ) {
|
||||
printAndroid();
|
||||
} else {
|
||||
printNonAndroid();
|
||||
}
|
||||
printTail();
|
||||
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue