Skip to content

Commit

Permalink
Allow iPhone users to request vcard via email rather than directly do…
Browse files Browse the repository at this point in the history
…wnloading (which they can't do)
  • Loading branch information
NeilCrosby committed Nov 21, 2009
1 parent a9c4261 commit 66605d7
Show file tree
Hide file tree
Showing 4 changed files with 1,943 additions and 1 deletion.
16 changes: 15 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,21 @@ public function toString( $userPasscode = null ) {
: '';
$page = $_SERVER['REQUEST_URI'];
$joiner = ('/' == substr($page, -1)) ? '?' : '&';
$url = "http://$server$port$page{$joiner}vcf=1";

// if we're on the iPhone go to the email page
if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
if ('/' == substr($page, -1)) {
$newPage = $page . 'via-email/';
} else {
$bits = explode('/', $page);
$queryString = array_pop($bits);
$newPage = implode('/', $bits).'/via-email/'.$queryString;
}
$url = "http://$server$port$newPage";
// otherwise go to the normal download page
} else {
$url = "http://$server$port$page{$joiner}vcf=1";
}

$success = '';
if ( isset( $_GET['passcode'] ) ) {
Expand Down
Loading

0 comments on commit 66605d7

Please sign in to comment.