Exemple #1
0
    $arResult["NAME"] = GetFileName($arF["URL"]);
    $arResult["ICON"] = CWebDavExtLinks::GetExtensionIcon($arF["URL"]);
    $arResult["F_SIZE"] = $arF["F_SIZE"];
    $arResult["DESCRIPTION"] = $arF["DESCRIPTION"];
    $arResult["PASSWORD"] = CheckUserPassword($arF);
    $arResult["DOWNLOAD_COUNT"] = $arF['DOWNLOAD_COUNT'];
}
if (!$arF || !empty($_GET['notfoud'])) {
    $arResult["NAME"] = GetMessage("WD_MODULE_IS_FILE_NOT_FOUND");
    $arResult["ICON"] = "nf.png";
    $arResult["F_SIZE"] = 0;
    $arResult["DESCRIPTION"] = GetMessage("WD_MODULE_IS_FILE_NOT_FOUND_DESCRIPTION");
    $arResult["FILE_NOT_FOUND"] = true;
}
if (!empty($_POST['checkViewByGoogle'])) {
    CWebDavTools::sendJsonResponse(array('viewByGoogle' => $arResult["DOWNLOAD_COUNT"] > 0));
}
if (!empty($arF) && !empty($arF['LINK_TYPE']) && $arF['LINK_TYPE'] == CWebDavExtLinks::LINK_TYPE_AUTO) {
    CWebDavExtLinks::LoadFile($arGetListRes);
}
if (!empty($arF) && !empty($arF['SINGLE_SESSION'])) {
    CWebDavExtLinks::DeleteSingleSessionLink($hash);
    CWebDavExtLinks::LoadFile($arGetListRes);
}
$arResult["COMPANY_NAME"] = COption::GetOptionString("main", "site_name", "");
if (array_key_exists("LoadFile", $_REQUEST) && intval($_REQUEST["LoadFile"]) > 0 && $arResult["PASSWORD"] == "NOT" && $arGetListRes['LINK_TYPE'] != CWebDavExtLinks::LINK_TYPE_AUTO) {
    CWebDavExtLinks::LoadFile($arGetListRes);
}
$arResult['ALLOW_VIEWER'] = false;
if ($arResult["PASSWORD"] == "NOT" && empty($arF['PASSWORD']) && CWebDavExtLinks::DEMO_HASH != $hash) {
    $allowExtDocServicesGlobal = CWebDavTools::allowUseExtServiceGlobal();
Exemple #2
0
 public function sendJsonResponse($response, $httpStatusCode = null)
 {
     CWebDavTools::sendJsonResponse($response, $httpStatusCode);
 }
Exemple #3
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!CModule::IncludeModule('webdav')) {
    return;
}
global $USER, $APPLICATION;
if (!$USER->IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') {
    return;
}
CUtil::JSPostUnescape();
if ($_POST['installDisk']) {
    CWebDavTools::setDesktopDiskInstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['uninstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskUninstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['reInstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $USER->getId());
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
Exemple #4
0
 public function sendJsonResponse($response)
 {
     CWebDavTools::sendJsonResponse($response);
 }
                        $copyTmpFile = CFile::MakeFileArray($wdElement['element_array']['PROPERTY_FILE_VALUE']);
                        $tmpFile->path = $copyTmpFile['tmp_name'];
                    }
                    $response = array();
                    try {
                        $fileData = $storage->addFile($filename, $savedFolderId, $tmpFile);
                        $savedName = CWebDavIblock::getSavedMetaData();
                        $pathToUserLib = str_replace(array('#USER_ID#', '#user_id#'), array($USER->GetID(), $USER->GetID()), CWebDavIblock::LibOptions('lib_paths', true, $data['IBLOCK_ID']));
                        $pathToUserLib = strstr($pathToUserLib, 'files/element', true) . 'files/lib';
                        $pathToUserLib = $pathToUserLib . '/' . $savedName['alias'] . '?result=doc' . $fileData['extra']['id'];
                        $response = array('status' => 'success', 'newId' => $fileData['extra']['id'], 'viewUrl' => $pathToUserLib);
                    } catch (Exception $e) {
                        $response['status'] = 'error';
                        $fileData = array();
                    }
                    CWebDavTools::sendJsonResponse($response);
                }
            }
        }
    }
} elseif (!empty($_REQUEST['downloadHistory']) && !empty($_REQUEST['id'])) {
    $APPLICATION->RestartBuffer();
    $APPLICATION->IncludeComponent('bitrix:webdav.element.history', '', array('webdav' => $ob, 'ajax' => false, 'elementId' => (int) $_REQUEST['id'], 'versionId' => (int) $_REQUEST['v'], 'fileId' => (int) $_REQUEST['f']));
    include $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php";
    die;
} elseif (!empty($_REQUEST['wdaction'])) {
    $wdAction = strtolower($_REQUEST['wdaction']);
    if ($wdAction == 'connect' || $wdAction == 'disconnect') {
        $attachObjectType = null;
        $attachObjectId = null;
        if (!empty($_REQUEST['group'])) {
Exemple #6
0
 public function sendJsonResponse($response, $httpStatusCode = null)
 {
     CWebDavTools::sendJsonResponse($response, $httpStatusCode, array($this, '__enableTimeZone'));
 }
Exemple #7
0
     if ($successDeleteAllElements || $deleteCounter == 0) {
         $rs = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $ob->IBLOCK_ID, 'SECTION_ID' => $arParams["SECTION_ID"]), false, array('ID'));
         $startTime = time();
         while ($s = $rs->fetch()) {
             $ob->DELETE(array("section_id" => $s['ID']));
             $deleteCounter++;
             if (time() - $startTime > $maxExecTime) {
                 CWebDavTools::sendJsonResponse(array('status' => 'success', 'deleteItems' => $deleteCounter, 'limitTime' => true, 'finish' => false));
             }
         }
         $successDeleteAllSections = true;
     }
     if ($successDeleteAllSections || $deleteCounter == 0) {
         CWebDavTools::sendJsonResponse(array('status' => 'success', 'finish' => true));
     } else {
         CWebDavTools::sendJsonResponse(array('status' => 'success', 'deleteItems' => $deleteCounter, 'finish' => false));
     }
 }
 $deleteOptions = array("section_id" => $arParams["SECTION_ID"]);
 if (!empty($_GET['delete_without_trash'])) {
     $deleteOptions["force"] = true;
 }
 $result = $ob->DELETE($deleteOptions);
 if (intVal($result) != 204) {
     $aMsg[] = array("id" => "not_delete", "text" => GetMessage("WD_ERROR_DELETE"));
 } else {
     WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list"));
     $arNavChain = $arResult["NAV_CHAIN"];
     array_pop($arNavChain);
     $url = CComponentEngine::MakePathFromTemplate($arParams["~SECTIONS_URL"], array("PATH" => implode("/", $arNavChain)));
     if ($_REQUEST["popupWindow"] == "Y") {