OLD | NEW |
1 <?php | 1 <?php |
2 /** | 2 /** |
| 3 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 * |
3 * A "Hello world!" for the Chrome Web Store Licensing API, in PHP. This | 7 * A "Hello world!" for the Chrome Web Store Licensing API, in PHP. This |
4 * program logs the user in with Google's Federated Login API (OpenID), fetches | 8 * program logs the user in with Google's Federated Login API (OpenID), fetches |
5 * their license state with OAuth, and prints one of these greetings as | 9 * their license state with OAuth, and prints one of these greetings as |
6 * appropriate: | 10 * appropriate: |
7 * | 11 * |
8 * 1. This user has FREE_TRIAL access to this application ( appId: 1 ) | 12 * 1. This user has FREE_TRIAL access to this application ( appId: 1 ) |
9 * 2. This user has FULL access to this application ( appId: 1 ) | 13 * 2. This user has FULL access to this application ( appId: 1 ) |
10 * 3. This user has NO access to this application ( appId: 1 ) | 14 * 3. This user has NO access to this application ( appId: 1 ) |
11 * | 15 * |
12 * This code makes use of a popup ui extension to the OpenID protocol. Instead | 16 * This code makes use of a popup ui extension to the OpenID protocol. Instead |
13 * of the user being redirected to the Google login page, a popup window opens | 17 * of the user being redirected to the Google login page, a popup window opens |
14 * to the login page, keeping the user on the main application page. See | 18 * to the login page, keeping the user on the main application page. See |
15 * popuplib.js | 19 * popuplib.js |
16 * | 20 * |
17 * Copyright 2010 the Chromium Authors | |
18 * | |
19 * Use of this source code is governed by a BSD-style license that can be found | |
20 * in the "LICENSE" file. | |
21 * | |
22 * Eric Bidelman <ericbidelman@chromium.org> | 21 * Eric Bidelman <ericbidelman@chromium.org> |
23 */ | 22 */ |
24 | 23 |
25 session_start(); | 24 session_start(); |
26 | 25 |
27 require_once 'lib/oauth/OAuth.php'; | 26 require_once 'lib/oauth/OAuth.php'; |
28 require_once 'lib/lightopenid/openid.php'; | 27 require_once 'lib/lightopenid/openid.php'; |
29 | 28 |
30 // Full URL of the current application is running under. | 29 // Full URL of the current application is running under. |
31 $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ? 'http' : | 30 $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ? 'http' : |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 extensions: extensions | 279 extensions: extensions |
281 }); | 280 }); |
282 link.parentNode.appendChild( | 281 link.parentNode.appendChild( |
283 document.createTextNode('Authenticating...')); | 282 document.createTextNode('Authenticating...')); |
284 link.parentNode.removeChild(link); | 283 link.parentNode.removeChild(link); |
285 googleOpener.popup(w, h); | 284 googleOpener.popup(w, h); |
286 } | 285 } |
287 </script> | 286 </script> |
288 </body> | 287 </body> |
289 </html> | 288 </html> |
OLD | NEW |