Example #1
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']];
				}
Example #2
0
 function DeleteEx($path)
 {
     global $APPLICATION, $USER;
     CMain::InitPathVars($site, $path);
     if (strlen($path) <= 0) {
         return false;
     }
     $src = $_SERVER["DOCUMENT_ROOT"] . $path;
     $src = str_replace("//", "/", $src);
     if ($src == $_SERVER["DOCUMENT_ROOT"]) {
         return false;
     }
     $DOC_ROOT = CSite::GetSiteDocRoot($site);
     @set_time_limit(600);
     $io = CBXVirtualIo::GetInstance();
     if (is_link($linkPath = CBXVirtualIoFileSystem::ConvertCharset($DOC_ROOT . $path))) {
         if (@unlink($linkPath)) {
             return;
         } else {
             return GetMessage("FILEMAN_FILEMAN_SYMLINK_DEL_ERROR") . " \"" . $path . "\".\n";
         }
     } elseif ($io->DirectoryExists($DOC_ROOT . $path)) {
         //check rights
         if (!$USER->CanDoFileOperation('fm_delete_folder', array($site, $path))) {
             return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY") . " \"" . $path . "\".\n";
         }
     } else {
         return CFileman::DeleteFile(array($site, $path));
     }
     $strWarning = "";
     //get folder content
     $d = $io->GetDirectory($DOC_ROOT . $path);
     $arChildren = $d->GetChildren();
     foreach ($arChildren as $child) {
         $fn = $child->GetName();
         if ($child->IsDirectory()) {
             $strWarning .= CFileman::DeleteEx(array($site, $path . "/" . $fn));
         } else {
             if ($fn == ".access.php") {
                 continue;
             }
             $strWarning .= CFileman::DeleteFile(array($site, $path . "/" . $fn));
         }
     }
     //delete first folder
     $strWarning .= CFileMan::DeleteDir(array($site, $path));
     return $strWarning;
 }
Example #3
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>
<?
	}