function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_seo_keywords", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/seo/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("seo"); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/seo/install/tasks/install.php"; RegisterModuleDependences('main', 'OnPanelCreate', 'seo', 'CSeoEventHandlers', 'SeoOnPanelCreate'); if (COption::GetOptionString('seo', 'searchers_list', '') == '' && CModule::IncludeModule('statistic')) { $arFilter = array('ACTIVE' => 'Y', 'NAME' => 'Google|MSN|Bing', 'NAME_EXACT_MATCH' => 'Y'); if (COption::GetOptionString('main', 'vendor') == '1c_bitrix') { $arFilter['NAME'] .= '|Yandex'; } $strSearchers = ''; $dbRes = CSearcher::GetList($by = 's_id', $order = 'asc', $arFilter, $is_filtered); while ($arRes = $dbRes->Fetch()) { $strSearchers .= ($strSearchers == '' ? '' : ',') . $arRes['ID']; } COption::SetOptionString('seo', 'searchers_list', $strSearchers); } return true; }
/** * Установка модуля */ public function DoInstall() { global $APPLICATION, $step; $this->STEP = $step ? (int) $step : $this->STEP; $stepMessage = ''; switch ($this->STEP) { case 1: $stepMessage = Loc::getMessage('STEP_1'); $APPLICATION->IncludeAdminFile($stepMessage, $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bitrixunittests/install/step1.php'); break; case 2: //устанавливаем корректный путь к тестам $pathToTest = $GLOBALS['UNIT_TESTS_PATH']; if ($pathToTest[0] != '/') { $pathToTest = '/' . $pathToTest; } $pathToTest = $_SERVER['DOCUMENT_ROOT'] . $pathToTest; //установка параметров модуля COption::SetOptionString($this->MODULE_ID, 'UNIT_TESTS_PATH', $pathToTest); RegisterModule($this->MODULE_ID); //копирование файлов и создание таблиц $this->InstallFiles(); $this->installDB(); //заполнение информации о тестах BitrixUnitTestsHelper::getTestList($pathToTest); break; } return true; }
function OnModuleInstalledEvent($id, $installed, $Module) { foreach (GetModuleEvents("main", "OnModuleInstalled", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($id, $installed)); } $cModules = COption::GetOptionString("main", "mp_modules_date", ""); $arModules = array(); if (strlen($cModules) > 0) { $arModules = unserialize($cModules); } if ($installed == "Y") { $arModules[] = array("ID" => $id, "NAME" => htmlspecialcharsbx($Module->MODULE_NAME), "TMS" => time()); if (count($arModules) > 3) { $arModules = array_slice($arModules, -3); } COption::SetOptionString("main", "mp_modules_date", serialize($arModules)); } else { foreach ($arModules as $arid => $val) { if ($val["ID"] == $id) { unset($arModules[$arid]); } } if (count($arModules) > 0) { COption::SetOptionString("main", "mp_modules_date", serialize($arModules)); } else { COption::RemoveOption("main", "mp_modules_date"); } $_SESSION["MP_MOD_DELETED"] = array("ID" => $id, "NAME" => $Module->MODULE_NAME); } }
public function __construct($arDBRecord = false) { parent::__construct($arDBRecord); $DB = CDatabase::GetModuleConnection('statistic'); if (!$arDBRecord) { $country_recs = COption::GetOptionString("statistic", "COUNTRY_INDEX_LOADED", "N"); if ($country_recs !== "Y") { $rs = $DB->Query(CStatistics::DBTopSql("SELECT /*TOP*/ * FROM b_stat_country", 1)); if ($rs->Fetch()) { $country_recs = "Y"; COption::SetOptionString("statistic", "COUNTRY_INDEX_LOADED", "Y"); } } $this->country_avail = $country_recs === "Y"; if ($this->country_avail) { $city_recs = COption::GetOptionString("statistic", "CITY_INDEX_LOADED", "N"); if ($city_recs !== "Y") { $rs = $DB->Query(CStatistics::DBTopSql("SELECT /*TOP*/ * FROM b_stat_city_ip", 1)); if ($rs->Fetch()) { COption::SetOptionString("statistic", "CITY_INDEX_LOADED", "Y"); } } $this->city_avail = COption::GetOptionString("statistic", "CITY_INDEX_LOADED", "N") === "Y"; } $this->is_installed = $this->country_avail; } }
public static function OnPageStart() { if(!defined("PERFMON_STOP")) { $end_time = COption::GetOptionInt("perfmon", "end_time"); if(time() > $end_time) { CPerfomanceKeeper::SetActive(false); if(COption::GetOptionString("perfmon", "total_mark_value", "") == "measure"); COption::SetOptionString("perfmon", "total_mark_value", "calc"); } else { global $DB, $APPLICATION; // define("PERFMON_STARTED", $DB->ShowSqlStat); $DB->ShowSqlStat = true; $APPLICATION->ShowIncludeStat = true; global $perfmonErrors; $perfmonErrors = array(); if(COption::GetOptionString("perfmon", "warning_log") === "Y") set_error_handler("perfmonErrorHandler"); } } }
function InstallDB() { global $DB, $DBType, $APPLICATION; if (!$DB->Query("SELECT 'x' FROM b_medialib_collection", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/install/db/" . $DBType . "/install.sql"); } if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } RegisterModule("fileman"); RegisterModuleDependences("main", "OnGroupDelete", "fileman", "CFileman", "OnGroupDelete"); RegisterModuleDependences("main", "OnPanelCreate", "fileman", "CFileman", "OnPanelCreate"); RegisterModuleDependences("main", "OnModuleUpdate", "fileman", "CFileman", "OnModuleUpdate"); RegisterModuleDependences("main", "OnModuleInstalled", "fileman", "CFileman", "ClearComponentsListCache"); RegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'fileman', 'CIBlockPropertyMapGoogle', 'GetUserTypeDescription'); RegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'fileman', 'CIBlockPropertyMapYandex', 'GetUserTypeDescription'); RegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'fileman', 'CIBlockPropertyVideo', 'GetUserTypeDescription'); RegisterModuleDependences("main", "OnUserTypeBuildList", "fileman", "CUserTypeVideo", "GetUserTypeDescription"); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "fileman", "CEventFileman", "GetAuditTypes"); RegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "fileman", "CEventFileman", "MakeFilemanObject"); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/install/tasks/install.php"; COption::SetOptionString('fileman', "use_editor_3", "Y"); // // Add hotkeys // $hkc = new CHotKeysCode; // $id = $hkc->Add(array( // CLASS_NAME => "admin_file_edit_apply", // CODE => "if(top.AjaxApply && typeof top.AjaxApply == 'function'){top.AjaxApply();}", // NAME => GetMessage("FILEMAN_HOTKEY_TITLE"), // IS_CUSTOM => "0" // )); // CHotKeys::getInstance()->Add(array("KEYS_STRING"=>"Ctrl+83", "CODE_ID"=>$id, "USER_ID" => 0)); //S return true; }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; UnRegisterModuleDependences("main", "OnPageStart", "security", "CSecurityIPRule", "OnPageStart"); UnRegisterModuleDependences("main", "OnBeforeProlog", "security", "CSecurityFilter", "OnBeforeProlog"); UnRegisterModuleDependences("main", "OnEndBufferContent", "security", "CSecurityXSSDetect", "OnEndBufferContent"); UnRegisterModuleDependences("main", "OnBeforeUserLogin", "security", "CSecurityUser", "OnBeforeUserLogin"); UnRegisterModuleDependences("main", "OnUserDelete", "security", "CSecurityUser", "OnUserDelete"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityFilter", "GetAuditTypes"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityAntiVirus", "GetAuditTypes"); UnRegisterModuleDependences("main", "OnBeforeLocalRedirect", "security", "CSecurityRedirect", "BeforeLocalRedirect"); UnRegisterModuleDependences("main", "OnEndBufferContent", "security", "CSecurityRedirect", "EndBufferContent"); UnRegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecurityFilter", "OnAdminInformerInsertItems"); UnRegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecuritySiteChecker", "OnAdminInformerInsertItems"); COption::SetOptionString("main", "session_id_ttl", "60"); COption::SetOptionString("main", "use_session_id_ttl", "N"); COption::SetOptionInt("main", "session_id_ttl", 60); COption::SetOptionString("security", "session", "N"); if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/db/" . strtolower($DB->type) . "/uninstall.sql"); $this->UnInstallTasks(); } UnRegisterModule("security"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function InstallDB($install_wizard = true) { global $DB, $DBType, $APPLICATION; $arCurPhpVer = Explode(".", PhpVersion()); if (IntVal($arCurPhpVer[0]) < 5) { return true; } $errors = null; if (!$DB->Query("SELECT 'x' FROM b_bp_workflow_instance", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/install/db/" . $DBType . "/install.sql"); } if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } RegisterModule("bizproc"); RegisterModuleDependences("iblock", "OnAfterIBlockElementDelete", "bizproc", "CBPVirtualDocument", "OnAfterIBlockElementDelete"); RegisterModuleDependences("main", "OnAdminInformerInsertItems", "bizproc", "CBPAllTaskService", "OnAdminInformerInsertItems"); RegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'bizproc', '\\Bitrix\\Bizproc\\RestService', 'onRestServiceBuildDescription'); RegisterModuleDependences('rest', 'OnRestAppDelete', 'bizproc', '\\Bitrix\\Bizproc\\RestService', 'onRestAppDelete'); RegisterModuleDependences('rest', 'OnRestAppUpdate', 'bizproc', '\\Bitrix\\Bizproc\\RestService', 'onRestAppUpdate'); RegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'bizproc', 'CBPDocument', 'onAfterTMDayStart'); COption::SetOptionString("bizproc", "SkipNonPublicCustomTypes", "Y"); return true; }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_im_chat", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/im/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("im"); RegisterModuleDependences('main', 'OnAddRatingVote', 'im', 'CIMEvent', 'OnAddRatingVote'); RegisterModuleDependences('main', 'OnCancelRatingVote', 'im', 'CIMEvent', 'OnCancelRatingVote'); RegisterModuleDependences('main', 'OnAfterUserUpdate', 'im', 'CIMEvent', 'OnAfterUserUpdate'); RegisterModuleDependences("pull", "OnGetDependentModule", "im", "CIMEvent", "OnGetDependentModule"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/im/ajax_hit.php"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "im", "CIMTableSchema", "OnGetTableSchema"); RegisterModuleDependences("im", "OnGetNotifySchema", "im", "CIMNotifySchema", "OnGetNotifySchema"); CAgent::AddAgent("CIMMail::MailNotifyAgent();", "im", "N", 600); CAgent::AddAgent("CIMMail::MailMessageAgent();", "im", "N", 600); $solution = COption::GetOptionString("main", "wizard_solution", false); if ($solution == 'community') { COption::SetOptionString("im", "path_to_user_profile", '/people/user/#user_id#/'); COption::SetOptionString("im", "path_to_user_lf", '/people/log/'); } CModule::IncludeModule("im"); if (CIMConvert::ConvertCount() > 0) { Cmodule::IncludeModule("im"); CAdminNotify::Add(array("MESSAGE" => GetMessage("IM_CONVERT_MESSAGE", array("#A_TAG_START#" => '<a href="/bitrix/admin/im_convert.php?lang=' . LANGUAGE_ID . '">', "#A_TAG_END#" => "</a>")), "TAG" => "IM_CONVERT", "MODULE_ID" => "IM", "ENABLE_CLOSE" => "Y")); CAgent::AddAgent("CIMConvert::UndeliveredMessageAgent();", "im", "N", 20, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 20, "FULL")); } return true; }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if(!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/pull/install/db/".strtolower($DB->type)."/install.sql"); if($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("pull"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema"); RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); COption::SetOptionString("pull", "path_to_listener", (CMain::IsHTTPS() ? "https" : "http")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/sub/'); COption::SetOptionString("pull", "path_to_websocket", (CMain::IsHTTPS() ? "wss" : "ws")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/subws/'); COption::SetOptionString("pull", "path_to_publish", 'http://127.0.0.1:8895/bitrix/pub/'); COption::SetOptionString("pull", "websocket", 'N'); COption::SetOptionString("pull", "nginx", 'N'); COption::SetOptionString("pull", "push", 'N'); CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL")); return true; }
public function SaveKeys($arKeys) { $privKey = $arKeys["PRIV"]; unset($arKeys["PRIV"]); COption::SetOptionString("main", "~rsa_keys_openssl", serialize($arKeys)); COption::SetOptionString("main", "~rsa_key_pem", $privKey); }
function GetConfig($siteId = false) { $shopLocationId = CSaleHelper::getShopLocationId($siteId); $arShopLocation = CSaleHelper::getLocationByIdHitCached($shopLocationId); if (!$arShopLocation) { $arShopLocation = array(); } $shopPrevLocationId = COption::GetOptionString('sale', 'delivery_rus_post_first_prev_loc', 0); /* if shop's location was changed */ if ($shopPrevLocationId != $shopLocationId) { COption::SetOptionString('sale', 'delivery_rus_post_first_prev_loc', $shopLocationId); COption::RemoveOption('sale', 'delivery_rus_post_first_tarifs'); } $arConfig = array('CONFIG_GROUPS' => array('wrapper' => GetMessage('SALE_DH_RPF_WRP_TITLE'))); $aviableBoxes = self::getAviableBoxes(); foreach ($aviableBoxes as $boxId => $arBox) { CSaleDeliveryHelper::makeBoxConfig($boxId, $arBox, 'wrapper', $arConfig); } $arConfig['CONFIG']['tarif_section_1'] = array('TYPE' => 'SECTION', 'TITLE' => GetMessage('SALE_DH_RPF_TARIFS'), 'GROUP' => 'wrapper'); $arTarifs = CSaleHelper::getOptionOrImportValues('delivery_rus_post_first_tarifs', array('CDeliveryRusPostFirst', 'getTarifsByRegionFromCsv'), array($arShopLocation)); foreach (self::$TARIFS as $arTarif) { $tarifId = $arTarif[self::$TARIF_IDX]; $arConfig['CONFIG']['TARIF_' . $tarifId] = array('TYPE' => 'STRING', 'DEFAULT' => isset($arTarifs[$tarifId]) ? $arTarifs[$tarifId] : '0', 'TITLE' => $arTarif[self::$TARIF_DESCR], 'GROUP' => 'wrapper'); } /* Additional services */ foreach (self::$SERVICES as $serviceId => $arService) { $tarifId = $arService[self::$TARIF_IDX]; $arConfig['CONFIG']['service_' . $tarifId . '_section'] = array('TYPE' => 'SECTION', 'TITLE' => $arService[self::$TARIF_DESCR], 'GROUP' => 'wrapper'); $arConfig['CONFIG']['service_' . $tarifId . '_enabled'] = array('TYPE' => 'CHECKBOX', 'TITLE' => GetMessage('SALE_DH_RPF_SRV_ALLOW'), 'GROUP' => 'wrapper', 'DEFAULT' => $serviceId == 'NOTIFICATION_REG' ? 'N' : 'Y', 'HIDE_BY_NAMES' => array('service_' . $tarifId . '_value')); $arConfig['CONFIG']['service_' . $tarifId . '_value'] = array('TYPE' => 'STRING', 'TITLE' => GetMessage('SALE_DH_RPF_SRV_PRICE'), 'GROUP' => 'wrapper', 'DEFAULT' => isset($arTarifs[$tarifId]) ? $arTarifs[$tarifId] : '0'); } return $arConfig; }
function InstallOptions(){ $rSites = CSite::GetList($by="sort", $order="desc", array() ); while( $aSite = $rSites->Fetch() ){ $aSites[$aSite['NAME'].' '.$aSite['ID']] = $aSite['ID']; }; COption::SetOptionString('tagsmanager', 'SITE_ID', implode( ',',$aSites )); return true; }
function OnPostForm() { $wizard =& $this->GetWizard(); if ($wizard->IsNextButtonClick()) { COption::SetOptionString("main", "site_personal_name", str_replace(array("<"), array("<"), $wizard->GetVar("siteName"))); COption::SetOptionString("main", "site_copyright", str_replace(array("<"), array("<"), $wizard->GetVar("copyright"))); } }
function InstallDB() { COption::SetOptionString('wiki', 'GROUP_DEFAULT_RIGHT', 'R'); RegisterModule('wiki'); RegisterModuleDependences('main', 'OnAddRatingVote', 'wiki', 'CRatingsComponentsWiki', 'OnAddRatingVote', 200); RegisterModuleDependences('main', 'OnCancelRatingVote', 'wiki', 'CRatingsComponentsWiki', 'OnCancelRatingVote', 200); RegisterModuleDependences('search', 'BeforeIndex', 'wiki', 'CRatingsComponentsWiki', 'BeforeIndex'); return true; }
public function Authorize() { $GLOBALS["APPLICATION"]->RestartBuffer(); $bSuccess = 1; $appID = trim(self::GetOption("twitter_key")); $appSecret = trim(self::GetOption("twitter_secret")); if (!isset($_REQUEST["oauth_token"]) || $_REQUEST["oauth_token"] == '') { $tw = new CTwitterInterface($appID, $appSecret); $callback = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID); //$callback = 'http://algerman.sam:6448/script.php?auth_service_id='.self::ID; if ($tw->GetRequestToken($callback)) { $tw->RedirectAuthUrl(); } } elseif (CSocServAuthManager::CheckUniqueKey()) { $tw = new CTwitterInterface($appID, $appSecret, $_REQUEST["oauth_token"], $_REQUEST["oauth_verifier"]); if (($arResult = $tw->GetAccessToken()) !== false && $arResult["user_id"] != '') { $twUser = $tw->GetUserInfo($arResult["user_id"]); $first_name = $last_name = ""; if ($twUser["name"] != '') { $aName = explode(" ", $twUser["name"]); $first_name = $aName[0]; if (isset($aName[1])) { $last_name = $aName[1]; } } $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arResult["user_id"], 'LOGIN' => $arResult["screen_name"], 'NAME' => $first_name, 'LAST_NAME' => $last_name); if (isset($twUser["profile_image_url"]) && self::CheckPhotoURI($twUser["profile_image_url"])) { if ($arPic = CFile::MakeFileArray($twUser["profile_image_url"])) { $arFields["PERSONAL_PHOTO"] = $arPic; } } $arFields["PERSONAL_WWW"] = "https://twitter.com/" . $arResult["screen_name"]; if (strlen(SITE_ID) > 0) { $arFields["SITE_ID"] = SITE_ID; } if (COption::GetOptionString('socialservices', 'last_twit_id', '1') == 1) { if (isset($twUser["status"]["id_str"])) { COption::SetOptionString('socialservices', 'last_twit_id', $twUser["status"]["id_str"]); } } $bSuccess = $this->AuthorizeUser($arFields); } } $aRemove = array("logout", "auth_service_error", "auth_service_id", "oauth_token", "oauth_verifier", "check_key", "current_fieldset"); $url = $GLOBALS['APPLICATION']->GetCurPageParam($bSuccess === true ? '' : 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove); if (CModule::IncludeModule("socialnetwork")) { $url = preg_match("/\\?/", $url) ? $url . "¤t_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV"; } echo ' <script type="text/javascript"> if(window.opener) window.opener.location = \'' . CUtil::JSEscape($url) . '\'; window.close(); </script> '; die; }
public static function enableCloseDateSync($enable) { $enable = (bool) $enable; if ($enable) { \COption::RemoveOption('crm', 'enable_close_date_sync'); } else { \COption::SetOptionString('crm', 'enable_close_date_sync', 'N'); } }
public static function enableSignature($enable) { $enable = (bool) $enable; if ($enable) { \COption::RemoveOption('crm', 'enable_b24_email_sign'); } else { \COption::SetOptionString('crm', 'enable_b24_email_sign', 'N'); } }
function InstallDB($install_wizard = true) { global $DB, $DBType, $APPLICATION, $install_smiles; if (!$DB->Query("SELECT 'x' FROM b_blog_user_group", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/blog/install/" . $DBType . "/install.sql"); COption::SetOptionString("blog", "socNetNewPerms", "Y"); } if (empty($errors)) { $errors = $this->InstallUserFields(); } if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } RegisterModule("blog"); RegisterModuleDependences("search", "OnReindex", "blog", "CBlogSearch", "OnSearchReindex"); RegisterModuleDependences("main", "OnUserDelete", "blog", "CBlogUser", "Delete"); RegisterModuleDependences("main", "OnSiteDelete", "blog", "CBlogSitePath", "DeleteBySiteID"); RegisterModuleDependences("socialnetwork", "OnSocNetGroupDelete", "blog", "CBlogSoNetPost", "OnGroupDelete"); RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesAdd", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch"); RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesUpdate", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch"); RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsAdd", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch"); RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsUpdate", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch"); RegisterModuleDependences("main", "OnAfterAddRating", "blog", "CRatingsComponentsBlog", "OnAfterAddRating", 200); RegisterModuleDependences("main", "OnAfterUpdateRating", "blog", "CRatingsComponentsBlog", "OnAfterUpdateRating", 200); RegisterModuleDependences("main", "OnSetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnSetRatingConfigs", 200); RegisterModuleDependences("main", "OnGetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnGetRatingConfigs", 200); RegisterModuleDependences("main", "OnGetRatingsObjects", "blog", "CRatingsComponentsBlog", "OnGetRatingObject", 200); RegisterModuleDependences("main", "OnGetRatingContentOwner", "blog", "CRatingsComponentsBlog", "OnGetRatingContentOwner", 200); RegisterModuleDependences("im", "OnGetNotifySchema", "blog", "CBlogNotifySchema", "OnGetNotifySchema"); CModule::IncludeModule("blog"); if (CModule::IncludeModule("search")) { CSearch::ReIndexModule("blog"); } if ($install_smiles == "Y" || $install_wizard) { $dbSmile = CBlogSmile::GetList(); if (!$dbSmile->Fetch()) { $arSmile = array(array("TYPING" => ":D :-D", "IMAGE" => "icon_biggrin.png", "FICON_SMILE" => "FICON_BIGGRIN", "SORT" => "120"), array("TYPING" => ":) :-)", "IMAGE" => "icon_smile.png", "FICON_SMILE" => "FICON_SMILE", "SORT" => "100"), array("TYPING" => ":( :-(", "IMAGE" => "icon_sad.png", "FICON_SMILE" => "FICON_SAD", "SORT" => "140"), array("TYPING" => ":o :-o :shock:", "IMAGE" => "icon_eek.png", "FICON_SMILE" => "FICON_EEK", "SORT" => "180"), array("TYPING" => "8) 8-)", "IMAGE" => "icon_cool.png", "FICON_SMILE" => "FICON_COOL", "SORT" => "130"), array("TYPING" => ":{} :-{}", "IMAGE" => "icon_kiss.png", "FICON_SMILE" => "FICON_KISS", "SORT" => "200"), array("TYPING" => ":oops:", "IMAGE" => "icon_redface.png", "FICON_SMILE" => "FICON_REDFACE", "SORT" => "190"), array("TYPING" => ":cry: :~(", "IMAGE" => "icon_cry.png", "FICON_SMILE" => "FICON_CRY", "SORT" => "160"), array("TYPING" => ":evil: >:-<", "IMAGE" => "icon_evil.png", "FICON_SMILE" => "FICON_EVIL", "SORT" => "170"), array("TYPING" => ";) ;-)", "IMAGE" => "icon_wink.png", "FICON_SMILE" => "FICON_WINK", "SORT" => "110"), array("TYPING" => ":!:", "IMAGE" => "icon_exclaim.png", "FICON_SMILE" => "FICON_EXCLAIM", "SORT" => "220"), array("TYPING" => ":?:", "IMAGE" => "icon_question.png", "FICON_SMILE" => "FICON_QUESTION", "SORT" => "210"), array("TYPING" => ":idea:", "IMAGE" => "icon_idea.png", "FICON_SMILE" => "FICON_IDEA", "SORT" => "230"), array("TYPING" => ":| :-|", "IMAGE" => "icon_neutral.png", "FICON_SMILE" => "FICON_NEUTRAL", "SORT" => "150")); $arLang = array(); $dbLangs = CLanguage::GetList($b = "", $o = "", array("ACTIVE" => "Y")); while ($arLangs = $dbLangs->Fetch()) { IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/blog/install/smiles.php", $arLangs["LID"]); foreach ($arSmile as $key => $val) { $arSmile[$key]["LANG"][] = array("LID" => $arLangs["LID"], "NAME" => GetMessage($val["FICON_SMILE"])); } } foreach ($arSmile as $val) { $val["SMILE_TYPE"] = "S"; $val["CLICKABLE"] = "Y"; $val["IMAGE_WIDTH"] = 16; $val["IMAGE_HEIGHT"] = 16; $id = CBlogSmile::Add($val); } } } return true; }
public function set($key, $value = null) { if (is_array($key)) { foreach ($key as $k => $v) { $this->set($k, $v); } } elseif (in_array($key, $this->_props)) { COption::SetOptionString('smartpolis', $key, serialize($value)); } }
function InstallDB() { global $DB, $DBType, $APPLICATION; $this->errors = false; RegisterModule("rficb.payment"); $arOptions = array("key", "secret_key"); foreach ($arOptions as $name) { COption::SetOptionString("rficb.payment", $name, $_REQUEST[$name], ""); } return true; }
function InstallDB() { COption::SetOptionString('wiki', 'GROUP_DEFAULT_RIGHT', 'R'); RegisterModule('wiki'); RegisterModuleDependences('main', 'OnAddRatingVote', 'wiki', 'CRatingsComponentsWiki', 'OnAddRatingVote', 200); RegisterModuleDependences('main', 'OnCancelRatingVote', 'wiki', 'CRatingsComponentsWiki', 'OnCancelRatingVote', 200); RegisterModuleDependences('search', 'BeforeIndex', 'wiki', 'CRatingsComponentsWiki', 'BeforeIndex'); RegisterModuleDependences('socialnetwork', 'BeforeIndexSocNet', 'wiki', 'CWikiSocNet', 'BeforeIndexSocNet'); RegisterModuleDependences("im", "OnGetNotifySchema", "wiki", "CWikiNotifySchema", "OnGetNotifySchema"); return true; }
function InstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (is_object($GLOBALS['CACHE_MANAGER'])) { $GLOBALS['CACHE_MANAGER']->CleanDir('/learning/LessonTreeComponent/'); $GLOBALS['CACHE_MANAGER']->CleanDir('/learning/coursetolessonmap/'); $GLOBALS['CACHE_MANAGER']->CleanDir('/learning/'); } // Database tables creation // was: if(!$DB->Query("SELECT 'x' FROM b_learn_course WHERE 1=0", true)) if (!$DB->TableExists('b_learn_lesson')) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/db/" . strtolower($DB->type) . "/install.sql"); if ($this->errors === false) { $rc = self::InitializeNewRightsModel(); if ($rc === false) { $this->errors = 'FATAL: new rights model init failed'; } } // Mark that DB converted to new format COption::SetOptionString('learning', '~LearnInstall201203ConvertDB::_IsAlreadyConverted', 1); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } else { RegisterModule("learning"); RegisterModuleDependences("main", "OnGroupDelete", "learning", "CCourse", "OnGroupDelete"); RegisterModuleDependences("main", "OnBeforeLangDelete", "learning", "CCourse", "OnBeforeLangDelete"); RegisterModuleDependences("main", "OnUserDelete", "learning", "CCourse", "OnUserDelete"); RegisterModuleDependences("main", "OnSiteDelete", "learning", "CSitePath", "DeleteBySiteID"); RegisterModuleDependences("search", "OnReindex", "learning", "CCourse", "OnSearchReindex"); RegisterModuleDependences("main", "OnGetRatingContentOwner", "learning", "CRatingsComponentsLearning", "OnGetRatingContentOwner", 200); RegisterModuleDependences("main", "OnAddRatingVote", "learning", "CRatingsComponentsLearning", "OnAddRatingVote", 200); RegisterModuleDependences("main", "OnCancelRatingVote", "learning", "CRatingsComponentsLearning", "OnCancelRatingVote", 200); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "learning", "CLearningEvent", "GetAuditTypes"); RegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "learning", "CLearningEvent", "MakeMainObject"); RegisterModuleDependences("learning", "OnAfterLearningGroupDelete", "learning", "CLearningGroupMember", "onAfterLearningGroupDelete"); RegisterModuleDependences("learning", "OnAfterLearningGroupDelete", "learning", "CLearningGroupLesson", "onAfterLearningGroupDelete"); if ($DB->Query("SELECT 'x' FROM b_learn_site_path WHERE 1=0", true)) { $sites = CLang::GetList($by, $order, array("ACTIVE" => "Y")); while ($site = $sites->Fetch()) { $path = "/learning/"; if ($_REQUEST["copy_" . $site["LID"]] == "Y" && !empty($_REQUEST["path_" . $site["LID"]])) { $path = $_REQUEST["path_" . $site["LID"]]; } $DB->Query("INSERT INTO b_learn_site_path(ID, SITE_ID, PATH,TYPE) \n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(NULL , '" . $site["LID"] . "', '" . $path . "course/index.php?COURSE_ID=#COURSE_ID#&INDEX=Y', 'C'),\n\t\t\t\t\t\t(NULL , '" . $site["LID"] . "', '" . $path . "course/index.php?COURSE_ID=#COURSE_ID#&CHAPTER_ID=#CHAPTER_ID#', 'H'),\n\t\t\t\t\t\t(NULL , '" . $site["LID"] . "', '" . $path . "course/index.php?COURSE_ID=#COURSE_ID#&LESSON_ID=#LESSON_ID#', 'L'),\n\t\t\t\t\t\t(NULL , '" . $site["LID"] . "', '" . $path . "course/index.php?LESSON_PATH=#LESSON_PATH#', 'U')", true); } } return true; } }
private function SaveGroupRight() { CMain::DelGroupRight($this->module_id); $GROUP = $_REQUEST['GROUPS']; $RIGHT = $_REQUEST['RIGHTS']; foreach ($GROUP as $k => $v) { if ($k == 0) { COption::SetOptionString($this->module_id, 'GROUP_DEFAULT_RIGHT', $RIGHT[0], 'Right for groups by default'); } else { CMain::SetGroupRight($this->module_id, $GROUP[$k], $RIGHT[$k]); } } }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_seo_search_engine", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/seo/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("seo"); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/seo/install/tasks/install.php"; $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandler('main', 'OnPanelCreate', 'seo', 'CSeoEventHandlers', 'SeoOnPanelCreate'); if (COption::GetOptionString('main', 'vendor', '') == '1c_bitrix') { $eventManager->registerEventHandler("fileman", "OnIncludeHTMLEditorScript", "seo", "CSeoEventHandlers", "OnIncludeHTMLEditorScript"); $eventManager->registerEventHandler("fileman", "OnBeforeHTMLEditorScriptRuns", "seo", "CSeoEventHandlers", "OnBeforeHTMLEditorScriptRuns"); } $eventManager->registerEventHandler("iblock", "OnAfterIBlockSectionAdd", "seo", "\\Bitrix\\Seo\\SitemapIblock", "addSection"); $eventManager->registerEventHandler("iblock", "OnAfterIBlockElementAdd", "seo", "\\Bitrix\\Seo\\SitemapIblock", "addElement"); $eventManager->registerEventHandler("iblock", "OnBeforeIBlockSectionDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeDeleteSection"); $eventManager->registerEventHandler("iblock", "OnBeforeIBlockElementDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeDeleteElement"); $eventManager->registerEventHandler("iblock", "OnAfterIBlockSectionDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "deleteSection"); $eventManager->registerEventHandler("iblock", "OnAfterIBlockElementDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "deleteElement"); $eventManager->registerEventHandler("iblock", "OnBeforeIBlockSectionUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeUpdateSection"); $eventManager->registerEventHandler("iblock", "OnBeforeIBlockElementUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeUpdateElement"); $eventManager->registerEventHandler("iblock", "OnAfterIBlockSectionUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "updateSection"); $eventManager->registerEventHandler("iblock", "OnAfterIBlockElementUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "updateElement"); $eventManager->registerEventHandler("forum", "onAfterTopicAdd", "seo", "\\Bitrix\\Seo\\SitemapForum", "addTopic"); $eventManager->registerEventHandler("forum", "onAfterTopicUpdate", "seo", "\\Bitrix\\Seo\\SitemapForum", "updateTopic"); $eventManager->registerEventHandler("forum", "onAfterTopicDelete", "seo", "\\Bitrix\\Seo\\SitemapForum", "deleteTopic"); $eventManager->registerEventHandler("main", "OnAdminIBlockElementEdit", "seo", "\\Bitrix\\Seo\\AdvTabEngine", "eventHandler"); $eventManager->registerEventHandler("main", "OnBeforeProlog", "seo", "\\Bitrix\\Seo\\AdvSession", "checkSession"); if (COption::GetOptionString('seo', 'searchers_list', '') == '' && CModule::IncludeModule('statistic')) { $arFilter = array('ACTIVE' => 'Y', 'NAME' => 'Google|MSN|Bing', 'NAME_EXACT_MATCH' => 'Y'); if (COption::GetOptionString('main', 'vendor') == '1c_bitrix') { $arFilter['NAME'] .= '|Yandex'; } $strSearchers = ''; $is_filtered = false; $dbRes = CSearcher::GetList($by = 's_id', $order = 'asc', $arFilter, $is_filtered); while ($arRes = $dbRes->Fetch()) { $strSearchers .= ($strSearchers == '' ? '' : ',') . $arRes['ID']; } COption::SetOptionString('seo', 'searchers_list', $strSearchers); } \CAgent::AddAgent("Bitrix\\Seo\\Engine\\YandexDirect::updateAgent();", "seo", "N", 3600); \CAgent::AddAgent("Bitrix\\Seo\\Adv\\LogTable::clean();", "seo", "N", 86400); return true; }
function CheckMenuAdminItems(&$adminFavoriteOption, $arMenuItemsId) { if (is_array($adminFavoriteOption) && !empty($adminFavoriteOption)) { $isChanged = false; foreach ($adminFavoriteOption as $itemID) { if (!in_array($itemID, $arMenuItemsId)) { $key = array_search($itemID, $adminFavoriteOption); unset($adminFavoriteOption[$key]); $isChanged = true; } } if ($isChanged && $GLOBALS['USER']->CanDoOperation('bitrix24_config')) { COption::SetOptionString("bitrix24", "admin_menu_items", serialize($adminFavoriteOption), false, SITE_ID); } } }
function ExecuteEvents() { $err_mess = "<br>Class: CEvent<br>File: " . __FILE__ . "<br>Function: CheckEvents<br>Line: "; global $DB, $CACHE_MANAGER; if (defined("BX_FORK_AGENTS_AND_EVENTS_FUNCTION")) { if (CMain::ForkActions(array("CEvent", "ExecuteEvents"))) { return ""; } } $uniq = COption::GetOptionString("main", "server_uniq_id", ""); if (strlen($uniq) <= 0) { $uniq = md5(uniqid(rand(), true)); COption::SetOptionString("main", "server_uniq_id", $uniq); } $bulk = intval(COption::GetOptionString("main", "mail_event_bulk", 5)); if ($bulk <= 0) { $bulk = 5; } $strSql = "SELECT 'x' " . "FROM b_event " . "WHERE SUCCESS_EXEC='N' " . "LIMIT 1"; $db_result_event = $DB->Query($strSql); if ($db_result_event->Fetch()) { $db_lock = $DB->Query("SELECT GET_LOCK('" . $uniq . "_event', 0) as L"); $ar_lock = $db_lock->Fetch(); if ($ar_lock["L"] == "0") { return ""; } } else { if (CACHED_b_event !== false) { $CACHE_MANAGER->Set("events", true); } return ""; } $strSql = "\n\t\t\tSELECT ID, C_FIELDS, EVENT_NAME, MESSAGE_ID, LID, DATE_FORMAT(DATE_INSERT, '%d.%m.%Y %H:%i:%s') as DATE_INSERT, DUPLICATE\n\t\t\tFROM b_event\n\t\t\tWHERE SUCCESS_EXEC='N'\n\t\t\tORDER BY ID\n\t\t\tLIMIT " . $bulk; $rsMails = $DB->Query($strSql); while ($arMail = $rsMails->Fetch()) { $flag = CEvent::HandleEvent($arMail); /* '0' - нет шаблонов (не нужно было ничего отправл¤ть) 'Y' - все отправлены 'F' - все не смогли быть отправлены 'P' - частично отправлены */ $strSql = "\n\t\t\t\tUPDATE b_event SET\n\t\t\t\t\tDATE_EXEC = now(),\n\t\t\t\t\tSUCCESS_EXEC = '{$flag}'\n\t\t\t\tWHERE\n\t\t\t\t\tID = " . $arMail["ID"]; $DB->Query($strSql, false, $err_mess . __LINE__); } $DB->Query("SELECT RELEASE_LOCK('" . $uniq . "_event')"); }
function OnBeforeProlog() { $optionJquery = COption::GetOptionString("scrollup.bxd", "SBXD_JQUERY", "false"); $tmpOptionsArray = array('js' => '/bitrix/js/scrollup.bxd/script.min.js', 'css' => '/bitrix/themes/.default/scrollup.bxd.min.css'); if ($optionJquery == "true") { $tmpOptionsArray['rel'] = array('jquery'); } CJSCore::RegisterExt('bxd', $tmpOptionsArray); CJSCore::RegisterExt('bxd_css', array('css' => '/bitrix/themes/.default/scrollup.bxd.min.css')); if (defined('ADMIN_SECTION')) { CJSCore::Init(array('bxd_css')); } if ($GLOBALS['APPLICATION']->GetCurPage() == '/bitrix/admin/scrollup.bxd_bxd_admin.php' && !empty($_POST)) { COption::SetOptionString("scrollup.bxd", "SBXD_JQUERY", $_POST["SBXD_JQUERY"]); COption::SetOptionString("scrollup.bxd", "SBXD_GROUPS", implode(",", $_POST["SBXD_GROUPS"])); } }
public static function setFormatID($formatID) { if (!is_int($formatID)) { throw new Main\ArgumentTypeException('formatID', 'integer'); } if (!self::isDefined($formatID)) { return false; } self::$formatID = $formatID; self::$formatString = null; if ($formatID !== self::Dflt) { return \COption::SetOptionString('crm', 'prsn_nm_frmt_id', $formatID); } // Do not store default format ID \COption::RemoveOption('crm', 'prsn_nm_frmt_id'); return true; }
public function getResult($arParams = array()) { $ID = $_REQUEST['AJAX'] == "Y" ? $_REQUEST['ID'] : $arParams['ID']; $stOptions = COption::GetOptionString(self::$module_id, $ID); $arOptions = $stOptions != '' ? unserialize($stOptions) : array(); $uPWD = md5($_REQUEST['PR_PWD']); $arResult = array( 'status' => '', 'result' => '', ); if((count(array_diff($arParams, $arOptions)) > 0 OR count($arOptions) == 0) AND $_REQUEST['AJAX'] != "Y") { $arOptions = $arParams; COption::SetOptionString(self::$module_id, $ID, serialize($arOptions)); } if($_REQUEST['PR_PWD'] AND $uPWD != $arOptions["PWD"]) { $arResult = array( 'status' => false, 'result' => $arOptions['ERROR'], ); } if($uPWD == $arOptions["PWD"]) { require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); ob_start(); include($_SERVER['DOCUMENT_ROOT'].SITE_DIR.$arOptions["FILE"]); $ob_get = ob_get_contents(); ob_clean(); ob_end_clean(); $arResult = array( 'status' => true, 'result' => $ob_get, ); } if($_REQUEST['AJAX'] == "Y") return CUtil::PhpToJSObject($arResult); return $arResult; }