本文整理汇总了PHP中CUtil::JSPostUnescape方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::JSPostUnescape方法的具体用法?PHP CUtil::JSPostUnescape怎么用?PHP CUtil::JSPostUnescape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::JSPostUnescape方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
public function exec()
{
try {
\CUtil::JSPostUnescape();
$this->checkRequest();
$this->processAction();
} catch (\Exception $e) {
$this->runProcessingException($e);
}
}
示例2: define
<?php
define("NO_KEEP_STATISTIC", true);
define("NO_AGENT_STATISTIC", true);
//define("NOT_CHECK_PERMISSIONS", true);
use Bitrix\Main;
use Bitrix\Main\Loader;
require_once $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/include/prolog_admin_before.php';
require_once dirname(__FILE__) . '/class.php';
Loader::includeModule('sale');
$result = true;
$errors = array();
$data = array();
try {
CUtil::JSPostUnescape();
if ($_REQUEST['REQUEST_TYPE'] == 'get-path') {
$data = CBitrixLocationSelectorSystemComponent::processGetPathRequest($_REQUEST);
} else {
// else type == 'search'
$data = CBitrixLocationSelectorSystemComponent::processSearchRequestV2($_REQUEST);
}
} catch (Main\SystemException $e) {
$result = false;
$errors[] = $e->getMessage();
}
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
print CUtil::PhpToJSObject(array('result' => $result, 'errors' => $errors, 'data' => $data), false, false, true);
示例3: Request
public static function Request($action, $site)
{
global $USER;
if (!$USER->CanDoOperation('fileman_view_file_structure')) {
return;
}
$io = CBXVirtualIo::GetInstance();
CUtil::JSPostUnescape();
switch ($action) {
case "count":
case "search":
case "replace":
$oSearch = new CFilemanSearch();
$oSearch->Init(array('lastPath' => isset($_POST['last_path']) ? $_POST['last_path'] : false, 'bCount' => $action == "count", 'bReplace' => $action == "replace", "fileName" => trim($_POST['file']), "phrase" => trim($_POST['phrase']), "replacePhrase" => trim($_POST['replace_phrase']), "dir" => CFilemanUtils::NormalizePath($_POST['dir']), "bSubdir" => $_POST['subdir'], "dateFrom" => $_POST['date_from'], "dateTo" => $_POST['date_to'], "sizeFrom" => intVal($_POST['size_from']), "sizeTo" => intVal($_POST['size_to']), "entire" => $_POST['entire'], "bCaseSens" => $_POST['case_sens'], "bDirsToo" => $_POST['dirs_too'], "ssess" => $_POST['ssess'], "bInResult" => $_POST['in_result'], "site" => CFileMan::__CheckSite($_GET['fu_site'])));
CFileMan::SaveLastPath(CFilemanUtils::NormalizePath($_POST['dir']));
break;
case "clean_old":
CFilemanSearch::CleanOldSearchResult();
break;
case "search_save_config":
CFilemanSearch::SaveConfig(array("advMode" => (bool) $_POST['adv_mode'], "bSubdir" => (bool) $_POST['subdir'], "entire" => (bool) $_POST['entire'], "bCaseSens" => (bool) $_POST['case_sens'], "bDirsToo" => (bool) $_POST['dirs_too']));
break;
case "copy_save_config":
CFilemanCopy::SaveConfig(array("advMode" => (bool) $_POST['adv_mode'], "caseOption" => $_POST['case_option']));
break;
case "copy":
case "move":
$oCopy = new CFilemanCopy();
$oCopy->Init(array("bCopy" => $action == "copy", "caseOption" => $_POST['case_option'], "arFiles" => $_POST['files'], "copyTo" => $_POST['copy_to'], "createCopyTo" => $_POST['create_copy_to'] == "Y", "userCaseAnswer" => isset($_POST['uc_answer']) ? $_POST['uc_answer'] : false, "userCaseToAll" => isset($_POST['uc_to_all']) ? $_POST['uc_to_all'] : false, "userCaseLastPath" => isset($_POST['uc_last_path']) ? $_POST['uc_last_path'] : false, "bSearch" => $_POST['search'] == "Y", "ssess" => $_POST['ssess'], "siteTo" => CFileMan::__CheckSite($_GET['fu_site'])));
CFileMan::SaveLastPath($_POST['copy_to']);
break;
case "get_last_pathes":
?>
<script>window.bx_last_pathes = <?php
echo CUtil::PhpToJSObject(CFilemanUtils::GetLastPathes());
?>
;</script>
<?php
break;
case "pack":
if (isset($_POST["startFile"])) {
$startFile = trim($_POST["startFile"]);
}
if (isset($_POST["quickPath"])) {
$quickPath = trim($_POST["quickPath"]);
}
if (isset($_POST["packTo"])) {
if (substr($_POST["packTo"], 0, 1) == "/") {
$pack_to = $_POST["packTo"];
} else {
$pack_to = "/" . $_POST["packTo"];
}
}
$siteTo = CFileMan::__CheckSite($_POST['siteTo']);
$docRootTo = CSite::GetSiteDocRoot($siteTo) ? CSite::GetSiteDocRoot($siteTo) : '';
$siteFrom = CFileMan::__CheckSite($site);
$docRootFrom = CSite::GetSiteDocRoot($siteFrom);
if (!$USER->IsAdmin()) {
$pack_to = RemoveScriptExtension($pack_to);
}
//check writing permissions
if (!$USER->CanDoFileOperation('fm_create_new_file', array($siteTo, $pack_to))) {
?>
<script>
window.BXFM_archivePermsError = true;
</script>
<?php
return;
}
if (IsFileUnsafe($docRootTo . $pack_to) || CFileMan::CheckFileName(GetFileName($pack_to)) !== true) {
?>
<script>
window.BXFM_archiveFNameError = true;
</script>
<?php
return;
}
//ask if the file already exists
if (file_exists($io->GetPhysicalName($docRootTo . $pack_to))) {
if (empty($startFile)) {
if ($_POST["bPackReplace"] != "replace") {
?>
<script>
window.BXFM_archiveExists = {
fileOld:
{
name: "<?php
echo CUtil::JSEscape(basename($pack_to));
?>
",
path: "<?php
echo CUtil::JSEscape($pack_to);
?>
",
site: "<?php
echo CUtil::JSEscape($siteTo);
?>
",
size: "<?php
echo CFile::FormatSize(filesize($io->GetPhysicalName($docRootTo . $pack_to)));
//.........这里部分代码省略.........
示例4: SearchUsers
public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
{
CUtil::JSPostUnescape();
$arUsers = array();
$search = trim($search);
if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
return $arUsers;
}
$bIntranetEnable = IsModuleInstalled('intranet');
$bExtranetEnable = CModule::IncludeModule('extranet');
$bBitrix24Enable = IsModuleInstalled('bitrix24');
$bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
$current_user_id = intval($GLOBALS["USER"]->GetID());
if ($bExtranetEnable) {
CSocNetTools::InitGlobalExtranetArrays();
}
$arSearchValue = preg_split('/\\s+/', trim(ToUpper($search)));
array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
$arFilter = array(array('LOGIC' => 'OR', 'NAME' => $arSearchValue, 'LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
$arFilter["CONFIRM_CODE"] = false;
}
if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
$arFilter["!UF_DEPARTMENT"] = false;
} elseif ($bExtranetOnly) {
$arFilter["UF_DEPARTMENT"] = false;
}
if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
$arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
if ($bExtranetUser) {
$arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
} else {
$arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
}
}
$arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER", new \Bitrix\Main\Entity\ExpressionField('MAX_LAST_USE_DATE', 'MAX(%s)', array('\\Bitrix\\Main\\FinderDest:CODE_USER_CURRENT.LAST_USE_DATE')));
// $arFilter["\Bitrix\Main\FinderDest:CODE_USER_CURRENT.USER_ID"] = array(false, intval($GLOBALS["USER"]->GetID()));
$helper = \Bitrix\Main\Application::getConnection()->getSqlHelper();
$connection = \Bitrix\Main\Application::getConnection();
$castType = $connection instanceof \Bitrix\Main\DB\MysqlCommonConnection ? 'UNSIGNED' : 'INT';
$arFilter["@ID"] = new \Bitrix\Main\DB\SqlExpression('
(SELECT
CAST(' . $helper->quote("MAIN_USER_TMP20258") . '.' . $helper->quote("ID") . ' AS ' . $castType . ') AS ' . $helper->quote("ID") . '
FROM b_user ' . $helper->quote("MAIN_USER_TMP20258") . '
LEFT JOIN
b_finder_dest ' . $helper->quote("TALIAS_1_TMP20258") . '
ON
' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("CODE_USER_ID") . ' = ' . $helper->quote("MAIN_USER_TMP20258") . '.' . $helper->quote("ID") . '
AND ' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' = ' . intval($GLOBALS["USER"]->GetID()) . '
WHERE (
' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' IS NULL
or ' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' in (0, ' . intval($GLOBALS["USER"]->GetID()) . ')
)
)');
$rsUser = \Bitrix\Main\UserTable::getList(array('order' => array("\\Bitrix\\Main\\FinderDest:CODE_USER_CURRENT.LAST_USE_DATE" => 'DESC', 'LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 50, 'data_doubling' => false));
while ($arUser = $rsUser->fetch()) {
if (!$bSelf && $current_user_id == $arUser['ID']) {
continue;
}
if (intval($departmentId) > 0) {
$arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"]);
if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
continue;
}
}
$sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
$arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
$arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : ' '), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
$checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
$arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
}
return $arUsers;
}
示例5: SearchUsers
public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
{
CUtil::JSPostUnescape();
$arUsers = array();
$search = trim($search);
if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
return $arUsers;
}
$bIntranetEnable = IsModuleInstalled('intranet');
$bExtranetEnable = CModule::IncludeModule('extranet');
$bBitrix24Enable = IsModuleInstalled('bitrix24');
$bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
$current_user_id = intval($GLOBALS["USER"]->GetID());
if ($bExtranetEnable) {
CSocNetTools::InitGlobalExtranetArrays();
}
$arSearchValue = preg_split('/\\s+/', trim($search));
array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
$arFilter = array(array('LOGIC' => 'OR', '%=NAME' => $arSearchValue, '%=LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
$arFilter["CONFIRM_CODE"] = false;
}
if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
$arFilter["!UF_DEPARTMENT"] = false;
} elseif ($bExtranetOnly) {
$arFilter["UF_DEPARTMENT"] = false;
}
if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
$arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
if ($bExtranetUser) {
$arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
} else {
$arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
}
}
$arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER");
if ($bIntranetEnable) {
$arSelect[] = 'UF_DEPARTMENT';
}
if (intval($departmentId) > 0) {
$acc = new CAccess();
}
$rsUser = \Bitrix\Main\UserTable::getList(array('order' => array('LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 20, 'data_doubling' => false));
while ($arUser = $rsUser->fetch()) {
if (!$bSelf && $current_user_id == $arUser['ID']) {
continue;
}
if (is_object($acc)) {
$acc->UpdateCodes(array("USER_ID" => $arUser["ID"]));
$arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"], array("PROVIDER_ID" => "intranet"));
if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
continue;
}
}
$sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
$arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
$arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : ' '), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
$checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
$arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
}
return $arUsers;
}
示例6: SearchUsers
public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false)
{
CUtil::JSPostUnescape();
$bIntranetEnable = IsModuleInstalled('intranet');
$bExtranetEnable = IsModuleInstalled('extranet');
$bBitrix24Enable = IsModuleInstalled('bitrix24');
$arUsers = array();
$arTmpUsers = array();
$arExtranetTestUsers = array();
$search = trim($search);
if (
strlen($search) <= 0
|| !GetFilterQuery("TEST", $search)
)
return $arUsers;
$arFilter = array(
"ACTIVE" => "Y",
"NAME_SEARCH" => $search,
);
if (
$bEmployeesOnly
|| ($bBitrix24Enable && !$bExtranetEnable)
)
$arFilter["!UF_DEPARTMENT"] = false;
$arExtParams = Array(
"FIELDS" => Array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION", "IS_ONLINE"),
"NAV_PARAMS" => Array("nTopCount" => 20)
);
if ($bIntranetEnable)
$arExtParams['SELECT'] = array('UF_DEPARTMENT');
$dbUsers = CUser::GetList(($sort_by = Array('last_name'=>'asc', 'IS_ONLINE'=>'desc')), ($dummy=''), $arFilter, $arExtParams);
while ($arUser = $dbUsers->Fetch())
{
if (
!$bSelf
&& is_object($GLOBALS["USER"])
&& $GLOBALS["USER"]->GetID() == $arUser['ID']
)
continue;
$arTmpUsers[$arUser["ID"]] = $arUser;
if(
$bIntranetEnable
&& $bExtranetEnable
&& (!is_array($arUser["UF_DEPARTMENT"])
|| empty($arUser["UF_DEPARTMENT"]))
)
$arExtranetTestUsers[$arUser["ID"]] = $arUser["ID"];
}
if (
!empty($arExtranetTestUsers)
&& CModule::IncludeModule('extranet')
&& CExtranet::IsIntranetUser()
)
{
global $USER;
$arUserSocNetGroups = Array();
$rsGroups = CSocNetUserToGroup::GetList(
array("GROUP_NAME" => "ASC"),
array(
"USER_ID" => intval($USER->GetID()),
"<=ROLE" => SONET_ROLES_USER,
"GROUP_SITE_ID" => SITE_ID,
"GROUP_ACTIVE" => "Y",
"!GROUP_CLOSED" => "Y"
),
false,
array("nPageSize" => 500, "bDescPageNumbering" => false),
array("ID", "GROUP_ID")
);
while($arGroup = $rsGroups->Fetch())
$arUserSocNetGroups[] = $arGroup["GROUP_ID"];
if (count($arUserSocNetGroups) > 0)
{
$dbUsersInGroup = CSocNetUserToGroup::GetList(
array(),
array(
"GROUP_ID" => $arUserSocNetGroups,
"<=ROLE" => SONET_ROLES_USER,
"USER_ACTIVE" => "Y"
),
false,
false,
array("ID", "USER_ID", "GROUP_ID")
);
while ($ar = $dbUsersInGroup->GetNext(true, false))
$arSelect[$ar["USER_ID"]] = $ar["USER_ID"];
foreach ($arExtranetTestUsers as $userId)
{
if (!isset($arSelect[$userId]))
unset($arTmpUsers[$userId]);
//.........这里部分代码省略.........
示例7: executeComponent
public function executeComponent()
{
if (!$this->arParams['webdav'] instanceof CWebDavIblock) {
ShowError('Invalid webdav property.');
return;
}
CUtil::JSPostUnescape();
$this->checkPermission();
if ($this->getWebdav()->workflow != 'bizproc' && $this->getWebdav()->workflow != 'bizproc_limited') {
return;
}
if (!CModule::IncludeModule('bizproc')) {
return;
}
$entityType = $this->getEntityType();
list($entityId, $documentUrl, $documentId) = $this->getEntityIdDocumentData($entityType);
if ($this->isDownloadOriginal()) {
$filter = array("DOCUMENT_ID" => $documentId);
if ($this->arParams['MODIFIED_FROM']) {
$filter['>=MODIFIED'] = ConvertTimeStamp($this->arParams['MODIFIED_FROM'], 'FULL');
}
$originalHistory = array();
//if exist history document with date modified > than post create, then get first from this list.
if ($this->getCountHistoryElementByDocument($filter) > 0) {
$originalHistory = $this->getOriginalHistoryDocument(array('id' => $documentId, 'url' => $documentUrl, 'entity' => $entityType, 'entityId' => $entityId), $filter);
} else {
}
if (!$originalHistory) {
$this->getWebdav()->SendHistoryFile($this->getWebdav()->arParams['element_array']['ID'], 0);
} else {
$this->getWebdav()->SendHistoryFile($this->getWebdav()->arParams['element_array']['ID'], $originalHistory['ID']);
}
} elseif ($this->isDownloadFileVersion()) {
$document = array('ID' => 0);
if ($this->arParams['fileId'] != $this->getWebdav()->arParams['file_array']['ID']) {
$document = $this->getWebdav()->findHistoryDocumentByFileId($this->getWebdav()->arParams['element_array']['ID'], $this->arParams['fileId'], $documentId);
}
$this->getWebdav()->SendHistoryFile($this->getWebdav()->arParams['element_array']['ID'], $document['ID']);
} elseif ($this->isDownloadVersion()) {
$this->getWebdav()->SendHistoryFile($this->getWebdav()->arParams['element_array']['ID'], $this->arParams['versionId']);
} elseif ($this->isDownloadLastVersion()) {
$this->getWebdav()->SendHistoryFile($this->getWebdav()->arParams['element_array']['ID'], 0);
} elseif ($this->isAjax()) {
$this->checkPermission('edit');
$filter = array("DOCUMENT_ID" => $documentId);
if ($this->arParams['MODIFIED_FROM']) {
$filter['>=MODIFIED'] = ConvertTimeStamp($this->arParams['MODIFIED_FROM'], 'FULL');
}
$document = array('id' => $documentId, 'url' => $documentUrl, 'entity' => $entityType, 'entityId' => $entityId);
$history = $this->getHistoryByDocument($document, $filter);
$history = $this->runCorrectionDateHistoryByDocument($history, count($history) < static::COUNT_HISTORY_ELEMENT_ON_PAGE + 1, $this->getWebdav()->arParams['element_array']["DATE_CREATE"]);
$history = $this->cleanHistoryList($history);
$this->arResult['count_history_items'] = $this->getCountHistoryElementByDocument($filter);
$this->arResult['webdav'] = $this->getWebdav();
$this->arResult['creator'] = CUser::GetByID($this->getWebdav()->arParams['element_array']['CREATED_BY'])->fetch();
$this->arResult['creator_name'] = CUser::FormatName(CSite::GetNameFormat(false), $this->arResult['creator'], true, false);
$this->arResult['modifier'] = CUser::GetByID($this->getWebdav()->arParams['element_array']['MODIFIED_BY'])->fetch();
$this->arResult['modifier_name'] = CUser::FormatName(CSite::GetNameFormat(false), $this->arResult['creator'], true, false);
$this->arResult['date_modify'] = FormatDate('x', MakeTimeStamp($this->getWebdav()->arParams['element_array']["TIMESTAMP_X"]));
$this->arResult['date_create'] = FormatDate('x', MakeTimeStamp($this->getWebdav()->arParams['element_array']["DATE_CREATE"]));
$this->arResult['uri_download_original'] = $this->getUriDownloadOriginal();
if (count($history) != static::COUNT_HISTORY_ELEMENT_ON_PAGE + 1) {
$page = $history[0]['DETAIL_PAGE_URL'];
//append original in history list
array_unshift($history, array('URL_DOWNLOAD' => $this->getUriDownloadLasVersion(), 'HISTORY_PAGE_URL' => '', 'DETAIL_PAGE_URL' => $page, 'ID' => false, 'MODIFIED' => $this->getWebdav()->arParams['element_array']["TIMESTAMP_X"], 'DOCUMENT_ID' => 'DOCUMENT_ID', 'NAME' => 'NAME', 'USER_ID' => $this->arResult['modifier']['ID'], 'USER_NAME' => $this->arResult['modifier']['NAME'], 'USER_LAST_NAME' => $this->arResult['modifier']['LAST_NAME'], 'USER_SECOND_NAME' => $this->arResult['modifier']['SECOND_NAME'], 'USER_LOGIN' => $this->arResult['modifier']['LOGIN'], 'FILE_SIZE' => CFile::FormatSize(intval($this->getWebdav()->arParams["file_size"]))));
}
$this->arResult['history'] = $history;
$this->arResult['editService'] = CWebDavLogOnlineEdit::getOnlineService(array('IBLOCK_ID' => $this->getWebdav()->arParams['element_array']['IBLOCK_ID'], 'SECTION_ID' => $this->getWebdav()->arParams['element_array']['IBLOCK_SECTION_ID'], 'ELEMENT_ID' => $this->getWebdav()->arParams['element_array']['ID']));
$this->arResult['editUsers'] = $this->getOnlineUsers();
if (!empty($filter['>=MODIFIED'])) {
$filter['<=MODIFIED'] = $filter['>=MODIFIED'];
unset($filter['>=MODIFIED']);
}
$this->includeComponentTemplate('ajax');
return;
}
return;
}
示例8: executeComponent
public function executeComponent()
{
try {
CUtil::JSPostUnescape();
$this->checkSessid();
if (!CModule::IncludeModule('socialservices')) {
$this->sendJsonResponse(array('error' => GetMessage('WD_DOC_INSTALL_SOCSERV')));
}
if (empty($_GET['proccess'])) {
$this->includeComponentTemplate('startpage');
return;
}
$this->setFileId($_REQUEST['id']);
$this->setVersionId($_REQUEST['v']);
$this->setAction(empty($_REQUEST['action']) ? '' : $_REQUEST['action']);
if ($this->isPublicNewFile()) {
} elseif ($this->isSaveNewFile()) {
} else {
$wdElement = array();
if (!empty($_REQUEST['elementId'])) {
$wdElement = array('elementId' => (int) $_REQUEST['elementId']);
}
$this->checkPermission($wdElement);
$lockInfo = $this->checkLock();
if ($lockInfo) {
$this->sendJsonResponse(array('error' => GetMessage('WD_DOC_ATTEMPT_EDIT_LOCK_DOCUMENT')));
}
}
$this->checkActiveSocServ();
$oAuthUrl = CUtil::JSEscape($this->getOAuthUrlBySocServ());
$accessToken = $this->getAccessTokenBySocServ();
$this->setAccessToken($accessToken);
$this->initDocHandler();
$this->getDocHandler()->setAccessToken($this->getAccessToken());
if (empty($accessToken)) {
$this->sendJsonResponse(array('authUrl' => $oAuthUrl));
} else {
//todo hack. SocServ set backurl!
if (strpos($_SERVER['HTTP_REFERER'], 'tools/oauth')) {
$curPath = CHTTP::urlDeleteParams($_SERVER['REQUEST_URI'], array("proccess", "sessid"));
$curPath = CHTTP::urlAddParams($curPath, array('sessid' => bitrix_sessid()));
//restart
LocalRedirect($curPath);
}
if ($this->isPublicNewFile()) {
$response = $this->publicBlankFile(new CWebDavBlankDocument($this->arParams['createType']));
//todo bad hack. bad hack
if ($this->getDocHandler()->isRequiredAuthorization()) {
$this->sendJsonResponse(array('authUrl' => $oAuthUrl));
}
$this->sendJsonResponse($response);
} elseif ($this->isSaveNewFile()) {
$response = $this->saveNewFile(array('isDropped' => true, 'createType' => $this->arParams['createType']));
$this->removeFile();
$this->sendJsonResponse($response);
} elseif ($this->isRenameFile()) {
$response = $this->renameFile(array('newName' => $_REQUEST['newName'], 'elementId' => (int) $_REQUEST['elementId'], 'sectionId' => (int) $_REQUEST['sectionId']));
$this->sendJsonResponse($response);
} elseif (!empty($_REQUEST['commit']) && $this->getFileId()) {
$deletedSession = $this->deleteSession(true);
$response = $this->commitFile();
if (is_array($deletedSession) && $this->isLastSession()) {
$this->removeFile($deletedSession);
}
$this->sendJsonResponse($response);
} elseif (!empty($_REQUEST['discard']) && $this->getFileId()) {
$deletedSession = $this->deleteSession(true);
if (is_array($deletedSession) && $this->isLastSession()) {
$this->removeFile($deletedSession);
$this->sendJsonResponse(array('status' => 'success'));
}
$this->sendJsonResponse(array('status' => 'error'));
} else {
$response = $this->publicFile();
//todo bad hack. bad hack
if ($this->getDocHandler()->isRequiredAuthorization()) {
$this->sendJsonResponse(array('authUrl' => $oAuthUrl));
}
$this->sendJsonResponse($response);
}
}
return;
} catch (Exception $e) {
//$this->sendJsonResponse(array('error' => $e->getMessage()));
}
return;
}