本文整理汇总了PHP中CAccess类的典型用法代码示例。如果您正苦于以下问题:PHP CAccess类的具体用法?PHP CAccess怎么用?PHP CAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filesBulletinAdd
public static function filesBulletinAdd($userId, $bulletinId)
{
if ($userId == 0) {
CAccess::setError('blockUnregister');
return false;
}
$table = JTable::getInstance('Bulletin', 'CTable');
$table->load($bulletinId);
//CFactory::load( 'libraries' , 'limits' );
$groupModel = CFactory::getModel('groups');
$bulletinParams = $table->getParams();
if (!CLimitsHelper::exceededGroupFileUpload($table->groupid)) {
return false;
}
if (CLimitsLibrary::exceedDaily('files', $userId)) {
return false;
}
if (COwnerHelper::isCommunityAdmin() || $groupModel->isAdmin($userId, $table->groupid) || $groupModel->isMember($userId, $table->groupid) && $bulletinParams->get('filepermission-member')) {
return true;
}
return false;
}
示例2: _check_rights_sql
function _check_rights_sql($min_permission)
{
global $DB, $USER;
$min_permission = (strlen($min_permission)==1) ? $min_permission : "R";
if(is_object($USER))
{
$iUserID = intval($USER->GetID());
$strGroups = $USER->GetGroups();
$bAuthorized = $USER->IsAuthorized();
}
else
{
$iUserID = 0;
$strGroups = "2";
$bAuthorized = false;
}
$stdPermissions = "
SELECT IBLOCK_ID
FROM b_iblock_group IBG
WHERE IBG.GROUP_ID IN (".$strGroups.")
AND IBG.PERMISSION >= '".$DB->ForSQL($min_permission)."'
";
if(!defined("ADMIN_SECTION"))
$stdPermissions .= "
AND (IBG.PERMISSION='X' OR B.ACTIVE='Y')
";
if($min_permission >= "X")
$operation = 'section_rights_edit';
elseif($min_permission >= "W")
$operation = 'section_edit';
elseif($min_permission >= "R")
$operation = 'section_read';
else
$operation = '';
if($operation)
{
$acc = new CAccess;
$acc->UpdateCodes();
}
if($operation == "section_read")
{
$extPermissions = "
SELECT SR.SECTION_ID
FROM b_iblock_section_right SR
INNER JOIN b_iblock_right IBR ON IBR.ID = SR.RIGHT_ID
".($iUserID > 0? "LEFT": "INNER")." JOIN b_user_access UA ON UA.ACCESS_CODE = IBR.GROUP_CODE AND UA.USER_ID = ".$iUserID."
WHERE SR.SECTION_ID = BS.ID
AND IBR.OP_SREAD = 'Y'
".($bAuthorized || $iUserID > 0? "
AND (UA.USER_ID IS NOT NULL
".($bAuthorized? "OR IBR.GROUP_CODE = 'AU'": "")."
".($iUserID > 0? "OR (IBR.GROUP_CODE = 'CR' AND BS.CREATED_BY = ".$iUserID.")": "")."
)": "")."
";
$strResult = "(
B.ID IN ($stdPermissions)
OR (B.RIGHTS_MODE = 'E' AND EXISTS ($extPermissions))
)";
}
elseif($operation)
{
$extPermissions = "
SELECT SR.SECTION_ID
FROM b_iblock_section_right SR
INNER JOIN b_iblock_right IBR ON IBR.ID = SR.RIGHT_ID
INNER JOIN b_task_operation T ON T.TASK_ID = IBR.TASK_ID
INNER JOIN b_operation O ON O.ID = T.OPERATION_ID
".($iUserID > 0? "LEFT": "INNER")." JOIN b_user_access UA ON UA.ACCESS_CODE = IBR.GROUP_CODE AND UA.USER_ID = ".$iUserID."
WHERE SR.SECTION_ID = BS.ID
AND O.NAME = '".$operation."'
".($bAuthorized || $iUserID > 0? "
AND (UA.USER_ID IS NOT NULL
".($bAuthorized? "OR IBR.GROUP_CODE = 'AU'": "")."
".($iUserID > 0? "OR (IBR.GROUP_CODE = 'CR' AND BS.CREATED_BY = ".$iUserID.")": "")."
)": "")."
";
$strResult = "(
B.ID IN ($stdPermissions)
OR (B.RIGHTS_MODE = 'E' AND EXISTS ($extPermissions))
)";
}
else
{
$strResult = "(
B.ID IN ($stdPermissions)
)";
}
return $strResult;
}
示例3: LocalRedirect
}
Bitrix\Security\Mfa\Otp::setMandatoryUsing($_POST['otp_mandatory_using'] === 'Y');
if (is_array($_POST['otp_mandatory_rights'])) {
Bitrix\Security\Mfa\Otp::setMandatoryRights($_POST['otp_mandatory_rights']);
}
if ($_REQUEST["save"] != "" && $_GET["return_url"] != "") {
LocalRedirect($_GET["return_url"]);
} else {
LocalRedirect("/bitrix/admin/security_otp.php?lang=" . LANGUAGE_ID . $returnUrl . "&" . $tabControl->ActiveTabParam());
}
}
$availableTypes = \Bitrix\Security\Mfa\Otp::getAvailableTypes();
$availableTypesDescription = \Bitrix\Security\Mfa\Otp::getTypesDescription();
$defaultType = \Bitrix\Security\Mfa\Otp::getDefaultType();
$targetRights = \Bitrix\Security\Mfa\Otp::getMandatoryRights();
$access = new CAccess();
$targetRightsNames = $access->GetNames($targetRights);
CJSCore::Init(array('access'));
$APPLICATION->AddHeadScript('/bitrix/js/security/admin/page/otp.js');
$APPLICATION->SetTitle(GetMessage("SEC_OTP_NEW_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if (CSecurityUser::isActive()) {
$messageType = "OK";
$messageText = GetMessage("SEC_OTP_NEW_ON");
} else {
$messageType = "ERROR";
$messageText = GetMessage("SEC_OTP_NEW_OFF");
}
CAdminMessage::ShowMessage(array("MESSAGE" => $messageText, "TYPE" => $messageType, "HTML" => true));
?>
示例4: intval
$cacheId .= "_" . $arResult["TZ_OFFSET"];
}
$cacheDir = '/blog/socnet_post/gen/' . intval($arParams["ID"] / 100) . '/' . $arParams["ID"];
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
$arPost = $obCache->GetVars();
} else {
$obCache->StartDataCache();
$dbPost = CBlogPost::GetList(array(), array("ID" => $arParams["ID"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR_ID", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
$arPost = $dbPost->Fetch();
$obCache->EndDataCache($arPost);
}
if (!empty($arPost) && ($arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && !in_array($arParams["TYPE"], array("DRAFT", "MODERATION")))) {
unset($arPost);
}
$a = new CAccess();
$a->UpdateCodes();
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y" || $arResult["bFromList"]) {
if (!empty($arPost)) {
if (($arParams["GET_FOLLOW"] == "Y" && (!array_key_exists("FOLLOW", $arParams) || strlen($arParams["FOLLOW"]) <= 0) || intval($arParams["LOG_ID"]) <= 0) && CModule::IncludeModule("socialnetwork")) {
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_micro", "blog_post_important"), "SOURCE_ID" => $arParams["ID"], "SITE_ID" => CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() ? SITE_ID : array(SITE_ID, false)), false, false, $arParams["GET_FOLLOW"] == "Y" ? array("ID", "FOLLOW", "FAVORITES_USER_ID") : array("ID", "FAVORITES_USER_ID"), $arParams["GET_FOLLOW"] == "Y" ? array("USE_FOLLOW" => "Y") : array());
if ($arLogSrc = $rsLogSrc->Fetch()) {
$arParams["LOG_ID"] = $arLogSrc["ID"];
$arParams["FAVORITES_USER_ID"] = $arLogSrc["FAVORITES_USER_ID"];
if ($arParams["GET_FOLLOW"] == "Y") {
$arParams["FOLLOW"] = $arLogSrc["FOLLOW"];
}
} elseif (!$arResult["bFromList"]) {
$bNoLogEntry = true;
}
}
示例5: array
{
$arAllOptions["main"][] = array('note'=>GetMessage("MAIN_OPT_TIME_ZONE_NOTE"));
}
$arAllOptions["main"][] = GetMessage("main_options_map");
$arAllOptions["main"][] = Array("map_top_menu_type", GetMessage("MAIN_TOP_MENU_TYPE"), "top", Array("text", 30));
$arAllOptions["main"][] = Array("map_left_menu_type", GetMessage("MAIN_LEFT_MENU_TYPE"), "left", Array("text", 30));
//show public panel for users
CJSCore::Init(array('access'));
$arCodes = unserialize(COption::GetOptionString("main", "show_panel_for_users"));
if(!is_array($arCodes))
$arCodes = array();
$access = new CAccess();
$arNames = $access->GetNames($arCodes);
$arSel = array();
foreach($arCodes as $code)
$arSel[$code] = true;
$panel = "
<script type=\"text/javascript\">
BX.Access.Init({
other: {disabled:true}
});
BX.Access.SetSelected(".CUtil::PhpToJSObject($arSel).");
示例6: GetAccessCodes
/**
* @return array of access codes, includes AU symbol (if user is authorized)
*/
protected function GetAccessCodes($isUseCache = false)
{
global $USER;
static $cache = array();
$isNeedCAccessUpdate = true;
if ($isUseCache) {
// Cache hits?
if (isset($cache['str' . $this->userId])) {
return $cache['str' . $this->userId];
}
// Prevent call CAccess->UpdateCodes() multiple times per hit,
// except long time period (three seconds) expired.
if ($this->CAccessLastUpdated === false || microtime(true) - $this->CAccessLastUpdated > 3) {
$isNeedCAccessUpdate = true;
} else {
$isNeedCAccessUpdate = false;
}
} else {
$isNeedCAccessUpdate = true;
}
if ($isNeedCAccessUpdate) {
$oAcc = new CAccess();
$oAcc->UpdateCodes();
if ($isUseCache) {
$this->CAccessLastUpdated = microtime(true);
}
unset($oAcc);
}
$rc = CAccess::GetUserCodes($this->userId);
if ($rc === false) {
throw new LearnException('', LearnException::EXC_ERR_ALL_GIVEUP | LearnException::EXC_ERR_ALL_ACCESS_DENIED);
}
$arData = array();
while ($arItem = $rc->Fetch()) {
if ((int) $arItem['USER_ID'] !== $this->userId) {
throw new LearnException('', LearnException::EXC_ERR_ALL_GIVEUP | LearnException::EXC_ERR_ALL_LOGIC | LearnException::EXC_ERR_ALL_ACCESS_DENIED);
}
$arData[] = $arItem['ACCESS_CODE'];
}
if (is_object($USER) && $this->userId === (int) $USER->GetID()) {
$arData[] = 'AU';
}
// Cache in case when $isUseCache === false too.
// Because, this will refresh cache, if it exists before.
$cache['str' . $this->userId] = $arData;
return $arData;
}
示例7: GetFormHtml
public function GetFormHtml($arParams = false)
{
global $USER;
if (is_array($arParams["socnetgroups"]) && $arParams["socnetgroups"]["disabled"] == "true") {
return false;
}
$currElements = '';
if (is_array($arParams[$this->id]) && ($group_id = intval($arParams[$this->id]["group_id"])) > 0) {
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
$arFilter = array("ID" => $group_id, "ACTIVE" => "Y");
if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
$arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
}
$rsGroups = CSocNetGroup::GetList(array(), $arFilter);
if ($arGroup = $rsGroups->Fetch()) {
$arItem = array("ID" => "SG" . $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION'], "OPEN" => "Y", "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
if ($arGroup["IMAGE_ID"]) {
$imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$arItem["AVATAR"] = $arFileTmp["src"];
}
}
$currElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
$elements = "";
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 3);
$arLRU = CAccess::GetLastRecentlyUsed($this->id);
if (!empty($arLRU)) {
$arLast = array();
$arLastID = array();
$arElements = array();
foreach ($arLRU as $val) {
if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
$arLast[$match[2]][$match[1]] = $match[1];
$arLastID[$match[1]] = $match[1];
}
}
if (!empty($arLastID)) {
$arFilter = array("ID" => $arLastID, "ACTIVE" => "Y");
if ($arParams["SITE_ID"] != '') {
$arFilter["SITE_ID"] = $arParams["SITE_ID"];
}
if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
$arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
}
$rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
while ($arGroup = $rsGroups->Fetch()) {
$arItem = array("ID" => $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION']);
if ($arGroup["IMAGE_ID"]) {
$imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$arItem["AVATAR"] = $arFileTmp["src"];
}
}
$arElements[$arItem['ID']] = $arItem;
}
foreach ($arLRU as $val) {
if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
$arItem = $arElements[$match[1]];
if ($match[2] == 'K') {
$arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_K';
$arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_k");
} else {
if ($match[2] == 'E') {
$arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_E';
$arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_e");
} else {
if ($match[2] == 'A') {
$arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_A';
$arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_a");
}
}
}
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
}
}
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
$arFilter = array("USER_ID" => $USER->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_ACTIVE" => "Y");
if ($arParams["SITE_ID"] != '') {
$arFilter["GROUP_SITE_ID"] = $arParams["SITE_ID"];
}
$rsGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arFilter, false, array(), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID"));
$myElements = '';
while ($arGroup = $rsGroups->Fetch()) {
$arItem = array("ID" => "SG" . $arGroup['GROUP_ID'], "AVATAR" => $arGroup['GROUP_IMAGE_ID'], "NAME" => $arGroup['GROUP_NAME'], "DESC" => $arGroup['GROUP_DESCRIPTION'], "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
if ($arGroup["GROUP_IMAGE_ID"]) {
$imageFile = CFile::GetFileArray($arGroup["GROUP_IMAGE_ID"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$arItem["AVATAR"] = $arFileTmp["src"];
}
}
$myElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
$arPanels = array();
//.........这里部分代码省略.........
示例8: groupsBulletinView
public static function groupsBulletinView($userId, $bullentinId)
{
$config = CFactory::getConfig();
if (!$config->get('enablegroups')) {
CAccess::setError(JText::_('COM_COMMUNITY_GROUPS_DISABLE'));
return false;
} else {
return true;
}
}
示例9: GetAccessCodes
function GetAccessCodes()
{
if (!$this->IsAuthorized()) {
return array('G2');
}
static $arCodes = array();
$USER_ID = intval($this->GetID());
if (!array_key_exists($USER_ID, $arCodes)) {
$access = new CAccess();
$access->UpdateCodes();
$arCodes[$USER_ID] = CAccess::GetUserCodesArray($USER_ID);
if ($this->IsAuthorized()) {
$arCodes[$USER_ID][] = "AU";
}
}
return $arCodes[$USER_ID];
}
示例10: 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;
}
示例11: GetOperations
public static function GetOperations($sectId, $userId = false)
{
global $USER;
if (!$userId) {
$userId = intVal($USER->GetId());
}
$arCodes = array();
$rCodes = CAccess::GetUserCodes($userId);
while ($code = $rCodes->Fetch()) {
$arCodes[] = $code['ACCESS_CODE'];
}
if (!in_array('G2', $arCodes)) {
$arCodes[] = 'G2';
}
$key = $sectId . '|' . implode(',', $arCodes);
if (self::$bClearOperationCache || !is_array(self::$arOp[$key])) {
if (!isset(self::$Permissions[$sectId])) {
self::GetArrayPermissions(array($sectId));
}
$perms = self::$Permissions[$sectId];
self::$arOp[$key] = array();
if (is_array($perms)) {
foreach ($perms as $code => $taskId) {
if (in_array($code, $arCodes)) {
self::$arOp[$key] = array_merge(self::$arOp[$key], CTask::GetOperations($taskId, true));
}
}
}
}
return self::$arOp[$key];
}
示例12: LearningShowRights
protected static function LearningShowRights($lessonId, $variable_name, $arBaseRights, $arPossibleRights, $arActualRights, $arSelected = array(), $arHighLight = array(), $readOnly)
{
$js_var_name = preg_replace("/[^a-zA-Z0-9_]/", "_", $variable_name);
$html_var_name = htmlspecialcharsbx($variable_name);
$sSelect = '<select name="' . $html_var_name . '[][TASK_ID]" style="vertical-align:middle">';
foreach ($arPossibleRights as $taskId => $arRightsData) {
$selected = '';
if (strtoupper($arRightsData['name']) === 'LEARNING_LESSON_ACCESS_DENIED') {
$selected = ' selected="selected" ';
}
$sSelect .= '<option value="' . (int) $taskId . '" ' . $selected . '>' . htmlspecialcharsex($arRightsData['name_human']) . '</option>';
}
$sSelect .= '</select>';
$table_id = $variable_name . "_table";
$href_id = $variable_name . "_href";
CJSCore::Init(array('access'));
?>
<tr>
<td colspan="2" align="center">
<input type="hidden" name="<?php
echo $variable_name . '_marker';
?>
" value='yeah!'>
<script type="text/javascript">
var obLearningJSRightsAccess_<?php
echo $js_var_name;
?>
= new LearningJSRightsAccess(
<?php
echo intval($lessonId);
?>
,
<?php
echo CUtil::PhpToJsObject($arSelected);
?>
,
'<?php
echo CUtil::JSEscape($variable_name);
?>
',
'<?php
echo CUtil::JSEscape($table_id);
?>
',
'<?php
echo CUtil::JSEscape($href_id);
?>
',
'<?php
echo CUtil::JSEscape($sSelect);
?>
',
<?php
echo CUtil::PhpToJsObject($arHighLight);
?>
);
</script>
<h3><?php
echo GetMessage('LEARNING_RIGHTS_FOR_ADMINISTRATION');
?>
</h3>
<table width="100%" cellpadding="0" cellspacing="10" border="0" id="<?php
echo htmlspecialcharsbx($table_id);
?>
" align="center">
<?php
$access = new CAccess();
// If rights are for lesson => show base rights
if ($lessonId !== false) {
$arBaseNames = $access->GetNames(array_keys($arBaseRights));
foreach ($arBaseRights as $symbol => $taskId) {
if ($taskId <= 0) {
continue;
}
?>
<tr valign="top">
<td align="right"><?php
echo htmlspecialcharsex($arBaseNames[$symbol]['provider'] . ' ' . $arBaseNames[$symbol]['name']);
?>
: </td>
<td align="left">
<?php
echo htmlspecialcharsex(CLearnAccess::GetNameForTask($taskId));
?>
</td>
</tr>
<?php
}
}
$arNames = $access->GetNames(array_keys($arActualRights));
foreach ($arActualRights as $symbol => $taskId) {
if ($taskId <= 0) {
continue;
}
?>
<tr valign="top">
<td align="right">
<div style="padding-top:8px;">
<span href="javascript:void(0);"
onclick="LearningJSRightsAccess.DeleteRow(
//.........这里部分代码省略.........
示例13: GetList
public static function GetList($arOrder = array("SORT" => "ASC"), $arFilter = array(), $bIncCnt = false)
{
global $DB, $USER;
$strSqlSearch = "";
$bAddSites = false;
foreach ($arFilter as $key => $val) {
$res = CIBlock::MkOperationFilter($key);
$key = strtoupper($res["FIELD"]);
$cOperationType = $res["OPERATION"];
switch ($key) {
case "ACTIVE":
$sql = CIBlock::FilterCreate("B.ACTIVE", $val, "string_equal", $cOperationType);
break;
case "LID":
case "SITE_ID":
$sql = CIBlock::FilterCreate("BS.SITE_ID", $val, "string_equal", $cOperationType);
if (strlen($sql)) {
$bAddSites = true;
}
break;
case "NAME":
case "CODE":
case "XML_ID":
case "PROPERTY_INDEX":
$sql = CIBlock::FilterCreate("B." . $key, $val, "string", $cOperationType);
break;
case "EXTERNAL_ID":
$sql = CIBlock::FilterCreate("B.XML_ID", $val, "string", $cOperationType);
break;
case "TYPE":
$sql = CIBlock::FilterCreate("B.IBLOCK_TYPE_ID", $val, "string", $cOperationType);
break;
case "ID":
case "VERSION":
case "SOCNET_GROUP_ID":
$sql = CIBlock::FilterCreate("B." . $key, $val, "number", $cOperationType);
break;
default:
$sql = "";
break;
}
if (strlen($sql)) {
$strSqlSearch .= " AND (" . $sql . ") ";
}
}
$bCheckPermissions = !array_key_exists("CHECK_PERMISSIONS", $arFilter) || $arFilter["CHECK_PERMISSIONS"] !== "N" || array_key_exists("OPERATION", $arFilter);
$bIsAdmin = is_object($USER) && $USER->IsAdmin();
if ($bCheckPermissions && !$bIsAdmin) {
$min_permission = strlen($arFilter["MIN_PERMISSION"]) == 1 ? $arFilter["MIN_PERMISSION"] : "R";
if (is_object($USER)) {
$iUserID = intval($USER->GetID());
$strGroups = $USER->GetGroups();
$bAuthorized = $USER->IsAuthorized();
} else {
$iUserID = 0;
$strGroups = "2";
$bAuthorized = false;
}
$stdPermissions = "\n\t\t\t\tSELECT IBLOCK_ID\n\t\t\t\tFROM b_iblock_group IBG\n\t\t\t\tWHERE IBG.GROUP_ID IN (" . $strGroups . ")\n\t\t\t\tAND IBG.PERMISSION >= '" . $min_permission . "'\n\t\t\t";
if (!defined("ADMIN_SECTION")) {
$stdPermissions .= "\n\t\t\t\t\tAND (IBG.PERMISSION='X' OR B.ACTIVE='Y')\n\t\t\t\t";
}
if (strlen($arFilter["OPERATION"]) > 0) {
$operation = "'" . $DB->ForSql($arFilter["OPERATION"]) . "'";
} elseif ($min_permission >= "X") {
$operation = "'iblock_edit'";
} elseif ($min_permission >= "U") {
$operation = "'element_edit'";
} elseif ($min_permission >= "S") {
$operation = "'iblock_admin_display'";
} else {
$operation = "'section_read', 'element_read', 'section_element_bind', 'section_section_bind'";
}
if ($operation) {
$acc = new CAccess();
$acc->UpdateCodes();
$extPermissions = "\n\t\t\t\t\tSELECT IBLOCK_ID\n\t\t\t\t\tFROM b_iblock_right IBR\n\t\t\t\t\tINNER JOIN b_task_operation T ON T.TASK_ID = IBR.TASK_ID\n\t\t\t\t\tINNER JOIN b_operation O ON O.ID = T.OPERATION_ID\n\t\t\t\t\t" . ($iUserID > 0 ? "LEFT" : "INNER") . " JOIN b_user_access UA ON UA.ACCESS_CODE = IBR.GROUP_CODE AND UA.USER_ID = " . $iUserID . "\n\t\t\t\t\tWHERE IBR.ENTITY_TYPE = 'iblock'\n\t\t\t\t\tAND O.NAME in (" . $operation . ")\n\t\t\t\t\t" . ($bAuthorized ? "AND (UA.USER_ID IS NOT NULL OR IBR.GROUP_CODE = 'AU')" : "") . "\n\t\t\t\t";
$sqlPermissions = "AND (\n\t\t\t\t\tB.ID IN ({$stdPermissions})\n\t\t\t\t\tOR (B.RIGHTS_MODE = 'E' AND B.ID IN ({$extPermissions}))\n\t\t\t\t)";
} else {
$sqlPermissions = "AND (\n\t\t\t\t\tB.ID IN ({$stdPermissions})\n\t\t\t\t)";
}
} else {
$sqlPermissions = "";
}
if ($bAddSites) {
$sqlJoinSites = "LEFT JOIN b_iblock_site BS ON B.ID=BS.IBLOCK_ID\n\t\t\t\t\tLEFT JOIN b_lang L ON L.LID=BS.SITE_ID";
} else {
$sqlJoinSites = "INNER JOIN b_lang L ON L.LID=B.LID";
}
if (!$bIncCnt) {
$strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\tB.*\n\t\t\t\t\t,B.XML_ID as EXTERNAL_ID\n\t\t\t\t\t," . $DB->DateToCharFunction("B.TIMESTAMP_X") . " as TIMESTAMP_X\n\t\t\t\t\t,L.DIR as LANG_DIR\n\t\t\t\t\t,L.SERVER_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock B\n\t\t\t\t\t" . $sqlJoinSites . "\n\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t" . $sqlPermissions . "\n\t\t\t\t\t" . $strSqlSearch . "\n\t\t\t";
} else {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tB.*\n\t\t\t\t\t,B.XML_ID as EXTERNAL_ID\n\t\t\t\t\t," . $DB->DateToCharFunction("B.TIMESTAMP_X") . " as TIMESTAMP_X\n\t\t\t\t\t,L.DIR as LANG_DIR\n\t\t\t\t\t,L.SERVER_NAME\n\t\t\t\t\t,COUNT(DISTINCT BE.ID) as ELEMENT_CNT\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock B\n\t\t\t\t\t" . $sqlJoinSites . "\n\t\t\t\t\tLEFT JOIN b_iblock_element BE ON (BE.IBLOCK_ID=B.ID\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t(BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL )\n\t\t\t\t\t\t\t" . ($arFilter["CNT_ALL"] == "Y" ? " OR BE.WF_NEW='Y' " : "") . "\n\t\t\t\t\t\t)\n\t\t\t\t\t\t" . ($arFilter["CNT_ACTIVE"] == "Y" ? "AND BE.ACTIVE='Y'\n\t\t\t\t\t\tAND (BE.ACTIVE_TO >= " . $DB->CurrentDateFunction() . " OR BE.ACTIVE_TO IS NULL)\n\t\t\t\t\t\tAND (BE.ACTIVE_FROM <= " . $DB->CurrentDateFunction() . " OR BE.ACTIVE_FROM IS NULL)\n\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t)\n\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t" . $sqlPermissions . "\n\t\t\t\t\t" . $strSqlSearch . "\n\t\t\t\tGROUP BY B.ID\n\t\t\t";
}
$arSqlOrder = array();
if (is_array($arOrder)) {
foreach ($arOrder as $by => $order) {
$by = strtolower($by);
$order = strtolower($order);
if ($order != "asc") {
//.........这里部分代码省略.........
示例14: unserialize
defaultToAllCont.style.display = (this.checked ? "" : "none");
}, toAllCheckBox));
}
</script>
<?
}
?></td>
</tr><?
}
elseif ($Option[0] == "livefeed_toall_rights")
{
$arToAllRights = unserialize($val);
if (!$arToAllRights)
$arToAllRights = unserialize($Option[2]);
$access = new CAccess();
$arNames = $access->GetNames($arToAllRights);
?><tr id="RIGHTS_all" style="display: <?php
echo COption::GetOptionString("socialnetwork", "allow_livefeed_toall", "Y") == "Y" ? "table-row" : "none";
?>
;"><td> </td><td><?
?><script>
var rightsCont = BX('RIGHTS_all');
if (toAllCheckBox && rightsCont)
{
BX.bind(toAllCheckBox, 'click', BX.delegate(function(e) {
rightsCont.style.display = (this.checked ? "" : "none");
}, toAllCheckBox));
}
示例15: IBlockShowRights
//.........这里部分代码省略.........
echo CUtil::JSEscape($sSelect);
?>
',
<?php
echo CUtil::PhpToJsObject($arHighLight);
?>
);
</script>
<table width="100%" class="internal" id="<?php
echo htmlspecialcharsbx($table_id);
?>
" align="center">
<?php
if ($section_title != "") {
?>
<tr id="<?php
echo $html_var_name;
?>
_heading" class="heading">
<td colspan="2">
<?php
echo $section_title;
?>
</td>
</tr>
<?php
}
?>
<?php
$arNames = array();
foreach ($arActualRights as $arRightSet) {
$arNames[] = $arRightSet["GROUP_CODE"];
}
$access = new CAccess();
$arNames = $access->GetNames($arNames);
foreach ($arActualRights as $RIGHT_ID => $arRightSet) {
if ($bForceInherited || $arRightSet["IS_INHERITED"] == "Y") {
?>
<tr class="<?php
echo $html_var_name;
?>
_row_for_<?php
echo htmlspecialcharsbx($arRightSet["GROUP_CODE"]);
if ($arRightSet["IS_OVERWRITED"] == "Y") {
echo " iblock-strike-out";
}
?>
">
<td style="width:40%!important; text-align:right"><?php
echo htmlspecialcharsex($arNames[$arRightSet["GROUP_CODE"]]["provider"] . " " . $arNames[$arRightSet["GROUP_CODE"]]["name"]);
?>
:</td>
<td align="left">
<?php
if ($arRightSet["IS_OVERWRITED"] != "Y") {
?>
<input type="hidden" name="<?php
echo $html_var_name;
?>
[][RIGHT_ID]" value="<?php
echo htmlspecialcharsbx($RIGHT_ID);
?>
">
<input type="hidden" name="<?php
echo $html_var_name;
?>