本文整理汇总了PHP中CFileMan::GetFileTypeEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileMan::GetFileTypeEx方法的具体用法?PHP CFileMan::GetFileTypeEx怎么用?PHP CFileMan::GetFileTypeEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileMan
的用法示例。
在下文中一共展示了CFileMan::GetFileTypeEx方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$BUCKET_ID = intval($f_BUCKET_ID);
$row =& $lAdmin->AddRow($BUCKET_ID.'_'.$f_NAME, $Elem);
$c = $arParts[$BUCKET_ID.$f_NAME];
if ($c > 1)
{
$parts = ' ('.GetMessage("MAIN_DUMP_PARTS").$c.')';
$size = $arSize[$f_NAME];
}
else
{
$parts = '';
$size = $f_SIZE;
}
$row->AddField("NAME", '<img src="/bitrix/images/fileman/types/'.CFileMan::GetFileTypeEx($f_NAME).'.gif" width="16" height="16" border=0 alt=""> '.$f_NAME.$parts);
$row->AddField("SIZE", HumanSize($size));
$row->AddField("PLACE", $f_PLACE ? $f_PLACE : GetMessage("MAIN_DUMP_LOCAL"));
$row->AddField("DATE", $f_DATE);
$arActions = Array();
if ($f_PERMISSION >= "R")
{
$arActions[] = array(
"ICON" => "download",
"DEFAULT" => true,
"TEXT" => GetMessage("MAIN_DUMP_ACTION_DOWNLOAD"),
"ACTION" => "AjaxSend('?action=download&f_id=".$f_NAME."&BUCKET_ID=".$BUCKET_ID."&".bitrix_sessid_get()."')"
);
$arActions[] = array(
示例2: Search
//.........这里部分代码省略.........
// Files was handled earlier
}
$io = CBXVirtualIo::GetInstance();
$bIsDir = $io->DirectoryExists($file);
$replFileCount = 0;
if ($bIsDir && !$this->Params['bDirsToo']) {
return;
}
$entity = $bIsDir ? $io->GetDirectory($file) : $io->GetFile($file);
$path = CFilemanUtils::TrimPath($file, $this->docRoot);
$arPath = array($this->Params['site'], $path);
// Check access
if (!$USER->CanDoFileOperation('fm_view_file', $arPath)) {
return;
}
$name = CFileman::GetFileName($file);
// Name of file or dir
// Check filename
if ($this->Params['fileName'] != "") {
if (!$this->Params['bCaseSens']) {
$name = strtolower($name);
$this->Params['fileName'] = strtolower($this->Params['fileName']);
}
// Simple find in file name
if (strpos($this->Params['fileName'], "*") === false) {
if (strpos($name, $this->Params['fileName']) === false) {
return;
}
} else {
$pattern = str_replace('.', '\\.', $this->Params['fileName']);
$pattern = str_replace('/', '', $pattern);
$pattern = str_replace('*', '.*', $pattern);
if (!preg_match('/^' . $pattern . '$/i', $io->ExtractNameFromPath($file))) {
return;
}
}
}
if (!$bIsDir) {
// Check filesize
$size = $entity->GetFileSize();
// Filesize limits in Kb
if ($this->Params['sizeFrom'] > 0 && $size < $this->Params['sizeFrom'] * 1024 || $this->Params['sizeTo'] > 0 && $size > $this->Params['sizeTo'] * 1024) {
return;
}
} else {
$size = 0;
}
// Check filetime
$time = $entity->GetModificationTime() + CTimeZone::GetOffset();
if ($this->Params['dateFrom'] && $time < MakeTimeStamp($this->Params['dateFrom'], CLang::GetDateFormat("FULL")) || $this->Params['dateTo'] && $time > MakeTimeStamp($this->Params['dateTo'], CLang::GetDateFormat("FULL"))) {
return;
}
if ($this->Params['phrase'] != "") {
// File size limits or it's dir or access denied
if ($size > $this->maxFileOpenSize || $bIsDir || $this->bReplace && !$USER->CanDoFileOperation('fm_edit_existent_file', $arPath)) {
return;
}
$fTmp = $io->GetFile($file);
$phrase = $this->Params['phrase'];
$fileContent = str_replace("\r\n", "\n", $fTmp->GetContents());
$origFileContent = $fileContent;
$isPHP = CFileman::IsPHP($fileContent) || HasScriptExtension($path) || substr($name, 0, 1) == ".";
if (!$this->Params['bCaseSens']) {
$phrase = strtolower($phrase);
$fileContent = strtolower($fileContent);
}
$I_PCRE_MODIFIER = $this->Params['bCaseSens'] ? '' : 'i';
// TODO: Add check Entire word
//$this->Params['entire']
if (strpos($fileContent, $phrase) === false) {
return;
}
if ($this->bReplace) {
if ($isPHP && !$USER->CanDoOperation('edit_php')) {
return;
}
// User can't write PHP files
$pattern = '/' . preg_quote($this->Params['phrase'], '/') . '/' . $I_PCRE_MODIFIER . BX_UTF_PCRE_MODIFIER;
$res = array();
preg_match_all($pattern, $origFileContent, $res);
$origFileContent = preg_replace($pattern, $this->Params['replacePhrase'], $origFileContent);
$replFileCount = count($res[0]);
$APPLICATION->SaveFileContent($file, $origFileContent);
} else {
if ($isPHP && !($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath))) {
return;
}
// User can't read PHP files
$pattern = '/' . preg_quote($this->Params['phrase'], '/') . '/' . $I_PCRE_MODIFIER . BX_UTF_PCRE_MODIFIER;
// Only for LPA. All php fragments will be cutted off
if ($USER->CanDoFileOperation('fm_lpa', $arPath) && !$USER->CanDoOperation('edit_php')) {
$origFileContent = CMain::ProcessLPA($origFileContent, '');
}
$res = array();
preg_match_all($pattern, $origFileContent, $res);
$replFileCount = count($res[0]);
}
}
$this->Result[] = array('path' => $path, 'size' => $size, 'b_dir' => $bIsDir, 'time' => $time, 'str_date' => date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), $time), 'str_size' => $bIsDir ? "" : CFile::FormatSize($size), 'type_src' => "/bitrix/images/fileman/types/" . ($bIsDir ? "folder" : CFileMan::GetFileTypeEx($file)) . ".gif", 'repl_count' => $replFileCount);
}
示例3: array
} else {
//$row->AddField("NAME", $showField, $editField);
$row->AddViewField("NAME", $showField);
$row->AddInputField("NAME", array('size' => '40', name => 'FIELDS[' . $f_NAME . '][NAME]', 'value' => htmlspecialcharsbx($val)));
}
if ($logical == 'Y') {
$showFieldIcon = "";
$showFieldText = "";
if (strlen($f_LOGIC_NAME) <= 0) {
$f_LOGIC_NAME = htmlspecialcharsbx(GetMessage("FILEMAN_ADM_UNTITLED"));
}
if ($Elem["TYPE"] == "D") {
$showFieldIcon = "<a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . urlencode($site) . "&path=" . $fpathUrl . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\" title=\"" . htmlspecialcharsbx($fpath) . "\"><span class='adm-submenu-item-link-icon fileman_icon_folder'></span></a>";
$showFieldText = "<a href=\"javascript:" . $sTableID . ".GetAdminList('fileman_admin.php?" . $addUrl_s . "&site=" . urlencode($site) . "&path=" . $fpathUrl . "&show_perms_for=" . IntVal($show_perms_for) . "', GALCallBack);\" title=\"" . htmlspecialcharsbx($fpath) . "\">" . $f_LOGIC_NAME . "</a>";
} else {
$curFileType = CFileMan::GetFileTypeEx($f_NAME);
if (preg_match('/^\\.(.*)?\\.menu\\.(php|html|php3|php4|php5|phtml)$/', $f_NAME, $regs)) {
$showFieldIcon = "";
$showFieldText = GetMessage("FILEMAN_ADMIN_MENU_TYPE") . "«" . htmlspecialcharsbx($regs[1]) . "»";
} else {
$showFieldIcon = "<IMG SRC=\"/bitrix/images/fileman/types/" . $curFileType . ".gif\" WIDTH=\"16\" HEIGHT=\"16\" BORDER=0 ALT=\"\" title=\"" . htmlspecialcharsbx($fpath) . "\">";
$showFieldText = $f_LOGIC_NAME;
}
}
$showField = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"left\">" . $showFieldIcon . "</td><td align=\"left\"> " . $showFieldText . "</td></tr></table>";
$row->AddViewField("LOGIC_NAME", $showField);
}
$row->AddField("SIZE", $Elem["TYPE"] == "F" ? CFile::FormatSize($f_SIZE) : "");
$row->AddField("DATE", $f_DATE);
$row->AddField("TYPE", $Elem["TYPE"] == "D" ? GetMessage('FILEMAN_FOLDER') : htmlspecialcharsbx($arFilemanPredifinedFileTypes[$curFileType]["name"]));
$showField = "";
示例4: GetDirList
function GetDirList($path, &$arDirs, &$arFiles, $arFilter = array(), $sort = array(), $type = "DF", $bLogical = false, $task_mode = false)
{
global $USER, $APPLICATION;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$arDirs = array();
$arFiles = array();
$exts = strtolower($arFilter["EXTENSIONS"]);
$arexts = explode(",", $exts);
if (isset($arFilter["TYPE"])) {
$type = strtoupper($arFilter["TYPE"]);
}
$io = CBXVirtualIo::GetInstance();
$path = $io->CombinePath("/", $path);
$abs_path = $io->CombinePath($DOC_ROOT, $path);
if (!$io->DirectoryExists($abs_path)) {
return false;
}
$date_format = CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL"));
$tzOffset = CTimeZone::GetOffset();
$dir = $io->GetDirectory($abs_path);
$arChildren = $dir->GetChildren();
foreach ($arChildren as $child) {
$arFile = array();
if (($type == "F" || $type == "") && $child->IsDirectory()) {
continue;
}
if (($type == "D" || $type == "") && !$child->IsDirectory()) {
continue;
}
$file = $child->GetName();
if ($bLogical) {
if ($child->IsDirectory()) {
$sSectionName = "";
$fsn = $io->CombinePath($abs_path, $file, ".section.php");
if (!$io->FileExists($fsn)) {
continue;
}
include $io->GetPhysicalName($fsn);
$arFile["LOGIC_NAME"] = $sSectionName;
} else {
if (CFileMan::GetFileTypeEx($file) != "php") {
continue;
}
if ($file == '.section.php') {
continue;
}
if (!preg_match('/^\\.(.*)?\\.menu\\.(php|html|php3|php4|php5|php6|phtml)$/', $file, $regs)) {
$f = $io->GetFile($abs_path . "/" . $file);
$filesrc = $f->GetContents();
$title = PHPParser::getPageTitle($filesrc);
if ($title === false) {
continue;
}
$arFile["LOGIC_NAME"] = $title;
}
}
}
$arFile["PATH"] = $abs_path . "/" . $file;
$arFile["ABS_PATH"] = $path . "/" . $file;
$arFile["NAME"] = $file;
$arPerm = $APPLICATION->GetFileAccessPermission(array($site, $path . "/" . $file), $USER->GetUserGroupArray(), $task_mode);
if ($task_mode) {
$arFile["PERMISSION"] = $arPerm[0];
if (count($arPerm[1]) > 0) {
$arFile["PERMISSION_EX"] = $arPerm[1];
}
} else {
$arFile["PERMISSION"] = $arPerm;
}
$arFile["TIMESTAMP"] = $child->GetModificationTime() + $tzOffset;
$arFile["DATE"] = date($date_format, $arFile["TIMESTAMP"]);
if (isset($arFilter["TIMESTAMP_1"]) && strtotime($arFile["DATE"]) < strtotime($arFilter["TIMESTAMP_1"])) {
continue;
}
if (isset($arFilter["TIMESTAMP_2"]) && strtotime($arFile["DATE"]) > strtotime($arFilter["TIMESTAMP_2"])) {
continue;
}
if (is_set($arFilter, "MIN_PERMISSION") && $arFile["PERMISSION"] < $arFilter["MIN_PERMISSION"] && !$task_mode) {
continue;
}
if (!$child->IsDirectory() && $arFile["PERMISSION"] <= "R" && !$task_mode) {
continue;
}
if ($bLogical) {
if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["LOGIC_NAME"], $arFilter["NAME"]) === false) {
continue;
}
} else {
if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["NAME"], $arFilter["NAME"]) === false) {
continue;
}
}
//if(strlen($arFilter["NAME"])>0 && strpos($arFile["NAME"], $arFilter["NAME"])===false)
// continue;
if (substr($arFile["ABS_PATH"], 0, strlen(BX_ROOT . "/modules")) == BX_ROOT . "/modules" && !$USER->CanDoOperation('edit_php') && !$task_mode) {
continue;
}
if ($arFile["PERMISSION"] == "U" && !$task_mode) {
$ftype = GetFileType($arFile["NAME"]);
//.........这里部分代码省略.........
示例5: require
}
require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
//Check access to file
if(!$USER->CanDoFileOperation('fm_view_file', $arPath))
$strWarning = GetMessage("ACCESS_DENIED");
else if(!$io->FileExists($abs_path))
$strWarning = GetMessage("FILEMAN_FILENOT_FOUND");
elseif(!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath)) && (HasScriptExtension($path) || substr(CFileman::GetFileName($path), 0, 1)=="."))
$strWarning = GetMessage("FILEMAN_FILEVIEW_PHPERROR");
$limit_php_access = ($USER->CanDoFileOperation('fm_lpa',$arPath) && !$USER->CanDoOperation('edit_php'));
$fileType = CFileMan::GetFileTypeEx($path);
$fileTypeParent = $arFilemanPredifinedFileTypes[CFileMan::GetFileTypeEx($path)]["gtype"];
?>
<?CAdminMessage::ShowMessage($strWarning);?>
<?if(strlen($strWarning) <= 0):?>
<?
$aMenu = Array();
if($fileTypeParent == "text")
{
if($USER->CanDoOperation('fileman_edit_existent_files') && $USER->CanDoFileOperation('fm_edit_existent_file',$arPath))
{
$aDDMenuEdit = array();
$aDDMenuEdit[] = array(
"TEXT" => GetMessage("FILEMAN_FILEVIEW_EDIT_AS_TEXT"),
"ACTION" => "window.location='fileman_file_edit.php?".$addUrl."&site=".urlencode($site)."&path=".urlencode($path)."';",
);
示例6: __struct_show_files
function __struct_show_files($arFiles, $doc_root, $path, $open_path, $dirsonly=false)
{
global $USER;
static $tzOffset = false;
if($tzOffset === false)
$tzOffset = CTimeZone::GetOffset();
$res = '';
$hintScript = '';
$scrDest = '';
$scrSrc = '';
foreach($arFiles as $arFile)
{
if($arFile["name"] == '' && $arFile["file"] <> "/" && $GLOBALS['arOptions']['show_all_files'] != true)
continue;
$full_path = rtrim($path, "/")."/".trim($arFile["file"], "/");
$encPath = urlencode($full_path);
$name = ($arFile["name"] <> ''? htmlspecialcharsback($arFile["name"]):$arFile["file"]);
$md5 = md5($full_path);
if($dirsonly)
$md5 = "_dirs".$md5;
$itemID = 'item'.$md5;
$item = '';
if($arFile["type"] == 'D')
{
$arPath = array($_GET['site'], $full_path);
$arPerm = array(
"create_file" => $USER->CanDoFileOperation("fm_create_new_file", $arPath),
"create_folder" => $USER->CanDoFileOperation("fm_create_new_folder", $arPath),
"edit_folder" => $USER->CanDoFileOperation("fm_edit_existent_folder", $arPath),
"edit_perm" => $USER->CanDoFileOperation("fm_edit_permission", $arPath),
"del_folder" => $USER->CanDoFileOperation("fm_delete_folder", $arPath),
);
$bOpenSubdir = ($open_path <> "" && (strpos($open_path."/", $full_path."/") === 0 || $arFile["file"] == "/"));
$dirID = 'dir'.$md5;
$item = '<div id="sign'.$md5.'" class="'.($bOpenSubdir? 'bx-struct-minus':'bx-struct-plus').'" onclick="structGetSubDir(this, \''.$dirID.'\', \''.$encPath.'\', '.($dirsonly? 'true':'false').')"></div>
<div class="bx-struct-dir" id="icon'.$md5.'"></div>
<div id="'.$itemID.'" __bx_path="'.$encPath.'" __bx_type="D" class="bx-struct-name"'.
' onmouseover="structNameOver(this)" onmouseout="structNameOut(this)" onclick="structShowDirMenu(this, '.($dirsonly? 'true':'false').', '.CUtil::PhpToJSObject($arPerm).')"'.
' ondblclick="structGetSubdirAction(\'sign'.$md5.'\')">'.htmlspecialcharsEx($name).'</div>
<div style="clear:both;"></div>
<div id="'.$dirID.'" class="bx-struct-sub" style="display:'.($bOpenSubdir? 'block':'none').'">'.
($bOpenSubdir? __struct_get_files($doc_root, $full_path, $open_path, $dirsonly):'').'</div>';
$scrDest .= ($scrDest <>''? ', ':'')."'".$itemID."'";
if($arFile["file"] <> '/')
$scrSrc .= ($scrSrc <>''? ', ':'')."'".$itemID."', 'icon".$md5."'";
}
elseif($dirsonly == false)
{
$arPath = array($_GET['site'], $full_path);
$arPerm = array(
"edit_file" => $USER->CanDoFileOperation("fm_edit_existent_file", $arPath),
"edit_perm" => $USER->CanDoFileOperation("fm_edit_permission", $arPath),
"del_file" => $USER->CanDoFileOperation("fm_delete_file", $arPath),
);
if($GLOBALS['bFileman'] == true && $GLOBALS['arOptions']['show_all_files'] == true)
$type = CFileMan::GetFileTypeEx($arFile["file"]);
else
$type = "";
$item = '<div style="float:left"></div><div class="bx-struct-file'.($type <> ''? ' bx-struct-type-'.$type : '').'" id="icon'.$md5.'"></div>
<div id="'.$itemID.'" __bx_path="'.$encPath.'" __bx_type="F" class="bx-struct-name" onmouseover="structNameOver(this)" onmouseout="structNameOut(this)" onclick="structShowFileMenu(this, '.CUtil::PhpToJSObject($arPerm).')" ondblclick="structEditFileAction(this)">'.htmlspecialcharsEx($name).'</div>
<div style="clear:both;"></div>';
$scrSrc .= ($scrSrc <>''? ', ':'')."'".$itemID."', 'icon".$md5."'";
}
if($item <> '')
$res .= '<div class="bx-struct-item">'.$item.'</div>';
if($GLOBALS['arOptions']['show_file_info'] == true)
{
$sHint = '<table cellspacing="0" border="0">'.
'<tr><td colspan="2"><b>'.($arFile["type"] == 'D'? GetMessage("pub_struct_folder"):GetMessage("pub_struct_file")).'</b></td></tr>'.
'<tr><td class="bx-grey">'.GetMessage("pub_struct_name").'</td><td>'.htmlspecialcharsEx($arFile["file"]).'</td></tr>'.
($arFile["type"] == 'F'? '<tr><td class="bx-grey">'.GetMessage("pub_struct_size")."</td><td>".number_format($arFile["size"], 0, ".", ",")." ".GetMessage("pub_struct_byte").'</td></tr>':'').
'<tr><td class="bx-grey">'.GetMessage("pub_struct_modified").'</td><td>'.htmlspecialcharsEx(ConvertTimeStamp($arFile["time"]+$tzOffset, 'FULL', $_GET['site'])).'</td></tr>';
if(is_array($arFile["properties"]))
foreach($arFile["properties"] as $prop_name => $prop_val)
$sHint .= '<tr valign="top"><td class="bx-grey">'.htmlspecialcharsEx($prop_name).':</td><td>'.htmlspecialcharsEx($prop_val).'</td></tr>';
$sHint .= '</table>';
$hintScript .= 'window.structHint'.$itemID.' = new BXHint(\''.CUtil::JSEscape($sHint).'\', document.getElementById(\''.$itemID.'\')); ';
}
}
if($hintScript <> '')
$res .= '<script>'.$hintScript.'</script>';
if($GLOBALS['bFileman'] == true)
$res .= '<script>structRegisterDD(['.$scrSrc.'], ['.$scrDest.']);</script>';
return $res;
}