Author: chabotc
Date: Mon Jan 12 03:29:13 2009
New Revision: 733691
URL: http://svn.apache.org/viewvc?rev=733691&view=rev
Log:
Sync fixes from trunk
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/common/sample/CacheApc.php
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MessageBundleParser.php
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MetadataHandler.php
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/oauth/OAuth.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuth.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/DataRequestHandler.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/RestRequestItem.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/ApiServlet.php
incubator/shindig/branches/1.0.x-incubating/php/test/gadgets/MessageBundleParserTest.php
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/common/sample/CacheApc.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/common/sample/CacheApc.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/common/sample/CacheApc.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/common/sample/CacheApc.php
Mon Jan 12 03:29:13 2009
@@ -87,6 +87,6 @@
}
public function delete($key) {
- @apc_delete($this->connection, $key);
+ @apc_delete($key);
}
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MessageBundleParser.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MessageBundleParser.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MessageBundleParser.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MessageBundleParser.php
Mon Jan 12 03:29:13 2009
@@ -32,7 +32,7 @@
return $this->getMessages($doc);
}
- public function getMessages(SimpleXMLElement $doc) {
+ public function getMessages($doc) {
if (! $doc) {
throw new Exception("Invalid XML structure in message bundle");
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MetadataHandler.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MetadataHandler.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MetadataHandler.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/MetadataHandler.php
Mon Jan 12 03:29:13 2009
@@ -65,6 +65,16 @@
foreach ($gadget->getIcons() as $icon) {
$icons[] = $icon;
}
+ $oauth = array();
+ $oauthspec = $gadget->getOAuthSpec();
+ if (! empty($oauthspec)) {
+ foreach ($oauthspec->getServices() as $oauthservice) {
+ $oauth[$oauthservice->getName()] = array(
+ "request" => $oauthservice->getRequestUrl(),
+ "access" => $oauthservice->getAccessUrl(),
+ "authorization" => $oauthservice->getAuthorizationUrl());
+ }
+ }
$response['author'] = $gadget->getAuthor();
$response['authorEmail'] = $gadget->getAuthorEmail();
$response['description'] = $gadget->getDescription();
@@ -95,6 +105,7 @@
$response['url'] = $gadgetUrl;
$response['iframeUrl'] = UrlGenerator::getIframeURL($gadget, $context);
$response['userPrefs'] = $prefs;
+ $response['oauth'] = $oauth;
return $response;
}
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/oauth/OAuth.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/oauth/OAuth.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
--- incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/oauth/OAuth.php
(original)
+++ incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/oauth/OAuth.php
Mon Jan 12 03:29:13 2009
@@ -220,7 +220,7 @@
}
class OAuthRequest {
- private $parameters;
+ public $parameters;
private $http_method;
private $http_url;
public $base_string;
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuth.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuth.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
--- incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuth.php
(original)
+++ incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuth.php
Mon Jan 12 03:29:13 2009
@@ -180,7 +180,7 @@
}
class OAuthRequest {
- private $parameters;
+ public $parameters;
private $http_method;
private $http_url;
// for debug purposes
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
Mon Jan 12 03:29:13 2009
@@ -399,6 +399,7 @@
if (! $totalResults) {
throw new SocialSpiException("Activity not found",
ResponseError::$NOT_FOUND);
}
+ $activities = array_slice($activities, $startIndex, $count);
$ret = new RestfulCollection($activities, $startIndex, $totalResults);
$ret->setItemsPerPage($count);
return $ret;
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/DataRequestHandler.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/service/DataRequestHandler.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/DataRequestHandler.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/DataRequestHandler.php
Mon Jan 12 03:29:13 2009
@@ -73,10 +73,10 @@
return $decoded;
}
- /*
- * To support people/@supportedFields and activity/@supportedFields
- * @param parameters url parameters to get request type(people/activity)
- */
+ /**
+ * To support people/@supportedFields and activity/@supportedFields
+ * @param parameters url parameters to get request type(people/activity)
+ */
public function getSupportedFields($parameters) {
$context = new GadgetContext('GADGET');
$container = $context->getContainer();
@@ -92,10 +92,10 @@
return new ResponseItem(null, null, $ret);
}
- /*
- * To get OpenSocial version fro getting supportedFields
- * @param config configuration values from container's js files
- */
+ /**
+ * To get OpenSocial version for getting supportedFields
+ * @param config configuration values from container's js files
+ */
private function getOpenSocialVersion($config) {
$str = "opensocial-";
$version = array();
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/RestRequestItem.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/service/RestRequestItem.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/RestRequestItem.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/service/RestRequestItem.php
Mon Jan 12 03:29:13 2009
@@ -22,8 +22,6 @@
* Represents the request items that come from the restful request.
*/
class RestRequestItem extends RequestItem {
-
- protected static $X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
private $url;
private $params;
private $inputConverter;
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/ApiServlet.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/ApiServlet.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/ApiServlet.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/ApiServlet.php
Mon Jan 12 03:29:13 2009
@@ -79,7 +79,6 @@
$appUrl = $request->get_parameter('oauth_consumer_key');
$userId = $request->get_parameter('xoauth_requestor_id'); // from Consumer
Request extension (2-legged OAuth)
$signature = $request->get_parameter('oauth_signature');
-
if ($appUrl && $signature) {
//if ($appUrl && $signature && $userId) {
// look up the user and perms for this oauth request
@@ -103,7 +102,6 @@
// accessable to anoymous users! Anonymous == owner = viewer = appId =
modId = 0
// create token with 0 values, no gadget url, no domain and 0 duration
-
//FIXME change this to a new AnonymousToken when reworking auth token
$gadgetSigner = Config::get('security_token');
return new $gadgetSigner(null, 0, 0, 0, 0, '', '', 0);
Modified:
incubator/shindig/branches/1.0.x-incubating/php/test/gadgets/MessageBundleParserTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/test/gadgets/MessageBundleParserTest.php?rev=733691&r1=733690&r2=733691&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/test/gadgets/MessageBundleParserTest.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/test/gadgets/MessageBundleParserTest.php
Mon Jan 12 03:29:13 2009
@@ -53,7 +53,6 @@
* Tests MessageBundleParser->parse()
*/
public function testParse() {
-
$xml = '<?xml version="1.0" encoding="UTF-8" ?>
<doc>
<msg name="name1">Message 1</msg>
@@ -69,6 +68,19 @@
$this->assertEquals('Message 3', $this->MessageBundle['name3']);
$this->assertEquals('Message 4', $this->MessageBundle['name4']);
}
-
+
+ /**
+ * Tests MessageBundleParser->parse() on error xml string.
+ */
+ public function testParseOnError() {
+ $xml = '<?xml version="1.0" encoding="UTF-8" ?>
+<doc>
+ <msg name="name1">Message 1</msg>
+ <msg name="name2">Message 2</msg>
+ <msg name="name3">Message 3</msg>
+ <msg name="name4">Message 4</msg>';
+ $this->setExpectedException('Exception');
+ $this->MessageBundle = $this->MessageBundleParser->parse($xml);
+ }
}