Leuchtfeuer / locate

The users country and preferred language and other facts will be detected. Depending on configurable rules the user can be redirected to other languages or pages. New functionality can be added easily.
https://www.Leuchtfeuer.com
GNU General Public License v2.0
9 stars 14 forks source link

Bug when redirecting to page defined by PID due to multiple ID parameters in URL #3

Closed bitmotionAE closed 6 years ago

bitmotionAE commented 6 years ago

Error occurs when defining a redirect action to a specific page like this:

plugin.tx_locate_pi1 = USER_INT
plugin.tx_locate_pi1 {
    userFunc = Bitmotion\Locate\Locate->main
    actions {
      redirectToPageDE {
            20 = \Bitmotion\Locate\Action\Redirect
            20.page = 25
            20.sys_language = 1
      }
      default {
            20 = \Bitmotion\Locate\Action\Redirect
            20.page = 25
            20.sys_language = 0
      }
    }

    ...
}

In this case you are not redirected to page 25 but you stay on the page where you are. The reason is, that the RedirectToPid method adds all URL parameters when trying to redirect, including the ID of the current page. The resulting redirect URL is something like this: www.example.com/index.php?id=25&L=0&id=1.

When adding the current URL parameters the parameter id should be left out if a specific page ID to redirect to has been defined.

Pull request: #4