Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php require_once(substr(__file__, 0, strlen(__file__) - strlen("/include.php")). "/bx_r..

Decoded Output download

<?php 
require_once(substr(__file__, 0, strlen(__file__) - strlen("/include.php")). "/bx_root.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/start.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_io.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_file.php"); 
$GLOBALS ["APPLICATION"] = new CMain(); 
if(defined("SITE_ID")) 
        define("LANG", SITE_ID); 
if(defined("LANG")) 
{ 
        if(defined("ADMIN_SECTION") && ADMIN_SECTION === true) 
                $db_lang = CLangAdmin::GetByID(LANG); 
        else 
                $db_lang = CLang::GetByID(LANG); 
        $arLang = $db_lang->Fetch(); 
} 
else 
{ 
        $arLang = $GLOBALS ["APPLICATION"]->GetLang(); 
        define("LANG", $arLang ["LID"]); 
} 
$lang = $arLang ["LID"]; 
define("SITE_ID", $arLang ["LID"]); 
define("SITE_DIR", $arLang ["DIR"]); 
define("SITE_SERVER_NAME", $arLang ["SERVER_NAME"]); 
define("SITE_CHARSET", $arLang ["CHARSET"]); 
define("FORMAT_DATE", $arLang ["FORMAT_DATE"]); 
define("FORMAT_DATETIME", $arLang ["FORMAT_DATETIME"]); 
define("LANG_DIR", $arLang ["DIR"]); 
define("LANG_CHARSET", $arLang ["CHARSET"]); 
define("LANG_ADMIN_LID", $arLang ["LANGUAGE_ID"]); 
define("LANGUAGE_ID", $arLang ["LANGUAGE_ID"]); 
$GLOBALS ["APPLICATION"]->reinitPath(); 
$GLOBALS ["MESS"] = array(); 
$GLOBALS ["ALL_LANG_FILES"] = array(); 
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/tools.php"); 
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/date_format.php"); 
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/database.php"); 
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/main.php"); 
IncludeModuleLangFile(__file__); 
error_reporting(COption::GetOptionInt("main", "error_reporting", e_compile_error | e_error | e_core_error | e_parse)& ~ E_STRICT); 
if(!defined("BX_COMP_MANAGED_CACHE") && COption::GetOptionString("main", "component_managed_cache_on", "Y")!= "N") 
        define("BX_COMP_MANAGED_CACHE", true); 
if($domain = $GLOBALS ["APPLICATION"]->GetCookieDomain()) 
        ini_set("session.cookie_domain", $domain); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/filter_tools.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/ajax_tools.php"); 
define("INTRANET_EDITION", "Y"); 
class CBXFeatures 
{ 
        private static $_1408214551 = 30; 
        private static $_58665169 = array( 
                        "Portal" => array( 
                                        "CompanyCalendar", 
                                        "CompanyPhoto", 
                                        "CompanyVideo", 
                                        "CompanyCareer", 
                                        "StaffChanges", 
                                        "StaffAbsence", 
                                        "CommonDocuments", 
                                        "MeetingRoomBookingSystem", 
                                        "Wiki", 
                                        "Learning", 
                                        "Vote", 
                                        "WebLink", 
                                        "Subscribe", 
                                        "Friends", 
                                        "PersonalFiles", 
                                        "PersonalBlog", 
                                        "PersonalPhoto", 
                                        "PersonalForum", 
                                        "Blog", 
                                        "Forum", 
                                        "Gallery", 
                                        "Board", 
                                        "MicroBlog", 
                                        "WebMessenger" 
                        ), 
                        "Communications" => array( 
                                        "Tasks", 
                                        "Calendar", 
                                        "Workgroups", 
                                        "Jabber", 
                                        "VideoConference", 
                                        "Extranet", 
                                        "SMTP", 
                                        "Requests", 
                                        "DAV", 
                                        "intranet_sharepoint", 
                                        "timeman", 
                                        "Idea", 
                                        "Meeting", 
                                        "EventList", 
                                        "Salary", 
                                        "XDImport" 
                        ), 
                        "Enterprise" => array( 
                                        "BizProc", 
                                        "Lists", 
                                        "Support", 
                                        "Analytics", 
                                        "crm", 
                                        "Controller" 
                        ), 
                        "Holding" => array( 
                                        "Cluster", 
                                        "MultiSites" 
                        ) 
        ); 
        private static $_1247112795 = false; 
        private static $_835716084 = false; 
        private static function Initialize() 
        { 
                if(self::$_1247112795 == false) 
                { 
                        self::$_1247112795 = array(); 
                        foreach(self::$_58665169 as $_1634993615 => $arFeatures) 
                        { 
                                foreach($arFeatures as $featureId) 
                                        self::$_1247112795 [$featureId] = $_1634993615; 
                        } 
                } 
                if(self::$_835716084 == false) 
                { 
                        self::$_835716084 = array(); 
                        $_513078194 = COption::GetOptionString("main", "~cpf_map_value", ""); 
                        if(strlen($_513078194)> 0) 
                        { 
                                $_513078194 = base64_decode($_513078194); 
                                self::$_835716084 = unserialize($_513078194); 
                                if(!is_array(self::$_835716084)) 
                                        self::$_835716084 = array(); 
                        } 
                        if(count(self::$_835716084)<= 0) 
                                self::$_835716084 = array( 
                                                "e" => array(), 
                                                "f" => array() 
                                ); 
                } 
        } 
        public static function InitiateEditionsSettings($arEditions) 
        { 
                self::Initialize(); 
                $_1345170397 = array(); 
                foreach(self::$_58665169 as $_1634993615 => $arFeatures) 
                { 
                        $_473486535 = in_array($_1634993615, $arEditions); 
                        self::$_835716084 ["e"] [$_1634993615] =($_473486535 ? array("F"): array("X")); 
                        foreach($arFeatures as $featureId) 
                        { 
                                self::$_835716084 ["f"] [$featureId] = $_473486535; 
                                if(!$_473486535) 
                                        $_1345170397 [] = array($featureId, false); 
                        } 
                } 
                $_1610123030 = serialize(self::$_835716084); 
                $_1610123030 = base64_encode($_1610123030); 
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030); 
                foreach($_1345170397 as $_690296712) 
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]); 
        } 
        public static function IsFeatureEnabled($featureId) 
        { 
                if(strlen($featureId)<= 0) 
                        return true; 
                self::Initialize(); 
                if(!array_key_exists($featureId, self::$_1247112795)) 
                        return true; 
                if(self::$_1247112795 [$featureId] == "Portal") 
                        $_1457953465 = array("F"); 
                elseif(array_key_exists(self::$_1247112795 [$featureId], self::$_835716084 ["e"])) 
                        $_1457953465 = self::$_835716084 ["e"] [self::$_1247112795 [$featureId]]; 
                else 
                        $_1457953465 = array("X"); 
                if($_1457953465 [0] != "F" && $_1457953465 [0] != "D") 
                { 
                        return false; 
                } 
                elseif($_1457953465 [0] == "D") 
                { 
                        if($_1457953465 [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y"))) 
                        { 
                                if(!isset($_1457953465 [2])|| !$_1457953465 [2]) 
                                        self::MarkTrialPeriodExpired(self::$_1247112795 [$featureId]); 
                                return false; 
                        } 
                } 
                return !array_key_exists($featureId, self::$_835716084 ["f"])|| self::$_835716084 ["f"] [$featureId]; 
        } 
        public static function IsFeatureInstalled($featureId) 
        { 
                if(strlen($featureId)<= 0) 
                        return true; 
                self::Initialize(); 
                return(array_key_exists($featureId, self::$_835716084 ["f"]) && self::$_835716084 ["f"] [$featureId]); 
        } 
        public static function IsFeatureEditable($featureId) 
        { 
                if(strlen($featureId)<= 0) 
                        return true; 
                self::Initialize(); 
                if(!array_key_exists($featureId, self::$_1247112795)) 
                        return true; 
                if(self::$_1247112795 [$featureId] == "Portal") 
                        $_1457953465 = array("F"); 
                elseif(array_key_exists(self::$_1247112795 [$featureId], self::$_835716084 ["e"])) 
                        $_1457953465 = self::$_835716084 ["e"] [self::$_1247112795 [$featureId]]; 
                else 
                        $_1457953465 = array("X"); 
                if($_1457953465 [0] != "F" && $_1457953465 [0] != "D") 
                { 
                        return false; 
                } 
                elseif($_1457953465 [0] == "D") 
                { 
                        if($_1457953465 [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y"))) 
                        { 
                                if(!isset($_1457953465 [2])|| !$_1457953465 [2]) 
                                        self::MarkTrialPeriodExpired(self::$_1247112795 [$featureId]); 
                                return false; 
                        } 
                } 
                return true; 
        } 
        private static function ExecuteEvent($featureId, $_1538917497) 
        { 
                if(method_exists("CBXFeatures", "On" . $featureId . "SettingsChange")) 
                        call_user_func_array(array("CBXFeatures", "On" . $featureId . "SettingsChange"), array($featureId, $_1538917497)); 
                $_36951677 = GetModuleEvents("main", "On" . $featureId . "SettingsChange"); 
                while($arEvent = $_36951677->Fetch()) 
                        ExecuteModuleEventEx($arEvent, array($featureId,$_1538917497)); 
        } 
        public static function SetFeatureEnabled($featureId, $_1538917497 = true, $_347148369 = true) 
        { 
                if(strlen($featureId)<= 0) 
                        return; 
                if(!self::IsFeatureEditable($featureId)) 
                        $_1538917497 = false; 
                $_1538917497 =($_1538917497 ? true : false); 
                self::Initialize(); 
                $_1187344289 =(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 || array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 != self::$_835716084 ["f"] [$featureId]); 
                self::$_835716084 ["f"] [$featureId] = $_1538917497; 
                $_1610123030 = serialize(self::$_835716084); 
                $_1610123030 = base64_encode($_1610123030); 
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030); 
                if($_1187344289 && $_347148369) 
                        self::ExecuteEvent($featureId, $_1538917497); 
        } 
        private static function MarkTrialPeriodExpired($_1634993615) 
        { 
                if(strlen($_1634993615)<= 0 || $_1634993615 == "Portal") 
                        return; 
                self::Initialize(); 
                if(!array_key_exists($_1634993615, self::$_835716084 ["e"])|| array_key_exists($_1634993615, self::$_835716084 ["e"]) && self::$_835716084 ["e"] [$_1634993615] [0] != "D") 
                        return; 
                if(isset(self::$_835716084 ["e"] [$_1634993615] [1]) && self::$_835716084 ["e"] [$_1634993615] [2]) 
                        return; 
                $_1345170397 = array(); 
                if(array_key_exists($_1634993615, self::$_58665169) && is_array(self::$_58665169 [$_1634993615])) 
                { 
                        foreach(self::$_58665169 [$_1634993615] as $featureId) 
                        { 
                                if(array_key_exists($featureId, self::$_835716084 ["f"]) && self::$_835716084 ["f"] [$featureId]) 
                                { 
                                        self::$_835716084 ["f"] [$featureId] = false; 
                                        $_1345170397 [] = array($featureId, false); 
                                } 
                        } 
                        self::$_835716084 ["e"] [$_1634993615] [2] = true; 
                } 
                $_1610123030 = serialize(self::$_835716084); 
                $_1610123030 = base64_encode($_1610123030); 
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030); 
                foreach($_1345170397 as $_690296712) 
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]); 
        } 
        public static function ModifyFeaturesSettings($arEditions, $arFeatures) 
        { 
                self::Initialize(); 
                foreach($arEditions as $_1634993615 => $_634862492) 
                        self::$_835716084 ["e"] [$_1634993615] = $_634862492; 
                $_1345170397 = array(); 
                foreach($arFeatures as $featureId => $_1538917497) 
                { 
                        if(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 || array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 != self::$_835716084 ["f"] [$featureId]) 
                                $_1345170397 [] = array($featureId, $_1538917497); 
                        self::$_835716084 ["f"] [$featureId] = $_1538917497; 
                } 
                $_1610123030 = serialize(self::$_835716084); 
                $_1610123030 = base64_encode($_1610123030); 
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030); 
                self::$_835716084 = false; 
                foreach($_1345170397 as $_690296712) 
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]); 
        } 
        public static function SaveFeaturesSettings($arEnabledEditions, $arEnabledFeatures) 
        { 
                self::Initialize(); 
                $_863728662 = array("e" => array(), "f" => array()); 
                if(!is_array($arEnabledEditions)) 
                        $arEnabledEditions = array(); 
                if(!is_array($arEnabledFeatures)) 
                        $arEnabledFeatures = array(); 
                if(!in_array("Portal", $arEnabledEditions)) 
                        $arEnabledEditions [] = "Portal"; 
                foreach(self::$_58665169 as $_1634993615 => $arFeatures) 
                { 
                        if(array_key_exists($_1634993615, self::$_835716084 ["e"])) 
                                $_100178709 = self::$_835716084 ["e"] [$_1634993615]; 
                        else 
                                $_100178709 =($_1634993615 == "Portal")? array("F"): array("X"); 
                        if($_100178709 [0] == "F" || $_100178709 [0] == "D") 
                        { 
                                $_863728662 ["e"] [$_1634993615] = $_100178709; 
                        } else 
                        { 
                                if(in_array($_1634993615, $arEnabledEditions)) 
                                        $_863728662 ["e"] [$_1634993615] = array("D", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); 
                                else 
                                        $_863728662 ["e"] [$_1634993615] = array("X"); 
                        } 
                } 
                $_1345170397 = array(); 
                foreach(self::$_1247112795 as $featureId => $_1634993615) 
                { 
                        if($_863728662 ["e"] [$_1634993615] [0] != "F" && $_863728662 ["e"] [$_1634993615] [0] != "D") 
                        { 
                                $_863728662 ["f"] [$featureId] = false; 
                        } 
                        else 
                        { 
                                if($_863728662 ["e"] [$_1634993615] [0] == "D" && $_863728662 ["e"] [$_1634993615] [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y"))) 
                                        $_863728662 ["f"] [$featureId] = false; 
                                else 
                                        $_863728662 ["f"] [$featureId] = in_array($featureId, $arEnabledFeatures); 
                                if(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_863728662 ["f"] [$featureId] || array_key_exists($featureId, self::$_835716084 ["f"]) && $_863728662 ["f"] [$featureId] != self::$_835716084 ["f"] [$featureId]) 
                                        $_1345170397 [] = array($featureId, $_863728662 ["f"] [$featureId]); 
                        } 
                } 
                $_1610123030 = serialize($_863728662); 
                $_1610123030 = base64_encode($_1610123030); 
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030); 
                self::$_835716084 = false; 
                foreach($_1345170397 as $_690296712) 
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]); 
        } 
        public static function GetFeaturesList() 
        { 
                self::Initialize(); 
                $_319143224 = array(); 
                foreach(self::$_58665169 as $_1634993615 => $arFeatures) 
                { 
                        if(array_key_exists($_1634993615, self::$_835716084 ["e"])) 
                                $_100178709 = self::$_835716084 ["e"] [$_1634993615]; 
                        else 
                                $_100178709 =($_1634993615 == "Portal")? array("F"): array("X"); 
                        $_319143224 [$_1634993615] = array( 
                                        "TYPE" => $_100178709 [0], 
                                        "DATE" => $_100178709 [1], 
                                        "FEATURES" => array() 
                        ); 
                        $_319143224 [$_1634993615] ["EXPIRED"] = false; 
                        if($_319143224 [$_1634993615] ["TYPE"] == "D") 
                        { 
                                $_319143224 [$_1634993615] ["TRY_DAYS_COUNT"] = intval((time()- $_319143224 [$_1634993615] ["DATE"])/ 64800); 
                                if($_319143224 [$_1634993615] ["TRY_DAYS_COUNT"] > self::$_1408214551) 
                                        $_319143224 [$_1634993615] ["EXPIRED"] = true; 
                        } 
                        foreach($arFeatures as $featureId) 
                                $_319143224 [$_1634993615] ["FEATURES"] [$featureId] =(!array_key_exists($featureId, self::$_835716084 ["f"])|| self::$_835716084 ["f"] [$featureId]); 
                } 
                return $_319143224; 
        } 
        private static function InstallModule($_689540566, $_128808919) 
        { 
                if(IsModuleInstalled($_689540566)== $_128808919) 
                        return true; 
                $_1070770522 = $_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/" . $_689540566 . "/install/index.php"; 
                if(!file_exists($_1070770522)) 
                        return false; 
                include_once($_1070770522); 
                $_1335203152 = str_replace(".", "_", $_689540566); 
                if(!class_exists($_1335203152)) 
                        return false; 
                $_419071018 = new $_1335203152(); 
                if($_128808919) 
                { 
                        if(!$_419071018->InstallDB()) 
                                return false; 
                        $_419071018->InstallEvents(); 
                        if(!$_419071018->InstallFiles()) 
                                return false; 
                } 
                else 
                { 
                        if(CModule::IncludeModule("search")) 
                                CSearch::DeleteIndex($_689540566); 
                        UnRegisterModule($_689540566); 
                } 
                return true; 
        } 
        private static function OnRequestsSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("form", $_1538917497); 
        } 
        private static function OnLearningSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("learning", $_1538917497); 
        } 
        private static function OnJabberSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("xmpp", $_1538917497); 
        } 
        private static function OnVideoConferenceSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("video", $_1538917497); 
        } 
        private static function OnBizProcSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("bizprocdesigner", $_1538917497); 
        } 
        private static function OnListsSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("lists", $_1538917497); 
        } 
        private static function OnWikiSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("wiki", $_1538917497); 
        } 
        private static function OnSupportSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("support", $_1538917497); 
        } 
        private static function OnControllerSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("controller", $_1538917497); 
        } 
        private static function OnAnalyticsSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("statistic", $_1538917497); 
        } 
        private static function OnVoteSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("vote", $_1538917497); 
        } 
        private static function OnFriendsSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_frields", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_frields", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_frields", $_1571534705); 
                        } 
                } 
        } 
        private static function OnMicroBlogSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_microblog_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_microblog_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_microblog_user", $_1571534705); 
                        } 
                        if(COption::GetOptionString("socialnetwork", "allow_microblog_group", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_microblog_group", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_microblog_group", $_1571534705); 
                        } 
                } 
        } 
        private static function OnPersonalFilesSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_files_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_files_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_files_user", $_1571534705); 
                        } 
                } 
        } 
        private static function OnPersonalBlogSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_blog_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_blog_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_blog_user", $_1571534705); 
                        } 
                } 
        } 
        private static function OnPersonalPhotoSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_photo_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_photo_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_photo_user", $_1571534705); 
                        } 
                } 
        } 
        private static function OnPersonalForumSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_forum_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_forum_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_forum_user", $_1571534705); 
                        } 
                } 
        } 
        private static function OnTasksSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_tasks_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_tasks_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_tasks_user", $_1571534705); 
                        } 
                        if(COption::GetOptionString("socialnetwork", "allow_tasks_group", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_tasks_group", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_tasks_group", $_1571534705); 
                        } 
                } 
                self::InstallModule("tasks", $_1538917497); 
        } 
        private static function OnCalendarSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        $_1571534705 = "Y"; 
                else 
                        $_1571534705 = "N"; 
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array( 
                                "ACTIVE" => "Y" 
                )); 
                while($_1421646471 = $_399435140->Fetch()) 
                { 
                        if(COption::GetOptionString("socialnetwork", "allow_calendar_user", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_calendar_user", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_calendar_user", $_1571534705); 
                        } 
                        if(COption::GetOptionString("socialnetwork", "allow_calendar_group", "Y", $_1421646471 ["ID"])!= $_1571534705) 
                        { 
                                COption::SetOptionString("socialnetwork", "allow_calendar_group", $_1571534705, false, $_1421646471 ["ID"]); 
                                COption::SetOptionString("socialnetwork", "allow_calendar_group", $_1571534705); 
                        } 
                } 
                self::InstallModule("calendar", $_1538917497); 
        } 
        private static function OnSMTPSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("mail", $_1538917497); 
        } 
        private static function OnExtranetSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("extranet", $_1538917497); 
        } 
        private static function OnDAVSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("dav", $_1538917497); 
        } 
        private static function OntimemanSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("timeman", $_1538917497); 
        } 
        private static function Onintranet_sharepointSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                { 
                        RegisterModuleDependences("iblock", "OnAfterIBlockElementAdd", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem"); 
                        RegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem"); 
                        CAgent::AddAgent("CIntranetSharepoint::AgentLists();", "intranet", "N", 333); 
                        CAgent::AddAgent("CIntranetSharepoint::AgentQueue();", "intranet", "N", 225); 
                        CAgent::AddAgent("CIntranetSharepoint::AgentUpdate();", "intranet", "N", 3600); 
                } 
                else 
                { 
                        UnRegisterModuleDependences("iblock", "OnAfterIBlockElementAdd", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem"); 
                        UnRegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem"); 
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentLists();", "intranet"); 
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentQueue();", "intranet"); 
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentUpdate();", "intranet"); 
                } 
        } 
        private static function OncrmSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        COption::SetOptionString("crm", "form_features", "Y"); 
                self::InstallModule("crm", $_1538917497); 
        } 
        private static function OnClusterSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("cluster", $_1538917497); 
        } 
        private static function OnMultiSitesSettingsChange($featureId, $_1538917497) 
        { 
                if($_1538917497) 
                        RegisterModuleDependences("main", "OnBeforeProlog", "main", "CWizardSolPanelIntranet", "ShowPanel", 100, "/modules/intranet/panel_button.php"); 
                else 
                        UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "CWizardSolPanelIntranet", "ShowPanel", "/modules/intranet/panel_button.php"); 
        } 
        private static function OnIdeaSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("idea", $_1538917497); 
        } 
        private static function OnMeetingSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("meeting", $_1538917497); 
        } 
        private static function OnXDImportSettingsChange($featureId, $_1538917497) 
        { 
                self::InstallModule("xdimport", $_1538917497); 
        } 
} 
define("ENCODE", "Y"); 
$GLOBALS ["arCustomTemplateEngines"] = array(); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/urlrewriter.php"); 
CModule::AddAutoloadClasses( 
        "main", 
        array( 
                "CBitrixComponent" => "classes/general/component.php", 
                "CComponentEngine" => "classes/general/component_engine.php", 
                "CComponentAjax" => "classes/general/component_ajax.php", 
                "CBitrixComponentTemplate" => "classes/general/component_template.php", 
                "CComponentUtil" => "classes/general/component_util.php", 
                "CControllerClient" => "classes/general/controller_member.php", 
                "PHPParser" => "classes/general/php_parser.php", 
                "CDiskQuota" => "classes/" . $DBType . "/quota.php", 
                "CEventLog" => "classes/general/event_log.php", 
                "CEventMain" => "classes/general/event_log.php", 
                "CAdminFileDialog" => "classes/general/file_dialog.php", 
                "WLL_User" => "classes/general/liveid.php", 
                "WLL_ConsentToken" => "classes/general/liveid.php", 
                "WindowsLiveLogin" => "classes/general/liveid.php", 
                "CAllFile" => "classes/general/file.php", 
                "CFile" => "classes/" . $DBType . "/file.php", 
                "CTempFile" => "classes/general/file_temp.php", 
                "CFavorites" => "classes/" . $DBType . "/favorites.php", 
                "CUserOptions" => "classes/general/user_options.php", 
                "CGridOptions" => "classes/general/grids.php", 
                "CUndo" => "/classes/general/undo.php", 
                "CAutoSave" => "/classes/general/undo.php", 
                "CRatings" => "classes/" . $DBType . "/ratings.php", 
                "CRatingsComponentsMain" => "classes/" . $DBType . "/ratings_components.php", 
                "CRatingRule" => "classes/general/rating_rule.php", 
                "CRatingRulesMain" => "classes/" . $DBType . "/rating_rules.php", 
                "CTopPanel" => "public/top_panel.php", 
                "CEditArea" => "public/edit_area.php", 
                "CComponentPanel" => "public/edit_area.php", 
                "CTextParser" => "classes/general/textparser.php", 
                "CPHPCacheFiles" => "classes/general/cache_files.php", 
                "CTimeZone" => "classes/general/time.php", 
                "CDataXML" => "classes/general/xml.php", 
                "CXMLFileStream" => "classes/general/xml.php", 
                "CRsaProvider" => "classes/general/rsasecurity.php", 
                "CRsaSecurity" => "classes/general/rsasecurity.php", 
                "CRsaBcmathProvider" => "classes/general/rsabcmath.php", 
                "CRsaOpensslProvider" => "classes/general/rsaopenssl.php", 
                "CASNReader" => "classes/general/asn.php", 
                "CBXShortUri" => "classes/" . $DBType . "/short_uri.php", 
                "CFinder" => "classes/general/finder.php", 
                "CAccess" => "classes/general/access.php", 
                "CAuthProvider" => "classes/general/authproviders.php", 
                "IProviderInterface" => "classes/general/authproviders.php", 
                "CGroupAuthProvider" => "classes/general/authproviders.php", 
                "CUserAuthProvider" => "classes/general/authproviders.php", 
                "Bitrix\Main\Entity\Base" => "lib/entity/base.php", 
                "Bitrix\Main\Entity\DataManager" => "lib/entity/datamanager.php", 
                "Bitrix\Main\Entity\Field" => "lib/entity/field.php", 
                "Bitrix\Main\Entity\ScalarField" => "lib/entity/scalarfield.php", 
                "Bitrix\Main\Entity\IntegerField" => "lib/entity/integerfield.php", 
                "Bitrix\Main\Entity\FloatField" => "lib/entity/floatfield.php", 
                "Bitrix\Main\Entity\StringField" => "lib/entity/stringfield.php", 
                "Bitrix\Main\Entity\TextField" => "lib/entity/textfield.php", 
                "Bitrix\Main\Entity\BooleanField" => "lib/entity/booleanfield.php", 
                "Bitrix\Main\Entity\DateField" => "lib/entity/datefield.php", 
                "Bitrix\Main\Entity\DatetimeField" => "lib/entity/datetimefield.php", 
                "Bitrix\Main\Entity\EnumField" => "lib/entity/enumfield.php", 
                "Bitrix\Main\Entity\ExpressionField" => "lib/entity/expressionfield.php", 
                "Bitrix\Main\Entity\UField" => "lib/entity/ufield.php", 
                "Bitrix\Main\Entity\ReferenceField" => "lib/entity/referencefield.php", 
                "Bitrix\Main\Entity\Query" => "lib/entity/query.php", 
                "Bitrix\Main\Entity\QueryChain" => "lib/entity/querychain.php", 
                "Bitrix\Main\Entity\QueryChainElement" => "lib/entity/querychainelement.php", 
                "Bitrix\Main\SiteTable" => "lib/site.php", 
                "Bitrix\Main\UserTable" => "lib/user.php", 
                "Bitrix\Main\UtsUserTable" => "lib/utsuser.php", 
                "Bitrix\Main\UtmUserTable" => "lib/utmuser.php", 
                "Bitrix\Main\UserGroupTable" => "lib/usergroup.php", 
                "Bitrix\Main\GroupTable" => "lib/group.php", 
                "Bitrix\Main\Localization\CultureTable" => "lib/localization/culture.php", 
                "\Bitrix\Main\Entity\Base" => "lib/entity/base.php", 
                "\Bitrix\Main\Entity\DataManager" => "lib/entity/datamanager.php", 
                "\Bitrix\Main\Entity\Field" => "lib/entity/field.php", 
                "\Bitrix\Main\Entity\ScalarField" => "lib/entity/scalarfield.php", 
                "\Bitrix\Main\Entity\IntegerField" => "lib/entity/integerfield.php", 
                "\Bitrix\Main\Entity\FloatField" => "lib/entity/floatfield.php", 
                "\Bitrix\Main\Entity\StringField" => "lib/entity/stringfield.php", 
                "\Bitrix\Main\Entity\TextField" => "lib/entity/textfield.php", 
                "\Bitrix\Main\Entity\BooleanField" => "lib/entity/booleanfield.php", 
                "\Bitrix\Main\Entity\DateField" => "lib/entity/datefield.php", 
                "\Bitrix\Main\Entity\DatetimeField" => "lib/entity/datetimefield.php", 
                "\Bitrix\Main\Entity\EnumField" => "lib/entity/enumfield.php", 
                "\Bitrix\Main\Entity\ExpressionField" => "lib/entity/expressionfield.php", 
                "\Bitrix\Main\Entity\UField" => "lib/entity/ufield.php", 
                "\Bitrix\Main\Entity\ReferenceField" => "lib/entity/referencefield.php", 
                "\Bitrix\Main\Entity\Query" => "lib/entity/query.php", 
                "\Bitrix\Main\Entity\QueryChain" => "lib/entity/querychain.php", 
                "\Bitrix\Main\Entity\QueryChainElement" => "lib/entity/querychainelement.php", 
                "\Bitrix\Main\SiteTable" => "lib/site.php", 
                "\Bitrix\Main\UserTable" => "lib/user.php", 
                "\Bitrix\Main\UtsUserTable" => "lib/utsuser.php", 
                "\Bitrix\Main\UtmUserTable" => "lib/utmuser.php", 
                "\Bitrix\Main\UserGroupTable" => "lib/usergroup.php", 
                "\Bitrix\Main\GroupTable" => "lib/group.php", 
                "\Bitrix\Main\Localization\CultureTable" => "lib/localization/culture.php", 
                "CTableSchema" => "classes/general/table_schema.php", 
                "CUserCounter" => "classes/" . $DBType . "/user_counter.php", 
                "CHotKeys" => "classes/general/hot_keys.php", 
                "CHotKeysCode" => "classes/general/hot_keys.php", 
                "CBXSanitizer" => "classes/general/sanitizer.php", 
                "CBXArchive" => "classes/general/archive.php", 
                "CAdminNotify" => "classes/general/admin_notify.php", 
                "CBXFavAdmMenu" => "classes/general/favorites.php", 
                "CAdminInformer" => "classes/general/admin_informer.php" 
) 
); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/agent.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/user.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/event.php"); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/menu.php"); 
AddEventHandler("main", "OnAfterEpilog", array("CCacheManager", "_Finalize")); 
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/usertype.php"); 
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/update_db_updater.php"))) 
{ 
        $US_HOST_PROCESS_MAIN = false; 
        include($_fname); 
} 
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . "/bitrix/init.php"))) 
        include_once($_fname); 
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/init.php"))) 
        include_once($_fname); 
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . SITE_ID . "/init.php"))) 
        include_once($_fname); 
if(!defined("BX_FILE_PERMISSIONS")) 
        define("BX_FILE_PERMISSIONS", 0600); 
if(!defined("BX_DIR_PERMISSIONS")) 
        define("BX_DIR_PERMISSIONS", 0700); 
$GLOBALS ["sDocPath"] = $GLOBALS ["APPLICATION"]->GetCurPage(); 
if((!(defined("STATISTIC_ONLY") && STATISTIC_ONLY && substr($GLOBALS ["APPLICATION"]->GetCurPage(), 0, strlen(BX_ROOT . "/admin/"))!= BX_ROOT . "/admin/")) && COption::GetOptionString("main", "include_charset", "Y")== "Y" && strlen(LANG_CHARSET)> 0) 
        header("Content-Type: text/html; charset=" . LANG_CHARSET); 
if(COption::GetOptionString("main", "set_p3p_header", "Y")== "Y") 
        header("P3P: policyref=\"/bitrix/p3p.xml\", CP=\"NON DSP COR CUR ADM DEV PSA PSD OUR UNR BUS UNI COM NAV INT DEM STA\""); 
  
$LICENSE_KEY = ""; 
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/license_key.php"))) 
        include($_fname); 
if($LICENSE_KEY == "" || strtoupper($LICENSE_KEY)== "DEMO") 
        define("LICENSE_KEY", "DEMO"); 
else 
        define("LICENSE_KEY", $LICENSE_KEY); 
header("X-Powered-CMS: Bitrix Site Manager(" .(LICENSE_KEY == "DEMO" ? "DEMO" : md5("BITRIX" . LICENSE_KEY . "LICENCE")). ")"); 
define("BX_CRONTAB_SUPPORT", defined("BX_CRONTAB")); 
if(COption::GetOptionString("main", "check_agents", "Y")== "Y") 
{ 
        define("START_EXEC_AGENTS_1", microtime()); 
        $GLOBALS ["BX_STATE"] = "AG"; 
        $GLOBALS ["DB"]->StartUsingMasterOnly(); 
        CAgent::CheckAgents(); 
        $GLOBALS ["DB"]->StopUsingMasterOnly(); 
        define("START_EXEC_AGENTS_2", microtime()); 
        $GLOBALS ["BX_STATE"] = "PB"; 
} 
if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security")) 
        CSecuritySession::Init(); 
$GLOBALS ["aHeadersInfo"] = array(); 
if(headers_sent($hs_file, $hs_line)) 
        $GLOBALS ["aHeadersInfo"] = array("file" => $hs_file, "line" => $hs_line); 
session_start(); 
foreach(GetModuleEvents("main", "OnPageStart", true)as $arEvent) 
        ExecuteModuleEventEx($arEvent); 
$GLOBALS ["USER"] = new CUser(); 
$arPolicy = $GLOBALS ["USER"]->GetSecurityPolicy(); 
$currTime = time(); 
if( 
        ( 
        $_SESSION ["SESS_IP"] 
         && strlen($arPolicy ["SESSION_IP_MASK"])> 0 
         &&( 
                (ip2long($arPolicy ["SESSION_IP_MASK"])& ip2long($_SESSION ["SESS_IP"])) 
                != 
                (ip2long($arPolicy ["SESSION_IP_MASK"])& ip2long($_SERVER ["REMOTE_ADDR"])) 
                ) 
                ) 
                || 
        ( 
                $arPolicy ["SESSION_TIMEOUT"] > 0 
                 && $_SESSION ["SESS_TIME"] > 0 
                 && $currTime - $arPolicy ["SESSION_TIMEOUT"] * 60 > $_SESSION ["SESS_TIME"] 
        ) 
        || 
        ( 
                isset($_SESSION ["BX_SESSION_TERMINATE_TIME"]) 
                 && $_SESSION ["BX_SESSION_TERMINATE_TIME"] > 0 
                 && $currTime > $_SESSION ["BX_SESSION_TERMINATE_TIME"] 
        ) 
        || 
( 
                isset($_SESSION ["BX_SESSION_SIGN"]) 
                 && $_SESSION ["BX_SESSION_SIGN"] != bitrix_sess_sign() 
        ) 
        ) 
        { 
        $_SESSION = array(); 
        @session_destroy(); 
        if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security")) 
                CSecuritySession::Init(); 
        session_id(md5(uniqid(rand(), true))); 
        session_start(); 
        $GLOBALS ["USER"] = new CUser(); 
} 
$_SESSION ["SESS_IP"] = $_SERVER ["REMOTE_ADDR"]; 
$_SESSION ["SESS_TIME"] = time(); 
if(!isset($_SESSION ["BX_SESSION_SIGN"])) 
        $_SESSION ["BX_SESSION_SIGN"] = bitrix_sess_sign(); 
if( 
        (COption::GetOptionString("main", "use_session_id_ttl", "N")== "Y") 
 &&(COption::GetOptionInt("main", "session_id_ttl", 0)> 0) 
 && !defined("BX_SESSION_ID_CHANGE") 
) 
{ 
        if(!array_key_exists("SESS_ID_TIME", $_SESSION)) 
        { 
                $_SESSION ["SESS_ID_TIME"] = $_SESSION ["SESS_TIME"]; 
        } 
        elseif(($_SESSION ["SESS_ID_TIME"] + COption::GetOptionInt("main", "session_id_ttl"))< $_SESSION ["SESS_TIME"]) 
        { 
                if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security")) 
                { 
                        CSecuritySession::UpdateSessID(); 
                } 
                else 
                { 
                        session_regenerate_id(); 
                } 
                $_SESSION ["SESS_ID_TIME"] = $_SESSION ["SESS_TIME"]; 
        } 
} 
define("BX_STARTED", true); 
if(isset($_SESSION ["BX_ADMIN_LOAD_AUTH"])) 
{ 
        define("ADMIN_SECTION_LOAD_AUTH", 1); 
        unset($_SESSION ["BX_ADMIN_LOAD_AUTH"]); 
} 
if(!defined("NOT_CHECK_PERMISSIONS")|| NOT_CHECK_PERMISSIONS !== true) 
{ 
        $bLogout = isset($_REQUEST ["logout"]) &&(strtolower($_REQUEST ["logout"])== "yes"); 
        if($bLogout && $GLOBALS ["USER"]->IsAuthorized()) 
        { 
                $GLOBALS ["USER"]->Logout(); 
                LocalRedirect($GLOBALS ["APPLICATION"]->GetCurPageParam("", array("logout"))); 
        } 
        $cookie_prefix = COption::GetOptionString("main", "cookie_name", "BITRIX_SM"); 
        $cookie_login = $_COOKIE [$cookie_prefix . "_LOGIN"]; 
        $cookie_md5pass = $_COOKIE [$cookie_prefix . "_UIDH"]; 
        if(COption::GetOptionString("main", "store_password", "Y")== "Y" 
        && strlen($cookie_login)> 0 
        && strlen($cookie_md5pass)> 0 
        && !$GLOBALS ["USER"]->IsAuthorized() 
        && !$bLogout 
        && $_SESSION ["SESS_PWD_HASH_TESTED"] != md5($cookie_login . "|" . $cookie_md5pass) 
        ) 
        { 
                $GLOBALS ["USER"]->LoginByHash($cookie_login, $cookie_md5pass); 
                $_SESSION ["SESS_PWD_HASH_TESTED"] = md5($cookie_login . "|" . $cookie_md5pass); 
        } 
        $arAuthResult = false; 
        if(($httpAuth = $GLOBALS ["USER"]->LoginByHttpAuth())!== null) 
        { 
                $arAuthResult = $httpAuth; 
                $GLOBALS ["APPLICATION"]->SetAuthResult($arAuthResult); 
        } 
        if(isset($_REQUEST ["AUTH_FORM"]) && $_REQUEST ["AUTH_FORM"] != "") 
        { 
                $bRsaError = false; 
                if(COption::GetOptionString("main", "use_encrypted_auth", "N")== "Y") 
                { 
                        $sec = new CRsaSecurity(); 
                        if(($arKeys = $sec->LoadKeys())) 
                        { 
                                $sec->SetKeys($arKeys); 
                                $errno = $sec->AcceptFromForm(array("USER_PASSWORD", "USER_CONFIRM_PASSWORD")); 
                                if($errno == CRsaSecurity::ERROR_SESS_CHECK) 
                                        $arAuthResult = array("MESSAGE" => GetMessage("main_include_decode_pass_sess"), "TYPE" => "ERROR"); 
                                elseif($errno < 0) 
                                        $arAuthResult = array("MESSAGE" => GetMessage("main_include_decode_pass_err", array("#ERRCODE#" => $errno)), "TYPE" => "ERROR"); 
                                if($errno < 0) 
                                        $bRsaError = true; 
                        } 
                } 
                if($bRsaError == false) 
                { 
                        if(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true) 
                                $USER_LID = LANG; 
                        else 
                                $USER_LID = false; 
                        if($_REQUEST ["TYPE"] == "AUTH") 
                        { 
                                $arAuthResult = $GLOBALS ["USER"]->Login($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_REMEMBER"]); 
                                if($arAuthResult === true && defined("ADMIN_SECTION") && ADMIN_SECTION === true) 
                                { 
                                        $_SESSION ["BX_ADMIN_LOAD_AUTH"] = true; 
                                        echo '<script type="text/javascript">window.onload=function(){top.BX.AUTHAGENT.setAuthResult(false);};</script>'; 
                                        die(); 
                                } 
                        } 
                        elseif($_REQUEST ["TYPE"] == "SEND_PWD") 
                                $arAuthResult = $GLOBALS ["USER"]->SendPassword($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_EMAIL"], $USER_LID); 
                        elseif($_SERVER ["REQUEST_METHOD"] == "POST" && $_REQUEST ["TYPE"] == "CHANGE_PWD") 
                                $arAuthResult = $GLOBALS ["USER"]->ChangePassword($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_CHECKWORD"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_CONFIRM_PASSWORD"], $USER_LID); 
                        elseif(COption::GetOptionString("main", "new_user_registration", "N")== "Y" && $_SERVER ["REQUEST_METHOD"] == "POST" && $_REQUEST ["TYPE"] == "REGISTRATION" &&(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true)) 
                                $arAuthResult = $GLOBALS ["USER"]->Register($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_NAME"], $_REQUEST ["USER_LAST_NAME"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_CONFIRM_PASSWORD"], $_REQUEST ["USER_EMAIL"], $USER_LID, $_REQUEST ["captcha_word"], $_REQUEST ["captcha_sid"]); 
                } 
                $GLOBALS ["APPLICATION"]->SetAuthResult($arAuthResult); 
        } 
        elseif(!$GLOBALS ["USER"]->IsAuthorized()) 
        { 
                $GLOBALS ["USER"]->LoginHitByHash(); 
        } 
} 
if(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true) 
{ 
        if(array_key_exists("bitrix_preview_site_template", $_REQUEST) && $_REQUEST ["bitrix_preview_site_template"] != "" && $GLOBALS ["USER"]->CanDoOperation("view_other_settings")) 
        { 
                $aTemplates = CSiteTemplate::GetByID($_REQUEST ["bitrix_preview_site_template"]); 
                if($template = $aTemplates->Fetch()) 
                        define("SITE_TEMPLATE_ID", $template ["ID"]); 
                else 
                        define("SITE_TEMPLATE_ID", CSite::GetCurTemplate()); 
        } 
        else 
                define("SITE_TEMPLATE_ID", CSite::GetCurTemplate()); 
        define("SITE_TEMPLATE_PATH", BX_PERSONAL_ROOT . "/templates/" . SITE_TEMPLATE_ID); 
} 
if(isset($_GET ["show_page_exec_time"])) 
{ 
        if($_GET ["show_page_exec_time"] == "Y" || $_GET ["show_page_exec_time"] == "N") 
                $_SESSION ["SESS_SHOW_TIME_EXEC"] = $_GET ["show_page_exec_time"]; 
} 
if(isset($_GET ["show_include_exec_time"])) 
{ 
        if($_GET ["show_include_exec_time"] == "Y" || $_GET ["show_include_exec_time"] == "N") 
                $_SESSION ["SESS_SHOW_INCLUDE_TIME_EXEC"] = $_GET ["show_include_exec_time"]; 
} 
if(isset($_GET ["bitrix_include_areas"]) && $_GET ["bitrix_include_areas"] != "") 
        $GLOBALS ["APPLICATION"]->SetShowIncludeAreas($_GET ["bitrix_include_areas"] == "Y"); 
if($GLOBALS ["USER"]->IsAuthorized()) 
{ 
        $cookie_prefix = COption::GetOptionString("main", "cookie_name", "BITRIX_SM"); 
        if(!isset($_COOKIE [$cookie_prefix . "_SOUND_LOGIN_PLAYED"])) 
                $GLOBALS ["APPLICATION"]->set_cookie("SOUND_LOGIN_PLAYED", "Y", 0); 
} 
foreach(GetModuleEvents("main", "OnBeforeProlog", true)as $arEvent) 
        ExecuteModuleEventEx($arEvent); 
if((!defined("NOT_CHECK_PERMISSIONS")|| NOT_CHECK_PERMISSIONS !== true) &&(!defined("NOT_CHECK_FILE_PERMISSIONS")|| NOT_CHECK_FILE_PERMISSIONS !== true)) 
{ 
        $real_path = $GLOBALS ["APPLICATION"]->GetCurPage(true); 
        if(isset($_SERVER ["REAL_FILE_PATH"]) && $_SERVER ["REAL_FILE_PATH"] != "") 
                $real_path = $_SERVER ["REAL_FILE_PATH"]; 
        if(!$GLOBALS ["USER"]->CanDoFileOperation("fm_view_file", array(SITE_ID, $real_path))||(defined("NEED_AUTH") && NEED_AUTH && !$GLOBALS ["USER"]->IsAuthorized())) 
        { 
                if($GLOBALS ["USER"]->IsAuthorized() && $arAuthResult ["MESSAGE"] == "") 
                        $arAuthResult = array("MESSAGE" => GetMessage("ACCESS_DENIED"). " " . GetMessage("ACCESS_DENIED_FILE", array("#FILE#" => $real_path)), "TYPE" => "ERROR"); 
                if(defined("ADMIN_SECTION") && ADMIN_SECTION == true) 
                { 
                        if($_REQUEST ["mode"] == "list" || $_REQUEST ["mode"] == "settings") 
                        { 
                                echo "<script>top.location='" . $GLOBALS ["APPLICATION"]->GetCurPage(). "?" . DeleteParam(array("mode")). "';</script>"; 
                                die(); 
                        } 
                        elseif($_REQUEST ["mode"] == "frame") 
                        { 
                                echo "<script type=\"text/javascript\"> 
                                        var w =(opener? opener.window:parent.window); 
                                        w.location.href='" . $GLOBALS ["APPLICATION"]->GetCurPage(). "?" . DeleteParam(array("mode")). "'; 
                                </script>"; 
                                die(); 
                        } 
                        elseif(defined("MOBILE_APP_ADMIN") && MOBILE_APP_ADMIN == true) 
                        { 
                                echo json_encode(array("status" => "failed")); 
                                die(); 
                        } 
                } 
                $GLOBALS ["APPLICATION"]->AuthForm($arAuthResult); 
        } 
} 
if(isset($REDIRECT_STATUS) && $REDIRECT_STATUS == 404) 
{ 
        if(COption::GetOptionString("main", "header_200", "N")== "Y") 
                CHTTP::SetStatus("200 OK"); 
} 
  ?>

Did this file decode correctly?

Original Code

<?php
require_once(substr(__file__, 0, strlen(__file__) - strlen("/include.php")). "/bx_root.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/start.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_io.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_file.php");
$GLOBALS ["APPLICATION"] = new CMain();
if(defined("SITE_ID"))
        define("LANG", SITE_ID);
if(defined("LANG"))
{
        if(defined("ADMIN_SECTION") && ADMIN_SECTION === true)
                $db_lang = CLangAdmin::GetByID(LANG);
        else
                $db_lang = CLang::GetByID(LANG);
        $arLang = $db_lang->Fetch();
}
else
{
        $arLang = $GLOBALS ["APPLICATION"]->GetLang();
        define("LANG", $arLang ["LID"]);
}
$lang = $arLang ["LID"];
define("SITE_ID", $arLang ["LID"]);
define("SITE_DIR", $arLang ["DIR"]);
define("SITE_SERVER_NAME", $arLang ["SERVER_NAME"]);
define("SITE_CHARSET", $arLang ["CHARSET"]);
define("FORMAT_DATE", $arLang ["FORMAT_DATE"]);
define("FORMAT_DATETIME", $arLang ["FORMAT_DATETIME"]);
define("LANG_DIR", $arLang ["DIR"]);
define("LANG_CHARSET", $arLang ["CHARSET"]);
define("LANG_ADMIN_LID", $arLang ["LANGUAGE_ID"]);
define("LANGUAGE_ID", $arLang ["LANGUAGE_ID"]);
$GLOBALS ["APPLICATION"]->reinitPath();
$GLOBALS ["MESS"] = array();
$GLOBALS ["ALL_LANG_FILES"] = array();
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/tools.php");
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/date_format.php");
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/database.php");
IncludeModuleLangFile($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/main.php");
IncludeModuleLangFile(__file__);
error_reporting(COption::GetOptionInt("main", "error_reporting", e_compile_error | e_error | e_core_error | e_parse)& ~ E_STRICT);
if(!defined("BX_COMP_MANAGED_CACHE") && COption::GetOptionString("main", "component_managed_cache_on", "Y")!= "N")
        define("BX_COMP_MANAGED_CACHE", true);
if($domain = $GLOBALS ["APPLICATION"]->GetCookieDomain())
        ini_set("session.cookie_domain", $domain);
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/filter_tools.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/ajax_tools.php");
define("INTRANET_EDITION", "Y");
class CBXFeatures
{
        private static $_1408214551 = 30;
        private static $_58665169 = array(
                        "Portal" => array(
                                        "CompanyCalendar",
                                        "CompanyPhoto",
                                        "CompanyVideo",
                                        "CompanyCareer",
                                        "StaffChanges",
                                        "StaffAbsence",
                                        "CommonDocuments",
                                        "MeetingRoomBookingSystem",
                                        "Wiki",
                                        "Learning",
                                        "Vote",
                                        "WebLink",
                                        "Subscribe",
                                        "Friends",
                                        "PersonalFiles",
                                        "PersonalBlog",
                                        "PersonalPhoto",
                                        "PersonalForum",
                                        "Blog",
                                        "Forum",
                                        "Gallery",
                                        "Board",
                                        "MicroBlog",
                                        "WebMessenger"
                        ),
                        "Communications" => array(
                                        "Tasks",
                                        "Calendar",
                                        "Workgroups",
                                        "Jabber",
                                        "VideoConference",
                                        "Extranet",
                                        "SMTP",
                                        "Requests",
                                        "DAV",
                                        "intranet_sharepoint",
                                        "timeman",
                                        "Idea",
                                        "Meeting",
                                        "EventList",
                                        "Salary",
                                        "XDImport"
                        ),
                        "Enterprise" => array(
                                        "BizProc",
                                        "Lists",
                                        "Support",
                                        "Analytics",
                                        "crm",
                                        "Controller"
                        ),
                        "Holding" => array(
                                        "Cluster",
                                        "MultiSites"
                        )
        );
        private static $_1247112795 = false;
        private static $_835716084 = false;
        private static function Initialize()
        {
                if(self::$_1247112795 == false)
                {
                        self::$_1247112795 = array();
                        foreach(self::$_58665169 as $_1634993615 => $arFeatures)
                        {
                                foreach($arFeatures as $featureId)
                                        self::$_1247112795 [$featureId] = $_1634993615;
                        }
                }
                if(self::$_835716084 == false)
                {
                        self::$_835716084 = array();
                        $_513078194 = COption::GetOptionString("main", "~cpf_map_value", "");
                        if(strlen($_513078194)> 0)
                        {
                                $_513078194 = base64_decode($_513078194);
                                self::$_835716084 = unserialize($_513078194);
                                if(!is_array(self::$_835716084))
                                        self::$_835716084 = array();
                        }
                        if(count(self::$_835716084)<= 0)
                                self::$_835716084 = array(
                                                "e" => array(),
                                                "f" => array()
                                );
                }
        }
        public static function InitiateEditionsSettings($arEditions)
        {
                self::Initialize();
                $_1345170397 = array();
                foreach(self::$_58665169 as $_1634993615 => $arFeatures)
                {
                        $_473486535 = in_array($_1634993615, $arEditions);
                        self::$_835716084 ["e"] [$_1634993615] =($_473486535 ? array("F"): array("X"));
                        foreach($arFeatures as $featureId)
                        {
                                self::$_835716084 ["f"] [$featureId] = $_473486535;
                                if(!$_473486535)
                                        $_1345170397 [] = array($featureId, false);
                        }
                }
                $_1610123030 = serialize(self::$_835716084);
                $_1610123030 = base64_encode($_1610123030);
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030);
                foreach($_1345170397 as $_690296712)
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]);
        }
        public static function IsFeatureEnabled($featureId)
        {
                if(strlen($featureId)<= 0)
                        return true;
                self::Initialize();
                if(!array_key_exists($featureId, self::$_1247112795))
                        return true;
                if(self::$_1247112795 [$featureId] == "Portal")
                        $_1457953465 = array("F");
                elseif(array_key_exists(self::$_1247112795 [$featureId], self::$_835716084 ["e"]))
                        $_1457953465 = self::$_835716084 ["e"] [self::$_1247112795 [$featureId]];
                else
                        $_1457953465 = array("X");
                if($_1457953465 [0] != "F" && $_1457953465 [0] != "D")
                {
                        return false;
                }
                elseif($_1457953465 [0] == "D")
                {
                        if($_1457953465 [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y")))
                        {
                                if(!isset($_1457953465 [2])|| !$_1457953465 [2])
                                        self::MarkTrialPeriodExpired(self::$_1247112795 [$featureId]);
                                return false;
                        }
                }
                return !array_key_exists($featureId, self::$_835716084 ["f"])|| self::$_835716084 ["f"] [$featureId];
        }
        public static function IsFeatureInstalled($featureId)
        {
                if(strlen($featureId)<= 0)
                        return true;
                self::Initialize();
                return(array_key_exists($featureId, self::$_835716084 ["f"]) && self::$_835716084 ["f"] [$featureId]);
        }
        public static function IsFeatureEditable($featureId)
        {
                if(strlen($featureId)<= 0)
                        return true;
                self::Initialize();
                if(!array_key_exists($featureId, self::$_1247112795))
                        return true;
                if(self::$_1247112795 [$featureId] == "Portal")
                        $_1457953465 = array("F");
                elseif(array_key_exists(self::$_1247112795 [$featureId], self::$_835716084 ["e"]))
                        $_1457953465 = self::$_835716084 ["e"] [self::$_1247112795 [$featureId]];
                else
                        $_1457953465 = array("X");
                if($_1457953465 [0] != "F" && $_1457953465 [0] != "D")
                {
                        return false;
                }
                elseif($_1457953465 [0] == "D")
                {
                        if($_1457953465 [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y")))
                        {
                                if(!isset($_1457953465 [2])|| !$_1457953465 [2])
                                        self::MarkTrialPeriodExpired(self::$_1247112795 [$featureId]);
                                return false;
                        }
                }
                return true;
        }
        private static function ExecuteEvent($featureId, $_1538917497)
        {
                if(method_exists("CBXFeatures", "On" . $featureId . "SettingsChange"))
                        call_user_func_array(array("CBXFeatures", "On" . $featureId . "SettingsChange"), array($featureId, $_1538917497));
                $_36951677 = GetModuleEvents("main", "On" . $featureId . "SettingsChange");
                while($arEvent = $_36951677->Fetch())
                        ExecuteModuleEventEx($arEvent, array($featureId,$_1538917497));
        }
        public static function SetFeatureEnabled($featureId, $_1538917497 = true, $_347148369 = true)
        {
                if(strlen($featureId)<= 0)
                        return;
                if(!self::IsFeatureEditable($featureId))
                        $_1538917497 = false;
                $_1538917497 =($_1538917497 ? true : false);
                self::Initialize();
                $_1187344289 =(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 || array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 != self::$_835716084 ["f"] [$featureId]);
                self::$_835716084 ["f"] [$featureId] = $_1538917497;
                $_1610123030 = serialize(self::$_835716084);
                $_1610123030 = base64_encode($_1610123030);
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030);
                if($_1187344289 && $_347148369)
                        self::ExecuteEvent($featureId, $_1538917497);
        }
        private static function MarkTrialPeriodExpired($_1634993615)
        {
                if(strlen($_1634993615)<= 0 || $_1634993615 == "Portal")
                        return;
                self::Initialize();
                if(!array_key_exists($_1634993615, self::$_835716084 ["e"])|| array_key_exists($_1634993615, self::$_835716084 ["e"]) && self::$_835716084 ["e"] [$_1634993615] [0] != "D")
                        return;
                if(isset(self::$_835716084 ["e"] [$_1634993615] [1]) && self::$_835716084 ["e"] [$_1634993615] [2])
                        return;
                $_1345170397 = array();
                if(array_key_exists($_1634993615, self::$_58665169) && is_array(self::$_58665169 [$_1634993615]))
                {
                        foreach(self::$_58665169 [$_1634993615] as $featureId)
                        {
                                if(array_key_exists($featureId, self::$_835716084 ["f"]) && self::$_835716084 ["f"] [$featureId])
                                {
                                        self::$_835716084 ["f"] [$featureId] = false;
                                        $_1345170397 [] = array($featureId, false);
                                }
                        }
                        self::$_835716084 ["e"] [$_1634993615] [2] = true;
                }
                $_1610123030 = serialize(self::$_835716084);
                $_1610123030 = base64_encode($_1610123030);
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030);
                foreach($_1345170397 as $_690296712)
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]);
        }
        public static function ModifyFeaturesSettings($arEditions, $arFeatures)
        {
                self::Initialize();
                foreach($arEditions as $_1634993615 => $_634862492)
                        self::$_835716084 ["e"] [$_1634993615] = $_634862492;
                $_1345170397 = array();
                foreach($arFeatures as $featureId => $_1538917497)
                {
                        if(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 || array_key_exists($featureId, self::$_835716084 ["f"]) && $_1538917497 != self::$_835716084 ["f"] [$featureId])
                                $_1345170397 [] = array($featureId, $_1538917497);
                        self::$_835716084 ["f"] [$featureId] = $_1538917497;
                }
                $_1610123030 = serialize(self::$_835716084);
                $_1610123030 = base64_encode($_1610123030);
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030);
                self::$_835716084 = false;
                foreach($_1345170397 as $_690296712)
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]);
        }
        public static function SaveFeaturesSettings($arEnabledEditions, $arEnabledFeatures)
        {
                self::Initialize();
                $_863728662 = array("e" => array(), "f" => array());
                if(!is_array($arEnabledEditions))
                        $arEnabledEditions = array();
                if(!is_array($arEnabledFeatures))
                        $arEnabledFeatures = array();
                if(!in_array("Portal", $arEnabledEditions))
                        $arEnabledEditions [] = "Portal";
                foreach(self::$_58665169 as $_1634993615 => $arFeatures)
                {
                        if(array_key_exists($_1634993615, self::$_835716084 ["e"]))
                                $_100178709 = self::$_835716084 ["e"] [$_1634993615];
                        else
                                $_100178709 =($_1634993615 == "Portal")? array("F"): array("X");
                        if($_100178709 [0] == "F" || $_100178709 [0] == "D")
                        {
                                $_863728662 ["e"] [$_1634993615] = $_100178709;
                        } else
                        {
                                if(in_array($_1634993615, $arEnabledEditions))
                                        $_863728662 ["e"] [$_1634993615] = array("D", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
                                else
                                        $_863728662 ["e"] [$_1634993615] = array("X");
                        }
                }
                $_1345170397 = array();
                foreach(self::$_1247112795 as $featureId => $_1634993615)
                {
                        if($_863728662 ["e"] [$_1634993615] [0] != "F" && $_863728662 ["e"] [$_1634993615] [0] != "D")
                        {
                                $_863728662 ["f"] [$featureId] = false;
                        }
                        else
                        {
                                if($_863728662 ["e"] [$_1634993615] [0] == "D" && $_863728662 ["e"] [$_1634993615] [1] < mktime(0, 0, 0, date("m"), date("d")- self::$_1408214551, date("Y")))
                                        $_863728662 ["f"] [$featureId] = false;
                                else
                                        $_863728662 ["f"] [$featureId] = in_array($featureId, $arEnabledFeatures);
                                if(!array_key_exists($featureId, self::$_835716084 ["f"]) && $_863728662 ["f"] [$featureId] || array_key_exists($featureId, self::$_835716084 ["f"]) && $_863728662 ["f"] [$featureId] != self::$_835716084 ["f"] [$featureId])
                                        $_1345170397 [] = array($featureId, $_863728662 ["f"] [$featureId]);
                        }
                }
                $_1610123030 = serialize($_863728662);
                $_1610123030 = base64_encode($_1610123030);
                COption::SetOptionString("main", "~cpf_map_value", $_1610123030);
                self::$_835716084 = false;
                foreach($_1345170397 as $_690296712)
                        self::ExecuteEvent($_690296712 [0], $_690296712 [1]);
        }
        public static function GetFeaturesList()
        {
                self::Initialize();
                $_319143224 = array();
                foreach(self::$_58665169 as $_1634993615 => $arFeatures)
                {
                        if(array_key_exists($_1634993615, self::$_835716084 ["e"]))
                                $_100178709 = self::$_835716084 ["e"] [$_1634993615];
                        else
                                $_100178709 =($_1634993615 == "Portal")? array("F"): array("X");
                        $_319143224 [$_1634993615] = array(
                                        "TYPE" => $_100178709 [0],
                                        "DATE" => $_100178709 [1],
                                        "FEATURES" => array()
                        );
                        $_319143224 [$_1634993615] ["EXPIRED"] = false;
                        if($_319143224 [$_1634993615] ["TYPE"] == "D")
                        {
                                $_319143224 [$_1634993615] ["TRY_DAYS_COUNT"] = intval((time()- $_319143224 [$_1634993615] ["DATE"])/ 64800);
                                if($_319143224 [$_1634993615] ["TRY_DAYS_COUNT"] > self::$_1408214551)
                                        $_319143224 [$_1634993615] ["EXPIRED"] = true;
                        }
                        foreach($arFeatures as $featureId)
                                $_319143224 [$_1634993615] ["FEATURES"] [$featureId] =(!array_key_exists($featureId, self::$_835716084 ["f"])|| self::$_835716084 ["f"] [$featureId]);
                }
                return $_319143224;
        }
        private static function InstallModule($_689540566, $_128808919)
        {
                if(IsModuleInstalled($_689540566)== $_128808919)
                        return true;
                $_1070770522 = $_SERVER ["DOCUMENT_ROOT"] . "/bitrix/modules/" . $_689540566 . "/install/index.php";
                if(!file_exists($_1070770522))
                        return false;
                include_once($_1070770522);
                $_1335203152 = str_replace(".", "_", $_689540566);
                if(!class_exists($_1335203152))
                        return false;
                $_419071018 = new $_1335203152();
                if($_128808919)
                {
                        if(!$_419071018->InstallDB())
                                return false;
                        $_419071018->InstallEvents();
                        if(!$_419071018->InstallFiles())
                                return false;
                }
                else
                {
                        if(CModule::IncludeModule("search"))
                                CSearch::DeleteIndex($_689540566);
                        UnRegisterModule($_689540566);
                }
                return true;
        }
        private static function OnRequestsSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("form", $_1538917497);
        }
        private static function OnLearningSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("learning", $_1538917497);
        }
        private static function OnJabberSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("xmpp", $_1538917497);
        }
        private static function OnVideoConferenceSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("video", $_1538917497);
        }
        private static function OnBizProcSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("bizprocdesigner", $_1538917497);
        }
        private static function OnListsSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("lists", $_1538917497);
        }
        private static function OnWikiSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("wiki", $_1538917497);
        }
        private static function OnSupportSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("support", $_1538917497);
        }
        private static function OnControllerSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("controller", $_1538917497);
        }
        private static function OnAnalyticsSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("statistic", $_1538917497);
        }
        private static function OnVoteSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("vote", $_1538917497);
        }
        private static function OnFriendsSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_frields", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_frields", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_frields", $_1571534705);
                        }
                }
        }
        private static function OnMicroBlogSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_microblog_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_microblog_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_microblog_user", $_1571534705);
                        }
                        if(COption::GetOptionString("socialnetwork", "allow_microblog_group", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_microblog_group", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_microblog_group", $_1571534705);
                        }
                }
        }
        private static function OnPersonalFilesSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_files_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_files_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_files_user", $_1571534705);
                        }
                }
        }
        private static function OnPersonalBlogSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_blog_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_blog_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_blog_user", $_1571534705);
                        }
                }
        }
        private static function OnPersonalPhotoSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_photo_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_photo_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_photo_user", $_1571534705);
                        }
                }
        }
        private static function OnPersonalForumSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_forum_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_forum_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_forum_user", $_1571534705);
                        }
                }
        }
        private static function OnTasksSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_tasks_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_tasks_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_tasks_user", $_1571534705);
                        }
                        if(COption::GetOptionString("socialnetwork", "allow_tasks_group", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_tasks_group", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_tasks_group", $_1571534705);
                        }
                }
                self::InstallModule("tasks", $_1538917497);
        }
        private static function OnCalendarSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        $_1571534705 = "Y";
                else
                        $_1571534705 = "N";
                $_399435140 = CSite::GetList(($_473486535 = ""),($_2110082728 = ""), array(
                                "ACTIVE" => "Y"
                ));
                while($_1421646471 = $_399435140->Fetch())
                {
                        if(COption::GetOptionString("socialnetwork", "allow_calendar_user", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_calendar_user", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_calendar_user", $_1571534705);
                        }
                        if(COption::GetOptionString("socialnetwork", "allow_calendar_group", "Y", $_1421646471 ["ID"])!= $_1571534705)
                        {
                                COption::SetOptionString("socialnetwork", "allow_calendar_group", $_1571534705, false, $_1421646471 ["ID"]);
                                COption::SetOptionString("socialnetwork", "allow_calendar_group", $_1571534705);
                        }
                }
                self::InstallModule("calendar", $_1538917497);
        }
        private static function OnSMTPSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("mail", $_1538917497);
        }
        private static function OnExtranetSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("extranet", $_1538917497);
        }
        private static function OnDAVSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("dav", $_1538917497);
        }
        private static function OntimemanSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("timeman", $_1538917497);
        }
        private static function Onintranet_sharepointSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                {
                        RegisterModuleDependences("iblock", "OnAfterIBlockElementAdd", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem");
                        RegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem");
                        CAgent::AddAgent("CIntranetSharepoint::AgentLists();", "intranet", "N", 333);
                        CAgent::AddAgent("CIntranetSharepoint::AgentQueue();", "intranet", "N", 225);
                        CAgent::AddAgent("CIntranetSharepoint::AgentUpdate();", "intranet", "N", 3600);
                }
                else
                {
                        UnRegisterModuleDependences("iblock", "OnAfterIBlockElementAdd", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem");
                        UnRegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "intranet", "CIntranetEventHandlers", "SPRegisterUpdatedItem");
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentLists();", "intranet");
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentQueue();", "intranet");
                        CAgent::RemoveAgent("CIntranetSharepoint::AgentUpdate();", "intranet");
                }
        }
        private static function OncrmSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        COption::SetOptionString("crm", "form_features", "Y");
                self::InstallModule("crm", $_1538917497);
        }
        private static function OnClusterSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("cluster", $_1538917497);
        }
        private static function OnMultiSitesSettingsChange($featureId, $_1538917497)
        {
                if($_1538917497)
                        RegisterModuleDependences("main", "OnBeforeProlog", "main", "CWizardSolPanelIntranet", "ShowPanel", 100, "/modules/intranet/panel_button.php");
                else
                        UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "CWizardSolPanelIntranet", "ShowPanel", "/modules/intranet/panel_button.php");
        }
        private static function OnIdeaSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("idea", $_1538917497);
        }
        private static function OnMeetingSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("meeting", $_1538917497);
        }
        private static function OnXDImportSettingsChange($featureId, $_1538917497)
        {
                self::InstallModule("xdimport", $_1538917497);
        }
}
define("ENCODE", "Y");
$GLOBALS ["arCustomTemplateEngines"] = array();
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/urlrewriter.php");
CModule::AddAutoloadClasses(
        "main",
        array(
                "CBitrixComponent" => "classes/general/component.php",
                "CComponentEngine" => "classes/general/component_engine.php",
                "CComponentAjax" => "classes/general/component_ajax.php",
                "CBitrixComponentTemplate" => "classes/general/component_template.php",
                "CComponentUtil" => "classes/general/component_util.php",
                "CControllerClient" => "classes/general/controller_member.php",
                "PHPParser" => "classes/general/php_parser.php",
                "CDiskQuota" => "classes/" . $DBType . "/quota.php",
                "CEventLog" => "classes/general/event_log.php",
                "CEventMain" => "classes/general/event_log.php",
                "CAdminFileDialog" => "classes/general/file_dialog.php",
                "WLL_User" => "classes/general/liveid.php",
                "WLL_ConsentToken" => "classes/general/liveid.php",
                "WindowsLiveLogin" => "classes/general/liveid.php",
                "CAllFile" => "classes/general/file.php",
                "CFile" => "classes/" . $DBType . "/file.php",
                "CTempFile" => "classes/general/file_temp.php",
                "CFavorites" => "classes/" . $DBType . "/favorites.php",
                "CUserOptions" => "classes/general/user_options.php",
                "CGridOptions" => "classes/general/grids.php",
                "CUndo" => "/classes/general/undo.php",
                "CAutoSave" => "/classes/general/undo.php",
                "CRatings" => "classes/" . $DBType . "/ratings.php",
                "CRatingsComponentsMain" => "classes/" . $DBType . "/ratings_components.php",
                "CRatingRule" => "classes/general/rating_rule.php",
                "CRatingRulesMain" => "classes/" . $DBType . "/rating_rules.php",
                "CTopPanel" => "public/top_panel.php",
                "CEditArea" => "public/edit_area.php",
                "CComponentPanel" => "public/edit_area.php",
                "CTextParser" => "classes/general/textparser.php",
                "CPHPCacheFiles" => "classes/general/cache_files.php",
                "CTimeZone" => "classes/general/time.php",
                "CDataXML" => "classes/general/xml.php",
                "CXMLFileStream" => "classes/general/xml.php",
                "CRsaProvider" => "classes/general/rsasecurity.php",
                "CRsaSecurity" => "classes/general/rsasecurity.php",
                "CRsaBcmathProvider" => "classes/general/rsabcmath.php",
                "CRsaOpensslProvider" => "classes/general/rsaopenssl.php",
                "CASNReader" => "classes/general/asn.php",
                "CBXShortUri" => "classes/" . $DBType . "/short_uri.php",
                "CFinder" => "classes/general/finder.php",
                "CAccess" => "classes/general/access.php",
                "CAuthProvider" => "classes/general/authproviders.php",
                "IProviderInterface" => "classes/general/authproviders.php",
                "CGroupAuthProvider" => "classes/general/authproviders.php",
                "CUserAuthProvider" => "classes/general/authproviders.php",
                "Bitrix\\Main\\Entity\\Base" => "lib/entity/base.php",
                "Bitrix\\Main\\Entity\\DataManager" => "lib/entity/datamanager.php",
                "Bitrix\\Main\\Entity\\Field" => "lib/entity/field.php",
                "Bitrix\\Main\\Entity\\ScalarField" => "lib/entity/scalarfield.php",
                "Bitrix\\Main\\Entity\\IntegerField" => "lib/entity/integerfield.php",
                "Bitrix\\Main\\Entity\\FloatField" => "lib/entity/floatfield.php",
                "Bitrix\\Main\\Entity\\StringField" => "lib/entity/stringfield.php",
                "Bitrix\\Main\\Entity\\TextField" => "lib/entity/textfield.php",
                "Bitrix\\Main\\Entity\\BooleanField" => "lib/entity/booleanfield.php",
                "Bitrix\\Main\\Entity\\DateField" => "lib/entity/datefield.php",
                "Bitrix\\Main\\Entity\\DatetimeField" => "lib/entity/datetimefield.php",
                "Bitrix\\Main\\Entity\\EnumField" => "lib/entity/enumfield.php",
                "Bitrix\\Main\\Entity\\ExpressionField" => "lib/entity/expressionfield.php",
                "Bitrix\\Main\\Entity\\UField" => "lib/entity/ufield.php",
                "Bitrix\\Main\\Entity\\ReferenceField" => "lib/entity/referencefield.php",
                "Bitrix\\Main\\Entity\\Query" => "lib/entity/query.php",
                "Bitrix\\Main\\Entity\\QueryChain" => "lib/entity/querychain.php",
                "Bitrix\\Main\\Entity\\QueryChainElement" => "lib/entity/querychainelement.php",
                "Bitrix\\Main\\SiteTable" => "lib/site.php",
                "Bitrix\\Main\\UserTable" => "lib/user.php",
                "Bitrix\\Main\\UtsUserTable" => "lib/utsuser.php",
                "Bitrix\\Main\\UtmUserTable" => "lib/utmuser.php",
                "Bitrix\\Main\\UserGroupTable" => "lib/usergroup.php",
                "Bitrix\\Main\\GroupTable" => "lib/group.php",
                "Bitrix\\Main\\Localization\\CultureTable" => "lib/localization/culture.php",
                "\\Bitrix\\Main\\Entity\\Base" => "lib/entity/base.php",
                "\\Bitrix\\Main\\Entity\\DataManager" => "lib/entity/datamanager.php",
                "\\Bitrix\\Main\\Entity\\Field" => "lib/entity/field.php",
                "\\Bitrix\\Main\\Entity\\ScalarField" => "lib/entity/scalarfield.php",
                "\\Bitrix\\Main\\Entity\\IntegerField" => "lib/entity/integerfield.php",
                "\\Bitrix\\Main\\Entity\\FloatField" => "lib/entity/floatfield.php",
                "\\Bitrix\\Main\\Entity\\StringField" => "lib/entity/stringfield.php",
                "\\Bitrix\\Main\\Entity\\TextField" => "lib/entity/textfield.php",
                "\\Bitrix\\Main\\Entity\\BooleanField" => "lib/entity/booleanfield.php",
                "\\Bitrix\\Main\\Entity\\DateField" => "lib/entity/datefield.php",
                "\\Bitrix\\Main\\Entity\\DatetimeField" => "lib/entity/datetimefield.php",
                "\\Bitrix\\Main\\Entity\\EnumField" => "lib/entity/enumfield.php",
                "\\Bitrix\\Main\\Entity\\ExpressionField" => "lib/entity/expressionfield.php",
                "\\Bitrix\\Main\\Entity\\UField" => "lib/entity/ufield.php",
                "\\Bitrix\\Main\\Entity\\ReferenceField" => "lib/entity/referencefield.php",
                "\\Bitrix\\Main\\Entity\\Query" => "lib/entity/query.php",
                "\\Bitrix\\Main\\Entity\\QueryChain" => "lib/entity/querychain.php",
                "\\Bitrix\\Main\\Entity\\QueryChainElement" => "lib/entity/querychainelement.php",
                "\\Bitrix\\Main\\SiteTable" => "lib/site.php",
                "\\Bitrix\\Main\\UserTable" => "lib/user.php",
                "\\Bitrix\\Main\\UtsUserTable" => "lib/utsuser.php",
                "\\Bitrix\\Main\\UtmUserTable" => "lib/utmuser.php",
                "\\Bitrix\\Main\\UserGroupTable" => "lib/usergroup.php",
                "\\Bitrix\\Main\\GroupTable" => "lib/group.php",
                "\\Bitrix\\Main\\Localization\\CultureTable" => "lib/localization/culture.php",
                "CTableSchema" => "classes/general/table_schema.php",
                "CUserCounter" => "classes/" . $DBType . "/user_counter.php",
                "CHotKeys" => "classes/general/hot_keys.php",
                "CHotKeysCode" => "classes/general/hot_keys.php",
                "CBXSanitizer" => "classes/general/sanitizer.php",
                "CBXArchive" => "classes/general/archive.php",
                "CAdminNotify" => "classes/general/admin_notify.php",
                "CBXFavAdmMenu" => "classes/general/favorites.php",
                "CAdminInformer" => "classes/general/admin_informer.php"
)
);
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/agent.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/user.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/event.php");
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/menu.php");
AddEventHandler("main", "OnAfterEpilog", array("CCacheManager", "_Finalize"));
require_once($_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . $DBType . "/usertype.php");
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/update_db_updater.php")))
{
        $US_HOST_PROCESS_MAIN = false;
        include($_fname);
}
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . "/bitrix/init.php")))
        include_once($_fname);
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/init.php")))
        include_once($_fname);
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . SITE_ID . "/init.php")))
        include_once($_fname);
if(!defined("BX_FILE_PERMISSIONS"))
        define("BX_FILE_PERMISSIONS", 0600);
if(!defined("BX_DIR_PERMISSIONS"))
        define("BX_DIR_PERMISSIONS", 0700);
$GLOBALS ["sDocPath"] = $GLOBALS ["APPLICATION"]->GetCurPage();
if((!(defined("STATISTIC_ONLY") && STATISTIC_ONLY && substr($GLOBALS ["APPLICATION"]->GetCurPage(), 0, strlen(BX_ROOT . "/admin/"))!= BX_ROOT . "/admin/")) && COption::GetOptionString("main", "include_charset", "Y")== "Y" && strlen(LANG_CHARSET)> 0)
        header("Content-Type: text/html; charset=" . LANG_CHARSET);
if(COption::GetOptionString("main", "set_p3p_header", "Y")== "Y")
        header("P3P: policyref=\"/bitrix/p3p.xml\", CP=\"NON DSP COR CUR ADM DEV PSA PSD OUR UNR BUS UNI COM NAV INT DEM STA\"");
 
$LICENSE_KEY = "";
if(file_exists(($_fname = $_SERVER ["DOCUMENT_ROOT"] . BX_ROOT . "/license_key.php")))
        include($_fname);
if($LICENSE_KEY == "" || strtoupper($LICENSE_KEY)== "DEMO")
        define("LICENSE_KEY", "DEMO");
else
        define("LICENSE_KEY", $LICENSE_KEY);
header("X-Powered-CMS: Bitrix Site Manager(" .(LICENSE_KEY == "DEMO" ? "DEMO" : md5("BITRIX" . LICENSE_KEY . "LICENCE")). ")");
define("BX_CRONTAB_SUPPORT", defined("BX_CRONTAB"));
if(COption::GetOptionString("main", "check_agents", "Y")== "Y")
{
        define("START_EXEC_AGENTS_1", microtime());
        $GLOBALS ["BX_STATE"] = "AG";
        $GLOBALS ["DB"]->StartUsingMasterOnly();
        CAgent::CheckAgents();
        $GLOBALS ["DB"]->StopUsingMasterOnly();
        define("START_EXEC_AGENTS_2", microtime());
        $GLOBALS ["BX_STATE"] = "PB";
}
if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security"))
        CSecuritySession::Init();
$GLOBALS ["aHeadersInfo"] = array();
if(headers_sent($hs_file, $hs_line))
        $GLOBALS ["aHeadersInfo"] = array("file" => $hs_file, "line" => $hs_line);
session_start();
foreach(GetModuleEvents("main", "OnPageStart", true)as $arEvent)
        ExecuteModuleEventEx($arEvent);
$GLOBALS ["USER"] = new CUser();
$arPolicy = $GLOBALS ["USER"]->GetSecurityPolicy();
$currTime = time();
if(
        (
        $_SESSION ["SESS_IP"]
         && strlen($arPolicy ["SESSION_IP_MASK"])> 0
         &&(
                (ip2long($arPolicy ["SESSION_IP_MASK"])& ip2long($_SESSION ["SESS_IP"]))
                !=
                (ip2long($arPolicy ["SESSION_IP_MASK"])& ip2long($_SERVER ["REMOTE_ADDR"]))
                )
                )
                ||
        (
                $arPolicy ["SESSION_TIMEOUT"] > 0
                 && $_SESSION ["SESS_TIME"] > 0
                 && $currTime - $arPolicy ["SESSION_TIMEOUT"] * 60 > $_SESSION ["SESS_TIME"]
        )
        ||
        (
                isset($_SESSION ["BX_SESSION_TERMINATE_TIME"])
                 && $_SESSION ["BX_SESSION_TERMINATE_TIME"] > 0
                 && $currTime > $_SESSION ["BX_SESSION_TERMINATE_TIME"]
        )
        ||
(
                isset($_SESSION ["BX_SESSION_SIGN"])
                 && $_SESSION ["BX_SESSION_SIGN"] != bitrix_sess_sign()
        )
        )
        {
        $_SESSION = array();
        @session_destroy();
        if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security"))
                CSecuritySession::Init();
        session_id(md5(uniqid(rand(), true)));
        session_start();
        $GLOBALS ["USER"] = new CUser();
}
$_SESSION ["SESS_IP"] = $_SERVER ["REMOTE_ADDR"];
$_SESSION ["SESS_TIME"] = time();
if(!isset($_SESSION ["BX_SESSION_SIGN"]))
        $_SESSION ["BX_SESSION_SIGN"] = bitrix_sess_sign();
if(
        (COption::GetOptionString("main", "use_session_id_ttl", "N")== "Y")
 &&(COption::GetOptionInt("main", "session_id_ttl", 0)> 0)
 && !defined("BX_SESSION_ID_CHANGE")
)
{
        if(!array_key_exists("SESS_ID_TIME", $_SESSION))
        {
                $_SESSION ["SESS_ID_TIME"] = $_SESSION ["SESS_TIME"];
        }
        elseif(($_SESSION ["SESS_ID_TIME"] + COption::GetOptionInt("main", "session_id_ttl"))< $_SESSION ["SESS_TIME"])
        {
                if(COption::GetOptionString("security", "session", "N")=== "Y" && CModule::IncludeModule("security"))
                {
                        CSecuritySession::UpdateSessID();
                }
                else
                {
                        session_regenerate_id();
                }
                $_SESSION ["SESS_ID_TIME"] = $_SESSION ["SESS_TIME"];
        }
}
define("BX_STARTED", true);
if(isset($_SESSION ["BX_ADMIN_LOAD_AUTH"]))
{
        define("ADMIN_SECTION_LOAD_AUTH", 1);
        unset($_SESSION ["BX_ADMIN_LOAD_AUTH"]);
}
if(!defined("NOT_CHECK_PERMISSIONS")|| NOT_CHECK_PERMISSIONS !== true)
{
        $bLogout = isset($_REQUEST ["logout"]) &&(strtolower($_REQUEST ["logout"])== "yes");
        if($bLogout && $GLOBALS ["USER"]->IsAuthorized())
        {
                $GLOBALS ["USER"]->Logout();
                LocalRedirect($GLOBALS ["APPLICATION"]->GetCurPageParam("", array("logout")));
        }
        $cookie_prefix = COption::GetOptionString("main", "cookie_name", "BITRIX_SM");
        $cookie_login = $_COOKIE [$cookie_prefix . "_LOGIN"];
        $cookie_md5pass = $_COOKIE [$cookie_prefix . "_UIDH"];
        if(COption::GetOptionString("main", "store_password", "Y")== "Y"
        && strlen($cookie_login)> 0
        && strlen($cookie_md5pass)> 0
        && !$GLOBALS ["USER"]->IsAuthorized()
        && !$bLogout
        && $_SESSION ["SESS_PWD_HASH_TESTED"] != md5($cookie_login . "|" . $cookie_md5pass)
        )
        {
                $GLOBALS ["USER"]->LoginByHash($cookie_login, $cookie_md5pass);
                $_SESSION ["SESS_PWD_HASH_TESTED"] = md5($cookie_login . "|" . $cookie_md5pass);
        }
        $arAuthResult = false;
        if(($httpAuth = $GLOBALS ["USER"]->LoginByHttpAuth())!== null)
        {
                $arAuthResult = $httpAuth;
                $GLOBALS ["APPLICATION"]->SetAuthResult($arAuthResult);
        }
        if(isset($_REQUEST ["AUTH_FORM"]) && $_REQUEST ["AUTH_FORM"] != "")
        {
                $bRsaError = false;
                if(COption::GetOptionString("main", "use_encrypted_auth", "N")== "Y")
                {
                        $sec = new CRsaSecurity();
                        if(($arKeys = $sec->LoadKeys()))
                        {
                                $sec->SetKeys($arKeys);
                                $errno = $sec->AcceptFromForm(array("USER_PASSWORD", "USER_CONFIRM_PASSWORD"));
                                if($errno == CRsaSecurity::ERROR_SESS_CHECK)
                                        $arAuthResult = array("MESSAGE" => GetMessage("main_include_decode_pass_sess"), "TYPE" => "ERROR");
                                elseif($errno < 0)
                                        $arAuthResult = array("MESSAGE" => GetMessage("main_include_decode_pass_err", array("#ERRCODE#" => $errno)), "TYPE" => "ERROR");
                                if($errno < 0)
                                        $bRsaError = true;
                        }
                }
                if($bRsaError == false)
                {
                        if(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true)
                                $USER_LID = LANG;
                        else
                                $USER_LID = false;
                        if($_REQUEST ["TYPE"] == "AUTH")
                        {
                                $arAuthResult = $GLOBALS ["USER"]->Login($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_REMEMBER"]);
                                if($arAuthResult === true && defined("ADMIN_SECTION") && ADMIN_SECTION === true)
                                {
                                        $_SESSION ["BX_ADMIN_LOAD_AUTH"] = true;
                                        echo '<script type="text/javascript">window.onload=function(){top.BX.AUTHAGENT.setAuthResult(false);};</script>';
                                        die();
                                }
                        }
                        elseif($_REQUEST ["TYPE"] == "SEND_PWD")
                                $arAuthResult = $GLOBALS ["USER"]->SendPassword($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_EMAIL"], $USER_LID);
                        elseif($_SERVER ["REQUEST_METHOD"] == "POST" && $_REQUEST ["TYPE"] == "CHANGE_PWD")
                                $arAuthResult = $GLOBALS ["USER"]->ChangePassword($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_CHECKWORD"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_CONFIRM_PASSWORD"], $USER_LID);
                        elseif(COption::GetOptionString("main", "new_user_registration", "N")== "Y" && $_SERVER ["REQUEST_METHOD"] == "POST" && $_REQUEST ["TYPE"] == "REGISTRATION" &&(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true))
                                $arAuthResult = $GLOBALS ["USER"]->Register($_REQUEST ["USER_LOGIN"], $_REQUEST ["USER_NAME"], $_REQUEST ["USER_LAST_NAME"], $_REQUEST ["USER_PASSWORD"], $_REQUEST ["USER_CONFIRM_PASSWORD"], $_REQUEST ["USER_EMAIL"], $USER_LID, $_REQUEST ["captcha_word"], $_REQUEST ["captcha_sid"]);
                }
                $GLOBALS ["APPLICATION"]->SetAuthResult($arAuthResult);
        }
        elseif(!$GLOBALS ["USER"]->IsAuthorized())
        {
                $GLOBALS ["USER"]->LoginHitByHash();
        }
}
if(!defined("ADMIN_SECTION")|| ADMIN_SECTION !== true)
{
        if(array_key_exists("bitrix_preview_site_template", $_REQUEST) && $_REQUEST ["bitrix_preview_site_template"] != "" && $GLOBALS ["USER"]->CanDoOperation("view_other_settings"))
        {
                $aTemplates = CSiteTemplate::GetByID($_REQUEST ["bitrix_preview_site_template"]);
                if($template = $aTemplates->Fetch())
                        define("SITE_TEMPLATE_ID", $template ["ID"]);
                else
                        define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
        }
        else
                define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
        define("SITE_TEMPLATE_PATH", BX_PERSONAL_ROOT . "/templates/" . SITE_TEMPLATE_ID);
}
if(isset($_GET ["show_page_exec_time"]))
{
        if($_GET ["show_page_exec_time"] == "Y" || $_GET ["show_page_exec_time"] == "N")
                $_SESSION ["SESS_SHOW_TIME_EXEC"] = $_GET ["show_page_exec_time"];
}
if(isset($_GET ["show_include_exec_time"]))
{
        if($_GET ["show_include_exec_time"] == "Y" || $_GET ["show_include_exec_time"] == "N")
                $_SESSION ["SESS_SHOW_INCLUDE_TIME_EXEC"] = $_GET ["show_include_exec_time"];
}
if(isset($_GET ["bitrix_include_areas"]) && $_GET ["bitrix_include_areas"] != "")
        $GLOBALS ["APPLICATION"]->SetShowIncludeAreas($_GET ["bitrix_include_areas"] == "Y");
if($GLOBALS ["USER"]->IsAuthorized())
{
        $cookie_prefix = COption::GetOptionString("main", "cookie_name", "BITRIX_SM");
        if(!isset($_COOKIE [$cookie_prefix . "_SOUND_LOGIN_PLAYED"]))
                $GLOBALS ["APPLICATION"]->set_cookie("SOUND_LOGIN_PLAYED", "Y", 0);
}
foreach(GetModuleEvents("main", "OnBeforeProlog", true)as $arEvent)
        ExecuteModuleEventEx($arEvent);
if((!defined("NOT_CHECK_PERMISSIONS")|| NOT_CHECK_PERMISSIONS !== true) &&(!defined("NOT_CHECK_FILE_PERMISSIONS")|| NOT_CHECK_FILE_PERMISSIONS !== true))
{
        $real_path = $GLOBALS ["APPLICATION"]->GetCurPage(true);
        if(isset($_SERVER ["REAL_FILE_PATH"]) && $_SERVER ["REAL_FILE_PATH"] != "")
                $real_path = $_SERVER ["REAL_FILE_PATH"];
        if(!$GLOBALS ["USER"]->CanDoFileOperation("fm_view_file", array(SITE_ID, $real_path))||(defined("NEED_AUTH") && NEED_AUTH && !$GLOBALS ["USER"]->IsAuthorized()))
        {
                if($GLOBALS ["USER"]->IsAuthorized() && $arAuthResult ["MESSAGE"] == "")
                        $arAuthResult = array("MESSAGE" => GetMessage("ACCESS_DENIED"). " " . GetMessage("ACCESS_DENIED_FILE", array("#FILE#" => $real_path)), "TYPE" => "ERROR");
                if(defined("ADMIN_SECTION") && ADMIN_SECTION == true)
                {
                        if($_REQUEST ["mode"] == "list" || $_REQUEST ["mode"] == "settings")
                        {
                                echo "<script>top.location='" . $GLOBALS ["APPLICATION"]->GetCurPage(). "?" . DeleteParam(array("mode")). "';</script>";
                                die();
                        }
                        elseif($_REQUEST ["mode"] == "frame")
                        {
                                echo "<script type=\"text/javascript\">
                                        var w =(opener? opener.window:parent.window);
                                        w.location.href='" . $GLOBALS ["APPLICATION"]->GetCurPage(). "?" . DeleteParam(array("mode")). "';
                                </script>";
                                die();
                        }
                        elseif(defined("MOBILE_APP_ADMIN") && MOBILE_APP_ADMIN == true)
                        {
                                echo json_encode(array("status" => "failed"));
                                die();
                        }
                }
                $GLOBALS ["APPLICATION"]->AuthForm($arAuthResult);
        }
}
if(isset($REDIRECT_STATUS) && $REDIRECT_STATUS == 404)
{
        if(COption::GetOptionString("main", "header_200", "N")== "Y")
                CHTTP::SetStatus("200 OK");
}
 

Function Calls

strlen 2
substr 1

Variables

None

Stats

MD5 c8266e56ce4d5289623573d7bde0607c
Eval Count 0
Decode Time 239 ms