Description
This was originally SHINDIG-1138 by Dmitry Vorobyev, but due to spamming auto responders i've deleted that issue. Original content:
Substitute _MODULE_ID_ and other parameters in url.
-
-
- Eclipse Workspace Patch 1.0
#P shindig
Index: http://svn.apache.org/repos/asf/incubator/shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php
===================================================================
- http://svn.apache.org/repos/asf/incubator/shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php (revision 800379)
+++ http://svn.apache.org/repos/asf/incubator/shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php (working copy)
@@ -32,9 +32,7 @@
public function renderGadget(Gadget $gadget, $view) {
// Preserve existing query string parameters.
$redirURI = $view['href'];
- Eclipse Workspace Patch 1.0
-
- $queryStr = strpos($redirURI, '?') !== false ? substr($redirURI, strpos($redirURI, '?')) : '';
- $query = $queryStr;
- $query .= $this->getPrefsQueryString($gadget->gadgetSpec->userPrefs);
+ $query = $this->getPrefsQueryString($gadget->gadgetSpec->userPrefs);
$features = array();
$forcedLibs = Config::get('focedJsLibs');
if ($forcedLibs == null) {
@@ -45,10 +43,15 @@
$query .= $this->appendLibsToQuery($features);
$query .= '&lang=' . urlencode(isset($_GET['lang']) ? $_GET['lang'] : 'en');
$query .= '&country=' . urlencode(isset($_GET['country']) ? $_GET['country'] : 'US'); - if (substr($query, 0, 1) == '&') {
- $query = '?' . substr($query, 1);
+
+ $redirURI = $gadget->substitutions->substituteUri(null, $redirURI);
+ if (strpos($redirURI, '?') !== false) { + $redirURI = $redirURI . $query; + }elseif (substr($query, 0, 1) == '&')
{ + $redirURI = $redirURI . '?' . substr($query, 1); + }else
{ + $redirURI = $redirURI . '?' . $query; } - $redirURI .= $query;
header('Location: ' . $redirURI);
}