Forums / Install & configuration / [BUG?] uri matching and elements > 1

[BUG?] uri matching and elements > 1

Author Message

Christian Rößler

Tuesday 09 March 2010 2:36:15 am

Hi,

I am about to setup a site using a mix of 2 access-types:

  • host based access using mapping
  • uri based access using elements

So i want to reach different siteaccesses the following way:

  • admin-de.example.com -> admin_DE
  • admin-en.example.com -> admin_EN
  • example.com/germany/de -> germany_de
  • example.com/germany/en -> germany_en

Everything is working as expected, using the following override-site.ini statements:

-------------------------------
[SiteAccessSettings]
CheckValidity=false
ForceVirtualHost=true

MatchOrder=host;uri
AvailableSiteAccessList[]=admin_DE
AvailableSiteAccessList[]=admin_EN
AvailableSiteAccessList[]=germany_de
AvailableSiteAccessList[]=germany_en
AvailableSiteAccessList[]=finland_fi
AvailableSiteAccessList[]=finland_en

HostMatchType=map
HostMatchMapItems[]
HostMatchMapItems[]=admin-de.example.com;admin_DE
HostMatchMapItems[]=admin-en.example.com;admin_EN
URIMatchType=element
URIMatchElement=2
----------------------------------

With the settings above, I am able to visit the siteaccesses as defined and described.
The URIMatchType element plus utilizing URIMatchElement=2 converts the request-Uri from '/germany/de/products/shoes/123' to the following Siteaccess-name: 'germany_de'.

Everything is fine 'til here. Now the (possible) Bug:

When creating links to contentobjects using the template-function ezurl, the followign links are being generated:
-----------
{"/content/view/ful/123"|ezurl} template code
/germany_de/content/view/full/123 output in html
/germany/de/content/view/full/123 output in html that is correct but not generated :-(
-----------
Am i missing something? The implementation of the following file/method seems not to take into account, that when using uri-type-matching plus using elements and elements being > 1, to reproduce a correct siteaccess-uri, not the siteaccess-directory-name. I implemented a workaround for this particular problem as below:

/lib/ezurils/classes/ezsys.php, method indexFile, around line 530, ezpublish 4.2.0
-------------------------------
if ( $withAccessList and count( $instance->AccessPath ) > 0 )
{
//$accessPath = implode( '/', $instance->AccessPath ); <--- original code
$accessPathArray = $instance->AccessPath; <-- added
$accessPathArray[0] = str_replace( '_', '/', $accessPathArray[0] ); <- added
$accessPath = implode( '/', $accessPathArray ); <-- added
...
...
-------------------------------

edit: added the function name, line and ez-version

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613