In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1432 [In-Portal CMS] Front End bug report always 2012-11-05 11:02 2012-11-08 07:54
alex  
alex  
normal  
resolved 5.2.0  
fixed  
 
none 5.2.1-B1  
https://groups.google.com/d/topic/in-portal-bugs/JfZfDA0uuko/discussion
Fixes redirect with language negotiation
1
0001432: Change first visit detection with language negotiation enabled
In-Portal has a feature (disabled by default), which allows automatically change website language to one, that matches language from "Accept-Language" header, sent by user's browser on first visit.

This way, when user opens http://www.website.tld/ (website on primary language, since no language in url) he is automatically redirected to http://www.website.tld/user-language/index.html.

There is only one major problem: first visit detection. We presume, that first visit is when no page has been specified = home page.

Since home page url is / instead of /index.html user is redirected to http://www.website.tld/user-language/index.html each time he wants to change language back to primary website language while staying on Home Page.

Solution:
Instead of redirect on empty url perform redirect only if referer isn't our website (using kHTTPQuery::refererIsOurSite method) in LanguagesItem::Load method (where redirect is made).
patch first_visit_language_1432.patch (1,532) 2012-11-07 09:29
http://tracker.in-portal.org/file_download.php?file_id=1860&type=bug
patch first_visit_language_1432_v3.patch (1,551) 2012-11-07 11:25
http://tracker.in-portal.org/file_download.php?file_id=1865&type=bug
patch first_visit_language_1432_v4.patch (913) 2012-11-08 07:51
http://tracker.in-portal.org/file_download.php?file_id=1866&type=bug
Issue History
2012-11-08 07:54 alex Changeset attached 5.2.x r15621
2012-11-08 07:54 alex Note Added: 0005293
2012-11-08 07:54 alex Status reviewed and tested => resolved
2012-11-08 07:54 alex Fixed in Version => 5.2.1-B1
2012-11-08 07:54 alex Resolution open => fixed
2012-11-08 07:53 alex Note Added: 0005292
2012-11-08 07:53 alex Status needs testing => reviewed and tested
2012-11-08 07:53 alex Note Added: 0005291
2012-11-08 07:51 alex File Added: first_visit_language_1432_v4.patch
2012-11-07 11:26 erik Note Added: 0005287
2012-11-07 11:26 erik Assigned To erik => alex
2012-11-07 11:26 erik Status needs work => needs testing
2012-11-07 11:25 erik File Added: first_visit_language_1432_v3.patch
2012-11-07 10:59 alex Note Added: 0005286
2012-11-07 10:59 alex Assigned To alex => erik
2012-11-07 10:59 alex Status needs testing => needs work
2012-11-07 09:31 erik Note Added: 0005275
2012-11-07 09:31 erik Assigned To erik => alex
2012-11-07 09:31 erik Status needs work => needs testing
2012-11-07 09:29 erik File Added: first_visit_language_1432.patch
2012-11-07 09:29 erik File Deleted: first_visit_language_1432.patch
2012-11-07 07:28 alex Note Added: 0005268
2012-11-07 07:28 alex Assigned To => erik
2012-11-07 07:28 alex Status needs testing => needs work
2012-11-07 06:21 erik Note Added: 0005265
2012-11-07 06:21 erik Developer => erik
2012-11-07 06:21 erik Status active => needs testing
2012-11-07 06:21 erik File Added: first_visit_language_1432.patch
2012-11-05 11:02 alex New Issue
2012-11-05 11:02 alex Reference => https://groups.google.com/d/topic/in-portal-bugs/JfZfDA0uuko/discussion
2012-11-05 11:02 alex Change Log Message => Fixes redirect with language negotiation
2012-11-05 11:02 alex Estimate Points => 1

Notes
(0005265)
erik   
2012-11-07 06:21   
Done. Patch attached. Needs testing
(0005268)
alex   
2012-11-07 07:28   
1. Proposed solution in task advised to REPLACE current check for empty url with referrer check. Please re-read task and fix.
(0005275)
erik   
2012-11-07 09:31   
1. Removed current check for empty url
2. Improved code formatting in work area (by use automatic formatting of IDE).
(0005286)
alex   
2012-11-07 10:59   
1. Used method "kHTTPQuery::refererIsOurSite" isn't declared as static and notice is issued on each call.
Please look at other code, that uses kHTTPQuery class and how it's been actually used.

2. Don't delete old patch version, but add "_vN" (e.g. "_v2", "_v3", etc.) to patch number and upload it. This way later on comments can be matched to uploaded patches.

(0005287)
erik   
2012-11-07 11:26   
Fixed usage of non-static method. New patch attached. Needs testing.
(0005291)
alex   
2012-11-08 07:53   
In "first_visit_language_1432_v4.patch" patch some changes that were not related to fixing were reverted and code rearranged to easily see what actually was changed.
(0005292)
alex   
2012-11-08 07:53   
OK
(0005293)
alex   
2012-11-08 07:54   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0001432: Change first visit detection with language negotiation enabled