[horde] Duplicate Turba Icon In Top Menu When 'horde' not in 'apps'
Jan Schneider
jan at horde.org
Wed Aug 5 20:53:41 UTC 2009
Zitat von John Merriam <johnm at ntplx.net>:
> 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 @@
> }
> }
> }
> + }
> }
> }
>
A simple:
$conf['menu']['apps'] = array_unique($conf['menu']['apps']);
right before the loop should do the same.
> 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.
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digitale PGP-Unterschrift
URL: <http://lists.horde.org/archives/horde/attachments/20090805/a6757719/attachment.bin>
More information about the horde
mailing list