コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$cache_id = 'user_otp_' . intval($USER->GetID() / 100);
$cache_dir = '/otp/user_id';
$obCache = new CPHPCache();
if ($obCache->InitCache($ttl, $cache_id, $cache_dir)) {
    $arUserOtp = $obCache->GetVars();
} else {
    $arUserOtp = array("ACTIVE" => CSecurityUser::IsUserOtpActive($USER->GetID()));
    if (defined("BX_COMP_MANAGED_CACHE")) {
        global $CACHE_MANAGER;
        $CACHE_MANAGER->StartTagCache($cache_dir);
        $CACHE_MANAGER->RegisterTag("USER_OTP_" . intval($USER->GetID() / 100));
        $CACHE_MANAGER->EndTagCache();
    }
    if ($obCache->StartDataCache()) {
        $obCache->EndDataCache($arUserOtp);
    }
}
$arParams["PATH_TO_PROFILE_SECURITY"] = trim($arParams["PATH_TO_PROFILE_SECURITY"]);
if (strlen($arParams["PATH_TO_PROFILE_SECURITY"]) <= 0) {
    $arParams["PATH_TO_PROFILE_SECURITY"] = SITE_DIR . "company/personal/user/#user_id#/security/";
}
$arResult["PATH_TO_PROFILE_SECURITY"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_PROFILE_SECURITY"], array("user_id" => $USER->GetID()));
//for all mandatory
$IsUserSkipMandatoryRights = CSecurityUser::IsUserSkipMandatoryRights($USER->GetID());
$dateDeactivate = CSecurityUser::GetDeactivateUntil($USER->GetID());
if (!$arUserOtp["ACTIVE"] && !isset($_SESSION["OTP_MANDATORY_INFO"]) && !$IsUserSkipMandatoryRights && $dateDeactivate) {
    $arResult["POPUP_NAME"] = "otp_mandatory_info";
    $_SESSION["OTP_MANDATORY_INFO"] = "Y";
    $arResult["USER"]["OTP_DAYS_LEFT"] = $dateDeactivate ? FormatDate("ddiff", time() - 60 * 60 * 24, MakeTimeStamp($dateDeactivate)) : "";
    $this->IncludeComponentTemplate();
}
コード例 #2
0
ファイル: component.php プロジェクト: vim84/b-markt
                    }
                }
                $arResult["tasks"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_TASKS_TITLE"));
                if (array_key_exists("tasks", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("intranet") >= "W") && CModule::IncludeModule("intranet")) {
                    $arResult["tasks"]["SHOW"] = true;
                    if (StrLen($arResult["ActiveFeatures"]["tasks"]) > 0) {
                        $arResult["tasks"]["TITLE"] = $arResult["ActiveFeatures"]["tasks"];
                    }
                }
            }
        }
        if (array_key_exists("RatingMultiple", $arResult) && count($arResult["RatingMultiple"]) > 0) {
            foreach ($arParams["RATING_ID_ARR"] as $rating_id) {
                if (array_key_exists($rating_id, $arResult["RatingMultiple"])) {
                    $arResult["RatingMultiple"][$rating_id]["VALUE"] = $arResult["User"]["RATING_" . $rating_id . "_CURRENT_VALUE"];
                }
            }
        }
        //otp
        if (CModule::IncludeModule("security")) {
            $arResult["User"]["OTP"]["IS_MANDATORY"] = CSecurityUser::IsOtpMandatory();
            $arResult["User"]["OTP"]["IS_ACTIVE"] = CSecurityUser::IsUserOtpActive($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["IS_EXIST"] = CSecurityUser::IsUserOtpExist($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["ARE_RECOVERY_CODES_ENABLED"] = Bitrix\Security\Mfa\Otp::isRecoveryCodesEnabled();
            $dateDeactivate = CSecurityUser::GetDeactivateUntil($arResult["User"]["ID"]);
            $arResult["User"]["OTP"]["NUM_LEFT_DAYS"] = $dateDeactivate ? FormatDate("ddiff", time() - 60 * 60 * 24, MakeTimeStamp($dateDeactivate)) : "";
        }
    }
}
$this->IncludeComponentTemplate();
return array("NAME" => $arResult["User"]["NAME_FORMATTED"]);