Beispiel #1
0
    /**
     * Shows information about CDN free space in Admin's informer popup
     *
     * @return void
     */
    public function OnAdminInformerInsertItems()
    {
        $CDNAIParams = array("TITLE" => GetMessage("BCL_BACKUP_AI_TITLE"), "COLOR" => "peach");
        $backup = self::getInstance();
        $backup->loadFromOptions();
        $last_request_time_option = CBitrixCloudOption::getOption("backup_last_backup_time");
        try {
            if ($backup->getQuota() <= 0 && $last_request_time_option->getIntegerValue() <= 0) {
                $backup->_getInformation(true);
                $backup->saveToOptions();
                $last_request_time_option->setStringValue((string) time());
            }
        } catch (CBitrixCloudException $e) {
            ///TODO show error to user
            return;
        }
        if ($backup->getQuota() <= 0) {
            return;
        }
        $arFiles = $backup->listFiles();
        if (empty($arFiles)) {
            $PROGRESS_FREE = 100;
            $AVAIL = $backup->getQuota();
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = true;
            $MESS = '<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_NO_FILES") . '</span>';
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY") . '</a>';
        } elseif ($backup->getLastTimeBackup() < time() - 7 * 24 * 3600) {
            $AVAIL = $backup->getQuota() - $backup->getUsage();
            if ($AVAIL < 0.0) {
                $AVAIL = 0.0;
            }
            $PROGRESS_FREE = round($AVAIL / $backup->getQuota() * 100);
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = true;
            $MESS = '<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_LAST_TIME") . ': ' . FormatDate(array("today" => "today", "yesterday" => "yesterday", "" => "dago"), $backup->getLastTimeBackup()) . '.</span>';
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY") . '</a>';
        } else {
            $AVAIL = $backup->getQuota() - $backup->getUsage();
            if ($AVAIL < 0.0) {
                $AVAIL = 0.0;
            }
            $PROGRESS_FREE = round($AVAIL / $backup->getQuota() * 100);
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = false;
            $MESS = GetMessage("BCL_BACKUP_AI_LAST_TIME") . ': ' . FormatDate(array("today" => "today", "yesterday" => "yesterday", "" => "dago"), $backup->getLastTimeBackup());
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP") . '</a>';
        }
        if (isset($CDNAIParams["ALERT"])) {
            $PROGRESS_FREE_BAR = $PROGRESS_FREE < 0 ? 0 : $PROGRESS_FREE;
            $CDNAIParams["HTML"] = '
				<div class="adm-informer-item-section">
					<span class="adm-informer-item-l">
						<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_USAGE_TOTAL") . '</span> ' . $ALLOWED . '
					</span>
					<span class="adm-informer-item-r">
							<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_USAGE_AVAIL") . '</span> ' . CFile::FormatSize($AVAIL, 0) . '
					</span>
				</div>
				<div class="adm-informer-status-bar-block" >
					<div class="adm-informer-status-bar-indicator" style="width:' . (100 - $PROGRESS_FREE_BAR) . '%; "></div>
					<div class="adm-informer-status-bar-text">' . (100 - $PROGRESS_FREE) . '%</div>
				</div>
			' . $MESS;
            CAdminInformer::AddItem($CDNAIParams);
        }
    }
Beispiel #2
0
	/**
	 * Shows information about WAF stats in Admin's informer popup
	 * @return bool|void
	 */
	public static function OnAdminInformerInsertItems()
	{
		/** @global CMain $APPLICATION */
		global $APPLICATION;
		if ($APPLICATION->GetGroupRight("security") < "W")
			return false;

		$setupLink = '/bitrix/admin/security_filter.php?lang='.LANGUAGE_ID;
		$WAFAIParams = array(
			"TITLE" => getMessage("SECURITY_FILTER_INFORM_TITLE"),
			"COLOR" => "blue",
			"FOOTER" => '<a href="'.$setupLink.'">'.getMessage("SECURITY_FILTER_INFORM_LINK_TO_SETUP_ON").'</a>'
		);

		try
		{
			if (self::IsActive())
			{

				$days = COption::getOptionInt("main", "event_log_cleanup_days", 7);
				if($days > 7)
					$days = 7;
				$timestampX = ConvertTimeStamp(time()-$days*24*3600+CTimeZone::getOffset());
				$eventLink = '/bitrix/admin/event_log.php?set_filter=Y&find_type=audit_type_id&find_audit_type[]=SECURITY_FILTER_SQL&find_audit_type[]=SECURITY_FILTER_XSS&find_audit_type[]=SECURITY_FILTER_XSS2&find_audit_type[]=SECURITY_FILTER_PHP&mod=security&find_timestamp_x_1='.$timestampX.'&lang='.LANGUAGE_ID;

				$eventCount = self::getEventsCount($timestampX);
				if($eventCount > 999)
					$eventCount = round($eventCount/1000,1).'K';

				if($eventCount > 0)
					$descriptionText = getMessage("SECURITY_FILTER_INFORM_EVENT_COUNT").'<a href="'.$eventLink.'">'.$eventCount.'</a>';
				else
					$descriptionText = getMessage("SECURITY_FILTER_INFORM_EVENT_COUNT_EMPTY");

				$WAFAIParams["FOOTER"] = '<a href="'.$setupLink.'">'.getMessage("SECURITY_FILTER_INFORM_LINK_TO_SETUP").'</a>';
				$WAFAIParams["ALERT"] = false;

				$WAFAIParams["HTML"] = '
<div class="adm-informer-item-section">
	<span class="adm-informer-item-l">
		<span class="adm-informer-strong-text">'.getMessage("SECURITY_FILTER_INFORM_FILTER_ON").'</span>
		<span>'.$descriptionText.'</span>
	</span>
</div>
';
			}
			else
			{
				$WAFAIParams["ALERT"] = true;

				$WAFAIParams["HTML"] = '
<div class="adm-informer-item-section">
		<span class="adm-informer-item-l">
			<span class="adm-informer-strong-text">'.getMessage("SECURITY_FILTER_INFORM_FILTER_OFF").'</span>
			<span>'.getMessage("SECURITY_FILTER_INFORM_FILTER_ON_RECOMMENDATION", array("#LINK#" => $setupLink)).'</span>
		</span>
</div>
';
			}
		}
		catch (Exception $e)
		{
			$WAFAIParams["TITLE"] .= " - ".getMessage("top_panel_ai_title_err");
			$WAFAIParams["ALERT"] = true;
			$WAFAIParams["HTML"] = $e->getMessage();
		}

		CAdminInformer::AddItem($WAFAIParams);
		return true;
	}
<?php

// define("START_EXEC_EPILOG_BEFORE_1", microtime());
$GLOBALS["BX_STATE"] = "EB";
if ($USER->IsAuthorized() && (!defined("BX_AUTH_FORM") || !BX_AUTH_FORM)) {
    $hkInstance = CHotKeys::getInstance();
    $Execs = $hkInstance->GetCodeByClassName("Global");
    echo $hkInstance->PrintJSExecs($Execs);
    echo $hkInstance->SetTitle("Global");
    $Execs = $hkInstance->GetCodeByUrl($_SERVER["REQUEST_URI"]);
    echo $hkInstance->PrintJSExecs($Execs);
    echo $hkInstance->PrintPhpToJSVars();
    echo CAdminInformer::PrintHtml();
}
if (!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1) {
    if (!defined("BX_AUTH_FORM") || !BX_AUTH_FORM) {
        require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/epilog_main_admin.php";
    } else {
        require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/epilog_auth_admin.php";
    }
} else {
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/epilog_jspopup_admin.php";
}
Beispiel #4
0
 public static function OnAdminInformerInsertItems()
 {
     global $USER;
     if (!defined("BX_AUTH_FORM")) {
         $tasksCount = CUserCounter::GetValue($USER->GetID(), 'bp_tasks');
         if ($tasksCount > 0) {
             $bpAIParams = array("TITLE" => GetMessage("BPTS_AI_BIZ_PROC"), "HTML" => '<span class="adm-informer-strong-text">' . GetMessage("BPTS_AI_EX_TASKS") . '</span><br>' . GetMessage("BPTS_AI_TASKS_NUM") . ' ' . $tasksCount, "FOOTER" => '<a href="/bitrix/admin/bizproc_task_list.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BPTS_AI_TASKS_PERF") . '</a>', "COLOR" => "red", "ALERT" => true);
             CAdminInformer::AddItem($bpAIParams);
         }
     }
 }
Beispiel #5
0
	function GetPanelHtml()
	{
		global $USER, $APPLICATION, $DB;

		$hkInstance = CHotKeys::getInstance();

		if ($APPLICATION->ShowPanel === false || (!$USER->IsAuthorized() && $APPLICATION->ShowPanel !== true))
			return "";

		CTopPanel::InitPanelIcons();

		$arPanelButtons = &$APPLICATION->arPanelButtons;
		usort($arPanelButtons, array("CTopPanel", "SortButtons"));

		$bShowPanel = false;
		foreach($arPanelButtons as $key=>$arValue)
		{
			if(trim($arValue["HREF"]) <> "" || is_array($arValue["MENU"]) && !empty($arValue["MENU"]))
			{
				//we have at least one button to show
				$bShowPanel = true;
				break;
			}
		}

		if($bShowPanel == false)
		{
			$arCodes = unserialize(COption::GetOptionString("main", "show_panel_for_users"));
			if($USER->CanAccess($arCodes))
			{
				//we have settings in the main module options
				$bShowPanel = true;
			}
		}

		if ($bShowPanel == false && $APPLICATION->ShowPanel !== true)
			return "";

		$APPLICATION->PanelShowed = true;


		if ($_GET["back_url_admin"] <> "" && strpos($_GET["back_url_admin"], "/") === 0)
			$_SESSION["BACK_URL_ADMIN"] = $_GET["back_url_admin"];

		$aUserOpt = CUserOptions::GetOption("admin_panel", "settings");
		$aUserOptGlobal = CUserOptions::GetOption("global", "settings");

		$toggleModeSet = false;
		if (isset($_GET["bitrix_include_areas"]) && $_GET["bitrix_include_areas"] <> "")
		{
			$APPLICATION->SetShowIncludeAreas($_GET["bitrix_include_areas"]=="Y");
			$toggleModeSet = true;
		}

		$showMode = $APPLICATION->GetPublicShowMode();

		$params = DeleteParam(array("bitrix_include_areas", "bitrix_show_mode", "back_url_admin"));
		$href = $APPLICATION->GetCurPage();
		$hrefEnc = htmlspecialcharsbx($href);

		$toggleModeDynamic = $aUserOptGlobal['panel_dynamic_mode'] == 'Y';
		$toggleMode = $toggleModeDynamic && !$toggleModeSet
			? $aUserOpt['edit'] == 'on'
			: $APPLICATION->GetShowIncludeAreas() == 'Y';

		//Save if changed
		$old_edit = $aUserOpt['edit'];
		$aUserOpt['edit'] = $toggleMode ? 'on' : 'off';
		if($old_edit !== $aUserOpt['edit'])
			CUserOptions::SetOption('admin_panel', 'settings', $aUserOpt);

		$toggleModeLink = $hrefEnc.'?bitrix_include_areas='.($toggleMode ? 'N' : 'Y').($params<>""? "&amp;".htmlspecialcharsbx($params):"");

		$maxQuotaMB = COption::GetOptionInt("main", "disk_space", 0);
		$maxQuota = $maxQuotaMB*1048576;//*1024*1024
		if($maxQuota > 0)
		{
			$quota = new CDiskQuota();
			$free = $quota->GetDiskQuota();
			$freeMB = intval($free/1048576);
		}

		$result = CTopPanel::ShowPanelScripts(true);
		$result .= '
	<!--[if lte IE 7]>
	<style type="text/css">#bx-panel {display:none !important;}</style>
	<div id="bx-panel-error">'.GetMessage("top_panel_browser").'</div><![endif]-->
	<script type="text/javascript">BX.admin.dynamic_mode='.($toggleModeDynamic ? 'true' : 'false').'; BX.admin.dynamic_mode_show_borders = '.($toggleMode ? 'true' : 'false').';</script>
	<div style="display:none; overflow:hidden;" id="bx-panel-back"></div>
	<div id="bx-panel"'.($aUserOpt["collapsed"] == "on" ? ' class="bx-panel-folded"':'').'>
		<div id="bx-panel-top">
			<div id="bx-panel-top-gutter"></div>
			<div id="bx-panel-tabs">
	';
		$result .= '
				<a id="bx-panel-menu" href="" '.CTopPanel::AddAttrHint(GetMessage('top_panel_start_menu_tooltip_title'), GetMessage('top_panel_start_menu_tooltip')).'><span id="bx-panel-menu-icon"></span><span id="bx-panel-menu-text">'.GetMessage("top_panel_menu").'</span></a><a id="bx-panel-view-tab"><span>'.GetMessage("top_panel_site").'</span></a><a id="bx-panel-admin-tab" href="'.(
						$_SESSION["BACK_URL_ADMIN"] <> ""
						? htmlspecialcharsbx($_SESSION["BACK_URL_ADMIN"]).(strpos($_SESSION["BACK_URL_ADMIN"], "?") !== false? "&amp;":"?")
						: '/bitrix/admin/index.php?lang='.LANGUAGE_ID.'&amp;'
					).'back_url_pub='.urlencode($href.($params<>""? "?".$params:"")).'"><span>'.GetMessage("top_panel_admin").'</span></a>';

		$back_url = CUtil::JSUrlEscape(CUtil::addslashes($href.($params<>""? "?".$params:"")));
		$arStartMenuParams = array(
			'DIV' => 'bx-panel-menu',
			'ACTIVE_CLASS' => 'bx-pressed',
			'MENU_URL' => '/bitrix/admin/get_start_menu.php?lang='.LANGUAGE_ID.'&back_url_pub='.urlencode($back_url).'&'.bitrix_sessid_get(),
			'MENU_PRELOAD' => ($aUserOptGlobal["start_menu_preload"] == 'Y')
		);

		$result .= '<script type="text/javascript">new BX.COpener('.CUtil::PhpToJsObject($arStartMenuParams).')</script>';

		$Execs=$hkInstance->GetCodeByClassName("top_panel_menu",GetMessage("top_panel_menu"));
		$result .=$hkInstance->PrintJSExecs($Execs);
		$Execs=$hkInstance->GetCodeByClassName("top_panel_admin",GetMessage("top_panel_admin"));
		$result .=$hkInstance->PrintJSExecs($Execs);

		$informerItemsCount = CAdminInformer::InsertMainItems();

		if($informerItemsCount>0)
			$result .= '<a class="adm-header-notif-block" id="adm-header-notif-block" onclick="BX.adminInformer.Toggle(this);"><span class="adm-header-notif-icon"></span><span id="adm-header-notif-counter" class="adm-header-notif-counter">'.CAdminInformer::$alertCounter.'</span></a>';

		if ($USER->CanDoOperation("cache_control"))
		{
			$result .= '<a id="bx-panel-clear-cache" href="" onclick="BX.clearCache(); return false;"><span id="bx-panel-clear-cache-icon"></span><span id="bx-panel-clear-cache-text">'.GetMessage("top_panel_cache_new_tooltip_title").'</span></a>';
		}

		$result .= '
			</div>
			<div id="bx-panel-userinfo">
	';

		$bCanProfile = $USER->CanDoOperation('view_own_profile') || $USER->CanDoOperation('edit_own_profile');

		$userName = CUser::FormatName(
			CSite::GetNameFormat(false),
			array(
				"NAME"	=> $USER->GetFirstName(),
				"LAST_NAME"	=> $USER->GetLastName(),
				"SECOND_NAME" => $USER->GetSecondName(),
				"LOGIN"		=> $USER->GetLogin()
			),
			$bUseLogin = true,
			$bHTMLSpec = true
		);

		if ($bCanProfile)
		{
			$result .= '<a href="/bitrix/admin/user_edit.php?lang='.LANGUAGE_ID.'&ID='.$USER->GetID().'" id="bx-panel-user" '.CTopPanel::AddAttrHint(GetMessage('top_panel_profile_tooltip')).'><span id="bx-panel-user-icon"></span><span id="bx-panel-user-text">'.$userName.'</span></a>';
		}
		else
		{
			$result .= '<a id="bx-panel-user"><span id="bx-panel-user-icon"></span><span id="bx-panel-user-text">'.$userName.'</span></a>';
		}

		$result .= '<a href="'.$hrefEnc.'?logout=yes'.htmlspecialcharsbx(($s=DeleteParam(array("logout"))) == ""? "":"&".$s).'" id="bx-panel-logout" '.CTopPanel::AddAttrHint(GetMessage('top_panel_logout_tooltip').$hkInstance->GetTitle("bx-panel-logout",true)).'>'.GetMessage("top_panel_logout").'</a>';

		$toggleCaptionOn = '<span id="bx-panel-toggle-caption-mode-on">'.GetMessage("top_panel_on").'</span>';
		$toggleCaptionOff = '<span id="bx-panel-toggle-caption-mode-off">'.GetMessage("top_panel_off").'</span>';
		$toggleCaptions = $toggleMode ? $toggleCaptionOn.$toggleCaptionOff : $toggleCaptionOff.$toggleCaptionOn;
		$toogle = '<a href="'.$toggleModeLink.'" id="bx-panel-toggle" class="bx-panel-toggle'.($toggleMode ? '-on' : '-off').'"'.($toggleModeDynamic ? '' : ' '.CTopPanel::AddAttrHint(GetMessage("top_panel_edit_mode_new_tooltip_title"), GetMessage('top_panel_toggle_tooltip').$hkInstance->GetTitle("bx-panel-small-toggle",true))).'><span id="bx-panel-switcher-gutter-left"></span><span id="bx-panel-toggle-indicator"><span id="bx-panel-toggle-icon"></span><span id="bx-panel-toggle-icon-overlay"></span></span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption">'.GetMessage("top_panel_edit_mode_new").'</span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption-mode">'.$toggleCaptions.'</span><span id="bx-panel-switcher-gutter-right"></span></a>';
		if ($aUserOpt["collapsed"] == "on")
			$result .= $toogle;

		$result .= '<a href="" id="bx-panel-expander" '.CTopPanel::AddAttrHint(GetMessage("top_panel_expand_tooltip_title"), GetMessage("top_panel_expand_tooltip").$hkInstance->GetTitle("bx-panel-expander",true)).'><span id="bx-panel-expander-text">'.GetMessage("top_panel_expand").'</span><span id="bx-panel-expander-arrow"></span></a>';

		if($hkInstance->IsActive())
		{
			$result .= '<a id="bx-panel-hotkeys" href="javascript:void(0)" onclick="BXHotKeys.ShowSettings();" '.CTopPanel::AddAttrHint(GetMessage("HK_PANEL_TITLE").$hkInstance->GetTitle("bx-panel-hotkeys",true)).'></a>';
		}

		$result .= '<a href="javascript:void(0)" id="bx-panel-pin"'.($aUserOpt['fix'] == 'on' ? ' class="bx-panel-pin-fixed"' : '').' '.CTopPanel::AddAttrHint(GetMessage('top_panel_pin_tooltip')).'></a>';

		$Execs	=	$hkInstance->GetCodeByClassName("bx-panel-logout",GetMessage('top_panel_logout_tooltip'));
		$result .=	$hkInstance->PrintJSExecs($Execs);
		$Execs	=	$hkInstance->GetCodeByClassName("bx-panel-small-toggle",GetMessage("top_panel_edit_mode_new_tooltip_title"),'location.href="'.$toggleModeLink.'";');
		$result .=	$hkInstance->PrintJSExecs($Execs);
		$Execs	=	$hkInstance->GetCodeByClassName("bx-panel-expander",GetMessage("top_panel_expand_tooltip_title")."/".GetMessage("top_panel_collapse_tooltip_title"));
		$result .=	$hkInstance->PrintJSExecs($Execs);

		$result .= '
			</div>
		</div>
	';


	/* BUTTONS */
		$result .= '<div id="bx-panel-site-toolbar"><div id="bx-panel-buttons-gutter"></div><div id="bx-panel-switcher">';

		if ($aUserOpt["collapsed"] != "on")
			$result .= $toogle;

		$result .= '<a href="" id="bx-panel-hider" '.CTopPanel::AddAttrHint(GetMessage("top_panel_collapse_tooltip_title"), GetMessage("top_panel_collapse_tooltip").$hkInstance->GetTitle("bx-panel-expander",true)).'>'.GetMessage("top_panel_collapse").'<span id="bx-panel-hider-arrow"></span></a>';

		$result .= '</div><div id="bx-panel-buttons"><div id="bx-panel-buttons-inner">';

		$main_sort = "";
		$last_btn_type = '';
		$last_btn_small_cnt = 0;

		$result .= '<span class="bx-panel-button-group">';
		foreach($arPanelButtons as $key=>$arButton)
		{
			$result.= $hkInstance->PrintTPButton($arButton);

			if($main_sort != $arButton["MAIN_SORT"] && $main_sort<>"")
			{
				$result .= '</span><span class="bx-panel-button-separator"></span><span class="bx-panel-button-group">';
				$last_btn_small_cnt = 0;
			}


			$arButton['TYPE'] = $arButton['TYPE'] == 'BIG' ? 'BIG' : 'SMALL';

			//very old behaviour
			if(is_set($arButton, "SRC_0"))
				$arButton["SRC"] = $arButton["SRC_0"];

			$arButton['HREF'] = trim($arButton['HREF']);
			$bHasAction = $arButton['HREF'] != '';

			if (array_key_exists("RESORT_MENU", $arButton) && $arButton["RESORT_MENU"] === true && is_array($arButton['MENU']) && !empty($arButton['MENU']))
				usort($arButton['MENU'], array("CTopPanel", "SortButtonMenu"));

			$bHasMenu = is_array($arButton['MENU']) && count($arButton['MENU']) > 0;

			if ($bHasMenu && !$bHasAction)
			{
				foreach ($arButton['MENU'] as $arItem)
				{
					if ($arItem['DEFAULT'])
					{
						$arButton['HREF'] = $arItem['HREF'];
						$bHasAction = true;
					}
				}
			}

			if ($last_btn_type != '' && $arButton['TYPE'] != $last_btn_type && $main_sort == $arButton["MAIN_SORT"])
			{
				$result .= '</span><span class="bx-panel-button-group">';
				$last_btn_small_cnt = 0;
			}

			if ($bHasAction && substr(strtolower($arButton['HREF']), 0, 11) == 'javascript:')
			{
				$arButton['ONCLICK'] = substr($arButton['HREF'], 11);
				$arButton['HREF'] = 'javascript:void(0)';
			}

			if ($arButton['HINT'])
			{
				if ($arButton['HINT']['ID'])
				{
					$hintOptions = CUtil::GetPopupOptions($arButton['HINT']['ID']);

					if($hintOptions['display'] == 'off')
					{
						unset($arButton['HINT']);
					}
				}

				if ($arButton['HINT'])
					unset($arButton['ALT']);

				if ($bHasMenu && !$arButton['HINT_MENU'])
					$arButton['HINT']['TARGET'] = 'parent';
			}

			$hkInstance = CHotKeys::getInstance();

			switch ($arButton['TYPE'])
			{
				case 'SMALL':
					if ($last_btn_small_cnt >= 3 && $main_sort == $arButton["MAIN_SORT"])
					{
						$result .= '</span><span class="bx-panel-button-group">';
						$last_btn_small_cnt = 0;
					}
					elseif ($last_btn_small_cnt > 0)
					{
						$result .= '<span class="bx-panel-break"></span>';
					}

					$result .= '<span class="bx-panel-small-button"><span class="bx-panel-small-button-inner">';

					$button_icon = '<span class="bx-panel-small-button-icon'.($arButton['ICON'] ? ' '.$arButton['ICON'] : '').'"'.($arButton['SRC'] ? ' style="background: scroll transparent url('.htmlspecialcharsbx($arButton['SRC']).') no-repeat center center !important;"' : '').'></span>';
					$button_text = '<span class="bx-panel-small-button-text">'.htmlspecialcharsbx($arButton['TEXT']).'</span>';

					if ($bHasAction)
					{
						$result .= '<a href="'.htmlspecialcharsbx($arButton['HREF']).'" onclick="'.htmlspecialcharsbx($arButton['ONCLICK']).';BX.removeClass(this.parentNode.parentNode, \'bx-panel-small-button'.($bHasMenu ? '-text' : '').'-active\')" id="bx_topmenu_btn_'.$key.'"'.($arButton['ALT'] ? ' title="'.htmlspecialcharsbx($arButton['ALT']).$hkInstance->GetTitle("bx_topmenu_btn_".$key).'"' : '"'.$hkInstance->GetTitle("bx_topmenu_btn_".$key).'"').'>'.$button_icon.$button_text.'</a>';

						$result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'\', TYPE: \'SMALL\', ACTIVE_CSS: \'bx-panel-small-button'.($bHasMenu ? '-text' : '').'-active\', HOVER_CSS: \'bx-panel-small-button'.($bHasMenu ? '-text' : '').'-hover\''.($arButton['HINT'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT']) : '').'})</script>';
						if ($bHasMenu)
						{
							$result .= '<a href="javascript:void(0)" class="bx-panel-small-button-arrow" id="bx_topmenu_btn_'.$key.'_menu"><span class="bx-panel-small-button-arrow"></span></a>';
							$result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'_menu\', TYPE: \'SMALL\', MENU: '.CUtil::PhpToJsObject($arButton['MENU']).', ACTIVE_CSS: \'bx-panel-small-button-arrow-active\', HOVER_CSS: \'bx-panel-small-button-arrow-hover\''.($arButton['HINT_MENU'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT_MENU']) : '').'})</script>';
						}
					}
					elseif ($bHasMenu)
					{
						$result .= '<a href="javascript:void(0)" id="bx_topmenu_btn_'.$key.'"'.($arButton['ALT'] ? ' title="'.htmlspecialcharsbx($arButton['ALT']).'"' : '').'>'.$button_icon.$button_text.'<span class="bx-panel-small-single-button-arrow"></span></a>';
						$result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'\', TYPE: \'SMALL\', MENU: '.CUtil::PhpToJsObject($arButton['MENU']).', ACTIVE_CSS: \'bx-panel-small-button-active\', HOVER_CSS: \'bx-panel-small-button-hover\''.($arButton['HINT'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT']) : '').'})</script>';
					}

					$result .= '</span></span>';

					$last_btn_small_cnt++;

				break;

				case 'BIG':
					$last_btn_small_cnt = 0;

					$result .= '<span class="bx-panel-button"><span class="bx-panel-button-inner">';

					$button_icon = '<span class="bx-panel-button-icon'.($arButton['ICON'] ? ' '.$arButton['ICON'] : '').'"'.($arButton['SRC'] ? ' style="background: scroll transparent url('.htmlspecialcharsbx($arButton['SRC']).') no-repeat center center !important;"' : '').'></span>';


					if ($bHasAction && $bHasMenu)
					{
						$button_text = '<span class="bx-panel-button-text">'.str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']).'&nbsp;<span class="bx-panel-button-arrow"></span></span>';
						$result .= '<a href="'.htmlspecialcharsbx($arButton['HREF']).'" onclick="'.htmlspecialcharsbx($arButton['ONCLICK']).';BX.removeClass(this.parentNode.parentNode, \'bx-panel-button-icon-active\');" id="bx_topmenu_btn_'.$key.'"'.($arButton['ALT'] ? ' title="'.htmlspecialcharsbx($arButton['ALT']).'"' : '').'>'.$button_icon.'</a><a id="bx_topmenu_btn_'.$key.'_menu" href="javascript:void(0)">'.$button_text.'</a>';
						$result .= '<script type="text/javascript">
	BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'\', TYPE: \'BIG\', ACTIVE_CSS: \'bx-panel-button-icon-active\', HOVER_CSS: \'bx-panel-button-icon-hover\''.($arButton['HINT'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT']) : '').'}); BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'_menu\', TYPE: \'BIG\', MENU: '.CUtil::PhpToJsObject($arButton['MENU']).', ACTIVE_CSS: \'bx-panel-button-text-active\', HOVER_CSS: \'bx-panel-button-text-hover\''.($arButton['HINT_MENU'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT_MENU']) : '').'})
	</script>';
					}
					else if ($bHasAction)
					{
						$button_text = '<span class="bx-panel-button-text">'.str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']).'</span>';

						$result .= '<a href="'.htmlspecialcharsbx($arButton['HREF']).'" onclick="'.htmlspecialcharsbx($arButton['ONCLICK']).';BX.removeClass(this.parentNode.parentNode, \'bx-panel-button-active\');" id="bx_topmenu_btn_'.$key.'"'.($arButton['ALT'] ? ' title="'.htmlspecialcharsbx($arButton['ALT']).'"' : '').'>'.$button_icon.$button_text.'</a>';

						$result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'\', TYPE: \'BIG\', ACTIVE_CSS: \'bx-panel-button-active\', HOVER_CSS: \'bx-panel-button-hover\''.($arButton['HINT'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT']) : '').'});</script>';

					}
					else // if $bHasMenu
					{
						$button_text = '<span class="bx-panel-button-text">'.str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']).'&nbsp;<span class="bx-panel-button-arrow"></span></span>';

						$result .= '<a href="javascript:void(0)" id="bx_topmenu_btn_'.$key.'_menu">'.$button_icon.$button_text.'</a>';

						$result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_'.$key.'_menu\', TYPE: \'BIG\', MENU: '.CUtil::PhpToJsObject($arButton['MENU']).', ACTIVE_CSS: \'bx-panel-button-active\', HOVER_CSS: \'bx-panel-button-hover\''.($arButton['HINT'] ? ', HINT: '.CUtil::PhpToJsObject($arButton['HINT']) : '').'});</script>';
					}

					$result .= '</span></span>';
				break;
			}

			$main_sort = $arButton["MAIN_SORT"];
			$last_btn_type = $arButton['TYPE'];
		}
		$result .= '</span>';

		$result .= '</div>
			</div>
		</div>';

		if ($USER->IsAdmin())
			$result .= CAdminNotify::GetHtml();

		$result .= '
	</div>
	';

		$result .= '<script type="text/javascript">
		BX.admin.panel.state = {
			fixed: '.($aUserOpt["fix"] == "on" ? 'true' : 'false').',
			collapsed: '.($aUserOpt["collapsed"] == "on" ? 'true' : 'false').'
		}
		</script>';

		//start menu preload
		// if($aUserOptGlobal["start_menu_preload"] == 'Y')
		// 	$result .= '<script type="text/javascript">BX.ready(function(){jsStartMenu.PreloadMenu(\''.CUtil::JSEscape($href.($params<>""? "?".$params:"")).'\');});</script>';

		//show script to play sound
		$result .= $GLOBALS["adminPage"]->ShowSound();

		return $result;
	}
Beispiel #6
0
    /**
     * @return bool
     */
    public static function OnAdminInformerInsertItems()
    {
        /** @global CUser $USER */
        global $USER;
        if (!$USER->isAdmin()) {
            return false;
        }
        if (!self::isNewTestNeeded()) {
            return false;
        }
        try {
            $adminUrl = self::ADMIN_PAGE_URL . "?lang=" . LANGUAGE_ID;
            $htmlText = '
<div class="adm-informer-item-section">
	<span class="adm-informer-item-l">
		<span>' . GetMessage("SEC_CHECKER_INFORMER_DESCRIPTION") . '</span>
	</span>
</div>
';
            $WAFAIParams = array("TITLE" => GetMessage("SEC_CHECKER_INFORMER_TITLE"), "COLOR" => "blue", "ALERT" => true, "HTML" => $htmlText, "FOOTER" => '<a href="' . $adminUrl . '">' . GetMessage("SEC_CHECKER_INFORMER_LINK") . '</a>');
        } catch (Exception $e) {
            $WAFAIParams = array("TITLE" => GetMessage("SEC_CHECKER_INFORMER_TITLE") . " - " . GetMessage("top_panel_ai_title_err"), "ALERT" => true, "HTML" => $e->getMessage());
        }
        CAdminInformer::AddItem($WAFAIParams);
        return true;
    }
Beispiel #7
0
echo $sPubUrl;
?>
" id="bx-panel-view-tab" class="adm-header-btn adm-header-btn-site" title="<?php 
echo GetMessage("adm_top_panel_view_title");
?>
"><?php 
echo GetMessage("admin_panel_site");
?>
</a><a hidefocus="true" href="<?php 
echo BX_ROOT . "/admin/index.php?lang=" . LANGUAGE_ID;
?>
" class="adm-header-btn adm-header-btn-admin"><?php 
echo GetMessage("admin_panel_admin");
?>
</a><?php 
$informerItemsCount = CAdminInformer::InsertMainItems();
if ($USER->IsAuthorized() && $informerItemsCount > 0) {
    ?>
<span class="adm-header-notif-block" id="adm-header-notif-block" onclick="BX.adminInformer.Toggle(this);" title="<?php 
    echo GetMessage("admin_panel_notif_block_title");
    ?>
"><span class="adm-header-notif-icon"></span><span class="adm-header-notif-counter" id="adm-header-notif-counter"><?php 
    echo CAdminInformer::$alertCounter;
    ?>
</span></span><?php 
}
_showTopPanelButtonsSection($arPanelButtons, $hkInstance);
?>
</div><div class="adm-header-right"><?php 
if ($USER->IsAuthorized() && IsModuleInstalled("search")) {
    ?>
Beispiel #8
0
    /**
     * Shows information about CDN free space in Admin's informer popup
     *
     * @return void
     */
    public function OnAdminInformerInsertItems()
    {
        if (IsModuleInstalled('intranet')) {
            return;
        }
        $CDNAIParams = array("TITLE" => GetMessage("BCL_CDN_AI_TITLE"), "COLOR" => "green");
        if (self::IsActive()) {
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/bitrixcloud_cdn.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_CDN_AI_SETT") . '</a>';
            $cdn_config = CBitrixCloudCDNConfig::getInstance()->loadFromOptions();
            $cdn_quota = $cdn_config->getQuota();
            $PROGRESS_TOTAL = $cdn_quota->getAllowedSize();
            $PROGRESS_VALUE = $cdn_quota->getTrafficSize();
            if ($PROGRESS_TOTAL > 0.0 || $PROGRESS_VALUE > 0.0) {
                $PROGRESS_AVAILABLE = $PROGRESS_TOTAL - $PROGRESS_VALUE;
                if ($PROGRESS_AVAILABLE < 0.0) {
                    $PROGRESS_AVAILABLE = 0.0;
                }
                $PROGRESS_FREE = 0.0;
                if ($PROGRESS_TOTAL > 0.0) {
                    $PROGRESS_FREE = round(($PROGRESS_TOTAL - $PROGRESS_VALUE) / $PROGRESS_TOTAL * 100);
                }
                $PROGRESS_FREE_BAR = $PROGRESS_FREE > 100.0 ? 100 : intval($PROGRESS_FREE);
                $PROGRESS_FREE_BAR = $PROGRESS_FREE < 0.0 ? 0 : intval($PROGRESS_FREE_BAR);
                $CDNAIParams["ALERT"] = false;
                if ($PROGRESS_FREE < 10.0) {
                    $CDNAIParams["ALERT"] = true;
                } elseif (!$cdn_config->isActive()) {
                    $CDNAIParams["ALERT"] = true;
                }
                $CDNAIParams["HTML"] = '
					<div class="adm-informer-item-section">
						<span class="adm-informer-item-l">
							<span class="adm-informer-strong-text">' . GetMessage("BCL_CDN_AI_USAGE_TOTAL") . '</span> ' . CFile::FormatSize($PROGRESS_TOTAL, 0) . '
						</span>
						<span class="adm-informer-item-r">
								<span class="adm-informer-strong-text">' . GetMessage("BCL_CDN_AI_USAGE_AVAIL") . '</span> ' . CFile::FormatSize($PROGRESS_AVAILABLE, 0) . '
						</span>
					</div>
					<div class="adm-informer-status-bar-block" >
						<div class="adm-informer-status-bar-indicator" style="width:' . (100 - $PROGRESS_FREE_BAR) . '%; "></div>
						<div class="adm-informer-status-bar-text">' . (100 - $PROGRESS_FREE) . '%</div>
					</div>
				';
            }
        } else {
            $CDNAIParams["HTML"] = '
				<div class="adm-informer-item-section">
					<span class="adm-informer-strong-text">' . GetMessage("BCL_CDN_AI_IS_OFF") . '</span>
				</div>
				<div class="adm-informer-status-bar-block" >
					<div class="adm-informer-status-bar-indicator" style="width:0%; "></div>
					<div class="adm-informer-status-bar-text">0%</div>
				</div>
			';
            $CDNAIParams["ALERT"] = true;
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/bitrixcloud_cdn.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_CDN_AI_TURN_ON") . '</a>';
        }
        CAdminInformer::AddItem($CDNAIParams);
    }
Beispiel #9
0
 public function OnAdminInformerInsertItems()
 {
     $CDNAIParams = array("TITLE" => GetMessage("Ўаблоны дл¤ печати"), "COLOR" => "green", "HTML" => "Hello", "FOOTER" => "<a href='/test/index'>Testing footer</a>", "ALERT" => true);
     CAdminInformer::AddItem($CDNAIParams);
 }