In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Type Reproducibility Date Submitted Last Update
0001433 [In-Portal CMS] Front End task always 2012-11-05 11:09 2012-12-13 02:57
Reporter alex View Status public Project Name In-Portal CMS
Assigned To alex Developer
Priority normal Resolution fixed Fixed in Version 5.3.0-B1
Status resolved Product Version 5.2.0 Target Version 5.3.0
Time EstimateNo estimate
Summary 0001433: Possibility of having 2 urls to a single page
Description In discussion I've talked about physical and virtual sections and fact, that 2 urls exists to a single physical section.

At first this might not seem a big problem, especially if across a theme "use_section" parameter of m_Link tag is used, which forces url from "Structure & Data" section to be used.
However if user manually guesses url to a TPL file, which is behind "Structure & Data" section url, then page will be shown too.

If google spider guess that url, then website could be banned because 2 different urls result in showing same page at all times.

I propose to automatically redirect (with 301 Moved Permanently http code) visitor to page url equivalent from "Structure & Data" section and put a notice into "System Log".
This way developers would know that somebody still accesses old page url. And using HTTP_REFERER header they would know exactly who that might be.
Additional Information Enable proposed functionality with a setting, that is turned off by default.
Tags No tags attached.
Change Log Message Fixes multiple urls pointing to a single page problem
Estimate Points 1
Attached Files patch file icon 2_urls_to_single_page_1433.patch [^] (5,438 bytes) 2012-12-05 10:44 [Show Content]
patch file icon 2_urls_to_single_page_1433_v2.patch [^] (5,409 bytes) 2012-12-06 12:43 [Show Content]
patch file icon 2_urls_to_single_page_1433_v3.patch [^] (6,035 bytes) 2012-12-11 04:06 [Show Content]
patch file icon 2_urls_to_single_page_1433_v4.patch [^] (7,498 bytes) 2012-12-13 02:54 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
User avatar (0005313)
alex (manager)
2012-12-05 03:11

1. add new system setting "ForceCanonicalUrls" ("Force Canonical Urls") into "Configuration -> Website -> Advanced" section after "Force Redirect to Selected URL Ending" setting
1a. try using new "Add" button to ease system setting adding and then dump INSERT statement into install_data.sql/upgrades.sql file

2. create getSeoTemplate method in kUrlManager class (+ create facade method in kApplication class, like it's one with getPhysicalTemplate method), that will use "structureTemplateMapping" array (see getPhysicalTemplate method for example) to figure out given template's underlying TPL file (be careful, because that array has info about multiple themes in them; only match current theme).

3. add new check to the end of kHTTPQuery::AfterInit method code where parsed template will be given to kApplication::getSeoTemplate method and it turns out that real TPL path is present in url + setting enabled + has seo url do redirect to that seo url.

4. test with both mod-rewrite enabled and disabled

5. try putting TPL path into url, that is listed in ".smsignore" file - no redirect loop should happen

6. use trigger_error method to create notice about redirects performed this way; System Log will catch them automatically, when it's present.
User avatar (0005317)
erik (manager)
2012-12-05 10:44

Patch attached. Needs testing
User avatar (0005319)
alex (manager)
2012-12-06 04:10

1. method getSeoTemplate accepts physical templates as input and that's why it's parameter should be called $physical_template and not a $parsed_template

2. this is no need for preg_match('|' . BASE_PATH check in kHTTPQuery::AfterInit method, because method getSeoTemplate will return empty string in case when we're on right seo template and not on physical one (should be done as I written in plan if this won't break anything)

3. no point in giving both "use_section" redirect parameter & seo_template to kApplication::Redirect method call, because:
- with seo template given url will be to seo template
- with empty string given + use_section parameter url will also be to seo template
- with seo template given + use_section parameter the use_section parameter will have no effect
Choose any of 3 proposed solutions in item 3.

4. getRedirectParams method not used (as in code before added code) and it will result in any extra url parameters passed to wrong url (from where we're doing a redirect) will be lost (e.g. "next_template" and so on) resulting in non working page displayed to user
User avatar (0005325)
erik (manager)
2012-12-06 12:44

Patch version 2 attached. Needs testing
User avatar (0005332)
alex (manager)
2012-12-11 03:06

1. no upgrade script
User avatar (0005333)
erik (manager)
2012-12-11 04:07

Added insert-sql for new SystemSettings in upgrades.sql

New patch attached. Needs testing.
User avatar (0005341)
alex (manager)
2012-12-13 02:56

Works in general, but some minor issues fixed:
1. code was working in Admin Console but wasn't actually doing anything useful because admin template isn't listed
User avatar (0005342)
alex (manager)
2012-12-13 02:57

Fix committed to 5.3.x branch. Commit Message:

Fixes 0001433: Possibility of having 2 urls to a single page
1. Commit on behalf of Erik

- Related Changesets
In-Portal CMS: 5.3.x r15652
Timestamp: 2012-12-13 02:57:24
Author: alex
Details ] Diff ]
Fixes 0001433: Possibility of having 2 urls to a single page
1. Commit on behalf of Erik
mod - /in-portal/branches/5.3.x/core/install/english.lang Diff ] File ]
mod - /in-portal/branches/5.3.x/core/install/install_data.sql Diff ] File ]
mod - /in-portal/branches/5.3.x/core/install/upgrades.sql Diff ] File ]
mod - /in-portal/branches/5.3.x/core/kernel/application.php Diff ] File ]
mod - /in-portal/branches/5.3.x/core/kernel/managers/url_manager.php Diff ] File ]
mod - /in-portal/branches/5.3.x/core/kernel/utility/http_query.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-12-13 02:57 alex Note Added: 0005342
2012-12-13 02:57 alex Status reviewed and tested => resolved
2012-12-13 02:57 alex Fixed in Version => 5.3.0-B1
2012-12-13 02:57 alex Resolution open => fixed
2012-12-13 02:57 alex Changeset attached 5.3.x r15652
2012-12-13 02:56 alex Note Added: 0005341
2012-12-13 02:56 alex Status needs testing => reviewed and tested
2012-12-13 02:54 alex File Added: 2_urls_to_single_page_1433_v4.patch
2012-12-11 04:07 erik Note Added: 0005333
2012-12-11 04:07 erik Assigned To erik => alex
2012-12-11 04:07 erik Status needs work => needs testing
2012-12-11 04:06 erik File Added: 2_urls_to_single_page_1433_v3.patch
2012-12-11 03:06 alex Note Added: 0005332
2012-12-11 03:06 alex Assigned To alex => erik
2012-12-11 03:06 alex Status needs testing => needs work
2012-12-06 12:44 erik Note Added: 0005325
2012-12-06 12:44 erik Assigned To erik => alex
2012-12-06 12:44 erik Status needs work => needs testing
2012-12-06 12:43 erik File Added: 2_urls_to_single_page_1433_v2.patch
2012-12-06 04:10 alex Note Added: 0005319
2012-12-06 04:10 alex Assigned To alex => erik
2012-12-06 04:10 alex Status needs testing => needs work
2012-12-05 10:44 erik Note Added: 0005317
2012-12-05 10:44 erik Assigned To => alex
2012-12-05 10:44 erik Developer => erik
2012-12-05 10:44 erik Status active => needs testing
2012-12-05 10:44 erik File Added: 2_urls_to_single_page_1433.patch
2012-12-05 03:11 alex Note Added: 0005313
2012-12-05 02:43 alex Description Updated View Revisions
2012-11-05 11:09 alex New Issue
2012-11-05 11:09 alex Reference =>
2012-11-05 11:09 alex Change Log Message => Fixes multiple urls pointing to a single page problem
2012-11-05 11:09 alex Estimate Points => 1

Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker