Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Creating the area menu...
- echo '
- <div align="center">';
- // Making an array of all the sections and what categories comprise them. Category 11 is added to each by default.
- $sections = array(
- 'general' => array(2, 4, 8),
- 'roleplay' => array(3, 13),
- 'staff' => array(1, 10),
- );
- // Grabbing what area we're on...
- $area = (isset($_GET['area']) && (in_array($_GET['area'], array_keys($sections))) ? htmlspecialchars($_GET['area'], ENT_QUOTES) : 'general');
- $is_active = false;
- foreach ($sections as $act => $cats)
- {
- // Determining the active area.
- if ($area === $act)
- $is_active = true;
- else
- $is_active = false;
- // Determining if so-and-so can see so-and-so action(s).
- if (in_array($act, array('staff', 'archive')))
- $can_see = (count(array_intersect(array(1, 2, 3), $user_info['groups'])) > 0);
- else
- $can_see = true;
- // Generating the link if so-and-so can see it.
- if ($can_see)
- echo '
- <a href="', $scripturl, '?area=', $act, '"><img src="', $settings['images_url'], '/menu_buttons/', $act, $is_active ? '_active.gif' : '.gif', '" alt="', $act, '" title="', $act, '" /></a> ';
- }
- $real_categories = array();
- if (!empty($area) && (in_array($area, array_keys($sections))))
- {
- while (list($id, $category) = each($context['categories']))
- {
- if (in_array($id, $sections[$area]))
- $real_categories[] = $category;
- elseif ($id == 11)
- $real_categories[] = $category;
- }
- if ($area != 'all')
- $context['categories'] = $real_categories;
- }
- echo '
- </div>';
Advertisement
Add Comment
Please, Sign In to add comment