MDN

Go Back   Mambo - Forums Closed for posting > Mambo Technical Zone > Developer Zone > 4.5.x

 
 
Thread Tools Search this Thread Display Modes
Old January 18th, 2005, 08:36   #1
Pentarh
 
Join Date: Jan 2005
Posts: 5
Pentarh is on a distinguished road
Exclamation Major bug in mambo 5.1a

Appearment:
1. when using SEO-type URLs (/component/option,com_rsgallery/ ... etc)
AND
2. when using third-party components (potentially this bug can appear in original modules)

File: MAMBOROOT/includes/sef.php
Function: sefRelToAbs( $string )

Description: This function does URL transformations and it permits non-unique parameter key in URL. I found the following transform result:

http://domain.com/component/option,c.../catid,0/id,1/limitstart,0/limit,1/limitstart,1/

So 'limitstart' variable must have a value of '0', but it was rewrited to '1'. So page navigation did not work.

My fix was:
Code:
--- old/sef.php Wed Sep  8 13:24:43 2004
+++ new/sef.php Tue Jan 18 03:31:01 2005
@@ -203,8 +203,15 @@
                        $sefstring = "component/";
                        $temp = split("\?", $string);
                        $temp = split("&", $temp[1]);
+                       $keyvals=array();
+
                        foreach($temp as $key => $value) {
-                               $sefstring .= $value."/";
+                               $keyvalue=explode('=',$value,2);
+                               $keyvals[$keyvalue[0]]=$keyvalue[1];
+                       }
+
+                       foreach($keyvals as $key => $value) {
+                               $sefstring .= $key.'='.$value."/";
                        }
                        $string = str_replace( '=', ',', $sefstring );
                }
PS: I was going to submit this one to mamboforge, but the site was down, so i submitted it here.

PPS: This bug is mostly related to com_rsgallery component, but the fact of non-unique key permittion in original code is a bug also i think.
Pentarh is offline  
Old January 19th, 2005, 03:08   #2
Saka
 
Saka's Avatar
 
Join Date: Oct 2003
Location: Sweden
Posts: 760
Saka is on a distinguished road
Default

Hello,

Can you please also post how the corespondent non-sef URL looks like here?
__________________
Emir Sakic
http://www.sakic.net
Saka is offline  
Old January 19th, 2005, 16:33   #3
Pentarh
 
Join Date: Jan 2005
Posts: 5
Pentarh is on a distinguished road
Default

Actually i didnt understand your question - my english is not good.

I'll try to describe the situation.

Lets say i have 3rd party component which uses standard pagenavigation tools. Also I use SEO-type URLs = 'On' in global config (URLs like directories and they are without parameters).

So, Before fix my page navigation didnt work in this component. When i click any page number i redirected to 1st page.

Before fix script generated the following URL like:
Code:
http://domain.com/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,0/limit,1/limitstart,1/
Code:
http://domain.com/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,0/limit,1/limitstart,2/
You can see that duplicate parameter limitstart is present!

After fix script generated URL:

Code:
http://domain.com/component/option,com_rsgallery/page,inline/catid,0/id,1/limit,1/limitstart,1/
Code:
http://domain.com/component/option,com_rsgallery/page,inline/catid,0/id,1/limit,1/limitstart,2/
You can see that code above removed first duplicate of limitstart parameter. And page navigation works okay.
Pentarh is offline  
Old January 19th, 2005, 16:35   #4
tonyskyday
 
tonyskyday's Avatar
 
Join Date: Dec 2003
Location: Charlottesville, VA USA
Posts: 2,836
tonyskyday is on a distinguished road
Default

He wants you to temporarily disable (turn off) SEF, and post the non-rewritten (non-SEF) URL.

-Tony
__________________
Great Mambo Hosting -- http://www.buyhttp.com
My Site: http://www.tonyscida.com
tonyskyday is offline  
Old January 19th, 2005, 16:46   #5
Pentarh
 
Join Date: Jan 2005
Posts: 5
Pentarh is on a distinguished road
Default

Got it -thanks. I'll try
Pentarh is offline  
Old January 19th, 2005, 17:04   #6
Pentarh
 
Join Date: Jan 2005
Posts: 5
Pentarh is on a distinguished road
Default

Okay. I uninstalled patch and turned SEF off.

Pagenavigation works okay, but duplicate parameters are present:
Code:
Without patch and SEF=off (works)
to 2nd page: 
option=com_rsgallery&page=inline&catid=0&id=1&limitstart=0&limit=1&limitstart=1
to 3rd page:
option=com_rsgallery&page=inline&catid=0&id=1&limitstart=0&limit=1&limitstart=2
Code:
Without patch and SEF=on (dont work page selection. anyway i have 1st page)
to 2nd page: 
/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,0/limit,1/limitstart,1/
to 3rd page:
/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,0/limit,1/limitstart,2/
Code:
With patch and SEF=on (works)
to 2nd page: 
/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,1/limit,1/
to 3rd page:
/component/option,com_rsgallery/page,inline/catid,0/id,1/limitstart,2/limit,1/
Actually i understand that the root of this problem is not in SEF function. I dont have time to research this so i putted a stop-code in SEF function to destroy key duplicates in SEO URL.
Pentarh is offline  
Old January 19th, 2005, 17:08   #7
Pentarh
 
Join Date: Jan 2005
Posts: 5
Pentarh is on a distinguished road
Default

Also there are some other minor fixes and hacks were done. Where can i publish them?
Pentarh is offline  
Old January 19th, 2005, 17:42   #8
Saka
 
Saka's Avatar
 
Join Date: Oct 2003
Location: Sweden
Posts: 760
Saka is on a distinguished road
Default

Hello!

Well, as you can see, the problem is in the RSgallery component that has double limitstart argument in the URL.
Code:
option=com_rsgallery&page=inline&catid=0&id=1&limitstart=0&limit=1&limitstart=1
The SEF function only converts this URL to the SEF one.

We could, as you suggest, put a check in the SEF function to disable duplicates, but this would actually lead to inconsistency between non-sef and sef URL. We want both these links to give the same result.

You are welcome to put your other fixes here for consideration.

Thanks.
__________________
Emir Sakic
http://www.sakic.net
Saka is offline  
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Mambo Server on Windows - IIS phardstaff Installation Questions 105 September 6th, 2007 14:37
Mambo OS Performance; Experienced Mambo Developers required Ritchie General Questions 4 July 23rd, 2006 11:01
NZMac.com goes Mambo Philip Roy Sites using Mambo 14 July 21st, 2005 22:03
Do developers give up on Mambo? aerdt Components 2 December 5th, 2004 02:52
Installation von Mambo Stable 4.5. Für Anfänger mit geringen Kenntnissen geeignet ! hello German Forum 17 November 2nd, 2004 08:48


All times are GMT -7. The time now is 07:32.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.