public function __construct() { $diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'); if (!$diskEnabled) { $this->validUrls = array_merge($this->validUrls, array("/company/personal.php", "/extranet/contacts/personal.php", "/docs/index.php", "/docs/shared/index.php", "/workgroups/index.php")); } }
function installDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->query("SELECT 'x' FROM b_abtest", true)) { $createTestTemplates = true; $this->errors = $DB->runSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/abtest/install/db/' . strtolower($DB->type) . '/install.sql'); } if ($this->errors !== false) { $APPLICATION->throwException(implode('', $this->errors)); return false; } $eventManager = Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandler('main', 'OnGetCurrentSiteTemplate', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onGetCurrentSiteTemplate'); $eventManager->registerEventHandler('main', 'OnFileRewrite', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onFileRewrite'); $eventManager->registerEventHandlerCompatible('main', 'OnPageStart', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onPageStart'); $eventManager->registerEventHandlerCompatible('main', 'OnPanelCreate', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onPanelCreate'); $eventManager->registerEventHandlerCompatible('conversion', 'OnGetAttributeTypes', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onGetAttributeTypes'); $eventManager->registerEventHandlerCompatible('conversion', 'OnSetDayContextAttributes', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onConversionSetContextAttributes'); registerModule($this->MODULE_ID); $defSite = Bitrix\Main\SiteTable::getList(array('order' => array('ACTIVE' => 'DESC', 'DEF' => 'DESC', 'SORT' => 'ASC'), 'select' => array('LID')))->fetch(); if (!empty($createTestTemplates) && CModule::includeModule('abtest') && !empty($defSite)) { $arTestTemplates = array(100 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE1_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE1_DESCR'), 'TEST_DATA' => array('id' => 'sample1', 'list' => array(array('type' => 'template', 'old_value' => '', 'new_value' => '')))), 200 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE2_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE2_DESCR'), 'TEST_DATA' => array('id' => 'sample2', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 300 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE3_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE3_DESCR'), 'TEST_DATA' => array('id' => 'sample3', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 400 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE4_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE4_DESCR'), 'TEST_DATA' => array('id' => 'sample4', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 500 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE5_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE5_DESCR'), 'TEST_DATA' => array('id' => 'sample5', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 600 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE6_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE6_DESCR'), 'TEST_DATA' => array('id' => 'sample6', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 700 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE7_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE7_DESCR'), 'TEST_DATA' => array('id' => 'sample7', 'list' => array(array('type' => 'composite', 'old_value' => 'N', 'new_value' => 'Y')))), 800 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE8_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE8_DESCR'), 'TEST_DATA' => array('id' => 'sample8', 'list' => array(array('type' => 'cdn', 'old_value' => 'N', 'new_value' => 'Y')))), 900 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE9_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE9_DESCR'), 'TEST_DATA' => array('id' => 'sample9', 'list' => array(array('type' => 'bigdata', 'old_value' => 'N', 'new_value' => 'Y'))))); foreach ($arTestTemplates as $sort => $test) { $test['SITE_ID'] = $defSite['LID']; $test['ACTIVE'] = 'N'; $test['DURATION'] = 0; $test['PORTION'] = 30; $test['SORT'] = $sort; Bitrix\ABTest\ABTestTable::add($test); } } return true; }
/** * @return array */ protected function toEdit() { /** @global CUser $USER */ global $USER; if (!$USER->IsAuthorized()) { return array('status' => 'error', 'error' => 'auth_error'); } if (!check_bitrix_sessid()) { return array('status' => 'error', 'error' => 'sessid_check_failed'); } if ($this->request['action'] !== 'otp_check_activate') { return array('status' => 'error', 'error' => 'unknown_action'); } if (!CModule::includeModule('security')) { return array('status' => 'error', 'error' => 'security_not_installed'); } try { $otp = Otp::getByUser($USER->getid()); $binarySecret = pack('H*', $this->request->getPost('secret')); $otp->regenerate($binarySecret)->syncParameters($this->request->getPost('sync1'), $this->request->getPost('sync2'))->save(); return array('status' => 'ok'); } catch (\Bitrix\Security\Mfa\OtpException $e) { return array('status' => 'error', 'error' => $e->getMessage()); } }
/** * @return array */ protected function toView() { /* @global CUser $USER */ global $USER; if (!CModule::includeModule('security')) { return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_MODULE_ERROR')); } if (!Otp::isOtpRequiredByMandatory()) { return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_NOT_REQUIRED')); } if ($USER->IsAuthorized()) { return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_AUTH_ERROR')); } $deferredParams = Otp::getDeferredParams(); if (!$deferredParams['USER_ID']) { return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_UNKNOWN_ERROR')); } $result = array(); $otp = Otp::getByUser($deferredParams['USER_ID']); $otp->regenerate(); $result['SECRET'] = $otp->getHexSecret(); $result['TYPE'] = $otp->getType(); $result['APP_SECRET'] = $otp->getAppSecret(); $result['APP_SECRET_SPACED'] = chunk_split($result['APP_SECRET'], 4, ' '); $result['PROVISION_URI'] = $otp->getProvisioningUri(); $result['SUCCESSFUL_URL'] = $this->arParams['SUCCESSFUL_URL']; $result['TWO_CODE_REQUIRED'] = $otp->getAlgorithm()->isTwoCodeRequired(); $result['OTP'] = $otp; return $result; }
public static function InitFileStorage() { static $bInited = false; $arResult = array(); if (!$bInited) { $bDiskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'); if ($bDiskEnabled) { $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID()); if (!$storage) { $arResult = array("ERROR_CODE" => "NO_DISC_STORAGE", "ERROR_MESSAGE" => "No disk storage"); } else { $folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()); if (!$folder) { $arResult = array("ERROR_CODE" => "NO_DISC_FOLDER", "ERROR_MESSAGE" => "No disk folder"); } else { $arResult = array("DISC_STORAGE" => $storage, "DISC_FOLDER" => $folder); } } } elseif (CModule::IncludeModule("webdav")) { $data = CWebDavIblock::getRootSectionDataForUser($GLOBALS["USER"]->GetID()); if (is_array($data)) { $ob = new CWebDavIblock($data["IBLOCK_ID"], "", array("ROOT_SECTION_ID" => $data["SECTION_ID"], "DOCUMENT_TYPE" => array("webdav", 'CIBlockDocumentWebdavSocnet', 'iblock_' . $data['SECTION_ID'] . '_user_' . intval($GLOBALS["USER"]->GetID())))); } if (!$ob) { $arResult = array("ERROR_CODE" => "NO_WEBDAV_SECTION", "ERROR_MESSAGE" => "No webdav section"); } else { $arResult = array("WEBDAV_DATA" => $data, "WEBDAV_IBLOCK_OBJECT" => $ob); } } $bInited = true; } return $arResult; }
public static function AddBlogPost($arFields) { if (!is_array($_POST)) { $_POST = array(); } $_POST = array_merge($_POST, array("apply" => "Y", "decode" => "N"), $arFields); $strPathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID); $strPathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, SITE_ID); $BlogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID); $arBlogComponentParams = array("IS_REST" => "Y", "ID" => "new", "PATH_TO_POST" => $strPathToPost, "PATH_TO_SMILE" => $strPathToSmile, "GROUP_ID" => $BlogGroupID, "USER_ID" => $GLOBALS["USER"]->GetID(), "USE_SOCNET" => "Y", "MICROBLOG" => "Y"); ob_start(); $result = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, false, array("HIDE_ICONS" => "Y")); ob_end_clean(); if (!$result) { throw new Exception('Error'); } else { if (isset($arFields["FILES"]) && \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk') && ($storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID())) && ($folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()))) { // upload to storage $arResultFile = array(); foreach ($arFields["FILES"] as $tmp) { $arFile = CRestUtil::saveFile($tmp); if (is_array($arFile)) { $file = $folder->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true); if ($file) { $arResultFile[] = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX . $file->getId(); } } } if (!empty($arResultFile)) { CBlogPost::Update($result, array("HAS_PROPS" => "Y", "UF_BLOG_POST_FILE" => $arResultFile)); } } return $result; } }
private static function needProxyToDiskByDocType($documentType) { if (!(\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'))) { return false; } if (empty($documentType)) { return false; } $storage = null; if (substr($documentType, 0, 7) == 'STORAGE') { $storageId = (int) substr($documentType, 8); if ($storageId) { $storage = \Bitrix\Disk\Storage::loadById($storageId); } if ($storage) { return $storage; } } list(, $iblockId, $typeLib, $entityId) = explode('_', $documentType); if ($typeLib == 'user') { $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($entityId); } elseif ($typeLib == 'group') { $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByGroupId($entityId); } else { return false; } return $storage; }
function __wd_get_root_section($IBLOCK_ID, $object, $object_id) { $result = CIBlockWebdavSocnet::GetSectionID($IBLOCK_ID, $object, $object_id); if (intval($result) > 0) { return $result; } else { __wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]); $arFields = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N"); if ($object == "user") { $dbUser = CUser::GetByID($object_id); $arUser = $dbUser->Fetch(); $arFields["NAME"] = trim($arUser['LAST_NAME'] . " " . $arUser['FIRST_NAME']); $arFields["NAME"] = trim(!empty($arFields["NAME"]) ? $arFields["NAME"] : $arUser['LOGIN']); $arFields['CREATED_BY'] = $arUser['ID']; $arFields['MODIFIED_BY'] = $arUser['ID']; if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") { $arTasks = CWebDavIblock::GetTasks(); $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'U' . $object_id, 'TASK_ID' => $arTasks['X'])); } } else { /* $res = CSocNetGroup::GetByID($arResult["VARIABLES"]["group_id"]); if (!$res) { $arParams["ERROR_MESSAGE"] = GetMessage("SONET_GROUP_NOT_EXISTS"); return 0; } */ $arFields["SOCNET_GROUP_ID"] = $object_id; //$arGroup = CSocNetGroup::GetByID($object_id); $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $object_id; $dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $object_id), false, false, array("ID", "SITE_ID", "NAME")); if ($arGroup = $dbGroup->Fetch()) { $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"]; } if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") { $arTasks = CWebDavIblock::GetTasks(); $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W'])); } } if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) { \Bitrix\Disk\Driver::getInstance()->addGroupStorage($arFields["SOCNET_GROUP_ID"]); } $GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"]; $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $IBLOCK_ID . "_SECTION", $arFields); $bs = new CIBlockSection(); $sectionID = $bs->Add($arFields); if (!$sectionID) { $arParams["ERROR_MESSAGE"] = $bs->LAST_ERROR; return 0; } WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list")); return true; /* if ($ob->workflow == 'bizproc') { __wd_create_default_bp_user_and_groups($arBizProcParameters); } */ } }
protected function checkRequired() { if (!CModule::includeModule('iblock')) { throw new Exception('Bad include iblock'); } if (!CModule::includeModule('webdav')) { throw new Exception('Bad include webdav'); } }
/** * Create new comment for task * * @param integer $taskId * @param integet $commentId * @param integer $commentEditorId - ID of user who is comment's editor * @param string[] $arFields - fields to be updated, including text in BB code * * @throws TasksException, CTaskAssertException * * @return boolean */ public static function update($taskId, $commentId, $commentEditorId, $arFields) { CTaskAssert::assertLaxIntegers($taskId, $commentId, $commentEditorId); CTaskAssert::assert(is_array($arFields) && !empty($arFields)); if (!CModule::includeModule('forum')) { throw new TasksException('forum module can not be loaded', TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED); } IncludeModuleLangFile(__FILE__); $forumId = CTasksTools::GetForumIdForIntranet(); $oTask = CTaskItem::getInstance($taskId, $commentEditorId); $arTask = $oTask->getData(); $outForumTopicId = $outStrUrl = null; $arErrorCodes = array(); $arFields = array_merge(array('EDITOR_ID' => $commentEditorId), $arFields); $messageId = self::__deprecated_Add($arFields['POST_MESSAGE'], $forumTopicId = $arTask['FORUM_TOPIC_ID'], $forumId, $nameTemplate = CSite::GetNameFormat(false), $arTask = $arTask, $permissions = 'Y', $commentId = $commentId, $givenUserId = $commentEditorId, $imageWidth = 300, $imageHeight = 300, $arSmiles = array(), $arForum = CForumNew::GetByID($forumId), $messagesPerPage = 10, $arUserGroupArray = CUser::GetUserGroup($commentEditorId), $backPage = null, $strMsgAddComment = GetMessage("TASKS_COMMENT_MESSAGE_ADD"), $strMsgEditComment = GetMessage("TASKS_COMMENT_MESSAGE_EDIT"), $strMsgNewTask = GetMessage("TASKS_COMMENT_SONET_NEW_TASK_MESSAGE"), $componentName = null, $outForumTopicId, $arErrorCodes, $outStrUrl, $arFields); if (!($messageId >= 1)) { throw new TasksException(serialize($arErrorCodes), TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED | TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE); } return true; }
protected function _determineModules(array $ids) { sort($ids); $cache = new CPhpCache(); if ($cache->initCache($this->_cacheTime, serialize($ids), $this->_cacheDir)) { return $cache->getVars(); } CModule::includeModule('iblock'); $res = CIBlockElement::getList(array(), array('ID' => $ids), false, array('nTopCount' => count($ids)), array('ID', 'IBLOCK_ID')); $result = array(); while ($row = $res->fetch()) { $module = $this->_getModule($row['IBLOCK_ID']); if (!array_key_exists($module, $result)) { $result[$module] = array(); } $result[$module][] = $row['ID']; } if ($cache->startDataCache()) { $cache->endDataCache($result); } return $result; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::includeModule('webdav')) { return; } class CWebDavDocEditSkydriveComponent extends CWebDavEditDocComponentBase { /** * @return string */ protected function getServiceName() { return CWebDavLogOnlineEdit::SKYDRIVE_SERVICE_NAME; } /** * @return string */ protected function generateUriToDoc() { return CUtil::JSEscape($this->getWebdav()->uri . '?' . 'editIn=' . $this->getServiceName() . '&proccess=1'); } protected function getAccessTokenBySocServ() { $socGoogleOAuth = new CSocServLiveIDOAuth($this->getUser()->getId()); //this bug. SocServ fill entityOAuth in method getUrl..... $liveIdOAuthUrl = $socGoogleOAuth->getUrl('modal', CWebDavEditSkyDrive::$SCOPE); $accessToken = $socGoogleOAuth->getStorageToken(); return $accessToken;
protected function initSession() { if ($domain = $GLOBALS["APPLICATION"]->getCookieDomain()) { ini_set("session.cookie_domain", $domain); } if (\COption::getOptionString("security", "session", "N") === "Y" && \CModule::includeModule("security")) { \CSecuritySession::init(); } //diagnostic for spaces in init.php etc. //message is shown in the admin section $GLOBALS["aHeadersInfo"] = array(); if (headers_sent($hs_file, $hs_line)) { $GLOBALS["aHeadersInfo"] = array("file" => $hs_file, "line" => $hs_line); } session_start(); }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("socialnetwork")) { ShowError(GetMessage("SONET_MODULE_NOT_INSTALL")); return; } if (!CBXFeatures::IsFeatureEnabled("Workgroups")) { ShowError(GetMessage("SONET_WORKGROUPS_FEATURE_DISABLED")); return; } $arDefaultUrlTemplates404 = array("index" => "index.php", "group_reindex" => "group_reindex.php", "group_content_search" => "group/#group_id#/search/", "group_request_user" => "group/#group_id#/user/#user_id#/request/", "group_create" => "create/", "search" => "search.php", "group" => "group/#group_id#/", "group_edit" => "group/#group_id#/edit/", "group_requests" => "group/#group_id#/requests/", "group_requests_out" => "group/#group_id#/requests_out/", "group_mods" => "group/#group_id#/moderators/", "group_users" => "group/#group_id#/users/", "group_ban" => "group/#group_id#/ban/", "group_delete" => "group/#group_id#/delete/", "group_features" => "group/#group_id#/features/", "group_subscribe" => "group/#group_id#/subscribe/", "group_list" => "group/", "group_search" => "group/search/", "group_search_subject" => "group/search/#subject_id#/", "user_leave_group" => "group/#group_id#/user_leave/", "user_request_group" => "group/#group_id#/user_request/", "group_request_search" => "group/#group_id#/user_search/", "message_to_group" => "group/#group_id#/chat/", "group_photo" => "group/#group_id#/photo/", "group_photo_gallery" => "group/#group_id#/photo/gallery/", "group_photo_gallery_edit" => "group/#group_id#/photo/gallery/action/#action#/", "group_photo_galleries" => "group/#group_id#/photo/galleries/", "group_photo_section" => "group/#group_id#/photo/album/#section_id#/", "group_photo_section_edit" => "group/#group_id#/photo/album/#section_id#/action/#action#/", "group_photo_section_edit_icon" => "group/#group_id#/photo/album/#section_id#/icon/action/#action#/", "group_photo_element_upload" => "group/#group_id#/photo/photo/#section_id#/action/upload/", "group_photo_element" => "group/#group_id#/photo/photo/#section_id#/#element_id#/", "group_photo_element_edit" => "group/#group_id#/photo/photo/#section_id#/#element_id#/action/#action#/", "group_photo_element_slide_show" => "group/#group_id#/photo/photo/#section_id#/#element_id#/slide_show/", "group_photofull_gallery" => "group/#group_id#/photo/gallery/#user_alias#/", "group_photofull_gallery_edit" => "group/#group_id#/photo/gallery/#user_alias#/action/#action#/", "group_photofull_section" => "group/#group_id#/photo/album/#user_alias#/#section_id#/", "group_photofull_section_edit" => "group/#group_id#/photo/album/#user_alias#/#section_id#/action/#action#/", "group_photofull_section_edit_icon" => "group/#group_id#/photo/album/#user_alias#/#section_id#/icon/action/#action#/", "group_photofull_element_upload" => "group/#group_id#/photo/photo/#user_alias#/#section_id#/action/upload/", "group_photofull_element" => "group/#group_id#/photo/photo/#user_alias#/#section_id#/#element_id#/", "group_photofull_element_edit" => "group/#group_id#/photo/photo/#user_alias#/#section_id#/#element_id#/action/#action#/", "group_photofull_element_slide_show" => "group/#group_id#/photo/photo/#user_alias#/#section_id#/#element_id#/slide_show/", "group_calendar" => "group/#group_id#/calendar/", "group_files" => "group/#group_id#/files/lib/#path#/", "group_files_short" => "folder/view/#section_id#/#element_id#/#element_name#", "group_files_section_edit" => "group/#group_id#/files/folder/edit/#section_id#/#action#/", "group_files_element" => "group/#group_id#/files/element/view/#element_id#/", "group_files_element_comment" => "group/#group_id#/files/element/comment/#topic_id#/#message_id#/", "group_files_element_edit" => "group/#group_id#/files/element/edit/#element_id#/#action#/", "group_files_element_file" => "", "group_files_element_history" => "group/#group_id#/files/element/history/#element_id#/", "group_files_element_history_get" => "group/#group_id#/files/element/historyget/#element_id#/#element_name#", "group_files_element_version" => "group/#group_id#/files/element/version/#action#/#element_id#/", "group_files_element_versions" => "group/#group_id#/files/element/versions/#element_id#/", "group_files_element_upload" => "group/#group_id#/files/element/upload/#section_id#/", "group_files_help" => "group/#group_id#/files/help/", "group_files_connector" => "group/#group_id#/files/connector/", "group_files_webdav_bizproc_history" => "group/#group_id#/files/bizproc/history/#element_id#/", "group_files_webdav_bizproc_history_get" => "group/#group_id#/files/bizproc/historyget/#element_id#/#id#/#element_name#", "group_files_webdav_bizproc_log" => "group/#group_id#/files/bizproc/log/#element_id#/#id#/", "group_files_webdav_bizproc_view" => "group/#group_id#/files/bizproc/bizproc/#element_id#/", "group_files_webdav_bizproc_workflow_admin" => "group/#group_id#/files/bizproc/admin/", "group_files_webdav_bizproc_workflow_edit" => "group/#group_id#/files/bizproc/edit/#id#/", "group_files_webdav_start_bizproc" => "group/#group_id#/files/bizproc/start/#element_id#/", "group_files_webdav_task_list" => "group/#group_id#/files/bizproc/task/list/", "group_files_webdav_task" => "group/#group_id#/files/bizproc/task/read/#id#/", "group_blog" => "group/#group_id#/blog/", "group_blog_post_edit" => "group/#group_id#/blog/edit/#post_id#/", "group_blog_rss" => "group/#group_id#/blog/rss/#type#/", "group_blog_post_rss" => "group/#group_id#/blog/rss/#type#/#post_id#/", "group_blog_draft" => "group/#group_id#/blog/draft/", "group_blog_moderation" => "group/#group_id#/blog/moderation/", "group_blog_post" => "group/#group_id#/blog/#post_id#/", "group_forum" => "group/#group_id#/forum/", "group_forum_topic" => "group/#group_id#/forum/#topic_id#/", "group_forum_topic_edit" => "group/#group_id#/forum/edit/#topic_id#/", "group_forum_message" => "group/#group_id#/forum/message/#topic_id#/#message_id#/", "group_forum_message_edit" => "group/#group_id#/forum/message/#action#/#topic_id#/#message_id#/", "group_tasks" => "group/#group_id#/tasks/", "group_tasks_task" => "group/#group_id#/tasks/task/#action#/#task_id#/", "group_tasks_view" => "group/#group_id#/tasks/view/#action#/#view_id#/", "group_tasks_report" => "group/#group_id#/tasks/report/", "group_tasks_report_construct" => "group/#group_id#/tasks/report/construct/#report_id#/#action#/", "group_tasks_report_view" => "group/#group_id#/tasks/report/view/#report_id#/", "group_log" => "group/#group_id#/log/", "group_log_rss" => "group/#group_id#/log/rss/?bx_hit_hash=#sign#&events=#events#", "group_log_rss_mask" => "group/#group_id#/log/rss/"); $diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'); if ($diskEnabled) { $arDefaultUrlTemplates404["group_disk"] = "group/#group_id#/disk/path/#PATH#"; $arDefaultUrlTemplates404["group_disk_file"] = "group/#group_id#/disk/file/#FILE_PATH#"; $arDefaultUrlTemplates404["group_trashcan_list"] = "group/#group_id#/disk/trashcan/#TRASH_PATH#"; $arDefaultUrlTemplates404["group_trashcan_file_view"] = "group/#group_id#/disk/trash/file/#TRASH_FILE_PATH#"; $arDefaultUrlTemplates404["group_external_link_list"] = "group/#group_id#/disk/external"; $arDefaultUrlTemplates404["group_disk_bizproc_workflow_admin"] = "group/#group_id#/disk/bp/"; $arDefaultUrlTemplates404["group_disk_bizproc_workflow_edit"] = "group/#group_id#/disk/bp_edit/#ID#/"; $arDefaultUrlTemplates404["group_disk_start_bizproc"] = "group/#group_id#/disk/bp_start/#ELEMENT_ID#/"; $arDefaultUrlTemplates404["group_disk_task"] = "group/#group_id#/disk/bp_task/#ID#/"; $arDefaultUrlTemplates404["group_disk_task_list"] = "group/#group_id#/disk/bp_task_list/"; } $arDefaultUrlTemplatesN404 = array("index" => "", "group_reindex" => "page=group_reindex", "group_content_search" => "page=group_content_search&group_id=#group_id#", "group_create" => "page=group_create&user_id=#group_id#", "group" => "page=group&group_id=#group_id#", "group_edit" => "page=group_edit&group_id=#group_id#", "group_requests" => "page=group_requests&group_id=#group_id#", "group_requests_out" => "page=group_requests_out&group_id=#group_id#", "group_mods" => "page=group_mods&group_id=#group_id#", "group_users" => "page=group_users&group_id=#group_id#", "group_ban" => "page=group_ban&group_id=#group_id#", "group_delete" => "page=group_delete&group_id=#group_id#", "group_features" => "page=group_features&group_id=#group_id#", "group_subscribe" => "page=group_subscribe&group_id=#group_id#", "group_list" => "page=group_list", "group_search" => "page=group_search", "group_search_subject" => "page=group_search_subject&subject_id=#subject_id#", "user_leave_group" => "page=user_leave_group&group_id=#group_id#", "group_request_user" => "page=group_request_user&group_id=#group_id#&user_id=#user_id#", "user_request_group" => "page=user_request_group&group_id=#group_id#", "group_request_search" => "page=group_request_search&group_id=#group_id#", "group_photo" => "page=group_photo&group_id=#group_id#", "group_photo_gallery" => "page=group_photo_gallery&group_id=#group_id#", "group_photo_gallery_edit" => "page=group_photo_gallery&group_id=#group_id#&action=#action#", "group_photo_galleries" => "page=group_photo_galleries&group_id=#group_id#", "group_photo_section" => "page=group_photo_section&group_id=#group_id#§ion_id=#section_id#", "group_photo_section_edit" => "page=group_photo_section_edit&group_id=#group_id#§ion_id=#section_id#&action=#action#", "group_photo_section_edit_icon" => "page=group_photo_section_edit_icon&group_id=#group_id#§ion_id=#section_id#&action=#action#", "group_photo_element_upload" => "page=group_photo_element_upload&group_id=#group_id#§ion_id=#section_id#", "group_photo_element" => "page=group_photo_element&group_id=#group_id#§ion_id=#section_id#&element_id=#element_id#", "group_photo_element_edit" => "page=group_photo_element_edit&group_id=#group_id#§ion_id=#section_id#&element_id=#element_id#&action=#action#", "group_photo_element_slide_show" => "page=group_photo_element_slide_show&group_id=#group_id#§ion_id=#section_id#&element_id=#element_id#", "group_photofull_gallery" => "page=group_photofull_gallery&group_id=#group_id#&user_alias=#user_alias#", "group_photofull_gallery_edit" => "page=group_photofull_gallery_edit&group_id=#group_id#&user_alias=#user_alias#&action=#action#", "group_photofull_section" => "page=group_photofull_section&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#", "group_photofull_section_edit" => "page=group_photofull_section_edit&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#&action=#action#", "group_photofull_section_edit_icon" => "page=group_photofull_section_edit_icon&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#&action=#action#", "group_photofull_element_upload" => "page=group_photofull_element_upload&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#", "group_photofull_element" => "page=group_photofull_element&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#&element_id=#element_id#", "group_photofull_element_edit" => "page=group_photofull_element_edit&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#&element_id=#element_id#&action=#action#", "group_photofull_element_slide_show" => "page=group_photofull_element_slide_show&group_id=#group_id#&user_alias=#user_alias#§ion_id=#section_id#&element_id=#element_id#", "group_calendar" => "page=group_calendar&group_id=#group_id#", "message_to_group" => "page=message_to_group&group_id=#group_id#", "group_files" => "page=group_files&group_id=#group_id#&path=#path#", "group_files_short" => "page=group_files_short&group_id=#group_id#§ion_id=#section_id#&element_id=#element_id#&element_name=#element_name#", "group_files_section_edit" => "page=group_files_section_edit&group_id=#group_id#§ion_id=#section_id#&action=#action#", "group_files_element" => "page=group_files_element&group_id=#group_id#&element_id=#element_id#", "group_files_element_comment" => "page=group_files_element_comment&group_id=#group_id#&topic_id=#topic_id#&message_id=#message_id#", "group_files_element_edit" => "page=group_files_element_edit&group_id=#group_id#&element_id=#element_id#&action=#action#", "group_files_element_file" => "", "group_files_element_history" => "page=group_files_element_history&element_id=#element_id#", "group_files_element_history_get" => "page=group_files_element_history_get&element_id=#element_id#&element_name=#element_name#", "group_files_element_version" => "page=group_files_element_version&group_id=#group_id#&element_id=#element_id#&action=#action#", "group_files_element_versions" => "page=group_files_element_versions&group_id=#group_id#&element_id=#element_id#", "group_files_element_upload" => "page=group_files_element_upload&group_id=#group_id#§ion_id=#section_id#", "group_files_help" => "page=group_files_help&group_id=#group_id#", "group_files_connector" => "page=group_files_connector&group_id=#group_id#", "group_files_webdav_bizproc_history" => "page=group_files_webdav_bizproc_history&group_id=#group_id#&element_id=#element_id#", "group_files_webdav_bizproc_history_get" => "page=group_files_webdav_bizproc_history_get&group_id=#group_id#&element_id=#element_id#&element_name=#element_name#", "group_files_webdav_bizproc_log" => "page=group_files_webdav_bizproc_log&group_id=#group_id#&element_id=#element_id#&id=#id#", "group_files_webdav_bizproc_view" => "page=group_files_webdav_bizproc_view&group_id=#group_id#&element_id=#element_id#", "group_files_webdav_bizproc_workflow_admin" => "page=group_files_webdav_bizproc_workflow_admin&group_id=#group_id#", "group_files_webdav_bizproc_workflow_edit" => "page=group_files_webdav_bizproc_workflow_edit&group_id=#group_id#&id=#id#", "group_files_webdav_start_bizproc" => "page=group_files_webdav_start_bizproc&group_id=#group_id#&element_id=#element_id#", "group_files_webdav_task_list" => "page=group_files_webdav_task_list&group_id=#group_id#", "group_files_webdav_task" => "page=group_files_webdav_task&group_id=#group_id#&id=#id#", "group_blog" => "page=group_blog&group_id=#group_id#", "group_blog_post_edit" => "page=group_blog_post_edit&group_id=#group_id#&post_id=#post_id#", "group_blog_rss" => "page=group_blog_rss&group_id=#group_id#&type=#type#", "group_blog_post_rss" => "page=group_blog_post_rss&group_id=#group_id#&type=#type#&post_id=#post_id#", "group_blog_draft" => "page=group_blog_draft&group_id=#group_id#", "group_blog_moderation" => "page=group_blog_moderation&group_id=#group_id#", "group_blog_post" => "page=group_blog_post&group_id=#group_id#&post_id=#post_id#", "group_forum" => "page=group_forum&group_id=#group_id#", "group_forum_topic" => "page=group_forum_topic&group_id=#group_id#&topic_id=#topic_id#", "group_forum_topic_edit" => "page=group_forum_topic_edit&group_id=#group_id#&topic_id=#topic_id#", "group_forum_message" => "page=group_forum_message&group_id=#group_id#&topic_id=#topic_id#&message_id=#message_id#", "group_forum_message_edit" => "page=group_forum_message_edit&group_id=#group_id#&topic_id=#topic_id#&message_id=#message_id#&action=#action#", "group_tasks" => "page=group_tasks&group_id=#group_id#", "group_tasks_task" => "page=group_tasks_task&group_id=#group_id#&action=#action#&task_id=#task_id#", "group_tasks_view" => "page=group_tasks_view&group_id=#group_id#&action=#action#&view_id=#view_id#", "group_tasks_report" => "page=group_tasks_report&group_id=#group_id#", "group_tasks_report_construct" => "page=group_tasks_report_construct&group_id=#group_id#&action=#action#&report_id=#report_id#", "group_tasks_report_view" => "page=group_tasks_report_view&group_id=#group_id#&report_id=#report_id#", "group_log" => "page=group_log&group_id=#group_id#", "group_log_rss" => "page=group_log_rss&group_id=#group_id#&bx_hit_hash=#sign#&events=#events#"); $arDefaultVariableAliases404 = array(); $arDefaultVariableAliases = array(); $componentPage = "";
} $arParams["CAN_EDIT"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::IS_ADMIN || CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit")); $arResult["CAN_ADD_ELEMENT"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm > CListPermissions::CAN_READ || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_element_bind")); $arResult["CAN_READ"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm > CListPermissions::CAN_READ || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "element_read")); $arResult["CAN_EDIT_SECTIONS"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_edit") || CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $section_id, "section_section_bind")); $arResult["IBLOCK_PERM"] = $lists_perm; $arResult["USER_GROUPS"] = $USER->GetUserGroupArray(); $arIBlock = CIBlock::GetArrayByID(intval($arParams["~IBLOCK_ID"])); $arResult["~IBLOCK"] = $arIBlock; $arResult["IBLOCK"] = htmlspecialcharsex($arIBlock); $arResult["IBLOCK_ID"] = $arIBlock["ID"]; $arResult["PROCESSES"] = false; $arResult["USE_COMMENTS"] = false; $arResult["RAND_STRING"] = $this->randString(); if ($arParams["IBLOCK_TYPE_ID"] == COption::GetOptionString("lists", "livefeed_iblock_type_id")) { $arResult["USE_COMMENTS"] = (bool) CModule::includeModule("forum"); $arResult["PROCESSES"] = true; } if ($arResult["IBLOCK"]["BIZPROC"] == "Y" && CModule::IncludeModule('bizproc')) { $arParams["CAN_EDIT_BIZPROC"] = !$arResult["IS_SOCNET_GROUP_CLOSED"] && CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $USER->GetID(), BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $IBLOCK_ID), array("UserGroups" => $USER->GetUserGroupArray())); } if (isset($arParams["SOCNET_GROUP_ID"]) && $arParams["SOCNET_GROUP_ID"] > 0) { $arParams["SOCNET_GROUP_ID"] = intval($arParams["SOCNET_GROUP_ID"]); } else { $arParams["SOCNET_GROUP_ID"] = ""; } $arResult["GRID_ID"] = "lists_list_elements_" . $arResult["IBLOCK_ID"]; $arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0; $arResult["SECTION"] = false; $arResult["SECTION_ID"] = false; $arResult["PARENT_SECTION_ID"] = false;
public function includeModule() { parent::includeModule(['user.controllers', 'user.models']); }
public static function getForumId() { $forumId = COption::GetOptionString('bizproc', 'forum_id', 0); if (!$forumId && CModule::includeModule('forum')) { $defaultSiteId = CSite::GetDefSite(); $forumId = CForumNew::Add(array('NAME' => 'Bizproc Workflow', 'XML_ID' => 'bizproc_workflow', 'SITES' => array($defaultSiteId => '/'), 'ACTIVE' => 'Y', 'DEDUPLICATION' => 'N')); COption::SetOptionString("bizproc", "forum_id", $forumId); } return $forumId; }
public static function getNotEmptySections($filter = array('sections' => array(), 'elements' => array()), $sort = array()) { CModule::includeModule('iblock'); $sections = array(); $rsSections = CIBlockSection::getList($sort, $filter['sections']); while ($section = $rsSections->getNext()) { $sections[$section['ID']] = $section; } $tmpSections = $sections; $sections = array(); $rsElements = CIBlockElement::getList(array('SORT'), $filter['elements'], array('IBLOCK_SECTION_ID')); while ($element = $rsElements->getNext()) { if ($element['CNT'] > 0) { $sections[$element['IBLOCK_SECTION_ID']] = $tmpSections[$element['IBLOCK_SECTION_ID']]; } } return $sections; }
<?php use Bitrix\Main\Config\Option; use Bitrix\Security\Mfa\Otp; use Bitrix\Security\Mfa\RecoveryCodesTable; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; /** * @global CMain $APPLICATION * @global CUser $USER */ IncludeModuleLangFile(__FILE__); $request = Bitrix\Main\Context::getCurrent()->getRequest(); $userId = (int) ($request['user'] ?: $USER->getId()); $userOtp = Otp::getByUser($userId); if (!CModule::includeModule('security')) { ShowError('Security module not installed'); } if (!$userOtp->isActivated()) { ShowError('OTP inactive'); } if (!Otp::isRecoveryCodesEnabled()) { ShowError('OTP Recovery codes are disabled'); } if (!$userId || $userId != $USER->getId() && !$USER->CanDoOperation('security_edit_user_otp')) { ShowError('Not enough permissions'); } if (isset($request['action']) && $request['action'] === 'download') { $codes = getRecoveryCodes($userId); $response = ''; $counter = 0; foreach ($codes as $code) {
$bNeedInclude = true; if ($_SERVER["REQUEST_METHOD"] == "HEAD") { $res = strtolower($_SERVER["HTTP_USER_AGENT"]); if (strpos($res, "microsoft") === false && strlen($_SERVER["REAL_FILE_PATH"]) <= 0 && substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { $bNeedInclude = false; $res = CUrlRewriter::GetList(array("QUERY" => $_SERVER['REQUEST_URI'])); foreach ($res as $res_detail) { if (strpos($res_detail["ID"], "webdav") !== false || strpos($res_detail["ID"], "disk") !== false || strpos($res_detail["ID"], "socialnetwork") !== false) { $bNeedInclude = true; break; } } } } if (__webdavIsDavHeaders() && $bNeedInclude) { if (CModule::includeModule('ldap') && CLdapUtil::isBitrixVMAuthSupported()) { CLdapUtil::bitrixVMAuthorize(); } if (!$_SERVER['PHP_AUTH_USER'] || !$_SERVER['PHP_AUTH_USER']) { $res = !empty($_SERVER['REDIRECT_REMOTE_USER']) ? $_SERVER['REDIRECT_REMOTE_USER'] : $_SERVER['REMOTE_USER']; if (!empty($res) && preg_match('/(?<=(basic\\s))(.*)$/is', $res, $matches)) { $res = trim($matches[0]); list($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]) = explode(':', base64_decode($res)); } } if (!is_array($GLOBALS["APPLICATION"]->arComponentMatch)) { $GLOBALS["APPLICATION"]->arComponentMatch = array(); } $GLOBALS["APPLICATION"]->arComponentMatch[] = 'dav'; $GLOBALS["APPLICATION"]->arComponentMatch[] = 'disk'; $GLOBALS["APPLICATION"]->arComponentMatch[] = 'socialnetwork';
<? define('STOP_STATISTICS', true); define('NO_AGENT_CHECK', true); define('DisableEventsCheck', true); define('FX_SECURITY_SHOW_MESSAGE', true); define("PUBLIC_AJAX_MODE", true); define("NOT_CHECK_PERMISSIONS", true); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_before.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/iblock/admin_tools.php"); IncludeModuleLangFile(__FILE__); header('Content-Type: application/x-javascript; charset='.LANG_CHARSET); if(!CModule::includeModule("iblock") || !CModule::includeModule('fileman')) { die(); } CUtil::jSPostUnescape(); if (check_freetrix_sessid()) { if ($_REQUEST["ENTITY_TYPE"] === "B") { $ipropTemplates = new \Freetrix\Iblock\InheritedProperty\IblockTemplates($_REQUEST["ENTITY_ID"]); $arFields = array( "NAME" => $_POST["NAME"], "CODE" => $_POST["CODE"], "DESCRIPTION" => $_POST["DESCRIPTION"], ); } elseif ($_REQUEST["ENTITY_TYPE"] === "S") {
$arResult["Urls"]["GroupRequests"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_REQUESTS"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["GroupMods"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_MODS"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["GroupUsers"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_USERS"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["GroupBan"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BAN"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Blog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BLOG"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Microblog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_MICROBLOG"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Photo"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_PHOTO"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Forum"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_FORUM"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Calendar"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_CALENDAR"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Tasks"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_TASKS"], array("group_id" => $arResult["Group"]["ID"])); $arResult["Urls"]["Files"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_FILES"], array("group_id" => $arResult["Group"]["ID"], "path" => "")); $arResult["Urls"]["content_search"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_CONTENT_SEARCH"], array("group_id" => $arResult["Group"]["ID"])); $arResult["ActiveFeatures"] = CSocNetFeatures::GetActiveFeaturesNames(SONET_ENTITY_GROUP, $arResult["Group"]["ID"]); $arResult["CanView"]["files"] = array_key_exists("files", $arResult["ActiveFeatures"]); if ($arResult["CanView"]["files"]) { $diskEnabled = CModule::includeModule('disk') && \Bitrix\Disk\Driver::isSuccessfullyConverted(); if ($diskEnabled) { $arResult["Urls"]["Files"] = CComponentEngine::makePathFromTemplate($arParams["PATH_TO_GROUP_DISK"], array("group_id" => $arResult["Group"]["ID"], "PATH" => "")); } } $arResult["CanView"]["tasks"] = array_key_exists("tasks", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["calendar"] = array_key_exists("calendar", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "calendar", "view", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["forum"] = array_key_exists("forum", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "forum", "view", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["microblog"] = array_key_exists("microblog", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["blog"] = array_key_exists("blog", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["photo"] = array_key_exists("photo", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["CanView"]["content_search"] = array_key_exists("search", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arResult["Group"]["ID"], "search", "view", CSocNetUser::IsCurrentUserModuleAdmin()); $arResult["Title"]["blog"] = array_key_exists("blog", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["blog"]) > 0 ? $arResult["ActiveFeatures"]["blog"] : GetMessage("SONET_UM_BLOG"); $arResult["Title"]["microblog"] = array_key_exists("microblog", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["microblog"]) > 0 ? $arResult["ActiveFeatures"]["microblog"] : GetMessage("SONET_UM_MICROBLOG"); $arResult["Title"]["photo"] = array_key_exists("photo", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["photo"]) > 0 ? $arResult["ActiveFeatures"]["photo"] : GetMessage("SONET_UM_PHOTO"); $arResult["Title"]["forum"] = array_key_exists("forum", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["forum"]) > 0 ? $arResult["ActiveFeatures"]["forum"] : GetMessage("SONET_UM_FORUM");
if ($basketCnt > 2) { $arTmp = array(); $arTmp[] = $arCartWithoutSetItems[0]; $arTmp[] = $arCartWithoutSetItems[1]; $arCartWithoutSetItems = $arTmp; } if ($basketCnt <= 0) $displayNoneBasket = "none"; /// $arViewed = array(); $arViewedIds = array(); $viewedCount = 0; $mapViewed = array(); if (CModule::includeModule("catalog")) { $viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array( 'order' => array("DATE_VISIT" => "DESC"), 'filter' => array('FUSER_ID' => $arFuserItems["ID"], "SITE_ID" =>$arOrder["LID"] ), 'select' => array("ID", "FUSER_ID", "DATE_VISIT", "PRODUCT_ID", "LID" => "SITE_ID", "NAME" => "ELEMENT.NAME", "PREVIEW_PICTURE" => "ELEMENT.PREVIEW_PICTURE", "DETAIL_PICTURE" => "ELEMENT.DETAIL_PICTURE" ) )); while($viewed = $viewedIterator->fetch()) { $viewed['MODULE'] = 'catalog'; $arViewed[$viewedCount] = $viewed; $arViewedIds[] = $viewed['PRODUCT_ID']; $mapViewed[$viewed['PRODUCT_ID']] = $viewedCount; $viewedCount++; }
protected function checkRequirements() { /** @global CUser $USER */ global $USER; if (!$USER->IsAuthorized()) { return Loc::getMessage("SECURITY_USER_RECOVERY_CODES_AUTH_ERROR"); } if (!CModule::includeModule('security')) { return Loc::getMessage("SECURITY_USER_RECOVERY_CODES_MODULE_ERROR"); } $otp = Otp::getByUser($USER->getID()); if (!$otp->isActivated()) { return Loc::getMessage("SECURITY_USER_RECOVERY_CODES_OTP_NOT_ACTIVE"); } if (!Otp::isRecoveryCodesEnabled()) { return Loc::getMessage("SECURITY_USER_RECOVERY_CODES_DISABLED"); } return null; }
function connectionHtmlEditor($fieldId, $params, $content) { $html = ''; if (CModule::includeModule('fileman')) { ob_start(); $editor = new CHTMLEditor(); $res = array('name' => $fieldId, 'inputName' => 'DEFAULT_VALUE', 'id' => $fieldId, 'width' => $params['width'], 'height' => $params['height'], 'content' => $content, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'beforeUnloadHandlerAllowed' => true, 'askBeforeUnloadPage' => false, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-htmleditor-' . $fieldId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-htmleditor-' . $fieldId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-htmleditor-' . $fieldId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400))); $editor->show($res); $html = ob_get_contents(); ob_end_clean(); } return $html; }
<?php CModule::includeModule('catalog'); CModule::includeModule('iblock'); CModule::includeModule('sale'); $dbBasketItems = CSaleBasket::GetList(array(), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "DELAY" => 'Y', "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "PRODUCT_ID")); while ($arItems = $dbBasketItems->Fetch()) { $mxResult = CCatalogSku::GetProductInfo($arItems['PRODUCT_ID']); if (is_array($mxResult)) { $id = $mxResult['ID']; } else { $id = $arItems['PRODUCT_ID']; } $GLOBALS['wished']['ID'][] = $id; }
public static function notifyMailDomain($type, $sid, $user_id, $cnt = 0) { $user_id = intval($user_id); $cnt = intval($cnt); if (!CModule::includeModule('mail')) { return ''; } $arAdmin = CUser::getList($by, $order, array('ID' => $user_id, 'GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'EMAIL')))->fetch(); if (empty($arAdmin)) { return ''; } if ($cnt == 0) { return 'CIntranetUtils::notifyMailDomain("' . $type . '", "' . $sid . '", ' . $user_id . ', ' . ++$cnt . ');'; } includeModuleLangFile(__FILE__); if (isModuleInstalled('bitrix24')) { $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMOREB24_LINK'); $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORTB24_LINK'); } else { $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMORE_LINK'); $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORT_LINK'); } if (in_array($type, array('nocomplete', 'nomailbox'))) { $sid = intval($sid); $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $sid)))->fetch(); if (empty($service) || $service['ACTIVE'] != 'Y' || !in_array($service['SERVICE_TYPE'], array('domain', 'crdomain'))) { return ''; } if ($service['SERVICE_TYPE'] == 'domain') { $result = CMailDomain2::getDomainStatus($service['TOKEN'], $service['SERVER'], $error); $stage = empty($result['stage']) ? null : $result['stage']; } else { $crResponse = CControllerClient::executeEvent('OnMailControllerCheckMemberDomain', array('DOMAIN' => $service['SERVER'])); $stage = empty($crResponse['result']['stage']) ? null : $crResponse['result']['stage']; } if ($type == 'nocomplete') { if (in_array($stage, array('owner-check', 'mx-check'))) { CEvent::send('INTRANET_MAILDOMAIN_NOCOMPLETE', array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); if ($cnt == 1) { global $pPERIOD; $pPERIOD = 3600 * 24 * 4; return 'CIntranetUtils::notifyMailDomain("nocomplete", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');'; } } } else { if ($stage == 'added') { $dbMailboxes = CMailbox::getList(array(), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $sid)); $adminMailbox = false; $userMailboxes = false; while ($arMailbox = $dbMailboxes->fetch()) { if ($arMailbox['USER_ID'] == $user_id) { $adminMailbox = true; } else { $userMailboxes = true; break; } } if (!$userMailboxes) { $eventType = $adminMailbox ? 'INTRANET_MAILDOMAIN_NOMAILBOX2' : 'INTRANET_MAILDOMAIN_NOMAILBOX'; CEvent::send($eventType, array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); if ($cnt == 1) { global $pPERIOD; $pPERIOD = 3600 * 24 * 21; return 'CIntranetUtils::notifyMailDomain("nomailbox", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');'; } } } } } else { if ($type == 'noreg') { $dbServices = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', 'SERVICE_TYPE' => 'crdomain'))); while ($service = $dbServices->fetch()) { if ($service['FLAGS'] & CMail::F_DOMAIN_REG) { return ''; } } $r = CEvent::send('INTRANET_MAILDOMAIN_NOREG', array($sid), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); } } return ''; }
function GetPublicViewHTML($arUserField, $id, $params = "", $settings = array(), $matches = array()) { if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) { return is_array($matches) ? $matches[0] : ''; } $set = array(); if (is_array($settings) && !empty($settings)) { if (array_key_exists("imageWidth", $settings) && array_key_exists("imageHeight", $settings)) { $set["MAX_SIZE"] = array("width" => $settings["imageWidth"], "height" => $settings["imageHeight"]); } if (array_key_exists("imageHtmlWidth", $settings) && array_key_exists("imageHtmlHeight", $settings)) { $set["HTML_SIZE"] = array("width" => $settings["imageHtmlWidth"], "height" => $settings["imageHtmlHeight"]); } } if ($params != '' && is_string($params) && preg_match_all("/(width|height)=(\\d+)/is", $params, $matches)) { $params = array_combine($matches[1], $matches[2]); } ob_start(); CWebDavInterface::UserFieldViewThumb($arParams = array("arUserField" => $arUserField, "arSettings" => $set, "MOBILE" => is_array($settings) && array_key_exists("bMobile", $settings) && $settings["bMobile"] ? "Y" : "N"), $arResult = array("VALUE" => array($id)), null, array($id => $params)); return ob_get_clean(); }
function CanUserOperateDocumentType($operation, $userId, $documentType, $parameters = array()) { $documentType = trim($documentType); if (strlen($documentType) <= 0) { return false; } $parameters["IBlockId"] = intval(substr($documentType, strlen("iblock_"))); $parameters['sectionId'] = !empty($parameters['sectionId']) ? (int) $parameters['sectionId'] : 0; if (!array_key_exists("IBlockRightsMode", $parameters)) { $parameters["IBlockRightsMode"] = CIBlock::getArrayByID($parameters["IBlockId"], "RIGHTS_MODE"); } if ($parameters["IBlockRightsMode"] === "E") { if ($operation === CBPCanUserOperateOperation::CreateWorkflow) { return CIBlockRights::userHasRightTo($parameters["IBlockId"], $parameters["IBlockId"], "iblock_rights_edit"); } elseif ($operation === CBPCanUserOperateOperation::WriteDocument) { return CIBlockSectionRights::userHasRightTo($parameters["IBlockId"], $parameters["sectionId"], "section_element_bind"); } elseif ($operation === CBPCanUserOperateOperation::ViewWorkflow || $operation === CBPCanUserOperateOperation::StartWorkflow) { if (!array_key_exists("WorkflowId", $parameters)) { return false; } if ($operation === CBPCanUserOperateOperation::ViewWorkflow) { return CIBlockRights::userHasRightTo($parameters["IBlockId"], 0, "element_read"); } if ($operation === CBPCanUserOperateOperation::StartWorkflow) { return CIBlockSectionRights::userHasRightTo($parameters["IBlockId"], $parameters['sectionId'], "section_element_bind"); } $userId = intval($userId); if (!array_key_exists("AllUserGroups", $parameters)) { if (!array_key_exists("UserGroups", $parameters)) { $parameters["UserGroups"] = CUser::getUserGroup($userId); } $parameters["AllUserGroups"] = $parameters["UserGroups"]; $parameters["AllUserGroups"][] = "Author"; } if (!array_key_exists("DocumentStates", $parameters)) { if ($operation === CBPCanUserOperateOperation::StartWorkflow) { $parameters["DocumentStates"] = CBPWorkflowTemplateLoader::getDocumentTypeStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"])); } else { $parameters["DocumentStates"] = CBPDocument::getDocumentStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"]), null); } } if (array_key_exists($parameters["WorkflowId"], $parameters["DocumentStates"])) { $parameters["DocumentStates"] = array($parameters["WorkflowId"] => $parameters["DocumentStates"][$parameters["WorkflowId"]]); } else { return false; } $allowableOperations = CBPDocument::getAllowableOperations($userId, $parameters["AllUserGroups"], $parameters["DocumentStates"], true); if (!is_array($allowableOperations)) { return false; } if ($operation === CBPCanUserOperateOperation::ViewWorkflow && in_array("read", $allowableOperations) || $operation === CBPCanUserOperateOperation::StartWorkflow && in_array("write", $allowableOperations)) { return true; } $chop = $operation === CBPCanUserOperateOperation::ViewWorkflow ? "element_read" : "section_element_bind"; $tasks = self::getRightsTasks(); foreach ($allowableOperations as $op) { if (isset($tasks[$op])) { $op = $tasks[$op]['ID']; } $ar = CTask::getOperations($op, true); if (in_array($chop, $ar)) { return true; } } } return false; } if (!array_key_exists("IBlockPermission", $parameters)) { if (CModule::includeModule('lists')) { $parameters["IBlockPermission"] = CLists::getIBlockPermission($parameters["IBlockId"], $userId); } else { $parameters["IBlockPermission"] = CIBlock::getPermission($parameters["IBlockId"], $userId); } } if ($parameters["IBlockPermission"] <= "R") { return false; } elseif ($parameters["IBlockPermission"] >= "W") { return true; } $userId = intval($userId); if (!array_key_exists("AllUserGroups", $parameters)) { if (!array_key_exists("UserGroups", $parameters)) { $parameters["UserGroups"] = CUser::getUserGroup($userId); } $parameters["AllUserGroups"] = $parameters["UserGroups"]; $parameters["AllUserGroups"][] = "Author"; } if (!array_key_exists("DocumentStates", $parameters)) { $parameters["DocumentStates"] = CBPDocument::getDocumentStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"]), null); } if (array_key_exists("WorkflowId", $parameters)) { if (array_key_exists($parameters["WorkflowId"], $parameters["DocumentStates"])) { $parameters["DocumentStates"] = array($parameters["WorkflowId"] => $parameters["DocumentStates"][$parameters["WorkflowId"]]); } else { return false; } } $allowableOperations = CBPDocument::getAllowableOperations($userId, $parameters["AllUserGroups"], $parameters["DocumentStates"]); if (!is_array($allowableOperations)) { return false; } $r = false; switch ($operation) { case CBPCanUserOperateOperation::ViewWorkflow: $r = in_array("read", $allowableOperations); break; case CBPCanUserOperateOperation::StartWorkflow: $r = in_array("write", $allowableOperations); break; case CBPCanUserOperateOperation::CreateWorkflow: $r = in_array("write", $allowableOperations); break; case CBPCanUserOperateOperation::WriteDocument: $r = in_array("write", $allowableOperations); break; case CBPCanUserOperateOperation::ReadDocument: $r = false; break; default: $r = false; } return $r; }
public static function OnAfterIBlockDelete($iblock_id) { if (CModule::includeModule('bizproc')) { BizProcDocument::deleteDataIblock($iblock_id); } }