1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-04 05:25:01 +02:00
git-svn-id: file:///svn/phpbb/trunk@7229 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2007-03-24 18:00:21 +00:00
parent f269de0fd4
commit 6bc4b1412b
2 changed files with 88 additions and 45 deletions

View File

@ -464,6 +464,44 @@ class p_master
}
}
/**
* Check if a module is active
*/
function is_active($id = false)
{
$icat = false;
$category = false;
foreach ($this->module_ary as $row_id => $item_ary)
{
// If this is a module and it's selected, active
// If this is a category and the module is the first within it, active
// If this is a module and no mode selected, select first mode
// If no category or module selected, go active for first module in first category
if (
(($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && (($item_ary['mode'] == false && !$item_ary['cat']) || ($icat && $item_ary['cat']))) ||
($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat && $item_ary['display']) ||
(($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && !$item_ary['cat']) ||
(!$id && !$item_ary['cat'] && $item_ary['display'])
)
{
if ($item_ary['cat'])
{
$id = $icat;
$icat = false;
continue;
}
return $item_ary['id'];
}
else if (($item_ary['cat'] && $item_ary['id'] === (int) $id) || ($item_ary['parent'] === $category && $item_ary['cat']))
{
$category = $item_ary['id'];
}
}
}
/**
* Get parents
*/

View File

@ -241,7 +241,14 @@ if (!$user->data['is_registered'])
login_box('', $user->lang['LOGIN_EXPLAIN_UCP']);
}
// Instantiate module system and generate list of available modules
$module->list_modules('ucp');
// Check if the zebra module is set
$zebra_enabled = $module->is_active('zebra') ? true : false;
if ($zebra_enabled)
{
// Output listing of friends online
$update_time = $config['load_online_time'] * 60;
@ -285,9 +292,7 @@ while ($row = $db->sql_fetchrow($result))
);
}
$db->sql_freeresult($result);
// Instantiate module system and generate list of available modules
$module->list_modules('ucp');
}
// Select the active module
$module->set_active($id, $mode);