domain content & url encoding

ariflukito - November 19, 2008 - 06:37
Project:Domain Access
Version:5.x-1.10
Component:- Domain Content
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi with domains with non standard port I get a path like this '/drupal/admin/domain/content/au.qtp:8080'

When switching between affiliate content pages I get this error message consitently

warning: parse_url(/drupal/admin/domain/content/au.qtp:8080) [function.parse-url]: Unable to parse URL in C:\www\drupal\sites\all\modules\domain\domain.module on line 1066.

If I click on the same page again the path is properly encoded ie. '/drupal/admin/domain/content/au.qtp%3A8080' and the error message disappear.

The problem here is with the colon, without it parse_url can parse succesfully. So should we just strip the colon or calling urlencode() just before calling parse_url()?

With the later however, it's going to be a problem for a feature that I'd like to have (#336218: Return to referring page after deleting content from affiliated content page). The problem is with drupal_goto(), it uses the following to get the return path parse_url(urldecode($_REQUEST['destination'])). It decodes the path first, so path 'admin/domain/content/au.qtp:8080' will get parsed like this

<?php
Array
(
    [
host] => admin
   
[port] => 8080
   
[path] => /domain/content/au.qtp:8080
)
?>

So the colon really confuse the parse_url().

#1

agentrickard - November 19, 2008 - 14:20

The problem is in line 44 of domain_content.module.

Does this work:

  foreach ($domains as $domain) {
    $items['admin/domain/content/'. urlencode(filter_xss_admin($domain['subdomain']))] = array(

#2

ariflukito - November 19, 2008 - 22:43

No it doesn't. It makes all affiliate content pages disappear. There is only "Content for all affiliate sites" under "Affiliated Content".

#3

agentrickard - November 19, 2008 - 23:39

Did you rebuild the menus?

#4

agentrickard - November 19, 2008 - 23:52

This may be insurmountable without using domain_id instead of subdomain as the url argument. I think the menu system is choking on the % sign that urlencode() inserts.

I originally wrote it that way to be more user 'friendly' to non-technical editors. The fix is to use domain_id instead.

    $items['admin/domain/content/'. $domain['domain_id']] = array(

There is a better solution by using %domain, and changing the arguments for domain_content_view().

#5

ariflukito - November 20, 2008 - 01:38

Yes I did rebuilt the menu.

The other option is to chop the port number all together and it still makes the url friendly. But I guess you don't want that, you want to keep them separate sites.

#6

agentrickard - November 20, 2008 - 13:55

Yes. The fix in #4 is the proper one.

#7

ariflukito - November 21, 2008 - 04:09

ok something like this

some notes:
- using wildcard doesn't genarate menu items
- I pass the first page argument for domain/content/all as string ('-1'), because drupal doesn't seem to let me pass numeric value there

this one also works

$items['admin/domain/content/'. $domain['domain_id']] = array(

edit:
hmm I think I made a mistake. I think the is_numeric() check inside domain_load() should be done in domain_lookup() instead, since the is_null() check is done there.

AttachmentSize
domain.patch 3.69 KB

#8

agentrickard - November 21, 2008 - 15:06

Good point about menu items. Looks like we may still need to run a proper loop there, setting domain_id.

Does the current patch generate menu items as expected on the main Affiliated Content page?

#9

ariflukito - November 22, 2008 - 00:16

nope it doesn't generate menu items

#10

agentrickard - December 26, 2008 - 15:54
Status:active» needs work

#11

agentrickard - January 4, 2009 - 16:41
Status:needs work» patch (to be ported)

Fixed. And we now run a menu rebuild when domains are updated.

#12

ariflukito - January 5, 2009 - 01:16

I dont get the same warning in D5

should we force menu_rebuild() for next release?

#13

agentrickard - January 5, 2009 - 03:54

I was planning to force the menu rebuild. There are a handful of reasons for why it needs to be done. Not sure if this issue affects D5 in the same way.

#14

ariflukito - January 5, 2009 - 06:07

oops I spoke too soon, I just get the same warning in D5.

#15

ariflukito - June 9, 2009 - 04:27

backport patch for D5

AttachmentSize
D5 port 1.74 KB

#16

agentrickard - June 9, 2009 - 14:09
Version:6.x-2.0-rc5» 5.x-1.10
Status:patch (to be ported)» needs review

#17

agentrickard - June 13, 2009 - 20:25
Status:needs review» fixed

Updated to 5.x-dev and committed!

AttachmentSize
336221-domain-content.patch 1.98 KB

#18

System Message - June 27, 2009 - 20:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.