multilingual sidebar plugin

Creating and modifying plugins.
Post Reply
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

multilingual sidebar plugin

Post by Timbalu »

Hi

I just noticed the serendipity_plugin_multilingual.php to spit out wrong urls changing languages multiple times with mod_rewrite=on settings. (like /blog/index.php?index.php and so on)

Changing line 88 from

Code: Select all

$url = serendipity_currentURL();
to

Code: Select all

$url = $serendipity['rewrite'] == 'rewrite' ? '' : serendipity_currentURL();
will work as expected.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual sidebar plugin

Post by garvinhicking »

Hi!

I'm not really sure that works, because if a page is called through the index.php?/... method and the user wants to change the language there, he would loose variables.

The currentURL is a safety measure so that this can never happen; the URL changes to the compatibility format of course, but IMHO it's more important that a language changes works in every case instead of having the same URL...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: multilingual sidebar plugin

Post by Timbalu »

Hi Garvin

Yes thats true. But - at least here on my local test blog - it does not change the url only, it changes the page, in cases like ...
/archive(.html) [lang change] leads to /index.php?archive(.html), which failes missing the slash after ?/.

We might add the missing slash somehow in case of mod_rewrite.... or does this effect compatibility too?

Edit:
Using strict = true in case of rewrite solves this problem. ;-)

Code: Select all

$url = $serendipity['rewrite'] == 'rewrite' ? serendipity_currentURL(true) : serendipity_currentURL();
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual sidebar plugin

Post by garvinhicking »

Hi!

That's good! Using the 'true' shouldn't be a problem. I've committed that, thansk!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply