本文整理汇总了PHP中CFileMan::SecurePathVar方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileMan::SecurePathVar方法的具体用法?PHP CFileMan::SecurePathVar怎么用?PHP CFileMan::SecurePathVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileMan
的用法示例。
在下文中一共展示了CFileMan::SecurePathVar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replacer
function replacer($str)
{
$str = CFileMan::SecurePathVar($str);
$str = preg_replace("/[^a-zA-Z0-9_\\.-\\+]/is", "_", $str);
return $str;
}
示例2: RequestAction
//.........这里部分代码省略.........
case "snippet_add_category":
if (!$USER->CanDoOperation('fileman_view_file_structure'))
break;
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::CreateCategory(array(
'template' => $template,
'name' => $_REQUEST['category_name'],
'parent' => $_REQUEST['category_parent']
));
if ($res)
{
$result = array(
'result' => true,
'snippets' => array($template => self::GetSnippets($template))
);
}
else
{
$result = array('result' => false);
}
break;
case "snippet_remove_category":
if (!$USER->CanDoOperation('fileman_view_file_structure'))
break;
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::RemoveCategory(array(
'template' => $template,
'path' => $_REQUEST['category_path']
));
if ($res)
{
$result = array(
'result' => true,
'snippets' => array($template => self::GetSnippets($template))
);
}
else
{
$result = array('result' => false);
}
break;
case "snippet_rename_category":
if (!$USER->CanDoOperation('fileman_view_file_structure'))
break;
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::RenameCategory(array(
'template' => $template,
'path' => $_REQUEST['category_path'],
'new_name' => $_REQUEST['category_new_name']
));
if ($res)
{
$result = array(
'result' => true,
'snippets' => array($template => self::GetSnippets($template))
);
}
else
{
$result = array('result' => false);
}
break;
// END *** Snippets actions
// spellcheck
case "spellcheck_words":
case "spellcheck_add_word":
CUtil::JSPostUnEscape();
$spellChecker = new CSpellchecker(array(
"lang" => $_REQUEST['lang'],
"skip_length" => 2,
"use_pspell" => $_REQUEST['use_pspell'] !== "N",
"use_custom_spell" => $_REQUEST['use_custom_spell'] !== "N",
"mode" => PSPELL_FAST
));
if ($action == "spellcheck_words")
{
$words = (isset($_REQUEST['words']) && is_array($_REQUEST['words'])) ? $_REQUEST['words'] : array();
$result = array(
'words' => $spellChecker->checkWords($words)
);
}
else // Add word
{
$word = CFileMan::SecurePathVar($_REQUEST['word']);
$spellChecker->addWord($word);
}
break;
// END *** spellcheck
}
self::ShowResponse(intVal($_REQUEST['reqId']), $result);
}
示例3: NormalizePath
public static function NormalizePath($path)
{
$path = CFileMan::SecurePathVar(Rel2Abs("/", $path));
$path = rtrim($path, '/');
return $path;
}
示例4: PreviewFlash
function PreviewFlash($Params)
{
if (CModule::IncludeModule("fileman")) {
global $APPLICATION, $USER;
if (CModule::IncludeModule("compression")) {
CCompress::Disable2048Spaces();
}
$path = $Params['path'];
$path = CFileMan::SecurePathVar($path);
$path = Rel2Abs("/", $path);
$arPath = array($Params['site'], $path);
if (!$USER->CanDoFileOperation('fm_view_file', $arPath)) {
$path = '';
}
if ($path == "") {
return;
}
$APPLICATION->RestartBuffer();
?>
<HTML>
<HEAD></HEAD>
<BODY id="__flash" style="margin:0px; border-width: 0px;">
<embed id="__flash_preview" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="__flash_preview" quality="high" width="<?php
echo $Params['width'];
?>
" height="<?php
echo $Params['height'];
?>
" src="<?php
echo htmlspecialcharsex($path);
?>
" />
</BODY>
</HTML>
<?php
die;
}
}
示例5: GetGroups
public static function GetGroups($Params)
{
$template = CFileMan::SecurePathVar($Params['template']);
$arSnGroups = Array();
CSnippets::InspectDir($arSnGroups, "", $template);
CSnippets::DisplayJSGroups($template, $arSnGroups);
}
示例6: RequestAction
//.........这里部分代码省略.........
$template = $_REQUEST['site_template'];
$result = array('result' => true, 'snippets' => array($template => self::GetSnippets($template, $_REQUEST['clear_cache'] == 'Y')));
break;
case "edit_snippet":
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
break;
}
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
// Update
if ($_REQUEST['current_path']) {
$result = CSnippets::Update(array('template' => $template, 'path' => $_REQUEST['path'], 'code' => $_REQUEST['code'], 'title' => $_REQUEST['name'], 'current_path' => $_REQUEST['current_path'], 'description' => $_REQUEST['description']));
} else {
$result = CSnippets::Add(array('template' => $template, 'path' => $_REQUEST['path'], 'code' => $_REQUEST['code'], 'title' => $_REQUEST['name'], 'description' => $_REQUEST['description']));
}
if ($result && $result['result']) {
$result['snippets'] = array($template => self::GetSnippets($template));
}
break;
case "remove_snippet":
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
break;
}
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::Remove(array('template' => $template, 'path' => $_REQUEST['path']));
if ($res) {
$result = array('result' => true, 'snippets' => array($template => self::GetSnippets($template)));
} else {
$result = array('result' => false);
}
break;
case "snippet_add_category":
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
break;
}
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::CreateCategory(array('template' => $template, 'name' => $_REQUEST['category_name'], 'parent' => $_REQUEST['category_parent']));
if ($res) {
$result = array('result' => true, 'snippets' => array($template => self::GetSnippets($template)));
} else {
$result = array('result' => false);
}
break;
case "snippet_remove_category":
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
break;
}
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::RemoveCategory(array('template' => $template, 'path' => $_REQUEST['category_path']));
if ($res) {
$result = array('result' => true, 'snippets' => array($template => self::GetSnippets($template)));
} else {
$result = array('result' => false);
}
break;
case "snippet_rename_category":
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
break;
}
CUtil::JSPostUnEscape();
$template = $_REQUEST['site_template'];
$res = CSnippets::RenameCategory(array('template' => $template, 'path' => $_REQUEST['category_path'], 'new_name' => $_REQUEST['category_new_name']));
if ($res) {
$result = array('result' => true, 'snippets' => array($template => self::GetSnippets($template)));
} else {
$result = array('result' => false);
}
break;
// END *** Snippets actions
// spellcheck
// END *** Snippets actions
// spellcheck
case "spellcheck_words":
case "spellcheck_add_word":
CUtil::JSPostUnEscape();
$spellChecker = new CSpellchecker(array("lang" => $_REQUEST['lang'], "skip_length" => 2, "use_pspell" => $_REQUEST['use_pspell'] !== "N", "use_custom_spell" => $_REQUEST['use_custom_spell'] !== "N", "mode" => PSPELL_FAST));
if ($action == "spellcheck_words") {
$words = isset($_REQUEST['words']) && is_array($_REQUEST['words']) ? $_REQUEST['words'] : array();
$result = array('words' => $spellChecker->checkWords($words));
} else {
$word = CFileMan::SecurePathVar($_REQUEST['word']);
$spellChecker->addWord($word);
}
break;
// END *** spellcheck
// END *** spellcheck
case "load_file_dialogs":
$editorId = $_REQUEST['editor_id'];
$editorId = preg_replace("/[^a-zA-Z0-9_-]/is", "_", $editorId);
CAdminFileDialog::ShowScript(array("event" => "BxOpenFileBrowserWindFile" . $editorId, "arResultDest" => array("FUNCTION_NAME" => "OnFileDialogSelect" . $editorId), "arPath" => array("SITE" => SITE_ID), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'image', "allowAllFiles" => true, "SaveConfig" => true));
CMedialib::ShowBrowseButton(array('value' => '...', 'event' => "BxOpenFileBrowserWindFile" . $editorId, 'button_id' => "bx-open-file-link-medialib-but-" . $editorId, 'id' => "bx_open_file_link_medialib_button_" . $editorId, 'MedialibConfig' => array("event" => "BxOpenFileBrowserFileMl" . $editorId, "arResultDest" => array("FUNCTION_NAME" => "OnFileDialogSelect" . $editorId)), 'useMLDefault' => false));
CMedialib::ShowBrowseButton(array('value' => '...', 'event' => "BxOpenFileBrowserWindFile" . $editorId, 'button_id' => "bx-open-file-medialib-but-" . $editorId, 'id' => "bx_open_file_medialib_button_" . $editorId, 'MedialibConfig' => array("event" => "BxOpenFileBrowserImgFileMl" . $editorId, "arResultDest" => array("FUNCTION_NAME" => "OnFileDialogImgSelect" . $editorId), "types" => array('image'))));
$result = array('result' => true);
break;
}
self::ShowResponse(intVal($_REQUEST['reqId']), $result);
}
示例7: GetGroupList
public static function GetGroupList($Params)
{
$template = CFileMan::SecurePathVar($Params['template']);
$arGroups = false;
$CACHE_SNIPPETS = Array();
if ($Params['bClearCache'])
CSnippets::ClearCache();
if (!$arGroups || !is_array($arGroups))
{
$arGroups = Array();
CSnippets::InspectDir($arGroups, "", $template);
$CACHE_SNIPPETS[$template] = $arGroups;
}
return $arGroups;
}
示例8: GetGroupList
public static function GetGroupList($Params)
{
global $CACHE_MANAGER;
$template = CFileMan::SecurePathVar($Params['template']);
$arGroups = false;
$CACHE_SNIPPETS = array();
if ($Params['bClearCache']) {
CSnippets::ClearCache();
}
$ttl = 30 * 24 * 60 * 60;
// 30 days
if ($CACHE_MANAGER->Read($ttl, "fileman_snippet_group")) {
$CACHE_SNIPPETS = $CACHE_MANAGER->Get("fileman_snippet_group");
if (isset($CACHE_SNIPPETS[$template])) {
$arGroups = $CACHE_SNIPPETS[$template];
}
}
if (!$arGroups || !is_array($arGroups)) {
$arGroups = array();
CSnippets::InspectDir($arGroups, "", $template);
$CACHE_SNIPPETS[$template] = $arGroups;
$CACHE_MANAGER->Set("fileman_snippet_group", $CACHE_SNIPPETS);
}
return $arGroups;
}
示例9: RemoveCategory
public static function RemoveCategory($params)
{
$res = false;
if (is_array($params) && isset($params['path'])) {
$path = CFileMan::SecurePathVar($params['path']);
$template = isset($params['template']) && $params['template'] !== '' ? CFileMan::SecurePathVar($params['template']) : '.default';
$basePath = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $template . "/snippets";
$categoryPath = $basePath . '/' . $path;
$io = CBXVirtualIo::GetInstance();
if ($io->DirectoryExists($categoryPath)) {
$res = $io->Delete($categoryPath);
}
CSnippets::ClearCache();
}
return $res;
}