Hi mike,

I am adding this Bug report as you suggested to keep this in a separate ticket.

The issue is,

While creating a Homebox page if you provide a path which already exists in the site, it takes that.(overrides, infact) . Instead of that it should throw an error like "The path is already in use." I am able to use the same path for all the 3 homebox pages!! It does not throw any error. It keeps overriding and shows latest overridden homebox page on that url. Even it accepts the sensitive paths like "admin/build/modules" !! Hence on this page admin/build/modules I see my homebox page now.

I resolved this issue in my site & here attaching a patch for this.

~ Ipsita

CommentFileSizeAuthor
homebox_code_cleanup.patch545 bytesipsitamishra
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstef’s picture

Status: Needs review » Fixed

Thanks again for finding this and creating a patch.

I just committed a fix to this. I did it differently though. I'm not sure why I decided to loop through all of the menu paths.

Better:

  // Check path against existing paths
  $existing = db_result(db_query("SELECT path FROM {menu_router} WHERE path = '%s'", $path));
  if ($existing) {
    drupal_set_message("path: $path");
      if ($element) {
        form_set_error($element, t('The chosen path is already in use.'));
      } 
      return FALSE;
  }

This did, however, bring forward a very big bug with the home box API because since that always returned TRUE, I never noticed..

For all Home Boxes that reside in code via the API, homebox_check_page_object() is used to check the code before using it. This obviously checks the path to see if it's in use. The first check will be fine because it's not in the menu - the second will always fail though.

Hmm..

mstef’s picture

Wanna hear something weird...

Path.module seems to let you do the same exact thing..

ipsitamishra’s picture

Yes I agree, this is a clean code than the one before with that while loop. :)

I created a patch for the issue regarding this - "The first check will be fine because it's not in the menu - the second will always fail though."

Submitting the patch to this thread http://drupal.org/node/828682

Cheers,
Ipsita

Status: Fixed » Closed (fixed)

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