From dd882ba9d4ced47e0b5c5abd3a340a4ac2d95731 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 1 Dec 2012 09:34:21 -0800 Subject: [PATCH] first cut at script old clients will see responding to new-style invitations --- xwords4/android/scripts/and_index.php | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 xwords4/android/scripts/and_index.php diff --git a/xwords4/android/scripts/and_index.php b/xwords4/android/scripts/and_index.php new file mode 100644 index 000000000..e13137d26 --- /dev/null +++ b/xwords4/android/scripts/and_index.php @@ -0,0 +1,94 @@ + + + + + Crosswords Invite redirect + + +

UNDER CONSTRUCTION -- certain assumptions will go away before the next version ships

+ + +EOF; +} + +function printTail() { +print << + +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 <<Please open the link that sent you here on an Android device.

+ +

(If you are viewing this on an Android device, you've + found a bug! Please email me (and be + sure to leave the user agent string in the email body.) +

+ +EOF; +} + +function printAndroid() { +print <<Hello Kati, Chris, Mana, Deb, and maybe Brynn,

+ +

You'll have come here after clicking a link in an invite + email. But you should not be seeing this page.

+ +

If you got this page on your device, it means either +

    +
  • you haven't installed a copy of Crosswords built after Nov. 25
  • +
  • OR
  • +
  • that you have, and when you clicked on the link and were asked to + choose between a browser and Crosswords you chose the browser.
  • +

+ +

In the first +case, download +and install the latest Crosswords. Then go back to the invite +email (or text) and tap the link again.

+ +

In the second, hit your back button, click the link in your invite +email (or text) again, and this time choose Crosswords.

+ +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(); + + +?>