Author: lindner
Date: Tue Aug 10 11:45:34 2010
New Revision: 983941
URL: http://svn.apache.org/viewvc?rev=983941&view=rev
Log:
SHINDIG-1399 | fix
Modified:
shindig/trunk/php/src/common/RemoteContentRequest.php
Modified: shindig/trunk/php/src/common/RemoteContentRequest.php
URL:
http://svn.apache.org/viewvc/shindig/trunk/php/src/common/RemoteContentRequest.php?rev=983941&r1=983940&r2=983941&view=diff
==============================================================================
--- shindig/trunk/php/src/common/RemoteContentRequest.php (original)
+++ shindig/trunk/php/src/common/RemoteContentRequest.php Tue Aug 10 11:45:34
2010
@@ -381,29 +381,29 @@ class RemoteContentRequest {
return false;
}
-/**
- * transforms a possible relative url to a absolute url from the gadget xml
root
- * @param string $url
- * @param string $gadgetUrl
- * @return mixed url or false
- */
-public static function transformRelativeUrl($url, $gadgetUrl)
-{
- $parsedUri = parse_url($url);
- if (empty($parsedUri['host'])) {
- // relative path's in the locale spec uri
- // check against valid chars so that we can make sure that the given
- // relative url is valid and does not try to fetch files outside of
- // gadget scope (e.g. /../../../usr/bin... )
- $pattern =
'%^(([a-zA-Z0-9\-_](?<!\.)){1,2}([a-zA-Z0-9\.\-_](?<!\.\.))*/?)+$%';
- if (preg_match($pattern, $url)) {
- $gadgetUrl = substr($gadgetUrl, 0, strrpos($gadgetUrl, '/') + 1);
- $url = $gadgetUrl . str_replace('..', '', $url);
- } else {
- return false;
+ /**
+ * transforms a possible relative url to a absolute url from the gadget xml
root
+ * @param string $url
+ * @param string $gadgetUrl
+ * @return mixed url or false
+ */
+ public static function transformRelativeUrl($url, $gadgetUrl) {
+ $parsedUri = parse_url($url);
+ if (empty($parsedUri['host'])) {
+ // relative path's in the locale spec uri
+ // check against valid chars so that we can make sure that the given
+ // relative url is valid and does not try to fetch files outside of
+ // gadget scope (e.g. /../../../usr/bin... )
+ $pattern =
'%^(([a-zA-Z0-9\-_](?<!\.)){1,2}([a-zA-Z0-9\.\-_](?<!\.\.))*/?)+$%';
+ if (preg_match($pattern, $url)) {
+ $gadgetUrl = substr($gadgetUrl, 0, strrpos($gadgetUrl, '/') + 1);
+ $url = $gadgetUrl . str_replace('..', '', $url);
+ } else {
+ return false;
+ }
}
+ return $url;
}
- return $url;
}