debug
This commit is contained in:
parent
041a776302
commit
4839b71521
47
identification.php
Normal file
47
identification.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
class adherent
|
||||
{
|
||||
protected $idAdherent;
|
||||
protected $nom;
|
||||
protected $prenom;
|
||||
protected $req_url = 'https://librepc.com:10081/cloud/apps/oauth2/api/v1/token';
|
||||
protected $authurl = 'https://librepc.com:10081/cloud/apps/oauth2/authorize';
|
||||
//protected $acc_url = 'https://fireeagle.yahooapis.com/oauth/access_token';
|
||||
//protected $api_url = 'https://fireeagle.yahooapis.com/api/0.1';
|
||||
protected $conskey = 'your_consumer_key';
|
||||
protected $conssec = 'your_consumer_secret';
|
||||
|
||||
function identification($idAdherent)
|
||||
{
|
||||
// En état state=1 la prochaine requete doit inclure le oauth_token.
|
||||
// Si ce n'est pas le cas, retour à 0
|
||||
if(!isset($_GET['oauth_token']) && $_SESSION['state']==1) $_SESSION['state'] = 0;
|
||||
try
|
||||
{
|
||||
$oauth = new OAuth($conskey,$conssec,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
|
||||
$oauth->enableDebug();
|
||||
if(!isset($_GET['oauth_token']) && !$_SESSION['state']) {
|
||||
$request_token_info = $oauth->getRequestToken($req_url);
|
||||
$_SESSION['secret'] = $request_token_info['oauth_token_secret'];
|
||||
$_SESSION['state'] = 1;
|
||||
header('Location: '.$authurl.'?oauth_token='.$request_token_info['oauth_token']);
|
||||
exit;
|
||||
} else if($_SESSION['state']==1) {
|
||||
$oauth->setToken($_GET['oauth_token'],$_SESSION['secret']);
|
||||
$access_token_info = $oauth->getAccessToken($acc_url);
|
||||
$_SESSION['state'] = 2;
|
||||
$_SESSION['token'] = $access_token_info['oauth_token'];
|
||||
$_SESSION['secret'] = $access_token_info['oauth_token_secret'];
|
||||
}
|
||||
$oauth->setToken($_SESSION['token'],$_SESSION['secret']);
|
||||
$oauth->fetch("$api_url/user.json");
|
||||
$json = json_decode($oauth->getLastResponse());
|
||||
print_r($json);
|
||||
} catch(OAuthException $E)
|
||||
{
|
||||
print_r($E);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -83,7 +83,7 @@ function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les v
|
||||
print "<pre>";
|
||||
foreach($votations as $key => $value )
|
||||
{
|
||||
print '<input type="radio" name="idVotation" value="' . $value["id"] . '"/> ' . $value["titre"] . ' :' . $value["libelle"] . '<br>';
|
||||
print '<input type="radio" name="id" value="' . $value["id"] . '"/> ' . $value["titre"] . ' :' . $value["libelle"] . '<br>';
|
||||
}
|
||||
// TODO confirmation du choix par javascript si $confirm = true
|
||||
|
||||
|
@ -22,12 +22,13 @@ print ("<table>");
|
||||
foreach($votationsList as $votation)
|
||||
{
|
||||
print("<tr><td>");
|
||||
print('<a href="' . $vote_url . 'vote.form.php?v=' . $votation["id"] . '">' . $votation["libelle"] . '</a></td><td>');
|
||||
print('<a href="' . $vote_url . 'vote.resultat.php?v=' . $votation["id"] . '">' . $votation["libelle"] . '</a></td><td>');
|
||||
if ($votation["status"] == 1)
|
||||
{
|
||||
print(_("Cloturé"));
|
||||
}else
|
||||
{
|
||||
print('<a href="' . $vote_url . 'vote.form.php?v=' . $votation["id"] . '">' . $votation["libelle"] . '</a></td><td>');
|
||||
print(_("En cours"));
|
||||
}
|
||||
print('</td></tr>');
|
||||
|
Reference in New Issue
Block a user