[horde] Duplicate Turba Icon In Top Menu When 'horde' not in 'apps'

John Merriam johnm at ntplx.net
Wed Aug 5 18:41:27 UTC 2009


Well, this is a really strange one to me.  I tried fiddling with a bunch 
of the simple things including downgrading from PHP 5.2.10 to 5.2.9, 
none of which made a difference.

So I started poking around in the code which is when I really was 
getting confused.  Somehow, when 'horde' is not in the 
$conf['menu']['apps'] array for IMP, Ingo or Turba an extra element gets 
added to the array.  On my system, 'turba' is getting tacked on to the 
end of the $conf['menu']['apps'] array if 'horde' is not in the array.

It also does not matter what the order of the apps is, it is always 
'turba' getting pushed on to the end.

It is as if $conf['menu']['apps'] = array('turba','ingo'); is getting 
magically changed to $conf['menu']['apps'] = array('turba','ingo', 'turba');

Very very strange if you ask me.

The file where the menu seems to me to be generated and where I have 
verified that 'turba' is pushed on to the end of the apps array is 
horde/lib/Horde/Menu.php

I have written a nasty hack to work around this.  Below is a patch in 
case someone else needs to fix the same issue:

--- Menu.php    2009-08-05 11:50:19.000000000 -0400
+++ Menu.php.hacked     2009-08-05 14:16:03.000000000 -0400
@@ -261,6 +261,19 @@
          global $conf, $registry;

          if (isset($conf['menu']['apps']) && 
is_array($conf['menu']['apps'])) {
+            // A stupid hack to fix duplicate turba icons in top menu
+            if (!array_search("horde", $conf['menu']['apps'])) {
+                $noduplicate = $conf['menu']['apps'];
+                array_pop($noduplicate);
+                foreach ($noduplicate as $app) {
+                    if ($registry->get('status', $app) != 'inactive' && 
$registry->hasPermission($app, PERMS_SHOW)) {
+                        $url = $registry->getInitialPage($app);
+                        if (!is_a($url, 'PEAR_Error')) {
+                            $this->add(Horde::url($url), 
$registry->get('name', $app), $registry->get('icon', $app), '');
+                        }
+                    }
+                }
+            } else {
              foreach ($conf['menu']['apps'] as $app) {
                  if ($registry->get('status', $app) != 'inactive' && 
$registry->hasPermission($app, PERMS_SHOW)) {
                      $url = $registry->getInitialPage($app);
@@ -269,6 +282,7 @@
                      }
                  }
              }
+            }
          }
      }


That just pops the last element off the apps array to work around the 
problem.

Yes it is stupid but what I will use for now.  A correct fix would be 
good though.

I have no idea how this could be happening.  I searched the code for 
array_push() calls and didn't see anything that looks to me like it 
would be the culprit.


John Merriam wrote:
> Hello.  I'm installing the latest versions of Horde, IMP, Ingo and 
> Turba.  I have everything set up, configured and ready to go except one 
> strange issue.  I have two Address Book icons/links showing up in the 
> top menu bar.
...
> Any ideas of how to fix this?  Thanks.

-- 

John Merriam
johnm at ntplx.net


More information about the horde mailing list