You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/08/24 01:43:09 UTC

svn commit: r688431 - in /incubator/shindig/trunk/php: index.php src/gadgets/SigningFetcherFactory.php src/social-api/dataservice/PeopleHandler.php src/social-api/opensocial/model/Enum.php src/social-api/opensocial/model/Person.php

Author: chabotc
Date: Sat Aug 23 16:43:09 2008
New Revision: 688431

URL: http://svn.apache.org/viewvc?rev=688431&view=rev
Log:
Fixes a couple of test suite errors

Modified:
    incubator/shindig/trunk/php/index.php
    incubator/shindig/trunk/php/src/gadgets/SigningFetcherFactory.php
    incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php
    incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php
    incubator/shindig/trunk/php/src/social-api/opensocial/model/Person.php

Modified: incubator/shindig/trunk/php/index.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/index.php?rev=688431&r1=688430&r2=688431&view=diff
==============================================================================
--- incubator/shindig/trunk/php/index.php (original)
+++ incubator/shindig/trunk/php/index.php Sat Aug 23 16:43:09 2008
@@ -75,7 +75,8 @@
 		Config::get('web_prefix') . '/gadgets/ifr' => 'GadgetRenderingServlet', 
 		Config::get('web_prefix') . '/gadgets/metadata' => 'JsonRpcServlet', 
 		Config::get('web_prefix') . '/social/rest' => 'RestServlet', 
-		Config::get('web_prefix') . '/public.crt' => 'CertServlet'
+		Config::get('web_prefix') . '/public.crt' => 'CertServlet',
+		Config::get('web_prefix') . '/public.cer' => 'CertServlet'
 		);
 
 // Try to match the request url to our servlet mapping

Modified: incubator/shindig/trunk/php/src/gadgets/SigningFetcherFactory.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/SigningFetcherFactory.php?rev=688431&r1=688430&r2=688431&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/SigningFetcherFactory.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/SigningFetcherFactory.php Sat Aug 23 16:43:09 2008
@@ -44,7 +44,7 @@
 	 */
 	public function __construct($keyFile = null)
 	{
-		$this->keyName = 'http://' . $_SERVER["HTTP_HOST"] . Config::get('web_prefix') . '/public.crt';
+		$this->keyName = 'http://' . $_SERVER["HTTP_HOST"] . Config::get('web_prefix') . '/public.cer';
 		if (! empty($keyFile)) {
 			$privateKey = null;
 			try {

Modified: incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php?rev=688431&r1=688430&r2=688431&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php (original)
+++ incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php Sat Aug 23 16:43:09 2008
@@ -46,7 +46,16 @@
 			//FIXME same logic as the java code here, but doesn't seem to do much with the optionalPersonId which seems odd
 			return $this->service->getPerson($requestItem->getUser(), $requestItem->getGroup(), $fields, $requestItem->getToken());
 		}
-		return $this->service->getPeople($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getOrderBy(), $requestItem->getFilterBy(), $requestItem->getStartIndex(), $requestItem->getCount(), $fields, $requestItem->getNetworkDistance(), $requestItem->getToken());
+		$startIndex = $requestItem->getStartIndex();
+		$count = $requestItem->getCount();
+		$networkDistance = $requestItem->getNetworkDistance();
+		if ((!empty($startIndex) && !is_numeric($startIndex)) ||
+			(!empty($count) && !is_numeric($count)) ||
+			(!empty($networkDistance) && !is_numeric($networkDistance))) {
+			return new ResponseItem(BAD_REQUEST, "Invalid options specified", null);
+		} else {
+			return $this->service->getPeople($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getOrderBy(), $requestItem->getFilterBy(), $startIndex, $count, $fields, $networkDistance, $requestItem->getToken());
+		}
 	}
 
 	public function handleDelete(RestRequestItem $requestItem)

Modified: incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php?rev=688431&r1=688430&r2=688431&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php (original)
+++ incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php Sat Aug 23 16:43:09 2008
@@ -34,8 +34,13 @@
 	public function __construct($key, $displayValue = '')
 	{
 		//FIXME should add enum restriction checking to this
-		if (! isset($this->values[$key])) {
-			throw new Exception("Invalid Enum key");
+		if (! empty($key) && ! isset($this->values[$key])) {
+			if (in_array($key, $this->values)) {
+				// case of mixing key <> display value, correct it
+				$key = array_search($key, $this->values);
+			} else {
+				throw new Exception("Invalid Enum key");
+			}
 		}
 		$this->key = $key;
 		$this->displayValue = ! empty($displayValue) ? $displayValue : $this->values[$key];
@@ -75,6 +80,15 @@
 }
 
 /**
+ * public Enum for opensocial.Enum.LookingFor
+ */
+class EnumLookingFor extends Enum {
+	public $values = array('ACTIVITY_PARTNERS' => 'Activity Partners', 'DATING' => 'Dating', 
+			'FRIENDS' => 'Friends', 'NETWORKING' => 'Networking', 'RANDOM' => 'Random', 
+			'RELATIONSHIP' => 'Relationship');
+}
+
+/**
  * public Enum for opensocial.Enum.Smoker
  */
 class EnumSmoker extends Enum {

Modified: incubator/shindig/trunk/php/src/social-api/opensocial/model/Person.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/opensocial/model/Person.php?rev=688431&r1=688430&r2=688431&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/opensocial/model/Person.php (original)
+++ incubator/shindig/trunk/php/src/social-api/opensocial/model/Person.php Sat Aug 23 16:43:09 2008
@@ -356,7 +356,7 @@
 
 	public function setLookingFor($lookingFor)
 	{
-		$this->lookingFor = $lookingFor;
+		$this->lookingFor = new EnumLookingFor($lookingFor);
 	}
 
 	public function getMovies()