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

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

So the colon really confuse the parse_url().

Comments

agentrickard’s picture

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(
ariflukito’s picture

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

agentrickard’s picture

Did you rebuild the menus?

agentrickard’s picture

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().

ariflukito’s picture

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.

agentrickard’s picture

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

ariflukito’s picture

StatusFileSize
new3.69 KB

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.

agentrickard’s picture

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?

ariflukito’s picture

nope it doesn't generate menu items

agentrickard’s picture

Status: Active » Needs work
agentrickard’s picture

Status: Needs work » Patch (to be ported)

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

ariflukito’s picture

I dont get the same warning in D5

should we force menu_rebuild() for next release?

agentrickard’s picture

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.

ariflukito’s picture

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

ariflukito’s picture

StatusFileSize
new1.74 KB

backport patch for D5

agentrickard’s picture

Version: 6.x-2.0-rc5 » 5.x-1.10
Status: Patch (to be ported) » Needs review
agentrickard’s picture

Status: Needs review » Fixed
StatusFileSize
new1.98 KB

Updated to 5.x-dev and committed!

Status: Fixed » Closed (fixed)

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