本文整理汇总了PHP中CDiskQuota::GetDiskQuota方法的典型用法代码示例。如果您正苦于以下问题:PHP CDiskQuota::GetDiskQuota方法的具体用法?PHP CDiskQuota::GetDiskQuota怎么用?PHP CDiskQuota::GetDiskQuota使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiskQuota
的用法示例。
在下文中一共展示了CDiskQuota::GetDiskQuota方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InsertMainItems
public static function InsertMainItems()
{
if(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1)
return false;
global $USER;
if(!$USER->IsAuthorized())
return false;
//Updates
if($USER->IsAdmin() || $USER->CanDoOperation('install_updates'))
{
$update_res = UpdateTools::GetUpdateResult();
$updAIParams = array(
"TITLE" => GetMessage("top_panel_ai_updates"),
"COLOR" => 'gray',
"SORT" => 12
);
//update_autocheck == true and we have something to show
if ($update_res['result'] === true && $update_res['tooltip'])
{
$updAIParams["HTML"] = $update_res['tooltip'];
$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_instl").'</a>';
$updAIParams["ALERT"] = true;
}
else if ($update_res['error'] <> '') // update error
{
$updAIParams["TITLE"] .= " - ".GetMessage("top_panel_ai_title_err");
$updAIParams["HTML"] = trim(self::CutErrorId($update_res['error']));
$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>';
$updAIParams["ALERT"] = true;
}
else // update_autocheck == false
{
//last update date time
$updateDate = COption::GetOptionString("main", "update_system_update", false);
// remove seconds
$updateDate = $updateDate ? CDatabase::FormatDate($updateDate, "DD.MM.YYYY HH:MI:SS", "DD.MM.YYYY HH:MI") : false;
$updAIParams["HTML"] = '<span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_sys_ver").' '.SM_VERSION."</span><br>";
$updAIParams["HTML"] .= $updateDate ? GetMessage("top_panel_ai_upd_last").'<br>'.$updateDate : GetMessage("top_panel_ai_upd_never");
$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>';
$updAIParams["ALERT"] = false;
}
self::AddItem($updAIParams);
}
//Disk space (quota)
$maxQuota = COption::GetOptionInt("main", "disk_space", 0)*1048576;
if ($maxQuota > 0)
{
$quota = new CDiskQuota();
$free = $quota->GetDiskQuota();
$freeMB = CFile::FormatSize($free,1);
$free = round($free/($maxQuota)*100);
$qAIParams = array(
"TITLE" => GetMessage("top_panel_ai_used_space"),
"COLOR" => "green",
"ALERT" => ($free < 10 ? true : false)
);
$qAIParams["HTML"] = '
<div class="adm-informer-item-section">
<span class="adm-informer-item-l"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_all").'</span> '.CFile::FormatSize($maxQuota,1).'</span>
<span class="adm-informer-item-r"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_aviable").'</span> '.$freeMB.'</span>
</div>
<div class="adm-informer-status-bar-block" >
<div class="adm-informer-status-bar-indicator" style="width:'.(100-$free).'%; "></div>
<div class="adm-informer-status-bar-text">'.(100-$free).'%</div>
</div>
<div class="adm-informer-item-section"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_recomend").'</span> '.GetMessage("top_panel_ai_in_no").'</div>';
self::AddItem($qAIParams);
}
if($USER->IsAdmin() && in_array(LANGUAGE_ID, array("ru", "ua")))
{
$cModules = COption::GetOptionString("main", "mp_modules_date", "");
$arModules = array();
if(strlen($cModules) > 0)
$arModules = unserialize($cModules);
$mCnt = count($arModules);
if($mCnt > 0)
{
foreach($arModules as $id => $module)
{
if(isModuleInstalled($module["ID"]))
{
if($module["TMS"]+3600*24*14 < time())
{
$script = "
<script type=\"text/javascript\">
function hideMpAnswer(el, module)
{
//.........这里部分代码省略.........
示例2: GetPanelHtml
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<>""? "&".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? "&":"?")
: '/bitrix/admin/index.php?lang='.LANGUAGE_ID.'&'
).'back_url_pub='.urlencode($href.($params<>""? "?".$params:"")).'"><span>'.GetMessage("top_panel_admin").'</span></a>';
//.........这里部分代码省略.........
示例3: getDiskSpace
private function getDiskSpace()
{
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$freeSpace = CDiskQuota::GetDiskQuota();
return array($freeSpace === false ? 0 : $freeSpace, (double) COption::GetOptionInt('main', 'disk_space', 0) * 1024 * 1024);
}
示例4: executeComponent
public function executeComponent()
{
if (!CModule::IncludeModule('webdav')) {
return false;
}
$isVisual = isset($this->arParams['VISUAL']) ? (bool) $this->arParams['VISUAL'] : true;
$pathToAjax = isset($this->arParams['AJAX_PATH']) ? $this->arParams['AJAX_PATH'] : '/bitrix/components/bitrix/webdav.disk/ajax.php';
try {
if ($isVisual) {
$diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk');
$quota = CDiskQuota::GetDiskQuota();
$this->arResult['showDiskQuota'] = false;
//$quota !== true; //now without quota
$this->arResult['diskSpace'] = (double) COption::GetOptionInt('main', 'disk_space') * 1024 * 1024;
$this->arResult['quota'] = $quota;
$this->arResult['ajaxIndex'] = $pathToAjax;
$this->arResult['ajaxStorageIndex'] = '/desktop_app/storage.php';
if ($diskEnabled) {
$this->arResult['isInstalledDisk'] = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
$this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/disk/path/';
} else {
$this->arResult['isInstalledDisk'] = (bool) CWebDavTools::isDesktopDiskInstall();
$this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/files/lib/';
}
$this->arResult['isInstalledPull'] = (bool) IsModuleInstalled('pull');
$this->arResult['currentUser'] = array('id' => $this->getUser()->getId(), 'formattedName' => $this->getUser()->getFormattedName());
$this->getApplication()->addHeadScript('/bitrix/components/bitrix/webdav.disk/disk.js');
$this->includeComponentTemplate();
return;
}
CTimeZone::Disable();
//decode from utf-8 to site LANG_CHARSET
CUtil::decodeURIComponent($_POST);
$this->checkUser()->runAction();
CTimeZone::Enable();
} catch (CWebDavBadStorageAfterMigrateException $e) {
CTimeZone::Enable();
$this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ERROR, 'message' => 'Could not get Disk\\Storage. Perhaps, it is old client, which does not reconnect. '), 500);
} catch (CWebDavSymlinkMoveFakeErrorException $e) {
CTimeZone::Enable();
$this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ERROR, 'message' => 'This is not really error. Move symlink folders.'));
} catch (CWebDavAccessDeniedException $e) {
CTimeZone::Enable();
$this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ACCESS_DENIED, 'message' => $e->getMessage()));
} catch (Exception $e) {
CTimeZone::Enable();
$response = array('status' => 'error', 'message' => $e->getMessage());
if ($this->dispatcher) {
$errors = $this->dispatcher->getErrors();
if ($errors) {
$response['detail'] = $errors;
}
}
$this->sendJsonResponse($response);
}
return;
}
示例5: processActionGetDiskQuota
public function processActionGetDiskQuota()
{
$this->enableIgnoreQuotaError();
$quota = CDiskQuota::GetDiskQuota();
if ($quota === true) {
return $this->sendResponse(array('status' => static::STATUS_UNLIMITED, 'quota' => null));
}
return $this->sendResponse(array('status' => static::STATUS_LIMITED, 'quota' => $quota === false ? 0 : $quota));
}