Rebelphoenix

Untitled

May 27th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1.  
  2. // Creating the area menu...
  3. echo '
  4. <div align="center">';
  5.  
  6. // Making an array of all the sections and what categories comprise them. Category 11 is added to each by default.
  7. $sections = array(
  8. 'general' => array(2, 4, 8),
  9. 'roleplay' => array(3, 13),
  10. 'staff' => array(1, 10),
  11. );
  12.  
  13. // Grabbing what area we're on...
  14. $area = (isset($_GET['area']) && (in_array($_GET['area'], array_keys($sections))) ? htmlspecialchars($_GET['area'], ENT_QUOTES) : 'general');
  15.  
  16. $is_active = false;
  17. foreach ($sections as $act => $cats)
  18. {
  19. // Determining the active area.
  20. if ($area === $act)
  21. $is_active = true;
  22. else
  23. $is_active = false;
  24.  
  25. // Determining if so-and-so can see so-and-so action(s).
  26. if (in_array($act, array('staff', 'archive')))
  27. $can_see = (count(array_intersect(array(1, 2, 3), $user_info['groups'])) > 0);
  28. else
  29. $can_see = true;
  30.  
  31. // Generating the link if so-and-so can see it.
  32. if ($can_see)
  33. echo '
  34. <a href="', $scripturl, '?area=', $act, '"><img src="', $settings['images_url'], '/menu_buttons/', $act, $is_active ? '_active.gif' : '.gif', '" alt="', $act, '" title="', $act, '" /></a>&nbsp;';
  35. }
  36.  
  37. $real_categories = array();
  38. if (!empty($area) && (in_array($area, array_keys($sections))))
  39. {
  40. while (list($id, $category) = each($context['categories']))
  41. {
  42. if (in_array($id, $sections[$area]))
  43. $real_categories[] = $category;
  44. elseif ($id == 11)
  45. $real_categories[] = $category;
  46. }
  47.  
  48. if ($area != 'all')
  49. $context['categories'] = $real_categories;
  50. }
  51.  
  52. echo '
  53. </div>';
Advertisement
Add Comment
Please, Sign In to add comment