[Fusionforge-commits] r12677 - in trunk/src/plugins/oauthprovider: include www
Madhumita Dhar
mdhar at fusionforge.org
Fri Mar 11 12:13:59 CET 2011
Author: mdhar
Date: 2011-03-11 12:13:59 +0100 (Fri, 11 Mar 2011)
New Revision: 12677
Modified:
trunk/src/plugins/oauthprovider/include/access_token_api.php
trunk/src/plugins/oauthprovider/include/consumer_api.php
trunk/src/plugins/oauthprovider/include/oauthprovider_plugin.php
trunk/src/plugins/oauthprovider/include/request_token_api.php
trunk/src/plugins/oauthprovider/include/token_api.php
trunk/src/plugins/oauthprovider/www/access_token.php
trunk/src/plugins/oauthprovider/www/access_tokens.php
trunk/src/plugins/oauthprovider/www/consumer_create.php
trunk/src/plugins/oauthprovider/www/consumer_manage.php
trunk/src/plugins/oauthprovider/www/consumer_update_page.php
trunk/src/plugins/oauthprovider/www/request_tokens.php
Log:
fixes for the phpunit tests
Modified: trunk/src/plugins/oauthprovider/include/access_token_api.php
===================================================================
--- trunk/src/plugins/oauthprovider/include/access_token_api.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/include/access_token_api.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -61,7 +61,34 @@
$t_token->id = $t_row['id'];
return $t_token;
}
+
+ static function load( $p_id ) {
+ $row = parent::load($p_id, self::TOKEN_TYPE);
+ return self::row_to_new_token($row);
+ }
+
+ static function load_all($user_id=null) {
+ $rows = parent::load_all($user_id=null, self::TOKEN_TYPE);
+ $tokens = array();
+ foreach ($rows as $row) {
+ $token = self::row_to_new_token($row);
+
+ $tokens[] = $token;
+ }
+
+ return $tokens;
+ }
+
+ static function load_by_key( $p_token_key ) {
+ $row = parent::load_by_key($p_token_key, self::TOKEN_TYPE);
+ return self::row_to_new_token($row);
+ }
+
+ function delete() {
+ parent::delete(self::TOKEN_TYPE);
+ }
+
/**
* Loads tokens related to a particular consumer (and a particular user, if specified)
*
@@ -74,15 +101,12 @@
$DBSTORE = FFDbOAuthDataStore::singleton();
// this is a hack to retrieve the table name from the base class
- $CHILD_CLASS = get_called_class();
- $t_token_type = $CHILD_CLASS::TOKEN_TYPE;
-
- $t_rows = $DBSTORE->find_tokens_by_consumer($t_token_type, $consumer_id, $user_id);
+ $t_rows = $DBSTORE->find_tokens_by_consumer(self::TOKEN_TYPE, $consumer_id, $user_id);
$t_tokens = array();
foreach ($t_rows as $t_row) {
- $t_token = $CHILD_CLASS::row_to_new_token($t_row);
+ $t_token = self::row_to_new_token($t_row);
$t_tokens[] = $t_token;
}
@@ -119,5 +143,4 @@
$this->id = $DBSTORE->save_access_token($this);
}
-};
-
+};
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/include/consumer_api.php
===================================================================
--- trunk/src/plugins/oauthprovider/include/consumer_api.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/include/consumer_api.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -254,4 +254,4 @@
}
- };
+ };
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/include/oauthprovider_plugin.php
===================================================================
--- trunk/src/plugins/oauthprovider/include/oauthprovider_plugin.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/include/oauthprovider_plugin.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -163,6 +163,4 @@
function account_menu( ) {
return array( '<a href="' . $gfplugins.'oauthprovider/www/access_tokens.php' . '">' . $plugin_oauthprovider_menu_account_summary. '</a>', );
}
-}
-
-?>
+}
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/include/request_token_api.php
===================================================================
--- trunk/src/plugins/oauthprovider/include/request_token_api.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/include/request_token_api.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -75,7 +75,34 @@
return $t_token;
}
+
+ static function load( $p_id ) {
+ $row = parent::load($p_id, self::TOKEN_TYPE);
+ return self::row_to_new_token($row);
+ }
+
+ static function load_all($user_id=null) {
+ $rows = parent::load_all($user_id=null, self::TOKEN_TYPE);
+ $tokens = array();
+ foreach ($rows as $row) {
+ $token = self::row_to_new_token($row);
+
+ $tokens[] = $token;
+ }
+
+ return $tokens;
+ }
+
+ static function load_by_key( $p_token_key ) {
+ $row = parent::load_by_key($p_token_key, self::TOKEN_TYPE);
+ return self::row_to_new_token($row);
+ }
+
+ function delete() {
+ parent::delete(self::TOKEN_TYPE);
+ }
+
/**
* Saves the token properly to the DB (insert or update with proper columns)
*/
@@ -99,5 +126,4 @@
}
-};
-
+};
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/include/token_api.php
===================================================================
--- trunk/src/plugins/oauthprovider/include/token_api.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/include/token_api.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -92,45 +92,28 @@
*
* @param int $p_id
*/
- static function load( $p_id ) {
+ static function load( $p_id, $token_type ) {
$DBSTORE = FFDbOAuthDataStore::singleton();
- // this is a hack to retrieve the table name from the base class
- $CHILD_CLASS = get_called_class();
- $token_type = $CHILD_CLASS::TOKEN_TYPE;
-
- $t_row = $DBSTORE->find_token_from_id($token_type, $p_id);
+ $t_row = $DBSTORE->find_token_from_id($token_type, $p_id);
if(!$t_row) {
exit_error( "Error trying to load token!", 'oauthprovider' );
}
- // again a hackfor the dispatching of the values
- return $CHILD_CLASS::row_to_new_token($t_row);
+ return $t_row;
}
/**
* @param int $user_id
* @return Ambigous <multitype:, unknown>
*/
- static function load_all($user_id=null) {
+ static function load_all($user_id=null, $token_type) {
$DBSTORE = FFDbOAuthDataStore::singleton();
- $CHILD_CLASS = get_called_class();
- $token_type = $CHILD_CLASS::TOKEN_TYPE;
-
$t_rows = $DBSTORE->find_all_tokens($token_type, $user_id);
-
- $t_tokens = array();
-
- foreach ($t_rows as $t_row) {
- $t_token = $CHILD_CLASS::row_to_new_token($t_row);
-
- $t_tokens[] = $t_token;
- }
-
- return $t_tokens;
+ return $t_rows;
}
/**
@@ -139,20 +122,16 @@
* @param string $p_token_key
* @return OauthAuthzToken subclass
*/
- static function load_by_key( $p_token_key ) {
+ static function load_by_key( $p_token_key, $token_type ) {
$DBSTORE = FFDbOAuthDataStore::singleton();
-
- $CHILD_CLASS = get_called_class();
- $token_type = $CHILD_CLASS::TOKEN_TYPE;
-
+
$t_row = $DBSTORE->find_token_from_key($token_type, $p_token_key);
if(!$t_row) {
exit_error( "Error trying to load ".$token_type." token!", 'oauthprovider' );
}
- // again a hackfor the dispatching of the values
- return $CHILD_CLASS::row_to_new_token($t_row);
+ return $t_row;
}
/**
@@ -167,13 +146,10 @@
/**
* @param int $p_id
*/
- function delete() {
+ function delete($token_type) {
$DBSTORE = FFDbOAuthDataStore::singleton();
-
- $CHILD_CLASS = get_called_class();
- $token_type = $CHILD_CLASS::TOKEN_TYPE;
-
+
$DBSTORE->delete_token( $token_type, $this->id);
}
Modified: trunk/src/plugins/oauthprovider/www/access_token.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/access_token.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/access_token.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -28,9 +28,9 @@
require_once('../../env.inc.php');
require_once $gfwww.'include/pre.php';
//require_once 'checks.php';
-if (!session_loggedin()) {
+/*if (!session_loggedin()) {
exit_not_logged_in();
- }
+ }*/
try {
$oauthprovider_server = new OAuthServer(FFDbOAuthDataStore::singleton());
@@ -52,4 +52,4 @@
die();
}
-?>
+?>
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/www/access_tokens.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/access_tokens.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/access_tokens.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -59,8 +59,4 @@
echo $HTML->listTableBottom();
-site_project_footer(array());
-
-
-
-
+site_project_footer(array());
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/www/consumer_create.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/consumer_create.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/consumer_create.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -61,7 +61,4 @@
form_release_key(getStringFromRequest('plugin_oauthprovider_consumer_create_token'));
session_redirect( '/plugins/'.$pluginname.'/consumer.php?type='.$type.'&id='.$id.'&pluginname='.$pluginname);
- }
-
-
-
+ }
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/www/consumer_manage.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/consumer_manage.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/consumer_manage.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -101,6 +101,4 @@
<?php
//html_page_bottom1( __FILE__ );
-site_project_footer(array());
-
-
+site_project_footer(array());
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/www/consumer_update_page.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/consumer_update_page.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/consumer_update_page.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -88,6 +88,4 @@
<?php
//html_page_bottom1( __FILE__ );
-site_project_footer(array());
-
-
+site_project_footer(array());
\ No newline at end of file
Modified: trunk/src/plugins/oauthprovider/www/request_tokens.php
===================================================================
--- trunk/src/plugins/oauthprovider/www/request_tokens.php 2011-03-11 11:03:37 UTC (rev 12676)
+++ trunk/src/plugins/oauthprovider/www/request_tokens.php 2011-03-11 11:13:59 UTC (rev 12677)
@@ -73,9 +73,4 @@
echo $HTML->listTableBottom();
//html_page_bottom1( __FILE__ );
-site_project_footer(array());
-
-
-
-
-
+site_project_footer(array());
\ No newline at end of file
More information about the Fusionforge-commits
mailing list