[ 
https://issues.apache.org/jira/browse/SHINDIG-1139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Lindner resolved SHINDIG-1139.
-----------------------------------

    Fix Version/s: 2.0.0
       Resolution: Fixed

will be fixed in 2.0.0

> Gadget Url Renderer: parameters substitution
> --------------------------------------------
>
>                 Key: SHINDIG-1139
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1139
>             Project: Shindig
>          Issue Type: Bug
>          Components: PHP
>    Affects Versions: 1.1-BETA2
>            Reporter: Chris Chabot
>            Assignee: Chris Chabot
>             Fix For: 2.0.0
>
>
> 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'];
> - $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);
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to