From f1ca94ea028b5dbc35e749c3490dcc2228df82ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Fri, 21 Aug 2009 07:45:36 +0000
Subject: [PATCH] Fix readline for OAuth demo

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1705 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/oauth/bin/demo.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/oauth/bin/demo.php b/modules/oauth/bin/demo.php
index ee455bdc0..34c813bcd 100755
--- a/modules/oauth/bin/demo.php
+++ b/modules/oauth/bin/demo.php
@@ -1,6 +1,12 @@
 #!/usr/bin/env php
 <?php
 
+
+function readline($prompt = '') {
+    echo $prompt;
+    return rtrim( fgets( STDIN ), "\n" );
+}
+
 /* This is the base directory of the simpleSAMLphp installation. */
 $baseDir = dirname(dirname(dirname(dirname(__FILE__))));
 
@@ -27,8 +33,7 @@ $url = $consumer->getAuthorizeRequest($baseurl . '/module.php/oauth/authorize.ph
 echo('Go to this URL to authenticate/authorize the request: ' . $url . "\n");
 system('open ' . $url);
 
-echo('Waiting 15 seconds for you to complete the authorization...' . "\n");
-sleep(15);
+readline('Click enter when you have completed the authorization step using your web browser...');
 
 // Replace the request token with an access token
 $accessToken = $consumer->getAccessToken( $baseurl . '/module.php/oauth/accessToken.php', $requestToken);
-- 
GitLab