本文整理汇总了PHP中CFile::FormatSize方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::FormatSize方法的具体用法?PHP CFile::FormatSize怎么用?PHP CFile::FormatSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::FormatSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mfi_format_line
function mfi_format_line($arValue, $uid, $controlNameFull)
{
$result = '';
if (is_array($arValue) && sizeof($arValue) > 0)
{
ob_start();
foreach ($arValue as $arElement)
{
$elementID = intval($arElement['ID']);
?>
<tr class="file-inline-file" id="wd-doc<?php
echo $elementID;
?>
">
<td class="files-name">
<span class="files-text">
<span class="f-wrap"><?php
echo htmlspecialcharsEx($arElement['ORIGINAL_NAME']);
?>
</span>
</span>
</td>
<td class="files-size"><?php
echo CFile::FormatSize($arElement["FILE_SIZE"]);
?>
</td>
<td class="files-storage">
<div class="files-storage-block">
<span class='del-but' onclick="BfileFD<?php
echo $uid;
?>
.agent.StopUpload(BX('wd-doc<?php
echo $elementID;
?>
'));"></span>
<span class="files-placement"><?/*=htmlspecialcharsEx($title)*/?></span>
<input id="file-doc<?php
echo $elementID;
?>
" type="hidden" name="<?php
echo htmlspecialcharsbx($controlNameFull);
?>
" value="<?php
echo $elementID;
?>
" />
</div>
</td>
</tr>
<?
}
$result = ob_get_clean();
}
return $result;
}
示例2: GetInfoHTML
function GetInfoHTML($params = array())
{
$html = '';
if (is_array($this->_file)) {
$intWidth = $this->_width;
$intHeight = $this->_height;
$img_src = '';
$divId = '';
if (isset($params['url_template']) && $intWidth > 0 && $intHeight > 0) {
$img_src = $this->GetImgSrc(array('url_template' => $params['url_template']));
if ($img_src) {
CUtil::InitJSCore(array("viewer"));
self::$_counter++;
$divId = 'lists-image-info-' . self::$_counter;
}
}
if ($divId) {
$html .= '<div id="' . $divId . '">';
} else {
$html .= '<div>';
}
if (isset($params['view']) && $params['view'] == 'short') {
$info = $this->_file["FILE_NAME"] . ' (';
if ($intWidth > 0 && $intHeight > 0) {
$info .= $intWidth . 'x' . $intHeight . ', ';
}
$info .= CFile::FormatSize($this->_file['FILE_SIZE']) . ')';
if ($divId) {
$html .= GetMessage('FILE_TEXT') . ': <span style="cursor:pointer" data-bx-viewer="image" data-bx-src="' . htmlspecialcharsbx($img_src) . '">' . htmlspecialcharsex($info) . '</span>';
} else {
$html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($info);
}
} else {
if ($divId) {
$html .= GetMessage('FILE_TEXT') . ': <span style="cursor:pointer" data-bx-viewer="image" data-bx-src="' . htmlspecialcharsbx($img_src) . '">' . htmlspecialcharsex($this->_file["FILE_NAME"]) . '</span>';
} else {
$html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($this->_file["FILE_NAME"]);
}
/*if($intWidth > 0 && $intHeight > 0)
{
$html .= '<br>'.GetMessage('FILE_WIDTH').': '.$intWidth;
$html .= '<br>'.GetMessage('FILE_HEIGHT').': '.$intHeight;
}*/
$html .= '<br>' . GetMessage('FILE_SIZE') . ': ' . CFile::FormatSize($this->_file['FILE_SIZE']);
}
if ($divId) {
$html .= '</div><script>BX.ready(function(){BX.viewElementBind("' . $divId . '");});</script>';
} else {
$html .= '</div>';
}
}
return $html;
}
示例3: GetInfoHTML
function GetInfoHTML()
{
$html = '';
if (is_array($this->_file)) {
$html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($this->_file["FILE_NAME"]);
$intWidth = $this->_width;
$intHeight = $this->_height;
if ($intWidth > 0 && $intHeight > 0) {
$html .= '<br>' . GetMessage('FILE_WIDTH') . ': ' . $intWidth;
$html .= '<br>' . GetMessage('FILE_HEIGHT') . ': ' . $intHeight;
}
$html .= '<br>' . GetMessage('FILE_SIZE') . ': ' . CFile::FormatSize($this->_file['FILE_SIZE']);
}
return $html;
}
示例4: __blogUFfileShowMobile
function __blogUFfileShowMobile($arResult, $arParams)
{
$result = false;
if ($arParams['arUserField']['FIELD_NAME'] == 'UF_BLOG_POST_DOC' || strpos($arParams['arUserField']['FIELD_NAME'], 'UF_BLOG_COMMENT_DOC') === 0) {
if (sizeof($arResult['VALUE']) > 0) {
?>
<div class="post-item-attached-file-wrap"><?php
foreach ($arResult['VALUE'] as $fileID) {
$arFile = CFile::GetFileArray($fileID);
if ($arFile) {
$name = $arFile['ORIGINAL_NAME'];
$ext = '';
$dotpos = strrpos($name, ".");
if ($dotpos !== false && $dotpos + 1 < strlen($name)) {
$ext = substr($name, $dotpos + 1);
}
if (strlen($ext) < 3 || strlen($ext) > 5) {
$ext = '';
}
$arFile['EXTENSION'] = $ext;
$arFile['LINK'] = SITE_DIR . "mobile/ajax.php?mobile_action=blog_image&bp_fid=" . $fileID;
$arFile["FILE_SIZE"] = CFile::FormatSize($arFile["FILE_SIZE"]);
?>
<div class="post-item-attached-file"><?php
?>
<a onclick="app.openDocument({'url' : '<?php
echo $arFile['LINK'];
?>
'});" href="javascript:void()" class="post-item-attached-file-link"><span><?php
echo htmlspecialcharsbx($arFile['ORIGINAL_NAME']);
?>
</span><span>(<?php
echo $arFile['FILE_SIZE'];
?>
)</span></a><?php
?>
</div><?php
}
}
?>
</div><?php
}
$result = true;
}
return $result;
}
示例5: getFileInfo
public static function getFileInfo($fileID, $checkPermissions = true)
{
if (!Loader::includeModule('disk')) {
return null;
}
$fileID = (int) $fileID;
if ($fileID <= 0) {
return null;
}
/** @var File $file */
$file = File::loadById($fileID);
if (!$file) {
return null;
}
$canRead = true;
if ($checkPermissions) {
$canRead = $file->canRead($file->getStorage()->getSecurityContext(\CCrmSecurityHelper::getCurrentUserID()));
}
return array('ID' => $fileID, 'NAME' => $file->getName(), 'SIZE' => \CFile::FormatSize($file->getSize()), 'CAN_READ' => $canRead, 'VIEW_URL' => $canRead ? Driver::getInstance()->getUrlManager()->getUrlForDownloadFile($file) : '');
}
示例6: getFileInfo
/**
* @param array $fileData
* @param string $siteID
* @return array|null
*/
public static function getFileInfo($fileID, $storageTypeID = 0, $checkPermissions = true, $options = null)
{
if (!is_integer($storageTypeID)) {
$storageTypeID = (int) $storageTypeID;
}
if (!StorageType::isDefined($storageTypeID)) {
$storageTypeID = StorageType::getDefaultTypeID();
}
if ($storageTypeID === StorageType::Disk) {
return DiskManager::getFileInfo($fileID, $checkPermissions, $options);
} elseif ($storageTypeID === StorageType::WebDav) {
return \CCrmWebDavHelper::getElementInfo($fileID, $checkPermissions);
} elseif ($storageTypeID === StorageType::File) {
$fileInfo = \CFile::GetFileArray($fileID);
if (!is_array($fileInfo)) {
return null;
}
return array('ID' => $fileID, 'NAME' => isset($fileInfo['ORIGINAL_NAME']) ? $fileInfo['ORIGINAL_NAME'] : $fileID, 'SIZE' => \CFile::FormatSize($fileInfo['FILE_SIZE'] ? $fileInfo['FILE_SIZE'] : 0), 'VIEW_URL' => isset($fileInfo['SRC']) ? $fileInfo['SRC'] : '');
}
throw new Main\NotSupportedException("Storage type: '{$storageTypeID}' is not supported in current context");
}
示例7: OnCommentFormDisplay
function OnCommentFormDisplay()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
ob_start();
?>
<div class="comments-reply-field comments-reply-field-upload">
<?php
if (!empty($arResult["REVIEW_FILES"])) {
foreach ($arResult["REVIEW_FILES"] as $key => $val) {
$iCount++;
$sFileSize = CFile::FormatSize(intval($val["FILE_SIZE"]));
?>
<div class="comments-uploaded-file">
<input type="hidden" name="FILES[<?php
echo $key;
?>
]" value="<?php
echo $key;
?>
" />
<input type="checkbox" name="FILES_TO_UPLOAD[<?php
echo $key;
?>
]" id="FILES_TO_UPLOAD_<?php
echo $key;
?>
" value="<?php
echo $key;
?>
" checked="checked" />
<label for="FILES_TO_UPLOAD_<?php
echo $key;
?>
"><?php
echo $val["ORIGINAL_NAME"];
?>
(<?php
echo $val["CONTENT_TYPE"];
?>
) <?php
echo $sFileSize;
?>
( <a href="/bitrix/components/bitrix/forum.interface/show_file.php?action=download&fid=<?php
echo $key;
?>
"><?php
echo GetMessage("F_DOWNLOAD");
?>
</a> )
</label>
</div>
<?php
}
}
$iFileSize = intval(COption::GetOptionString("forum", "file_max_size", 50000));
$sFileSize = CFile::FormatSize($iFileSize);
?>
<div class="comments-upload-info" id="upload_files_info_<?php
echo $arParams["form_index"];
?>
">
<?php
if ($arParams["FORUM"]["ALLOW_UPLOAD"] == "F") {
?>
<span><?php
echo str_replace("#EXTENSION#", $arParams["FORUM"]["ALLOW_UPLOAD_EXT"], GetMessage("F_FILE_EXTENSION"));
?>
</span>
<?php
}
?>
<span><?php
echo str_replace("#SIZE#", $sFileSize, GetMessage("F_FILE_SIZE"));
?>
</span>
</div>
<?php
$componentParams = array('INPUT_NAME' => 'FILE_NEW', 'INPUT_NAME_UNSAVED' => 'FILE_NEW_TMP', 'INPUT_VALUE' => array(), 'MAX_FILE_SIZE' => $iFileSize, 'MODULE_ID' => 'forum');
if ($arResult['FORUM']['ALLOW_UPLOAD'] == 'Y') {
$componentParams['ALLOW_UPLOAD'] = 'I';
} elseif ($arResult['FORUM']['ALLOW_UPLOAD'] == 'F') {
$componentParams['ALLOW_UPLOAD'] = 'F';
$componentParams['ALLOW_UPLOAD_EXT'] = $arResult['FORUM']['ALLOW_UPLOAD_EXT'];
} elseif ($arResult['FORUM']['ALLOW_UPLOAD'] == 'A') {
$componentParams['ALLOW_UPLOAD'] = 'A';
}
$GLOBALS['APPLICATION']->IncludeComponent('bitrix:main.file.input', '', $componentParams, $this->component);
?>
</div>
<?php
return array(array('DISPLAY' => 'AFTER', 'SORT' => '50', 'TEXT' => ob_get_clean()));
}
示例8: OnAdminInformerInsertItems
/**
* 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);
}
}
示例9: 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)
{
//.........这里部分代码省略.........
示例10: GetMessage
<td><textarea name="FORUM_SIGNATURE" rows="3" cols="35"><?php
echo $arResult["str_FORUM_SIGNATURE"];
?>
</textarea></td>
</tr>
<tr>
<th><?php
echo GetMessage("F_AVATAR");
?>
</th>
<td>
<?php
foreach (array('AVATAR_SIZE', 'AVATAR_H', 'AVATAR_V') as $prop) {
$arResult[$prop] = intval($arResult[$prop]);
}
$arResult['AVATAR_SIZE'] = CFile::FormatSize($arResult['AVATAR_SIZE']);
if (!empty($arResult['AVATAR_H']) && !empty($arResult['AVATAR_V']) && !empty($arResult['AVATAR_SIZE'])) {
?>
<?php
echo str_replace(array("#SIZE#", "#SIZE_BITE#"), array($arResult["AVATAR_H"] . "x" . $arResult["AVATAR_V"], $arResult["AVATAR_SIZE"]), GetMessage("F_SIZE_AVATAR"));
?>
<br/>
<?php
}
?>
<input name="FORUM_AVATAR" size="30" type="file" />
<?php
if ($arResult["SHOW_DELETE_FORUM_AVATAR"] == "Y") {
?>
<br/><input type="checkbox" name="FORUM_AVATAR_del" value="Y" id="FORUM_AVATAR_del" />
<label for="FORUM_AVATAR_del"><?php
示例11: GetMessage
$lAdmin->NavText($rsDirContent->GetNavPrint(GetMessage("MAIN_DUMP_FILE_PAGES")));
$lAdmin->AddHeaders(array(array("id" => "NAME", "content" => GetMessage("MAIN_DUMP_FILE_NAME"), "sort" => "name", "default" => true), array("id" => "SIZE", "content" => GetMessage("MAIN_DUMP_FILE_SIZE1"), "sort" => "size", "default" => true), array("id" => "PLACE", "content" => GetMessage("MAIN_DUMP_LOCATION"), "sort" => "location", "default" => true), array("id" => "DATE", "content" => GetMessage('MAIN_DUMP_FILE_TIMESTAMP'), "sort" => "timestamp", "default" => true)));
$arWriteBucket = CBackup::GetBucketList($arFilter = array('READ_ONLY' => 'N'));
while ($f = $rsDirContent->NavNext(true, "f_")) {
$BUCKET_ID = intval($f['BUCKET_ID']);
$row =& $lAdmin->AddRow($BUCKET_ID . '_' . $f['NAME'], $f);
$c = $arParts[$BUCKET_ID . $f['NAME']];
if ($c > 1) {
$parts = ' (' . GetMessage("MAIN_DUMP_PARTS") . $c . ')';
$size = $arSize[$BUCKET_ID . $f['NAME']];
} else {
$parts = '';
$size = $f['SIZE'];
}
$row->AddField("NAME", $f['NAME'] . $parts);
$row->AddField("SIZE", CFile::FormatSize($size));
$row->AddField("PLACE", $f['PLACE']);
if ($f['DATE']) {
$row->AddField("DATE", ($t = time() - $f['DATE']) < 86400 && $t > 0 ? HumanTime($t) . ' ' . GetMessage('DUMP_BACK') : ConvertTimeStamp($f['DATE'], 'FULL'));
}
$arActions = array();
if (defined('DUMP_DEBUG_MODE')) {
$arActions[] = array("ICON" => "clouds", "TEXT" => 'DEBUG - ' . GetMessage("MAIN_DUMP_SEND_CLOUD") . ' Bitrix', "ACTION" => "if(k=prompt('" . CUtil::JSEscape(GetMessage("MAIN_DUMP_SEND_FILE_CLOUD")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=cloud_send&dump_bucket_id=-1&" . bitrix_sessid_get() . '&dump_encrypt_key="+k;');
$arActions[] = array("ICON" => "archive", "TEXT" => 'DEBUG - ' . GetMessage("INTEGRITY_CHECK"), "ACTION" => strpos($f['NAME'], '.enc.') ? "if(k=prompt('" . CUtil::JSEscape(GetMessage("INTEGRITY_CHECK")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=check_archive&" . bitrix_sessid_get() . '&dump_encrypt_key="+k;' : "if(confirm('" . CUtil::JSEscape(GetMessage("INTEGRITY_CHECK")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=check_archive&" . bitrix_sessid_get() . '";');
}
if (!preg_match('#\\.sql$#i', $f['NAME'])) {
if ($BUCKET_ID != -1) {
$arActions[] = array("ICON" => "download", "DEFAULT" => true, "TEXT" => GetMessage("MAIN_DUMP_ACTION_DOWNLOAD"), "ACTION" => "AjaxSend('/bitrix/admin/dump_list.php?action=download&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
$arActions[] = array("ICON" => "link", "TEXT" => GetMessage("MAIN_DUMP_GET_LINK"), "ACTION" => "AjaxSend('/bitrix/admin/dump_list.php?action=link&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
}
$arActions[] = array("ICON" => "restore", "TEXT" => GetMessage("MAIN_DUMP_RESTORE"), "ACTION" => "if(confirm('" . CUtil::JSEscape(GetMessage("MAIN_RIGHT_CONFIRM_EXECUTE")) . "')) AjaxSend('/bitrix/admin/dump_list.php?action=restore&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
示例12: ShowInput
//.........这里部分代码省略.........
case "password":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetPasswordValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetPasswordField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "email":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetEmailValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetEmailField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "url":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetUrlValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetUrlField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "textarea":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetTextAreaValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetTextAreaField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"], $value);
break;
case "date":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . " (" . CSite::GetDateFormat("SHORT") . ")</span><br />";
}
$value = CForm::GetDateValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetDateField($arAnswer["ID"], $this->arForm["SID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "image":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
if ($this->RESULT_ID) {
if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
if (intval($arFile["USER_FILE_ID"]) > 0) {
if ($arFile["USER_FILE_IS_IMAGE"] == "Y") {
$res .= CFile::ShowImage($arFile["USER_FILE_ID"], 0, 0, "border=0", "", true);
$res .= "<br />";
}
//endif;
}
//endif;
}
// endif
}
// endif
$res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "IMAGE", 0, "", $arAnswer["FIELD_PARAM"]);
break;
case "file":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
if ($this->RESULT_ID) {
if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
if (intval($arFile["USER_FILE_ID"]) > 0) {
$res .= "<a title=\"" . GetMessage("FORM_VIEW_FILE") . "\" target=\"_blank\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "\">" . htmlspecialcharsbx($arFile["USER_FILE_NAME"]) . "</a> (";
$res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]);
$res .= ") [ <a title=\"" . str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE")) . "\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "&action=download\">" . GetMessage("FORM_DOWNLOAD") . "</a> ]";
$res .= "<br /><br />";
}
//endif;
}
//endif;
}
$res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "FILE", 0, "", $arAnswer["FIELD_PARAM"]);
break;
}
//endswitch;
}
//endwhile;
return $res;
} elseif (is_array($this->arQuestions[$FIELD_SID]) && $this->arQuestions[$FIELD_SID]["ADDITIONAL"] == "Y") {
$res = "";
switch ($this->arQuestions[$FIELD_SID]["FIELD_TYPE"]) {
case "text":
$value = CForm::GetTextAreaValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetTextAreaField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], "60", "5", "", $value);
break;
case "integer":
$value = CForm::GetTextValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetTextField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $value);
break;
case "date":
$value = CForm::GetDateValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetDateField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $arForm["SID"], $value);
break;
}
//endswitch;
return $res;
} else {
return "";
}
}
示例13: ShowStep
function ShowStep()
{
$wizard =& $this->GetWizard();
$import_type = $wizard->GetVar('import_type');
if ($import_type !== 'city') {
$import_type = 'country';
$this->content = GetMessage('STATWIZ_STEP2_COUNTRY_CHOOSEN');
} else {
$this->content = GetMessage('STATWIZ_STEP2_CITY_CHOOSEN');
}
$this->content .= "<br><br>";
$this->content .= GetMessage('STATWIZ_STEP2_CONTENT');
$this->content .= "<br><br>";
$file_name = $wizard->GetVar('file_name');
$arFiles = CCity::FindFiles($import_type);
if (count($arFiles) <= 0) {
$this->content .= GetMessage('STATWIZ_FILES_NOT_FOUND');
} else {
$this->content .= "<style>\n\t\t\ttable.statwiz_table { border-collapse:collapse; }\n\t\t\ttable.statwiz_table td { font-family:Verdana,Arial,sans-serif; border: 1px solid #BDC6E0; padding:3px; background-color: white; }\n\t\t\ttable.statwiz_table td.head { background-color:#E6E9F4; }\n\t\t\ttable.statwiz_table td.tail { background-color:#EAEDF7; }\n\t\t\t</style>\n\t\t\t";
$this->content .= '<table class="statwiz_table">
<tr>
<td class="head"> </td>
<td class="head">' . GetMessage('STATWIZ_STEP2_FILE_NAME') . '</td>
<td class="head">' . GetMessage('STATWIZ_STEP2_FILE_SIZE') . '</td>
<td class="head">' . GetMessage('STATWIZ_STEP2_DESCRIPTION') . '</td>
</tr>';
foreach ($arFiles as $arFile) {
$this->content .= '<tr>';
$arInputAttr = array();
if ($arFile["FILE"] === $file_name) {
$arInputAttr['checked'] = 'checked';
}
$arInputAttr["id"] = htmlspecialcharsbx($arFile["FILE"]);
$this->content .= '<td>' . $this->ShowRadioField("file_name", $arFile["FILE"], $arInputAttr) . '</td>';
$this->content .= '<td nowrap><label for="' . $arInputAttr["id"] . '">' . $arFile["FILE"] . '</label></td>';
$pos = 0;
$this->content .= '<td nowrap>' . CFile::FormatSize($arFile["SIZE"]) . '</td>';
switch ($arFile["SOURCE"]) {
case "MAXMIND-IP-COUNTRY":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_IP_COUNTRY') . '</td>';
break;
case "IP-TO-COUNTRY":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IP_TO_COUNTRY') . '</td>';
break;
case "MAXMIND-IP-LOCATION":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_IP_LOCATION') . '</td>';
break;
case "MAXMIND-CITY-LOCATION":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_CITY_LOCATION') . '</td>';
break;
case "IPGEOBASE":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE') . '</td>';
break;
case "IPGEOBASE2":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE2') . '</td>';
break;
case "IPGEOBASE2-CITY":
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE2_CITY') . '</td>';
break;
default:
$this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_UNKNOWN') . '</td>';
}
$this->content .= '</tr>';
}
$this->content .= '</table>';
}
}
示例14: GetFormatFilesMessageOut
public static function GetFormatFilesMessageOut($files)
{
if (!is_array($files) || count($files) <= 0)
return false;
$messageFiles = '';
$serverName = (CMain::IsHTTPS() ? "https" : "http")."://".((defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
foreach ($files as $fileId => $fileData)
{
if ($fileData['status'] == 'done')
{
$fileElement = $fileData['name'].' ('.CFile::FormatSize($fileData['size']).")\n".
GetMessage('IM_MESSAGE_FILE_DOWN').' '.$serverName.$fileData['urlDownload']['default']."\n";
$messageFiles = strlen($messageFiles)>0? $messageFiles."\n".$fileElement: $fileElement;
}
}
return $messageFiles;
}
示例15: elseif
} elseif ($key == 'bytes') {
$key = 'using_bytes';
}
if ($key == 'uptime') {
} elseif ($key == 'limit_maxbytes') {
$html .= '
<tr>
<td width="50%" align=right>' . $key . ':</td>
<td align=left>' . CFile::FormatSize($value) . '</td>
</tr>
';
} elseif ($key == 'using_bytes') {
$html .= '
<tr>
<td width="50%" align=right>' . $key . ':</td>
<td align=left>' . CFile::FormatSize($value) . ($limit_maxbytes > 0 ? ' (' . round($value / $limit_maxbytes * 100, 2) . '%)' : '') . '</td>
</tr>
';
} elseif ($key == 'listen_disabled_num') {
$html .= '
<tr>
<td width="50%" align=right>' . $key . ':</td>
<td align=left>' . ($value > 0 ? "<span style=\"color:red\">" . $value . "</span>" : "<span style=\"color:green\">" . $value . "</span>") . '</td>
</tr>
';
} elseif ($key == 'get_hits') {
$html .= '
<tr>
<td width="50%" align=right>' . $key . ':</td>
<td align=left>' . $value . ' ' . ($value > 0 ? '(' . round($value / ($value + $get_misses) * 100, 2) . '%)' : '') . '</td>
</tr>