本文整理汇总了PHP中CFileman::IsPHP方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileman::IsPHP方法的具体用法?PHP CFileman::IsPHP怎么用?PHP CFileman::IsPHP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileman
的用法示例。
在下文中一共展示了CFileman::IsPHP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Search
public function Search($file)
{
global $APPLICATION, $USER;
if ($this->maxResultCount && count($this->Result) >= $this->maxResultCount) {
return "stop";
}
if ($this->bSkip) {
if ($file == $this->Params['lastPath']) {
$this->bSkip = false;
} else {
return;
}
// 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
//.........这里部分代码省略.........
示例2: str_pad
$new_filesrc .= $arPHP[$n][2];
} else {
$new_filesrc .= '#PHP' . str_pad(++$php_count, 4, "0", STR_PAD_LEFT) . '#';
}
}
$new_filesrc .= substr($filesrc, $end);
$filesrc = $new_filesrc;
}
}
$bEditProps = strlen($res["PROLOG"]) > 0;
$title = $res["TITLE"];
$page_properties = $res["PROPERTIES"];
} else {
$filesrc = $filesrc_tmp;
}
if ((CFileman::IsPHP($filesrc) || $isScriptExt) && !($USER->CanDoOperation('edit_php') || $limit_php_access)) {
$strWarning = GetMessage("FILEMAN_FILEEDIT_CHANGE_ACCESS");
}
} elseif ($prop_edit == "Y") {
$bEditProps = true;
}
if ($bEdit) {
$APPLICATION->SetTitle(GetMessage("FILEMAN_FILEEDIT_PAGE_TITLE") . " \"" . htmlspecialcharsbx($arParsedPath["LAST"]) . "\"");
} else {
$APPLICATION->SetTitle(GetMessage("FILEMAN_NEWFILEEDIT_TITLE"));
}
$aTabs = array();
$aTabs[] = array("DIV" => "edit1", "TAB" => GetMessage("FILEMAN_H_EDIT_TAB1"), "ICON" => "main_user_edit", "TITLE" => GetMessage("FILEMAN_H_EDIT_TAB2"));
if ($bEditProps) {
$aTabs[] = array("DIV" => "edit2", "TAB" => GetMessage("FILEMAN_H_EDIT_RTAB2"), "ICON" => "main_user_edit", "TITLE" => GetMessage("FILEMAN_H_EDIT_TAB2_TITLE"));
}
示例3: isset
if (isset($_GET['target']) && check_freetrix_sessid())
{
switch ($_GET['target'])
{
case "load":
CSnippets::LoadList(array(
'template' => $APPLICATION->UnJSEscape($_GET["templateID"]),
'bClearCache' => isset($_GET['clear_snippets_cache']) && $_GET['clear_snippets_cache'] == 'Y',
));
break;
case "add":
case "edit":
CUtil::JSPostUnEscape();
$code = isset($_REQUEST['code']) ? $_REQUEST['code'] : '';
if (CFileman::IsPHP($code) && !$USER->CanDoOperation('edit_php'))
return $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
CSnippets::Edit(array(
'bNew' => $_REQUEST['target'] == 'add',
'name' => $_REQUEST['name'],
'path' => $_REQUEST['target'] == 'add' && isset($_REQUEST['path']) ? $_REQUEST['path'] : false,
'template' => $_REQUEST['templateID'],
'site' => $_REQUEST['site'],
'title' => isset($_REQUEST['title']) ? $_REQUEST['title'] : '',
'description' => isset($_REQUEST['description']) ? $_REQUEST['description'] : '',
'code' => $code,
'thumb' => isset($_REQUEST['thumb']) ? $_REQUEST['thumb'] : false,
'location' => isset($_REQUEST["location"]) ? $_REQUEST["location"] : false,
'newGroup' => isset($_REQUEST["new_group"]) ? $_REQUEST["new_group"] : false
));