domain content & url encoding
| Project: | Domain Access |
| Version: | 5.x-1.10 |
| Component: | - Domain Content |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
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
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
No it doesn't. It makes all affiliate content pages disappear. There is only "Content for all affiliate sites" under "Affiliated Content".
#3
Did you rebuild the menus?
#4
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
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
Yes. The fix in #4 is the proper one.
#7
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.
#8
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
nope it doesn't generate menu items
#10
#11
Fixed. And we now run a menu rebuild when domains are updated.
#12
I dont get the same warning in D5
should we force menu_rebuild() for next release?
#13
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
oops I spoke too soon, I just get the same warning in D5.
#15
backport patch for D5
#16
#17
Updated to 5.x-dev and committed!
#18
Automatically closed -- issue fixed for 2 weeks with no activity.