Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- AddEventHandler('main', 'OnBuildGlobalMenu', 'ASDOnBuildGlobalMenu');
- function ASDOnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu)
- {
- $arSites = array(
- 'www.site.ru' => 's1',
- 'site.ru' => 's1',
- );
- $arIBsites = array();
- $rsIB = $GLOBALS['DB']->Query("SELECT * FROM b_iblock_site;");
- while ($arIB = $rsIB->Fetch())
- $arIBsites[$arIB['IBLOCK_ID']] = $arIB['SITE_ID'];
- foreach ($aModuleMenu as $k => &$v)
- {
- if($v['parent_menu']=='global_menu_content' && $v['module_id']=='iblock' && $v['page_icon']!='iblock_page_icon_settings')
- {
- $cUnsets = 0;
- $cAll = count($v['items']);
- foreach ($v['items'] as $kk => $vv)
- {
- $BID = array_pop(explode('/', $vv['items_id']));
- if ($arIBsites[$BID] != $arSites[$_SERVER['SERVER_NAME']])
- {
- unset($v['items'][$kk]);
- $cUnsets++;
- }
- }
- if ($cUnsets == $cAll)
- unset($aModuleMenu[$k]);
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement