コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
if (!$errorMessage && $USER->IsAuthorized() && $arResult["PERMISSION"] > "R") {
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && array_key_exists("sm_action", $_REQUEST) && strlen($_REQUEST["sm_action"]) > 0 && strlen($_REQUEST["feature"]) > 0 && !in_array($_REQUEST["feature"], $arStaticTabs)) {
        if (!array_key_exists($_REQUEST["feature"], $arSocNetFeaturesSettings)) {
            $errorMessage = GetMessage("SONET_SM_FEATURE_INCORRECT");
        } elseif (!in_array($arParams["ENTITY_TYPE"], $arSocNetFeaturesSettings[$_REQUEST["feature"]]["allowed"])) {
            $errorMessage = GetMessage("SONET_SM_FEATURE_INACTIVE");
        }
    }
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && array_key_exists("sm_action", $_REQUEST) && $_REQUEST["sm_action"] == "update" && strlen($_REQUEST["feature"]) > 0 && check_bitrix_sessid()) {
        if (!$errorMessage) {
            CUtil::JSPostUnescape();
            $idTmp = CSocNetFeatures::SetFeature($arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], $_REQUEST["feature"], true, StrLen($_REQUEST[$_REQUEST["feature"] . "_name"]) > 0 ? $_REQUEST[$_REQUEST["feature"] . "_name"] : false);
            if ($idTmp && (!array_key_exists("hide_operations_settings", $arSocNetFeaturesSettings[$_REQUEST["feature"]]) || !$arSocNetFeaturesSettings[$_REQUEST["feature"]]["hide_operations_settings"])) {
                foreach ($arSocNetFeaturesSettings[$_REQUEST["feature"]]["operations"] as $operation => $perm) {
                    if (!array_key_exists("restricted", $arSocNetFeaturesSettings[$_REQUEST["feature"]]["operations"][$operation]) || !in_array($key, $arSocNetFeaturesSettings[$_REQUEST["feature"]]["operations"][$operation]["restricted"][$arParams["ENTITY_TYPE"]])) {
                        $id1Tmp = CSocNetFeaturesPerms::SetPerm($idTmp, $operation, $_REQUEST[$_REQUEST["feature"] . "_" . $operation . "_perm"]);
                        if (!$id1Tmp && ($e = $APPLICATION->GetException())) {
                            $errorMessage .= $e->GetString();
                        }
                    }
                }
            } elseif ($e = $APPLICATION->GetException()) {
                $errorMessage = $e->GetString();
            }
        }
        $APPLICATION->RestartBuffer();
        require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/interface/admin_lib.php';
        $obJSPopup = new CJSPopup();
        if (!$errorMessage) {
            $obJSPopup->Close();
        } else {