Beispiel #1
0
 function Recover($HISTORY_ID, $ID, $IBLOCK_ID)
 {
     $this->CleanCacheById($ID, $IBLOCK_ID);
     $rIBlock = CIBlock::getList(array(), array('ID' => $IBLOCK_ID, 'CHECK_PERMISSIONS' => 'N'));
     $arIBlock = $rIBlock->GetNext();
     if ($arIBlock['BIZPROC'] == 'Y' && CModule::IncludeModule('bizproc')) {
         $arErrorsTmp = array();
         $arHistoryResult = CBPDocument::GetDocumentFromHistory($HISTORY_ID, $arErrorsTmp);
         $modifyComment = GetMessage('WIKI_RECOVER_COMMENT') . " " . $arHistoryResult["MODIFIED"];
         if (CBPHistoryService::RecoverDocumentFromHistory($HISTORY_ID)) {
             if ($this->UpdateHistory($ID, $IBLOCK_ID, $modifyComment)) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 $rsHistory->NavStart($arParams['HISTORY_COUNT'], false);
 $arResult['DB_LIST'] =& $rsHistory;
 $arResult['HISTORY'] = array();
 if ($arResult['SOCNET']) {
     $arResult['AJAX_PAGE'] = $APPLICATION->GetCurPageParam('', array('bxajaxid', 'logout'));
     $arResult['PATH_TO_USER'] = $arParams['PATH_TO_USER'];
     $arResult['SHOW_LOGIN'] = $this->GetParent()->arParams['SHOW_LOGIN'];
     $arResult['NAME_TEMPLATE'] = $this->GetParent()->arParams['NAME_TEMPLATE'];
     $arResult['PATH_TO_CONPANY_DEPARTMENT'] = $this->GetParent()->arParams['PATH_TO_CONPANY_DEPARTMENT'];
     $arResult['PATH_TO_VIDEO_CALL'] = $this->GetParent()->arParams['PATH_TO_VIDEO_CALL'];
     $arResult['PATH_TO_SONET_MESSAGES_CHAT'] = $this->GetParent()->arParams['PATH_TO_MESSAGES_CHAT'];
 }
 $arErrorsTmp = array();
 while ($arHistory = $rsHistory->GetNext()) {
     $arHistory['USER_LINK'] = '';
     $arHistoryResult = CBPDocument::GetDocumentFromHistory($arHistory['ID'], $arErrorsTmp);
     $arHistory["MODIFY_COMMENT"] = $arHistoryResult["DOCUMENT"]["MODIFY_COMMENT"];
     if (!empty($arParams['PATH_TO_USER'])) {
         $arHistory['USER_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId, 'user_id' => $arHistory['USER_ID'])), array());
     }
     /*CBPHistoryService::GetHistoryList() returns specialchared values
     		and CWikiUtils::GetUserLogin also do htmlspecialchars*/
     foreach (array('USER_LOGIN', 'USER_NAME', 'USER_LAST_NAME', 'USER_SECOND_NAME') as $key) {
         $arHistory[$key] = CWikiUtils::htmlspecialchars_decode($arHistory[$key]);
     }
     $arHistory['USER_LOGIN'] = CWikiUtils::GetUserLogin($arHistory, $arParams["NAME_TEMPLATE"]);
     $arHistory['DISCUSSION_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DISCUSSION'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => 'discussion') : array());
     $arHistory['SHOW_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), array('oldid' => $arHistory['ID']));
     $arHp = array('oldid' => $arHistory['ID'], 'sessid' => bitrix_sessid());
     if ($arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N') {
         $arHp[$arParams['OPER_VAR']] = 'history';
	if ($return_url != '' && strtolower(substr($return_url, strlen($APPLICATION->GetCurPage())))==strtolower($APPLICATION->GetCurPage()))
		$return_url = '';
	if ($return_url == '')
	{
		if ($from=="iblock_section_admin")
			$return_url = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('find_section_section'=>intval($find_section_section)));
	}
}

do{ //one iteration loop

	$errorTriger = false;
	if ($historyId > 0)
	{
		$arErrorsTmp = array();
		$arResult = CBPDocument::GetDocumentFromHistory($historyId, $arErrorsTmp);

		if (!empty($arErrorsTmp))
		{
			foreach ($arErrorsTmp as $e)
			{
				$error = new _CIBlockError(1, $e["code"], $e["message"]);
				break;
			}
		}

		$canWrite = CBPDocument::CanUserOperateDocument(
			CBPCanUserOperateOperation::WriteDocument,
			$USER->GetID(),
			$arResult["DOCUMENT_ID"],
			array("UserGroups" => $USER->GetUserGroupArray())
Beispiel #4
0
 if (empty($arParams['ELEMENT_NAME'])) {
     $arParams['ELEMENT_NAME'] = CWiki::GetDefaultPage($arParams['IBLOCK_ID']);
 }
 $arFilter = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N', 'ACTIVE' => 'Y');
 if (!empty($arParams['ELEMENT_NAME']) && ($arResult['ELEMENT'] = CWiki::GetElementByName($arParams['ELEMENT_NAME'], $arFilter)) != false) {
     $arParams['ELEMENT_ID'] = $arResult['ELEMENT']['ID'];
 }
 $documentId = array('iblock', 'CWikiDocument', $arParams['ELEMENT_ID']);
 $arErrorsTmp = array();
 $arHistoryResult = CBPDocument::GetDocumentFromHistory($historyId, $arErrorsTmp);
 if (count($arErrorsTmp) > 0) {
     foreach ($arErrorsTmp as $e) {
         $arResult['FATAL_MESSAGE'] .= $e['message'];
     }
 }
 $arDiffResult = CBPDocument::GetDocumentFromHistory($DiffId, $arErrorsTmp);
 if (count($arErrorsTmp) > 0) {
     foreach ($arErrorsTmp as $e) {
         $arResult['FATAL_MESSAGE'] .= $e['message'];
     }
     $this->AbortResultCache();
     ShowError($arResult['FATAL_MESSAGE']);
     return;
 }
 if (!($arHistoryResult['DOCUMENT_ID'] == $documentId && $arDiffResult['DOCUMENT_ID'] == $documentId)) {
     $this->AbortResultCache();
     ShowError(GetMessage('WIKI_ACCESS_DENIED'));
     return;
 }
 $canRead = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ReadDocument, $GLOBALS['USER']->GetID(), $documentId, array('UserGroups' => $GLOBALS['USER']->GetUserGroupArray()));
 if (!$canRead) {