3 // TODO : copyright header missing
5 require_once '../../env.inc.php';
6 require_once 'checks.php';
8 oauthconsumer_CheckUser();
10 $userid = session_get_user()->getID();
11 $providers = OAuthProvider::get_all_oauthproviders();
12 if(count($providers)>0) {
13 echo '<p>'. _('This OAuth Consumer plugin allows a user to connect to different oauth enabled services.').'</p>';
14 echo '<h4>'._('Accessing resources with OAuth').'</h4>';
16 <form action="index.php" method="post">
17 <?php echo _('<b>Providers</b>');
18 $f_provider_id = getStringFromPost('providers');?>
19 <select name=providers>
20 <?php foreach ($providers as $provider) {
21 echo '<option value="'.$provider->get_id().'" ';
22 if($provider->get_id()==$f_provider_id) {
25 echo '>'.$provider->get_name().'</option>';
28 <input type="submit" value="<?php echo _('Select') ?>"/>
33 $access_tokens = OAuthAccessToken::get_all_access_tokens_by_provider($f_provider_id, $userid);
34 if(count($access_tokens)>0) {
36 <form action="response.php" method="post">
37 <table class="width50" align="center" cellspacing="1">
40 <td class="category"><?php echo _('Access Tokens');?></td>
41 <td><select name=tokens>
42 <?php foreach ($access_tokens as $token) {
43 echo '<option value="'.$token->get_id().'">'.$token->get_token_key().'</option>';
49 <td class="category"><?php echo _('Resource URL') ?></td>
50 <td><input name="resource_url" maxlength="250" size="60" value=""/></td>
54 <td class="category"><?php echo _('HTTP Request');?></td>
55 <td><select name=http>
56 <option value="get">GET</option>
57 <option value="post">POST</option>
62 <td class="category"><?php echo _('POST data') ?></td>
63 <td><input name="post_data" maxlength="250" size="60" value=""/></td>
67 <td class="center" colspan="2"><input type="submit" value="<?php echo _('Go') ?>"/></td>
77 echo '<p>'. _('No access tokens have been created for this provider').'</p>';
81 echo '<p>'. _('There are no OAuth Providers registered in the database currently. Please ask your forge administer to create one.').'</p>';
84 echo'<br><br><p>'._("If no OAuth Providers or Access Tokens have been created yet, follow the links below to get started").'</p>';
86 echo util_make_link('/plugins/'.$pluginname.'/providers.php', _('OAuth Providers')). ' <br />';
87 echo util_make_link('/plugins/'.$pluginname.'/get_access_token.php', _('Get Access tokens')).'<br /> ';
88 echo util_make_link('/plugins/'.$pluginname.'/access_tokens.php', _('Access tokens')).'<br /> ';
90 site_user_footer(array());