예제 #1
0
	return false;
}

if (!$arParams['INPUT_NAME_UNSAVED'])
{
	$arParams['INPUT_NAME_UNSAVED'] = $arParams['INPUT_NAME'].'_'.RandString(8);
}

$arResult['CONTROL_UID'] = FileInputUtility::instance()->registerControl($arParams['CONTROL_ID']);

$arResult['FILES'] = array();

if (is_array($arParams['INPUT_VALUE']) && strlen(implode(",", $arParams["INPUT_VALUE"])) > 0)
{
	$dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arParams["INPUT_VALUE"])));
	while ($arFile = $dbRes->GetNext())
	{
		$arFile['URL'] = CHTTP::URN2URI($APPLICATION->GetCurPageParam("mfi_mode=down&fileID=".$arFile['ID']."&cid=".$arResult['CONTROL_UID']."&".bitrix_sessid_get(), array("mfi_mode", "fileID", "cid")));
		$arFile['FILE_SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']);
		$arResult['FILES'][$arFile['ID']] = $arFile;

		FileInputUtility::instance()->registerFile($arResult['CONTROL_UID'], $arFile['ID']);
	}
}

CJSCore::Init(array('ajax'));

$this->IncludeComponentTemplate();

return $arParams['CONTROL_ID'];
예제 #2
0
 protected function fillRequireData($requestType)
 {
     $this->mode = $this->getPost("mode", $requestType);
     $this->CID = FileInputUtility::instance()->registerControl($this->getPost("CID", $requestType), $this->controlId);
     if (in_array($this->mode, array("upload", "delete", "view"))) {
         $directory = \CBXVirtualIo::GetInstance()->GetDirectory($this->path);
         $directoryExists = $directory->IsExists();
         if ($this->mode != "view" && !check_bitrix_sessid()) {
             $this->status = new Status("BXU345.1");
         } else {
             if (!$directory->Create()) {
                 $this->status = new Status("BXU345.2");
             } else {
                 if ($this->getPost("packageIndex", $requestType)) {
                     $this->PID = $this->getPost("packageIndex");
                     $this->packLog->setPath($this->path . $this->getPost("packageIndex") . ".package");
                     $this->packLog->setValue("filesCount", $this->getPost("filesCount"));
                 } else {
                     if ($this->mode == "upload") {
                         $this->status = new Status("BXU344.1");
                     }
                 }
             }
         }
         $this->log->setPath($this->path . $this->CID . ".log");
         if (!$directoryExists) {
             $access = \CBXVirtualIo::GetInstance()->GetFile($directory->GetPath() . "/.access.php");
             $content = '<?$PERM["' . $directory->GetName() . '"]["*"]="X";?>';
             if (!$access->IsExists() || strpos($access->GetContents(), $content) === false) {
                 if (($fd = $access->Open('ab')) && $fd) {
                     fwrite($fd, $content);
                 }
                 fclose($fd);
             }
         }
         return true;
     }
     return false;
 }
예제 #3
0
}
if (!defined("NO_KEEP_STATISTIC")) {
    define("NO_KEEP_STATISTIC", true);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$cid = trim($_REQUEST['cid']);
use Bitrix\Main\UI\FileInputUtility;
use Bitrix\Main\Security\Sign\Signer;
/**
 * Bitrix vars
 *
 * @global CMain $APPLICATION
 */
if ($cid && preg_match('/^[a-f01-9]{32}$/', $cid) && check_bitrix_sessid()) {
    $fid = intval($_GET["fileID"]);
    if ($fid > 0 && FileInputUtility::instance()->checkFile($cid, $fid)) {
        $arFile = \CFile::GetFileArray($fid);
        if ($arFile) {
            $APPLICATION->RestartBuffer();
            while (ob_end_clean()) {
            }
            // hack!
            $useContentType = false;
            if (!empty($_REQUEST["s"])) {
                $sign = new Signer();
                $useContentType = ($res = $sign->unsign($_REQUEST["s"], "main.file.input")) && $res == $cid;
            }
            if ($useContentType) {
                CFile::ViewByUser($arFile, array("content_type" => $arFile["CONTENT_TYPE"]));
            } else {
                CFile::ViewByUser($arFile, array("force_download" => true));
예제 #4
0
 $bUpdateEvent = false;
 if ($bFromEditForm) {
     $bUpdateEvent = true;
     $res = false;
     $arFields = array('TITLE' => trim($_REQUEST['TITLE']), 'DESCRIPTION' => trim($_REQUEST['DESCRIPTION']), 'DATE_START' => CMeeting::MakeDateTime($_REQUEST['DATE_START_DATE'], $_REQUEST['DATE_START_TIME']), 'DURATION' => $_REQUEST['DURATION'] * $_REQUEST['DURATION_COEF'], 'PLACE' => $_REQUEST['PLACE'], 'GROUP_ID' => $_REQUEST['GROUP_ID']);
     if (strlen($_REQUEST['PLACE_ID']) > 0) {
         $arFields['PLACE'] = $_REQUEST['PLACE_ID'];
     }
     $TextParser = new CBXSanitizer();
     $TextParser->SetLevel(CBXSanitizer::SECURE_LEVEL_LOW);
     $TextParser->ApplyHtmlSpecChars(false);
     $arFields['DESCRIPTION'] = $TextParser->SanitizeHtml($arFields['DESCRIPTION']);
     if (strlen($arFields['TITLE']) <= 0) {
         $arFields['TITLE'] = GetMessage('ME_MEETING_TITLE_DEFAULT');
     }
     $arFields['FILES'] = \Bitrix\Main\UI\FileInputUtility::instance()->checkFiles('MEETING_DESCRIPTION', $_REQUEST['FILES']);
     /*$count = sizeof($_FILES["FILES_TMP"]["name"]);
     		if ($count > 0)
     		{
     			for($i = 0; $i < $count; $i++)
     			{
     				$arFile = array(
     					"name" => $_FILES["FILES_TMP"]["name"][$i],
     					"size" => $_FILES["FILES_TMP"]["size"][$i],
     					"tmp_name" => $_FILES["FILES_TMP"]["tmp_name"][$i],
     					"type" => $_FILES["FILES_TMP"]["type"][$i],
     					"MODULE_ID" => 'meeting'
     				);
     
     				$fileID = CFile::SaveFile($arFile, $mid);
     				if ($fileID > 0)
예제 #5
0
파일: component.php 프로젝트: vim84/b-markt
 }
 if (StrLen($arResult["FatalError"]) <= 0) {
     if (!array_key_exists("TAB", $arResult) || $arResult["TAB"] == "edit") {
         __GCE_GetFeatures($arParams["GROUP_ID"], $arResult["POST"]["FEATURES"]);
     }
     $arResult["ShowForm"] = "Input";
     $arResult["ErrorFields"] = array();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
         if ($_POST["ajax_request"] == "Y") {
             CUtil::JSPostUnescape();
         }
         $errorMessage = "";
         $warningMessage = "";
         if (!array_key_exists("TAB", $arResult) || $arResult["TAB"] == "edit") {
             if (intval($_POST["GROUP_IMAGE_ID"]) > 0) {
                 if (intval($arResult["POST"]["IMAGE_ID"]) != intval($_POST["GROUP_IMAGE_ID"]) && in_array($_POST['GROUP_IMAGE_ID'], \Bitrix\Main\UI\FileInputUtility::instance()->checkFiles('GROUP_IMAGE_ID', array($_POST['GROUP_IMAGE_ID'])))) {
                     $arImageID = CFile::MakeFileArray($_POST["GROUP_IMAGE_ID"]);
                     $arImageID["old_file"] = $arResult["POST"]["IMAGE_ID"];
                     $arImageID["del"] = "N";
                     CFile::ResizeImage($arImageID, array("width" => 300, "height" => 300), BX_RESIZE_IMAGE_PROPORTIONAL);
                 }
             } else {
                 $arImageID = array("del" => "Y", "old_file" => $arResult["POST"]["IMAGE_ID"]);
             }
             $arResult["POST"]["NAME"] = htmlspecialcharsbx($_POST["GROUP_NAME"]);
             $arResult["POST"]["DESCRIPTION"] = $_POST["GROUP_DESCRIPTION"];
             $arResult["POST"]["IMAGE_ID_DEL"] = $_POST["GROUP_IMAGE_ID_DEL"] == "Y" ? "Y" : "N";
             $arResult["POST"]["SUBJECT_ID"] = $_POST["GROUP_SUBJECT_ID"];
             $arResult["POST"]["VISIBLE"] = $_POST["GROUP_VISIBLE"] == "Y" ? "Y" : "N";
             $arResult["POST"]["OPENED"] = $_POST["GROUP_OPENED"] == "Y" ? "Y" : "N";
             $arResult["POST"]["IS_EXTRANET_GROUP"] = $_POST["IS_EXTRANET_GROUP"] == "Y" ? "Y" : "N";
예제 #6
0
}
if (!$bHasAccess) {
    return ShowError(GetMessage("ME_MEETING_ACCESS_DENIED"));
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_REQUEST['save_item'] && check_bitrix_sessid()) {
    $arFiles = $_REQUEST['FILES'];
    $arFields = array();
    if ($arResult['CAN_EDIT']) {
        if (isset($_REQUEST['ITEM_TITLE'])) {
            $arResult['ITEM']['TITLE'] = $arFields['TITLE'] = trim($_REQUEST['ITEM_TITLE']);
        }
        if (isset($_REQUEST['ITEM_DESCRIPTION'])) {
            $arResult['ITEM']['DESCRIPTION'] = $arFields['DESCRIPTION'] = trim($_REQUEST['ITEM_DESCRIPTION']);
        }
    }
    $arFields['FILES'] = is_array($_REQUEST['ITEM_FILES']) ? \Bitrix\Main\UI\FileInputUtility::instance()->checkFiles('MEETING_ITEM_FILES_' . $arParams['ITEM_ID'], $_REQUEST['ITEM_FILES']) : array();
    $arFields['TASKS'] = is_array($_REQUEST['ITEM_TASKS']) ? $_REQUEST['ITEM_TASKS'] : array();
    CMeetingItem::Update($arParams['ITEM_ID'], $arFields);
    $arParams['UPDATE'] = true;
}
$arResult['ITEM']['FILES'] = array();
$dbRes = CMeetingItem::GetFiles($arResult['ITEM']['ID']);
while ($arFile = $dbRes->Fetch()) {
    $arResult['ITEM']['FILES'][$arFile['FILE_ID']] = $arFile;
}
$arResult['ITEM']['TASKS'] = CMeetingItem::GetTasks($arResult['ITEM']['ID']);
$arResult['USERS'] = array();
if (count($arUserIDs) > 0) {
    $dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', array_unique($arUserIDs))));
    while ($arUser = $dbRes->Fetch()) {
        $arResult['USERS'][$arUser['ID']] = $arUser;
예제 #7
0
	private function fillRequireData($requestType)
	{
		$this->mode = $this->getPost("mode", $requestType);
		$this->CID = FileInputUtility::instance()->registerControl($this->getPost("CID", $requestType), $this->controlId);

		if (in_array($this->mode, array("upload", "delete", "view")))
		{
			if ($this->mode != "view" && !check_bitrix_sessid())
				$this->error = "BXU345";
			else if (!CheckDirPath($this->path))
				$this->error .= "BXU346";
			else if ($this->getPost("packageIndex", $requestType))
			{
				$this->package = array(
					"handler" => CBXVirtualIo::GetInstance()->GetFile($this->path.$this->getPost("packageIndex").".package"),
					"id" => $this->getPost("packageIndex"),
					"data" => array("filesCount" => intval($this->getPost("filesCount")), "files" => array())
				);
				if ($this->package["handler"]->IsExists())
					$this->package["data"] = unserialize($this->package["handler"]->GetContents());
			}
			else if ($this->mode == "upload")
				$this->error = "BXU344.1";

			$this->uploading = array(
				"handler" => CBXVirtualIo::GetInstance()->GetFile($this->path.$this->CID.".log"),
				"data" => array());
			if ($this->uploading["handler"]->IsExists())
				$this->uploading["data"] = unserialize($this->uploading["handler"]->GetContents());

			return true;
		}
		return false;
	}
예제 #8
0
 //bitrix24 template
 if ($_POST['PERSONAL_PHOTO_ID'] && intval($_POST['PERSONAL_PHOTO_ID']) > 0 && intval($_POST['PERSONAL_PHOTO_ID']) != intval($arResult["User"]["PERSONAL_PHOTO"])) {
     if (in_array($_POST['PERSONAL_PHOTO_ID'], \Bitrix\Main\UI\FileInputUtility::instance()->checkFiles('PERSONAL_PHOTO_IMAGE_ID', array($_POST['PERSONAL_PHOTO_ID'])))) {
         $arPICTURE = CFile::MakeFileArray($_POST['PERSONAL_PHOTO_ID']);
     }
 } elseif (strlen($_FILES["PERSONAL_PHOTO"]["name"]) > 0) {
     $arPICTURE = $_FILES["PERSONAL_PHOTO"];
 }
 if (sizeof($arPICTURE) != 0 || isset($_POST["PERSONAL_PHOTO_del"])) {
     $arPICTURE["old_file"] = $arResult["User"]["PERSONAL_PHOTO"];
     $arPICTURE["del"] = $_POST["PERSONAL_PHOTO_del"];
 }
 //WORK_LOGO upload
 //bitrix24 template
 if ($_POST['WORK_LOGO_ID'] && intval($_POST['WORK_LOGO_ID']) > 0 && intval($_POST['WORK_LOGO_ID']) != intval($arResult["User"]["WORK_LOGO"])) {
     if (in_array($_POST['WORK_LOGO_ID'], \Bitrix\Main\UI\FileInputUtility::instance()->checkFiles('WORK_LOGO_IMAGE_ID', array($_POST['WORK_LOGO_ID'])))) {
         $arPICTURE_WORK = CFile::MakeFileArray($_POST['WORK_LOGO_ID']);
     }
 } elseif (strlen($_FILES["WORK_LOGO"]["name"]) > 0 || isset($_POST["WORK_LOGO_del"])) {
     $arPICTURE_WORK = $_FILES["WORK_LOGO"];
     $arPICTURE_WORK["old_file"] = $arResult["User"]["WORK_LOGO"];
     $arPICTURE_WORK["del"] = $_POST["WORK_LOGO_del"];
 }
 if (sizeof($arPICTURE_WORK) != 0) {
     $arPICTURE_WORK["old_file"] = $arResult["User"]["WORK_LOGO"];
     $arPICTURE_WORK["del"] = $_POST["WORK_LOGO_del"];
 }
 $arFields = array('ACTIVE', 'GROUP_ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'PERSONAL_BIRTHDAY', 'PERSONAL_BIRTHDATE', 'PERSONAL_PROFESSION', 'PERSONAL_NOTES', 'EMAIL', 'PERSONAL_PHONE', 'PERSONAL_MOBILE', 'PERSONAL_WWW', 'PERSONAL_ICQ', 'PERSONAL_FAX', 'PERSONAL_PAGER', 'PERSONAL_COUNTRY', 'PERSONAL_STREET', 'PERSONAL_MAILBOX', 'PERSONAL_CITY', 'PERSONAL_STATE', 'PERSONAL_ZIP', 'WORK_COUNTRY', 'WORK_CITY', 'WORK_STATE', 'WORK_COMPANY', 'WORK_DEPARTMENT', 'WORK_PROFILE', 'WORK_WWW', 'WORK_PHONE', 'WORK_FAX', 'WORK_PAGER', 'WORK_LOGO', 'WORK_POSITION', 'LOGIN', 'PASSWORD', 'CONFIRM_PASSWORD');
 $arFieldsValue = array();
 foreach ($arFields as $key) {
     if ('PERSONAL_PHOTO' == $key) {
예제 #9
0
 public function viewFile($hash)
 {
     $file = false;
     $copy = "";
     if (strpos($hash, "_") > 0) {
         $copy = explode("_", $hash);
         $hash = $copy[0];
         $copy = $copy[1];
     }
     $copy = !!$copy ? $copy : "default";
     if (FileInputUtility::instance()->checkFile($this->CID, $hash)) {
         $file = $this->getFromCache($hash);
         $file = $file["files"][$copy];
     }
     if ($file) {
         CFile::ViewByUser($file, array("content_type" => $file["type"]));
     }
 }