Esempio n. 1
0
				<?php 
$compositeStatus = \CHTMLPagesCache::IsCompositeEnabled() ? Loc::getMessage("MAIN_SITE_SPEED_ENABLED") : Loc::getMessage("MAIN_SITE_SPEED_DISABLED");
?>
				<a href="/bitrix/admin/composite.php?lang=<?php 
echo LANGUAGE_ID;
?>
" class="site-speed-perf-label"><?php 
echo Loc::getMessage("MAIN_SITE_SPEED_COMPOSITE_SITE");
?>
</a>:<span class="site-speed-perf-value"><?php 
echo $compositeStatus;
?>
</span>
				<?php 
if (\Bitrix\Main\Loader::includeModule("bitrixcloud")) {
    $cdnStatus = CBitrixCloudCDN::IsActive() ? Loc::getMessage("MAIN_SITE_SPEED_ENABLED") : Loc::getMessage("MAIN_SITE_SPEED_DISABLED");
    ?>
				<a href="/bitrix/admin/bitrixcloud_cdn.php?lang=<?php 
    echo LANGUAGE_ID;
    ?>
" class="site-speed-perf-label"><?php 
    echo Loc::getMessage("MAIN_SITE_SPEED_CDN");
    ?>
</a>:<span class="site-speed-perf-value"><?php 
    echo $cdnStatus;
    ?>
</span>
				<?php 
}
?>
			</div>
Esempio n. 2
0
 /**
  *
  * @return void
  *
  */
 public static function domainChanged()
 {
     self::$domain_changed = true;
 }
        if ($cdn_config->getQuota()->isExpired()) {
            $cdn_config->updateQuota();
        }
        $cdn_quota = $cdn_config->getQuota();
        if ($cdn_quota->getAllowedSize() > 0.0 || $cdn_quota->getTrafficSize() > 0.0) {
            CAdminMessage::ShowMessage(array("TYPE" => "PROGRESS", "DETAILS" => '<p><b>' . GetMessage("BCL_CDN_USAGE", array("#TRAFFIC#" => CFile::FormatSize($cdn_quota->getTrafficSize()), "#ALLOWED#" => CFile::FormatSize($cdn_quota->getAllowedSize()))) . '</b></p>#PROGRESS_BAR#', "HTML" => true, "PROGRESS_TOTAL" => $cdn_quota->getAllowedSize(), "PROGRESS_VALUE" => $cdn_quota->getTrafficSize()));
        }
    } catch (Exception $e) {
        CAdminMessage::ShowMessage($e->getMessage());
    }
}
if ($bVarsFromForm) {
    $active = $_POST["cdn_active"] === "Y";
    $server_name = $_POST["server_name"];
} else {
    $active = CBitrixCloudCDN::IsActive();
    $server_name = $cdn_config->getDomain();
    if (!$server_name) {
        $server_name = COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]);
    }
}
?>
<form method="POST" action="bitrixcloud_cdn.php?lang=<?php 
echo LANGUAGE_ID;
echo $_GET["return_url"] ? "&amp;return_url=" . urlencode($_GET["return_url"]) : "";
?>
" enctype="multipart/form-data" name="editform">
<?php 
$tabControl->Begin();
$tabControl->BeginNextTab();
?>
Esempio n. 4
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 (CBitrixCloudCDN::IsActive()) {
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/bitrixcloud_cdn.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_CDN_AI_SETT") . '</a>';
            try {
                $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) {
                        $PROGRESS_AVAILABLE = 0;
                    }
                    if ($PROGRESS_TOTAL > 0) {
                        $PROGRESS_FREE = round(($PROGRESS_TOTAL - $PROGRESS_VALUE) / $PROGRESS_TOTAL * 100);
                    } else {
                        $PROGRESS_FREE = 0;
                    }
                    $PROGRESS_FREE_BAR = $PROGRESS_FREE > 100 ? 100 : $PROGRESS_FREE;
                    $PROGRESS_FREE_BAR = $PROGRESS_FREE < 0 ? 0 : $PROGRESS_FREE_BAR;
                    $CDNAIParams["ALERT"] = false;
                    if ($PROGRESS_FREE < 10) {
                        $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>
					';
                }
            } catch (Exception $e) {
                $CDNAIParams["TITLE"] .= " - " . GetMessage("top_panel_ai_title_err");
                $CDNAIParams["ALERT"] = true;
                $CDNAIParams["HTML"] = $e->getMessage();
            }
        } 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);
    }