Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?
  2. AddEventHandler('main', 'OnBuildGlobalMenu', 'ASDOnBuildGlobalMenu');
  3. function ASDOnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu)
  4. {
  5. $arSites = array(
  6. 'www.site.ru' => 's1',
  7. 'site.ru' => 's1',
  8. );
  9.  
  10. $arIBsites = array();
  11. $rsIB = $GLOBALS['DB']->Query("SELECT * FROM b_iblock_site;");
  12. while ($arIB = $rsIB->Fetch())
  13. $arIBsites[$arIB['IBLOCK_ID']] = $arIB['SITE_ID'];
  14.  
  15. foreach ($aModuleMenu as $k => &$v)
  16. {
  17. if($v['parent_menu']=='global_menu_content' && $v['module_id']=='iblock' && $v['page_icon']!='iblock_page_icon_settings')
  18. {
  19. $cUnsets = 0;
  20. $cAll = count($v['items']);
  21. foreach ($v['items'] as $kk => $vv)
  22. {
  23. $BID = array_pop(explode('/', $vv['items_id']));
  24. if ($arIBsites[$BID] != $arSites[$_SERVER['SERVER_NAME']])
  25. {
  26. unset($v['items'][$kk]);
  27. $cUnsets++;
  28. }
  29. }
  30. if ($cUnsets == $cAll)
  31. unset($aModuleMenu[$k]);
  32. }
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement