stevenmaguire /
trello-php
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | require "../vendor/autoload.php"; |
||||||
| 4 | |||||||
| 5 | $currentUrl = (isset($_SERVER['HTTPS']) ? 'https' : 'http')."://".$_SERVER['HTTP_HOST'].preg_replace('/\?.*$/', '', $_SERVER["REQUEST_URI"]); |
||||||
| 6 | |||||||
| 7 | set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($currentUrl) { |
||||||
|
0 ignored issues
–
show
The parameter
$errfile is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$errstr is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 8 | if (E_RECOVERABLE_ERROR === $errno) { |
||||||
| 9 | header('Location: ' . $currentUrl); |
||||||
| 10 | } |
||||||
| 11 | |||||||
| 12 | return false; |
||||||
| 13 | }); |
||||||
| 14 | |||||||
| 15 | $client = new \Stevenmaguire\Services\Trello\Client(array( |
||||||
| 16 | 'key' => 'your-app-key', |
||||||
| 17 | 'secret' => 'your-app-secret', |
||||||
| 18 | 'name' => 'My sweet trello enabled app', |
||||||
| 19 | 'callbackUrl' => $currentUrl, |
||||||
| 20 | 'expiration' => '30days', |
||||||
| 21 | 'scope' => 'read,write', |
||||||
| 22 | )); |
||||||
| 23 | |||||||
| 24 | session_start(); |
||||||
| 25 | |||||||
| 26 | if (isset($_GET['oauth_token'], $_GET['oauth_verifier'])) { |
||||||
| 27 | |||||||
| 28 | try { |
||||||
| 29 | |||||||
| 30 | $credentials = $client->getAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']); |
||||||
| 31 | |||||||
| 32 | echo "<pre>"; |
||||||
| 33 | |||||||
| 34 | echo 'Access Token: ' . $credentials->getIdentifier() . "\n"; |
||||||
| 35 | |||||||
| 36 | echo 'Token Secret: ' . $credentials->getSecret() . "\n"; |
||||||
| 37 | |||||||
| 38 | echo "</pre>"; |
||||||
| 39 | |||||||
| 40 | } catch (Exception $e) { |
||||||
| 41 | |||||||
| 42 | header('Location: ' . $currentUrl); |
||||||
| 43 | |||||||
| 44 | } |
||||||
| 45 | |||||||
| 46 | } elseif (isset($_GET['auth'])) { |
||||||
| 47 | |||||||
| 48 | $authorizationUrl = $client->getAuthorizationUrl(); |
||||||
| 49 | |||||||
| 50 | header('Location: ' . $authorizationUrl); |
||||||
| 51 | |||||||
| 52 | } else { |
||||||
| 53 | |||||||
| 54 | echo '<a href="?auth=true">Authenticate</a>'; |
||||||
| 55 | |||||||
| 56 | } |
||||||
| 57 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.