Пример #1
0
function BXDeleteFromMenuFile($menuFile, $documentRoot, $site, $path)
{
    $aMenuLinks = array();
    $arMenu = CFileman::GetMenuArray($documentRoot . $menuFile);
    if (empty($arMenu["aMenuLinks"])) {
        return false;
    }
    $arFound = false;
    foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) {
        if (!isset($arItem[1])) {
            continue;
        }
        $menuLink = $arItem[1];
        $position = strpos($menuLink, "?");
        if ($position !== false) {
            $menuLink = substr($menuLink, 0, $position);
        }
        if ($menuLink != "/") {
            $menuLink = rtrim($menuLink, "/");
        }
        $filename = basename($path);
        $dirName = str_replace("\\", "/", dirname($path));
        if ($menuLink == $path || $filename == "index.php" && $menuLink == $dirName) {
            $arFound = array('menuFile' => $menuFile, 'menuIndex' => $menuIndex, 'menuItem' => $arItem);
            unset($arMenu["aMenuLinks"][$menuIndex]);
        }
    }
    if ($arFound) {
        CFileMan::SaveMenu(array($site, $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
        if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
            $res_log = array();
            $mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
            $mt = unserialize(str_replace("\\", "", $mt));
            $res_log['menu_name'] = $mt[$menuType];
            $res_log['path'] = substr($dirName, 1);
            CEventLog::Log("content", "MENU_EDIT", "main", "", serialize($res_log));
        }
    }
    return $arFound;
}
Пример #2
0
				"SUB_DETAIL_TEXT",
				$str_DETAIL_TEXT,
				"SUB_DETAIL_TEXT_TYPE",
				$str_DETAIL_TEXT_TYPE,
				array(
						'height' => 450,
						'width' => '100%'
					),
					"N",
					0,
					"",
					"",
					$arIBlock["LID"],
					true,
					false,
					array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_".(defined('BX_SUB_SETTINGS') && BX_SUB_SETTINGS == true ? 'admin' : 'public')), 'saveEditorKey' => $IBLOCK_ID)
				);
		?></td>
	</tr>
	<?else:?>
	<tr id="tr_SUB_DETAIL_TEXT_TYPE">
		<td><?echo GetMessage("IBLOCK_DESC_TYPE")?></td>
		<td><input type="radio" name="SUB_DETAIL_TEXT_TYPE" id="SUB_DETAIL_TEXT_TYPE_text" value="text"<?if($str_DETAIL_TEXT_TYPE!="html")echo " checked"?>> <label for="SUB_DETAIL_TEXT_TYPE_text"><?echo GetMessage("IBLOCK_DESC_TYPE_TEXT")?></label> / <input type="radio" name="SUB_DETAIL_TEXT_TYPE" id="SUB_DETAIL_TEXT_TYPE_html" value="html"<?if($str_DETAIL_TEXT_TYPE=="html")echo " checked"?>> <label for="SUB_DETAIL_TEXT_TYPE_html"><?echo GetMessage("IBLOCK_DESC_TYPE_HTML")?></label></td>
	</tr>
	<tr id="tr_SUB_DETAIL_TEXT">
		<td colspan="2" align="center">
			<textarea cols="60" rows="20" name="SUB_DETAIL_TEXT" style="width:100%"><?echo $str_DETAIL_TEXT?></textarea>
		</td>
	</tr>
	<?endif?>
<?
Пример #3
0
					tmpArray = arGlobalToolbar.slice(0, cutID).concat([arButtons['BlogCUT']]);
					arGlobalToolbar = tmpArray.concat(arGlobalToolbar.slice(cutID));					
				}										
				
				//-->
				</script>

				<?php 
            }
            AddEventHandler("fileman", "OnIncludeHTMLEditorScript", "CustomizeEditorForBlog");
            ?>
			<script>
			jsUtils.addCustomEvent('EditorLoadFinish_POST_MESSAGE_HTML', BXBlogSetEditorContent);
			</script>
			<?php 
            CFileman::ShowHTMLEditControl("POST_MESSAGE_HTML", $arResult["PostToShow"]["~DETAIL_TEXT"], array("site" => SITE_ID, "templateID" => "", "bUseOnlyDefinedStyles" => "N", "bWithoutPHP" => true, "arToolbars" => array("manage", "standart", "style", "formating", "source", "table"), "arTaskbars" => array("BXPropertiesTaskbar"), "sBackUrl" => "", "fullscreen" => false, "path" => "", "limit_php_access" => true, 'height' => '490', 'width' => '100%', 'light_mode' => true));
        } else {
            ShowError(GetMessage("FILEMAN_MODULE_NOT_INSTALL"));
        }
        die;
    } else {
        include $_SERVER["DOCUMENT_ROOT"] . $templateFolder . "/script.php";
        if ($arResult["preview"] == "Y" && !empty($arResult["PostToShow"]) > 0) {
            echo "<span class=\"blogtext\"><b>" . GetMessage("BLOG_PREVIEW_TITLE") . "</b></span>";
            ?>
			<table class="blog-table-post">
			<tr>
				<th nowrap width="100%">
					<table width="100%" cellspacing="0" cellpadding="0" border="0" class="blog-table-post-table">
					<tr>
						<td align="left">
Пример #4
0
 public static function CheckFileExtention($strPath = '', $arExt = false)
 {
     if (!$arExt) {
         $arExt = CMedialib::GetMediaExtentions(false);
     }
     $ext = strtolower(CFileman::GetFileExtension($strPath));
     return in_array($ext, $arExt);
 }
Пример #5
0
        ?>
;">
<?php 
        $site = is_array($arSITE) ? $arSITE[0] : LANG;
        $arTplList = CSite::GetTemplateList($site);
        $tpl = "";
        while ($ar = $arTplList->Fetch()) {
            if (strlen($tpl) == 0) {
                $tpl = $ar["TEMPLATE"];
            }
            if (strlen(trim($ar["CONDITION"])) == 0) {
                $tpl = $ar["TEMPLATE"];
                break;
            }
        }
        CFileMan::ShowHTMLEditControl("FORM_TEMPLATE", htmlspecialcharsback($str_FORM_TEMPLATE), array("site" => $arSITE[0], "templateID" => $tpl, "bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bWithoutPHP" => false, "arToolbars" => array("standart", "style", "formating", "source", "template", "table"), "arTaskbars" => array("BXFormElementsTaskbar", "BXPropertiesTaskbar"), "toolbarConfig" => CFileman::GetEditorToolbarConfig("form_edit" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? "_public" : "")), "sBackUrl" => "", "fullscreen" => false, 'width' => '100%', 'height' => '500', 'use_editor_3' => 'N'));
        ?>
<script>
oBXEditorUtils.addPHPParser(oForm.PHPParser);
oBXEditorUtils.addTaskBar('BXFormElementsTaskbar', 2, "<?php 
        echo GetMessageJS('FORM_TASKBARSET_TITLE');
        ?>
", []);
if (window.arButtons['Optimize'])
	arButtons['Optimize'][1].hideCondition = function(pMainObj){return pMainObj.name == "FORM_TEMPLATE";}
</script>
		</div></td>
	</tr>
	<?php 
    } else {
        ?>
Пример #6
0
function CheckFields()
{
    global $DB, $strError, $FILENAME, $APPLICATION, $ID, $BODY, $USER, $SITE_ID, $STATUS_ID, $DOC_ROOT;
    $str = "";
    $arMsg = array();
    $SCRIPT_FILE_TYPE = GetFileType($FILENAME);
    $FILENAME = trim($FILENAME);
    $FILENAME = "/" . ltrim(_normalizePath($FILENAME), "/");
    $io = CBXVirtualIo::GetInstance();
    if (strlen($FILENAME) <= 0) {
        $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FORGOT_FILENAME"));
    } elseif (!$io->ValidatePathString($FILENAME)) {
        $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FILE_NAME_NOT_VALID"));
    } elseif ($SCRIPT_FILE_TYPE != "SOURCE") {
        $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_INCORRECT_FILETYPE"));
    } else {
        $SITE_ID = CWorkflow::__CheckSite($SITE_ID);
        if (!$SITE_ID) {
            $SITE_ID = CSite::GetSiteByFullPath($_SERVER['DOCUMENT_ROOT'] . $FILENAME);
        }
        if (!$USER->CanDoFileOperation('fm_edit_in_workflow', array($SITE_ID, $FILENAME))) {
            $s = str_replace("#FILENAME#", "{$FILENAME}", GetMessage("FLOW_ACCESS_DENIED"));
            $arMsg[] = array("id" => "FILENAME", "text" => $s . ": " . GetMessage("FLOW_MIN_RIGHTS"));
        } elseif ($STATUS_ID == 1 && !($USER->CanDoFileOperation('fm_edit_existent_file', array($SITE_ID, $FILENAME)) && $USER->CanDoFileOperation('fm_create_new_file', array($SITE_ID, $FILENAME)))) {
            $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_ACCESS_DENIED_FOR_FILE_WRITE", array("#FILENAME#" => $FILENAME)));
        } else {
            $z = CWorkflow::GetByFilename($FILENAME, $SITE_ID);
            if ($zr = $z->Fetch()) {
                if ($zr["ID"] != $ID && $zr["STATUS_ID"] != 1) {
                    $arMsg[] = array("id" => "FILENAME", "text" => str_replace("#FILENAME#", $FILENAME, GetMessage("FLOW_FILENAME_EXIST")));
                }
            }
        }
    }
    if (!CWorkflow::IsAdmin()) {
        $arGroups = $USER->GetUserGroupArray();
        if (!is_array($arGroups)) {
            $arGroups = array(2);
        }
        $arFilter = array("GROUP_ID" => $arGroups, "PERMISSION_TYPE_1" => 1, "ID_EXACT_MATCH" => "Y", "ID" => $STATUS_ID);
        $rsStatuses = CWorkflowStatus::GetList($by = "s_c_sort", $strOrder, $arFilter, $is_filtered, array("ID"));
        if (!$rsStatuses->Fetch()) {
            $arMsg[] = array("id" => "STATUS_ID", "text" => GetMessage("FLOW_ERROR_WRONG_STATUS"));
        }
    }
    $bIsPhp = IsPHP($BODY);
    if ($bIsPhp) {
        if ($USER->CanDoFileOperation('fm_lpa', array($SITE_ID, $FILENAME)) && !$USER->CanDoOperation('edit_php')) {
            if (CModule::IncludeModule("fileman")) {
                $old_res = CFileman::ParseFileContent($APPLICATION->GetFileContent($DOC_ROOT . $FILENAME), true);
                $old_BODY = $old_res["CONTENT"];
                $BODY = CMain::ProcessLPA($BODY, $old_BODY);
            } else {
                $arMsg[] = array("id" => "BODY", "text" => "Error! Fileman is not included!");
            }
        } else {
            if (!$USER->CanDoOperation('edit_php')) {
                $arMsg[] = array("id" => "BODY", "text" => GetMessage("FLOW_PHP_IS_NOT_AVAILABLE"));
            }
        }
    }
    if (!empty($arMsg)) {
        $e = new CAdminException($arMsg);
        $GLOBALS["APPLICATION"]->ThrowException($e);
        return false;
    }
    return true;
}
Пример #7
0
    public static function Init($Params)
    {
        global $USER;
        $arWarnings = array();
        if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_admin_folders')) {
            $arWarnings[] = GetMessage('FM_UTIL_ACCESS_DENIED');
        }
        $io = CBXVirtualIo::GetInstance();
        if (count($arWarnings) == 0) {
            $pathTo = trim($Params['copyTo'], " /");
            $site = CFileMan::__CheckSite($_GET['site']);
            $siteTo = $Params['siteTo'] ? $Params['siteTo'] : $site;
            $pathTo = $pathTo == "" ? "/" : "/" . $pathTo . "/";
            $absPathTo = CSite::GetSiteDocRoot($siteTo) . $pathTo;
            $docRootFrom = CSite::GetSiteDocRoot($site);
            if (!$io->DirectoryExists($absPathTo)) {
                // Create destination directory
                $bAccess = $USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_create_new_folder', $pathTo);
                if ($Params['createCopyTo']) {
                    if ($bAccess) {
                        CFileMan::CreateDir(array($siteTo, $pathTo));
                    }
                } else {
                    ?>
<script>window.BXFM_NoCopyToDir = "<?php 
                    echo $bAccess ? "ask_user" : "access_denied";
                    ?>
";</script><?php 
                    return;
                }
            }
            foreach ($Params['arFiles'] as $file) {
                $filePath = $file['path'];
                $caseOption = $Params['caseOption'];
                if ($Params["userCaseLastPath"]) {
                    if ($Params["userCaseLastPath"] != $filePath) {
                        continue;
                    }
                    $caseOption = $Params['userCaseAnswer'];
                    if ($Params["userCaseToAll"]) {
                        $Params['caseOption'] = $caseOption;
                    }
                    $Params["userCaseLastPath"] = false;
                }
                $arPath_i = array($site, $filePath);
                $absPath_i = $docRootFrom . $filePath;
                $bDir_i = $io->DirectoryExists($absPath_i);
                $name_i = CFileman::GetFileName($filePath);
                $strWarn = "";
                // Check if file already exists in destination folder
                if ($io->FileExists($absPathTo . $name_i) || $bDir_i == $io->DirectoryExists($absPathTo . $name_i) && $bDir_i) {
                    $fTmp = $io->GetFile($absPathTo . $name_i);
                    $fTmp1 = $io->GetFile($absPath_i);
                    $altName = CFilemanCopy::GetAltFileName($absPathTo, $name_i, $bDir_i);
                    if ($caseOption == 'ask') {
                        ?>
<script>
						window.BXFM_fileExist = {
							fileOld: {
								name: "<?php 
                        echo CUtil::JSEscape($name_i);
                        ?>
",
								path: "<?php 
                        echo CUtil::JSEscape($pathTo . $name_i);
                        ?>
",
								site: "<?php 
                        echo CUtil::JSEscape($siteTo);
                        ?>
",
								bDir: <?php 
                        echo $bDir_i ? "true" : "false";
                        ?>
,
								size: "<?php 
                        echo $bDir_i ? '-' : CFile::FormatSize($fTmp->GetFileSize());
                        ?>
",
								date: "<?php 
                        echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPathTo . $name_i) + CTimeZone::GetOffset());
                        ?>
"
							},
							fileNew: {
								alt_name: "<?php 
                        echo CUtil::JSEscape($altName);
                        ?>
",
								name: "<?php 
                        echo CUtil::JSEscape($name_i);
                        ?>
",
								path: "<?php 
                        echo CUtil::JSEscape($filePath);
                        ?>
",
								site: "<?php 
                        echo CUtil::JSEscape($site);
                        ?>
",
								bDir: <?php 
                        echo $bDir_i ? "true" : "false";
                        ?>
,
								size: "<?php 
                        echo $bDir_i ? '-' : CFile::FormatSize($fTmp1->GetFileSize());
                        ?>
",
								date: "<?php 
                        echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPath_i) + CTimeZone::GetOffset());
                        ?>
"
							}
						};
						</script><?php 
                        return;
                    } elseif ($caseOption == 'replace') {
                        // We don't need to replace, couse it's one file
                        if (CFileMan::NormalizePath($pathTo . "/" . $name_i) == $filePath) {
                            continue;
                        }
                        $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy'], true);
                        if ($strWarn != "") {
                            $arWarnings[] = $strWarn;
                            $log = false;
                        } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
                            CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
                        }
                    } elseif ($caseOption == 'auto_rename') {
                        $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $altName)), !$Params['bCopy']);
                        if ($strWarn != "") {
                            $arWarnings[] = $strWarn;
                            $log = false;
                        } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
                            CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
                        }
                    } elseif ($caseOption == 'skip') {
                        continue;
                    }
                } else {
                    $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy']);
                    if ($strWarn != "") {
                        $arWarnings[] = $strWarn;
                        $log = false;
                    } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
                        CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
                    }
                }
                $module_id = "fileman";
                if (COption::GetOptionString($module_id, "log_page", "Y") == "Y" && $log) {
                    $res_log['copy_to'] = substr($pathTo, 1);
                    $res_log['path'] = substr($filePath, 1);
                    if ($Params['bCopy'] == "copy") {
                        if (!$bDir_i) {
                            CEventLog::Log("content", "FILE_COPY", "fileman", "", serialize($res_log));
                        } else {
                            CEventLog::Log("content", "SECTION_COPY", "fileman", "", serialize($res_log));
                        }
                    } else {
                        if (!$bDir_i) {
                            CEventLog::Log("content", "FILE_MOVE", "fileman", "", serialize($res_log));
                        } else {
                            CEventLog::Log("content", "SECTION_MOVE", "fileman", "", serialize($res_log));
                        }
                    }
                }
            }
        }
        $arWarnings;
        ?>
<script>
		window.BXFM_result = {
			status: "<?php 
        echo count($arWarnings) > 0 ? 'errors' : 'ok';
        ?>
",
			errors: <?php 
        echo count($arWarnings) > 0 ? CUtil::PhpToJSObject($arWarnings) : '{}';
        ?>
		};
		</script><?php 
    }
Пример #8
0
IncludeModuleLangFile(__FILE__);
$strWarning = "";
$site = CFileMan::__CheckSite($site);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$io = CBXVirtualIo::GetInstance();
$path = $GLOBALS["APPLICATION"]->ConvertCharset($path, "UTF-8", LANG_CHARSET);
$arFile = CFile::MakeFileArray($io->GetPhysicalName($path));
$arFile["tmp_name"] = CBXVirtualIoFileSystem::ConvertCharset($arFile["tmp_name"], CBXVirtualIoFileSystem::directionDecode);
$path = $io->CombinePath("/", $path);
$arPath = array($site, $path);
if (!$USER->CanDoFileOperation('fm_download_file', $arPath)) {
    $strWarning = GetMessage("ACCESS_DENIED");
} else {
    if (!$io->FileExists($arFile["tmp_name"])) {
        $strWarning = GetMessage("FILEMAN_FILENOT_FOUND") . " ";
    } elseif (!$USER->CanDoOperation('edit_php') && (HasScriptExtension($path) || substr(CFileman::GetFileName($path), 0, 1) == ".")) {
        $strWarning .= GetMessage("FILEMAN_FILE_DOWNLOAD_PHPERROR") . "\n";
    }
}
if (strlen($strWarning) <= 0) {
    $flTmp = $io->GetFile($arFile["tmp_name"]);
    $fsize = $flTmp->GetFileSize();
    $bufSize = 4194304;
    //4M
    session_write_close();
    set_time_limit(0);
    header("Content-Type: application/force-download; name=\"" . $arFile["name"] . "\"");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . $fsize);
    header("Content-Disposition: attachment; filename=\"" . $arFile["name"] . "\"");
    header("Expires: 0");
Пример #9
0
 public static function GetSiteTemplateParams($templateId, $siteId)
 {
     $params = CFileman::GetAllTemplateParams($templateId, $siteId);
     $params["STYLES"] = preg_replace("/(url\\(\"?)images\\//is", "\\1" . $params['SITE_TEMPLATE_PATH'] . '/images/', $params["STYLES"]);
     if (is_array($params['EDITOR_STYLES'])) {
         for ($i = 0, $l = count($params['EDITOR_STYLES']); $i < $l; $i++) {
             $params['EDITOR_STYLES'][$i] = $params['EDITOR_STYLES'][$i] . '?' . @filemtime($_SERVER['DOCUMENT_ROOT'] . $params['EDITOR_STYLES'][$i]);
         }
     }
     return $params;
 }
Пример #10
0
				$str_DETAIL_TEXT,
				"DETAIL_TEXT_TYPE",
				$str_DETAIL_TEXT_TYPE,
				array(
					'height' => 450,
					'width' => '100%'
				),
				"N",
				0,
				"",
				"",
				$arIBlock["LID"],
				true,
				false,
				array(
					'toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_".(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin')),
					'saveEditorKey' => $IBLOCK_ID,
					'hideTypeSelector' => $arIBlock["FIELDS"]["DETAIL_TEXT_TYPE_ALLOW_CHANGE"]["DEFAULT_VALUE"] === "N",
				)
			);
		?></td>
	</tr>
	<?else:?>
	<tr id="tr_DETAIL_TEXT_TYPE">
		<td><?echo GetMessage("IBLOCK_DESC_TYPE")?></td>
		<td><input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_text" value="text"<?if($str_DETAIL_TEXT_TYPE!="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_text"><?echo GetMessage("IBLOCK_DESC_TYPE_TEXT")?></label> / <input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_html" value="html"<?if($str_DETAIL_TEXT_TYPE=="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_html"><?echo GetMessage("IBLOCK_DESC_TYPE_HTML")?></label></td>
	</tr>
	<tr id="tr_DETAIL_TEXT">
		<td colspan="2" align="center">
			<textarea cols="60" rows="20" name="DETAIL_TEXT" style="width:100%"><?echo $str_DETAIL_TEXT?></textarea>
		</td>
Пример #11
0
				'name' => 'filesrc',
				'id' => 'filesrc',
				'width' => '100%',
				'height' => '650',
				'content' => $filesrc,
				'bAllowPhp' => $USER->CanDoOperation('edit_php'),
				"limitPhpAccess" => $limit_php_access
			));
			?>
		<?else:?>
			<? CFileman::ShowHTMLEditControl("filesrc", $filesrc, Array(
				"site"=>$site,
				"templateID"=>$templateID,
				"bUseOnlyDefinedStyles"=>COption::GetOptionString("fileman", "show_untitled_styles", "N")!="Y",
				"bWithoutPHP"=>(!$USER->CanDoOperation('edit_php')),
				"toolbarConfig" => CFileman::GetEditorToolbarConfig("filesrc"),
				"arToolbars"=>Array("manage", "standart", "style", "formating", "source", "template"),
				"arTaskbars"=>Array("BXComponentsTaskbar", "BXComponents2Taskbar", "BXPropertiesTaskbar", "BXSnippetsTaskbar"),
				"sBackUrl"=>$url,
				"fullscreen"=>($bFullScreen=='Y'),
				"path" => $path,
				'width' => '100%',
				'height' => '650px',
				"limit_php_access" => $limit_php_access
				)
			);?>
		<?endif;?>
	</td></tr>
	<?if($bEditProps):?>
	<?$tabControl->BeginNextTab();?>
	<tr>
Пример #12
0
# Copyright (c) 2002-2006 Bitrix             #
# http://www.bitrixsoft.com                  #
# mailto:admin@bitrixsoft.com                #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/prolog.php";
if (!$USER->CanDoOperation('fileman_view_file_structure') || !$USER->CanDoOperation('fileman_edit_existent_files')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/include.php";
if (CModule::IncludeModule("compression")) {
    CCompress::Disable2048Spaces();
}
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : false;
if (!check_bitrix_sessid()) {
    die('<!--BX_EDITOR_DUBLICATE_ACTION_REQUEST' . bitrix_sessid() . '-->');
}
if ($action == 'sitetemplateparams') {
    $templateID = $_GET['templateID'];
    ?>
	<script>
	window.bx_template_params = <?php 
    echo CUtil::PhpToJSObject(CFileman::GetAllTemplateParams($templateID, $site));
    ?>
;
	</script>
	<?php 
}
define("ADMIN_AJAX_MODE", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_after.php";
	<tr id="tr_DETAIL_TEXT_DIFF">
		<td colspan="2">
			<div style="width:95%;background-color:white;border:1px solid black;padding:5px">
				<?php 
            echo getDiff($prev_arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT"]);
            ?>
			</div>
		</td>
	</tr>
	<?php 
        } elseif (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && $bFileman) {
            ?>
	<tr id="tr_DETAIL_TEXT_EDITOR">
		<td colspan="2" align="center">
			<?php 
            CFileMan::AddHTMLEditorFrame("DETAIL_TEXT", $str_DETAIL_TEXT, "DETAIL_TEXT_TYPE", $str_DETAIL_TEXT_TYPE, array('height' => 450, 'width' => '100%'), "N", 0, "", "", $arIBlock["LID"], true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin')), 'saveEditorKey' => $IBLOCK_ID));
            ?>
</td>
	</tr>
	<?php 
        } else {
            ?>
	<tr id="tr_DETAIL_TEXT_TYPE">
		<td><?php 
            echo GetMessage("IBLOCK_DESC_TYPE");
            ?>
</td>
		<td><input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_text" value="text"<?php 
            if ($str_DETAIL_TEXT_TYPE != "html") {
                echo " checked";
            }
Пример #14
0
		Array("height"=>600, "width"=>'100%'),
		"N", //CONVERT_FOR_WORKFLOW
		0, //WORKFLOW_DOCUMENT_ID
		"", //NEW_DOCUMENT_PATH
		"", //textarea_field
		false, //site
		false, //bWithoutPHP
		Array("BXPropertiesTaskbar","BXComponentsTaskbar", "BXComponents2Taskbar","BXSnippetsTaskbar"), //arTaskbars
		Array //arAdditionalParams
		(
			"additionalCSS" => Array($template_styles_path),
			"saveEditorState" => false,
			//"dontusecookie" => true,
			"limit_php_access" => ($lpa || $lpa_view),
			"dontshowta" => true,
			'toolbarConfig' => CFileman::GetEditorToolbarConfig("template_edit")
		)
	);
else:?>
	<textarea rows="28" cols="60" style="width:100%" id="bxed_CONTENT" name="CONTENT" wrap="off"><?echo htmlspecialcharsbx(htmlspecialcharsback($str_CONTENT))?></textarea>
<?endif;?>
		</td>
	</tr>

<script type="text/javascript" src="/bitrix/js/main/template_edit.js?v=<?php 
echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/main/template_edit.js');
?>
"></script>

<script>
var messErrorWA = '<?echo CUtil::JSEscape(GetMessage("templ_edit_error_wa"))?>';
Пример #15
0
						editorDialog.DenyClose();
						editor.GetDialog('ConfirmExit').Show();
					}
				}

				function onEditorUnregister()
				{
					editor.Destroy();
				}
			})();
		</script>
		<?php 
        /* ************* END |HTML EDITOR 3.0| END ************* */
    } else {
        /* ************* OLD HTML EDITOR ************* */
        CFileman::ShowHTMLEditControl($editor_name, $filesrc, array("site" => $site, "templateID" => $_REQUEST['templateID'], "bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bWithoutPHP" => !$USER->CanDoOperation('edit_php'), "toolbarConfig" => CFileman::GetEditorToolbarConfig($editor_name), "arTaskbars" => array("BXComponentsTaskbar", "BXComponents2Taskbar", "BXPropertiesTaskbar", "BXSnippetsTaskbar"), "sBackUrl" => $back_url, "path" => $path, "limit_php_access" => $limit_php_access, 'height' => '490', 'width' => '100%', 'light_mode' => true));
        ?>
	<script>
		var _bEdit = true;
		arEditorFastDialogs['asksave'] = function(pObj)
		{
			return {
				title: BX_MESS.EDITOR,
				innerHTML : "<div style='margin-bottom: 20px; padding: 5px;'>" + BX_MESS.DIALOG_EXIT_ACHTUNG + "</div>",
				width: 700,
				height: 130,
				OnLoad: function()
				{
					window.oBXEditorDialog.SetButtons([
						new BX.CWindowButton(
							{
Пример #16
0
 if (!$io->FileExists($abs_path) && !$io->DirectoryExists($abs_path)) {
     $strWarning .= GetMessage("FILEMAN_FILEORFOLDER_NOT_FOUND");
 } else {
     if ($REQUEST_METHOD == "POST" && strlen($save) > 0 && check_bitrix_sessid()) {
         $pathTmp = $path;
         foreach ($arFiles as $ind => $file) {
             $newfilename = $filename[$ind];
             if (strlen($newfilename) <= 0) {
                 $strWarning .= GetMessage("FILEMAN_RENAME_NEW_NAME") . " \"" . $file . "\"!\n";
             } elseif (($mess = CFileMan::CheckFileName($newfilename)) !== true) {
                 $strWarning = $mess;
             } else {
                 $pathto = Rel2Abs($path, $newfilename);
                 if (!$USER->CanDoFileOperation('fm_create_new_file', array($site, $pathto))) {
                     $strWarning .= GetMessage("FILEMAN_RENAME_ACCESS_ERROR") . "\n";
                 } elseif (!$USER->CanDoOperation('edit_php') && (substr(CFileman::GetFileName($file), 0, 1) == "." || substr(CFileman::GetFileName($pathto), 0, 1) == "." || !HasScriptExtension($file) && HasScriptExtension($pathto))) {
                     // if not admin and renaming from non PHP to PHP
                     $strWarning .= GetMessage("FILEMAN_RENAME_TOPHPFILE_ERROR") . "\n";
                 } elseif (!$USER->CanDoOperation('edit_php') && HasScriptExtension($file) && !HasScriptExtension($pathto)) {
                     // if not admin and renaming from PHP to non PHP
                     $strWarning .= GetMessage("FILEMAN_RENAME_FROMPHPFILE_ERROR") . "\n";
                 } else {
                     $pathparsedtmp = CFileMan::ParsePath(array($site, $pathto), false, false, "", $logical == "Y");
                     $strWarningTmp = CFileMan::CreateDir($pathparsedtmp["PREV"]);
                     if (strlen($strWarningTmp) > 0) {
                         $strWarning .= $strWarningTmp;
                     } else {
                         if (!$io->FileExists($DOC_ROOT . $path . "/" . $file)) {
                             $strWarning .= GetMessage("FILEMAN_RENAME_FILE") . " \"" . $path . "/" . $file . "\" " . GetMessage("FILEMAN_RENAME_NOT_FOUND") . "!\n";
                         } elseif (!$io->Rename($DOC_ROOT . $path . "/" . $file, $DOC_ROOT . $pathto)) {
                             $strWarning .= GetMessage("FILEMAN_RENAME_ERROR") . " \"" . $path . "/" . $file . "\" " . GetMessage("FILEMAN_RENAME_IN") . " \"" . $pathto . "\"!\n";
Пример #17
0
		for($i = 0; $i<$numpropsvals; $i++)
		{
			if(strlen(Trim($_POST["CODE_".$i]))>0 && strlen(Trim($_POST["VALUE_".$i]))>0)
			{
				if($bNeedComma) $strDirProperties .= ",\n";
				$strDirProperties .= "   \"".CFileMan::EscapePHPString(Trim($_POST["CODE_".$i]))."\" => \"".CFileMan::EscapePHPString(Trim($_POST["VALUE_".$i]))."\"";
				$bNeedComma = True;
				$bNeedSectionFile = True;
			}
		}
		$strDirProperties .= "\n);\n";

		if($bNeedSectionFile)
			$APPLICATION->SaveFileContent($DOC_ROOT.$path."/.section.php", "<"."?\n".$strSectionName.$strDirProperties."?".">");
		else
			CFileman::DeleteFile(Array($site, $path."/.section.php"));

		if($USER->CanDoFileOperation('fm_edit_permission',$arPath))
		{
			$arPermissions=Array();
			$db_groups = CGroup::GetList($order="sort", $by="asc");
			while($arGroup = $db_groups->Fetch())
			{
				$gperm = isset($_POST["g_".$arGroup["ID"]]) ? $_POST["g_".$arGroup["ID"]] : '';
				if (!isset($gperm))
				{
					if($path=="")
						$gperm = $CUR_PERM["/"][$arGroup['ID']];
					else
						$gperm = $CUR_PERM[$arParsedPath["LAST"]][$arGroup['ID']];
				}
Пример #18
0
$path = $io->CombinePath("/", $path);
$arParsedPath = CFileMan::ParsePath(array($site, $path), true);
$abs_path = $DOC_ROOT . $path;
$arPath = array($site, $path);
$bUploaded = false;
$file_name = "";
$strWarning = "";
if ($REQUEST_METHOD == "POST" && strlen($saveimg) > 0 && check_bitrix_sessid()) {
    if (!$USER->CanDoOperation('fileman_edit_existent_files') || !$USER->CanDoFileOperation('fm_edit_existent_file', $arPath)) {
        $strWarning = GetMessage('FILEMAN_CAN_NOT_WRITE') . "<br>";
    } else {
        $file_name = CFileman::GetFileName($newfilename);
        if (strlen($file_name) <= 0 || $file_name == "none") {
            continue;
        }
        if (!$USER->IsAdmin() && (in_array(CFileman::GetFileExtension($file_name), CFileMan::GetScriptFileExt()) || $file_name[0] == ".")) {
            $strWarning .= GetMessage("FILEMAN_UPLOAD_BAD_TYPE") . "\n";
        } elseif ($io->FileExists($abs_path . "/" . $file_name)) {
            $strWarning = GetMessage("FILEMAN_FILE_EXIST") . "<br>";
        } else {
            if ($io->Copy($_FILES["imagefile"]["tmp_name"], $abs_path . "/" . $file_name)) {
                $bUploaded = true;
                $f = $io->GetFile($abs_path . "/" . $file_name);
                $f->MarkWritable();
            }
        }
    }
}
if ($bUploaded) {
    ?>
<script>
Пример #19
0
    function ShowHTMLEditControl($name, $content, $arParams = array())
    {
        global $USER;
        // We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986]
        if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid()) {
            return;
        }
        CUtil::InitJSCore(array('window', 'ajax'));
        $relPath = isset($arParams["path"]) ? $arParams["path"] : "/";
        $site = isset($arParams["site"]) ? $arParams["site"] : "";
        $__path = Rel2Abs("/", $relPath);
        $site = CFileMan::__CheckSite($site);
        $name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $name);
        if (!isset($arParams["limit_php_access"])) {
            $arParams["limit_php_access"] = false;
        }
        $arParams["light_mode"] = defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 || isset($arParams["light_mode"]) && $arParams["light_mode"] == 'Y';
        $io = CBXVirtualIo::GetInstance();
        $direction_rtl = false;
        if ($site) {
            $DOC_ROOT = CSite::GetSiteDocRoot($site);
            $abs_path = $DOC_ROOT . $__path;
            if ($io->FileExists($abs_path)) {
                $relPath = substr($relPath, 0, strrpos($relPath, "/"));
                if ($relPath == "") {
                    $relPath = "/";
                }
            }
        }
        static $bFirstUsed;
        $template = $arParams["templateID"];
        if (!isset($template) && defined('SITE_TEMPLATE_ID')) {
            $template = SITE_TEMPLATE_ID;
        }
        if (!isset($template) && isset($_GET['siteTemplateId'])) {
            $template = $_GET['siteTemplateId'];
        }
        if (!isset($template) && isset($site)) {
            $dbSiteRes = CSite::GetTemplateList($site);
            $SITE_TEMPLATE = array();
            while ($arSiteRes = $dbSiteRes->Fetch()) {
                if ($arSiteRes['CONDITION'] == "" || !isset($template)) {
                    $template = $arSiteRes['TEMPLATE'];
                }
            }
        }
        if (isset($arParams['use_editor_3'])) {
            $useEditor3 = $arParams['use_editor_3'] == "Y";
        } else {
            $useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y";
        }
        if ($useEditor3) {
            $Editor = new CHTMLEditor();
            $Editor->Show(array('name' => $name, 'id' => $name, 'siteId' => $arParams["site"], 'width' => $arParams["width"], 'height' => $arParams["height"], 'content' => $content, 'bAllowPhp' => !$arParams["bWithoutPHP"] && $USER->CanDoOperation('edit_php'), "limitPhpAccess" => $arParams["limit_php_access"], "display" => $arParams['bDisplay'], "componentFilter" => isset($arParams['componentFilter']) ? $arParams['componentFilter'] : false, "setFocusAfterShow" => isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : true, "relPath" => $relPath, "templateId" => $template));
            return;
        }
        //Taskbars
        $arTaskbars = isset($arParams["arTaskbars"]) ? $arParams["arTaskbars"] : array();
        //Toolbars
        $arToolbars = isset($arParams["arToolbars"]) ? $arParams["arToolbars"] : false;
        // Toolbar config
        $arParams["toolbarConfig"] = is_array($arParams["toolbarConfig"]) ? $arParams["toolbarConfig"] : false;
        $arParams["use_advanced_php_parser"] = COption::GetOptionString("fileman", "use_advanced_php_parser", "Y");
        $arParams["ar_entities"] = COption::GetOptionString("fileman", "ar_entities", 'umlya,greek,other');
        if ($arParams["ar_entities"] == 'none') {
            $arParams["ar_entities"] = '';
        }
        if (!isset($arParams["usePspell"])) {
            $arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
        }
        if (!isset($arParams["useCustomSpell"])) {
            $arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
        }
        $arParams['allowRenderComp2'] = COption::GetOptionString('fileman', "allow_render_components", "N") == 'Y';
        $arParams['renderComponents'] = $arParams['allowRenderComp2'] && CUserOptions::GetOption('fileman', "render_components", "Y") == 'Y';
        $lca = COption::GetOptionString("fileman", "use_lca", "N");
        $styleList_render_style = COption::GetOptionString("fileman", "render_styles_in_classlist", "Y") == 'Y' ? 'true' : 'false';
        $arAdditionalParams = isset($arParams["arAdditionalParams"]) ? $arParams["arAdditionalParams"] : array();
        $arResult = CFileman::GetAllTemplateParams($template, $site, $arParams["bWithoutPHP"] != true, $arAdditionalParams);
        $arParams["TEMPLATE"] = $arResult;
        if ($bUseOnlyDefinedStyles && !is_set($arResult, "STYLES_TITLE")) {
            $bUseOnlyDefinedStyles = false;
        }
        $arParams["body_class"] = COption::GetOptionString("fileman", "editor_body_class", "");
        $arParams["body_id"] = COption::GetOptionString("fileman", "editor_body_id", "");
        ?>
		<script bxrunfirst="true">
			var relPath = "<?php 
        echo CUtil::JSEscape($relPath);
        ?>
";
			var <?php 
        echo 'ar_' . $name . '_taskbars';
        ?>
 = {};
			<?php 
        for ($k = 0, $l = count($arTaskbars); $k < $l; $k++) {
            echo 'ar_' . $name . '_taskbars["' . $arTaskbars[$k] . '"] = true;';
        }
        if ($arToolbars !== false) {
            echo 'var  ar_' . $name . '_toolbars = {};';
            for ($k = 0, $l = count($arToolbars); $k < $l; $k++) {
                echo 'ar_' . $name . '_toolbars["' . $arToolbars[$k] . '"] = true;';
            }
        } else {
            echo 'var  ar_' . $name . '_toolbars = false;';
        }
        ?>

			window.ar_<?php 
        echo $name;
        ?>
_config = <?php 
        echo CUtil::PhpToJSObject($arParams);
        ?>
; // editor-config
		</script>
		<?php 
        $str_taskbars = "";
        CFileman::GetHTMLEditorSettings($name, $arParams["light_mode"], $arTaskbars, $str_taskbars);
        $str_taskbars .= '_' . CFileman::GetVersion();
        if (!$bFirstUsed) {
            $arTemplates = array(array('value' => '.default', 'name' => GetMessage("FILEMAN_DEFTEMPL")));
            $db_site_templates = CSiteTemplate::GetList(array(), array(), array());
            while ($ar_site_templates = $db_site_templates->Fetch()) {
                $arTemplates[] = array('value' => $ar_site_templates['ID'], 'name' => $ar_site_templates['NAME']);
            }
            ?>
			<script bxrunfirst="true">
				var
					arBXTemplates = <?php 
            echo CUtil::PhpToJSObject($arTemplates);
            ?>
,
					BXSite = "<?php 
            echo CUtil::JSEscape($site);
            ?>
",
					BXLang = "<?php 
            echo CUtil::JSEscape(LANGUAGE_ID);
            ?>
",
					styleList_render_style = <?php 
            echo $styleList_render_style;
            ?>
,
					limit_php_access = <?php 
            echo $arParams["limit_php_access"] ? 'true' : 'false';
            ?>
,
					lca = <?php 
            echo $lca == 'Y' ? 'true' : 'false';
            ?>
,
					lightMode = <?php 
            echo $arParams["light_mode"] ? 'true' : 'false';
            ?>
,
					BX_PERSONAL_ROOT = "<?php 
            echo BX_PERSONAL_ROOT;
            ?>
";

				window.limit_php_access = top.limit_php_access = limit_php_access;
				window.lightMode = top.lightMode = lightMode;
				window.lca = top.lca = lca;
				window.BXLang = top.BXLang = BXLang;
				window.BXSite = top.BXSite = BXSite;
				window.BX_PERSONAL_ROOT = top.BX_PERSONAL_ROOT = BX_PERSONAL_ROOT;
			</script>
			<?php 
            $arJS = array();
            $arCSS = array();
            $events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet");
            while ($arEvent = $events->Fetch()) {
                $tmp = ExecuteModuleEventEx($arEvent, array($name, $arParams));
                if (!is_array($tmp)) {
                    continue;
                }
                if (is_array($tmp['JS'])) {
                    $arJS = array_merge($arJS, $tmp['JS']);
                }
                if (is_array($tmp['CSS'])) {
                    $arCSS = array_merge($arCSS, $tmp['CSS']);
                }
            }
            $arr = array();
            // Additional JS files from event OnBeforeHtmlEditorScriptGet
            for ($i = 0, $c = count($arJS); $i < $c; $i++) {
                $arJS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arJS[$i]);
                if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arJS[$i])) {
                    $arr[] = $arJS[$i];
                }
            }
            ?>
			<script type="text/javascript" src="/bitrix/admin/fileman_js.php?lang=<?php 
            echo LANGUAGE_ID;
            ?>
&v=<?php 
            echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/fileman/lang/' . LANGUAGE_ID . '/admin/fileman_js.php');
            ?>
"></script>
			<script type="text/javascript" src="/bitrix/admin/fileman_common_js.php?s=<?php 
            echo $str_taskbars;
            ?>
"></script>
			<?php 
            for ($i = 0, $l = count($arr); $i < $l; $i++) {
                $script_filename = $arr[$i];
                ?>
<script type="text/javascript" src="/bitrix/admin/htmleditor2/<?php 
                echo $script_filename;
                ?>
?v=<?php 
                echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $script_filename);
                ?>
"></script><?php 
            }
            ?>
			<script type="text/javascript" src="/bitrix/js/main/popup_menu.js?v=<?php 
            echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/main/popup_menu.js');
            ?>
"></script>
			<?php 
            for ($i = 0, $l = count($arCSS); $i < $l; $i++) {
                $arCSS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arCSS[$i]);
                if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i])) {
                    continue;
                }
                ?>
<link rel="stylesheet" type="text/css" href="/bitrix/admin/htmleditor2/<?php 
                echo $arCSS[$i];
                ?>
?v=<?php 
                echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i]);
                ?>
"/><?php 
            }
            $db_events = GetModuleEvents("fileman", "OnIncludeHTMLEditorScript");
            while ($arEvent = $db_events->Fetch()) {
                ExecuteModuleEventEx($arEvent);
            }
            $bFirstUsed = true;
        }
        ?>
		<div class="bxedmain-cont" id="<?php 
        echo $name . '_object';
        ?>
"><table id="<?php 
        echo $name;
        ?>
_pFrame" class="bxedmainframe dim100x100" style="display:none;">
				<tr style="height: 1%;"><td id="<?php 
        echo $name;
        ?>
_toolBarSet0" colspan="2" style="width: 100%; display: none; border-bottom: 1px solid #808080 !important;"></td></tr>
				<tr>
					<td id="<?php 
        echo $name;
        ?>
_toolBarSet1" style="width:0%; display: none; border-right: 1px solid #808080 !important;"></td>
					<td vAlign="top" style="width: 4000px; padding: 0!important;">
						<table class="dim100x100">
							<tr>
								<td class="bx-ceditor" id="<?php 
        echo $name;
        ?>
_cEditor"></td>
								<td id="<?php 
        echo $name;
        ?>
_taskBarSet2" class="bxedtaskbarset" style="width:0%; display: none;">
									<table>
										<tr><td class="bx-move-col-v" rowSpan="3"><img src="/bitrix/images/1.gif" /></td><td style="height:26px;"></td></tr>
										<tr><td style="vertical-align: top;"></td></tr>
										<tr><td class="bx-taskbar-tabs"></td></tr>
									</table>
								</td>
							</tr>
							<tr style="height:0%; display: none;">
								<td id="<?php 
        echo $name;
        ?>
_taskBarSet3" colspan="2">
									<table>
										<tr><td class="bx-move-col-h"><img src="/bitrix/images/1.gif" /></td></tr>
										<tr><td style="height:26px;"></td></tr>
										<tr><td style="vertical-align: top; background: #F4F4F4 none !important;"></td></tr>
										<tr><td class="bx-taskbar-tabs"></td></tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr id="bx-css-tt"><td id="<?php 
        echo $name;
        ?>
_taskBarTabs" colspan="2" class="tasktabcell"></td></tr>
			</table>
		</div>
		<script>
			BX.loadCSS('/bitrix/admin/htmleditor2/editor.css');
			var bEd = BX("bxed_<?php 
        echo $name;
        ?>
_editor");
			if (bEd && !bEd.checked)
				BX("<?php 
        echo $name;
        ?>
_object").style.display = "none";
		</script>
		<?php 
        if (!$arParams["bFromTextarea"]) {
            echo '<input type="hidden" name="' . $name . '" id="bxed_' . $name . '" value="' . htmlspecialcharsbx($content) . '">';
        }
        if ($arParams["bDisplay"] !== false) {
            setEditorEventHandlers($name);
            ?>
			<script>
				BX.ready(function(){
					BX.showWait();
					BX("bxed_<?php 
            echo $name;
            ?>
").pMainObj  = new BXHTMLEditor("<?php 
            echo $name;
            ?>
");
				});
			</script>
		<?php 
        }
    }
Пример #20
0
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
			));
Пример #21
0
				"DETAIL_TEXT",
				$str_DETAIL_TEXT,
				"DETAIL_TEXT_TYPE",
				$str_DETAIL_TEXT_TYPE,
				array(
					'height' => 450,
					'width' => '100%'
				),
				"N",
				0,
				"",
				"",
				$arIBlock["LID"],
				true,
				false,
				array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_".(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin')), 'saveEditorKey' => $IBLOCK_ID)
			);
		?></td>
	</tr>
	<?else:?>
	<tr id="tr_DETAIL_TEXT_TYPE">
		<td><?echo GetMessage("IBLOCK_DESC_TYPE")?></td>
		<td><input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_text" value="text"<?if($str_DETAIL_TEXT_TYPE!="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_text"><?echo GetMessage("IBLOCK_DESC_TYPE_TEXT")?></label> / <input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_html" value="html"<?if($str_DETAIL_TEXT_TYPE=="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_html"><?echo GetMessage("IBLOCK_DESC_TYPE_HTML")?></label></td>
	</tr>
	<tr id="tr_DETAIL_TEXT">
		<td colspan="2" align="center">
			<textarea cols="60" rows="20" name="DETAIL_TEXT" style="width:100%"><?echo $str_DETAIL_TEXT?></textarea>
		</td>
	</tr>
	<?endif?>
<?
Пример #22
0
         $arActions[] = array("ICON" => "btn_fileman_prop", "TEXT" => GetMessage("FILEMAN_ADMIN_FOLDER_PROP"), "ACTION" => $lAdmin->ActionRedirect("fileman_folder.php?" . $addUrl . "&site=" . urlencode($site) . "&path=" . $fpathUrl . ""));
     }
 }
 $type = $Elem["TYPE"] == "F" ? 'file' : 'folder';
 if ($logical != "Y") {
     if ($Elem["TYPE"] == "F" && $USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) {
         $arActions[] = array("SEPARATOR" => true);
         $arActions[] = array("ICON" => "pack", "TEXT" => GetMessage("FILEMAN_ADMIN_ARC_PACK"), "ACTION" => "window.PackUnpackRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], true); return false;");
         $is_archive = CBXArchive::IsArchive($fpath);
         if ($is_archive) {
             $arActions[] = array("ICON" => "unpack", "TEXT" => GetMessage("FILEMAN_ADMIN_ARC_UNPACK"), "ACTION" => "window.PackUnpackRun(['" . CUtil::JSEscape($fpath) . "'], false); return false;");
         }
     }
     if ($USER->CanDoFileOperation('fm_rename_' . $type, $arPath)) {
         $arActions[] = array("SEPARATOR" => true);
         $arActions[] = array("ICON" => "rename", "TEXT" => GetMessage("FILEMAN_RENAME_SAVE"), "ACTION" => 'setCheckbox(\'' . addslashes($f_NAME) . '\'); if(' . $lAdmin->table_id . '.IsActionEnabled(\'edit\')){document.forms[\'form_' . $lAdmin->table_id . '\'].elements[\'action_button\'].value=\'edit\'; ' . $lAdmin->ActionPost() . '}else{document.location.href=\'fileman_rename.php?' . $addUrl . '&path=' . urlencode($path) . '&site=' . $site . '&files[]=' . CFileman::GetFileName($arPath[1]) . '\'}');
     }
     // Copy
     if ($USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) && $Elem["TYPE"] == "F" || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) {
         $arActions[] = array("ICON" => "copy", "TEXT" => GetMessage("FILEMAN_ADM_COPY"), "ACTION" => "window.CopyMoveRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], true); return false;");
     }
     // Move
     if ($USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_delete_' . $type, $arPath)) {
         if ($USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) && $Elem["TYPE"] == "F" || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) {
             $arActions[] = array("ICON" => "move", "TEXT" => GetMessage("FILEMAN_ADM_MOVE"), "ACTION" => "window.CopyMoveRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], false); return false;");
         }
         $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("FILEMAN_ADMIN_DELETE"), "ACTION" => "if(confirm('" . GetMessage('FILEMAN_ALERT_DELETE') . "')) " . $lAdmin->ActionDoGroup(urlencode($f_NAME), "delete", $addUrl . "&site=" . urlencode($site) . "&path=" . urlencode($path) . "&show_perms_for=" . IntVal($show_perms_for)));
     }
     if ($USER->CanDoFileOperation('fm_edit_permission', $arPath)) {
         $arActions[] = array("SEPARATOR" => true);
         $arActions[] = array("ICON" => "access", "TEXT" => GetMessage("FILEMAN_ADMIN_ACCESS_PERMS_B"), "ACTION" => "setCheckbox('" . Cutil::JSEscape($f_NAME) . "'); setAccess('" . Cutil::JSEscape($site) . "', '" . Cutil::JSEscape(urlencode($path)) . "');");
Пример #23
0
";
		FE_MESS.FILEMAN_HTMLED_MANAGE_TB = "<?php 
    echo GetMessage("FILEMAN_HTMLED_MANAGE_TB");
    ?>
";
		window.bEditProps = <?php 
    echo $bEditProps ? 'true' : 'false';
    ?>
;

		var _bEdit = <?php 
    echo $bEdit ? 'true' : 'false';
    ?>
		</script>
		<?php 
    CFileman::ShowHTMLEditControl("filesrc", $filesrc, array("site" => $site, "templateID" => $templateID, "bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bWithoutPHP" => !$USER->CanDoOperation('edit_php'), "toolbarConfig" => CFileman::GetEditorToolbarConfig("filesrc"), "arToolbars" => array("manage", "standart", "style", "formating", "source", "template"), "arTaskbars" => array("BXComponentsTaskbar", "BXComponents2Taskbar", "BXPropertiesTaskbar", "BXSnippetsTaskbar"), "sBackUrl" => $url, "fullscreen" => $bFullScreen == 'Y', "path" => $path, 'width' => '100%', 'height' => '650px', "limit_php_access" => $limit_php_access));
    ?>
	</td></tr>
	<?php 
    if ($bEditProps) {
        ?>
	<?php 
        $tabControl->BeginNextTab();
        ?>
	<tr>
		<td>
			<input type="hidden" name="prop_edit" value="Y">
			<!-- FILE PROPS -->
			<script>
				function _MoreRProps(code, value)
				{
Пример #24
0
	public static function Delete($Params)
	{
		global $APPLICATION;

		$snPath = BX_PERSONAL_ROOT."/templates/".CFileMan::SecurePathVar($Params['template'])."/snippets";
		$contPath = $_SERVER["DOCUMENT_ROOT"].$snPath;
		$path = CFileMan::SecurePathVar($Params["path"]);
		$key = $Params["path"].($Params["path"] == '' ? '' : '/').CFileMan::SecurePathVar($Params["name"]);

		//Delete snippet file
		CFileman::DeleteFile(Array($Params["site"], $snPath.'/'.$key));

		//Delete thumbnail
		if ($Params["thumb"] != '')
			CFileman::DeleteFile(Array($Params["site"], $snPath.'/images/'.$path.($path == '' ?  '' : '/').CFileMan::SecurePathVar($Params["thumb"])));

		if (file_exists($contPath."/.content.php"))
		{
			@include($contPath."/.content.php");
			$contentSrc = '<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>'.chr(10);
			$contentSrc .= '<?'.chr(10).'$SNIPPETS = Array();'.chr(10);
			foreach ($SNIPPETS as $k=>$_arSn)
			{
				if ($k != $key && CSnippets::CheckFile(array('site' => $Params["site"], 'template' => $Params['template'], 'path' => $k)))
					$contentSrc .= '$SNIPPETS[\''.CUtil::JSEscape($k).'\'] = Array("title"=>\''.CUtil::JSEscape($_arSn['title']).'\', "description"=>\''.CUtil::JSEscape($_arSn['description']).'\');'.chr(10);
			}
			$contentSrc .= '?>';
			$APPLICATION->SaveFileContent($contPath."/.content.php", $contentSrc);
		}

		CSnippets::ClearCache();
?>
<script>
window.operation_success = true;
</script>
<?
	}
Пример #25
0
		}

		$arTemplates = CFileman::GetFileTemplates(LANGUAGE_ID, array($site_template));
		if(strlen($template)>0)
		{
			for ($i=0; $i<count($arTemplates); $i++)
			{
				if($arTemplates[$i]["file"] == $template)
				{
					$filesrc_tmp = CFileman::GetTemplateContent($arTemplates[$i]["file"], LANGUAGE_ID, array($site_template));
					break;
				}
			}
		}
		else
			$filesrc_tmp = CFileman::GetTemplateContent($arTemplates[0]["file"], LANGUAGE_ID, array($site_template));
	}

	if($REQUEST_METHOD=="POST" && strlen($save)>0)
	{
		if(!check_freetrix_sessid())
		{
			$strWarning = GetMessage("FILEMAN_SESSION_EXPIRED");
			$bVarsFromForm = true;
		}

		// lpa was denied earlier, so use file src as is
		$filesrc_for_save = $_POST['filesrc'];

		if(strlen($strWarning) <= 0)
		{
Пример #26
0
	<tr id="tr_SUB_DETAIL_TEXT_DIFF">
		<td colspan="2">
			<div style="width:95%;background-color:white;border:1px solid black;padding:5px">
				<?php 
        echo getDiff($prev_arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT"]);
        ?>
			</div>
		</td>
	</tr>
	<?php 
    } elseif (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && $bFileman) {
        ?>
	<tr id="tr_SUB_DETAIL_TEXT_EDITOR">
		<td colspan="2" align="center">
			<?php 
        CFileMan::AddHTMLEditorFrame("SUB_DETAIL_TEXT", $str_DETAIL_TEXT, "SUB_DETAIL_TEXT_TYPE", $str_DETAIL_TEXT_TYPE, array('height' => 450, 'width' => '100%'), "N", 0, "", "", $arIBlock["LID"], true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_" . (defined('BX_SUB_SETTINGS') && BX_SUB_SETTINGS == true ? 'admin' : 'public')), 'saveEditorKey' => $IBLOCK_ID, 'hideTypeSelector' => $arIBlock["FIELDS"]["DETAIL_TEXT_TYPE_ALLOW_CHANGE"]["DEFAULT_VALUE"] === "N"));
        ?>
</td>
	</tr>
	<?php 
    } else {
        ?>
	<tr id="tr_SUB_DETAIL_TEXT_TYPE">
		<td><?php 
        echo GetMessage("IBLOCK_DESC_TYPE");
        ?>
</td>
		<td><input type="radio" name="SUB_DETAIL_TEXT_TYPE" id="SUB_DETAIL_TEXT_TYPE_text" value="text"<?php 
        if ($str_DETAIL_TEXT_TYPE != "html") {
            echo " checked";
        }
Пример #27
0
	public static function GetSiteTemplateParams($templateId, $siteId)
	{
		return CFileman::GetAllTemplateParams($templateId, $siteId);
	}
Пример #28
0
					editor.Destroy();
				}
			})();
		</script>
		<?
		/* ************* END |HTML EDITOR 3.0| END ************* */
	}
	else
	{
		/* ************* OLD HTML EDITOR ************* */
		CFileman::ShowHTMLEditControl($editor_name, $filesrc, Array(
			"site" => $site,
			"templateID" => $_REQUEST['templateID'],
			"bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N")!="Y",
			"bWithoutPHP" => (!$USER->CanDoOperation('edit_php')),
			"toolbarConfig" => CFileman::GetEditorToolbarConfig($editor_name),
			"arTaskbars" => Array("BXComponentsTaskbar", "BXComponents2Taskbar", "BXPropertiesTaskbar", "BXSnippetsTaskbar"),
			"sBackUrl" => $back_url,
			"path" => $path,
			"limit_php_access" => $limit_php_access,
			'height' => '490',
			'width' => '100%',
			'light_mode' => true,
		));

	?>
	<script>
		var _bEdit = true;
		arEditorFastDialogs['asksave'] = function(pObj)
		{
			return {
Пример #29
0
	</tr>
<?php 
    $tabControl->EndCustomField("ANSWERS");
    ?>

<?php 
    $tabControl->BeginNextFormTab();
    $tabControl->BeginCustomField("DESCRIPTION", GetMessage("LEARNING_DESCRIPTION"), false);
    ?>
	<?php 
    if (COption::GetOptionString("learning", "use_htmledit", "Y") == "Y" && CModule::IncludeModule("fileman")) {
        ?>
	<tr>
		<td colspan="2" align="center">
			<?php 
        CFileMan::AddHTMLEditorFrame("DESCRIPTION", $str_DESCRIPTION, "DESCRIPTION_TYPE", $str_DESCRIPTION_TYPE, array('width' => '100%', 'height' => '500'), "N", 0, "", "", false, true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("learning_" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin'))));
        ?>
		</td>
	</tr>
	<?php 
    } else {
        ?>
	<tr>
		<td align="center"><?php 
        echo GetMessage("LEARNING_DESC_TYPE");
        ?>
:</td>
		<td>
			<input type="radio" name="DESCRIPTION_TYPE" value="text"<?php 
        if ($str_DESCRIPTION_TYPE != "html") {
            echo " checked";
    echo htmlspecialcharsbx($back_url);
    ?>
">

<?php 
    $aTabs = array(array("DIV" => "edit1", "TAB" => $bEdit ? GetMessage('FILEMAN_EDIT_TAB') : GetMessage('FILEMAN_EDIT_TAB1'), "ICON" => "fileman", "TITLE" => $bEdit ? GetMessage('FILEMAN_EDIT_TAB_ALT') : GetMessage('FILEMAN_EDIT_TAB_ALT1')));
    $tabControl = new CAdminTabControl("tabControl", $aTabs);
    $tabControl->Begin();
    $tabControl->BeginNextTab();
    ?>

	<?php 
    if (!$bEdit) {
        ?>
		<?php 
        $arTemplates = CFileman::GetFileTemplates(LANGUAGE_ID, array($site_template));
        ?>
		<tr>
			<td width="30%"><?php 
        echo GetMessage("FILEMAN_FILEEDIT_TEMPLATE");
        ?>
</td>
			<td width="70%">
				<select name="template" onchange="window.location='/bitrix/admin/fileman_file_edit.php?lang=<?php 
        echo LANG;
        ?>
&site=<?php 
        echo Urlencode($site);
        ?>
&path=<?php 
        echo UrlEncode($path);