diff options
author | David M <davidmj@users.sourceforge.net> | 2007-03-24 18:00:21 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-03-24 18:00:21 +0000 |
commit | 6bc4b1412b42c275b0715ee47c5bf923ee3f2206 (patch) | |
tree | cb9b93f00944ee675e7a0aca76b3c9513e1128ba /phpBB/includes/functions_module.php | |
parent | f269de0fd49481dae1dd28076d6e08115b9edba0 (diff) | |
download | forums-6bc4b1412b42c275b0715ee47c5bf923ee3f2206.tar forums-6bc4b1412b42c275b0715ee47c5bf923ee3f2206.tar.gz forums-6bc4b1412b42c275b0715ee47c5bf923ee3f2206.tar.bz2 forums-6bc4b1412b42c275b0715ee47c5bf923ee3f2206.tar.xz forums-6bc4b1412b42c275b0715ee47c5bf923ee3f2206.zip |
#5280
git-svn-id: file:///svn/phpbb/trunk@7229 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r-- | phpBB/includes/functions_module.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index d45358327f..651e35032c 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -465,6 +465,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 */ function get_parents($parent_id, $left_id, $right_id, &$all_parents) |