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/06/05 09:47:04 UTC
svn commit: r663494 - in /incubator/shindig/trunk/php/src: common/
common/Zend/ common/samplecontainer/ gadgets/ gadgets/http/ gadgets/oauth/
gadgets/samplecontainer/
Author: chabotc
Date: Thu Jun 5 00:47:03 2008
New Revision: 663494
URL: http://svn.apache.org/viewvc?rev=663494&view=rev
Log:
A few source formatting inconsistencies snuk in
Modified:
incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
incubator/shindig/trunk/php/src/common/Zend/Loader.php
incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php
incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
incubator/shindig/trunk/php/src/gadgets/http/CertServlet.php
incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php
incubator/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php
Modified: incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/RemoteContentRequest.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/RemoteContentRequest.php (original)
+++ incubator/shindig/trunk/php/src/common/RemoteContentRequest.php Thu Jun 5 00:47:03 2008
@@ -68,7 +68,7 @@
$tmpHeaders .= "Pragma:no-cache\n";
}
$this->headers = $tmpHeaders;
- }
+ }
if (! isset($postBody)) {
$this->postBody = '';
} else {
Modified: incubator/shindig/trunk/php/src/common/Zend/Loader.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/Zend/Loader.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/Zend/Loader.php (original)
+++ incubator/shindig/trunk/php/src/common/Zend/Loader.php Thu Jun 5 00:47:03 2008
@@ -1,4 +1,5 @@
<?php
+
/**
* Zend Framework
*
@@ -27,232 +28,232 @@
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Loader
-{
- /**
- * Loads a class from a PHP file. The filename must be formatted
- * as "$class.php".
- *
- * If $dirs is a string or an array, it will search the directories
- * in the order supplied, and attempt to load the first matching file.
- *
- * If $dirs is null, it will split the class name at underscores to
- * generate a path hierarchy (e.g., "Zend_Example_Class" will map
- * to "Zend/Example/Class.php").
- *
- * If the file was not found in the $dirs, or if no $dirs were specified,
- * it will attempt to load it from PHP's include_path.
- *
- * @param string $class - The full class name of a Zend component.
- * @param string|array $dirs - OPTIONAL Either a path or an array of paths
- * to search.
- * @return void
- * @throws Zend_Exception
- */
- public static function loadClass($class, $dirs = null)
- {
- if (class_exists($class, false) || interface_exists($class, false)) {
- return;
- }
-
- if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) {
- require_once 'src/common/Zend/Exception.php';
- throw new Zend_Exception('Directory argument must be a string or an array');
- }
-
- // autodiscover the path from the class name
- $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
- if (!empty($dirs)) {
- // use the autodiscovered path
- $dirPath = dirname($file);
- if (is_string($dirs)) {
- $dirs = explode(PATH_SEPARATOR, $dirs);
- }
- foreach ($dirs as $key => $dir) {
- if ($dir == '.') {
- $dirs[$key] = $dirPath;
- } else {
- $dir = rtrim($dir, '\\/');
- $dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath;
- }
- }
- $file = basename($file);
- self::loadFile($file, $dirs, true);
- } else {
- self::_securityCheck($file);
- include_once 'src/common/'.$file;
- }
-
- if (!class_exists($class, false) && !interface_exists($class, false)) {
- require_once 'src/common/Zend/Exception.php';
- throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file");
- }
- }
-
- /**
- * Loads a PHP file. This is a wrapper for PHP's include() function.
- *
- * $filename must be the complete filename, including any
- * extension such as ".php". Note that a security check is performed that
- * does not permit extended characters in the filename. This method is
- * intended for loading Zend Framework files.
- *
- * If $dirs is a string or an array, it will search the directories
- * in the order supplied, and attempt to load the first matching file.
- *
- * If the file was not found in the $dirs, or if no $dirs were specified,
- * it will attempt to load it from PHP's include_path.
- *
- * If $once is TRUE, it will use include_once() instead of include().
- *
- * @param string $filename
- * @param string|array $dirs - OPTIONAL either a path or array of paths
- * to search.
- * @param boolean $once
- * @return boolean
- * @throws Zend_Exception
- */
- public static function loadFile($filename, $dirs = null, $once = false)
- {
- self::_securityCheck($filename);
-
- /**
- * Search in provided directories, as well as include_path
- */
- $incPath = false;
- if (!empty($dirs) && (is_array($dirs) || is_string($dirs))) {
- if (is_array($dirs)) {
- $dirs = implode(PATH_SEPARATOR, $dirs);
- }
- $incPath = get_include_path();
- set_include_path($dirs . PATH_SEPARATOR . $incPath);
- }
-
- /**
- * Try finding for the plain filename in the include_path.
- */
- if ($once) {
- include_once $filename;
- } else {
- include $filename;
- }
-
- /**
- * If searching in directories, reset include_path
- */
- if ($incPath) {
- set_include_path($incPath);
- }
-
- return true;
- }
-
- /**
- * Returns TRUE if the $filename is readable, or FALSE otherwise.
- * This function uses the PHP include_path, where PHP's is_readable()
- * does not.
- *
- * @param string $filename
- * @return boolean
- */
- public static function isReadable($filename)
- {
- if (!$fh = @fopen($filename, 'r', true)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * spl_autoload() suitable implementation for supporting class autoloading.
- *
- * Attach to spl_autoload() using the following:
- * <code>
- * spl_autoload_register(array('Zend_Loader', 'autoload'));
- * </code>
- *
- * @param string $class
- * @return string|false Class name on success; false on failure
- */
- public static function autoload($class)
- {
- try {
- self::loadClass($class);
- return $class;
- } catch (Exception $e) {
- return false;
- }
- }
-
- /**
- * Register {@link autoload()} with spl_autoload()
- *
- * @param string $class (optional)
- * @param boolean $enabled (optional)
- * @return void
- * @throws Zend_Exception if spl_autoload() is not found
- * or if the specified class does not have an autoload() method.
- */
- public static function registerAutoload($class = 'Zend_Loader', $enabled = true)
- {
- if (!function_exists('spl_autoload_register')) {
- require_once 'src/common/Zend/Exception.php';
- throw new Zend_Exception('spl_autoload does not exist in this PHP installation');
- }
-
- self::loadClass($class);
- $methods = get_class_methods($class);
- if (!in_array('autoload', (array) $methods)) {
- require_once 'src/common/Zend/Exception.php';
- throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
- }
-
- if ($enabled === true) {
- spl_autoload_register(array($class, 'autoload'));
- } else {
- spl_autoload_unregister(array($class, 'autoload'));
- }
- }
-
- /**
- * Ensure that filename does not contain exploits
- *
- * @param string $filename
- * @return void
- * @throws Zend_Exception
- */
- protected static function _securityCheck($filename)
- {
- /**
- * Security check
- */
- if (preg_match('/[^a-z0-9\\/\\\\_.-]/i', $filename)) {
- require_once 'src/common/Zend/Exception.php';
- throw new Zend_Exception('Security check: Illegal character in filename');
- }
- }
+class Zend_Loader {
- /**
- * Attempt to include() the file.
- *
- * include() is not prefixed with the @ operator because if
- * the file is loaded and contains a parse error, execution
- * will halt silently and this is difficult to debug.
- *
- * Always set display_errors = Off on production servers!
- *
- * @param string $filespec
- * @param boolean $once
- * @return boolean
- * @deprecated Since 1.5.0; use loadFile() instead
- */
- protected static function _includeFile($filespec, $once = false)
- {
- if ($once) {
- return include_once $filespec;
- } else {
- return include $filespec ;
- }
- }
+ /**
+ * Loads a class from a PHP file. The filename must be formatted
+ * as "$class.php".
+ *
+ * If $dirs is a string or an array, it will search the directories
+ * in the order supplied, and attempt to load the first matching file.
+ *
+ * If $dirs is null, it will split the class name at underscores to
+ * generate a path hierarchy (e.g., "Zend_Example_Class" will map
+ * to "Zend/Example/Class.php").
+ *
+ * If the file was not found in the $dirs, or if no $dirs were specified,
+ * it will attempt to load it from PHP's include_path.
+ *
+ * @param string $class - The full class name of a Zend component.
+ * @param string|array $dirs - OPTIONAL Either a path or an array of paths
+ * to search.
+ * @return void
+ * @throws Zend_Exception
+ */
+ public static function loadClass($class, $dirs = null)
+ {
+ if (class_exists($class, false) || interface_exists($class, false)) {
+ return;
+ }
+
+ if ((null !== $dirs) && ! is_string($dirs) && ! is_array($dirs)) {
+ require_once 'src/common/Zend/Exception.php';
+ throw new Zend_Exception('Directory argument must be a string or an array');
+ }
+
+ // autodiscover the path from the class name
+ $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
+ if (! empty($dirs)) {
+ // use the autodiscovered path
+ $dirPath = dirname($file);
+ if (is_string($dirs)) {
+ $dirs = explode(PATH_SEPARATOR, $dirs);
+ }
+ foreach ($dirs as $key => $dir) {
+ if ($dir == '.') {
+ $dirs[$key] = $dirPath;
+ } else {
+ $dir = rtrim($dir, '\\/');
+ $dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath;
+ }
+ }
+ $file = basename($file);
+ self::loadFile($file, $dirs, true);
+ } else {
+ self::_securityCheck($file);
+ include_once 'src/common/' . $file;
+ }
+
+ if (! class_exists($class, false) && ! interface_exists($class, false)) {
+ require_once 'src/common/Zend/Exception.php';
+ throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file");
+ }
+ }
+
+ /**
+ * Loads a PHP file. This is a wrapper for PHP's include() function.
+ *
+ * $filename must be the complete filename, including any
+ * extension such as ".php". Note that a security check is performed that
+ * does not permit extended characters in the filename. This method is
+ * intended for loading Zend Framework files.
+ *
+ * If $dirs is a string or an array, it will search the directories
+ * in the order supplied, and attempt to load the first matching file.
+ *
+ * If the file was not found in the $dirs, or if no $dirs were specified,
+ * it will attempt to load it from PHP's include_path.
+ *
+ * If $once is TRUE, it will use include_once() instead of include().
+ *
+ * @param string $filename
+ * @param string|array $dirs - OPTIONAL either a path or array of paths
+ * to search.
+ * @param boolean $once
+ * @return boolean
+ * @throws Zend_Exception
+ */
+ public static function loadFile($filename, $dirs = null, $once = false)
+ {
+ self::_securityCheck($filename);
+
+ /**
+ * Search in provided directories, as well as include_path
+ */
+ $incPath = false;
+ if (! empty($dirs) && (is_array($dirs) || is_string($dirs))) {
+ if (is_array($dirs)) {
+ $dirs = implode(PATH_SEPARATOR, $dirs);
+ }
+ $incPath = get_include_path();
+ set_include_path($dirs . PATH_SEPARATOR . $incPath);
+ }
+
+ /**
+ * Try finding for the plain filename in the include_path.
+ */
+ if ($once) {
+ include_once $filename;
+ } else {
+ include $filename;
+ }
+
+ /**
+ * If searching in directories, reset include_path
+ */
+ if ($incPath) {
+ set_include_path($incPath);
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns TRUE if the $filename is readable, or FALSE otherwise.
+ * This function uses the PHP include_path, where PHP's is_readable()
+ * does not.
+ *
+ * @param string $filename
+ * @return boolean
+ */
+ public static function isReadable($filename)
+ {
+ if (! $fh = @fopen($filename, 'r', true)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * spl_autoload() suitable implementation for supporting class autoloading.
+ *
+ * Attach to spl_autoload() using the following:
+ * <code>
+ * spl_autoload_register(array('Zend_Loader', 'autoload'));
+ * </code>
+ *
+ * @param string $class
+ * @return string|false Class name on success; false on failure
+ */
+ public static function autoload($class)
+ {
+ try {
+ self::loadClass($class);
+ return $class;
+ } catch (Exception $e) {
+ return false;
+ }
+ }
+
+ /**
+ * Register {@link autoload()} with spl_autoload()
+ *
+ * @param string $class (optional)
+ * @param boolean $enabled (optional)
+ * @return void
+ * @throws Zend_Exception if spl_autoload() is not found
+ * or if the specified class does not have an autoload() method.
+ */
+ public static function registerAutoload($class = 'Zend_Loader', $enabled = true)
+ {
+ if (! function_exists('spl_autoload_register')) {
+ require_once 'src/common/Zend/Exception.php';
+ throw new Zend_Exception('spl_autoload does not exist in this PHP installation');
+ }
+
+ self::loadClass($class);
+ $methods = get_class_methods($class);
+ if (! in_array('autoload', (array)$methods)) {
+ require_once 'src/common/Zend/Exception.php';
+ throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
+ }
+
+ if ($enabled === true) {
+ spl_autoload_register(array($class, 'autoload'));
+ } else {
+ spl_autoload_unregister(array($class, 'autoload'));
+ }
+ }
+
+ /**
+ * Ensure that filename does not contain exploits
+ *
+ * @param string $filename
+ * @return void
+ * @throws Zend_Exception
+ */
+ protected static function _securityCheck($filename)
+ {
+ /**
+ * Security check
+ */
+ if (preg_match('/[^a-z0-9\\/\\\\_.-]/i', $filename)) {
+ require_once 'src/common/Zend/Exception.php';
+ throw new Zend_Exception('Security check: Illegal character in filename');
+ }
+ }
+
+ /**
+ * Attempt to include() the file.
+ *
+ * include() is not prefixed with the @ operator because if
+ * the file is loaded and contains a parse error, execution
+ * will halt silently and this is difficult to debug.
+ *
+ * Always set display_errors = Off on production servers!
+ *
+ * @param string $filespec
+ * @param boolean $once
+ * @return boolean
+ * @deprecated Since 1.5.0; use loadFile() instead
+ */
+ protected static function _includeFile($filespec, $once = false)
+ {
+ if ($once) {
+ return include_once $filespec;
+ } else {
+ return include $filespec;
+ }
+ }
}
Modified: incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php (original)
+++ incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php Thu Jun 5 00:47:03 2008
@@ -33,7 +33,7 @@
*/
public function createToken($stringToken)
{
- if (empty($stringToken) && !empty($_GET['authz'])) {
+ if (empty($stringToken) && ! empty($_GET['authz'])) {
throw new GadgetException('INVALID_GADGET_TOKEN');
}
try {
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php Thu Jun 5 00:47:03 2008
@@ -104,7 +104,7 @@
/*
* TODO: Temporal fix, double check where empty dependencies are being added
*/
- if(!empty($dep)) {
+ if (! empty($dep)) {
$this->addEntryToSet($results, $this->features[$dep]);
}
}
Modified: incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php Thu Jun 5 00:47:03 2008
@@ -39,24 +39,24 @@
private function sortFeaturesFiles($feature1, $feature2)
{
- $feature1 = basename(str_replace('/feature.xml','', $feature1));
- $feature2 = basename(str_replace('/feature.xml','', $feature2));
- if ($feature1 == $feature2) {
- return 0;
- }
- return ($feature1 < $feature2) ? -1 : 1;
+ $feature1 = basename(str_replace('/feature.xml', '', $feature1));
+ $feature2 = basename(str_replace('/feature.xml', '', $feature2));
+ if ($feature1 == $feature2) {
+ return 0;
+ }
+ return ($feature1 < $feature2) ? - 1 : 1;
}
-
+
private function loadFiles($path, &$features)
{
- $featuresFile = $path.'/features.txt';
+ $featuresFile = $path . '/features.txt';
if (file_exists($featuresFile) && is_readable($featuresFile)) {
$files = explode("\n", file_get_contents($featuresFile));
// custom sort, else core.io seems to bubble up before core, which breaks the dep chain order
- usort($files, array($this,'sortFeaturesFiles'));
+ usort($files, array($this, 'sortFeaturesFiles'));
foreach ($files as $file) {
- if (!empty($file) && strpos($file, 'feature.xml') !== false && substr($file, 0, 1) != '#' && substr($file, 0, 2) != '//') {
- $file = realpath($path.'/../'.trim($file));
+ if (! empty($file) && strpos($file, 'feature.xml') !== false && substr($file, 0, 1) != '#' && substr($file, 0, 2) != '//') {
+ $file = realpath($path . '/../' . trim($file));
$feature = $this->processFile($file);
$features[$feature->name] = $feature;
}
@@ -99,7 +99,7 @@
if (! isset($doc->name)) {
throw new GadgetException('Invalid name in feature: ' . $path);
}
- $feature->name = trim($doc->name);
+ $feature->name = trim($doc->name);
foreach ($doc->gadget as $gadget) {
$feature = $this->processContext($feature, $gadget, false);
}
Modified: incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsLibrary.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsLibrary.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsLibrary.php Thu Jun 5 00:47:03 2008
@@ -57,7 +57,7 @@
}
//FIXME purely for debugging, remove this asap!
// puts a //LIB: <name of feature> above the JS of the feature
- return "\n\n//LIB: ".$this->featureName."\n".$this->content;
+ return "\n\n//LIB: " . $this->featureName . "\n" . $this->content;
}
public function getFeatureName()
Modified: incubator/shindig/trunk/php/src/gadgets/http/CertServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/http/CertServlet.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/http/CertServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/http/CertServlet.php Thu Jun 5 00:47:03 2008
@@ -33,7 +33,7 @@
public function doGet()
{
$file = Config::get('public_key_file');
- if (!file_exists($file) || !is_readable($file)) {
+ if (! file_exists($file) || ! is_readable($file)) {
throw new Exception("Invalid public key location ($file), check config and file permissions");
}
$this->setLastModified(filemtime($file));
Modified: incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php Thu Jun 5 00:47:03 2008
@@ -52,10 +52,10 @@
echo "<html><body><h1>400 - Missing url parameter</h1></body></html>";
}
$signingFetcherFactory = $gadgetSigner = false;
- if (!empty($_GET['authz']) || !empty($_POST['authz'])) {
+ if (! empty($_GET['authz']) || ! empty($_POST['authz'])) {
$gadgetSigner = Config::get('security_token_signer');
$gadgetSigner = new $gadgetSigner();
- $signingFetcherFactory = new SigningFetcherFactory(Config::get("private_key_file"));
+ $signingFetcherFactory = new SigningFetcherFactory(Config::get("private_key_file"));
}
$proxyHandler = new ProxyHandler($context, $signingFetcherFactory);
if (! empty($_GET['output']) && $_GET['output'] == 'js') {
@@ -66,7 +66,7 @@
} catch (Exception $e) {
// catch all exceptions and give a 500 server error
header("HTTP/1.0 500 Internal Server Error");
- echo "<h1>Internal server error</h1><p>".$e->getMessage()."</p>";
+ echo "<h1>Internal server error</h1><p>" . $e->getMessage() . "</p>";
}
}
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php Thu Jun 5 00:47:03 2008
@@ -18,46 +18,47 @@
*/
class OAuthStoreException extends GadgetException {}
-
+
/**
* Higher-level interface that allows callers to store and retrieve
* OAuth-related data directly from {@code GadgetSpec}s, {@code GadgetContext}s,
* etc. See {@link OAuthStore} for a more detailed explanation of the OAuth
* Data Store.
- */
-class GadgetOAuthTokenStore {
-
+ */
+class GadgetOAuthTokenStore {
+
/**
* Internal class used to communicate results of parsing the gadget spec
* between methods.
- */
+ */
// name of the OAuth feature in the gadget spec
- public static $OAUTH_FEATURE = "oauth";
+ public static $OAUTH_FEATURE = "oauth";
// name of the Param that identifies the service name
- public static $SERVICE_NAME = "service_name";
+ public static $SERVICE_NAME = "service_name";
// name of the Param that identifies the access URL
- public static $ACCESS_URL = "access_url";
+ public static $ACCESS_URL = "access_url";
// name of the optional Param that identifies the HTTP method for access URL
- public static $ACCESS_HTTP_METHOD = "access_method";
+ public static $ACCESS_HTTP_METHOD = "access_method";
// name of the Param that identifies the request URL
- public static $REQUEST_URL = "request_url";
+ public static $REQUEST_URL = "request_url";
// name of the optional Param that identifies the HTTP method for request URL
- public static $REQUEST_HTTP_METHOD = "request_method";
+ public static $REQUEST_HTTP_METHOD = "request_method";
// name of the Param that identifies the user authorization URL
- public static $AUTHORIZE_URL = "authorize_url";
+ public static $AUTHORIZE_URL = "authorize_url";
// name of the Param that identifies the location of OAuth parameters
- public static $OAUTH_PARAM_LOCATION = "param_location";
- public static $AUTH_HEADER = "auth_header";
- public static $POST_BODY = "post_body";
- public static $URI_QUERY = "uri_query";
-
+ public static $OAUTH_PARAM_LOCATION = "param_location";
+ public static $AUTH_HEADER = "auth_header";
+ public static $POST_BODY = "post_body";
+ public static $URI_QUERY = "uri_query";
+
//public static $DEFAULT_OAUTH_PARAM_LOCATION = AUTH_HEADER;
public static $DEFAULT_OAUTH_PARAM_LOCATION = "auth_header"; //It has to be like the line above this.
//TODO: Check why java use AUTH_HEADER
-
+
+
// we use POST if no HTTP method is specified for access and request URLs
// (user authorization always uses GET)
- public static $DEFAULT_HTTP_METHOD = "POST";
+ public static $DEFAULT_HTTP_METHOD = "POST";
private $store;
/**
@@ -232,8 +233,8 @@
$gadgetInfo->setProviderInfo($provInfo);
$gadgetInfo->setServiceName($serviceName);
return $gadgetInfo;
- }
-
+ }
+
/**
* Extracts a single oauth-related parameter from a key-value map,
* throwing an exception if the parameter could not be found (unless the
@@ -245,39 +246,39 @@
* found.
* @return the value corresponding to the key (paramName)
* @throws GadgetException if the parameter value couldn't be found.
- */
+ */
static function getOAuthParameter($params, $paramName, $isOptional)
- {
- $param = @$params[$paramName];
- if ($param == null && !$isOptional) {
- $message = "parameter '" . $paramName . "' missing in oauth feature section of gadget spec";
- throw new GadgetException($message);
- }
- return ($param == null) ? null : trim($param);
- }
-}
-
-class GadgetInfo {
- private $serviceName;
- private $providerInfo;
-
+ {
+ $param = @$params[$paramName];
+ if ($param == null && ! $isOptional) {
+ $message = "parameter '" . $paramName . "' missing in oauth feature section of gadget spec";
+ throw new GadgetException($message);
+ }
+ return ($param == null) ? null : trim($param);
+ }
+}
+
+class GadgetInfo {
+ private $serviceName;
+ private $providerInfo;
+
public function getServiceName()
- {
- return $this->serviceName;
+ {
+ return $this->serviceName;
}
-
+
public function setServiceName($serviceName)
- {
- $this->serviceName = $serviceName;
+ {
+ $this->serviceName = $serviceName;
}
-
+
public function getProviderInfo()
- {
- return $this->providerInfo;
- }
-
- public function setProviderInfo($providerInfo)
- {
- $this->providerInfo = $providerInfo;
- }
+ {
+ return $this->providerInfo;
+ }
+
+ public function setProviderInfo($providerInfo)
+ {
+ $this->providerInfo = $providerInfo;
+ }
}
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php?rev=663494&r1=663493&r2=663494&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php Thu Jun 5 00:47:03 2008
@@ -40,7 +40,7 @@
public function wrap(Array $in)
{
$encoded = $this->serializeAndTimestamp($in);
- if (!function_exists('mcrypt_module_open') && Config::get('allow_plaintext_token')) {
+ if (! function_exists('mcrypt_module_open') && Config::get('allow_plaintext_token')) {
$cipherText = base64_encode($encoded);
} else {
$cipherText = Crypto::aes128cbcEncrypt($this->cipherKey, $encoded);
@@ -49,7 +49,7 @@
$b64 = base64_encode($cipherText . $hmac);
return $b64;
}
-
+
private function serializeAndTimestamp(Array $in)
{
$encoded = "";
@@ -82,7 +82,7 @@
$cipherText = substr($bin, 0, strlen($bin) - Crypto::$HMAC_SHA1_LEN);
$hmac = substr($bin, strlen($cipherText));
Crypto::hmacSha1Verify($this->hmacKey, $cipherText, $hmac);
- if (!function_exists('mcrypt_module_open') && Config::get('allow_plaintext_token')) {
+ if (! function_exists('mcrypt_module_open') && Config::get('allow_plaintext_token')) {
$plain = base64_decode($cipherText);
} else {
$plain = Crypto::aes128cbcDecrypt($this->cipherKey, $cipherText);