This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor tweaks; added sample for "flattr" resource
- Loading branch information
Showing
6 changed files
with
122 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
<?php | |||
require_once __DIR__ . '/../bootstrap.php'; | |||
|
|||
if ( empty($_SESSION['access_token']) ) { | |||
header('index.php'); | |||
exit; | |||
} | |||
|
|||
$thingIdList= array('466757','465172','467437'); | |||
|
|||
$client = new OAuth2Client( ConfigFlattr::all(array('access_token' => $_SESSION['access_token'])) ); | |||
|
|||
if (!empty($_GET['thing_url'])) | |||
{ | |||
$thingUrl = $_GET['thing_url']; | |||
echo "will try to flattr ".$thingUrl; | |||
$response = Oauth2Client::parseResponse($client->post('/flattr', array('url' => $thingUrl))); | |||
var_dump($response); | |||
exit; | |||
} | |||
|
|||
$profile = $client->getParsed('/user'); | |||
|
|||
$things = array(); | |||
foreach($thingIdList as $thingId) { | |||
$things[] = $client->getParsed('/things/'.$thingId); | |||
} | |||
?> | |||
<a href="/index.php?logout=true">logout</a> | |||
<a href="/authenticated_calls.php">profile</a> | |||
<a href="/submit.php">submit new thing</a> | |||
<h1>Authenticated as as <?php echo h($profile['username'])?> </h1> | |||
<hr/> | |||
|
|||
<?php foreach($things as $thing) { ?> | |||
<div> | |||
<?php if ($thing['flattred']) { ?> | |||
<?php echo h($thing['url'])?> is already flattred by the authenticated user | |||
<?php } else { ?> | |||
<a href="/flattr.php?thing_url=<?php echo h($thing['url'])?>">flattr <?php echo h($thing['title'])?></a> | |||
<?php } ?> | |||
</div> | |||
<?php } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters