• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Main\Loader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Bitrix\Main\Loader的典型用法代码示例。如果您正苦于以下问题:PHP Loader类的具体用法?PHP Loader怎么用?PHP Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Loader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: connectInternal

 /**
  * Establishes a connection to the database.
  * Includes php_interface/after_connect_d7.php on success.
  * Throws exception on failure.
  *
  * @return void
  * @throws \Bitrix\Main\DB\ConnectionException
  */
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     $connectionInfo = array("UID" => $this->login, "PWD" => $this->password, "Database" => $this->database, "ReturnDatesAsStrings" => true);
     if (($this->options & self::PERSISTENT) != 0) {
         $connectionInfo["ConnectionPooling"] = true;
     } else {
         $connectionInfo["ConnectionPooling"] = false;
     }
     $connection = sqlsrv_connect($this->host, $connectionInfo);
     if (!$connection) {
         throw new ConnectionException('MS Sql connect error', $this->getErrorMessage());
     }
     $this->resource = $connection;
     $this->isConnected = true;
     // hide cautions
     sqlsrv_configure("WarningsReturnAsErrors", 0);
     /** @noinspection PhpUnusedLocalVariableInspection */
     global $DB, $USER, $APPLICATION;
     if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:33,代码来源:mssqlconnection.php


示例2: checkParams

 protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
 {
     if (\Bitrix\Main\Loader::includeModule('forum')) {
         $arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
         if (empty($arTopic)) {
             return false;
         }
         $arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
         if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
             $arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
             $date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
             $result = array();
             foreach ($arSitemaps as $arSitemap) {
                 $path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
                 if (!empty($path)) {
                     $arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
                     $arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
                     $arSitemap["date"] = $date;
                     $result[] = $arSitemap;
                 }
             }
             return empty($result) ? false : $result;
         }
     }
     return false;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:26,代码来源:sitemapforum.php


示例3: uninstallDB

 public function uninstallDB()
 {
     if (Loader::includeModule($this->MODULE_ID)) {
         $connection = Application::getInstance()->getConnection();
         $connection->dropTable(ExampleTable::getTableName());
     }
 }
开发者ID:rbaklanov,项目名称:bex.d7dull,代码行数:7,代码来源:index.php


示例4: onPrepareComponentParams

 public function onPrepareComponentParams($arParams)
 {
     $arParams['ERROR'] = array();
     if (!Loader::includeModule('lists') || !Loader::includeModule('bizproc')) {
         $arParams['ERROR'][] = Loc::getMessage('CC_BLL_MODULE_NOT_INSTALLED');
         return $arParams;
     }
     global $USER;
     $arParams['LIST_PERM'] = CListPermissions::CheckAccess($USER, COption::GetOptionString("lists", "livefeed_iblock_type_id"), false);
     if ($arParams['LIST_PERM'] < 0) {
         switch ($arParams['LIST_PERM']) {
             case CListPermissions::WRONG_IBLOCK_TYPE:
                 $arParams['ERROR'][] = Loc::getMessage("CC_BLL_WRONG_IBLOCK_TYPE");
                 break;
             case CListPermissions::WRONG_IBLOCK:
                 $arParams['ERROR'][] = Loc::getMessage("CC_BLL_WRONG_IBLOCK");
                 break;
             case CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
                 $arParams['ERROR'][] = Loc::getMessage("CC_BLL_LISTS_FOR_SONET_GROUP_DISABLED");
                 break;
             default:
                 $arParams['ERROR'][] = Loc::getMessage("CC_BLL_UNKNOWN_ERROR");
                 break;
         }
     } elseif ($arParams['LIST_PERM'] <= CListPermissions::ACCESS_DENIED) {
         $arParams['ERROR'][] = Loc::getMessage("CC_BLL_ACCESS_DENIED");
     }
     $arParams['IBLOCK_TYPE_ID'] = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     return $arParams;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:class.php


示例5: checkRequiredModules

	/**
	 * Function checks if required modules installed. If not, throws an exception
	 * @return void
	 */
	protected static function checkRequiredModules()
	{
		if (!Loader::includeModule('sale'))
			$this->errors['FATAL'][] = Loc::getMessage("SALE_SLS_SALE_MODULE_NOT_INSTALL");

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:11,代码来源:class.php


示例6: filter

 public function filter()
 {
     \Bitrix\Main\Loader::includeModule('sale');
     $daysBasketForgotten = $this->getFieldValue('DAYS_BASKET_FORGOTTEN');
     if (!is_numeric($daysBasketForgotten)) {
         $daysBasketForgotten = 90;
     }
     $dateFrom = new \Bitrix\Main\Type\DateTime();
     $dateTo = new \Bitrix\Main\Type\DateTime();
     $dateFrom->setTime(0, 0, 0)->add('-' . $daysBasketForgotten . ' days');
     $dateTo->setTime(0, 0, 0)->add('1 days')->add('-' . $daysBasketForgotten . ' days');
     if ($this->isRunForOldData()) {
         $filter = array('<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT));
     } else {
         $filter = array('>MIN_DATE_INSERT' => $dateFrom->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT), '<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT));
     }
     $filter = $filter + array('!FUSER.USER_ID' => null, '=ORDER_ID' => null, '=LID' => $this->getSiteId());
     $userListDb = \Bitrix\Sale\BasketTable::getList(array('select' => array('USER_ID' => 'FUSER.USER_ID', 'EMAIL' => 'FUSER.USER.EMAIL', 'FUSER_USER_NAME' => 'FUSER.USER.NAME'), 'filter' => $filter, 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('MIN_DATE_INSERT', 'MIN(%s)', 'DATE_INSERT')), 'order' => array('USER_ID' => 'ASC')));
     if ($userListDb->getSelectedRowsCount() > 0) {
         $userListDb->addFetchDataModifier(array($this, 'getFetchDataModifier'));
         $this->recipient = $userListDb;
         return true;
     } else {
         return false;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:triggerbasketforgotten.php


示例7: onExecuteStartWriting

 function onExecuteStartWriting(\Bitrix\Main\Event $event)
 {
     $parameters = $event->getParameters();
     $userId = $parameters[0];
     $dialogId = $parameters[1] . $parameters[2];
     if ($userId > 0) {
         if (!\Bitrix\Main\Loader::includeModule('pull')) {
             return;
         }
         \CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
         if (intval($dialogId) > 0) {
             \CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
         } elseif (substr($dialogId, 0, 4) == 'chat') {
             $chatId = substr($dialogId, 4);
             $arRelation = \CIMChat::GetRelationById($chatId);
             unset($arRelation[$userId]);
             $pullMessage = array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId));
             \CPullStack::AddByUsers(array_keys($arRelation), $pullMessage);
             $orm = \Bitrix\Im\ChatTable::getById($chatId);
             $chat = $orm->fetch();
             if ($chat['TYPE'] == IM_MESSAGE_OPEN) {
                 \CPullWatch::AddToStack('IM_PUBLIC_' . $chatId, $pullMessage);
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:startwritinghandler.php


示例8: getDirStructure

 public static function getDirStructure($bLogical, $site, $path)
 {
     global $USER;
     $arDirContent = array();
     if ($USER->CanDoFileOperation('fm_view_listing', array($site, $path))) {
         \Bitrix\Main\Loader::includeModule('fileman');
         $arDirs = array();
         $arFiles = array();
         \CFileMan::GetDirList(array($site, $path), $arDirs, $arFiles, array(), array("NAME" => "asc"), "DF", $bLogical, true);
         $arDirContent_t = array_merge($arDirs, $arFiles);
         for ($i = 0, $l = count($arDirContent_t); $i < $l; $i++) {
             $file = $arDirContent_t[$i];
             $arPath = array($site, $file['ABS_PATH']);
             if ($file["TYPE"] == "F" && !$USER->CanDoFileOperation('fm_view_file', $arPath) || $file["TYPE"] == "D" && !$USER->CanDoFileOperation('fm_view_listing', $arPath) || $file["TYPE"] == "F" && $file["NAME"] == ".section.php") {
                 continue;
             }
             $f = $file['TYPE'] == 'F' ? new \Bitrix\Main\IO\File($file['PATH'], $site) : new \Bitrix\Main\IO\Directory($file['PATH'], $site);
             $p = $f->getName();
             if ($f->isSystem() || $file['TYPE'] == 'F' && in_array($p, array("urlrewrite.php")) || $file['TYPE'] == 'D' && preg_match("/\\/(bitrix|" . \COption::getOptionString("main", "upload_dir", "upload") . ")\\//", "/" . $p . "/")) {
                 continue;
             }
             $arFileData = array('NAME' => $bLogical ? $file['LOGIC_NAME'] : $p, 'FILE' => $p, 'TYPE' => $file['TYPE'], 'DATA' => $file);
             if (strlen($arFileData['NAME']) <= 0) {
                 $arFileData['NAME'] = GetMessage('SEO_DIR_LOGICAL_NO_NAME');
             }
             $arDirContent[] = $arFileData;
         }
         unset($arDirContent_t);
     }
     return $arDirContent;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:seo_utils.php


示例9: __construct

 /**
  * @param array $config
  */
 public function __construct(array $config = null)
 {
     Loader::includeModule('highloadblock');
     if ($config) {
         $this->config($config);
     }
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:10,代码来源:HighLoadIb.php


示例10: onMessageAdd

 /**
  * Increments conversion post day counter
  *
  * @param int $id Topic ID.
  * @param array $message Message fields.
  * @param array $topicInfo Message TOPIC_INFO field.
  * @param array $forumInfo Message FORUM_INFO field.
  * @param array $fields Message fields used to insert.
  * @return void
  */
 public static function onMessageAdd($id, $message, $topicInfo, $forumInfo, $fields)
 {
     if (Loader::includeModule('conversion')) {
         $context = DayContext::getInstance();
         $context->addDayCounter('forum_post_add_day', 1);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:conversionhandlers.php


示例11: getPropDirectory

function getPropDirectory(&$property)
{
    if (empty($property)) {
        return false;
    }
    if (!is_array($property)) {
        return false;
    }
    if (!isset($property['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($property['USER_TYPE_SETTINGS']['TABLE_NAME'])) {
        return false;
    }
    $highLoadInclude = \Bitrix\Main\Loader::includeModule('highloadblock');
    $highBlock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array("filter" => array('TABLE_NAME' => $property['USER_TYPE_SETTINGS']['TABLE_NAME'])))->fetch();
    if (!isset($highBlock['ID'])) {
        return false;
    }
    $entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($highBlock);
    $entityDataClass = $entity->getDataClass();
    $entityList = $entityDataClass::getList();
    while ($arEntityItem = $entityList->Fetch()) {
        $val =& $property["VALUES"][$arEntityItem["UF_XML_ID"]];
        //foreach($property["VALUES"] as &$val){
        if (!empty($arEntityItem["UF_FILE"])) {
            $property["PICTURE_INCLUDED"] = true;
            $arEntityItem["~UF_FILE"] = $arEntityItem["UF_FILE"];
            $arEntityItem["PICTURE"] = CFile::GetPath($arEntityItem["~UF_FILE"]);
        }
        if (!empty($arEntityItem)) {
            $val = array_merge($val, $arEntityItem);
        }
        //}
        //echo'<pre>';print_r($arEntityItem);echo'</pre>';
    }
    return true;
}
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:35,代码来源:functions.php


示例12: OnBasketAddHandler

function OnBasketAddHandler($ID, $arFields)
{
    global $USER;
    \Bitrix\Main\Loader::includeModule('catalog');
    \Bitrix\Main\Loader::includeModule('sale');
    if ($USER->IsAuthorized()) {
        $arFilter = array("USER_ID" => $USER->GetID());
        $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
        $arrCount = [];
        while ($ar_sales = $db_sales->Fetch()) {
            $arrCount[] = $ar_sales;
        }
        if (is_array($arrCount) == false) {
            $res = CCatalogDiscount::SetCoupon('SL-CDUEA-HI8MMPY');
            //3%
        } else {
            if (count($arrCount) >= 1) {
                $resClean = CCatalogDiscount::ClearCoupon('SL-CDUEA-HI8MMPY');
                $res5 = CCatalogDiscount::SetCoupon('SL-0JG2C-XIHBEYZ');
                //5%
            } else {
            }
        }
    } else {
        $res = CCatalogDiscountCoupon::SetCoupon('SL-CDUEA-HI8MMPY');
        //3%
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:28,代码来源:CCatalogDiscount.php


示例13: isDesktopImOnline

 /**
  * Checks online status of IM.
  * @return bool
  */
 public static function isDesktopImOnline()
 {
     if (!Loader::includeModule('im')) {
         return false;
     }
     return \CIMMessenger::checkDesktopStatusOnline();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:desktop.php


示例14: initClassesList

 public static function initClassesList()
 {
     if (static::$classes !== null) {
         return true;
     }
     $classes = array('\\Bitrix\\Sale\\Delivery\\ExtraServices\\Enum' => 'lib/delivery/extra_services/enum.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store' => 'lib/delivery/extra_services/store.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\String' => 'lib/delivery/extra_services/string.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Checkbox' => 'lib/delivery/extra_services/checkbox.php');
     \Bitrix\Main\Loader::registerAutoLoadClasses('sale', $classes);
     unset($classes['\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store']);
     static::$classes = array_keys($classes);
     $event = new Event('sale', 'onSaleDeliveryExtraServicesClassNamesBuildList');
     $event->send();
     $resultList = $event->getResults();
     if (is_array($resultList) && !empty($resultList)) {
         $customClasses = array();
         foreach ($resultList as $eventResult) {
             /** @var  EventResult $eventResult*/
             if ($eventResult->getType() != EventResult::SUCCESS) {
                 throw new SystemException("Can't add custom tracking class successfully");
             }
             $params = $eventResult->getParameters();
             if (!empty($params) && is_array($params)) {
                 $customClasses = array_merge($customClasses, $params);
             }
         }
         if (!empty($customClasses)) {
             \Bitrix\Main\Loader::registerAutoLoadClasses(null, $customClasses);
             $classes = array_merge($customClasses, $classes);
         }
     }
     static::$classes = array_merge(array_keys($classes), static::$classes);
     return static::$classes;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:manager.php


示例15: getMap

 /**
  * Returns entity map definition.
  *
  * @return array
  */
 public static function getMap()
 {
     \Bitrix\Main\Loader::includeModule('iblock');
     $metadata = ElementTable::getMetadata(static::$_iblockId);
     $map = array('IBLOCK_ELEMENT_ID' => array('data_type' => 'integer', 'primary' => true));
     foreach ($metadata['props'] as $arProp) {
         //            if ($arProp['MULTIPLE'] == 'Y') {
         //                continue;
         //            }
         switch ($arProp['PROPERTY_TYPE']) {
             case 'N':
                 $map[] = new Entity\FloatField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
             case 'L':
             case 'E':
             case 'G':
                 $map[] = new IntegerField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
             case 'S':
             default:
                 $map[] = new Entity\StringField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
         }
     }
     return $map;
 }
开发者ID:chupo22,项目名称:bxtools,代码行数:31,代码来源:SinglePropertyElementTable.php


示例16: getTabs

 public static function getTabs($iblockElementInfo)
 {
     $showTab = false;
     $request = Context::getCurrent()->getRequest();
     if ($iblockElementInfo["ID"] > 0 && (!isset($request['action']) || $request['action'] != 'copy')) {
         $showTab = true;
         if (Loader::includeModule('catalog')) {
             /*
             				$dbRes = CatalogIblockTable::getList(array(
             					'filter' => array(
             						'=IBLOCK_ID' => $iblockElementInfo["IBLOCK"]["ID"],
             						'!PRODUCT_IBLOCK_ID' => 0
             					),
             					'select' => array('IBLOCK_ID'),
             				));
             				if($dbRes->fetch())
             				{
             					$showTab = false;
             				}
             */
             if (\CCatalogSku::getInfoByOfferIBlock($iblockElementInfo["IBLOCK"]["ID"]) !== false) {
                 $showTab = false;
             }
         }
     }
     return $showTab ? array(array("DIV" => "seo_adv", "SORT" => 4, "TAB" => Loc::getMessage("SEO_ADV_TAB"), "TITLE" => Loc::getMessage("SEO_ADV_TAB_TITLE"))) : null;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:advtabengine.php


示例17: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!Loader::includeModule('search')) {
         throw new BitrixException('Search module is not installed');
     }
     $searchResult = array();
     $bar = new ProgressBar($output, 0);
     do {
         $bar->display();
         $searchResult = \CSearch::ReIndexAll($input->getOption('full'), static::UPDATE_TIME, $searchResult);
         $bar->advance();
         $bar->clear();
         if (is_array($searchResult) && $searchResult['MODULE'] == 'main') {
             list(, $path) = explode("|", $searchResult["ID"], 2);
             $output->writeln("\r       " . $path, OutputInterface::VERBOSITY_VERBOSE);
         }
     } while (is_array($searchResult));
     $bar->finish();
     $bar->clear();
     $output->write("\r");
     if (ModuleManager::isModuleInstalled('socialnetwork')) {
         $output->writeln('<info>The Social Network module needs to be reindexed using the Social Network component in the public section of site.</info>');
     }
     $output->writeln(sprintf('<info>Reindexed</info> %d element%s.', $searchResult, $searchResult > 1 ? 's' : ''));
     return 0;
 }
开发者ID:notamedia,项目名称:console-jedi,代码行数:29,代码来源:ReIndexCommand.php


示例18: getJobName

 public static function getJobName($id)
 {
     if (empty($id)) {
         return false;
     }
     $result = false;
     $obCache = new CPHPCache();
     $dir = '/companies/names';
     if ($obCache->InitCache(9999999999, md5($id), $dir)) {
         $result = $obCache->GetVars();
     } elseif ($obCache->StartDataCache() && \Bitrix\Main\Loader::includeModule('iblock')) {
         if ($result = CIBlockElement::GetByID($id)->Fetch()) {
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->StartTagCache($dir);
                 $GLOBALS['CACHE_MANAGER']->RegisterTag('iblock_id_' . $result['IBLOCK_ID']);
             }
             $result = $result['NAME'];
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->EndTagCache();
             }
         }
         $obCache->EndDataCache($result);
     }
     return $result;
 }
开发者ID:Tvaruga,项目名称:ae,代码行数:25,代码来源:CInc.php


示例19: DoInstall

 function DoInstall() {
     global $APPLICATION, $data;
     $loc = \WS\Migrations\Module::getInstance()->getLocalization('setup');
     $options = \WS\Migrations\Module::getInstance()->getOptions();
     global $errors;
     $errors = array();
     if ($data['catalog']) {
         $dir = $_SERVER['DOCUMENT_ROOT'].$data['catalog'];
         if (!is_dir($dir)) {
             mkdir($dir);
         }
         if (!is_dir($dir)) {
             $errors[] = $loc->getDataByPath('error.notCreateDir');
         }
         if (!$errors) {
             $options->catalogPath = $data['catalog'];
         }
         $this->InstallFiles();
         $this->InstallDB();
         RegisterModule(self::MODULE_ID);
         \Bitrix\Main\Loader::includeModule(self::MODULE_ID);
         \Bitrix\Main\Loader::includeModule('iblock');
         \WS\Migrations\Module::getInstance()->install();
     }
     if (!$data || $errors) {
         $APPLICATION->IncludeAdminFile($loc->getDataByPath('title'), __DIR__.'/form.php');
         return;
     }
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:29,代码来源:index.php


示例20: getSecurityContextByUser

 /**
  * Gets security context (access provider) for user.
  * Attention! File/Folder can use anywhere and SecurityContext have to check rights anywhere (any module).
  * @param mixed $user User which use for check rights.
  * @return SecurityContext
  */
 public function getSecurityContextByUser($user)
 {
     if ($this->isCurrentUser($user)) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if (Loader::includeModule('socialnetwork') && \CSocnetUser::isCurrentUserModuleAdmin()) {
             return new FakeSecurityContext($user);
         }
         if (UserModel::isCurrentUserAdmin()) {
             return new FakeSecurityContext($user);
         }
     } else {
         $userId = UserModel::resolveUserId($user);
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if ($userId && Loader::includeModule('socialnetwork') && \CSocnetUser::isUserModuleAdmin($userId)) {
             return new FakeSecurityContext($user);
         }
         try {
             if ($userId && ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24') && \CBitrix24::isPortalAdmin($userId)) {
                 return new FakeSecurityContext($user);
             } elseif ($userId) {
                 //Check user group 1 ('Admins')
                 $tmpUser = new \CUser();
                 $arGroups = $tmpUser->getUserGroup($userId);
                 if (in_array(1, $arGroups)) {
                     return new FakeSecurityContext($user);
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return new DiskSecurityContext($user);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:disk.php



注:本文中的Bitrix\Main\Loader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Main\ModuleManager类代码示例发布时间:2022-05-23
下一篇:
PHP Main\HttpApplication类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap