Author: chabotc
Date: Wed Dec 10 16:37:37 2008
New Revision: 725500
URL: http://svn.apache.org/viewvc?rev=725500&view=rev
Log:
Sync up with fixes on trunk
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/ProxyHandler.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputAtomConverter.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputBasicXmlConverter.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputXmlConverter.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuthSecurityToken.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/src/social/servlet/DataServiceServlet.php
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/JsonRpcServlet.php
incubator/shindig/branches/1.0.x-incubating/php/test/ShindigAllTests.php
incubator/shindig/branches/1.0.x-incubating/php/test/index.php
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/ProxyHandler.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/ProxyHandler.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/ProxyHandler.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/gadgets/ProxyHandler.php
Wed Dec 10 16:37:37 2008
@@ -281,7 +281,8 @@
// filter out headers that would otherwise mess up our output
if (strcasecmp($key, "Transfer-Encoding") != 0 && strcasecmp($key,
"Cache-Control") != 0 && strcasecmp($key, "Expires") != 0 && strcasecmp($key,
"Content-Length") != 0 && strcasecmp($key, "ETag") != 0) {
header("$key: $val");
- } elseif ($key == 'Content-Type' && $val ==
'application/x-shockwave-flash') {
+ }
+ if ($key == 'Content-Type' && $val ==
'application/x-shockwave-flash') {
// We're skipping the content disposition header for flash due to
an issue with Flash player 10
// This does make some sites a higher value phishing target, but
this can be mitigated by
// additional referer checks.
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputAtomConverter.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputAtomConverter.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputAtomConverter.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputAtomConverter.php
Wed Dec 10 16:37:37 2008
@@ -115,7 +115,7 @@
$this->addNode($entry, 'updated', $updatedAtom);
$content = $this->addNode($entry, 'content', '', array('type' =>
'application/xml'));
// addData loops through the responseItem data recursively creating a
matching XML structure
- $this->addData($content, $requestType, $data, self::$osNameSpace);
+ $this->addData($content, $requestType, $data['entry'],
self::$osNameSpace);
}
$xml = $doc->saveXML();
if ($responseItem->getResponse() instanceof RestfulCollection) {
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputBasicXmlConverter.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputBasicXmlConverter.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputBasicXmlConverter.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputBasicXmlConverter.php
Wed Dec 10 16:37:37 2008
@@ -30,7 +30,7 @@
* @param array $entryTypes the map of entries
* @return string the request type
*/
- public function getRequestType($requestItem, $entryTypes) {
+ public static function getRequestType($requestItem, $entryTypes) {
// map the Request URL to the content type to use
$params = $requestItem->getParameters();
if (! is_array($params)) {
@@ -60,7 +60,7 @@
* @param string $nameSpace optional namespace to use when creating node
* @return DOMElement node
*/
- public function addNode(DOMDocument $doc, DOMElement $node, $name, $value =
'', $attributes = false, $nameSpace = false) {
+ public static function addNode(DOMDocument $doc, $node, $name, $value = '',
$attributes = false, $nameSpace = false) {
if ($nameSpace) {
$childNode = $node->appendChild($doc->createElementNS($nameSpace,
$name));
} else {
@@ -90,7 +90,7 @@
* @param string $nameSpace if specified, the node is created using this
namespace
* @return DOMElement returns newly created element
*/
- public function addData(DOMDocument $doc, DOMElement $element, $name, $data,
$nameSpace = false) {
+ public static function addData(DOMDocument $doc, DOMElement $element, $name,
$data, $nameSpace = false) {
if ($nameSpace) {
$newElement = $element->appendChild($doc->createElementNS($nameSpace,
$name));
} else {
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputXmlConverter.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputXmlConverter.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputXmlConverter.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/converters/OutputXmlConverter.php
Wed Dec 10 16:37:37 2008
@@ -60,7 +60,7 @@
// Single entry = Xml:Entry
$entry = $this->addNode($doc, 'response', '');
// addData loops through the responseItem data recursively creating a
matching XML structure
- $this->addData($entry, $requestType, $data);
+ $this->addData($entry, 'entry', $data['entry']);
}
$xml = $doc->saveXML();
echo $xml;
@@ -79,7 +79,7 @@
* @param array $attributes optional array of attributes, false by default.
If set attributes are added to the node using the key => val pairs
* @return DOMElement node
*/
- private function addNode(DOMElement $node, $name, $value = '', $attributes =
false) {
+ private function addNode($node, $name, $value = '', $attributes = false) {
return OutputBasicXmlConverter::addNode($this->doc, $node, $name, $value,
$attributes);
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuthSecurityToken.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuthSecurityToken.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuthSecurityToken.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/oauth/OAuthSecurityToken.php
Wed Dec 10 16:37:37 2008
@@ -35,7 +35,7 @@
}
public function isAnonymous() {
- return ($this->userId != null);
+ return ($this->userId == null);
}
public function getOwnerId() {
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=725500&r1=725499&r2=725500&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
Wed Dec 10 16:37:37 2008
@@ -115,7 +115,7 @@
$params = explode('&', $val);
foreach ($params as $param) {
$queryParams = explode('=', $param);
- $this->params[$queryParams[0]] = $queryParams[1];
+ $this->params[$queryParams[0]] = isset($queryParams[1]) ?
$queryParams[1] : '';
}
}
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=725500&r1=725499&r2=725500&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
Wed Dec 10 16:37:37 2008
@@ -54,7 +54,7 @@
/**
* Common base class for API servlets.
*/
-abstract class ApiServlet {
+abstract class ApiServlet extends HttpServlet {
protected $handlers = array();
protected static $DEFAULT_ENCODING = "UTF-8";
@@ -65,6 +65,7 @@
public static $MESSAGE_ROUTE = "messages";
public function __construct() {
+ parent::__construct();
$this->handlers[self::$PEOPLE_ROUTE] = new PersonHandler();
$this->handlers[self::$ACTIVITY_ROUTE] = new ActivityHandler();
$this->handlers[self::$APPDATA_ROUTE] = new AppDataHandler();
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/DataServiceServlet.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/DataServiceServlet.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/DataServiceServlet.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/DataServiceServlet.php
Wed Dec 10 16:37:37 2008
@@ -1,4 +1,5 @@
<?php
+
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -135,10 +136,13 @@
$outputFormat = strtolower(trim(! empty($_POST[self::$FORMAT_PARAM]) ?
$_POST[self::$FORMAT_PARAM] : (! empty($_GET[self::$FORMAT_PARAM]) ?
$_GET[self::$FORMAT_PARAM] : 'json')));
switch ($outputFormat) {
case 'xml':
+ if (Config::get('debug')) $this->setContentType('application/xml');
return new OutputXmlConverter();
case 'atom':
+ if (Config::get('debug'))
$this->setContentType('application/atom+xml');
return new OutputAtomConverter();
case 'json':
+ if (Config::get('debug')) $this->setContentType('application/json');
return new OutputJsonConverter();
default:
// if no output format is set, see if we can match an input format
header
@@ -146,11 +150,14 @@
if (isset($_SERVER['CONTENT_TYPE'])) {
switch ($_SERVER['CONTENT_TYPE']) {
case 'application/atom+xml':
+ if (Config::get('debug'))
$this->setContentType('application/atom+xml');
return new OutputAtomConverter();
case 'application/xml':
+ if (Config::get('debug'))
$this->setContentType('application/xml');
return new OutputXmlConverter();
default:
case 'application/json':
+ if (Config::get('debug'))
$this->setContentType('application/json');
return new OutputJsonConverter();
}
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/JsonRpcServlet.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/JsonRpcServlet.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/JsonRpcServlet.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/servlet/JsonRpcServlet.php
Wed Dec 10 16:37:37 2008
@@ -29,7 +29,7 @@
*/
public function doGet() {
$token = $this->getSecurityToken();
- if (token == null) {
+ if ($token == null) {
$this->sendSecurityError();
return;
}
Modified:
incubator/shindig/branches/1.0.x-incubating/php/test/ShindigAllTests.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/test/ShindigAllTests.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
--- incubator/shindig/branches/1.0.x-incubating/php/test/ShindigAllTests.php
(original)
+++ incubator/shindig/branches/1.0.x-incubating/php/test/ShindigAllTests.php
Wed Dec 10 16:37:37 2008
@@ -47,7 +47,7 @@
set_include_path(get_include_path() . PATH_SEPARATOR . realpath('./php') .
PATH_SEPARATOR . realpath('./php/external'));
ini_set('error_reporting', E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
-require_once 'config.php';
+require_once 'src/common/Config.php';
require_once 'test/TestContext.php';
if (defined('PHPUnit_MAIN_METHOD') === false) {
@@ -80,4 +80,4 @@
if (PHPUnit_MAIN_METHOD === 'ShindigAllTests::main') {
ShindigAllTests::main();
-}
\ No newline at end of file
+}
Modified: incubator/shindig/branches/1.0.x-incubating/php/test/index.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/test/index.php?rev=725500&r1=725499&r2=725500&view=diff
==============================================================================
--- incubator/shindig/branches/1.0.x-incubating/php/test/index.php (original)
+++ incubator/shindig/branches/1.0.x-incubating/php/test/index.php Wed Dec 10
16:37:37 2008
@@ -23,7 +23,7 @@
require_once "PHPUnit/Framework/TestSuite.php";
require_once "PHPUnit/TextUI/TestRunner.php";
-require_once realpath('../') . "/config.php";
+require_once realpath('../') . "/src/common/Config.php";
require_once realpath('../') . "/test/TestContext.php";
function __autoload($className) {